/dpt/ - Daily Programming Thread

What are you working on?

Old thread:

Other urls found in this thread:

pastebin.com/raw/z1Rddj9z
pastebin.com/raw/GgDJcjWr
youtube.com/watch?v=bHSDYa95mMo
twitter.com/SFWRedditGifs

First for C++

Is that a girl version of Shinji?

I'm working on a stylometry program desu.

I realised that a supervised learning algorithm using user provided labels (user names) is retarded, so I'm grueling through the math to get an unsupervised learning algorithm working.

Just coded a naive Llyod's algorithm, about to turn it into a smart one using the triangle inequality.

All trends seem to be moving into deep learning and stuff like that but I'm not smart enough for that and I don't know enough math

I started with webdev, then moved to Java (did a MOOC), then to C#, now I made a game in C# /Unity

So I know OOP fundamentals and decent amount of Java and C#

but nobody's gonna hire me if I only show a game in my github

Any advice what's a good way to get a job in any related field, what should I focus on? I'm in Europe

where are the job trends going?

Machine* learning

And home automation.

Video gaming is dead. Ed tech will die. Mobile is dying. AI is the only thing left.

Don't bother following the "job trends" or you'll always be way behind the people who always specialized in that thing which happens to be trendy now.

Pick your poison and as long as it's not terribly outdated, stick to it.

I know webdevs are naturally attracted to the shiny things of the month, but that's not what most serious employers want.

>deep learning
Well as far as job opportunities go its always gonna be a small field. Maybe you utilise it more in normal software.
And really when you do most programmers will just connect to the api and be done with it.

It's fun though.
>where are the job trends going?
As always performance programming is the one thing that stands securely. It won't ever go away. Learn that unless you're aiming/you're in a field that doesn't really care most of the time.

Find something you're passionate about though. I'm certain that in a job interview a person that's able to passionately describe their project will go way beyond a person which just follows the current fads.

How do I simulate a shift+click using python?

>dykes

I'm trying to write a small javascript guide for a friend of mine and holy shit I never realized how shit Javascript was before ES6. I can't believe I got used to a language where insane shit like
console.log(a) // undefined
console.log(b) // undefined
console.log(c) // ReferenceError: can't access lexical declaration e before initalization
console.log(d) // ReferenceError: d is not defined
a = 10;
var b = 20;
let c = 30;
console.log(a, b, c) // 10, 20, 30
console.log(d) // ReferenceError
can happen.

>performance programming
I don't have a CS degree. That sounds like something that requires a lot of knowledge about hardware.

The most fun I have when I program is when I am dealing with purely abstract, logical problems, no mathematical but algorithmic.

Algorithms are mathematics, user...

If you don't know the theory, you won't be able to work on any interesting problems.

I thought global warming should be incinerating india now?

Then why is java still around?

Great post, pajeet.

Feel free to go to that website where you can get points for these high quality quips.

I thought Mike Pence got to be VP?

Then why aren't Haskellers being put into electroshock treatment?

>What are you working on?

Your mum.
Why do you need to ask this every day jesus...

Because it's called a general, you fucking newfag

Maybe i should work on your mum instead.

Epik meme, faggot

>put java in resume

>Java "programmer"
>memgenerator.net

Sounds about right.

>Get java job
>Scream in agony when i take a look at their code

Double edged sword. I'll take a C# job any day, month, year, time, dimension, dimensional cluster, theoretical time state.

doesn't matter, I still earn more than you :^)

Didn't know the salaries in India where that high.

>le pajeet meme
stay jealous poorfag why you toy around with your pretentious language

Oh please, your precious JVM is implemented in my "toy language".

You literally wouldn't have a job without real languages supporting you.

not him, but, in your opinion, list 10 pretentious languages

So i know C, C++, Java, JS and PHP
Which language would you suggest me to learn next?
I want something that is easy to make it work with PHP.
I dont rly like Java, and im not that masochistic to write in C++

Have you tried web development with Assembly?

learn asm, then pick a scripting language like python or ruby

F#

Visual Basic 6

How do you crack simple software /dpt/?

I'm trying to crack this thing, i managed to bypass the 30 day check jmp but it crashes right after a dialog window.

>mfw I'm in a step far from writing a self-modifying code
#include

int main(void) {
void *(*to_main)();
to_main = &main;
int test = 0xEEBB1144;
int i;
for (i = 0; i < 1023; i++){
if (*(int *)(to_main+i) == 0xEEBB1144) goto out;
}
printf("Nothing found\n");
return 0;

out:
printf("Found EBIN\n");
printf ("0x%x", test);
return 0;
}

Ruby vs Python for beginners?

>Is that a girl version of Shinji?
Shinji was never happy, at least with Ritsuko.

AoC 2016, Day 8, Python.

Part 1: pastebin.com/raw/z1Rddj9z
Part 2: pastebin.com/raw/GgDJcjWr

Python, no question here.

Ebin xD

Thoughts on this guy?

youtube.com/watch?v=bHSDYa95mMo

>i know C++
>i know C

lmao

Is winsock2.h definitely the correct sockets header for Win7? Compiling and getting anything to work using Visual Studio has consumed my morning and afternoon thus far...

>i know
woah

yeah but you also need to link agaisnt the winsock lib

If it crashes, you didn't patch it right.

Try to understand the code before changing things.

the joke is that you think you know C++ as a whole, but you don't.

you probably can write small programs but thats it

Yeah, so far I have:
#define _WINSOCK_DEPRECATED_NO_WARNINGS 1
#pragma comment(lib, "Ws2_32.lib")

This lets me compile and run my test program, but it doesn't work properly and the debug output is full of messages along the lines of ''ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.'.

It's annoying but I'm sure Google can fix it...

>you think
I don't, even its creator doesn't know it

Is Modern C a good book?

so you don't know the language afterall

retard

That problem just means that MSVS cannot find debug symbols for ntdll, your program will work just fine, no worries.

No, and I never implied that

>So i know C, C++,

That's not my post, I was greentexting around.

But do YOU know c++?

Why is Douglas Crockford so autistic?

Why do you think he is?

I know ask me anything

Why the fuck is MFC so convoluted? like Jesus fucking Christ.

Explain the consume memory ordering, and the differences with acquire semantics.

Protip: You can't ;^)

>C
>Modern
Pick one an geeet out

>MFC
I like Mfc but chaturbate is much better
I can watch traps there, much better desu

All his inane pointless rules.

Never uses traditional for loops, always uses forEach instead. Never uses the 'this' or the 'new' keywords, always uses factory functions instead. You must put a space in between "function" and "()" for some reason.

template
T average(T a,T b)
{
return a/2 + b/2 + (a%2 & b%2);
}

Prove this wrong. I dare you

Prove that is right, first . I dare you

(a + b + 1) / 2 works just as well, though you may encounter overflow

BTW, replace x % 2 with x & 1

Yeah you're right. The problem was the test IP addr in the tutorial must be outdated. I replaced it with one from Google and now I get the results I expect.

why use for when you can use foreach?

>Never uses the 'this' or the 'new' keywords, always uses factory functions instead
They have the potential to be dangerous.

>You must put a space in between "function" and "()" for some reason.
never heard that one.

These are all guide lines. if you don't like em, don't use them. But if you do you them, your code will be safer and less prone to brain melting js-ism bugs.

>(a + b + 1) / 2 works just as well, though you may encounter overflow
That's the point. average of INT_MAX-1 and 10 is going to give wrong output.

>BTW, replace x % 2 with x & 1
Doesn't work with signed. Try -3 and 3

i was just trying to show a simplification :

>Doesn't work with signed. Try -3 and 3
What?

3 is ..0011
-3 is ..1101

Works fine.

C and C++ doesn't standardize how signed integers work. Signed integers are compiler specific. They have a choice of one of three types of signed

On my machine, average(-3,3) becomes 1.

Oh, you're right. I hate how underspecified C is.

>why use for when you can use foreach?

Using forEach needs a new function, so if you're already inside a function and you want to return a value, it can get autistic and mess up.

For example:

function contains(array, word) {
array.forEach((x) => {
if(x === word) {
return true;
}
})

return false;
}


A non-autist way to do it would be:

function contains(array, word) {
for(var i = 0; i < array.length; i++) {
if(array[i] === word) {
return true;
}
}

return false;
}

well you wouldn't use a foreach in that situation anyways for the exact reason you gave.

I'm not completely against forEach, my point is Douglas is against traditional for loops entirely even when sometimes they are more appropriate than forEach.

Not being able to deal with nested functions is not a good reason to not do something.

which one is faster?

that's what matters

Why would you use foreach to test for a condition?

Doesn't Javascript have an equivalent to something like:
if (myList.Any(x => x === "ass")) return true;

That's not a case against foreach at all; it's just using it wrong, and a for loop is not the solution here.

In Python that's just:
contains = lambda arr, word: word in arr

Hey guys, new to programming, should i start by learning java? If not, then is C++ a better choice? If neither, which language would be good to start with? Thanks in advance!

I haven't used a traditional for loop in the entirety of 2016.

Why use for loops when you can use set comprehension?

I can't think of a situation where they would be more appropriate unless you're working with a case that you need to ultra-optimize (which are very very rare).

>Douglas is against traditional for loops entirely
really? Kinda doubt that. there's scenarios where you absolutely need a for/while loop.

what's your current occupation, and why are you interested in programming?

>that's what matters
only to bad programmers

C++ is a fine choice, but I think that C# is the best first language between C#, C++, and Java.

Avoid Python as your first language, but it's not a bad language to know.

If you want to get into low-level stuff (unlikely), then start with C.

>Avoid Python as your first language
retard

>If you want to get into low-level stuff (unlikely)
Stop projecting. Not everyone is a code monkey.

Python is extremely different from C, C++, Java, and C#, which are the other huge languages from a pure job-count perspective.

It would behoove anyone to know one of the former 4 languages, rather than the latter.

>be me earlier this semester
>senior at UNI
>chilling in the UNI CS lounge
>overhear underclassman talking
>a neckbeard jokingly says that he is overwhelmed and he would like to kill himself
>a pajeet replies asking if he really is going to do it this time and not be a liar
>neckbeard just looks very sad at his computer
>he takes off his shoes revealing that he isn't wearing socks.
>pajeet continue making fun of neckbeard
>neckbeard starts slapping his bare feet against the linoleum floor
>everyone gets up and leaves to go to class
>neckbeard cries out 'wh where are you guys going, ar are you leaving me??' while still slapping his bare feet.

For fuck sake are CS majors like this everywhere?

I have more stories of this neckbeard if more is wanted.

Of course you haven't, JavaScript programmers have been memed by Douglas Crockford into not using traditional for loops any more.

His only complaint? He doesn't like seeing three statements on one line. That's his only problem with traditional for loops.

Nah, it's true, in one of his presentations he says he only uses forEach. He used to use "while" loops, but he's dropped those in favour of recursive functions.

I'll see if I can find it for you.

Are all servers daemons?

I'm not a Javascript programmer.

Though I have no idea who this person is, I agree with him I guess; it's easier to read set comprehension than index-based iteration.

>I'll see if I can find it for you.

thanks big guy

no survivors

No.

I work in hardware, but I want to learn the software side aswell, so I want to learn programming to get deeper knowledge of computers

Also, I'm curious:

What are three situation where you normally use a traditional for loop?

I'd like to see how my normal approach differs.

how deep are you willing to go?

Is there any literature that actually confirms that programs written using static typing actually result in fewer bugs?