/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

stevelosh.com/blog/2016/12/chip8-cpu/
pastebin.com/MftqQ6i2
github.com/rust-lang/rust-www/issues/268
jeffe.cs.illinois.edu/teaching/algorithms/everything.pdf
en.wikipedia.org/wiki/Generic_you
twitter.com/NSFWRedditGif

First for D

Friendly reminder that Lisp is the greatest programming language with the greatest programming community.
If you are not programming in Lisp, you honestly can not call yourself a programmer.

stevelosh.com/blog/2016/12/chip8-cpu/

Should I add exception handling to my program only whenever Eclipse suggests it it?

Or more often?

Fun(ctional) programming discussions:

When I apply for a software dev job, should I link them to my github page? I only have a few Python and bash scripts there.

Of course. Bonus points if you have Sup Forums projects listed.

Yes, always link your github and your stackoverflow account.

I'm not on PajeetOverflow.

Only this Are you guys actually serious or not?

I would seriously link to the GitHub. I don't have a Stack Overflow, but that wouldn't hurt (assuming you don't ask retarded questions).

looks cool. What's the best Lisp interpreter for Linux?

do you think any user here has a job?

>I'm not on PajeetOverflow.
Then forget being hired by any startup in the bay.

you should link:

>your github
to see the code you wrote

>your twitter
to see if you're a racist bigot

>your facebook
to see if you aren't a sperg

>your reddit
to see your post history

Steelbank common lisp (sbcl)

REEEE why must we split /dpt/ even more ffs?

/dpt/ is slow as it is.

This is our 3rd thread today already.

/dpt/ isn't too slow.

You jest, but someday this may actually be a thing.

>GitHub
yes
>Twitter
no
>Facebook
no
>Reddit
no

They should be able to tell if you aren't a sperg in the interview.

pastebin.com/MftqQ6i2

this takes 1sec to run if compiled with visual studio, and >70 sec to run if compiled with g++

any ideas why?

A few of us do.

I love my job.

The haskell autists got mad because you trolled them too much. What they didn't know is that now I know where they went and that they are clustered in one place at the same time.

-O3 ?

Any reason why you #define TEN_MILLION instead of just putting the actual number?

enable an optimization flag in g++
also, do the threads even get started?
some languages you have to explicitly start them after constructing them

WHAT LANGUAGE IS BEST FOR HEAVY COMPUTATIONS

PLEASE HELP

i exagerated the number a bit

the original was
#define SIX_MILLION 6000000

What are the optimization flags for g++? Also, have you thought

C/C++ with GNU Multiprecision

>be me
>dystopian future governed by women
>men chained in silicon mines
>go to the HR chick
>sup! the boss gave me a new job
>"what kind of job?"
>a blowjob
>le troldad_dance.jpg

C++ and CUDA / GPU programming

Easier to read

Is Rust any good?

oy vey
Still, why aren't you just putting the number in the program?

I'm starting to get really autistic with design patterns and going overboard with simple projects.

What do?

They way he constructed the threads they will launch automatically whenever possible. Read the std lib about threads of C++

KISS

>Rust
oh boy here we go again

github.com/rust-lang/rust-www/issues/268

dumb frogposter

What about when you need to redefine the number, such as for the metric system?

yes

>KYS
ftfy

what are some examples? If it makes it easier to read and/or faster, then do it.

word, i use java/python if i want anything with oop and c otherwise desu

...

The submitter looks exactly like I would imagine

#define METRIC_MUL 420
#define MAX_VAL 10000000*METRIC_MUL

Also, if you need to redefine the number enough, it makes sense to store it as a variable instead of a macro.

But design patterns make your code easier to maintain desu.

Then the name you chose for it will be wrong which means you have to go over the program again.
I mean I guess it makes sense if you happen to use the same number for different purposes and then only want to change specific occurences. Like when you're calculating the amount of jews Hitler killed, and factor in the number of cocks OP sucks, but then OP goes and sucks another cock so now you have to change all the occurences of 6000000 that refer to cocks OP sucked to 6000001 while leaving the number of crispy jews the same.
But then why would you call that "constant" TEN_MILLION? If you change the value, the name becomes meaningless and indeed confusing.

Until they don't. Like all things, they are good only in moderation.

guys i'm genuinely spooked. i sovled the first 11 problesm (except problem 10) on euler and now i'm realizing i'm only good at brute forcing them. you can't bruteforce the next ones what should i look into for optimization?

just leave the problem running a couple days

A book on programming.

learn lots of theory
problems solved without brute force typically apply some theoretical math and computer science

ya sounds good. actually what i'll do is hack they shit and turn it into a botnet and use millions of parallel computations to do teh massive number crunching!

well most books say syntax.

jeffe.cs.illinois.edu/teaching/algorithms/everything.pdf

you can skip the language theory parts

...

it's the KISS solution

Anyone knows how can i install g++ on windows?

But what if you want something that works fast? C++ is compiled and I much more prefer it over C.

MinGW

No it's not. You misunderstand what KISS means. It is not an excuse to be lazy. Far from it.

>13:39:00

in my post it says 19:39:00

It has to run to only once.
Running it for a while is completely adequate and leaves the solution clear and simple.

So i'm trying to open as many TCP sockets as possible in my program, and something is breaking.

When I get to around 537, the program crashes in SDL_net because of "stack smashing". Here's some relevant data from Valgrind
*** stack smashing detected ***: ./a.out terminated
==13234==
==13234== Process terminating with default action of signal 6 (SIGABRT)
==13234== at 0x612D428: raise (raise.c:54)
==13234== by 0x612F029: abort (abort.c:89)
==13234== by 0x616F7E9: __libc_message (libc_fatal.c:175)
==13234== by 0x621056B: __fortify_fail (fortify_fail.c:37)
==13234== by 0x621050F: __stack_chk_fail (stack_chk_fail.c:28)
==13234== by 0x542C675: SDLNet_CheckSockets (SDLnetselect.c:153)


Any ideas?

i already install gcc on my windows, and i can compile c programs just fine, but when i do g++ it says "not an internal command" or something

actually lolled

Why would you even do the Euler problems if you're not trying to improve yourself? Might as well just google the answers. That's truly the simple solution, no?

Either you have a stack overflow or you are writing past the end of a stack-allocated array.

You mean:
is not recognized as an internal or external command, operable program or batch file., yes?

You need to add it to your PATH variables.

Locate the .EXE used for compilation, and Google how to add PATH variables for command-line access.

Otherwise, you'd need to type out the fully qualified path to your executable.

i am trying to improve myself and my algos user.

i'm a homeless programmer self admittedly my shit got stolen and i'm happy because through that i started doing euler at library computer.

>What the fuck is a timezone? Sounds like some communist shit.

I'm not the one doing the problems.

But if someone paid me to do it, I'd just let it run and call it a day.

Did you know that the entire country of China has just one time zone, although it geographically crosses five?

well if they were paying per problem solved then this would not be very efficient because of the time it'd take to get solutions. you'd be better optimizing it == more problems solved, more money.

Yes.

What does that have to do with anything?

I can do other shit while the program runs.

you realize that on euler bruteforcing some of the solutions could take upwards of days? where an optimized algorithm can get the answer in less > 60 seconds...

>en.wikipedia.org/wiki/Generic_you

Learn to read, fuckwit, or better yet just immolate yourself already.

i prefer c desu
structs work just as well as classes :^)

also i legit have never used c++ because java and others satisfy my ``legitimate'' oop needs sufficiently well
this is a bit trivial but i fucking hate operator overloading, too

C++ noob here, is this okay code?
Task: Czeck if two short integers have exactly matching digits (repetitions allowed). Print Yes/No accordingly.
Basically put each digit in the corresponding index of a flag variable, then XOR.

this is my bin folder

there is no g++ exe in this folder

>timezones sound communist
>largest communist country doesn't have timezones

no u

His argument was dependent on someone doing the Euler problems. So it was necessary to point out that I'm not.

nice screenshot

>taking a picture of a computer screen with a camera

I forgot to bring my cable pls no bully

i hate this, everything is too connected, i want to keep real life separate from fracebook, facebook separate from Sup Forums, Sup Forums separate from everything else
why does everything gotta run into each other now. people 15 years ago didn't act irl how they acted in chat rooms, nothing has changed

is your computer just not internet-connected?

thanks
yeah, that's literally what "screenshot" means

They shut it off, too many noisy freshmen. Yes, university we're talking about.

no, he forgot the wifi cable

Yes, university shut it off. too many noisy freshmen.

lmao what...who the fuck shuts off the internet

...

Whats the outlook/expectations for entry level no-college people in more normal programming jobs? (as opposed to web-dev where you can get a job easily with a pretty basic portfolio and maybe studying for a couple months if even that)

it's easy to setup g++, follow my steps:
1) put this code in g++.c
#include

int main(int argc, char** argv){
printf("Hello world\n");
return 0;
}
[code/]
2) then run this command:
gcc -o g++ g++.c
3) optional, add the directory containing g++ in the path (refer to your OS manual)

who the fuck shuts off the internet... lmao what

What in Satan's holy name do you think cpp.exe is? Communist Pool Party?

There's no reason to use &Num over Num, is there?

1. that's C code. not C++ code
2. i think don't have g++ installed on my computer

I got to about 60 a couple of years ago with no CS, math or algorithm knowledge.

Just brute force it, and if it's not fast enough, profile.

>that's C code. not C++ code
it is both you fucko