[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 42
File: DPT.png (389 KB, 934x1000) Image search: [Google]
DPT.png
389 KB, 934x1000
Old thread: >>54838244

What are you working on /g/?
>>
File: 1451683650441.gif (1 MB, 500x281) Image search: [Google]
1451683650441.gif
1 MB, 500x281
delete this
>>
First for OOP is shit.
https://www.youtube.com/watch?v=QM1iUe6IofM
>>
>>54843095
kys
>>
>>54843069
STOP REPOSTING THIS SHITE MEME EVERY FUCKING DAY
>>
File: reallymakesyouthink.webm (3 MB, 936x516) Image search: [Google]
reallymakesyouthink.webm
3 MB, 936x516
behold.....my masterpiece
>>
>>54843069
This is a duplicate spam thread.

REAL THREAD >>54843016
>>
>>54843116
kys
>>
{ f(x) | x <- [1,100] } where f(x) = {
| "Fizz", prime(x) ∧ (x % 3 = 0)
| "Buzz", prime(x) ∧ (x % 5 = 0)
| "FizzBuzz", prime(x) ∧ (x % 15 = 0)
| string(x), otherwise
}
prime(x) determines if x is prime


someone make a cs grad meme of this
>>
>>54843069
Saged dupe thread

>>54843098 >>54843134
>kys
>>>reddit
>>54843099
>meme
>>>reddit

>>54843195
You obviously don't understand the CS grad thing.
That was a problem definition for people to implement.
The CS grad would be mixed with all the retards failing to understand it.
>>
File: 1462970641659.png (754 KB, 736x715) Image search: [Google]
1462970641659.png
754 KB, 736x715
I want to write a program which does some processing of audio. By processing, I mean things like finding tempo.

Does anyone know of any resources that goes more into this sort of stuff? I already know about samples, sampling rates and whatnot, but I don't know how to actually process the data.
>>
>>54843213
kys
>>
>>54843232
fourier transform
>>
Auto-saged?
>>
is this still auto-saging? the fag thread got delted
>>
File: 1453653439216.jpg (162 KB, 750x747) Image search: [Google]
1453653439216.jpg
162 KB, 750x747
>>54843438
It's not
>>
>>54843432
>>54843438
it's fine now

this is the official legit /dpt/ thread

the fag poster got btfo
>>
File: 1464723576745.jpg (38 KB, 362x346) Image search: [Google]
1464723576745.jpg
38 KB, 362x346
>>54843465
>because the OP is an image of a trap, the thread is gay
>>
File: JA1y4DR.png (385 KB, 3000x2584) Image search: [Google]
JA1y4DR.png
385 KB, 3000x2584
>>54843195
>>
>>54843584
should make it a comic sans font gor extra gihgle
>>
>>54843584
Are you retarded?
>>
File: stq.png (93 KB, 1366x768) Image search: [Google]
stq.png
93 KB, 1366x768
i thought the array class was managed?
>>
>>54843612
Are you?
>>
>>54843213
>>54843612
how are we supposed to know if it's pseudocode or FP meme lang #471
>>
File: 091256129.jpg (63 KB, 1112x452) Image search: [Google]
091256129.jpg
63 KB, 1112x452
>>54843645
You're supposed to know that it's FUCKING MATHEMATICS.
It's a task to fucking implement. That's why OP said "don't call us, we'll call you" - it's analogous to an interview. If you don't understand, you fail the interview and won't be called back.
Jesus fucking christ.

>>54843638
>haha look i did the meme guys
>(pic related)
>funny isnt it
>>
hey guys rate my code
 
{ f(x) | x <- [1,100] } where f(x) = {
| "Fizz", prime(x) ∧ (x % 3 = 0)
| "Buzz", prime(x) ∧ (x % 5 = 0)
| "FizzBuzz", prime(x) ∧ (x % 15 = 0)
| string(x), otherwise
}
prime(x) determines if x is prime
>>
>>54843095
>>
>>54843265
So that will split an audio wave into the frequencies that makes it up, but is there anything that explains what to do with those after I have them?
>>
rate?
{ f(x) | x <- [50/50,50 + 50] } where f(x) = {
| "Fizz", is_the_current_number_prime_or_not(x) ∧ (x % 3 = 0)
| "Buzz", is_the_current_number_prime_or_not(x) ∧ (x % 5 = 0)
| "FizzBuzz", is_the_current_number_prime_or_not(x) ∧ (x % 15 = 0)
| string(x), otherwise
}
is_the_current_number_prime_or_not(x) determines if x is prime or not
>>
File: [tilting increases].png (27 KB, 500x500) Image search: [Google]
[tilting increases].png
27 KB, 500x500
>>54843666
>fizzbuzz code with shitty FP syntax
>mathematics
>>
>>54843684
find the dominant frequency in the ~40-200 Hz range
>>
int i = 1;
++i++;
fprintf(stdout, "%d", *(int *)&i);
// -> ???


99% of programmers will get this wrong!
>>
File: for retards.png (95 KB, 839x307) Image search: [Google]
for retards.png
95 KB, 839x307
>>54843695
It's not code you fucking retard, and it's not fucking fizzbuzz. Pic related, it's for (You), who never went to secondary school / whatever you call it in america.
>>
>>54843712
wait divide that by 60, i'm talking beats per minute
>>
>>54843723
it's a variant of fizzbuzz and it most certainly is a FP style pseudocode function definition
>>
File: 1435372828296.png (750 KB, 854x853) Image search: [Google]
1435372828296.png
750 KB, 854x853
>>54843666
>it's FUCKING MATHEMATICS
>>
>>54843800
>>54843758
I wrote it, cunt. It's literally mathematics. It's just a set definition and a function definition (and an extra line to help the mentally aided infer what prime(x) meant in the function)
{
|
} is because
/
/
|
<
|
\
\
is awkward as fuck and will never conveniently wrap with the cases, and I'm never gonna fucking centre that on an =

Have you faggots SERIOUSLY never seen any mathematics before?
Do you seriously not understand what a piecewise function is?
>>
>>54843807
prove that your code is correct.
>>
>>54843807
have you considered that if LITERALLY no one can understand what you're trying to convey, you communicated it badly?
>>
>>54843807
who gives a shit if you label it as mathematics or not jeez

and it's obviously better labeled as a programming task formulated as pseudocode since you wanted people to implement programs that give the same result as the pseudocode
>>
>>54843830
It's not fucking code

>>54843831
If you don't understand it you failed maths

>>54843833
Perhaps I should've labelled it as a task but to need to label it as mathematics is just fucking sad
>>
>>54843844
i didn't fail math"s". maybe it's because my math teacher wasn't an underage british dweeb trying to look cool by trying to imitate math equations using ascii on dpt
>>
>>54843844
at the very least it can clearly be interpreted as code, i could make a programming language where it's perfectly valid syntax
>>
>>54843864
Well yeah, I don't want to go into the whole maths vs programming thing but the two are very interchangeable, and there are good reasons for that.

>>54843861
You are and will always be a retard who has no knowledge of "mathematic" (whatever that is)
>>
>>54843861
how did you know i'm british?
>>
>>54843890
You're not me
>>
>>54843890
because you're gay
>>54843904
don't deny it
>>
>>54843920
>i could have disarmed this dude and fired all rounds without much effort
but you didn't. you could also have stabbed someone, but you didn't.
>>
>>54843719
3
>>
>>54843945
she also probably couldn't have done that since the strap would need to be taken off before being unholstered, and unless he's got some disability he'd realize right away that someone's grabbing him. she's basically pic related
>>
Java.
Have file full of numbers (floats, possibly negative) which are separated by some whitespace (can be newline, can be space). I just want to read one number at a time till the next whitespace.
>>
>>54844022
it's a triple retention holster
>>
>>54844029
Parser monad
>>
>>54844029
https://docs.oracle.com/javase/tutorial/essential/io/file.html
>>
>>54844092
i've been there, doesn't really help me their generic solution is "readline" when I can have files without any new line characters to parse.
>>
>>54843111
neat
>>
perror(strerror(errno));


Does it make sense to do this?
>>
>>54844219
strerror should call perror()
>>
anyone know some projects I should do using SQL, C#, C++, C etc?

I did a linked list and that was fun getting back in the groove of coding but I like doing shit with datasets and analyzing or looking through them.

but I haven't found many large fun ddatasets other than a Yelp dataset.
>>
>>54844022
HAYAI
>>
haskel vs f# vs clojure?
>>
>>54844284
ocaml
>>
>>54844169
iterate through the line string. skip spaces and read numbers into a StringBuilder or a string
>>
Segmentation fault.
    struct Runtime_State Options;
std::vector<std::string> files;
for (uint8_t count=1; count<argc; ++count)
{
if (!strcmp(argv[count], "--help")) {help(); return 1;}
if (!strcmp(argv[count], "--evaluate")) {Options.evaluate = true; ++count;}
if (!strcmp(argv[count], "--input"))
{
++count;
while((strncmp(argv[count], "--", 2) != 0) && count<argc)
{
++Options.file_count;
files.resize(Options.file_count);
files[Options.file_count] = argv[count];
++count;
}
continue;
}
std::cout << "Unknown option \"" << argv[count] << "\"";
return -1;
}


I haven't the slightest why I'm failing so badly at basic argument parsing. I thought it had something to do with the vector, but commenting it out changes nothing.
>>
>>54844335
>I haven't the slightest why I'm failing so badly at basic argument parsing.
work on standardising your indentation style first.
>>
>>54844367
I wrote the chain of ifs when I was very tired. Didn't even notice until now.
>>
>>54844335
Your commandline flags, their descriptions and their associated global bitwise masks should be stored in a lookup table array.
You shouldn't have to hardcode this shit.
>>
>>54844402
I might be the only one, but if I'm code reviewing this is one of the first things that will grind my gears.
>>
>>54844408
I don't really understand. You mean I should make some sort of two dimensional array and just scan through through the top row for a match, then use the associated column for anything else? I don't plan to use any bit masking.
>>
>>54844420
    struct Runtime_State Options;
std::vector<std::string> files;
for (uint8_t count=1; count<argc; ++count)
{
if (!strcmp(argv[count], "--help")) {help(); return 1;}
if (!strcmp(argv[count], "--evaluate")) {Options.evaluate = true; ++count;}
if (!strcmp(argv[count], "--input"))
{
++count;
while((strncmp(argv[count], "--", 1) != 0) && count<argc)
{
++Options.file_count;
files.resize(Options.file_count);
files[Options.file_count] = argv[count];
++count;
}
continue;
}
std::cout << "Unknown option \"" << argv[count] << "\"";
return -1;
}

That'll ungrind 'em.
>>
File: OS.webm (444 KB, 1024x768) Image search: [Google]
OS.webm
444 KB, 1024x768
Well
I almost got input working
>>
>>54844284
Do you want strictness or not strict
>>
Is there a better way to compare strings than strncmp?
>>
>>54844603
int compare(char* a, char* b) { return abs(a - b); }
>>
>>54844626
This just checks if 2 strings point to the same location in memory.
>>
>>54844791
and?
>>
>>54844862
This doesn't compare strings, you should rename it is_aliased()
>>
>>54844862
it doesn't do what strcmp does
>>
>>54844882
it does compare strings, it just doesn't compare them the way you want it to
>>
>>54844937
When people say 'compare strings', they mean compare it's contents, not it's location in memory.
Even the C standard is written this way.
>>
>>54844219
No.

>>54844241
No, perror calls strerror
>>
Daily reminder that references are not equivalent to pointers.
>>
>>54845004
Kill yourself already.
>>
>>54845004
it's called a smart pointer
>>
>still no RISC-V/OpenRISC/Sparc M7 boards
kill me
>>
>>54844029
Scanner s = new Scanner(new File(path));
>>
>>54845011

I will when you admit the two are not equivalent.
>>
>>54845039
idk why it took me so long to realize this is just creating an object. i had so much trouble trying to memorize it. i'm not even new to java. i had to use it 2 years in college
>>
>>54845083
i admit the string references is not equivalent to the string pointers
>>
How does strcmp work anyway?
In the man page it says:

DESCRIPTION
The strcmp() function compares the two strings s1 and s2. It returns an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2.


But I when I compare my buffer with the text "PING" it returns 0 even though the buffer does not exactly match the string constant.
>>
makefiles are a pain in the dick
i just want to dev
>>
>>54845118
use scheme
>>
>>54845105
If they match exactly, the return value is 0.
Most people use !strcmp(...) instead of strcmp(...) == 0

I don't know why it's like that, when none of the other C library functions return 0 to mean "SUCCESS".
>>
>>54845154
because it's also telling you whether it's before or after it alphabetically
>>
>>54844543
Fuck, this is pissing me off. I know what these underlying "types" are and how they're stored in memory, but I just can't figure well enough to not feel as though the language and available tools are getting in the way of making the machine do what I want it to.

Fuck "C-style" strings. I'm by no means in a frame of life conducive to learning anything new, but this is going to drive me to madness. I'll have to become something else to make this happen, and I will stay up for three days straight until I can cram this whole fucked up framework into my head.

Pro-tip, it's often said sleep is vital for memory, but this isn't strictly the case nor does it apply uniformly to all aspects of memory. Near the 22-26 hour mark, if caffeine is supplemented, it greatly enhances fluidity of thought, abstract connections, and memorization. Sucks, but it's true, and it works.

It begins. Goodbye /g/.
>>
>>54845193
I find a lot of people have difficult with C until they come to the realization that everything in C is an abstraction built on pointers.

That being said, there's nothing wrong with C strings.
They're about as minimal and effective as it gets.
It's just an array.
>>
>>54845585
>there's nothing wrong with C strings

They're the source of many bugs, though.
>>
>>54845154
>Most people use !strcmp(...) instead of strcmp(...) == 0
I find it to be the opposite exactly. !strcmp really doesn't get across the meaning of that test.
>I don't know why it's like that, when none of the other C library functions return 0 to mean "SUCCESS".
It's doing a comparison. Strings can be 'less than' or 'greater than' another, and <0 and >0 are used to show that respectively.
>>
>>54845154
But say I have char *buffer1 = "kek", *buffer2 = "kokkek";
Why does strncmp return 0 if the strings are not exactly equal?
>>
>>54845643
int strncmp(const char *s1, const char *s2, size_t n);


Are you passing in 1 for the 3rd argument?
>>
>>54844335
If you're rolling your own argparser in C++ then you have fucked up my friend.
>>
>>54845679
no
>>
>>54845643
>strncmp
Because strncmp will only test up to n characters, so you're really only testing a substring.
#include <stdio.h>
#include <string.h>

int main()
{
char *str1 = "kek";
char *str2 = "kekkok";

printf("%d\n", strcmp(str1, str2));
printf("%d\n", strncmp(str1, str2, strlen(str1)));
printf("%d\n", strncmp(str1, str2, strlen(str2)));
}

The first and third print a number less than zero and the second prints 0.
>>
>>54845705
post your code
>>
>>54843111
quite cool
>>
>>54845585
I know. I'm just having difficulty manipulating or accessing more or less anything the way I want. ie, here's the code as it is now.

struct Runtime_State Options;
std::vector<std::string> files;
for (uint8_t count=1; count<argc; ++count)
{
if (!strcmp(argv[count], "--help")) {help(); return 1;}
if (!strcmp(argv[count], "--evaluate")) {Options.evaluate = true; continue;}
if (!strcmp(argv[count], "--input"))
{
++count;
while (count<argc)
{
if (strncmp(argv[count], "--", 2))
{
++Options.file_count;
files.resize(Options.file_count);
//files[Options.file_count] = argv[count];
++count;
}
else {break;}
}
break;
}
std::cout << "Unknown option \"" << argv[count] << "\"";
return -1;
}


The problem is entirely the one line I commented out. What in the fucking fuck is wrong here? It compiles fine and then throws a segmentation fault. Why can't it just take the bytes out of the specified array element, and put it into a vector of std::strings? Do whatever padding etc it needs to. It has all the information it needs, the space has been allocated, so fucking do it. I'd dig through the library and find why it can't if I thought I'd readily understand any of it.
>>
>>54845762
Not to be rude, but you really should just rewrite this in idiomatic C if you want to know why one of your C++ constructs is fucking up.
>>
>>54845816
Never mind. I was making a ridiculously stupid logic error.
>>
>>54845715
this nigger read the documentation
>>
>>54845907
i wish i could install manpages for other standard libraries, looking up all of glibc's quirks in man is so convenient.
>>
>>54845975
true men read the man
>>
I've seen mentioned how HTML is not a programming language because it doesn't get executed, it gets parsed.

How do you define execution, then?
>>
>apply to SEL for some jobs
>declined because I lack experience in C and C++

alright senpai I need to learn networking and do some projects in C and C++ what would be some good ones.

I have never done networking code so I am planning on attempting that but the only guide I found was on wikibooks.
>>
>>54846142
https://www.google.com/search?q=is+html+a+programming+language
>>
>>54845695
Why?
>>
>>54846224
Make a basic TCP chat program with a server and client.
Have multiple clients connect to the server and have the server relay the messages to the clients. Have commands to be able to broadcast a message to all clients and send a message directly to one client.

The tools you will need are things like:
select()
send()
recv()
bind()
socket()

There is a good amount of documentation on all of those. I also may be missing one or two useful ones but those should point you in the right direction.
>>
>>54846879

sounds good I will try it senpai

thanks!
>>
File: 1.jpg (39 KB, 323x349) Image search: [Google]
1.jpg
39 KB, 323x349
I want to make an 3d ambigram logo for /dpt/ threads in the style of GEB

right now I only have Dijkstra for D and T for turing, I need a P. and it should be something that can be projected orthogonally to the other two

any ideas?

the only thing I can think of is calling it /dct/ instead for daily coding thread and C for Church but the letters aren't compatible with each other
>>
>>54847821
P for 'penis'.
>>
>>54847821
Pajeet?
>>
landing a rocket isn't all that fucking hard fucking stupid kids

any nerd with enough tax payer money could do it
>>
>>54847917
You'll be okay.
>>
>>54847821
"P versus NP"?
>>
>>54847821
Python B)
>>
>>54848108
simple undergrad homework exercise

n = 1

>>54848459
if you're gonna go the language route might as well say pascal, which had more historical significance
>>
i fucking hate youtube. even deleting my cookies didn't stop the retarded grid view shit. someone write me a thing to make my videos be in list view
>>
>>54848662
it's region dependent
research shows western hemisphere prefers grid view

get a VPN or move to another country
>>
>>54848662
anything by gjewgle is shit, they're fucking cancer
>>
>>54848685
i will move to another country then.

thanks for the advice.
>>
>>54848716
I'm getting very sick of Google as well. The unfortunate nature of capitalism is that anyone can eventually do whatever moronic nonsense they want, as long as they have the economic to make it happen. The latest is their "project loon", ie, a massive floating mesh network aimed at undercutting existing service providers without having to compete in controlling, renting, or laying underlying infrastructure. Though obviously it could have... other uses, over time. The main problem with this? They're primarily held up by helium balloons, the minority are hydrogen. What a waste.
>>
>>54848716
I still don't understand why they fucked up safe search, there's no operator now for nsfw results, you just have to type in a completely arbitrary bad word like 'pussy' or 'fuck' and hope it doesn't mess up your search result
>>
>>54848822
Also, humanity will likely ultimately see it apt to create a god for its godless world. This AI may not be designed to serve its creator, or it may not do so indefinitely. I'm certain people in Google (and others) have had this in mind for decades, and I'm waiting to see how it pans out.

Many of the underlying requirements for this near omnipresent, omnipotent, omniscient construct are beginning to fall into place.
>>
>>54848685
or stop using youtube until they change it, which i'm going to be doing
>>
>>54843095
As someone who's only ever done OOP languages, I didn't quite grasp what's so bad about them from the article linked in the video's description. I get that sometimes people go overboard with creating unnecessary classes for everything, which can make the code bloated and confusing, but why should I prefer to use fukken goto-statements and global variables over a handful of classes with defined statusses and behaviors?
>>
>>54849144
don't worry it's just memes and strawman arguments
>>
>>54849144
OOP potentiates cache misses, memory fragmentation, and often encourages organizing control flow such that you end up dicking around instead of just doing what you wanted to do. This becomes cognitive overhead, ironically.

OOP principles are fine, but an insistence on strict adherence to the "pure" philosophy is demonstrably negative. Like I said, humans might like OOP, the machine often does not.
>>
>>54849240
Like a spike pit covered over with brush, or?
>>
>>54849265
You know what I mean sempai.
>>
>>54849240
/dpt/ is totally tsundere for linux trap programmers.
>>
>>54849240
Only if they're straight
>>
>>54849379
Well if I ever get myself up to a good standard, I'll post pics. For now I'll just stay anon and shitpost about GNU/Linux.
>>
>>54849238
So essentially, as long as one uses classes purely for creating a sensible division of states, which is what they were originally intended for anyway, OOP is perfectly fine, even advised?
>>
>>54849240
no
>>
>>54849240
http://www.gnu.org/software/libc/manual/html_node/Program-Error-Signals.html
>>
god damn it /dpt/
i need help with a database query.
I need to output to look like this
course A Subject A,b,c,d

from 4 tables
Table 1 course table: courseid, nameid
table 2 course_subject table: courseid,subjectid
table 3 subject table: subject id, name id
table 4 string table nameid string


i thought of a query like
Select t41.string,t42.string From
course_subject as t2 join course as t1 on t1.courseid=t2.courseid
Join subject as t3 on t2.subjectid =t3.subjectid
innerjoin string as t41 on t1.nameid = t41.nameid
innerjoin string as t42 on t3.nameid = t41.nameid

but that doesn't work, how'd do imake it list the courses and subjects. and even if it did work it would give me a list filled of course and its components, how do group them up into one column instead of multiple rows.
>>
>>54849989
maybe you should have paid attention in class. :^)
>>
>>54849454
pls go back to /lgbt/. Why are there so many faggots on 4chan?
>>
>>54850001
it actually isn't class work.
also how can i suggest a better format than holding every string in a lone table and linking to it.
i forgot to mention table 4 has also langid
The table has been design so it can change through languages easily, but i can't but think that its all a dumb way to connect things.
donno if i can get the team to change it.
it fucking annoys me that i'm stuck with a stupid project with incompetent people.
not that i am competent, but i'm not the one who is supposed to finish this, and i'll surely be blamed for it.
>>
How do I become better at multi-threading, anons?

Any useful exercises, texts, etc.?
>>
>>54849642
As long as one doesn't use strictly abstract reasoning, and both bears in mind and engineers their abstractions for, the real world mechanics of their target machinery, controlling state via interfaces with conceptual objects is fine.

As I said though, a lot of the calls people end up doing to influence objects, or cause them to interact, are not easily inlineable, and the required data (because that's what an object is actually composed of) likely won't be contiguous in memory and cannot be accessed on serial cache lines. Worse, people have a tendency to like to make the cpu chase around pointers everywhere, which also results in cache misses.

Hybrid styles are ultimately the most efficient. A lot of the philosophy, cognitive psychology, etc really is superfluous. I see people generating false dilemmas for themselves all the time around the whole "object" notion. The only relevant aspects are not writing yourself into a corner, and the fact that relative to any task, a given system has an intrinsic maximum capacity for efficiency. Identifying the means, and then approximating this within reason is the ideal. Not neatly making false objects.
>>
>>54850017
Because it's anonymity actually makes it one of the most inclusive communities on the web. Contrary to popular belief
>>
>>54850059
>multi threading
There can only be one /dpt/ you faggot

>mfw this is a dupe thread
>>
>>54850017
>he likes women so much that he gets off to dressing like one
that sounds straight to me

>>54850059
learn posix threads and familiarize yourself with race conditions
your threads must be able to execute in any order without affecting the final results
an easy way out is a mutex or an atomic operation, but that slows you down the more you abuse it
>>
File: snoop_dogg1.jpg (198 KB, 1548x1548) Image search: [Google]
snoop_dogg1.jpg
198 KB, 1548x1548
Working on interviewing skills atm. Might get back to programming-related activities later.
>>
>>54850059
Depends on what your goals are with them. If it's just to do things more efficiently just learn to make a single producer multiple consumer queue. Sure there's other schemes that are more appropriate sometimes but really it's like the array of threaded programming. You need exceptional cases to beat it.
>>
Phenylethylamine and kavalactones won't ever get me dat 5-HT.
>>
File: 1454205088528.png (357 KB, 397x402) Image search: [Google]
1454205088528.png
357 KB, 397x402
>>54850104
Just light up before the interview my niga.
>>
>>54850104
>not smug dog.png
>>
int my_function ()
{
int c = 1;
int d = 1;
}


00000000  55                push ebp
00000001 48 dec eax
00000002 89E5 mov ebp,esp
00000004 C745FC01000000 mov dword [ebp-0x4],0x1
0000000B C745F801000000 mov dword [ebp-0x8],0x1
00000012 90 nop
00000013 5D pop ebp
00000014 C3 ret


So the current stack base pointer is pushed onto the stack, and then the stack base pointer becomes the current stack pointer (new stack for the function). Why don't the two
mov dword
operations just overwrite what was previously on the stack since they're
base pointer minus byte
?
>>
>>54850338
are there any drugs or nootropics that are actually worth taking for programming
>>
>>54850845
For some reason I thought the previous stacks were growing upwards and then this one started and was growing downwards. Never mind.
>>
>>54850856

Did your programmer heroes ever do drugs? No. They were too busy programming.
>>
>>54850856
Most and none.

Really depends on individual physiology, psychology, starting state, and your general frame of life. Any altered state, even if it doesn't advantageously change how your brain is functioning relative to a given task, can afford a useful new perspective.

My ability to make connections and realize better solutions to problems, and code some great things, has been improved while drunk, high on cocoa beans, full of caffeine, phenibut (which I generally don't like) etc. By the same note it could do the inverse. It could be functionally null.

Large spectrum of factors involved. The best advice is to learn to do things with drugs, rather than do something while they're doing something to you.
>>
>>54850930
http://www.dailymail.co.uk/news/article-3230057/Hitler-high-heroin-troops-carried-Blitzkreig-METH-New-book-reveals-extent-Nazis-pursued-evil-dream-narcotics.html
>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>programming
>>
>>54850856
Modafinil is pretty good, but then again it and all the 'study drugs' work well for any intensive task. Then again mostly use it for my uni programming which is pretty braindead.
>>
>>54843069
Anyone work with SAS? I've an SPSS background but wanting to learn SAS.

Can anyone recommend some good resources?
>>
>>54851033
a lot of the things i'm doing now are pretty braindead just boring but i probably won't bother with anything other than coffee and chocolate and food
>>
>>54851002

Your heroes were nazis?
>>
>>54851219
hitler did nothing wrong
>>
>>54851002
This is definitely a daily mail headline
>>
>>54843232
I bet scipy has some stuff for this
>>
Is anyone else at pycon right now?
>>
>>54851358
Don't make direct eye contact with any problem glasses.
>>
File: 1453366677142.jpg (44 KB, 540x559) Image search: [Google]
1453366677142.jpg
44 KB, 540x559
>>54851358
yeah where you at
qt grill btw
>>
>>54851335
>meme snek
No thanks
>>
>>54851335
He said he wanted to write a program, not use a program someone else wroet
>>
>>54851419
>He

Stop assuming.
>>
>>54851377
Sleep snug, smug
>>
>>54850059
Don't
Use languages which do it for you via actor/csp, like erlang, F#, Go, etc
>>
>>54851377
"sleep snug, smug."
>>
>>54851447
Not that poster, but this just strikes me as so amusing.

For my entire life I've referred to people as "them" or "they", and caught quite a lot of flak for it. That's incorrect they said, why are you speaking so strangely, why are you using plurals. Because it strips unnecessary embedded assumptions, can be resolved implicitly, and works even when you don't have information.

Now days I get to watch you people, because it's all about the gender neutral pronouns. It's all about how gendered words are the last remaining flaw of the English language, and how it's spillover from our germanic and romance language roots.

Yep. You fucks are only ever two+ decades behind, but they always come around, eventually.
>>
>>54851506
Still wrong, if you are a SJW, it's "He or She"

I use he since I'm not a cuck
>>
>>54851542
Nah, you're definitely a cuck. You just don't know it yet.
>>
>>54851372
Best line of the day was one of the core devs shitting on the organizers last year for putting a ton of unqualified women on stage just to say they had a lot of women speakers.
>>
>>54851542
Xir or xirself
>>
>>54851377
Hotel deLuxe, senpai
>>
>>54851447
gender neutral he is still a thing, and literally 98-100% of /dpt/ posters are male
>>
>>54851668
based
>>
>>54851542
>He or She
stop assuming, SHITLORD
>>
>>54843616
>| x <- [1,100] } where f(x) =
whatshit code
fak u
>>
>>54852169
>>f(x) = 2x + x^2
>what shit code
>>
>>54852169
>>54852188
what
>>
>>54852198
he doesn't realise >>54843584 is mathematics, like how >>54843584 didn't realise it was a task to implement
>>
>>54843616

I think you mean System::Array not std::array

This is why full namespace resolution is a thing and not always just a meme
>>
I made a name generator. Makes very believable names:
run:
Nugerishiwiba
Dou
Juwemechajo
Ubobanyan
Riyuwiruri
Echo
Hehetapo
Bokushahe
Shocharu
Bobiruhyuha
Gijiwisho
Sese
BUILD SUCCESSFUL (total time: 0 seconds)
>>
File: 2309803983.png (4 KB, 485x101) Image search: [Google]
2309803983.png
4 KB, 485x101
Can you run visual C++ on WIN7?
>>
>>54852265
Yea I use it
What you doing
>>
>>54852272
What version are you running?
>>
>>54852265
I'm running VS 2015 update 2 on Windows 7 x64.

If you're trying to run an application, obviously you need to download the 2015 runtime libraries.
>>
>>54852265
Lmfao

Windows ladies and gentlemen
>>
>>54852214
The output is supposed to be "1", "2", "Fizz", "4", "Buzz", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "100", right?
>>
>>54852277
VS 2015 update 2
>>
>>54852330
Yes.
>>
>>54843111
Can it press OK in the UAC?
>>
Memeing in haskell, check out this fizzbuzz
{-# LANGUAGE OverloadedStrings, 
MultiWayIf,
DeriveFunctor,
FlexibleContexts #-}

module Lib where

import Control.Monad.Free

-- DSL Type
data TeletypeF x
= Print String x
| Skip x
| ExitSuccess
deriving (Show)

-- Functor Instance
instance Functor TeletypeF where
fmap f (Print str x) = Print str (f x)
fmap f (Skip x) = Skip (f x)
fmap f ExitSuccess = ExitSuccess

-- Newtype
type Teletype = Free TeletypeF

-- DSL Constructors
print' :: String -> Teletype ()
print' str = liftF $ Print str ()

skip' :: Teletype ()
skip' = liftF $ Skip ()

exitSuccess' :: Teletype r
exitSuccess' = liftF ExitSuccess

fizz :: Int -> (Teletype () -> Teletype ())
fizz n
| n `mod` 3 == 0 = \x -> (print' "Fizz") >> x >> exitSuccess'
| otherwise = id

buzz :: Int -> (Teletype () -> Teletype())
buzz n
| n `mod` 5 == 0 = \x -> (print' "Buzz") >> x >> exitSuccess'
| otherwise = id

base :: Int -> (Teletype () -> Teletype())
base n = \x -> x >> print' (show n) >> exitSuccess'

fizzBuzz' :: Int -> Teletype ()
fizzBuzz' n = (base n . fizz n . buzz n) skip'

-- DSL Interpreters
runIO :: Teletype () -> IO ()
runIO (Pure r) = return r
runIO (Free (Print str t)) = putStr str >> runIO t
runIO (Free (Skip f)) = runIO f
runIO (Free ExitSuccess ) = putStrLn "" >> runIO (Pure ())

runPure :: Teletype () -> String
runPure (Pure r) = ""
runPure (Free (Print str t)) = str ++ (runPure t)
runPure (Free (Skip f)) = runPure f
runPure (Free ExitSuccess ) = runPure (Pure ())

-- Fizzbuzz
fizzBuzz :: [Teletype ()]
fizzBuzz = map fizzBuzz' [1..100]


main :: IO ()
main = mapM_ runIO fizzBuzz
>>
>>54852363
Why aren't you using monads?
>>
>>54852388
b-b-but I'm using the Free monad...

also ignore the pragma's, had them from earlier memeing.
>>
>>54843719
Invalid.

++i++ is same as ++(i++) but the standard requires the operand of the unary++ to be a modifiable l-value but the postfix++ returns an r-value.
>>
>>54852408
Not good enough
>>
>>54851036
That's a pretty specific field.

That kind of software does have good odcumentation and certification courses. If you're serioud I'd suggest investing in a cert.
>>
>>54852454
The free monad is the memeiest of all monads.
>>
>>54852521
show (return n >>= Fizz >>= Buzz)

Would be nicer code.
Type would be
t * [s]

Where [s] is the labels and t is the labelled value
Bind gives the value and adds labels of the returned function
(Either keep the old value or use the new one)
>>
>>54852336
>>54852313
>>54852292
Accidentally downloaded the wrong version. All good now.
>>
>>54847821
Change it to /dht/ - Daily Himegoto Thread and use Dijkstra, Himegoto and Turing.

kappa
>>
Pythonfag here, running a silhouette analysis on my k-means clustered data. I have a bunch of vectors and for every one I have to calculate an AI (the average distance between that vector and other vectors within the same cluster) and a BI (the lowest average distance to all vectors from another cluster).

Here's part of the code:
for cluster,clusterNumber in zip(clusterDict.values(),range(len(clusterDict))):
aiList = []
for vector1 in cluster:
listOfDistancesAI = []
for vector2 in cluster:
distanceAI = silhouetteDistance(vector1,vector2)
listOfDistancesAI.append(distanceAI)
averageDistanceAI = sum(listOfDistancesAI)/len(listOfDistancesAI)
aiList.append(averageDistanceAI)

biList = []
for vector, clusterNumber in zip(cluster,range(len(clusterDict))):
clusterDistanceList = []
for otherCluster in clusterDict.values():
listOfDistancesBI = []
for vector2 in otherCluster:
distanceBI = silhouetteDistance(vector,vector2)
listOfDistancesBI.append(distanceBI)
averageDistanceBI = sum(listOfDistancesBI)/len(listOfDistancesBI)
clusterDistanceList.append(averageDistanceBI)
clusterDistanceList[clusterNumber] = 10**100
biList.append(min(clusterDistanceList)


The vectors are fed from a dictionary which has a key for every cluster and then a list of vectors as values. The problem is, the AI values are getting calculated just fine, but its only calculating 9 BI values. The amount of vectors in the cluster should match the number of AI and BI values. The biList.append statement is in the for-loop for the vectors, so it should be appending as many BI values as there are vectors.
As it happens, 9 is the amount of clusters I'm telling my k-means algorithm to make, so stuff might be in the wrong loop?
>>
File: categorised monad.png (71 KB, 1415x602) Image search: [Google]
categorised monad.png
71 KB, 1415x602
>>54852562
>mfw i invented a somewhat useful, fairly generic monad
>>
>>54852696
You can't see a lot of the buzzes but they're there
; is the delimeter
>>
>>54852562
Could you provide an example that actually correctly constructs the AST using that style? I can't see how that actually works.
>>
Y'all may have missed this, else you wouldn't be here still posting stupid shit

https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
>>
>>54852750
Boring
>>
>>54850059
Read up on cache thrashing, atomic operations, and concurrent data structures,
Remember that the ideal implementation of multithreading is lock-free.
Also remember that its possible to get more than one writer by distributing or mirroring the dataset.
There are many academic papers on this subject as well.
>>
>>54852725
I mean like this: >>54852696
>>
>>54852831
Yeah I can't read that f# crap
>>
>>54852841
Look at the comment on the bottom
>>
>>54852862
Not a DSL, also your interpreter is completely tied up.
>>
>>54852841
Value: and Categories: are just labels that can be used in the constructor but are just there for the StructuredFormatDisplay (to make it print differently)

The type is just
categorised v c = v * [c]
(I should probably reverse this so it makes more sense 'type currying', and makes the bind's signature more obvious)
a Seq is a lazy list in F#

The
let bind f (Categorised(value, categories)) is a pattern match (total in 1 case) that decomposes the argument into the identifiers value and categories, i.e. it's actually
let bind f m = match m with | Categorised(value, categories) -> ...

>>54852898
?
>>
>>54852898
>>54852901
Also
a { ... } is a computation expression, 99% of the time it's just do notation (but a is an object and so it can be parametrised on an object)

let! x = y // in a cexpr is just // x <- y // which calls a.Bind(monad,function)
return! is normally just id, it calls ReturnFrom
return calls Return
>>
Why is my shit always blood stained whenever I try a dildo?
>>
>>54852973
It means there is still hope for you.
>>
File: categorised monad haskell.png (95 KB, 1463x677) Image search: [Google]
categorised monad haskell.png
95 KB, 1463x677
More comments edition

Regarding monad signatures, imagine applying the 'c in category<'v,'c> to get category<concrete, 'c> or concCategory<'c>
>>
>>54853042
Using the new value rather than the old value is actually useful too, if you want the category to "take away" from the value, e.g. if you're creating something to tell you what the least coins for change is
>>
>>54852973
The intestinal walls are not innervated to feel pain. You're likely scraping it up and creating small tears in the walls, but not real tissue damage further in. This raises the chance of infection.

Don't do that, Anon.
>>
File: categorised monad 2.png (29 KB, 694x370) Image search: [Google]
categorised monad 2.png
29 KB, 694x370
>>54853042
Sample
>>
File: categorised monad 3.png (28 KB, 771x287) Image search: [Google]
categorised monad 3.png
28 KB, 771x287
>>54853197
etc
>>
Is ruby on right now? I was wondering if she would be willing to read something I wrote. I'm thinkIng I could set the password to it as something she's written before. I know she's knowledgeable and also, at the same time, doesn't need me to instruct her.

Ruby you here?
>>
>>54849989
Are you still here?

Why do you always ask for SQL help 6 hours before I wake up, faggot?
>>
>>54853920
>sleeping in rather than helping anon
You should be ashamed of yourself
>>
File: virtual_reality.jpg (641 KB, 1704x2526) Image search: [Google]
virtual_reality.jpg
641 KB, 1704x2526
things = {"Sssss":'ss', "ggggg":"gg", "ffff":'ff', }

x = input("Enter a bunch of letters you want abbreviated: ")
s = input("What do you want them abbreviated to: ")

things[x] = s

print (things)


"""
First time I run my program I input "mmmmmm" and abbreviate it to "mm"
it outputs the new list to me perfectly.


I run my program the next day and enter "hhhhhh" abbreviate it to "hh"
outputs the list but only todays new addition to the list, yesterdays addition is not.


My question is, how do I get inputs to the list to be permanent so that the inputs are always added to the list and not just for one specific running instance of the program

"""

inb4 someone says pay attention in class, im a financefag trying to automate some shit on my computer
>>
Are there alternatives to these fucking meme programs are should I drop this course?

I just finished a C course on Javascript and in the time I was taking the course it seems they added a Javascript course, so I thought I'd take it next. They email you a 5 minute lesson a day. It was nice. I don't want botnet chrome or the meme editor, though. For the C course I got to use vim and gcc and all was well.

Can emacs do JS development? I was thinking of learning it anyway.
>>
>>54854225
I don't see how either of the two would prevent you from learning JS, just roll with whatever you like.
>>
File: win7 ricing.png (201 KB, 1200x900) Image search: [Google]
win7 ricing.png
201 KB, 1200x900
>>54854207
how to add keys and values to a dictionary so that they are permanent

inb4 someone says pay attention in class, financefag trying to automate some shit on my computer
>>
>>54854207
So you want your changes/additions to persists through script executions? You will have to read on file I/O to dump the data into a file when the script ends, and load the data from a file when the script starts.
>>
>>54854301
This, the easiest for you would be to use pickle.
>>
>>54854225
Yes, you can use any editor of your choice for that and you do not have to use Google Chrome, Firefox for example supports most of the stuff from the new standard (https://developer.mozilla.org/en/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla) and I doubt you'll heavily utilize those, you'll probably work on some standard old ass JS so worry not.
>>
>>54854244
>>54854329
Thanks guys. I will probably stick with Firefox and vim, then. Hopefully this doesn't lead to confusion later.
>>
>>54854225
>I just finished a C course on Javascript
Got confused here, meant to say Highbrow instead of Javascript
>>
What kind of memory allocation algorithms and structures do some modern operating systems use? (e.g. buddy system, fibonacci/weighted etc, dynamic partioning etc.)
>>
>>54852691
Could I get some help with this? Shit's still not working.
>>
File: usb.jpg (140 KB, 708x1275) Image search: [Google]
usb.jpg
140 KB, 708x1275
>>54854301
>>54854328
Thanks guys
>>
>>54854424
Everything except monads
>>
You know in MS Paint how you can drag the corner of the canvas to resize it? What is the best data structure to use for the canvas, given this resizing ability? A vector of vectors, or is there something better?
>>
>>54854479
a rectangle?
>>
Trying to figure out how the fuck should I organize my JavaFX project in Intellij IDEA. Haven't done OOP or GUI shit much so needless to say it's a complete clusterfuck right now.

If anyone has any good links to how to manage the graphics and all teh event handling in a reasonable way that would be awesome.

>>54854479
A rectangle aka a collection of two points that define the margins
>>
>>54854487
>>54854501
But I need to store all the pixels inside the canvas... maybe I'm misunderstanding what you're saying.
Thread replies: 255
Thread images: 42

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.