/dpt/ - Daily Programming Thread

Old thread: What are you working on, Sup Forums?

Other urls found in this thread:

en.cppreference.com/w/cpp/language/structured_binding
youtube.com/watch?v=hB6eY73sLV0
pastebin.com/Ce8hT7qg
twitter.com/SFWRedditImages

Gay ticket simulation system with threads

>Posted before the bump limit
Delete this and kill yourself, you degenerate fuck.

I miss Yuki in the OP.

Lots of irritating, spurious parentheses:
(((lambda (a b)
(lambda (f z) (a (lambda (x) (b f x)) z)))
(lambda (f z) (f (f (f z))))
(lambda (f z) (f (f z))))
(lambda (x) (cons x x))
'())

Is there any situation where a platform would support core profile opengl 3.2+ and not 2.1?
Can I get away with runtime checks during context creation so I can convert my shaders to modern glsl by injecting some keyword replacement macros at shader compile time?

Astolfo is gay.

Friendly reminder that device major:minor numbers were a mistake.
devfs should just be like sysfs.

>Is there any situation where a platform would support core profile opengl 3.2+ and not 2.1?
It's allowed, but I don't know of any implementation that does so.

>Can I get away with runtime checks during context creation so I can convert my shaders to modern glsl by injecting some keyword replacement macros at shader compile time?
I believe GLSL is backward compatible. If you write a GLSL 1.2 shader with #version 120 it should work on any context above OpenGL 2.1.

>post 15/hour wordpress on indeed for the place i work
>specifically tell them its part-time (20-29 hours)
>dozens of applications from people w/ CS masters degrees and years of experience at major companies applying

huh

are these bots that auto-apply to things? their resumes list them being in my city but i find it hard to believe that people are this desperate for jobs

People can't lie on their resumes huh?

I'm writing a C program in which some things need to be updated in the background while the user may/may not enter a message.
Should I use forking or threads for it. What is the difference between the two?

How the FUCK do I get an int out of std::hash?

unsigned int hashOf(const KEY& key) {
std::hash hasher;
return hasher(key);
}

This compiles, but then fucking tells me "UNSIGNED INT UNEXPECTED" in a fucking for loop.
for (int i{ 0 },unsigned int potentialIndex{ hashOf(key) % arraySize }; statusArray[potentialIndex] != 0 || i < arraySize; i++, potentialIndex = (potentialIndex + 1) % arraySize) {
if (keyArray[potentialIndex] == key) return valueArray[potentialIndex];
}

Forking creates a new process. To make a long story short, memory is not shared between processes like it is between threads.

I'm learning C++ and I just wanted to read a tutorial on Win32 API just for the sake of knowing how Windows handles GUI, but now this tutorial is telling me to learning C or else I should go fuck myself, what the fuck?
What are some good C books?

There are people holding master's degrees working at mcdicks and spamming every place with an email address because they just can't get that first bit of experience to get their foot in the industry.
Torment them during the interview process, they're probably suck you off under the table if they think it'll land them a job offer.

So what is better for what I want to do? Or does it not matter, since both 'functions' are independent of each other?

Using threads will have less overhead. Both will work.

use a thread, fork has some different considerations

alright, thanks

...

you don't need C for winapi, I don't even use the C family for winapi.

Appreciate it

Fuck if know, but reading about C doesn't hurt.
Another question. Most C++ compilers compile C code without a problem don't they?

Yes.

>int i{ 0 }, unsigned int potentialIndex{ hashOf (key) % arraySize };

anyone wanna make a fake company with me so i can put something on my undergrad resume

WTF does it expect? The return type of hashOf(key) is unsigned int, is it not? Or does it not cast from the hasher() call to an unsigned int? Why the fuck does it compile?

...

>it compiles
What the fuck. Anyway, you're not supposed to be able to declare two variables of different types in a single declaration

Ohhhh, it's because it's a different fucking.

Fuck.
Thank you guys.
Fuck, I'm losing my mind. Will it cast to int if I properly rename hashOf to int, and do it from there, then?

Just the QUALITY of C++, we've all come to love.

Just wait for C++17, you'll be able to
auto [i, potentialIndex] = std::make_tuple(0, hashOf(key));

Why are you guys always coding some random bs algorithm. When are you guys going to develop something usable? serious question.

>an array of a tuple of an index and key of a hash
Or is in still a tuple?

en.cppreference.com/w/cpp/language/structured_binding

>When are you guys going to develop something usable?
Like code flappy bird using super mario world as an IDE?
youtube.com/watch?v=hB6eY73sLV0

>const auto& [a,b,c] = std::tuple(x,std::move(y),z);

Jesus christ, im glad i stopped using sepples.

Fuck Visual Studio.
It gives me shitty, unfuckingproductive errors that completely give me no fucking information while I can go to ideone and it looks for _actual_ syntax errors and other sanity-based shit before it starts looking for generic (sorry, "TEMPLATE")-based code-analysis garbage.

gitgud

learn to read through that garbage is how you become a sepples my user

user, you're meant to write C# in VS.

I made this, it seems to work, but I was fucking around and I don't know how.

Visual basic, opening a .csv and reading the data. L is the value for minimum, H is maximum, T is the current data point. It spit out an accurate minimum and maximum each time I used it but it was only a couple times, any explanation?

Getting syntax errors and learning to read them correctly is part of learning user.

We've all been there

>Visual basic
>took a picture of the screen

surprised dumb phone posters can even work a computer, desu.

School computer in lab, and I was on the way out since I just whacked together what I needed to leave.

>What is readability?
>What is comments?
>What is self documenting code?

you should learn how to name your variable.
you should name a variable in a way that tommorows you can look at the name and know the purpose right away.

Not the same user, but yesterday I opened an old C# project to do some adjustments to it and when tried to compiled it gave a random error about a file not found and that error was in a another file called 'CSC', but there wasn't any CSC file in my project and clicking on the error didn't do anything. I googled the problem and also nothing.

It had been a while since I last used C# so it took me a while to figure it out what the fuck was wrong. After messing around I remembered that for that project I 'inserted' tree icons into the binary and had to do some shady hacks with resource file for it work properly.
In end the source of the problem was that my project was referencing a resource file with an absolute path from my old windows installation that didn't exist in my current PC. I just went to the project proprieties and fixed the resource path. I still don't know why Visual Studio used an absolute path for a resource file.

>Tell me about yourself

Should I talk about the fairly large (10k+ users) web service I built and maintained when I was 12? Everywhere I read says don't include things from your personal life, but I don't think I have enough to talk about with my almost zero work experience.

>the fairly large (10k+ users) web service I built and maintained when I was 12?
what was it?

It was basically a set of irc channels and mirc bots for information sharing in an online game. Not really a "web service".

Did someone tell you to ask shitty interview questions here, or did someone say that this thread was for posting the code you're fucking working on?
Jesus fucking christ. Why are you even being interviewed? Do contract work.

Need some help with my first powershell script if someone can:

I have a working script that compares two text files, and lists the differences with a side indicator.
Now i want to send a mail when differences between the two files are found, but i cant find a function that checks for the sideindicator, does this even exist?
I mean i could store the output of the comparisson in a external file, and check for the file to send a mail, but i just want to know if there is a way without this extra step.
Thanks

>What are you working on, Sup Forums?

system programming on gnu+linux

No you should fuck off you self loathing downy.

What's the difference between using multiple if statements in a row and using else ifs?

>ifs in a row
second will be executed if both conditions are met
>else if
second will be executed if first condition fails and second condition is met

Really nigga?

In a functional, function definition, does 'a' stand for "anything" or "anonymous"?

What?

Why don't you try it and see what happens yourself?

void foo(void)
{
bool a = true;
bool b = true;
if (a) { puts("foo A"); }
if (b) { puts("foo B"); }
}

void bar(void)
{
bool a = true;
bool b = true;
if (a) { puts("bar A"); }
else if (b) { puts("bar B"); }
}

foo();
bar();


try this

Like a List a
I know a is just a variable there, hence "a list of anything", but i could of sworn the reason it's often used is because it was a common shortening of one of those two words.

It doesn't mean anything in particular. It's used because it's the first letter of the alphabet. Then additional type parameters are b, c, etc.

I'm working on my shell

passing an iterator to list() will result in a list of all iterations. Although this is a 1-d list.
>>> import itertools
>>> iterable = [1,2,4,5,6,7,8,9,10,11]
>>> list_of_tuples = list(itertools.combinations(iterable, 3))
>>> list_of_tuples
[(1, 2, 4), (1, 2, 5), (1, 2, 6), (1, 2, 7), (1, 2, 8), (1, 2, 9), (1, 2, 10), (1, 2, 11), (1, 4, 5), (1, 4, 6), (1, 4, 7), (1, 4, 8), (1, 4, 9), (1, 4, 10), (1, 4, 11), (1, 5, 6), (1, 5, 7), (1, 5, 8), (1, 5, 9), (1, 5, 10), (1, 5, 11), (1, 6, 7), (1, 6, 8), (1, 6, 9), (1, 6, 10), (1, 6, 11), (1, 7, 8), (1, 7, 9), (1, 7, 10), (1, 7, 11), (1, 8, 9), (1, 8, 10), (1, 8, 11), (1, 9, 10), (1, 9, 11), (1, 10, 11), (2, 4, 5), (2, 4, 6), (2, 4, 7), (2, 4, 8), (2, 4, 9), (2, 4, 10), (2, 4, 11), (2, 5, 6), (2, 5, 7), (2, 5, 8), (2, 5, 9), (2, 5, 10), (2, 5, 11), (2, 6, 7), (2, 6, 8), (2, 6, 9), (2, 6, 10), (2, 6, 11), (2, 7, 8), (2, 7, 9), (2, 7, 10), (2, 7, 11), (2, 8, 9), (2, 8, 10), (2, 8, 11), (2, 9, 10), (2, 9, 11), (2, 10, 11), (4, 5, 6), (4, 5, 7), (4, 5, 8), (4, 5, 9), (4, 5, 10), (4, 5, 11), (4, 6, 7), (4, 6, 8), (4, 6, 9), (4, 6, 10), (4, 6, 11), (4, 7, 8), (4, 7, 9), (4, 7, 10), (4, 7, 11), (4, 8, 9), (4, 8, 10), (4, 8, 11), (4, 9, 10), (4, 9, 11), (4, 10, 11), (5, 6, 7), (5, 6, 8), (5, 6, 9), (5, 6, 10), (5, 6, 11), (5, 7, 8), (5, 7, 9), (5, 7, 10), (5, 7, 11), (5, 8, 9), (5, 8, 10), (5, 8, 11), (5, 9, 10), (5, 9, 11), (5, 10, 11), (6, 7, 8), (6, 7, 9), (6, 7, 10), (6, 7, 11), (6, 8, 9), (6, 8, 10), (6, 8, 11), (6, 9, 10), (6, 9, 11), (6, 10, 11), (7, 8, 9), (7, 8, 10), (7, 8, 11), (7, 9, 10), (7, 9, 11), (7, 10, 11), (8, 9, 10), (8, 9, 11), (8, 10, 11), (9, 10, 11)]

>a girl who wants to be a boy who is also a famous fictional hero who was an actual boy in his own legend, kicks a boy who dresses like a girl who is an actual historical character that dressed like a man in reality in the balls
God bless Fateshit

Really makes one think.

why is fortran ahead of C

but c++ > java plt wise

To make you think, silly ;)

What are you trying to say?

Which came first, the language or he compiler?

Anyone able to lay down how exactly I can achieve this:

I have a python program that generates graphs using Bokeh, some flags are passed to the program and these flags determine what the graph will output.
The python program then outputs a html file which contains the graph, which is built using javascript.

I want to have a html form on my website that the user can fill in, which will set the flags of the python program. The website will then either automagically direct to the page created by the graph, or preferably; somehow virtually embed the graphs page inside the currently opened page (this is probably not achievable, but worth mentioning).

Anyone able to recommend frameworks/server I should use to achieve this?
Thanks

Are you some kind of retard?

If a C compiler was written in C, how was it written if there wasn't a compiler to begin with?

We made compilers out of hand-made circuits that ran off the wireless rage of Tesla's ghost.

>mfw I finally got my janky pajeet-tier Java image manipulation project working perfectly but got told by my professor I have to refactor half of the methods since they're not "elegant"

Is there a curriculum of C++ or C# programming exercises I can do to simultaneously help me build up my skills and learn the language?

I don't think ive ever seen any piece of java code I'd call elegant. By elegant he meant "conforms to my arbitrary style" right?

Any decent programming book will have end of chapter exercises to help you apply the new concepts.

Would you have any recommendations?

Ask your professor if he'd ever like to visit planet earth. In other words, your prof is out of touch with the real world

Yeah pretty much.

Pic related is all the style guidelins we're forced to follow to the letter in this class or else your grade gets assraped.

Here's the code for the shitheap I just got done writing if you wanna roast me for being a fucking noob.

pastebin.com/Ce8hT7qg

I rate your github/bitbucket/gitlab/whatever on 10.

No idea, as i don't use sepples. Try a Scott Meyers book though. He's pretty great at explaining concepts.

The language, then someone wrote a compiler for it.
The first one wasn't.

>do not put spaces after and before left/right parenthesis
oh boy, i can already tell he's a great teacher.

>The first one wasn't.
It was written in what then, binary, assembly?

This so much.

Java got popular because it's essentially the AK-47 of programming languages.

It's really versatile, runs on fucking everything everywhere and is extremely forgiving of not coding/styling things exactly perfect.

Having taken Python last semester, I can sse why everybody says Python programmers are the biggest brainlets.

B

B is not even a real language, nigger

>a real language,
Yes it is, it was essentially the alpha version of C

first c compiler was written in assembly.

Version 3.2 introduced the core profile which will break compatibility with older shaders.

NB -> B -> PDP-7 asm

BCPL or assembly
C is the ak47 of programming languages, Java is some experimental chink copy

>he's a great teacher.
*she's. Not even gonna go into that...

It's funny because the dude I had for my CS 101 Python class last semester acted like the most stereotypical pajeet to ever walk the earth, but was actually really chill and had a ton of real-world knowledge to pass on since he spent a good deal of time at both EA and Microsoft before he started teaching.

trying to solve pic related with bruteforce right now, but it takes fuckin ages.
Any thoughts to improve?
I think comparing if the decrypted string contains a common english word takes lots of time apperently and I just compare it to 1k words