[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 335
Thread images: 29

File: Homura_DPT_rust.jpg (128KB, 563x712px) Image search: [Google]
Homura_DPT_rust.jpg
128KB, 563x712px
Old thread: >>56783867

What are you working on /g/?
>>
Trying to solve this problem on hackerrank:
https://www.hackerrank.com/challenges/simple-text-editor

But I'm timing out on test cases w/ 1 million inputs, would love some feedback
on how to speed this up:

import std.conv, std.algorithm, std.string, std.stdio;


void main() {
auto stack = new Stack;
int opCount = to!int(strip(stdin.readln()));
foreach (_; 0 .. opCount) {
string[] inputs = split(strip(stdin.readln()));
int opType = to!int(inputs[0]);
if (opType == 1) {
stack.push(inputs[1]);
} else if (opType == 2) {
stack.pop(to!int(inputs[1]));
} else if (opType == 3) {
(stack.get(to!int(inputs[1])));
} else if (opType == 4) {
stack.undo();
}
}
}


class Stack {
private string data;
private int[] ops;
private string[] deleted;
private size_t[] appended;
this() {
data = [];
}
public void push(string value) {
ops ~= 1;
appended ~= value.length;
data ~= value;
}
public void pop(int i = 1) {
ops ~= 2;
deleted ~= data[$ - i .. $];
data = data[0 .. $ - i];
}
public char get(int charNumber) {
return data[charNumber - 1];
}
public void undo() {
int lastOp = ops[$ - 1];
ops = ops[0 .. $ - 1];
if (lastOp == 1) {
size_t appendLength = appended[$ - 1];
appended = appended[0 .. $ - 1];
data = data[0 .. $ - appendLength];
} else {
string deletedString = deleted[$ - 1];
deleted = deleted[0 .. $ - 1];
data ~= deletedString;
}
}
}
>>
File: anal beads.png (12KB, 305x311px) Image search: [Google]
anal beads.png
12KB, 305x311px
>>56790078
Thank you.

I'm going to potentially add a GUI to my racial slur generator today, and add more functionality.
>>
>>56790119
Is that D?
>>
>>56790127
>racial slur generator
who did bring this idea up?
been browsing too much /pol/ lately?
>>
>>56790138
Yup - don't hate, I just like to learn new languages.
>>
anime babes are the best...
>>
>>56790143
It was mostly because one anon couldn't figure how how to get a list of demonyms, and had only like 20 of them hard-coded.

I wanted to do something with demonyms as a test-case, and this just so happened to be a quick and easy showcase of that. Also, I haven't had much practice with web-scraping, so I did the slur half with that, as I couldn't find an API for racial slurs.

I was planning on showing him source if he showed up again.
>>
>>56790187
i remember an anon trying to make a racial slur generator ... he got insulted that his program is "worthy of /pol/" afaik :p
>>
File: 1379272606191.jpg (18KB, 512x384px) Image search: [Google]
1379272606191.jpg
18KB, 512x384px
>>56790200
> :p
Get the fuck out.
>>
>>56790200
It was worthy of /pol/ because it was a half-assed piece of shit, not because it had racism.

4chan has always had a culture of light-hearted racist banter.
>>
>>56790208
p:
>>
>>56790078
Just finished a distributed chat server for uni. Java is alright, a bit boring though.
>>
>>56790187
can you show me the source code? how did you implement the demonym list?
>>
so ... why do we need command line arguments again?
>>
>>56790236
It's a fairly simple API pull from https://restcountries.eu

There's probably a more concise way to do it, so I'll try to clean it up and repost:

var demonyms = new List<string>();

var url = "https://restcountries.eu/rest/v1/all";
var request = WebRequest.Create(url);

using (Stream s = request.GetResponse().GetResponseStream())
{
using (StreamReader sr = new StreamReader(s))
{
var jsonResponse = sr.ReadToEnd();

var json = JArray.Parse(jsonResponse);

demonyms = json
.Select(x => (string)x["demonym"])
.Where(x => x.Length > 1)
.ToList();
}
}
>>
>>56790287
To pass arguments to your program, of course.
How else do you propose that people do that?
>>
>>56790302
1. start program
2. standard cin / cout ?
>>
>>56790307
Now trying doing that on 300 computers at once.
>>
>>56790287
why do we need arguments to functions?
>>
>>56790307
1. C++ streams are pure trash, as is the rest of the language. It's stdin. stdout, and stderr or file descriptor 0, 1 and 2 if you want to be "Unix-y".
2. It's a pain in the ass
3. Many programs use stdin/stdout for other purposes.
>>
>>56790236
>>56790289
Here's a shorter version that works just as well:
var demonyms = new List<string>();

var url = "https://restcountries.eu/rest/v1/all";

using (var client = new HttpClient())
{
var response = await client.GetAsync(url);
var result = await response.Content.ReadAsStringAsync();
var json = JArray.Parse(result);

demonyms = json
.Select(x => (string)x["demonym"])
.Where(x => x.Length > 1)
.ToList();
}
>>
File: Wieso.gif (2MB, 250x249px) Image search: [Google]
Wieso.gif
2MB, 250x249px
>more and more programming tutorials in fucking HINDI, with comments in HINDI
>>
File: dpt 13.png (244KB, 1920x1080px) Image search: [Google]
dpt 13.png
244KB, 1920x1080px
makes you think...
>>
What's the best way to set up a project so it can be easily built on both Windows and Linux?
>>
>>56790351
Depends on the language.
>>
>>56790351
cmake
>>
>>56790351
Build it on Mono.

I'm not entirely sure what you're asking. It depends on what you're doing and the language.
>>
>>56790316
You don't even need functions, look at register machines, they can do anything your precious functions can.
>>
>>56790307
Describe running
gcc -Wall -pedantic -o foo foo.c -l bar
with this cin/cout method
>>
>>56790358
C and a scheme

>>56790365
I'm not using .NET though

>>56790364
*cries*
>>
>>56790388
No idea about scheme but if your C program is small you could just do a unitybuild.
>>
>open document
>300 lines of code are commented out

What should I do? Just delete it? This code probably hasn't been run in years, surely no one needs it.
>>
>>56790491
Stick that shit in your vcs w/ a tag in case you ever need it first.
>>
>>56790491
if you want to get fired sure just delete it
>>
>>56790497
>>56790507
It is already in version control, so we could go back and grab whatever piece we need, I would think.
>>
>>56790491
>This code probably hasn't been run in years
>probably
How about your lazy ass checks when it was commented out?
>>
>>56790547
Two years and two months ago.
>>
What's the best way to compile a c++ programming using g++ I was using -o2 is that good?
>>
>>56790559
I think using g++ is a very good idea.
>>
>>56790559
>best way to compile a c++ programming
just end it
>>
File: not a statement.png (66KB, 1227x720px) Image search: [Google]
not a statement.png
66KB, 1227x720px
can someone explain me why the fuck this isnt a statement?
>>
>>56790559
-O2 -std=c++14 -pedantic-errors
>>
>>56790633
You put the verb first and ended it with a question mark, so it's a question, not a statement.
>>
>>56790645
-Wall -Werror
>>
>>56790633
try surrounding it with { and }
>>
>>56790633
Missing braces
>>
>>56790555
You cold go the save route and talk to whoever commented it out, but 2y and 2m seems pretty save to delete.

>>56790647
kek
>>
>>56790633
This is exactly why you should almost always use braces on every control statement.
>>
>>56790698
>talk to whoever commented it out
They got fired.

Fuck it, I'm going to put it on a text file with an undescriptive name and stick it somewhere deep and dark on the NAS.
>>
How is Ubuntu so cucked? It has Eclipse 3.8 in the repository while the latest version is 4.6 or something. This distro is the worst.
>>
>>56790803
Nobody ever said Ubuntu packages would be bleeding edge.

If you wanted bleeding edge then you should have chosen a different distro.
>>
>>56790803
Only a handful of packages are maintained by Ubuntu developers. The rest is synchronized periodically from Debian, every 6 months.
But the jump from 3.8 to 4.6 seems huge even for 6 months, anyone know what version the debian package manager is on?
>>
>>56790865
Why don't you check yourself?
>>
do i really need to master linked lists in c++, if i am not a game developer?

i cannot think of a situation where i have to add an object into an array of a million objects with high performance
>>
>>56790865
It's like you retards don't even know duckduckgo !bang patterns exists. You could have found the answer by searching "!dpkg eclipse"...
>>
>>56790923
Linked lists are a fundamental data structure that is used in implementing other, more advanced data structures.
Also, linked lists actually have pretty terrible performance.
>>
>>56790928
I actually didn't know, thanks.
>>
>>56790923
Yes anon.

It's not even that you'll need to use linked lists, it's that if you don't understand them your going to be in trouble when it comes to understanding more complex structures.
>>
What RTOS would you recommend me for AVR microcontrollers, /g/?
>>
>>56790923
>Linked list
>Game development
Kek.
If you use a linked list in game development nobody is gonna hire you.

In game development iteration speed is much, much, much more important than random access or insertions.
The cost for cache misses is just way to high so you want to store your data as closely together as possible.

Games almost exclusively use arrays and hashmaps.
>>
Why is every programming language so shit?
>>
>>56791034
because the internet says so for every language in existence
>>
how can i make a custom type project in an IDE?

so every time i make a new project, several things are already pre-set
>>
>>56791084
Don't use an IDE.
>>
>>56790342

gimme dat
>>
File: IMG_20160926_080824222.jpg (1MB, 2592x1944px) Image search: [Google]
IMG_20160926_080824222.jpg
1MB, 2592x1944px
>putting anime references in programming books
ISHYGDDT
>>
>>56791084
>an IDE
You select the option for making custom project types.
>>
>>56791120
>Spic
No surprises there. They're the biggest fucking weebs.
>>
>>56791120
https://doc.rust-lang.org/rustc-serialize/rustc_serialize/json/index.html#using-autoserialization
https://doc.rust-lang.org/rustc-serialize/rustc_serialize/json/index.html#verbose-example-of-tojson-usage
>>
>>56791152
As a massive fucking weeb I'm asking you people please learn to hide your powerlevels.
>>
are switches in c++ only possible with integers?
>>
>>56791120
I swear, in 10 years there's going to be fucking touhou on o'reilly's books
>>
starting to fall for go
>>
>>56791199
Integers and chars.
>>
>>56791239
A char is an integer.
>>
Is anyone familiar with yon-chan? I can't figure out how to open a thread.
>>
>>56791199
and enums (which are also ints actually)
>>
>>56791199
>>56791199
Anything that can be cast into int, so also enums and chars. But I haven't used c++ in years so things might've changed.
>>
File: element.png (22KB, 844x462px) Image search: [Google]
element.png
22KB, 844x462px
I'm retarded.

I have a list of elements, pic related.

Whats the easiest way to find the min and max Top values? I'm new to C# and programming in general.
>>
>>56791244
Using reinterpret cast you can turn anything in an integer.
>>
>>56791309
just do a for loop and check
>>
>>56791318
Fundamentally, everything is an integer.
>reinterpret cast
Dumb sepples fag.
>>
Integrating django-wiki into a mezzanine site. Will eventually make a "choose your own adventure" app that describes various structures an organization can adopt, letting you pick an option for each structure. The end goal is to make the adventure app automatically create wiki pages.
>>
File: anal beads.png (4KB, 467x105px) Image search: [Google]
anal beads.png
4KB, 467x105px
>>56791309
elements.Max();
elements.Min();
>>
>>56791309
init max var to the maximum value of the type and min var to the minimum. Loop through elements, check the Top against max & min, setting them if they are bigger/smaller.
>>
>>56791309
>>56791369
Sorry, I'm retarded and jumped the gun responding.

Are you wanting to retrieve just the value or the whole element struct that has that max/min value?
>>
>>56791340
>Restricting the amount of features I can use makes me superior.
Whatever makes you sleep at night.
>>
>>56791340
>Fundamentally, everything is an integer.
Fundamentally, everything can be anything.
>>
What would be a more elegant solution to this ubiquitous programming problem?

The user has to choose between a set of options.

 cout << "\nIn which units was the temperature entered? Enter the corresponding number. \n Available options:\n0. Celsius \n1. Kelvin \n 2. Fahrenheit\n " << endl;
cin >> input;

switch (input) {
case 0: datatype = "Celsius"; break;
case 1: datatype = "Kelvin"; break;
case 2: datatype = "Fahrenheit"; break;
default: cout << "No such unit available. Please try again."; break;
}

cout << "Unit set to " << datatype << " ." << endl;
>>
Any recommendations on how to get into network programming? I was thinking maybe something like a simple chat protocol/server/client? Too high-level?
>>
>>56791309
struct Element
{
public string Text;
public int Left;
public int Top;

public Element(int inLeft, int inTop, string inText)
{
Text = inText;
Left = inLeft;
Top = inTop;
}
}

static void Test()
{
var elementList = new List<Element>();
elementList.Add(new Element(3, 5, "poo"));
elementList.Add(new Element(1, 2, "loo"));
elementList.Add(new Element(4, 69, "paj"));
elementList.Add(new Element(7, 7, "eet"));

// get max Top value
var maxTopValue = elementList.Select(x => x.Top).Max();

// get Element with the maximum Top value
var maxTopElement = elementList.Aggregate((x1, x2) => x1.Top > x2.Top ? x1 : x2);

// get Element with the maximum Top value (less obfuscated method)
var max = elementList.Max(x => x.Top); // get max value
var item = elementList.First(x => x.Top == max); // get the first element with this value
}
>>
File: umarusee.jpg (113KB, 1280x720px) Image search: [Google]
umarusee.jpg
113KB, 1280x720px
>>56791442
you could avoid the whole switch block by doing
cout << "unit" set to " << {"Celsius", "Kelvin", "Fahrenheit", ... }[input] << endl;
>>
>>56791483
thanks, but please consider I also have to

1. make the user enter a number, instead of the full name of the measurement
2. set a variable to that particular measurement
>>
>>56791444
https://docs.python.org/3/library/socketserver.html
>>
>>56791442
The user-friendly solution is to evaluate potential misspellings of the actual words and confirm with the user if the system isn't confident in what they meant to type.
>>
>>56791453
Not OP, but is it possible to have multiple reduce functions, so you can calculate the max & min with just one pass?
>>
>>56791510
Thanks, is a simple chat server/client a decent starting project?

I'd prefer a compiled, statically typed language, but Python seems like a good way to slowly wade into the pool.
>>
>>56791510
Also, any decent book recommendations?
>>
>>56790289
>https://restcountries.eu/rest/v1/all
LINQ is so based.
>>
>>56791378

I'm trying to make a buffer for my game. I want to store screen stuff in elements.

New Game[N]
Load Game[L]
Exit Game[E]

Would be examples of elements, cursor positions are a vector2 x,y position.

What I'm trying to do is take in a list of elements from a screen class.

Have an array of strings thats equal to writing area in the screen size, right now thats

string[] firstBuffer = new string[Window.Height - 2] this is because I want 1 line above and below off limits so the screen doesn't write past its buffer ever.

I want to take every element that shares the same y value and concatenate them while still preserving their respective x positions filling the empty space with " ".

Then I want to have a final buffer that is just a string that concatenates every string in the array to one long string with "\n" in between the concatenations.

Then I can just Console.Write(finalBuffer);

Console.Write/Writeline are slow and cause flickering and shit if you try and just loop and print stuff. Dumping everything in one string solves the problem from what I've seen.

I'm going to have another layer that prints colored elements individually over the other buffer since you have to do separate Write() calls for each color.

>>56791453
I'll look into that fancy syntax you're using.
>>
>>56790342
rolling for real
>>
File: smug frog.png (468KB, 1024x1024px) Image search: [Google]
smug frog.png
468KB, 1024x1024px
Can someone please hook me up with a good mobile app idea I can use to make some good boy points?
>>
>>56791638
dumb frogposter
>>
>>56791638
what are good boy points
>>
>>56791652
he meant good goy points, typo
>>
>>56791638
Make 2 whack-a-mole apps, one w/ trump's face, the other will hillary's. Make cash money off both sides.
>>
>>56791526
I'm toying with this now. Not sure how to send two values into the next iteration within LINQ.

Maybe you'd need one additional "holder" variable.
>>
>>56791638
Escape bag app where you are the only user, dumb frogposter.
>>
>>56791670

What would be the best way to monetize small, simple games like this? F2P and donations? Small fixed price?

What's the best practice for gathering pictures, in this case shillary and trump pictures, to not get buttfucked over copyrights?
>>
int[8][2] *measurements  = new int[8][2];


Is this how it works?
I want to declare a multi-dimensional array with a pointer.
>>
>>56791526
>>56791676
D does this nicely:
auto results = reduce!(min, max)(myArray);
>>
Never posted code before, so sorry if I fuck up but I have a question.

In c# when creating instances of an object why would you declare it as the base class instead of just having everything be the subclass that you are using?

Polygon polygon1 = new Square(4.5f);
Square square1 = new Square(4.5f);


If I'm gonna have a square then shouldn't I just do line 2? They seem to work the same, but tuts I'm following seem to always do line one.
>>
>>56791542
few simple ideas:
- tick tack toe
- chat
- file transfer with directory browsing and listing
>>
>>56791743
Don't fuck w/ C#, but the first line probably allows you to pass the object to functions that take any Polygon while the second only lets you pass it to functions that take a Square.
>>
>>56791757
Thanks anon <3
>>
>>56791743

Same thing in Java. If you want to change the implementation at some point, you can change from square to circle or whatever if you declare it as a superclass.

Some functions might require the superclass object to be passed as a parameter instead of a subclass.

If you declare the object as a subclass, you're stuck with it.
>>
>>56791526
Here's what I came up with, uses only one pass:
var minTopElement = elementList.First();
var maxTopElement = elementList.Aggregate((x1, x2) =>
{
minTopElement = minTopElement.Top < x2.Top ? minTopElement : x2;
return x1.Top > x2.Top ? x1 : x2;
});


>>56791733
Keep in mind that this is not the min/max of a single-dimensional array. This is a list of objects containing properties that is being evaluated. Your code is not equivalent.
>>
>>56791785
This helps. Thanks anon.
>>
>>56791786
nice. really haven't kept up with c#. has that stuff always been there?
>>
>>56791848
For nearly a decade.

These things were added in C# 3.0 IIRC, which was around 2007.
>>
>>56791786
Good point
auto results = reduce!((x1, x2) => x1.top < x2.top ? x1 : x2,
(x1, x2) => x1.top > x2.top ? x1 : x2)(myArray);
>>
>>56791868
I'm 60% sure that this does two passes over the collection.
>>
>>56791877
False
https://dlang.org/phobos/std_algorithm_iteration.html#.reduce
> Sometimes it is very useful to compute multiple aggregates in one pass.
> That's why reduce accepts multiple functions.
>>
>>56791865
i think that's around the time i checked out
>>
map <string, float> measurements;
map <string, float>::iterator itr;
measurements ["Celsius"] = temperature;
measurements ["Kelvin"] = temperature - 273.15;
measurements ["Fahrenheit"] = ( temperature * (9/5) ) + 32;

for (itr = measurements.begin(); itr != measurements.end(); ++itr ) {
cout << "Temperature in " << *itr->first << endl;

}


fails to compile for some reason, telling me
no match for operator*
but i am sure as hell this should be possible
>>
>>56791909
Neat.

I know this is a moot point, but if I really just wanted to go for brevity of my own code, I'd NuGet in that package that lets you just write a one-liner to reduce by a property, or even just write my own extension method that does the work so I can just do
elementList.MinAndMaxBy(property);
or something like that.

I feel like it's pointless to dickmeasure on things as trivial as this, because it's not like it has to be written more than once before you just abstract it.
>>
Who AA coodaus (Aku Ankka coodi) here?
Cr-peli. Peli name: Akun suuri seikkailu. Taso 1: ankkalinna. viholliset-ei koko: 999 mega,t Pää bos-kyllä. Pää bos kestävyys: 9.
>>
>>56790383
gcc <<< -Wall -pedantic -o foo foo.c -l bar
>>
>>56792188
shut the fuck up with your modern terms for made up bullshit, communist

>>56791952
C# sucked cock in those days.

I'm honestly still having trouble understanding how it could start so horribly and be so good in modern times.
>>
>>56792188
Is that Finnish or Estonian?
>>
>>56792248
>>56792188
this started playing in my mind instantly
https://www.youtube.com/watch?v=4om1rQKPijI
>>
File: ThereIsOnlyOneAnswer.jpg (58KB, 499x254px) Image search: [Google]
ThereIsOnlyOneAnswer.jpg
58KB, 499x254px
Well?
>>
>>56792350
second one is a complete waste of space, especially if there's only 1 statement after the conditional.
>inb4 meh when there's only 1 statement don't use curlies at all
fuck off and die pls
>>
Anyone have a "coding" bootcamp they had to attend at university?

>tfw literally getting confused on Java making circles go in different directions

I'm fucked.

I just don't do well with visual/graphical stuff. Give me numbers and fucking code not shapes and (((draw))) methods.
>>
>>56792350
Go with whatever the consensus is in that language.

I prefer the second one for readability, but I'm more than willing to use the first if that's the style-choice of the language or project I'm contributing to.
>>
>>56792350
if (true)
{
// stuff
}
>>
>>56792390
This. Being flexible > obeying a single style.
>>
IDE for C++ on a mac?
>>
what is the best way to make a menu in c++?

cin >> input;

switch (input)

case 1 : ...
case 2 : ...
default : ...

}


are switches the best method, or is there a better one?
>>
>>56792425
if (true)
{
//stuff
}
[/code
>>
>>56792458
if
(
true
)
{
//stuff
}
>>
>>56792549
if (((true)))
{
// stuff
}

>fell for the boolean jew
>>
As a starter, if I haven't learnt C in how many days should I give up on programming
>>
>>56790965
anyone?
>>
How do you define a constant for a type in Haskell?

Like you have a board and want to make an initial board.

is this correct:?

ChessBoard a = [ [Rows] ] | EmptyBoard | InitBoard
EmptyBoard = -- make everything 0 for instance
initboad = -- do first two rows all white objects, last two rows all black objects

is that how you create constant types?
>>
>>56792567
about 3.5 hours
>>
I thought pic related said sexualize instead of serialize.

Sexualize the homura
>>
>>56792587
That does not include study breaks for more efficient information processing and general procrastination, then it's doable
>>
>>56792567
how old are you and what do you need it for?
>>
>>56792589
>Sexualize the homura
Method threw 'InvalidOperationException'
>>
>>56792619
21, little games while it's just C
>>
>>56792609
>study breaks
read perky breasts

>procrastination
read penetration


ill take a braek
>>
>>56791152
>https://github.com/barosl/homu
Can't get more weeb than Rust.
>>
>>56792659
You need more than a break mr Freud
>>
>>56792636
Depends on your previous programming experience and time to spare. Assuming you don't have any experience, it might take you two weeks, maybe a month, or even half a year if you don't have that much free time.
It's hard to tell. I've learned C in my summer vacation in the 5th grade.
>>
Did anyone here go to study CS/software engineering at university without previous coding knowledge?
>>
I'm new to Java (and OOP in general) with some background in C.
I could use some advice on Java error handling

I have a method whose constructor parses a string, and expects a string with 5 comma seperated values.

what should i do if the string is invalid?
should i throw an illegalArgumentException?
should i return an error value like C?

what's the tl;dr of handling bad arguments in Java? just some quick notes would be extremely appreciated.
>>
>>56792773
Exceptions in java cost a lot of power/resources afaik, so you should try to avoid them in performance critical functions
>>
>>56792759
>without previous coding knowledge?
You gotta know SOMETHING about programming if you choose to take CS/SE or even just intro courses yourself. Technically you don't have to know a damn thing because professors and schools have to cover their ass curriculum-wise if people wander in from other majors or undecided tracks but you won't last long if you don't have any investment in programming.
>>
>>56792759
Yes?
>>
>>56792789
funny, because exceptions in c++ have pretty little overhead afaik
>>
>>56792789
Normally i would 100% agree, but this is for a second year programming class where the marks are HEAVILY weighted towards reusability, error handling, and design. Performance is actually very, very low priority.

what methods would you suggest for handling bad arguments?
>>
>>56792824
people without any prior knowledge get into CS/SE all the time because muh good paying job.
>>
>>56792880
I always forget about those people.
>>
File: 1425929096346.jpg (15KB, 300x300px) Image search: [Google]
1425929096346.jpg
15KB, 300x300px
>>56792860
>this is for a second year programming class
err I think I mightve oversold myself
t. started programming java this summer
>>
>>56792824
>>56792880

Yeah I've used C# in college(UK) so its strange using Java now at Uni.

Any tips on getting by the first year?
>>
>>56792951
Read the god damn textbook. Holy shit, READ THE FUCKING TEXTBOOK. Actually talk to your professor if you have any questions, and don't do some "uh profesuh m8 this scanner class stuff aint fukken mint" garbage either, ask a question based on the information here: http://www.catb.org/~esr/faqs/smart-questions.html

Don't be the class smart-ass who sits in the back because he has experience with a programming language before, and don't be the same smart-ass who sits in the front and interrupts constantly with trivial bullshit about how you read on the internet that [x] is a "baby language" or stupid shit like that. Also, try to get on good terms with your professors and see if you "click" with them. If you like them, try to develop a professional relationship with them because that's the perfect time to learn how to. If you don't click with them on a personal level, just be polite and sociable (yeah yeah look at where we are, etc) and they'll respond in kind and be much more willing to help you.
>>
>>56792579
What do you mean a "constant type"?
You just use a regular value
Everything's immutable

data Chessboard a = Chessboard { rows :: [[a]] }

emptyBoard = Chessboard []
initBoard = [ [ ... ], [ ... ], ..., [...], [...] ]
>>
>>56793202
whoops, I guess you meant unoccupied was part of the element type
emptyBoard = Chessboard (replicate 8 (replicate 8 Empty))
>>
>>56792902
>t. started programming java this summer

You're using t. wrong you inbred yokel.

Just don't use memes unless you know what the fuck they mean, newfag.
>>
>>56793242
For the record, how do I use this meme without creating an exception?
>>
What did people do before C++11 came out to model a pair or map?

With a pair, I can't save a value with a name (key). There is no way to model the same thing with classes.
>>
>>56793254
It's basically "signed".
>>
>>56793286
Not sure what you mean - both std::pair and std::map existed pre-c++11 and you could use a struct to make a pair, just a bit uglier...

template <typename T, typename U>
struct Pair
{
T first;
U second;

Pair(T first, U second): first(first), second(second)
{
}
};

Pair<std::string, int> something()
{
return Pair("asdf", 5);
}


vs.
std::pair<std::string, int> something()
{
return {"asdf", 5};
}
>>
>>56793286
template <typename a, typename b>
struct pair {
a fst;
b snd;
}

Magic.
>>
>>56793254
t. is short for the Finnish word terveiset, which in English is "regards."

It's not a 4chan "meme", by the way. You'd have to have been part of a certain community to actually understand the usage properly, but t. (self-deprecation like "babby" or "newfag") is kind of acceptable usage when attached to initial entry-level question posts. Another instance would be the common "t. knower" which is exactly what it sounds like. You're not supposed to use it constantly.
>>
>>56793324
>>56793323
O-oh, thanks.

But would I also be able to access "second" by naming first?

As in
Value = pair ["key"]

?
>>
>>56793362
That makes no sense but you could overload the operator to do so if you really wanted to.
>>
>>56793362
template <typename k, typename v>
v& operator [](map<k,v>, k key) {
for (auto& kv : data)
if (kv.fst == key) then
return kv.snd;
}
>>
>>56793242
>muh you need to write "someone who" there
>t. autism
>>
>>56793378
Let's assume a scenario, where the user is asked for a key and the program returns the corresponding value.

How'd you do that outside of pairs and maps? Would you run through all your custom-created classes and drag the one out where "key = input"? That takes a lot of time.

(Noob question, I know.)
>>
>>56793415
lurk more
>>
>>56793429
Not like almost everyone uses it like I did and you sperged out as if you only knew about it from kym
>>
>>56793416
data structures and algorithms
>>
>>56793416
Before C++11 something like this would work:
typedef std::pair<std::string, int> MuhPair;
std::vector<MuhPair> data;
// fill the data

std::string input;
do {
fprintf(stdout, "key pls\n");
std::cin >> input;
} while(!input.size());

for (const MuhPair &pair: data) {
if (pair.first == input) {
fprintf(stdout, "%d\n", pair.second);
break
}
}
>>
>>56793441
>implying i'm >>56793242 this retard
You still need to lurk more because you and >>56793242 are wrong
>>
>>56793202
>>56793217
got it thx!
>>
>>56793442
So I have to learn basics first to solve such tasks... K, thanks, won't ask superfluous questions again.

>>56793393
>>56793444
I'll study these, thank you.
>>
>>56793444
>>56793471
Actually never mind because there were no for-ranged loops so you wuold have to use iterators but still.
>>
File: f-fuck you.jpg (51KB, 397x419px) Image search: [Google]
f-fuck you.jpg
51KB, 397x419px
>be on github for a year
>no recruiter emails
>check my profile
>i forgot to set a public email address
>>
>>56793572
Yeah, but it'd be applicable today.
>>
File: tmp_16337-d8b1901706346.png (397KB, 600x600px) Image search: [Google]
tmp_16337-d8b1901706346.png
397KB, 600x600px
>>56793640
>implying that was the cause
>>
which c math library to use for opengl stuff?
>>
>>56792660
That's actually a neat tool.
>>
>>56792560
if (((true)))
{
// stuff
}

Much more readable now.
>>
>>56792350
(if then else)
>>
if
(
true
)
{
//stuff
}
>>
>>56792350
like dis
        function foo(bar)
{
if (bar)
{
// stuff
}
}
>>
Reading this: http://composingprograms.com/
Thank you Akarin!
>>
>>56792350
if
(
true
)
{
// stuff
}
>>
>>56794158
>fp section
>it's just lisp
>>
>>56794345
who would've thought that the sicp successor uses lisp
>>
>>56794345
jelly 'skell-ee?
>>
>>56794374 >>56794397
Yeah, I thought it was meant to be about programming
>>
Post special snowflake FizzBuzz from your language.

Here's some C# LINQ.

Enumerable.Range(1, 100)
.Select(x => x % 15 == 0 ? "FizzBuzz" : x % 5 == 0 ? "Buzz" : x % 3 == 0 ? "Fizz" : x.ToString())
.ToList()
.ForEach(Console.WriteLine);
>>
Has anyone used Soot in Java?
>>
>>56794434

disp x =
case (x `mod` 3, x `mod` 5) of
(0,0) -> "FizzBuzz"
(0,_) -> "Fizz"
(_,0) -> "Buzz"
(_,_) -> show x

main = [1..100] `forM_` (putStrLn . disp)
>>
File: g.png (302KB, 1920x1080px) Image search: [Google]
g.png
302KB, 1920x1080px
>>56794434

<ul>
<li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li><li>7</li><li>8</li><li>9</li><li>10</li><li>11</li><li>12</li><li>13</li><li>14</li><li>15</li><li>16</li><li>17</li><li>18</li><li>19</li><li>20</li><li>21</li><li>22</li><li>23</li><li>24</li><li>25</li><li>26</li><li>27</li><li>28</li><li>29</li><li>30</li><li>31</li><li>32</li><li>33</li><li>34</li><li>35</li><li>36</li><li>37</li><li>38</li><li>39</li><li>40</li><li>41</li><li>42</li><li>43</li><li>44</li><li>45</li><li>46</li><li>47</li><li>48</li><li>49</li><li>50</li><li>51</li><li>52</li><li>53</li><li>54</li><li>55</li><li>56</li><li>57</li><li>58</li><li>59</li><li>60</li><li>61</li><li>62</li><li>63</li><li>64</li><li>65</li><li>66</li><li>67</li><li>68</li><li>69</li><li>70</li><li>71</li><li>72</li><li>73</li><li>74</li><li>75</li><li>76</li><li>77</li><li>78</li><li>79</li><li>80</li><li>81</li><li>82</li><li>83</li><li>84</li><li>85</li><li>86</li><li>87</li><li>88</li><li>89</li><li>90</li><li>91</li><li>92</li><li>93</li><li>94</li><li>95</li><li>96</li><li>97</li><li>98</li><li>99</li><li>100</li></ul>



ul{
list-style-type:none;
}
li:nth-child(3n), li:nth-child(5n){
font-size:0px;
}

li:nth-child(3n):before{
font-size:16px;
content:"Fizz";
}
li:nth-child(5n):after{
font-size:16px;
content:"Buzz";
}
>>
>>56794506
has science gone too far?
>>
>>56790078

is R a language?
>>
>>56794434
private static void FizzBuzz(int bignumberz)
{
var bignumber = bignumberz; string FizzBuzz = "FizzBuzz"; int qwer = -~new int() * bignumber; int? asdf = null; int zxcv = FizzBuzz.IndexOf((FizzBuzz.ToCharArray())[2]); var uiop = Enumerable.Range(1, bignumber * -~new int()); string fz = "Fizz"; string bz = "Buzz"; foreach (char x in FizzBuzz) { if (FizzBuzz.IndexOf(x) == -~-~new int()) { asdf = FizzBuzz.IndexOf(x) + -~new int(); } if (FizzBuzz.IndexOf(x) == -~-~-~-~-~new int()) { zxcv = FizzBuzz.IndexOf(x); } } foreach (var ayy in uiop) { if ((ayy % asdf == -~new int() - 1) && (ayy % (asdf * zxcv) != -~new int() - 1)) { WriteLine(fz); } else if (ayy % zxcv == 0 && (ayy % (asdf * zxcv) != -~-~-~-~-~-~new int() - 6)) { WriteLine(bz); } else if (ayy % (asdf * zxcv) == - ~ - ~ - ~ - ~ - ~ - ~-~-~-~ -~-~-~-~-~-~-~-~- ~-~-~-~- ~-~-~new int() - -~-~-~-~ -~-~-~- ~-~-~-~-~-~- ~-~-~-~ -~-~-~-~-~- ~-~new int()) { WriteLine(fz + bz); } else { WriteLine(ayy); } }
}
>>
>>56794434
For every integer x in the range [1, 100]
If x is divisible by 3, print "Fizz"
If x is divisible by 5, print "Buzz"
If x is divisible by neither 3 nor 5, print x
>>
File: anal beads.png (26KB, 661x489px) Image search: [Google]
anal beads.png
26KB, 661x489px
>>56794524
>>
Say, I'd like to relearn modern C++ - what resource /dpt/ recommends?
>>
>>56794506
>>
>>56794565
Any book using C++14. Ideally, C++17.
>>
>>56794565
https://isocpp.org/faq
>>
>>56794565

scott meyer
>>
So there is this single header math library for C.
https://github.com/arkanis/single-header-file-c-libs/blob/master/math_3d.h

If I have
main.c
#include "math_3d.h"
int main(void) { vec3_t x = vec3(0.0f, 0.0f, 0.0f); return 0; }

It compiles and runs ok.
So then I run another function from it.
#include "math_3d.h"
int main(void) {
mat4_t x = m4_perspective(
0.0f,
0.0f,
0.0f,
0.0f
);
return 0;
}

And I get get linker error undefined reference to m4_perspective.
Why would that be?
Compiling with
cc -lm main.c -o exe
>>
>>56794565
https://github.com/rigtorp/awesome-modern-cpp
>>
>>56794599
>Ideally, C++17.
are there even any out there yet?
>>
>>56794703
dunno
>>
I want to learn to program better.

I currently am pretty good at C, but OO is a struggle that I'm trying to pick up.

My main desires are to program iPhone apps and program games.

For now I'm going to settle on games. Now I'm not jumping up and down saying "how do I make COD" or whatever it is people play nowadays. I know that my first games will be simple 2D affairs.

But actually, I'm looking for resources that don't focus on the graphics, but teach more about game logic, maybe with very simple graphics included.

Anyone recommend a course or book on that?
>>
>>56794949
OO is bad
>>
>>56792773
>should i throw an illegalArgumentException?
This seems most reasonable to me. Exceptions are cleaner than error values in most cases.
>>
anyone here know how to allow user input on a combo box? I am trying to have it so when the enter key is pressed it adds data to the combo box.

This is in visual basic
>>
>>56794636
I don't know C but after taking a glance at the code I assume you have to add this:
#define MATH_3D_IMPLEMENTATION


Before including math_3d.h header.
>>
File: penn_jillette.jpg (31KB, 300x400px) Image search: [Google]
penn_jillette.jpg
31KB, 300x400px
>>56794956
>states opinion
>no facts or studies to back it up
>>
>>56794949
http://gameprogrammingpatterns.com/
http://www.gameenginebook.com/
I don't know more resources but those should get you started.
>>
>>56794949
>>56794984
Furthermore it even says so in the top comment:
>It's an stb style single header file library. Define MATH_3D_IMPLEMENTATION
before you include this file in *one* C file to create the implementation.
>>
>>56794987
>>denies membership to cult
>>no facts or studies to justify his heresy
>>
>>56794994
Thanks matey
>>
>>56794599
>>56794615
>>56794621
>>56794675
k, thanks. I think I'll wait for C++17 as it isn't anything urgent for me now, just my whim.
>>
>>56795001
well fuck...
>>
>>56790342
rolling for real [unless its hard or takes long]
>>
>>56795180
seems you're lucky
>>
>>56794599
>>56794703
>>56794786
There seems to be some support
http://en.cppreference.com/w/cpp/compiler_support
>>
>>56794994
Not that guy, but curious about learning the whole shebang of making games. That's a good resource, but what would I do for a graphics system?
>>
File: 64dunkhv.jpg (152KB, 1024x768px) Image search: [Google]
64dunkhv.jpg
152KB, 1024x768px
Fuck you C, I'm learning another programming language.
>>
>>56795367
You'd use an existing engine, because rolling your own results in you never actually making a game.
>>
>>56795375
>he fell for the "learn C" meme
>>
>>56795376
So Unity?

I'm looking at iOS dev and wondering what scenekit offers?
>>
>>56795375
What exactly is bothering you about it?
>>
>>56795404
SceneKit sounds like some bullshit.

Just use Unity and tick the iOS targetting pack when you're installing it. You can just immediately make a build for iOS right out of the box then.
>>
>>56795439
Seems a bit overkill for the types of games I'll be making though? I'm thinking I'll be doing basic 2D side-scrollers etc?
>>
>>56795452
Unity is very good for basic 2D games.
>>
>>56795404
>So Unity?
I'd rather use Unreal, but use the one that fits you more.
>>
>>56795452
Not particularly overkill.

Depends what languages you already know.

If you want to learn (or already know) Objective-C and want to put in a whole heap of extra work to make an actual functional game, then sure go right ahead with what I imagine isn't a particularly performant API that was never designed specifically for making games.

Alternatively, you could just use Unity.
>>
>>56795423
I feel like it's stupid language to learn in 2016. I've understood that C++ can do everything same that C but with classes and so on. I'm feeling like even Go is better language to learn nowadays.
>>
Haskell question!
Gotta make a tictactoe game where I have a nested triple tuple. The three tuples are the rows:

( ( , , ) , ( , , ) , ( , , ) )

Now I want to split them into different tuples and make a list of it based on the X mark like this:

( ( , , X ) , ( X , , ) , (X , , ) )

visualised:

| | X
X | |
X | |


I want to split each X into its own tuple:

[
( ( , , X ) , ( , , ) , ( , , ) ) ,
( ( , , ) , ( X , , ) , ( , , ) ),
( ( , , ) , ( , , ) , (X , , ) )
]

visualised:
list:

[

| | X | | | |
| | X | | | |
| | , | | , X | |

]

Any help please?
>>
>>56795480
Unity is a lot friendlier. And also, it's cheaper if releasing games with it.

>>56795483
I know C. And have a rough idea of how C#/Java works.
As I'm still learning, I'd prefer to learn Swift, instead of Objective-C. I know there's huge support for Objective-C as is, but by the time I get to a stage where I'll be any good, it'll tend to be more legacy things using Obj-C.
>>
>>56795507
Are you sure you want to be using a tuple?
>>
File: tegaki.png (10KB, 400x400px) Image search: [Google]
tegaki.png
10KB, 400x400px
>>56795507
ah fuck the visualisation is fucked i'll paint
>>
>>56795507
why
>>
>>56795507
use code tags, and I might consider reading your post.
>>
File: no.jpg (186KB, 816x488px) Image search: [Google]
no.jpg
186KB, 816x488px
>>56795375
>2016
>learning C
>>
File: 134257380020.jpg (34KB, 288x499px) Image search: [Google]
134257380020.jpg
34KB, 288x499px
>>56795507
>Nested tuple

I don't even know anything about Haskell and that seems entirely wrong even to me.
>>
>>56795530
yes we have to use a triple tuple for this practical
>>
>>56795557
Well ok, I'm still confused by your explanation

You want to turn the board of many Xs into a list of grids consisting of only 1 X?
Why not just their positions?
>>
>>56795552
have you ever heard of linked lists anon
>>
File: ss (2016-09-27 at 05.33.23).png (81KB, 552x457px) Image search: [Google]
ss (2016-09-27 at 05.33.23).png
81KB, 552x457px
>>56791120
I've seen worse.
>>
>>56795540
gotta make potential moves/gamestates based on possible moves (denoted by the X)

>>56795542
check my drawing here for visualisation: >>56795539

>>56795552
Thats why im having such a hard time, but we gotta use this shit :(

>>56795569
>You want to turn the board of many Xs into a list of grids consisting of only 1 X?
yes

>Why not just their positions?
I have made a workaround to acces tuples per indices, but that's the bitchy part. Its hard to manipulate tuples based on index.

Thats why i gotta use this shit so i can IMPOSE each element in my list with the current state of the board and thus create a list of potential board states. I really dont know how else i'd do it.
>>
def cons(x, y):
return lambda m: m(x, y)

def car(pair):
return pair(lambda x, y: x)

def cdr(pair):
return pair(lambda x, y: y)


>python
>>
>>56795680
man fuck python it will only take me 100 times as many lines to write a singly linked list in my favorite language
>>
>>56795667
>gotta make potential moves/gamestates based on possible moves (denoted by the X)
Shouldn't you be turning blank spots into X's then?
>>
>>56795680
explain pls
>>
>>56795667
The tuple thing is really awkward desu
>>
>>56795751
it's like the procedures in sicp that implement a linked list

cons pairs up two things, car extracts the first one, cdr the second one

it uses some lambda and function tricks to store the values and retrieve them

if you trace through the calls you'll see it
>>
>>56795728
>turning blank spots into X's then?
I already did in the first grid (with the three X's). I then split them to each their own grid (see the 3 grids in the list), and then I impose each one of them on the original/current board (didnt draw that one) to create a list of potential board states.

fuck it ill hardcode it by making a function with 9 cases that splits them or something. That should do it i think. Its ugly but whatever.
Thx anyway
>>
>>56795789
it's called lambda calculus you'll get more when you search for that instead
>>
>>56795789
Oh I get it. I was misreading cons return value.
>>
>>56790342
Hmmmm
>>
>>56795680
Would it be accurate to say cons returns a closure?
>>
any of you ever done a google interview?
>>
>can download all of a threads posts
>allows you to view a threads images and download them by clicking on them
>also allows you to download them all at once
D-did I actually code something semi useful /dpt/?
>>
>>56795965
there is nothing here worth saving
>>
>>56795965
0-vanned in 3.4 seconds
>>
>>56795507
This can be abstracted a bit, and you'll have to add the `O` mark:

data Mark = X | None deriving (Show)
type Row = (Mark, Mark, Mark)
type Grid = (Row, Row, Row)


first (m, _, _) = m
second (_, m, _) = m
third (_, _, m) = m


initialGrid :: Grid
initialGrid =
(initialRow, initialRow, initialRow)
where initialRow = (None, None, None)

type RowIndex = Int
type ColumnIndex = Int
type Position = (RowIndex, ColumnIndex)

nextMoveGrids :: Grid -> [Grid]
nextMoveGrids currentGrid =
map (makeMove initialGrid) $ getPossibleMoves currentGrid

makeMove :: Grid -> Position -> Grid
makeMove grid (1, col) =
( makeRowMove col (first grid)
, second grid
, third grid )
makeMove grid (2, col) =
( first grid
, makeRowMove col (second grid)
, third grid )
makeMove grid (3, col) =
( first grid
, second grid
, makeRowMove col (third grid) )
makeMove grid _ = grid


makeRowMove :: ColumnIndex -> Row -> Row
makeRowMove 1 (_, y, z) = (X, y, z)
makeRowMove 2 (y, _, z) = (y, X, z)
makeRowMove 3 (y, z, _) = (y, z, X)
makeRowMove _ row = row


getPossibleMoves :: Grid -> [Position]
getPossibleMoves grid =
getPossibleColumns 1 (first grid) ++
getPossibleColumns 2 (second grid) ++
getPossibleColumns 3 (third grid)

getPossibleColumns :: RowIndex -> Row -> [Position]
getPossibleColumns rowIndex row =
markToPosition 1 (first row) ++
markToPosition 2 (second row) ++
markToPosition 3 (third row)
where markToPosition :: ColumnIndex -> Mark -> [Position]
markToPosition column mark =
if isTaken mark then [] else [(rowIndex, column)]


isTaken :: Mark -> Bool
isTaken None = False
isTaken _ = True
>>
>>56796168
?
>>
>>56796175

λ: nextMoveGrids initialGrid
[
((X,None,None),(None,None,None),(None,None,None)),
((None,X,None),(None,None,None),(None,None,None)),
((None,None,X),(None,None,None),(None,None,None)),
((None,None,None),(X,None,None),(None,None,None)),
((None,None,None),(None,X,None),(None,None,None)),
((None,None,None),(None,None,X),(None,None,None)),
((None,None,None),(None,None,None),(X,None,None)),
((None,None,None),(None,None,None),(None,X,None)),
((None,None,None),(None,None,None),(None,None,X))
]
>>
>>56796175
thx m8, should help!
>>
If, rather than using sockets and the socket.io library which seems to largely malfunction every time I use it, I used a plain 'ol piece of javascript to request new messages in a chat room every 5 - 10 seconds, wouldn't that make building a chat room pretty dang easy?
>>
>>56796258
It'll be pointlessly heavy on your server if there's a bunch of people just idling. And there might be a flood of messages every X seconds instead of a natural flow.
>>
>>56796258
>socket.io
this is a very popular library so it seems unlikely that the fault is there. have you checked their slack? seems well populated
>>
>>56796327
I had used it a few years ago and noticed that my applications always defaulted to the fallback which was, iirc, long polling. my console was chock-full of poll requests
>>
How do you deal with reconnecting people who've disconnected in network (internet) applications?

Do you write a piece of code on the client side that simply attempts to reconnect to some sort of saved session/lobby/connection?

Let's say I lose internet for 20 seconds. Do I simply pause both the client and server until the client reconnects?
>>
I am getting Visual Studio 2015 Enterprise Edition Update 1 installed on a lab machine for research shit. Not the most fun of development environments, but umm... Windows Kernel debugging. Yeah...
>>
File: mfw your opinions.gif (3MB, 240x234px) Image search: [Google]
mfw your opinions.gif
3MB, 240x234px
>>56796412
>Enterprise Edition
>>
>>56796412
I actually think VS is decent. plsnobully
>>
Should I use MVC?
>>
>>56796412
Visual Studio is actually great, imo
>>
>>56796368
Nothing wrong with long polling. It's what facebook uses for their chats for example.
>>
>one webdev class required for cs degree
>class about making websites
>first assignment is to make a website in html5/css
>make beautiful layout, check requirements for what's left to do
>literally every single html and css feature is required to be on the website
>my perfect layout is reduced to trash
>3 hours of work and design down the drain

fuck I hate web dev
>>
>>56796468
>>56796441
>>56796412
Yep VS is amazing but >Windows Kernel debugging.
Good luck buddy...
>>
>>56796475
>literally every single html and css feature is required to be on the website
I had an assignment like that in my intro to web dev class. It was a shitty assignment that consisted of me throwing everything into a single page.
>>
File: 1437837019806.png (26KB, 462x320px) Image search: [Google]
1437837019806.png
26KB, 462x320px
>>56796475
>literally every single html and css feature is required to be on the website
>>
>>56796408
depends on the application, in a game server you shouldn't wait, or pause.
when this one client's info is needed for other connections (like undistributed blockchains) you have to wait and pause.
>>
>>56796474
It's inefficient. If you don't care about IE <=10 use vanilla WebSockets or SSE.
>>
>>56796475
You haven't even licked the surface of the shit-sea that is webdev.
Oh bu hu you had a garbage assignment that you didn't even bother to read.
You don't get to complain until you have worked on meme "web app" for retarded blind monkeys that uses at least 17 front end frameworks, java applets, flash and a mixture of PHP and rails for the backend.
>>
>>56796475
>>literally every single html and css feature is required to be on the website
>>
>>56796475
>one programming class required for cs degree
>class about making programs
>first assignment is to make a program in java
>make beautiful fizzbuzz, check requirements for what's left to do
>literally have to use OO, GUI and networking
>my perfect fizzbuzz is reduced to trash
>3 hours of work and design down the drain
>>
>>56796617
In all seriousness though, it's funny seeing all the extra shit IT students have to do in a simple program because they're using Java
>>
File: 1471900898275.jpg (45KB, 577x622px) Image search: [Google]
1471900898275.jpg
45KB, 577x622px
>>56796617
>GUI networked fizzbuzz
>>
>>56790342
Captcha was my area code
>>
>>56796434
Yes, that is correct. The university's paying for it, so I'm not complaining.

>>56796441
>>56796468
I rather dislike Visual Studio. It's a pain in the ass to navigate, and I'm used to doing everything via command line, so I hate having that shit abstracted away. That said, if I'm going to be working in Microsoft's kernel space, I'm going to be using Microsoft's toolset.

>>56796475
>>56796617
Read requirements before opening text editor.
>>
>>56796654
edit
options
fizz
buzz
>>
>>56796654
If I ever get around to hosting a /g/ community OSS project it's gonna be this.
>>
>>56796685
wow thats crazy what a coincidence
>>
>>56796695
Rewriting the linux kernel in fizzbuzz
>>
File: x.png (37KB, 248x288px) Image search: [Google]
x.png
37KB, 248x288px
>>56796654
>blockchain based fizzbuzz
>>
>>56796738
>coincedence
>>
>>56796688
>read requirements before opening text editor
the point was to teach me about html and css and I learned way more about them from designing a good website than I did by making the trash he wanted.
>>
>>56796744
I've made this actually, there's now a fizzbuzz contract on the ethereum test network somewhere.
>>
>>56796744
>watching chinktoons when you're old enough to be on this websi--
wait a minute.
>>
>>56796744
>fizzbuzz based cryptocurrency.
>>
>>56796762
No the point was to dance like a good monkey so you can get a piece of paper from an accredited university. You're gonna have to actually learn how to apply the stuff yourself. That's nothing to complain about, it's just how it is.
>>
>>56796762
Why didn't you just append the new features at the end?
>>
>>56796800
This. Self development is important etc. but don't forget your priorities. Which is getting your job done in time and getting a signature on a paper.
No one's gonna care about your grades, but rather when, and if you graduated at all.
>>
>>56796849
I tried my best, but I mean it needed EVERY feature. That includes background colors with hex, rgb, and color names.
>>
>>56796762

Doesn't matter. Read the fucking requirements document front to back before you start coding. If you want a good grade, do as instructed.
>>
how do i go about proving this grammar is unambiguous?

S -> ST | T
T -> xTy | xy

i read the entire chapter of the book and it says nothing about proving something's unambiguous
>>
>>56796958
Draw it as a state machine. Observe how every state only has one output. Alternatively use state diagrams etc.
>>
>>56796958
What do you mean unambiguous?
>>
>>56796977
this seems promising, will do. are all unambiguous grammars convertible into an FSM? is the reason CFG's are more powerful than FSM's because of languages which require ambiguous grammars?
>>56796979
only 1 parse tree per string
>>
>>56796958
My book never talked about this either, so I assumed the class wasn't as rigorous, so I just handwaved drawing a parse tree and saying there were no others. If I wanted to be more rigorous, I would talk about not being able to turn one nonterminal into two nonterminals of the same name. I haven't received the homework yet, so I can't really tell you how that turned out. My school also doesn't seem to be too difficult, so as long as I do better work than most retards I feel fine.
>>
>>56790127
>GUI for racial slur generator
Why?
Oh wait, that font rendering is ClearType. You're on Windows.
>>
>>56796977
update: i still don't get it
>>
>>56790127
What's it written in?
post sores.
>>
>>56797164
Sorry senpai that's all I got, it's been too long since I took those classes.
>>
I'm trying to use PHP's "is_readable" function AND "file_exists", but they return 100% FALSE.
Nothing I do makes them return TRUE.
The file DOES exist, and even the exact path I'm passing will link the image for display.
But it doesn't EXIST and cannot BE READ. Although it CAN be displayed.
What the fuck?
echo "<img src='$_SiteVar[BASELINK]media/user/7c713a272e4ac63e8274f29ade920beb0f70712d.jpg' 
alt='ERROR'/><br />";
echo "Does this image exist? $_SiteVar[BASELINK]media/user/7c713a272e4ac63e8274f29ade920beb0f70712d.jpg <br />"; //Works. It's a nice picture
if(is_readable("$_SiteVar[BASELINK]media/user/7c713a272e4ac63e8274f29ade920beb0f70712d.jpg")){
echo "YESS!! <br />";
}else{
echo "NOOOOO <br />";
}//NEVER works. Returns a fucking blank
>>
>>56797315
https://secure.php.net/manual/en/function.is-readable.php
https://secure.php.net/manual/en/function.file-exists.php
read you're docs
>>
NEW THREAD!

>>56797467
>>
>>56790078
what lang is this?
>>
>>56796175
fuck I miss haskell
Thread posts: 335
Thread images: 29


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.