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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 311
Thread images: 35

File: dpt hime.png (518KB, 974x974px) Image search: [Google]
dpt hime.png
518KB, 974x974px
old thread: >>57851952

What are you working on, /g/?
>>
>>57856284

learning lisp ironically
>>
nice pic but this thread's a tad early
>>
>>57856284
she is the cutest
>>
>>57856314
>she
>>
>>57856310
Doesn't really matter.
The only people who actually care are the nerds who want to pick the OP image.
Is there really anyone else that has reasons to complain?
>>
File: AUTISMO.jpg (183KB, 960x949px) Image search: [Google]
AUTISMO.jpg
183KB, 960x949px
first for Java
>>
File: 1470789626656.gif (46KB, 100x155px) Image search: [Google]
1470789626656.gif
46KB, 100x155px
>>57856284
First for D
>>
>>57856344
because it's a waste of a bit of a thread and it puts another in the archive, plus it leads to thread wars
>>
How are you enjoying this year's advent of code?
Here's my day 3 pt 2.
int valid_triangle(int *arr)
{
if (arr[0] + arr[1] > arr[2] &&
arr[0] + arr[2] > arr[1] &&
arr[1] + arr[2] > arr[0])
return 1;
else
return 0;
}

int main(void)
{
char *ins = get_filebuffer(DAY(03));
int sides[3][3] = { { 0 } };
unsigned col = 0, row = 0;
unsigned valid = 0;
char *tok = strtok(ins, " \n");
while (tok != NULL)
{
sscanf(tok, "%d", &sides[row++ % 3][col % 3]); /* vertical */
if ((row % 3) == 2)
col++;
if (!(row % 3) && !(col % 3))
{
unsigned i; /* flatten array */
for (i = 0; i < 3; i++)
{
int arr[3] = { sides[i][0], sides[i][1], sides[i][2] };
if (valid_triangle(arr))
valid++;
}
}
tok = strtok(NULL, " \n");
}
printf("Valid triangles: %d\n", valid);
free(ins);
return 0;
}
>>
>>57856284
Please stop using an anime picture on a tech related discussion board
>>
>>57856365
>plus it leads to thread wars
See
>The only people who actually care are the nerds who want to pick the OP image.

>because it's a waste of a bit of a thread and it puts another in the archive
Autistic reason really. Memory is cheap and it's not even ours.
>>
>>57856417
it's not about memory
>>
>>57856393
Ask gook to write in rules about forbidding using anime pictures on the site, if you want so.
>>
>>57856284
what're some must have features for my IRC bot?
>>
>>57856526
SASL so you don't ruin it for everyone else in private channels
>>
After 4 months of failure is it time to suck up my pride and apply to one of those disability recruitment agencies?

I have a hard time applying for jobs because of a speech impediment that makes me sound retarded. Of course, I quickly confirm that suspicion by immediately forgetting all the programming terminology I need to know
>>
>>57856364
D as in Dick
>>
File: 1480417080290.gif (203KB, 639x299px) Image search: [Google]
1480417080290.gif
203KB, 639x299px
Can someone please help me understand the Quick Sort algorithm? I know it's meant to be basic shit, but I'm terrible.

I've got a rough one that I wrote, but it was mostly copying other people.I just about understand the algorithm itself, but don't quite get how to implement it. I know it recursively sorts smaller and smaller arrays until the main list of numbers is in order, but that's about all I can grasp.

Here's my shitty attempt: http://pastebin.com/3trwadwa
>>
>>57856543
Because only faggots want the D
>>
File: 5NtgCEy[1].jpg (200KB, 960x949px) Image search: [Google]
5NtgCEy[1].jpg
200KB, 960x949px
>>57856354
>>
>>57856539
I was planning on being the only one using the bot
>>
File: 5bCso.jpg (160KB, 599x421px) Image search: [Google]
5bCso.jpg
160KB, 599x421px
You don't use programming languages for unintended purposes, do you?
>>
File: 1390369412659.jpg (178KB, 500x500px) Image search: [Google]
1390369412659.jpg
178KB, 500x500px
>>57856204

Use the api to pull stuff from Wikipedia then process accordingly, for example

https://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmprop=title&cmlimit=500&cmtitle=Category:Gay_men%27s_choruses
>>
>>57856623
What do you mean?
>>
>>57856679
he's probably gonna say something stupid like
>using C in 2017
>>
>>57856144
>>57856221

What do you mean by infinite/inversed loop?
Is it one/both of the for loops in the constructor?

Sry I'm really slow at learning.
>>
File: autismAwareness.jpg (64KB, 589x1087px) Image search: [Google]
autismAwareness.jpg
64KB, 589x1087px
>>57856732
Yep, you failed!
>>
>>57856732
Red's not going to house 1.
>>
I managed to get working an algoritm to recreate the SNES Mode7 perspective. Is not the real deal Baseball, but it accomplish the goal.

The logic is basically project 3D to 2D (x/z and y/z), grab the color of a certain pixel of a 2D map given the previous calculation, then display that color on screen.

Max_X= //Get width of the screen;
Max_Y= //Get height of the screen;

HORIZON=90;
FOV=300;

While(TRUE)
{
for (X=0; X < Max_X; X++)
for (Y=0; Y < Max_Y; Y++)
{
PX=X;
PY=FOV;
PZ=Y/HORIZON;

SX=PX/PZ;
SY=PY/PZ;

//Grab the color of a pixel
COLOR= //GrabColor(SX,SY);

//Display the color on screen

//PlaceColor(X,Y,COLOR);
}
}


Is not optimized, but looks neat BTW.
>>
>>57856767
no bully
>>
>>57856882
The only winning move is not to play. The puzzle has no solutions.
>>
>>57856892
I don't believe you. I'm already playing life anyway
>>
var gay = "Haskell"
>>
>>57856949
>var
Disgusting.
>>
>>57856929
>Posts on 4chan.org
Clearly you're not doing very well at life either
>>
>>57856555
Please friends I beg of you

Help :(
>>
>>57856555
>take first element of list
>get elements less than that
>get elements more than that
>re-arrange so that it's smaller < element < bigger
>recur on smaller and bigger
>>
>>57857090
http://www.algomation.com/algorithm/quick-sort-visualization
>>
>>57857110
That's very concise, thanks.
>>
>when you spend 2 hours trying to build the latest libjpg-turbo on VS2015 and fix various missing legacy functions to make jpegview compile to make it close when you press esc when you're viewing a gif instead of pausing it
>the solution was to add legacy_stdio_definitions.lib in the linker options
>>
>>57857122
>Microsoft Windows.bmp
>>
>>57857167
At least I fixed an issue that have been annoying me for the last two years. Worth it, should have done it sooner.
>>
pajeets btfo
https://www.youtube.com/watch?v=QM1iUe6IofM
>>
>>57856284
Is Android Programming for Beginners a good book for me if I want to learn how to make apps? I know no java but have background in programming.

Only books. Fucking hate learning on the computer
>>
>>57857122
Gotta love Open Source when you can just adjust something that you don't like.
>>
I can't seem to find "The Pragmatic Programmer: From Journeyman to Master" in a hardcover copy.
It's like physical media wants to die.
Of course they probably have a larger profit-margin on digital book sales.
But I'm not gonna buy that.
>>
>>57855630
why though?
>>
>>57856736
Please someone explain this to me.
>>
>>57857462
why not?
>>
>>57857405
I have a physical copy of that book.
I don't recall it being difficult to find.
>>
>>57857490
Yeah but I can only find paperback copies. I hate paperback.
I'd pay lots more for one. But I'm not paying 20$+ for a paperback.
>>
>>57857487
because hardware acceleration an shit
>>
>>57857502
>I hate paperback
>But I'm not paying 20$+ for a paperback
What the hell do you have against paperback? Most books are paperback.
Are you going to use it as a coaster or something?
>>
>>57856284
It makes sense for Hime to be the thread mascot. It's right there in her name: Hime"GOTO"!
>>
>>57857554
This stupid trap meme needs to stop.
Also, himegoto was fucking shit.
>>
>>57857554
>Using a harmful mascot
>>
>>57857522
>Are you going to use it as a coaster or something?
yes
>>
>>57857569
Mistreating books is literally worse than hitler.
I bet you scrible in the margins and use a bright pink highlighter, too.
>>
File: 1475796047671.jpg (200KB, 796x800px) Image search: [Google]
1475796047671.jpg
200KB, 796x800px
>>57856393
>Please stop using an anime picture on a tech related discussion board

Without Maki.
>>
>>57857522
>What the hell do you have against paperback?
They're not as comfortable to read for me. The hardcover just feels way better.

Also there's aesthetic considerations. I mostly have hardcover books. I don't want to allocate more space to the paperbacks. They can go back to mexico.
>>
>>57857593
>perverted blushing
Why do men always praise sluts?
>>
>>57857606
>Men
You mean manchildren
>>
>>57857504
HW acceleration in wayland is better and more efficient than in X11, now it's just a matter of drivers implementing it. All the FOSS drivers and proprietary nvidia driver (on non-optimus systems) work AFAIK
>>
is there anyone here that actually looks like that pic because if so pls pm.
>>
>>57857626
>pm
k
>>
>>57857632
>Not having a 4chan Gold account
>>
>>57857090
Here, try reading this beautiful elegant Haskell code
import Data.List
import Control.Arrow
import Control.Monad
import Data.Function

qs :: Ord a => [a] -> [a]
qs = fix (ap ((>>) . guard . not . null) . (`ap` tail) . ((uncurry (++) .) .) . (`ap` (partition . flip (<) . head)) . ((.) .) . liftM2 (.) (***) (flip ((.) . (:) . head)))


Truly now you can see why functional programming languages are superior. Quicksort and other recursive algorithms can be expressed so much more cleanly and concisely this way, don't you think?
>>
>>57857642
Good goys belongs to
>>>/vip/
>>
>>57857642
>2016
Get out of here, you newfag.
>>
>>57857217
You're probably not gonna find someone who has read the specific book you're asking about.
My guess is that an android book covers more than you need.
There's fairly good reasons why they're not that popular.
>>57857471
A infinite loop means that your loop never ends. That is often not what you want.
>inverted check
This means that anon here thinks you're checking the opposite of what you intended. I'm not sure exactly what he's referring to.
>Sry I'm really slow at learning.
No it's just that nobody has introduced these things to you.

Anyway I think your issue is that you have an infinitely recursing function. walk through the program and think about each step.
If you look at Snackbar(...) it will always call Snackbar(...). So really onyl the first three lines are executed in the function because snackbar calls snackbar which calls snackbar which calls snackbar....

The computer can't do that forever. It runs out of memory because it has to remember where it should go back to when it's done with the function.

Also enable line numbers like I told you two-five days ago.
>>
Who here /obfuscated/?

#include <stdio.h> // To print a special message for my friends in the /dpt/ <3
#define x(z, y) z* y = "M{rejg$s$ehs$l$mo$ji$lx$mi}ywqxmkx$vr2\x0p$"; int i = 0
#define _(__) putchar(*__-4); __++; i = i + 1; i++; --i; i = *j-*j; i = *k- *k;
#define z(y) y = "$er$yo}ylv$rxiwr2Exvxe0kz$s$silr$shmo\xEje"; char* j; char* k
main(){x(char, __);z(char* ___); j=&0[__]; k=&0[___]; while(*j!=0) {_(j)_(k)} }
>>
>>57857684
thanks for supporting 4chan
>>
>>57857684
>newfag
Pls. I wouldn't have bough a pass at all, but I believed his lies.
>>
>>57857614
I mean males of the human species. If we're to be specific.
>>
File: 1480979259950.png (36KB, 400x280px) Image search: [Google]
1480979259950.png
36KB, 400x280px
>>57857684
>wasting 20 USD years just to bypass a captcha
>>
>>57857704
It was worth it. I can block all botnet scripts from running here, and it's an boon to my shitposting efficiency.
>>
>>57857704
I'd do it too if I could get bothered to buy some buttcoins.
>>
Anyone interested in a private 4chan leaderboard for Advent of Code this year?
>>
>>57857691
Step back, can't get spunk on the mink
>>
>>57857730
but anon, we're like 10 here and everyone know I'm the best
>>
>>57857730
sure post the code
>>
>>57857781
steven nigga you set yourself as anon but you linked to your github lol
>>
>>57857730
>To play, please identify yourself via one of these services:
>[GitHub] [Google] [Twitter] [Reddit]

Am I really introvert or is internet beyond saving?
>>
So I am very uneducated in the realm of programming, but I would like to change that. What languages would be good for me to learn, taking into consideration future employability/desirability, and the fact that I barely have any programming experience. What are some good resources to get me started?
>>
>>57857847
The latter.
>>
>>57857847
just create a throwaway account i guess
>>
>>57857801
My bad. Made a new account/leaderboard. 138736-c753c8e0
>>
public boolean setPlayer()
{
Scanner in = new Scanner(System.in);
while(true)
{

System.out.println("Choose, (1)Rock, (2)Paper or (3)Scissors (-99 to quit)");
System.out.println("enter number: 1,2 or 3");
userChoice = in.nextInt();
if(userChoice != "-99")
return true;
else
return false;
}


why is if(userChoice != "-99") an error
how does one fix
>>
>>57857864
yeah although I guess you just lost all your progress (at least on that leaderboard) since it counts total combined rather than just the most recent

anyway would be nice if we got some more people from here to join just for the fuck of it
>>
>>57857883
nextInt returns an int
"-99" is a string
>>
>>57857883
Have you declared it?
>>
>>57857889
I did the first 5 problems about an hour ago, so it's not like I've lost a ton of progress.
>>
>>57857907
fuck im retarded thanks
>>
>>57857889
>Detroit Labs - Build beautiful mobile apps.
>muh """MD5""" haxor
>PHP
Seriously why is this supported by /dpt/? At best it's just a glorified IQ test.
>>
File: justlikeblastprocess.png (5KB, 322x287px) Image search: [Google]
justlikeblastprocess.png
5KB, 322x287px
Can I install Linux on a Sega Genesis?
>>
>>57857948
>>Detroit Labs - Build beautiful mobile apps.

Just a sponsor.

>>muh """MD5""" haxor
It's just a joke, calm down autist.

>>PHP
?
>>
Wageslave here

Is there any way to iterate through labels (For i = 2 to 100 objDoc.Label(i).Caption) in a Word document in Excel VBA?
>>
File: sweating in the sun.jpg (41KB, 325x358px) Image search: [Google]
sweating in the sun.jpg
41KB, 325x358px
>>57857594
>decide to look at what book nerds consider proper for books
>find this cute girl who prefers paperback
>she eventually starts fondling the hard, hard, cover of the book rubbing her nice hands up and down its rigid exterior
Too much. This is not what I'm supposed to be doing.
>>
>>57857977
Hi! I'm Eric Wastl. I make Advent of Code. I hope you like it! I also made Vanilla JS, PHP Sadness, and lots of other things. You can find me on Twitter and GitHub.

His github is filled with scripts for mac and PHP projects.

--- Credits ---
Playing: You!
>>
The fuck

So I'm implementing a member function for a class that returns nothing. The class in question inherits from another base class and contains deques of other a few other objects.

The weird thing is that...this question I'm working on wants me to access other instances of this class, form inside said class's member function. But how the hell am I supposed to do that when these other instances are well outside this function's scope???
>>
>>57858044
What does it matter what he uses?
He's made a nice series of challenges for Christmas with a competitive factor in there and I enjoyed them a lot for practicing a new language last year, and I do again this year.
You do not have to participate.
>>
>>57858071
Have the function accept another instance as a parameter. Note that the member function will have access to this instance's private data members.
>>
>>57857952
no. You can on dreamcast though.
>>
public int CheckValid()
{
if (userChoice < 3 && =! -99)
System.out.println("ERROR: INPUT INVALID");
System.exit(0);
}


whats the deal with this bullshit, why is the =! -99 an error
>>
>>57858044
If you want something with more substance, he did another challenge site.

https://challenge.synacor.com/
>>
>>57858114

I don't think I can though, it's not specified that I can change the parameters already set out by the assignment.

 void pass (int i) 


^ That's it. That's all I have to work with in terms of the function itself.
>>
>>57858153
!=
>>
>>57858153
please change your name
>>
>>57858192
n0
>>
>>57858185
thats not the reason unfortunately
>>
>>57858192
is this beter now ?
>>
>>57857691
Whats "jpe"/"fla" for?
>>
>>57858208
also userChoice < 3 && userChoice != -99

You can't "chain together" inequality symbols in Java or whatever pajeet language that is
>>
>>57858217
a little...
>>
>>57858221
Botnet code
>>
>>57858221
Where do you see that? Can you copy paste the exact part?
>>
>>57857703
cuck
>>
How to bind JSON file with a PyQt QTreeWidget?
>>
>>57858272
QT_REEEEEE_WIDGET
what did they mean by this
>>
>>57858217

delete this
>>
File: here.png (3KB, 485x65px) Image search: [Google]
here.png
3KB, 485x65px
>>57858242
Is it like a promotion code? So i will be a middle node and not the endpoint zombie? I like it.

>>57858261
Well, its actually "fla "/"jpe$".
>>
File: 1479178611838.jpg (140KB, 496x592px) Image search: [Google]
1479178611838.jpg
140KB, 496x592px
>>57858290

heh
>>
File: qOzjM.png (12KB, 659x299px) Image search: [Google]
qOzjM.png
12KB, 659x299px
>>57858290
Things like the related picture.
>>
>>57858321
Well, if you unobfuscate the code, it doesn't do anything. Just there to be confusing.
>>
>>57858338
Trump?
>>
Is there a way to create and register an "anonymous" window class (used with the atom that RegisterClass returns) in Win32?
>>
dpt, are there any sites or agencies out there intended to provide real programming jobs to people with aspergers?
>>
File: 1453308876622.jpg (152KB, 1033x798px) Image search: [Google]
1453308876622.jpg
152KB, 1033x798px
>>57856284
Uh is this sane?

#ifndef OPENGL_H
#define OPENGL_H
#include <iostream>
#include <GLFW/glfw3.h>
class programWindow
{
GLFWwindow *windowHandle;

public:
programWindow() :
windowHandle(glfwCreateWindow(
640,
480,
"OpenGL",
NULL,
NULL))
{
if (!windowHandle)
std::cout << "error XD" << std::endl;

glfwMakeContextCurrent(windowHandle);

std::cout << "Constructed" << std::endl;
}

~programWindow()
{
std::cout << "glfwTerminate()'ed ;)" << std::endl;
glfwTerminate();
}

void run()
{
while (!glfwWindowShouldClose(windowHandle))
{
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(windowHandle);
glfwPollEvents();
}
}
};
#endif /* OPENGL_H */


#include <iostream>
#include <GLFW/glfw3.h>
#include <opengl.h>

int main(int argc, char **argv)
{
if (!glfwInit())
return -1;

programWindow window;
window.run();
}
>>
>>57858456
>C++
No. It is definitely not sane.
>>
>>57858456
>"error XD"
>"glfwTerminate()'ed ;)"
Anon you're perfectly fine keep going
>>
>>57858437
The SSA
>>
File: 3-taylor-swift-game.w529.h529.jpg (81KB, 529x529px) Image search: [Google]
3-taylor-swift-game.w529.h529.jpg
81KB, 529x529px
I want to get into big data, machine learning, etc. I'm more interested in working with high-level compsci concepts and not just basic software engineering for muh startup memery .

When you have a Msc in compsci can you work in the industry, doing research or high level devwork or do they per definition expect a phd? Reminder I dont want to be a codemonkey. I want to use some math and other higher level concepts in my job.

fwiw im in my last year of compsci bachelor and will be going for a masters (I'm in yurop btw)
>>
>>57858532
>yurop
stopped reading right there
>>
>>57858559
>stopped reading right there
pourquoi?
>>
this is gonna sound really fucking dumb, but do i need to wrap stuff inside lambdas or progns when using conditionals in lisp?

because otherwise it seems like both conditions can only be one function
>>
>>57858579
Vous avez un sexe de taille inférieur.
>>
>>57858593
lisp doesn't even have that. what are you on about?
>>
>>57858579
No computer science in Europe.
>>
>>57858593
>>57858599
>Lisp
You should be more specific.
>>
>>57858599
common lisp definitely has if conditionals though
>>
>>57858607
Lisp.
>>57858610
No it doesn't.
>>
>>57858615
http://clhs.lisp.se/Body/s_if.htm
what the hell is this then
>>
>>57858615
Do you mean the original "LISP" from 1958?
Common Lisp? Emacs Lisp? Racket?

"Lisp" refers to an entire family of languages now.
>>
>>57858622
Sure, I just haven't noticed them in all these years.
That's totally plausible. Fuck off.
>>57858624
all of them.
>>
>>57858604
lol if there is anyone overrated its the fucking usa. Fucking pajeetmagnet.

Yes sillicon valley is the most retarded and overrated shithole on earth. If yurop would make one we'd fucking destroy you m8. But we're too busy having our culture.

MIT, harvard, princeton is a joke compared to real universities like ETH, EPFL, TUM, Cambridge, etc.
>>
>>57858667
(if (faggot-p (You))
(print ":^)")
(print "you'll never see this lel"))
>>
>>57858593
In Common Lisp at least, each conditional in a cond statement is already a progn.

* (macroexpand '(cond (a b) (c d)))

(IF A
(PROGN B)
(COND (C D)))
T
>>
what does foo even mean?
>>
>>57858676
>yurop
>culture
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAH
>>
>>57858763
It means the opposite of bar
>>
>>57858763
its named after the player foobar
>>
File: 2vwdxsw.jpg (82KB, 900x643px) Image search: [Google]
2vwdxsw.jpg
82KB, 900x643px
>>57858774
>>
>>57858804
why did you post this?
i'm not even american lmao
stupid y*ropean
>>
>>57858815
>not fat
>not fag
Even if you are asian you're not human
>>
>>57858763
Ebonics for "fool".
>>
>>57858832
but i'm human which means:
i'm white
i'm not y*ropean
i'm not asian
i'm not black
i'm not any other species
>>
>>57858456
>return -1;
>>
>>57858804
>Superb owls won by American football coaches: 50
>Superb owls won by yuropean football coaches: 0
surely makes those synapses fire
>>
I have been programming a doppler simulator to output surround sound.

This is an example of what the program outputs (in stereo sound):

https://www.youtube.com/watch?v=G3dLtdEYx4k
>>
>>57858936
>calling Cross-Atlantic Competitive Handegg "Football"
shiggy
>>
>>57858936
>Implying yurosmart cares about such a shitty game
Anon we already solved it
>>
>>57858998
nice
>>
File: templatefunction.png (44KB, 1479x697px) Image search: [Google]
templatefunction.png
44KB, 1479x697px
Hey guys could use some help understanding templates. I am supposed to make a template function that receives a minimum value, a maximum value, an array of test values, the size of the array, and a boolean array.

What I have done works when the min/max values provided are regular int and char values. However my tester program also receives an object array of students which breaks the program. I have no idea why. Is the way I declared the template function incorrect?

Any help would be appreciated I have been reading about templates and I can't understand why my function won't work with the object array specifically.
>>
>>57859183
I should clarify it should only display the values in the array that are not between the min and max value. It goes through the boolean array while also going through the array of values and for false index values of the boolean array it will print out the invalid value.
>>
>>57859183
size should be of type std::size_t, not a templated type.

Your for loop is incorrect. You are checking size + 1 elements of the array.

The types of min and max should match the type of the array.

Most importantly: how did you overload operator>?
>>
int Factorial(int val)
{
if (val > 1) {
return Factorial(val - 1) * val;
}return 1;
}

int main()
{
int value = Factorial(5);
cout << value << endl;

return 0;
}


Maybe a stupid question, but given this recursive function. Does the int "value" get 5 values assigned to it one after the other or just the last return in the call back?
>>
>>57859368
Just the last return.
>>
>>57857691
>calling this """obfuscation"""
>also undefined behavior

int main()
{
char* __ = "M{rejg$s$ehs$l$mo$ji$lx$mi}ywqxmkx$vr2";
int i = 0;
char* ___ = "$er$yo}ylv$rxiwr2Exvxe0kz$s$silr$shmo\xEje";
char* j;
char* k;
j = &0[__];
k = &0[___];
while(*j)
{
putchar(*j - 4);
j++;
i = i + 1;
i++;
--i;
i = *j - *j;
i = *k- *k;
putchar(*k - 4);
k++;
i = i + 1;
i++;
--i;
i = *j - *j;
i = *k- *k;
}
}


aka

int main()
{
char* __ = "M{rejg$s$ehs$l$mo$ji$lx$mi}ywqxmkx$vr2\x0p$";
char* ___ = "$er$yo}ylv$rxiwr2Exvxe0kz$s$silr$shmo\xEje";
while(*__)
{
putchar(*__++ - 4);
putchar(*___++ - 4);
}
}
>>
>>57859381
Thanks
>>
File: dicks now.jpg (173KB, 1280x720px) Image search: [Google]
dicks now.jpg
173KB, 1280x720px
>>57858763
It's a useful warning beacon.
You can pretty much invalidate any opinion made by someone who uses "foo", "bar", "baz" naming pattern because it also means they're a cargo cult OOP programmer who has never had an original thought in their life.
>>
>>57859398
> >also undefined behavior
Is there a single line of code in C that is not an undefined behavior according to the standard?
>>
>>57858532
>Implying fags doing that work arent pseudo-code-monkeys.
You do know what a job is right?
>>
>>57859471
You're an idiot.
>>
I can't decide which language I want to learn, if it is c# or c++. I keep hopping from one to the other and I end up not learning any of them continuously.
>>
>>57859738
Learn C instead.
>>
>>57859738
learn C# first.
>>
>>57859738
Your lack of discipline makes you unworthy to learn C++.
>>
>>57859758
I know a bit of c and I've played a bit with pointers and function pointers, but my knowledge of it is very basic, I guess.
>>
>>57859324
All of the class functions were given to me. Turns out they had the <= and >= operator overloaded to deal with comparing the objects. When I replaced the < and > with <= and >= it worked correctly!
>>
>>57859398
I'm glad you had fun unpacking it, anon! You should post some obfuscated code of your own!
>>
File: why.png (144KB, 809x400px) Image search: [Google]
why.png
144KB, 809x400px
See an interesting article about calloc on HN and lobsters [1]. Open it, and the author's added an extra preamble whining that political discussion isn't allowed for a whole week on HN (attached image).
Exercise for the reader: Guess what the "happen" hyperlink leads to

[1] https://vorpus.org/blog/why-does-calloc-exist/
>>
Python anyone?
>>
>>57860381
Python 3 was a mistake
-- Zed Shaw
>>
>>57860391
Zed Shaw was a mistake
-- me
>>
>>57860397
I agree
-- Also me
>>
>>57857691
Get on my level, kid.

int64_t f(uint8_t n)
{
if (n <= 1) return n;
/* if n is greater than 92, fail */
if (n > 92) return -1;
n -= 2;

uint64_t a = 1, b = 1, c = 0, d = 1, e = 1, f = 0;

while (n) {
uint64_t g, h;
if (n & 1) {
g = a * d + b * e;
h = b * d + c * e;
f = b * e + c * f;
d = g;
e = h;
}
g = a * b + b * c;
a = a * a + b * b;
c = b * b + c * c;
b = g;
n >>= 1;
}

return d;
}
>>
Fun with macros:

#define while if
>>
File: 01.png (38KB, 1146x476px) Image search: [Google]
01.png
38KB, 1146x476px
>>57860320
Also the article sucked, and Jonathon Blow (Braid, The Witness) commented
>>
>>57860446
#define while(cond) while(!(cond))
>>
How do i use an encrypted code block, have the program run, decrypt the code block and run said code block?
>>
>>57860570
#!/usr/bin/bash
decrypt code.c.encrypted >> code.c
gcc code.c -o code
./code
rm code
rm code.c

???
>>
http://flyingfrogblog.blogspot.com.au/2016/05/disadvantages-of-purely-functional.html
You guys read this?
Never read this guy's stuff before, but apparently he's the arch nemesis of Haskellers everywhere
The Diogenes to their Plato, if you will
>>
File: 2000px-Haskell-Logo.svg[1].png (36KB, 2000x1412px) Image search: [Google]
2000px-Haskell-Logo.svg[1].png
36KB, 2000x1412px
>>57857672

It's funny how mad people get because they're too stupid to learn something they don't already know. And as far as ugly goes, I'd bet you could do a lot worse in C/C++. :-)

>>57857090

Here's some more idiomatic Haskell, hopefully it can make understanding Quicksort a bit easier:

quicksort [] = []
quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater)
where
lesser = filter (< p) xs
greater = filter (>= p) xs
>>
>>57860651
t. unemployed
>>
>>57860647
Diogenes? More like dysgenics.
>>
>>57860673
haha nice
>>
>>57860651
That's not quicksort though.
>>
>>57856284
Is Lisp actually useful for hackers?

The recommended languages seem to Python, C, C++, Lisp, Perl and Java.
>>
>>57860727
Stop hacking our systems or we'll kick you out of school
>>
>>57856366
Where's the official advent of code?
>>
File: 1444887197679.jpg (53KB, 300x300px) Image search: [Google]
1444887197679.jpg
53KB, 300x300px
So it says here you program on Haskell, would you care to comment on that?
>>
>>57860762
Yes I do sir.
>>
>>57860762
I did a paper about it in University.
It was very informative.
>>
>>57860762
Nein, mein name ist Haskell, entschuldigung.
>>
>>57860762
On Haskell? Never heard of that OS
>>
>>57860775
Will? Is that you?
>>
>>57860689

It's quicksort, just not in-place quicksort. For the purposes of illustrating what quicksort does, I think it's helpful.
>>
>>57860812
>just not in-place quicksort
i.e. not quicksort.
>>
>>57860733
Yes Mr. Crawley ;_;
>>
>>57860812
>just not in-place quicksort
the original definition of quicksort gave the in-place requirement. it's not some extra add-on, it's core to why it's efficient. quicksort is simply suboptimal to mergesort in haskell because at least mergesort has a better worse case runtime
>>
>>57860834
Unless you implement it using the ST monad.
>>
File: 150716manreviewingresume-stock.jpg (210KB, 3867x2578px) Image search: [Google]
150716manreviewingresume-stock.jpg
210KB, 3867x2578px
So you say you need to wear striped arm warmers, striped socks and a skirt to be an efficient coder.

Care to explain yourself on that?
>>
>>57860904
I'm not a very efficient coder
>>
File: learning_c.png (2MB, 1058x1600px) Image search: [Google]
learning_c.png
2MB, 1058x1600px
>>57860904
All the best coders do it. What's there to explain?
>>
>>57860904
Memes desu
>>
Kill me desu

How learn go
>>
>>57860834

Ah, good to know, thanks. The in-place version isn't as pretty, but it's certainly do-able.
>>
>>57860998
Golang? It's dead simple, even a sandwich could learn it! haha ( ^.^)
>>
>>57861022
The code of conduct is the most complicated part
>>
>>57861022
Haha crossdressing LOL
>>
>>57861034
Golang has a CoC now? Weird.
>>
>>57861047
Yeah, you have to prove you're obeying the CoC in order to pass typechecking.
>>
>>57860904
I like that suit.
It's a nice suit.
>>
C++ is so goddamn ugly
>>
Poorfag here starting the Data Structure casual filter class. I've learned Java so far, but the professor recommends learning C++ for the class. What is a good video/website series I can use to help learn C++.?
>>
>>57861074
A mere mortal cannot just "learn" C++.
>>
>>57861074
the first few google results for "learn C++"
>>
>>57861065
std::austd::4chan::posts::responses<facetious, snarky> response("What's wrong with it, homo?");
>>
just realized it's not me who's wrong, it's dynamic programming
>>
>>57861082
Maybe if you're "retarded"
>>
>>57861131
I can say with complete certainly that you do not know C++.
When I say "know" I don't mean "I can write hello world or fizzbuzz". I mean you have an good understanding of all of the language features.

>>57861124
No, it's probably you.
>>
>>57861124
It's probably your approach to dynamic programming not the method itself.
>>
>>57861149
Nice black and white comparison there
>>
Going through Analysis of Algorithms book, I have a stupid question.

Why is the summation from 0 to n-1 and not 0 to logn?

http://clrs.skanev.com/04/04/04.html
>>
>>57857405
Ok so I've given up hope on finding a hardcover copy.
Where can I print a copy myself? Is there places that take ebooks and print them for you?
>>
>>57861185
nevermind I figured it out.
>>
>>57861200
Share your answers big guy
>>
>>57861207
We're not splitting the sub problems, we're just removing 1 from n.

So we're going to end up with n leaves.

R-Right?
>>
>>57861228
>>57861228
>So we're going to end up with n leaves.
Oops, meant 2^n here
>>
>>57861175
>>57861149
yeah i just learned about do blocks in haskell. fucking learn you a haskell asshole put hello world halfway through the book so i thought you had to do literally everything functionally
>>
>>57861348
>implying do blocks aren't functional
>>
>>57861358
i'm talking about the style, not whether it technically is functional. i gave myself asscancer trying to do dijkstra's all day today in a functional style
>>
>>57861348
>>57861375
Anon I'm an imperative programmer so I can't really say if pure FP is good or not but it sure doesn't seem like it's a good idea for you.
>>
>>57861389
functional programming's a bit odd, it makes some things very elegant, but it doesn't work very well on certain tasks at all
>>
>>57861375
How did do notation help with that?
>>
http://www.strawpoll.me/11809805
alternative option not mentioned: fall asleep and never wake up
>>
File: yui does the cute thing.gif (802KB, 500x545px) Image search: [Google]
yui does the cute thing.gif
802KB, 500x545px
8 minutes till AoC day 6 is up!

Can you beat the filthy python redditors for a spot in the top 100?
Friendly reminder that average completion time is 2 minutes and 6 seconds.
>>
>>57861429
read the algorithm
>>
>>
>>57861463
there has to be a smarter way to handle all those option changes reactbro
>>
>>57861453
i don't even know python
>>
I'm working through K&R, what does /dpt/ think about my temperature conversion program?

#include <stdio.h>

#define printTable main(){float celsius;int fahr;int lower, upper, step;lower = 0;upper = 300;step = 20;celsius = lower;printf("Celsius\t\tFahrenheit\n");printf("----------------------\n");while (celsius <= upper) {fahr = (9.0/5.0 * celsius) + 32;printf("%3.0f\t\t%d\n", celsius, fahr);printf("----------------------\n");celsius = celsius + step;}return 0;}

printTable
>>
>>57861597
>float celsius
>int fahr
I don't need to read the program to see the problem
>>
>>57861453
>Finish AoC problem
>Answer looks scrambled
>Fuck! Got it wrong, how is that possible?
>Debug for 5 minutes
>Same answer
>Put it in
>Right
>Leaderboard position: 200+

End my life.
>>
>>57861641
*teleports behind you*
*sheathes katana*
>>
File: sad yui.jpg (28KB, 467x700px) Image search: [Google]
sad yui.jpg
28KB, 467x700px
>>57861453
>5 minutes in
>leaderboard already capped
>the #1 guy finished in ONE MINUTE. BOTH STARS.
>>
Probably a stupid question, but I need to write some command line tools for Windows for a project I'm working on. I've never worked with C or C++ on Windows before, would I have to deal with all kinds of dependencies and shit? I'd like to be able to just move the resulting exe around to other Windows PCs and have it "just werk". Would I be better off just using something like C#?
>>
assuming we're past the bump limit before 7:20, requesting permission to make the next thread

I have found an exceptional OP image for /dpt/.
>>
>>57861597
Stop it. Get some help.
>>
>>57861710
If it's more trannies you're getting banned
>>
>>57861710
7:20 GMT that is, it being 5:20 GMT now
>>
>>57861724
I thought it was crossdressers. Trannies got breasts.
>>
>>57861724
It's not a trap nor is it a tranny, and it is unquestionably programming related and only programming related.
>>
>>57857704
How much is your time worth?
>>
File: [].png (11KB, 738x143px) Image search: [Google]
[].png
11KB, 738x143px
>>
>>57858532
Down here, we can already smell your genius farts and complaints about others' code style
>>
I can't keep this up anymore /dpt/, I can't keep on sending application after application, going through interview after pointless interview. I just need a fucking job but nobody's going to give me a fucking chance

I thought being a programmer would prevent me from having to go through the bullshit my my mom went through as an artist, but since I graduate I've spent more time unemployed than I did working. My entire college education was a waste
>>
This may sound stupid, but does anyone have any tips in what language to write a text to speech program that uses my own voice?
>>
>>57858456
Make your destructor virtual. CamelCase your class name. move initialization logic to an init() method. move glfwCreateWindow out of the initializer list (my god). Clear the DEPTH_BUFFER_BIT
>>
New thread
>>57861948
>>
>>57861463
It makes me excited to think that one of the girls sitting in the library is actually an expert boy in girls clothing programmer.
>>
>>57861463
This gives me an idea for a wifi chandelier.
>>
>>57861463

>handleOptionChange4
>handleOptionChange5
>...

USE A GOD DAMNED ARRAY
>>
>>57858165
Is this link what you're after? Really hard to understand what else you want.

http://stackoverflow.com/questions/2436125/c-access-derived-class-member-from-base-class-pointer
>>
>>57857122
Lmao iktff bro
>>
>>57858456
>
#include <GLFW/glfw3.h>
class programWindow

No.
>>
>>57859458
Source? Google thinks it's auto parts.
>>
>>57856284
Why are there two thread with 200+ posts?

>>57860904
I didn't say that at all, but if the company's providing, I'll take 'em.

>>57858763
https://en.wikipedia.org/wiki/Foobar
>>
>>57860651
that's not a correct implementation of quicksort, it has quadratic complexity

haskell fags always botch the most basic shit when it comes to algorithms, I've never met a haskeller who could implement qsort or sieves correctly
>>
>>57858456
the trickier part is initializing the GL context, do that, then we can probably give you more useful feedback
>>
>>57856393
this is 4chan
if you don't like it kindly fuck off
>>
What's wrong with var?

>>57857207
Considering you've been spamming this link for literal months now, I'm inclined to believe you're trying to get views for tube-bux.

>>57857704
It's worth it to me.

I bought two so I can have it on all my devices.
>>
>>57865718
let and const are superior options in modern javascript (or typescript/flow)
>>
>>57865748
Then why was it not said that "var is bad in Javascript"?

Javascript ain't the only language with var.
>>
>>57865804
¯\_(ツ)_/¯ it's certainly not bad in C#, where it's basically just like C++'s auto (although I suppose it could be bad there too if you overuse it a lot -- at least in C++ it can be a tad annoying if a codebase uses auto too excessively)
>>
File: anal beads.png (4KB, 75x333px) Image search: [Google]
anal beads.png
4KB, 75x333px
>>57865834
>tfw C# dev and addicted to convenience
>>
>want to get familiar with the source for an emulation server
>its 330 000 lines of undocumented code
holy fuck, im surprised it hasn't died off years ago
anyone got tips for how try and understand something of this size?
>>
>>57865939
get an IDE that has good support for the language you're looking at (if it's C++, then e.g. QtCreator). Use the features the IDE gives you like drawing type hierachies, finding definitions etc to better understand the codebase. It can be a HUGE help.

Other than that, basically just jump in and start modifying stuff (e.g. try to implement an improvement or something) and you will quickly learn your way around

Also picking apart the build-system may help you figure out how things are structured to some degree.
>>
>>57865963
inb4>IDE

But seriously, this.

IDEs exist to help you do complex tasks on massive projects, and it's a tool you're certainly going to want to employ here.
>>
>>57865963
>>57866087
thanks dudes, ill keep trying then
>>
>>57866122
you just gotta keep at it, that's how it is with large codebases. It may take you a month or two of working on it before you can really start to "see" the structure of things. Reading other peoples code is a skill in and of itself that is very different from being able to write software.
>>
>>57866150
Truth.

I inherited a massive web app written by literal pajeets a while back.

Took me a lot of poking and prodding to figure out their insane code base.

There were entire swaths of classes that seemed like they did something that I was trying to trouble shoot, but upon setting breakpoints, were never used.

Instead, there were many obviously copy/pasted "MyLongRunningTask"-like things that actually did the work I needed to modify and repair, still with default variable names and other oddities like "Upgradation" and "Authentification"
>>
>thread gets to 312
>make new thread
>few minutes later
>old thread at 300
>come back 7 hours later
>old thread at 292
wew
>>
>>57866410
Did a bunch of posts get deleted or what?
>>
reasking from old thread, what're some things I can setup/program that're used by governments i.e honeypots
>>
>>57866438
What are you even asking here?

You sound like a 14-year-old that was asking how to make roblox accounts the other day.
>>
>>57866471
Link to thread?
>>
>>57866567
It was in a programming discord, not here.

Same inability to really express what they were trying to do, and why they were trying to do it.
>>
>>57856850
Can you post a pic of it in action?
>>
File: 1480974581762.jpg (376KB, 960x949px) Image search: [Google]
1480974581762.jpg
376KB, 960x949px
>>57856354
>>57856563
Fastest route is a straight line.
>>
File: sweat1-300x277.jpg (39KB, 300x277px) Image search: [Google]
sweat1-300x277.jpg
39KB, 300x277px
>game server uses a database based scripting system
why
who thought this was a good idea
>>
>>57867270
Gotta keep forcing databases into relevance or people might realise just how fucking stupid they are.
>>
>>57867342
databases are great/necessary ya doof
just not for fucking scripting systems
>>
File: 1450010742005.jpg (49KB, 696x699px) Image search: [Google]
1450010742005.jpg
49KB, 696x699px
I've got to think up a project for a database management class using mySQL

>Hospital records!
Something more fun than this. Something involving media seems neat, but I don't know what it'd be besides my own shitty image board.
>>
>>57868343
youtube-clone with users, playlists, videos, ...?
>>
>>57868343
I think >>57868369 has a decent idea, but keep it simple like those MMD porn sites that have a very basic structure and limited features or you're going to end up in a clusterfuck.
>>
>>57868343
what are your tools? or just working on mysql only?
>>
>>57868369
>>57868463
Note taken. Videos would be cool.

>>57868466
We're allowed to use anything for the front end stuff apparently. The only requirement is to have used mySQL to handle a database and use the E-R model.
>>
>>57868691
Does it have to be a website?

Also, post 310 GET.

Migrate to the active thread so we can kill this almost day-old thread: >>57866411
>>
File: WVW69j3M-XkEIx3ASN.jpg (205KB, 400x240px) Image search: [Google]
WVW69j3M-XkEIx3ASN.jpg
205KB, 400x240px
>>57866683
Thread posts: 311
Thread images: 35


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.