/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

twitter.com/dpttxt/status/882110065607618560
stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
twitter.com/NSFWRedditVideo

Unpopular opinion: Both C and C++ enables lazy and brainlet programmers.
Bring back ML.

>No anime image
I'm extremely disappointed. Also, are you such a fucking autist that you were waiting for exactly 310 so you could post that shit image?

>retain concerns
>enables brainlets
No

so in Javascript Sets and Maps are hashed with ===, which checks for refrence equality. You cant overwrite === so if you want to have a Set of a custom data type, you're fucked! What's more, Javascript's === semanticas are totally fucked:

let a = [2,3]
a === [2,3] // false
It is therefore nearly impossible to use a Set or a Map in Javascript.

Sedgewick's Algorithms > SICP

Stay mad.

Sedgewick's Algorithms is shit
CLRS > Sedgewick's Algorithms

The C++ language never rammed any features down your throat. Let’s not confuse the languages stance with that of the zealots in that community. You never had to use those OO features if you didn’t want to.

But they were so tempting, weren’t they? They glistened like gold and were so much fun to use. You were young. You didn’t know any better. You needed the money. And it was fun too. C++ looked like it could fulfill the dreams of programming in the large.

At first, the changes start in small ways. The comment style changes. /* */ evolves into // . Shortly thereafter variable declarations are sprinkled liberally in the middle of functions. Small and simple. Yet it hit a relevant sweet spot with many developers.

Then the inevitable happens. References find their way into function declarations. The inexperienced developer begins to dabble with function overloading, which results in the requisite name mangling. Now the peer programming languages from the past have a huge barrier to cross.

Structs turn into classes with virtual functions. Classes pick up non-trivial constructors, and critical high-level functions start throwing exceptions. Then comes the mind-bending multiple inheritance designs. When this phase appears, the old-school programming languages have no hope of participating.

By the time the metamorphosis is complete, it’s too late. There’s no turning back. The beauty of this evolutionary process is that as the code base becomes more entrenched with C++-specific features, it becomes harder to get out. The code begets further C++. Its existence serves as the accelerant in the process.

Given the difficulties created by the linkers on most modern operating systems, C++ has to go through extraordinary gyrations to make its function overloading available to mere mortals. But it’s the same silliness that serves as its defense. Once you have mangled function names, there’s no hope for the rest of the classic languages to feel like equals.

if java was truly garbage collected, the programs would delete themselves upon execution

This. Java is not a garbage collected language

twitter.com/dpttxt/status/882110065607618560

nice post ;)

>Comparing a simple "yes" program with the same algorithm
>GNU C averages on 8 GB/s (for reference)
>/dpt/ C averages on 120MB/s
>My D averages on 120 MB/s
>My Rust averages on 35 MB/s
Rust BTFO, how will they ever recover?

What are you even talking about?

do this:
use std::env;

fn main(){
let args: Vec = env::args().collect();
loop{
println!("{}", args[1]);
}
}
And compare with similar C and D

So why the difference? What does "GNU C" do that lets them achieve 8 GB/s throughput?

in haskell this averages 2GB/s

based haskell

Did any of you not learn through making your own projects when you were new to programming?
Could you share how you did it?

case "$1" in
-s|-simulate)
shift
;;
esac
or
if [[ $1 =~ ^(-s|-simulate)$ ]]
then
shift
fi
?

Create projects that sound interesting and motivate you to code.

No project sounds interesting (and doable with my low skills).
I enjoy it a bit but I'm getting really tired of this textbook and don't really feel like I'm getting significantly closer to being able to doing any programming that isn't exercises from a textbook.

Don't use textbooks then. Browse the posix/Linux manual and fine some function that does something funny and try to use it. If you get stuck ask Google, you can be sure stack overflow has answers.

Whenever you think "there should be a program for that", instead of looking to see if it already exists try and create it yourself.

>nothing is doable with my low skill level
Not an excuse in the modern age, you can get an answer to just about any question on the internet (but make sure you take the time to actually understand the answer and implement it yourself instead of just copy+pasting some pajeet's snippet from stackoverflow). Besides, if you don't push yourself how do you expect to ever improve?

Then you are going to have a hard time learning. I'm sure there are concepts that interest you. It doesn't matter if you have low skills. The point is to fight with code to practice and better yourself.

QT documentation is shit.

wew just tripled the performance of my Game of Life toy

Did you implemented hashlife yet?

Why the fuck does spamming 'y' faster matter to ANYONE?????

It's an indication of other things user.

no but thanks for the read, I'll look into it.
before I was computing the bounding box of alive cells and re-checking every cell inside the box. this would lead to extremely poor performance with a sparse field (for example two gliders flying in opposite directions leads to a huge, empty box to waste time checking)
now I'm just checking alive cells and their immediate neighbors. Tripled is an understatement of how much faster that is

I was hoping to find interesting stuff once I got started more and actually knew about some stuff.
Right know I don't know of something that interests me.

>rustfags claim rust is fast
>yes implementation is slower than PHP
baka desu senpai

Maybe you shouldn't use IO functions from the standard library and use system calls instead.

Maybe computers aren't your thing.

Yeah that part of my post might have been flawed since I can learn while making something (it's a significant part of why I wanted to do something) but I'd hope to figure out something where there's just a moderate amount I don't know instead of something where the stuff I've learnt already from my textbook isn't 1% of what I need to make the project.

I have had a bit fun sometimes while programming a bit (exercises from text books) but it wasn't because I had any interest in what the thing was doing (since it didn't really do anything).
It was just the programming itself that was interesting.

Raymarching in Spreadsheets - I'm making a cubefield at the moment.

lots of people feel the same when learning programing
>I want to learn to program to write video games
>*learns the fundamentals of programing*
>ok, now I can declare variables and do loops
>*learns more*
>ok so programing is basically just manipulating lists
>I wouldnt even know how to program a video game if I tried
>depression

alternative route
>I want to program to do video games!
>*learns application frameworks*
>one year later
>Dear Sir, attached is your requested website in zip format. Kindly do the needful. --Rajeet

Cool, what for?

dad I'm scared

What if you skip depression and keep going?

Just for fun!

It seems daunting at first but it's really not that difficult so long as you understand the core concepts and have a good mind for problem solving.

are yuo a wizard?

excellent

No but i stay away from 3D

you become a technology alchemist and gain wizard-level programming powers
or you become a maintenance engineer making bank but paying for it with your sanity

I'm writing a MIPS emulator. It achieves ~10 MIPS in debug mode, and ~50 in release(on an i5-2540m). It'll eventually emulate a SGI Indy.

Yeah I might be able to do something but I don't want to start with something huge for the first thing since I have severe problems with willpower.

>new code monkey degree doesn't introduce programming until the second year because half the cohort drops out after failing to learn python in the first semester.

>now in second semester, only actual semi-programming class is databases, which is only SQL. the other 3 classes are all practically all common sense business-esque subjects that teach you how to be a good wagie, not fuck up designing a basic GUI, and to account for the disabled and mentally ill by implementing gender neutral pronouns in programs they haven't taught you how to code.

i actually did quite well last semester but I'm seriously considering dropping out

>account for the disabled and mentally ill by implementing gender neutral pronouns in programs they haven't taught you how to code.
I dont believe this. University, course name?

How would I go about discerning doubles and Strings?
I have a datalist looking like this:

34.45 Detroit
43.10 Italy
5.32 Hong Kong
3.21 Brooklyn-New York
?
I have already understood that I need two arrays, one for doubles one for strings.
But reading the file, they are all read as chars or Strings, right?

Yeah.
Get each line as a String, explode it on a space, then parse the 0th element with Double.parseDouble

programming animeOS

How does whatanime.ga works user?

how do they match a target image against 10000000 anime pictures( assuming they parse videos into pictures) ???

if you want to make video games why dont just learn unity or some shit? building ur own engine is the most retarded way of killing yourself by depression

The most important thing to ask yourself is what is it that you want to do?

JavaScript's === semantics aren't "totally fucked", what are you comparing it with? Your sample that returns false for this returns false in nearly all major languages. Just because you don't understand what's going on, doesn't mean it's "totally fucked".

Idiot.

in every single cs internship i've had, at least half the workers were indian contractors.

what things should i learn so that ranjeet can't steal my job a decade down the line?

The fact that it's called === means that it's totally fucked

No, I understand why it doesnt work. It checks for reference equality. But consider the following code snippet.
let s = new Set();
s.add([1,2,3]);
set.has([1,2,3]); // false
Dont you think there's something wrong with that? The way to get around it seems to be strignifying your values:
let s = new Set();
s.add([1,2,3].toString());
set.has([1,2,3].toString()); // true
but then your values() are all useless!
for (let el of s.values) {
el[1]; // "," !!!!!
}

If you look for the best rated programming books on Amazon, will you find very good books?

never post here again you braindead faggot.

you'll find the best rated ones

speak better english, never stop learning something that is fun.
Also, become a social jockey, too while you are at it.

They access the eye scanners hidden in the screens of the people on a few different anime forums to clone their minds and put them together into one AI which put together knows most things about anime.

how do i into social skills?

the smile-and-nod is my extent

Nice argument

I want to learn programming. I really do. I eventually want to get an entry level job and improve from there since I absolutely hate my current career path. I just don't know how and where to start. It's just so overwhelming with so many languages and resources.
I'm so anxious to learn. I know it's a stupid question but is it possible to get a job in IT if I dedicate myself 100% to learning?

Implicit reference types were a mistake.

grab k&r, the intel software developer manuals, CLRS, the dragon book, and an OS textbook of your choice.

disregard anyone who says otherwise

Do you have experience with programming? If not start with something really simple and basic. You can wrestle with syntax and stupid language features in the future. Try python for a week and then see how you like it.

>unironically recommending python to a beginner
that's it buddy, turn in your /dpt/ badge, you're fucking done

He's right, anything more advanced would be scary

Fuck off moron. Python is a good taste of what programming is like logically. I didn't ask him to learn python or use it. I told him to try a week of python because you can get into the logical thinking of making programs without having to wrestle with syntax and constraints of older languages.

lads how do you pirate programming ebooks?

Gensis library

>good taste
In that case, I'd recommend Scratch. It's easy to learn, and easy to shed off once one starts learning real languages.

I rail against python because it has a lot of idiosyncratic syntax and best practices that won't help a beginner anywhere outside the realm of python.

It's better to start off with a language which has a more widely applicable syntax.

But if all you want to teach through Python is conditionals, loops, and objects, then there are many better options available.

Python is a good mix of both. Like I said, it is important that that user has a general feel of how programming is like past learning the languages before he commits to a career path.

Not him but if I've done basic programming (school exercises), how do I progress?

Well, as with programming, you learn people by training your skills.
I suggest Joe Navarro's body language skills books for that.
Spend your days reading and intepreting people. While you are occupied with it, go lifting and do some cardio for your health.
Being and looking healthy is a sign of having potential.
And employers always look for a lot of potential.


Also, how do I ignore the operands while applying Double.parseDouble on my string arrays?
Stuff like:
32.3456 MEi-ling
cause me a nullpointer exception.

>Pick a language
>Learn language
>Start programming in said language
>Become somewhat competent in language
>Decide if you want to continue learning said language
>If no, start from step 1 again
>If yes, decide if you wanna "specialize" in a particular subject or be a jack of all trades
>Buy more advanced books
>Keep learning

Cheers boss

>Cardio
Gonna lose those gains

>this meme
Seriously, you /fit/ boards are the very antithesis to what you should be about.
Go suck some tranny cocks.
Maybe your mom might offer hers to you in pity after she finishes with your daddy.

Shoo shoo gains goblin

How do I find good books?
I made a post about this I might look for pdfs of the book I pick anyway but I just need something like that place to find out which books are best.
There's a huge amount of different books and as a beginner I have no idea what to pick.

Stack overflow has plenty of recommendations for books of the language of your choice.

>idiots write unsafe code
>somehow blames it on the language
Whoa... so this is the power of a CS degree...

I want to matepress Pascal, Fortran and C.

Also, why do I get a Numberformatexception?
PS C:\Users\thora\Documents\Uni\Übungsblatt10\Material-20170628> java Reading
Exception in thread "main" java.lang.NumberFormatException: For input string: "25.88 Nordrhein-Westfalen"
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at sun.misc.FloatingDecimal.parseDouble(Unknown Source)
at java.lang.Double.parseDouble(Unknown Source)
at DatafileReader.(DatafileReader.java:61)
at Reading.main(Reading.java:5)


idx =1;
count=1;
while(count

Thanks i can try it.
Where do I find it though? I went there but I haven't been there before and just searching showed many questions about books to read and they had all been closed because apparently they're not supposed to ask that or something.

Here is an example for C++.
stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
Google for it. I got the above by googling C++ books stackoverflower. So do [language name] books stackover for whatever language you are looking into.

That's a problem.

Freelance studies masterrace, no seriously, fuck 99% of universities and their agenda pushing

building a HTML parser in C atm
hoping to add a basic rendering engine later

>What are you working on, Sup Forums?
An input method to make 60% and smaller keyboards as efficient or more efficient than 100% keyboards

Tell what did you want to result to and post the whole code

>why

your code basically includes only information that's not relevant, except for the fact that you're actually using Double.parseDouble I guess

my brother starts his studies in CS this fall and they start with C. I want to help him getting started a bit ahead of time. what C resources do you recommend for a complete beginner, which he can ideally complete independently?

Are you under the impression that your brother cannot use google?

anyway, unfortunately, with C, the only two decent resources are K&R, which is pretty outdated, and the C11 standard, which is way too thick for a beginner.