/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

gwan.com/faq#license
hackage.haskell.org/package/vector-algorithms-0.4/docs/src/Data-Vector-Algorithms-Intro.html#sort
en.cppreference.com/w/cpp/language/constexpr
youtube.com/watch?v=TcqWok8AubE
youtube.com/watch?v=cbBkAdNc88w
twitter.com/NSFWRedditImage

suh

>terry is banned from twitter
>trump isn't

dumb frogposter
go back to

does anyone know where i can find
>FOSS algorithmic music composition software similar to soundhelix and cgmusic but without a restrictive license
or
>good learning material for algorithmic music composition

How does it feel knowing that you're being denied a job because they hire non-technical people to hire for technical jobs?

www.gwan.com/blog/20160405.html
>what is the name of the KILL signal?
>Me: SIGKILL which #define is set to 9.
>Recruiter: no, it's "TERMINATE".
>Me: SIGTERM (15) is different from the KILL signal (9).
>Recruiter: that's not the answer I have on my sheet of paper.

template
typename std::enable_if::type
g_quickSort( T first, T last)
{
T pivot = last -1;
size_t length = (last - first);

if(length < 2)
return;

for (T it = first; it < pivot; it++)
{


if( ((*it > *pivot && it < pivot)
&& it != pivot)){


*(pivot -1) += *pivot;
*pivot = *(pivot-1) - *pivot;
*(pivot -1) = *(pivot -1) - *pivot;
pivot -= 1;

if(pivot != it)
{
*it += *(pivot +1);
*(pivot +1) = *it - *(pivot +1);
*it = *it - *(pivot +1);
}


it -=1;

}
}

if(pivot -1 > first)
g_quickSort(first,pivot-1);
if(pivot + 1 < last)
g_quickSort(pivot+1,last);
return ;
}


how come my enable_if doesn't work; the function works fine without it

the compiler error doesn't make sense to me

inplace_quickSort.cpp:7:79: error: type/value mismatch at argument 1 in template parameter list for ‘template struct std::is_arithmetic’
td::enable_if::type
^
inplace_quickSort.cpp:7:79: note: expected a type, got ‘std::iterator_traits::value_type’
inplace_quickSort.cpp:7:87: error: template argument 1 is invalid
enable_if::type


why isn't iterator_traits::value_type a type!!!

Can someone point me to a guide on passing strings into an array/vector from another function?

>here i'll look it up on google to show you

I’m trying to get my two business partners to sell outside of their comfort area - customers that are clamoring for our product but my partners are overwhelmed.

The programming doesn’t even matter at this point.

Reposting from last thread.
What are some good books to learn me about compilers and shit? People seem to have this really in-depth knowledge of how the C compiler and Java compilers work and I'd like to learn more about them.

try

auto g_quickSort(T first, T last) -> typename std::enable_if::type

Reminder that C fanboys are brainlets who accuse others of being dumb even though they don't understand anything more complex than raw pointers

wtf i love haskell now

notetaking program with dolphins and rng generator in freepascal

>9. There's an array of 10,000 16-bit values, how do you count the bits most efficiently?
__builtin_popcount

auto g_quickSort(T first, T last) -> typename std::enable_if::type

this is what the monkey thinks is sensible syntax

it cuts down on the other generated errors, but the main one is still there

am a big fan of trailing return type though

I refuse to believe this is real. No sensible person would hear a detailed explanation and then just say "NUHUH THE PAPER SAYS DIS WORD"

maybe it should be

::typename value_type

?

oh, fixed it
thanks

Reposting this shit since autists were arguing in last thread:

Sup /dpt/, I posted on here last week about an online coding screening I had to take for a possible job for this SF startup.

Well, the interviewer said he liked my code (including after a retest, when he gave it to candidates again after realizing we didn't know we could use third-party libs), and I got a remote technical interview tomorrow over Google hangouts. Says it'll consist of "meeting the team, set of technical questions and a small documentation exercise".

Is there anything I should "study" beforehand to get a good idea of what kind of questions they might ask, or any tips you might have to ace this interview? This is the quintessential dream job, and although I was an EE major in college, I've been programming for a while and am really gunning hard for this gig so I don't have to do this mediocre electronics tester job that I already have an offer for. Thanks fellow Sup Forumsents.

Chase the Dragon. Book it.
Then look for critique of that approach, which will list other more intro level books.

I just got an assignment totally out of the scope of what we learned and what we're going to learn for the next weeks, I mailed the teaching assistant who did it to know wtf he was on and am waiting for an answer.

I also discovered he didn't do the assignment himself just got the code he shows on the internet and attached the code in the mail, also considering snitching to the head teacher that his assistants are retards.

Should I KMS if I consider hiring someone to do it for me instead of (literally) wasting time? I'm not against working on projects that require time, but the man went totally batshit on this one and is clearly asking for things out of our abilities

C++ truly is awful

The G-WAN author is a bit... odd, it could be either way.
gwan.com/faq#license

/dpt/ give me ideas for a good project please.

>serif font

waiting for someone to post the fake haskell quicksort

The fuck is C++/CX

Is Microsoft pulling the another com c++ shit?

What's the project? Post detailz

>clearly asking for things out of our abilities
b-but that's how you learn senpai

Here's a good project idea: create a random number generator that selects one of the options from this chart.

hackage.haskell.org/package/vector-algorithms-0.4/docs/src/Data-Vector-Algorithms-Intro.html#sort

Trump never used the N-word.

Isn't that their .net thing?

>tfw you've already done most of the red ones, certainly all the interesting red ones
What now, /dpt/?

Are you using idioms or is that the title of something?

what would the equivalent type_traits/concepts matching look like in a different language

Yup thats full blown autism

Won't post it for obvious reasons.

The fact is it uses advanced functions of the language and is totally out of our reach. I achieved to do all the assignment so far, but reading what we are asked to do is totally stupid and the assistant didn't even do it himself, which is fucking hypocritical imho. I reached the assistant and hopefully he will get his shit together, but I'm having an ethical dilemma about having someone to do it for me. It sounds so stupid to me and yet if the guy doesn't back off, what are our options? I mean, besides sinking hours to hopefully do something that will get us a potential passing grade for the project.

>C++/CX(component extensions)is a language extension forC++compilersfromMicrosoft that enables C++ programmers to write programs for the newWindows Runtime platform, orWinRT API.

Literally the first result on google.

Search compilers book it's the one with the dragon cover

generic
public ref class bag
{
property T Item;
};


Runtime c++ generics for everyone!

What does Twitter have against the mentally ill?

Put "Dragon Book compiler" into a search engine. Read the criticisms to find other intro level books.

Just ask here if it's simple(short)

>have sepples class
>teacher is going through I/O before if statements or loops
>code blatantly copypasted from K&R (while ((c = getchar()) != STOP))
>will only go through the very basic stuff (if statements, loops, maybe structs)
>this is mandatory 2x 1 hour for 1 year class

That'd be so frustrating

>mfw using bytestrings and strtok instead of a database
>just werks

quickSort :: (Num (ValueType t), Ord (ValueType t), Iterator t) => t -> t -> IO ()

Thank you for your invaluable feedback.

>calling out GPL for being the trash that it is
>mentally ill
>implying

This is fucking horrifying.

M8 I don't know if you know who that guy is
He's batshit crazy

"Yeah I ran over a CIA nigger in 9/9/99. They surrounded me and I panicked. There's nothing wrong with killing space aliens"

I'm not unwilling to learn, senpai. But if you compare the past projects and even the previous year projects and this one, the guy clearly went over what we're taught.

Thanks user, I will depending on his answer and eventually the answer of the head teacher. I don't mind copy pasted for some things because you're not supposed to reinvent the wheel every time, but for this one he clearly took a very distinguishable code from someone else and said "this is the expected outcome". Telling us to not plagiarize and doing it himself seems very hypocritical to me. Especially when I can get someone to do it for me for $5...

OwO I think I recognise this editor session, post desktop

wtf i love rust now

phew
Apparently they released a tool called C++/WinRT which is Standard C++ to escape CX monstrosities.

My older pal spent his youth maintaining legacy mc++ and cli. Says it was not fun like at all

It's not too bad. What's really horrifying is the performance of .net on ARM. After you see that you will be very thankful for C++/CX which makes interop between C++ and .net basically seamless.

uwu

How would you uniquely identify the cards of a tcg in programming terms?

I considered using sha256 on the card file but it means dependencies have to rehash as well.

Using simple incremental integer seems error prone.

I'm thinking about of gentoo's portage cache/manifest system but there's no versions of a card nor do I know if the card's name will be safe?

Usually what went down when this type of shit happened in my classes is I talked with classmates, assessed the level of bullshittery that was going on (basically, how many other classmates recognize that this is practically impossible) and once I can determine that enough people are riled up, we all went to the professor and asked for something like an extension, modification, or otherwise some redress for the grievance they had brought upon us.

Usually worked desu

Reminder that Lisp fanboys are brainlets who accuse others of being dumb even they don't understand anything more complex than lambda expressions.

Thanks for the input senpai, this is also what I did : Asked my classmates what they though about it because maybe i was the only one that found it was fucking stupid but everyone said it was the most retarded shit they saw this year.

I hope he will come back to his senses. I'm just deeply enraged when I see this kind of stuff. Sorry for venting.

I know this is an idiotic question, but
Who the fuck is that guy?

Reminder that typelets are brainlets who don't even understand lambda expressions, monads and dependent typing fully, so they remain fascinated by these concepts indefinitely.

creator of templeOS

God.

Then it's your job to teach/communicate with the interviewer. It's not that hard you fucking retard.

You sure yo put at least some effort, spent some time with the task? Figuring out shit on your own, especially when your mates are scared, feels bretty fucking awesome desu

For my minecraft clone I give each block a unique name and convert the name to a number each time the game loads. The number is different every load. To save the game files as binaries with numbers and not as long names, I dump the association table.

(finiteworld (4 8 4) (16 16 16) (2 2 198 628 232 2 2 2 2 2 530 458 2 2 2 2 2 78 602 282 2 2 2 2 2 202 584 170 2 2 2 2 2 2 2 78 1282 70 2 2 2 2 2 608 652 2 2 2 2 2 2 1024 2 2 2 2 2 2 2 1020 2 2 2 2 2 2 2 2 1322 112 2 2 2 2 2 106 1296 2 2 2 2 2 2 618 310 2 2 2 2 2 2 582 394 2 2 2 2 2 2 6 1124 2 2 2 2 2 2 14 1016 2 2 2 2 2 2 2 1010 6 2 2 2 2 2 2 542 430 2 2) ((water . 0) (grass . 1) (glass . 2) (void . 3) (air . 4) (stone . 5)))

$hexdmp 1.bin
0000000 1000 0001
0000004

4096 grass

Can confirm, currently reading dragon book for my university compiler class and its very good.

how could the person in the article do any better
lets see how you would handle those same questions and responses?

dumblet here
Is constexpr basically a good C++ way enum?

no, I meant what have he done until he is memeworthy on Sup Forums??

Hello /dpt/
quick question

i'm currently learning C++ (i know the bare basics of general programming)
but C++ pisses me the fuck off because of how verbose it is

should i immediatly switch to ruby or should i push through?

t.hobbyist,not looking for a programming job

I'm generally hardworking desu, it's not that it "seems" hard but it's clearly too hard for what we've been taught so far. For the past projects, I dug into both the official documentation and stackoverflow to find answers when I needed hints, but it was generally to improve my code.

I have no doubt you guys would be able to solve it and/or find it easy to do, or at least find it doable.

Not really related. Constexpr is a qualifier.
en.cppreference.com/w/cpp/language/constexpr

do C first
the power of sepples wont mean anything negative or positive to you until you have actually done some projects in C

making bash script to change directory permissions

>Is constexpr basically a good C++ way enum?
What the fuck? A good C++ way enum would be enum class

>enum class
enum struct*

>i have a banana and an apple, which one should i eat?
>DUDE BUY AN ORANGE
he had a well defined question
also C is even more verbose than C++

You explain to the interviewer that there's most likely an error with their sheet, and you briefly explain the idea of process signals? In this field of work you're not always interacting with computer autists. It's a life skill to be able to take "advanced" concepts and explain it to the layman.

If the interview was truly so atrocious that you can't even find a level playing ground, then go talk to your recruiter and explain what happened. Otherwise, you're just being autistc.

If you're a beginner should pick whatever makes it easier on you to get comfortable with programming. If Ruby is that language then so be it. You won't know before you tried so at least give it a shot.

fired

>t.hobbyist,not looking for a programming job
>Implying programming is a proper job.

seriously, learn C, at least the basic of it before going back to C++.
C++ basically C, but with addition of fuckton of useless / useful / alternative stuff
until it's overly complex and weird in their own way.

And by learning C++ as first language, you are basically learning C with useless stuff,
since your project idea will not use those.

So, the main question is, Do you want to master the basic then go forward with your knowledge,
or do everything at once and have a really shallow understanding of it

ok I retract my helpful advice
do whatever you want

>my helpful advice
Why Ruby?

I've had plenty of interviews with HR reps about computer vision topics, general algos from your CS courses, etc. and some of the answers they have are completely off. They know they don't know. You just have to properly explain why you know /you're/ correct and it involves briefly explaining the topic. It's really not that hard.

*complains to HR*

>Why Ruby?
because it's allegedly the least verbose language?

>enum struct
enum
ftfy

kys

That makes sense. The in memory data can be decided at load, but I still need to be able to reference another card somehow because of effects?

why

youtube.com/watch?v=TcqWok8AubE
youtube.com/watch?v=cbBkAdNc88w

>doesn't require type prefix when using a field
>implicit conversion
These two are already quite unhealthy.

A symbol table for the names. Names -> pointers.

...