[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: Trump Edition

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: 336
Thread images: 43

File: 1478907671527.jpg (227KB, 954x838px) Image search: [Google]
1478907671527.jpg
227KB, 954x838px
Previous Thread: >>57470763

What are you working on, /g/??
>>
I'm reading a C++ tutorial
>>
>>57478879
I'm watching one
>>
File: RIGGERS RIGGING.webm (248KB, 400x400px) Image search: [Google]
RIGGERS RIGGING.webm
248KB, 400x400px
>>57478870
>>
If Trump was a programmer, which language would he have used?
>>
Working on a linked list assignment...

I have a clear() method for a LinkedList, does this work? I wast trying without the
front = NULL
snippet, but it didn't seem to work
//FRONT IS NULL
if(front == NULL) return;

ListNode* temp = front->next;
while(temp != NULL)
{
cout << "CURRENTLY AT " << front->value << "\tNEXT: " << front->next->value << endl;
delete front;
front = temp;
// if(front == NULL) return;
temp = front->next;
}
cout << "==============" << endl;
cout << "CURRENTLY AT " << front->value << endl;
delete front;
front = NULL;
>>
File: 1471745404924.jpg (84KB, 640x627px) Image search: [Google]
1471745404924.jpg
84KB, 640x627px
Java assignments

At least I'm learning.

When do I start making money?
>>
>>57480767

Without front = null, the memory is still freed but front now points to a garbage memory value.
>>
>>57480800
Never
>>
File: Screenshot_2016-10-19-03-22-07.png (2MB, 1357x1972px) Image search: [Google]
Screenshot_2016-10-19-03-22-07.png
2MB, 1357x1972px
Is it possible to get a bf who's both good at programming and also not diagnostically autistic?
>>
>>57480821
Thanks, senpai
>>
>>57480477
Cobol in all likelihood
>>
>>57480929
Yes, but expect them to be liberal, or hate the world.
>>
>>57480929
Gonna be a really tough one to find.
>>
>>57480929
You can't be a good programmer without being autistic
>>
File: Screenshot_2016-10-19-02-51-28.png (1MB, 1305x1066px) Image search: [Google]
Screenshot_2016-10-19-02-51-28.png
1MB, 1305x1066px
>>57480975
Classical liberal or neoliberal?
>>
File: 1449303961669_0.png (765KB, 985x957px) Image search: [Google]
1449303961669_0.png
765KB, 985x957px
>>57479025
I love that webm. Vote for Trump, brother.
>>
>>57481037
NeoLiberal.
>>
File: Spoonsrattling.jpg (11KB, 300x207px) Image search: [Google]
Spoonsrattling.jpg
11KB, 300x207px
reddit.com/r/bur
>>
>>57481318
What great readmes
>>
>>57478870
>/dpt/
>Donald "President" Trump
>>
>>57481318
stop shilling you fucking subleddit we don't give a fuck
go back to plebbit to get your internet shekels and never come back here faggot

NIGGER MY POST ISN'T A SPAM
>>
File: Selection_688.png (16KB, 577x138px) Image search: [Google]
Selection_688.png
16KB, 577x138px
>>57482382
>>
File: 1478626529264.png (18KB, 360x299px) Image search: [Google]
1478626529264.png
18KB, 360x299px
Constructers in Abstract classes in cpp are a fucking nightmare and there's nothing helpful on the web for it.

this is my code and it's not fucking working for whater reason. http://pastebin.com/w5mBSems
>>
>>57484607
where's the constructor?
>>
>>57484607
is this bait or are you really fucking retarded?
>>
>>57483443
therefore his argument is flawed
>>
File: 1469937836505.png (72KB, 555x611px) Image search: [Google]
1469937836505.png
72KB, 555x611px
I wrote a JavaScript library for type checking and type conversion (and a map function).

I don't know if this could actually be useful though
>>
>>57484629
>>57484759
in Abstract class


public:
char*nom;

this is my constructor. forgetaboudit too advanced for u i guess.
>>
>>57484787
What font is this?
>>
>>57484844
Fantasque Sans Mono
>>
File: 1477421599218.jpg (233KB, 719x685px) Image search: [Google]
1477421599218.jpg
233KB, 719x685px
>>57484860
Thanks
>>
I keep getting a variable not defined in scope error in c++ could anyone help me?

#include <iostream>
#include <string>

using namespace std;

class Person{
private: string full_name;

public:
string getName();
void setName(string n);
}


#include "Person.h"
string getName() {
return full_name //this is where i get the error
}


excuse the shit indentation first time doing this and the tab key was tabbing to the captcha
>>
>>57481030
fagts
>>
>>57484910
go to a code monkey site to learn the basics

string Person::getName() {
return full_name
}
>>
>>57483443
TOPKEK
>>
>>57484954
How new are you?
>>
>>57484787
whatsamatta with you is typeof not gud enough for ye eh??

still an excellent exercise
>>
>>57484942
still getting the same error
>>
File: 1439274985397s.jpg (3KB, 125x111px) Image search: [Google]
1439274985397s.jpg
3KB, 125x111px
>>57484959
rather
>>
>>57484981
;
>>
>>57484972
You could do a lot of this with typeof but it's more convenient this way, and it also has some more features like check if every element in an array is a number, or map a function to every element of an array. I don't think anyone would use it though.
>>
>>57485003
no as in the variable is not declared in this scope error
>>
>>57478870
I just found out that because I read a graph of function names, parameters and data flow from a file and follow that graph, I am writing an interpreter for a script language.

That just struck me like lightning and the implications are alarmingly complex. Should I try to specify the "language" first or should I implement the functionality of the program and derive the language from what it actually does?
>>
>>57485007
It's not like most of this couldn't be accomplished with built-ins (there's literally a map function for arrays since es6) but I like the explicitness of your library a lot.
>>
>>57484787
>Using a non-strict language
ISHYGDDT
>>
>>57484607
Doesn't that defeat the purpose of an abstract class?
>>
>>57485041
>there's literally a map function for arrays since es6
Oh, didn't know that. That probably makes this pretty useless (I assume TypeScript has this too). Thanks though
>>57485064
It's not like you always have a choice
>>
>>57485082
nw, it's all in the bible:
https://github.com/getify/You-Dont-Know-JS
>>
>>57485012
there's a ; missing
>>
>>57485109
I know I have fixed that but thats not whats giving me the error relating to the variables
>>
I don't think it's a stupid enough question for /sqt/.

I want to run an old legacy C file on a webserver, using HTTP requests instead of stdin and stdout. What tool would you guys recommend?
>>
>>57485116
works for me
>>
>>57485209
disregard me i suck dicks
>>
>>57485231
>>57485241 was meant for you
>>
>>57485241
I had created a new folder where I put cloned Person.h and Person.cpp to see if the problem was something to do with the header file being used by others files in my original folder. Then I navigated to that folder in the terminal and forgot I was there so I was compiling the faulty code even though the original had been correctly edited
>>
>>57485157
looks like cgi is what you want. not sure if it will just werk or if you have to rewrite certain sections.
>>
Is there a better way for quasi inheritance in haskell?
data Generic = Base Shared Fields | Extended Shared Fields AndUnique 
>>
>>57485330
There is no need for inheritance in haskell.
Use typeclasses and instances.
>>
I have to work with a poo in loo, what should I do?
>>
>>57485348
foo :: Generic -> Float
foo (Base shared field) = shared
foo (Extended shared field extra) = shared * extra

bar :: Generic -> Field
bar (Base shared field) = field * (Base shared field)
bar (Extended shared field extra) = field * (Extended shared field extra)
>>
>>57485415
*How should this be written instead?
>>
>>57485423
https://en.wikibooks.org/wiki/Haskell/Classes_and_types#Classes_and_instances
>>
>>57485391
Just do all the work, tell whoever Pajeet is worthless.
Then next time you get a worthwhile partner
>>
you forgot ur semi-colon their bruh
>>
Is there any good software for testing out network protocols?

Like a server or client tool you start up, select which types of fields are present and at which positions, then just let it log the input
>>
So, I have an amazing idea.

But, I'm too lazy to actually work on it (I've started some work twice already, but both projects have stalled and died off)

The culprit is the fact I was unable to find a quick and easy way to display everything I've wanted.

Is there a game engine that allows me to do 2d/3d things, as easy as possible and preferably have a streamlined way to create dynamic guis?

Can be for C++/C# or any other language that's actually popular and makes sense

>>57485587
...Virtually?
If so, Cisco Packet Tracer

If not, why not just write one yourself? Selecting a port and listening is rather easy on all platforms.
>>
>>57485587
Virtually, with no care about the real inner workings of protocols, just testing topology and such? Cisco Packet Tracer
Real emulation, can be connected to the internet and emulates every single layer, being able to even write your own protocols and simulating the machines with VM? GNS3
>>
>>57485597
>If not, why not just write one yourself? Selecting a port and listening is rather easy on all platforms.
Writing a general one is a lot of work and I'm sure there are ready-made solutions out there.

I would like to be able to configure how the data is to be interpreted and also add tests for it.

Correct endianness that sometimes vary by field, correct encoding of floats (have to deal with people using non-IEEE...) and the like, etc.
>>
>>57485679
Ah, excuse me, I thought you simply wanted to look at the data/run extremely simple tests.
>>
>>57483443
>Comma after shekels.
>Proper noun 'internet' when it doesn't have 'the' to the left of it.
>Period instead of semicolon after subleddit.
You seem to be illiterate, Anon. I'm sorry, but you'll have to leave.
>>>/pol/
>>
pointers are fucking my shit up again
>>
whats the recommended way of returning collections of stuff in C++?
both of these seem pretty clumsy desu

bool read_into(byte** ppData, size_t** ppDataCount)
bool read_into(std::vector<byte>* pData)
>>
>>57478886
link?
>>
File: Screenshot (126).png (137KB, 1280x1024px) Image search: [Google]
Screenshot (126).png
137KB, 1280x1024px
Writing a development environment for a computer I'm designing... in batch.

>1180 lines
Kill me.
>>
>>57486436
what the fuck, why

get a decent scripting language at least
>>
>>57486464
I'd love to - but I'm unwilling to learn.

Fuck all your object oriented shit, I want my GOTO / GOSUB dammit! I couldn't care less what problems it might have.
>>
>>57485415
How is multiplication even defined here?
>>
>>57486717
It isn't. The important bit is that the parameters of Base and Extended are required in foo and bar
>>
>>57478870
if(op.image.isTrump() == "true")
{
reply("thank you for posting a trump picture");
}
>>
>be 2nd year CS student
>class is 95% males
>get assigned to a random group of 4 people for next assignment
>my 3 teammates are female

really makes me wonder
>>
>>57486567
>I'm unwilling to learn
Are you fucking serious? You would rather write scripts in the shittiest "language" ever than learning a proper language? You don't even have to learn a whole new language, you can just learn the very basics and it would be infinetely better than batch.
>>
>>57487046
Name a language that has goto or an instruction like it, and I'll look into it very seriously.

Functions don't count, the variables have to be global for the entire program.

I say this with 100% seriousness - I've been using GOTO since the late 1980s when we first got a computer - it's a bad habit that I don't see the problem with not giving up.

A good IDE is also something of a must.

Post-script:
Keep in mind this is just an emulator for a computer I'm designing, since it hasn't been built yet and a few of my friends are working on programs for it, I thought it'd be useful to write a short program they could emulate the computer in.
>>
>>57487156
>Name a language that has goto or an instruction like it, and I'll look into it very seriously.
There's a reason why nobody uses goto, it's because it's fucking shit and you would probably realize that if you would learn an actually useful language.
>Functions don't count, the variables have to be global for the entire program.
You can modify global variables with functions.
>it's a bad habit that I don't see the problem with not giving up
So you're admitting that you're just stuck in the past?

Seriously, learn a proper scripting language RIGHT NOW. If you don't then you're just ignorant as fuck and stuck in the past.
>>
>>57487156
>>57487183
Oh and I should also mention that there are (obviously) languages that have a goto feature but as I said, there's not a single reason to use them.
>>
>>57487183
Remind me of what exactly makes goto shit.
>Looks more organized
>carries over variables
>easy looping
>Access one point of a program from multiple positions and act accordingly
The only problem I can see with goto might be speed or memory fragmentation, neither of which are of particular importance to me.

Yes, I am stuck in the past, but at least my god damned Commodore 64 works correctly.

Name a decent scripting language with gosub or a goto equivalent, and like I said, I'll look into it.

>>57487202
See above for my reasons
>>
>>57487266
>Looks more organized
No, it's the exact opposite: Your code will be unmaintainable with goto.
>carries over variables
Except functions can do that much better in every way.
>easy looping
No. Why do you think so?
>Access one point of a program from multiple positions and act accordingly
Except functions can do that much better in every way, again.

You clearly don't know shit about programming and refuse to learn anything new because it's something new. Do yourself a favor and learn a new language anyway, your life will become so much easier. I mean seriously, batch scripting is the most annoying "language" I have ever used. I would rather use Brainfuck than this garbage.
>Name a decent scripting language with gosub or a goto equivalent
You don't fucking get it, if you would use a decent language then you would immediately realize how retarded your arguments were.
>>
Is there any good open-source keystroke encryption software out there?
And does the major operating systems have them built in?
If they don't, shouldn't they?

I mean, as long as they were set up to use a random salt, the whole keylogger problem would vanish?
Am I wrong?
>>
File: raspberry-pi-logo[1].png (50KB, 511x642px) Image search: [Google]
raspberry-pi-logo[1].png
50KB, 511x642px
I've posted in this thread before. I'm pretty good doing simple coding challenges in Js. I don't see Javascript posted here a lot so I'm just throwing that out there.

For my first actual programming project I want to create a voice interactive alarm clock; something with more dexterity than google now.

I want to use my phone to do this, a bit like:
https://www.youtube.com/watch?v=gihvvbNIEo8

I'm aware he uses does this with 'tasker scripts' (something unfamiliar with). How can I use voice to send text to my RPi? It's pretty simple. How do you think I should go about this?

I want it to take as input a conversational string and to search the string for keywords. If anyone has any insight on ways to go about this, that would be awesome. I essentially know nothing.
>>
So im doing my first bigger project and I'm not sure if everything is working fine

what i am doing is read input data from excel and plugging it all into a custom class to manage and query it

it works fine when I test it with just the first 10 lines, but when I run a test of all 30k lines it never terminates. Im monitoring it via task-manager and the ram usage never goes above 20mb

i dont really have the experience to troubleshoot this, could you recommend something?
>>
File: Screenshot (128).png (141KB, 1280x1024px) Image search: [Google]
Screenshot (128).png
141KB, 1280x1024px
>>57487334
Where is pic related disorganized?

>Except functions can do that much better in every way
How can integers be carried over better? I'm not sure I understand. All it's doing is retaining a value.

>No. Why do you think so?
:LOOP
REM Stuff here
GOTO LOOP
That's why.

>Except functions can do that much better in every way, again.
Calling a function name inside a function too many times can cause more issues than using GOTO infinite times.

>Rather use Brainfuck than this garbage
That was a low blow

>learn a decent language
I'm not sure if visual C++ counts, but it was pretty shitty for what I tried to do. Could've been done much simpler in batch or VBS even.

>Your life will become much easier
By learning a high level programming language? You realize I work more with hardware than software, right? (I don't know if I implied that enough, sorry).

C was pretty good, but I still prefer even Crapplesoft BASIC or FORTRAN over it.
>>
Writing a game/physics engine.

Anyone know a sensible way to handle a player-controlled object that is also a physics object? Like, I still want it to bounce off of things and resolve collisions sanely, but I also want the player to control it. I'm trying to avoid doing things that would allow the player to cancel all their momentum w/ quick movements
>>
>>57487478
>How can integers be carried over better? I'm not sure I understand. All it's doing is retaining a value.
I don't exactly know what you mean, but you can carry over variables to functions very easily
function(variable) {
// do something with the variable
}

>:LOOP
>REM Stuff here
>GOTO LOOP
>That's why.
You mean an infinite loop?
while(true) {
// do stuff
}

Or do a thing 10 times:
for(int i = 0; i < 10; i++) {
// do stuff
}

These are just two cases. You have many more options that are much better than goto.
>Calling a function name inside a function too many times can cause more issues than using GOTO infinite times.
I have no idea what you're talking about. Do you mean calling a function inside a function? Why would that cause issues?
>I'm not sure if visual C++ counts, but it was pretty shitty for what I tried to do.
Then use something else. That's not an excuse, there are so many languages to choose from. Pretty much everything you do in batch is easier in other languages.
>You realize I work more with hardware than software, right?
Doesn't matter, just learn the basics of a scripting language. There are so many languages yet you choose batch?
>>
>>57487577
>Learn a language
>ruby
No
>Python
Fuck off
>C
Confusing but yeah sure
>C++
garbage
>Java
No
>VBScript
Acceptable but no
>PowerShell
How about suicide
>>
>>57478870
Trying to become a functional programming magician.
>>
>>57487633
What language?
>>
File: wow.png (13KB, 613x335px) Image search: [Google]
wow.png
13KB, 613x335px
>>57478870
I decided to get back into programming, been about a year since I was programming basic games like tic-tac-toe and shit like that.

Wanted to get back into it, so I am just doing little mini programs to get back into the swing of things, as in shit that takes like 2 minutes.
>>
>>57487648
Haskell
>>
>>57479025
So who did he vote for? Did he vote for Jeb?
>>
>>57480477
Microsoft PowerPoint
>>
What's the logic behind deciding what goes in the WindowProc vs. the message loop?
>>
>>57487693
Kek

What about Hillary
>>
>>57487731
https://github.com/ErisBlastar/cplusequality
>>
>>57487751
>femminists
>3 years ago
Sounds about right
>>
>>57487751
>#define post_on_tumblr throw
>#define trans void*

kek
>>
File: 1462053739113.jpg (26KB, 215x365px) Image search: [Google]
1462053739113.jpg
26KB, 215x365px
Aseprite got cucked, damn, it's my favourite program for making shitty pixelart but the guy is a total nutcase. I think I'll start contributing to the fork, i was really looking forward to the new features but this just left a bad taste in my mouth so I guess this is my new programming project.
>>
>>57487616
why python fuck off?

general question, is it worth learning C++? I dunno what I'd use it for but that's because I dunno what it's used for
>>
>>57488134
Because even I know that Python is a pile of shit.

I'm used to slow computers and equipment, yeah, but holy hell it's got noticeable slowdown while doing just about anything. IDLE crashes all the goddamn time, too.
>>
>>57488171
Wtf are you doing in life that python brings you no joy
>>
I am going to start looking at either Java or C#.

I feel like Java would be the better option at this point although I am also tempted to start C instead.
>>
>>57488219
Floating point calculations, anything that gets input at all, literally anything that has to do with graphics.

IDLE still crashes no matter what I do - it's the latest version and I'm on Windows 8.1, so it's not like anything's wrong there.

Notepad++ is a decent editor, though.
>>
>>57488226
C is good if you want to try some low-level programming
Java will get you a job, though I don't think it's necessarily a great language. It gets the job done though
Never really tried C#, so I can't comment on that
>>
i'm trying to understand neural networks in general and Neuroevolution in specific and how to utilize them
but i can't get it through my thick skull

>i wish i had a step by step guide for that stuff ala "from an empty notepad to virtually evolving animals"
>>
>>57488277
And there are other languages to take care of those few things.

There's a big step from saying "python isn't particularly efficient at handling floating point calculations and graphics intensive work"

to

"python is a pile of shit"
>>
>>57486436
>windows
>notepad++
>batch
>opera
you forgot the how2take screenshot in you're troll picture
>>
>>57488378
"Graphics intensive work" meaning I wanted to draw a square on screen and it took 30 seconds. My Apple ][ clones do it faster!

Floating point as in dividing 9/2 gives 4. I know I can do
from decimal import*
and
decimal() or
float()
To fix this, but it should just automatically do this.

Even the Commodore PET could handle this!

>>57488431
I like 8.1 better than 10, but XP is out of support so I'm not using that system to post.
Notepad++ for Batch makes it a lot easier.
Batch is my personal favorite language since it's built into Windows and I don't have to download a bigass IDE onto my computers, among other reasons.
Opera because fuck Chrome, and because I felt like I wanted some change from Firefox.
>>
File: 1478150037697.jpg (76KB, 625x626px) Image search: [Google]
1478150037697.jpg
76KB, 625x626px
>>57488470
>all of your posts
>>
>>57487684
Who didn't? Trump cheated.
>>
>>57488470
neither of those things sounds like python's fault; may I suggest, as an alternative explanation, that possibly you are a moron coding on a relic?

In python, 9/2 = 4 yes, but 9.0/2 = 4.5
Is there a problem there with the language?
If you're not manually providing your inputs then maybe add an extra line in there to convert your inputs to float? Is that a problem for you? that's one of the least concerns I've seen mentioned about python.

My computer takes milliseconds to render 16bit images with python. If you can't draw a square in less than that then again I don't see how python is more to blame than your hardware.
>>
>>57487819
It was a /g/ and /pol/ project. We used to consort...
>>
File: Screenshot (129).png (299KB, 1280x1024px) Image search: [Google]
Screenshot (129).png
299KB, 1280x1024px
>>57488506
I hope not

>>57488577
Core i5 4440 and 8GB RAM?

>>57488588
I can tell. Seems like it got pretty far!
>>
File: Screenshot (130).png (767KB, 1280x1024px) Image search: [Google]
Screenshot (130).png
767KB, 1280x1024px
>>57488635
Thought I'd include my Speccy and all the games on my desktop.

Not shown: Games people other than me enjoy
>>
How to do class inheritance in Javascript? Below is an example of my class. Each my classes share the same render() and exists() functions. Only the init functions differ.

function Blast(rect, size, vel) {
// Assign parameters to this.particles[]
};


Blast.prototype.render = function(c) {
for (var j = 0; j < this.particles.length; j++) {
if(this.particles[j].exists()) {
this.particles[j].render(c);
}
}
};

Blast.prototype.exists = function() {
if(this.alivecounter < MAX_ALIVE_TIME)
return 1;
return 0;
};
>>
>>57484787
t. haskell fag
what is your font and scheme?
>>
File: Area behind intersection.png (9KB, 674x577px) Image search: [Google]
Area behind intersection.png
9KB, 674x577px
What would be the best way to determine the plane segment of a plane segment behind another plane segment using either pure math or unity stuff?

sub-plane in red
>>
>>57488690
>sub-plane
sub-quad*
>>
>>57488669
pre es6
var subBlast.prototype = new Blast();
subBlast.protoype.constructor = subBlast;

es6 and beyond:
class subBlast extends Blast;
>>
>>57488680
The font is Fantasque Sans Mono, the color scheme is One Dark
>>
>>57488712
Thank you sir!
>>
>>57488690
Plane segment? Like a rectangle on a plane, i.e. defined by a point and two orthogonal vectors?

The simplest thing that would work is to find the line segment of the intersection and make a trapezoid out of that line segment and the line segment that is the end of one of the "plane segments".

Why do you need to do this? There might be a better (more implicit/relational) way.
>>
with python (and I assume other languages), is it better to have a single module full of functions or to spread those functions out across multiple modules?

is there any difference beyond readability?
>>
>>57481037
>>57480929
Sauce of mango?
>>
how does java's println manage to be shittier than C's printf

why the fuck do i have to write so much stuff to change the decimal format
>>
How useful is knowing how to balance binary trees?
>>
>>57480477
C

He would compile with gcc -Wall
>>
>>57490714
Very. A well balanced tree will find results quicker.
>>
>>57490833
How often are binary trees used by companies to store and search info?

I'm like, memorizing many basic data structures but still somewhat afraid of never using the knowledge and then forgetting everything
>>
File: 1477570238468.jpg (57KB, 784x643px) Image search: [Google]
1477570238468.jpg
57KB, 784x643px
>>57490756
kek
>>
File: 1476846368725.jpg (707KB, 3500x2587px) Image search: [Google]
1476846368725.jpg
707KB, 3500x2587px
>>57487751
#define no 0
#define yes 0
>>
found a rajesh nest
http://www.crazyengineers.com/threads/to-count-no-of-elements-in-list-using-prolog-programming.41122/
>>
im starting learning programming lads

how big performance impact installing visual studio and sql server on my PC?
>>
doing this in prolog
okbank(List) :-
count(c, List, Ccount),
count(m, List, Mcount),
Mcount == 0 ; Mcount >= Ccount.

i'm trying to compare the number of c's in the list with the number of m's. if there's more c's than a's, it's false. it tells me Mcount and Ccount are singleton variables though, as a warning. why? i use them to compare. is there a way to do it different and not get warned?
>>
>>57491629
I recommend English for your first language
>>
I'm working on a pipe I'm unsure where to even begin. Tried to get help IRL but still stuck

I need a pipe for my forks(). I'm going to have 5 forks for 10 processes

int i;  
pid_t pid[5];
for (i = 0; i < 4; i++){
pid[i] = fork();
switch(pid[i]) {
//stuck here???


Each process has a specific code value that will eventually be output through the parent. I'm unsure how to tell the program this though
>>
>>57491629
visual studio is cancer
>>
File: 1450767638946.jpg (50KB, 760x631px) Image search: [Google]
1450767638946.jpg
50KB, 760x631px
Can anyone recommend a good tutorial or project to really nail down pointers in C/C++?

Every time I encounter them I lose momentum and try to avoid using them.
>>
>>57491709
Linked list. Build functions to add to it, remove from it and print it.
>>
>>57491709
what this guy said >>57491744

More concretely I would advise you to write a graph manipulator with linked lists. It's great practice, you'll learn some graph theory, some algorithmic stuff, all while getting used to pointers. So make a graph and then make functions that let's say, identify if it's a tree or not, search for elements, find the shortest path between a and b, write heap sort... There's tons of stuff to make with graphs.
>>
File: DtoBconverter.jpg (70KB, 811x796px) Image search: [Google]
DtoBconverter.jpg
70KB, 811x796px
I'm taking a java class and made a dumb way to do this decimal to binary conversion. it works, but i want to turn the scanner into a command line argument instead. is there a quick way i can do that here?
>>
>>57491709
after making your own linked list, read up on the linux kernel's linked list implementation

((type *)((char *)(ptr) - (unsigned long)&((type *)0)->member))
>>
>>57491857
God that looks ugly
>>
>>57491884
wow, ok, I can go kill myself now, I don;t know shit
>>
>>57491676
i needed parenthesis around the final line
>>
quick question, how do you return true or false from a recursive algorithm in c++? (searching a binary tree for an element) I though about adding the recursive calls together but that doesn't work if you get multiple trues and return a number larger than one.
>>
>>57491922
this is a good explanation of how it works
http://isis.poly.edu/kulesh/stuff/src/klist/list.h
it's a very backwards implementation of a linked list

the code I posted is just to find the parent struct of a given member
>>
>>57491937
|| &&
>>
>>57491948
>isis
>>
>>57492012
that works in a return statement? For some reason I assumed you could only use them in logical statements (as in a for loop or something). Derp.
>>
File: 1478344825073.gif (2MB, 320x180px) Image search: [Google]
1478344825073.gif
2MB, 320x180px
hello, i'm new to programming. i made a command line tool to download all images from a thread. could be useful for porn. example usage:

python3 download_all.py g 57478870[/code]

any tips for improvement?

https://github.com/octopuzzy/4chan_tools
>>
>>57492153
- Use the 4chan API rather than parsing HTML
https://github.com/4chan/4chan-API
- Allow arguments to look like URLs so you can:
  download_all.py g/57478870
download_all.py >>57478870

You could probably use regexp for that
- Allow folder to be specified (optionally) on the CLI
>>
>>57492168
I wish 4chan wasn't shit with its code tags and wouldn't turn a url into a >>#### link
>>
>>57492168
any reason to use 4chan api instead of parsing? i wanted to be nice to their json server
>>
File: tide_antiprotest_street_cleaner.jpg (84KB, 960x640px) Image search: [Google]
tide_antiprotest_street_cleaner.jpg
84KB, 960x640px
>>57492168
i just read their api and had to change the title.

https://github.com/octopuzzy/Meme-Tools
>>
>>57492204
Less data to download, and if the HTML DOM changes it won't break your app. The JSON API shouldn't change for a long time. Its also faster for 4chan and for you to encode/decode.
>>
>>57492275
ok thanks a lot
>>
What should I do if I can't pick between C and C++?
>>
>>57492715
The go with C.
>>
>>57478870
Hey guys, I'm trying to overwrite a value in a remote process, but I'm having alot of trouble.

I've found the base address and pid of the process, and I'm able to read the value that I want to overwrite, but the actual overwriting part with WriteProcessMemory is really fucking me up.

I have found a multi-level pointer with 3 offsets pointing to the value I want to overwrite, and manually putting the value into WriteProcessMemory works, but I'm trying to avoid doing shit manually.

DWORD BASEADDRESS = MemManip::GetBaseAddr(PID, "ProcessToSet.exe");
DWORD offset0 = 0x0001392;
DWORD offset1 = 0x043;
DWORD offset2 = 0x142;
DWORD offset3 = 0x0;


So the way I can read the value it's pointing to is I call ReadProcessMemory about 4 times in a row, adding the offsets to the output each time. But I am not sure how to replicate the same with WriteProcessMemory.
>>
>>57481030
>implying programming is actually hard
>implying it isn't just a trade that takes training like any other
>implying that in 5-10 years the workforce won't be flooded with pot-smoking code junkies who hold second rate cs degrees
>>
function <$> list

or
map function list
>>
File: 393 Bytes of Chen.gif (393B, 50x50px) Image search: [Google]
393 Bytes of Chen.gif
393B, 50x50px
I'm about to start learning C++.
I would love to become a regular visitor to these threads as well.
Where would you guys recommend I start? Links? I was thinking of finding some books, but based upon previous experience, that isn't very efficient.
>>
>>57493140
but programming IS hard
>>
>>57493140
t. faggot who can't make anything more advanced than fizzbuzz
>>
>>57493238
learn java first, C++ can be a clusterfuck to beginners

https://docs.oracle.com/javase/tutorial/
>>
>>57493238
http://101.lv/learn/C++/
>>
>>57481030
this

>>57493140
webdev and codemonkey tier coding isn't hard but real programming is hard, if you're actually good you'll run your own startup or be a "rockstar developer" on a 7 digit salary
>>
>>57493262
Thanks for the advice, will learn it first.

>>57493272
Lifesaver. Needed a link like that. Thanks a mill.
>>
>>57492998
Bump. I guess I need to get the address ReadProcessMemory is reading from?
>>
>>57492768
Is this a confirmed post?
>>
>>57487942
fill me in?
>>
I can't install Visual Studio so is MonoDevelop a good IDE for C#? Is programming in C# even a good decision? Why do people not like C++? What's C generally used for? What do you guys even make here? Are you having fun?
>>
>>57480929
Sup girl are you girl
>>
>>57480477
Perl, because of ol' Larry
>>
>>57493396
We're still getting the results back but our team thinks it's likely not a post.
>>
>>57493644
A ruse?
>>
>>57486436
how retarded does someone have to be to prefer batch even after they've tried C
>>
>>57493710
Someone who's been using GOTO / GOSUB since 1983 and doesn't want to use functions and make the program unnecessarily complex
>>
>>57493736
wow dude you're so advanced and smart :^)
>>
>>57493827
Lies. I'm only smart in the Commodore / Apllesoft / Microsoft BASIC languages (They're the same for the most part).
>>
>>57493736
>functions
>make the program unnecessarily complex

Dude..
>>
>>57486567
it's 2016
>>
>>57493905
I hadn't noticed

>>57493886
Yes?
>>
>>57493905

A year that will go down in history as one of the greatest.
>>
Trying to implement a binomial heap, but am running into an issue.

If a 3-order heap (such as pic related) can contain a order-0, order-1, and order-2 heap, how can I make a struct that can link to n-1 of a similar struct?

In case my question made no sense (which is probable), I'm asking this: how would I go about beginning to organize a binomial heap?
>>
>>57494128
Could you elaborate a bit on the use of this structure? i'm not seeing the point... Don't binary structures already have a set mode and order of precedence for the order? Pre, In and Post?
>>
>>57494128
Also, what's a binomial heap? Wouldn't that be organized using the same method you would use with regular binomials and then make a call back to a sorting method specifically for binary trees?
>>
>>57494128
Okay, just googled it.

A binomial tree can be broken down just the same way one would break down the return order for a recursive stack. So, you return from the busiest tree, the n tree, and sort it to the point that it can fit the model for an n-1 tree. You then sort that until it fits the model for n-2, so on and so forth until you have reached the top of the binomial heap as a single point of entry.
>>
>>57494424
When I say fit the model, I'm meaning that you sort the the tree with the most children with children of their own until the sorting of those children nodes is no longer a matter of significance and you can thus treat the node as a child node without children of its own.
>>
>>57494424
>>57494444
Right... But I'm more confused with how'd you'd actually implement it. Wikipedia says you can use a Linked List, but I'm having trouble visualizing it

struct Node
{
int value;
Node* leftChild;
Node* rightChild;
}


That's the general structure for a binary tree, but a Binomial heap can have more than two children nodes,.. Would you need an array of pointers to nodes?
>>
>>57494475
Sounds about right.
>>
>>57494522
Okay... I'm thinking about the following for the struct's structure (heh...)
struct Node
{
int value;
Node** pointersToOtherTrees;

Node(int value, int order) //Constructor
{
this->value = value;
this->pointersToOtherTrees = new Node*[order]; //Creates a pointer to an array of pointers to Nodes
}
}
>>
>>57494580
I was going to reference something like this but using only pointer arithmetic and decided against it because traversal would be strange in an in-order traversal and decided against it because I didn't consider the possibility of using the index notation for the call to the specific order. My thought process being that if you make calls to the array on the grounds that you want to use a specific sorting method, you would have to abide the strategy throughout since you have the iterator traverse from a single point. What that would do then is force you to pull back out of, for instance, an n order tree and then move back at a higher level and then return to the right most tree, which would muck up a lot of calculations if for some reason you h..- it just occurred to me how you could do this using just pointer arithmetic.

If you use a pointer to a pointer to a pointer ( ***node ) and hold the trees at the lowest point of indirection capable of promotion, you could apply any order by a means of indirection and simply return to a level where the orders were designated separately from the table and not as the condition for the qualities of a table. Let me know if that made sense or not so I can rig up an example.

As you have it right now, you will only be able to make recursive calls from the busiest backwards and will have to make all kinds of strange exceptions for the sorting methods to be applied linearly.
>>
File: youcandoit.jpg (158KB, 450x600px) Image search: [Google]
youcandoit.jpg
158KB, 450x600px
>>57494691
I got to use "indirection" on /g/.
>>
>>57487156
>djikstra was right
Youre doomed anon
>>
>>57491094
I haven't seen simple balanced binary trees in direct commercial use yet. Either you will be using an existing library/implementation or you will use a more specialized data structure. Looking into them can still be useful, getting the idea and everything, just don't bother trying to learn every data structures implementation details by heart - if you ever need them you can still just look up the implementation.
>>
>>57494691
I'm not sure I understand your point...I'm using a Binomial tree for a Priority Queue representation, where you don't really need to sort, but you sort of "meld/merge" when you add things (apparently giving you some pretty wicked improvement boosts)

I'm going off this lecture:https://www.cs.princeton.edu/~wayne/kleinberg-tardos/pdf/BinomialHeaps.pdf

Binomial heaps are near the middle
>>
File: sortingbinomialheap.png (57KB, 1013x530px) Image search: [Google]
sortingbinomialheap.png
57KB, 1013x530px
>>57494580
So whenever you reach the end of your pointer list at the "n order" level, you attach that to the end of your "n -1" pointer list, then do the same for that list down to "n -2", so on and so forth.
>>
Im building a game for PS Vita using Unity as engine
>>
>>57494814
Yes.... I think.

I'm thinking of having a "front" node pointer that just "connects" all the trees in the heap

So I can make it such array index is closely related with the order of the tree you're inserting
>>
>>57494854
What I'm thinking is that this way you can just template the sorting methods and have a function for each structure, one for a tree, the calls the pointer function, which references the order according to the sorting method. This way you can simply skip to a level or iterate normally or iterate using calls to the "front" "front +i" or "last" nodes. I was trying to suggest you scrap the use of index notation to avoid the use of smart pointers and the extra inferences they carry with them. Performance boost up the whazzoo.
>>
>>57494854
Wait, what language are you using for this, anyway?
>>
>>57494883
I only just added the front and front +i and last parts as per your own post. I was originally just thinking of it as calls to the iterator ( [ ) and reverse iterator ( ] ).
>>
>>57493272
Is there something similar for C?
>>
>>57494886
C++
>>
Is DOM even worth learning? Trying to work out why this isn't working.
<HTML>
<table border="1">
<SCRIPT LANGUAGE="JavaScript">
var xmldoc=new ActiveXObject("Microsoft.XMLDOM");
xmldoc.load("students.xml");
var names = xmldoc.getElementsByTagName("NAME");
var ages = xmldoc.getElementsByTagName("AGE");
document.write("<tr>" + "<th>" + "Name" + "</th>" + "<th>" + "Age" + "</th>" + "</tr>")
for (var i = 0; i < names.length; i++) {
document.write("<tr>");
document.write("<td>" + names[i].firstChild.nodeValue + "</td><td>" + ages[i].firstChild.nodeValue + "</td>");
document.write("</tr>");
}
</SCRIPT>
</table>
</HTML>

and my xml list
<?xml version="1.0" encoding="ISO-8859-1"?>
<CLASS ID=”Advanced Web Development”>
<STUDENT>
<NAME>Tom</NAME>
<AGE>19</AGE>
<HEIGHT>1.3</HEIGHT>
<SEX>M</SEX>
<GRADE>B</GRADE>
</STUDENT>
<STUDENT>
<NAME>Dick</NAME>
<AGE>29</AGE>
<HEIGHT>1.1</HEIGHT>
<SEX>M</SEX>
<GRADE>A</GRADE>
</STUDENT>
<STUDENT>
<NAME>Harry</NAME>
<AGE>39</AGE>
<HEIGHT>1.5</HEIGHT>
<SEX>M</SEX>
<GRADE>C</GRADE>
</STUDENT>
<STUDENT>
<NAME>Mary</NAME>
<AGE>30</AGE>
<HEIGHT>1.1</HEIGHT>
<SEX>F</SEX>
<GRADE>B+</GRADE>
</STUDENT>
</CLASS>
>>
>>57494957
So the template function would work its way in by allowing you to create an n order function using the dynamic type declaration by string invocation. Wait, can you even make pointers using something like:

makePointer( T type, int level )
{
char* newType =(typeof)type;
int count =level;
while( level-- >0 )
newType += "*";

}

So, that you could iterate throughout the current order at the tree level and still abide the strategy so that compilation would stay fully optimized?

I'm reading that there is a gnu extension to use typeof, but let's say there was a different way of creating a "type" using a string declaration...

As I've stated it, it would only be possible if you could do this somehow. I guess you could top off the filesystem by not allowing more than a certain number of levels, just like bash does with directory traversals using the option -l, but that is assuming you'd be heading the project as the designer/director/admin.
>>
>>57495146
I guess you could do this if you just made a subclass of the type for every level of the order but that would be a little heavier that my ideal. ;_;
>>
>>57495166
You'd also have to assume an analogy or a general case that would function most broadly. So, like bit to class. I think I just fucking ruined the thread.
>>
Am I glad that the caveman's the caveman , what I wanna know is where's the caveman?

Am I glad that the sherrif's the caveman and that I just remembered he's in there and that we're out here and that I'm the sherrif and that he's in here and that the caveman's the caveman , what I wanna know is where's the caveman?

Am I glad that we're in here , what I wanna know is where's the caveman?

Am I glad that we're out here and that I just remembered I'm the sherrif , what I wanna know is where's the caveman?

Am I glad that he's in there but I'm frozen out there and that we're frozen over there , what I wanna know is where's the caveman?

Am I glad that he's out here but the sherrif's the caveman but the sherrif's in there but he's in here and that he's the caveman but I just remembered I'm the sherrif , what I wanna know is where's the caveman?

Am I glad that he's out here but we're in here but the sherrif's in here but I'm frozen in here , what I wanna know is where's the caveman?

Am I glad that I'm frozen out here , what I wanna know is where's the caveman?

Am I glad that I'm in here but I just remembered I'm over there but the sherrif's in there and that I'm frozen over here and that we're the caveman but the caveman's frozen out there , what I wanna know is where's the caveman?

Am I glad that the sherrif's in there , what I wanna know is where's the caveman?

How would I go about figuring about where the caveman is and if it is possible to know where the caveman is?
>>
>>57495019
activex is no longer supported by any current internet explorer.
so unless you go find some old windows machine to run your things on you aren't going anywhere with that.
>>
>>57495215
Ok thanks, any ideas how i would get around this? or anything that i should read up on to try and fix it
>>
>>57495188
Are these all separate problems? Or do I have to carry the first answer to the second premise ANDing the answer to the next premise as I move along the list?
>>
>>57495278
They're all separate
>>
>>57486787
> == "true"
gross
>>
>>57495188
// Am I glad that the caveman's the caveman , what I wanna know is where's the caveman?
**caveman; // in here somewhere

// Am I glad that the sherrif's the caveman and that I just remembered he's in there and that we're out here and that I'm the sherrif and that he's in here and that the caveman's the caveman , what I wanna know is where's the caveman?
char** caveman;
int count =0;
char* findCaveman( char* entities, int count)
{
if( *(entities +count++) != "sheriff" )
findCaveman( entities, count );
else
return *( entities +count);
}
caveman = *(findCaveman( *(caveman), count ));
printf("%s", *(*caveman +count));


Going to need to do this over several posts..
>>
>>57495285
Is this your homework or have you done this yourself and are just testing us? I would like to know if I'm correct when I'm done writing these all out instead of just giving you an answer to your master's thesis and staying poor.
>>
>>57478870
What is a good site to learn the basics of algorithmics and more?
>>
>>57495349
char* entitiesList = entitiesEntries();
int count =0;
char* findCaveman( char* entities, int count)
{
if( *(entities +count++) != "sheriff" )
findCaveman( entities, count );
else
return *( entities +count);
}
char** caveman;
caveman =*(findCaveman( entitiesList, count ));
printf("%s", *(*caveman +count));



correction!
>>
>>57495379
I generated these sentences randomly as part of my Backus-Naur recursion homework. I'm just curious this unrelated problem.
>>57495349
interdasting
>>
>>57495446
>Am I glad that we're in here , what I wanna know is where's the caveman?
void findCaveman()
{
char* entitiesList =someList();
char** caveman = *(*list);
int count;
while( *(caveman +count) != "caveman")
{
count++;
continue;
}
printf("%s", *(caveman +count) );
}


>Am I glad that we're out here and that I just remembered I'm the sherrif , what I wanna know is where's the caveman?
char* entitiesList =someList(); 
// sheriff is the first entry in this list
// So is caveman
for( int i=0;; i++)
{
if(*(entitiesList +i) != "caveman")
continue;
else
printf("%s", *(entitiesList +i));

}
>>
Trump would program in cobol for fucks sake, why did people even answer otger things to that question when I already gave the right answer? He definitely fucking would, it fits him perfectly
>>
>>57495504
errr caveman is in this list too, not also the first

>Am I glad that he's in there but I'm frozen out there and that we're frozen over there , what I wanna know is where's the caveman?
This one sounds like it's asking for simple output from each point.
So output from within the function the caveman's location, and output from the char** the entry that is me, and then output the whole list from out of the entitiesList.


I'm getting tired. I'm going to sleep.
>>
>>57495349
oops char** caveman;

lol
>>
>>57495188
https://www.youtube.com/watch?v=6JaY3vtb760
nice meme
>>
<code>
#include<stdio.h>

int main(int argc, char* argv[]) {
int i;
printf("argc: %d\n", argc);
for(i=0; i < argc; i++) {
printf("argv[%d]: %s\n", i, argv[i]);
}
return 0;
}
</code>

im teaching myself on commandlines for c.i think i get it now argc is the counter argv is the value.the first value of argv is mostly the programname itself, then the "real" arguments follow.im i right /g/? btw my english is goddamn bad i know
>>
>>57495188
Just use the quantum IO monad
>>
>>57495629


argc is how many elements you can expect in the list that is represented by argv

I dn't know what you mean by mostly the programme itself nor what you mean by "real" arguments.

Okay, really going to sleep now.
>>
>>57495718

>I dn't know what you mean by mostly the programme itself nor what you mean by "real" arguments.

i mean here>>

argv[0]

is the programname itself example crack.exe
then the "real arguments" follow after crack.exe example
argv[1]: Command
argv[2]: line

my english is still shit good night btw
>>
>>57480929

hey bb, come to the irc channel and i'll whisper sweet nothings about how GNU/Linux respects the users freedom
>>
Is it ok to store an empty array as null?
>>
>>57489918

It's a mango called SE
>>
>>57490037

What's so shit about it?
>>
>>57495796
yes
>>
>>57490037
System.out.printf("Are you mentally challenged?\n");
>>
>>57490037
System.out.printf?
>>
Am I imagining it, or have /dpt/'s become really slow lately?

Not so long ago we could burn through 2, sometimes even 3, threads in a day and it wasn't always shitposting.

Now these threads can last a whole day sometimes. Or is it because people seem to be creating multiple /dpt/'s simultaneously, so one thread naturally ends up being long-lived?
>>
>>57495893
wasn't there a discord channel? maybe some people shifted there
>>
Do you guys keep your debug code around after verifying that it works?

>>57495893
Most probably left since mook is ruining the site
>>
>>57495825

Yeh was juust about to say this too, you can simply append \n to all strings.

Why do autists get so ass blasted about fucking basic programming functions?
>>
>>57495905
>discord
/g/ would never give their ip up so easily
>>
Anyone know of a good C++ programming book with exercises that helps you make use of features like pointers and templates?
>>
>>57495893
maybe it's because of that secret, invite only, /dpt/ discord server.
>>
Is qt the only c++ framework that let's me deploy to x11, windows, android and ios?
>>
>>57495909
If its something I learned to do for the first time, I put it in my notes
>>
>>57487156
C, C++ both have goto.
>>
>>57492715
The go with C++.
>>
>>57481030
retarded
>>
>>57496272
Is this a confirmed post?
>>
>>57496296
Yes. It is.
>>
>>57496296
I've just got the data back from the lab analysis, and I can confirm that it is a post.
>>
Anyone doing neuro-evolution in here? I often see some simulations adding delays between connections (whether they're between neurons or after outputs, i don't know), what benefit is this supposed to have?
>>
File: file.png (567KB, 1024x390px) Image search: [Google]
file.png
567KB, 1024x390px
Just finished setting up VSCode + color themes to only end up not feeling like coding.
>>
What is some /dpt/ required reading?
>>
>>57496452
None. Just make some stuff, use books as references.
>>
>>57496460
I currently have no stuff to be making.
>>
>>57494945
So is there? Anything good for beginners would be fine.
>>
>>57495982
bump
>>
i've been doing nothing but work on mathematical problems all day long for a month now.
i wanna go back to programming :(
>>
I found Synergy (a crossplatform program to use a single mouse&keyboard set for multiple computers) recently and loved it enough to not pay for it and to see how I could use the pro version for free without needing to compile it on Windows.
The license key is a string of hex characters that decode to a JSON string so it was easy to do.

There is another program I wrote for the future of Synergy but it's too early to release.

Synergy builds:
https://symless.com/nightly
syngen.cpp:
http://pastebin.com/KNbgrU5a
>>
>>57496620
solving mathematical problems is programming
>>
>>57496797
But you don't need math to program.
>>
>>57496811
>
>>
>accidentally type a comma instead of a semicolon in C++
>code still compiles and works

f(), g();


Is apparently valid.
>>
>>57496839
Are you dumb enough to not know what , does?
>>
>>57478870

So I'm working on a game engine and so far I've learned so much about software.

I have a problem that my game engine is made of entities which are compositions of components. The entities themselves are stored as arrays and there are three main arrays; mob/projectile/decoration.

The problem is that my physics engine would be simplest if it had a pointer to a single list of entities - I don't want the overhead of passing in three separate lists.

But if I make all entities simply be in one giant global list them I'll have bad performance because entities - especially projectiles are constantly being added and removed.

Should I create one global entity list and hope that it can be performant enough to handle thousands of updates per second or is there some other solution?
>>
from urllib.parse import urlparse
import urllib.request
import json
import os
import sys
import argparse


def process_link(url):
link_component = urlparse(url)
if link_component.netloc != "boards.4chan.org":
print("Not a valid link!")
return

list_params = link_component.path.split("/")
url = "https://a.4cdn.org/%s/thread/%s.json" % (list_params[1], list_params[3])

board = list_params[1]
return [url, board]


def retrieve_json(url):
response = urllib.request.urlopen(url)
response = response.read().decode('utf-8')
data = json.loads(response)
return data

def find_image_id(json_data, image_width, image_height):
thread_pics = {}
for json, json_list in json_data.items():
for posts in json_list:
if "tim" in posts:
if image_width == 0:
thread_pics[posts["tim"]] = posts["ext"]
elif image_width == posts["w"] and image_height == posts["h"]:
thread_pics[posts["tim"]] = posts["ext"]


return(thread_pics)

def create_image_link(board, pictures_dict):
image_urls = []
for picture_id, extension in pictures_dict.items():
url = "http://i.4cdn.org/%s/%s%s" % (board, picture_id, extension)
image_urls.append(url)
return(image_urls)

def download_image(link_dict):
for image in link_dict:
urllib.request.urlretrieve(image, (target_folder + "/" + image[20:]))


def image_downloader(target):
target_link = process_link(target)[0]
json_data = retrieve_json(target_link)
dict_img_ids = find_image_id(json_data, image_width, image_height)
list_img_urls = create_image_link(process_link(target)[1], dict_img_ids)
download_image(list_img_urls)


user_input = sys.argv[1]
print(user_input)

target_folder = sys.argv[2]
print(target_folder)
os.chdir(target_folder)

image_width = 0
image_height = 0
if len(sys.argv) == 4:
input_resolution = sys.argv[3]
image_width, image_height = input_resolution.split('x')
image_width = int(image_width)
image_height = int(image_height)

image_downloader(user_input)
>>
>>57496922
image downloader, added on filter by resolution
please r8 or feedback :^)
>>
>>57496333
I'm actually working on creating a neural network (with a genetic algorithm) that learns how to play games (games like Mario, Snake, etc). I don't know the answer to your question though.
>>
sorry for the noobiness

anyone know what might be wrong with this code? Doesnt seem to add the node to the linkedlist

void LinkedList::instertNode(ListNode* n){
if (head == NULL) {
head = n;
lenght++;
}
else {
ListNode* currentnode = head;

while(currentnode != NULL) {
if (currentnode->getNext() == NULL){
currentnode->setNext(n);
lenght++;
}

currentnode = currentnode->getNext();
}
}
}
>>
>>57489918
http://mangafox.me/manga/se/
>>
>>57496896
Are you sure that this is going to be a bottleneck? I'd say just do the simplest thing that works, and then speed it up later if need be. Premature optimization and all that jazz.
>>
>>57493427
Aseprite dev changed the the license from GPL to proprietary license that doesn't allow redistribution because he didn't like that the software was packaged in some distributions while he's selling the binaries on his website and he said he suddenly disagrees with the idea of open source software.

Of course he didn't mind the open source idea when he got a lot of contributors who helped without monetary compensation thinking it's open source software. When the last GPL licensed version got forked, he went into a raging fit saying tons of wonderful stuff like, he did it to make it easier for users to make bug reports, that FOSS software contributes to global warming, and that saying you want the open source fork to succeed is equivalent of saying you want him to die.

I thought he was a pretty reasonable dude before but he sounds like he's off his rocker there. I mean, I dislike the GPL for forcing derivatives into GPL but he didn't do it for that, he changed to a license that specifically forbids redistribution, so if you give a copy to a friend you're breaching the license.

Anyways, if you're into nerd drama here's a link
https://github.com/aseprite-gpl/aseprite/issues/1

the fork is also looking for devs so if you're a C++ dev looking for an open source project, aseprite is an awesome program.
>>
Learning godot
>>
>>57478870
How do I derive the error approximation from any numerical integration (simpsons / trapez) ?
I taylor the function, then integrate it and then subtract the numerically integrated area from simpson/trapez.
But it doesn't work out like it's supposed to
>>
r8 my shell script
#!/bin/bash

print_help() {
echo "Usage: build.sh [output]"
echo " commands:"
echo " b - build"
echo " e - build and run"
echo " h - print this help message"
echo " q - quit"
echo " r - rebuild"
};

build() {
cmake . && make -j 2
};

rebuild() {
cmake . && make -B -j 2
};

run() {
./$1
};

output=$1

if [ "$output" == "" ]
then
output="bin"
fi

while :; do
read -p ">" -n1 input
echo
case $input in
[bB])
build
;;
[eE])
build && run $output
;;
[hH])
print_help
;;
[qQ])
echo
exit
;;
[rR])
rebuild
;;
*)
echo "unknown command, press h for help"
;;
esac
done


pls no bully
>>
>>57497440
what does it do? u do know how to comment ur code right?
>>
File: 1460054618055.png (128KB, 345x345px) Image search: [Google]
1460054618055.png
128KB, 345x345px
>mfw someone implements a utf8 infix operator as a core part of their API in swift
Honestly, I feel this should be a crime punishable by gnu/linux.
>>
File: Cu_mjs9WEAQZCYv.jpg (55KB, 899x1024px) Image search: [Google]
Cu_mjs9WEAQZCYv.jpg
55KB, 899x1024px
>>57497595
>he codes for applefags
android or kys
>>
>>57497595
pretty common in haskell
>>
>>57497580
it compile and run what's in the directory, I can build/rebuild/build and run
and it's a loop too so I don't have to press Up arrow and Enter in my terminal, just "e"
>>
File: 1474476406074.png (205KB, 785x757px) Image search: [Google]
1474476406074.png
205KB, 785x757px
>>57497609
>kys
>>
>>57493199
map function list

or alternatively
function `map` list
>>
>>57493199
it depends
if it's just that then
function <$> list
>>
who is the smartest person on /dpt/?
Any notable anons or even tripfaggots?
>>
>>57493199
infix
>>
What is client code? Is it the same as a user, or is it code that other programs/classes might refer to?
>>
>>57498120
i am
>>
>>57498120
You are
>>
I'm a C-monkey, and I was recently volunteered to write some desktop GUI program for someone.
Since I'd rather not do GUI shit in C, I figured I'd use C++ and stick with using the parts that I know.
That said, does C++ have decent GUI libraries?

I've heard of ones like QT or WX Widgets, but I don't know which is better or easier to use.
On a side note, is Boost good or is it a meme?
>>
>>57498194
>Since I'd rather not do GUI shit in C
casual
>>
>>57498194
Qt is okay (and good for cross-platform)
I haven't used wx
Boost is also okay but you probably don't need it
>>
>>57498194
i'm sure boost isnt a complete meme and that it has useful packages but definitely weigh the downsides:
boost typically uses a lot of template code in headers,which can slow down conpilation. also relying on boost drags in a huge dependency for anyone trying to maintain your code or just compile it from source. if none of that is an issue to you, and you find boost legitimately helpful to your project (and couldnt be done yourself in just a few lines of code) then dont listen to /g/ and go for it
>>
File: tup.png (7KB, 331x59px) Image search: [Google]
tup.png
7KB, 331x59px
>>57497440
use masterrace tup
>>
why havn't bjarne just thrown the majority of boost libraries into the standard library and called it a day yet?
>>
>>57498438
because there's something called "standard"
>>
>>57498453
sure you'd have to avoid the libs that are ass, but take filesystem, format string support or endianess for example
shit like this should have been there from the very start
>>
>>57498438
Because then people would question what purpose the committe actually services
>>
>>57498474
filesystem will be added to c++17
>>
problem: you have 3 cannibals and 3 missionaries on one side of the river, and they need to get to the other side. if you ever have more cannibals than missionaries on a bank, they get eaten. their boat can only carry at most 2 people
?- run.
[c,c,c,m,m,m][]
[c,m,m,m][c,c]
[c,m][c,c,m,m]
[][c,c,c,m,m,m]
true .

so simple
>>
>>57498264
Can it be used for cross-compilation?
>>
>>57498557
I don't think you can do it. You will always end up with a missionary eaten.
>>
>>57498557
Anyone knows what's just outside the edges of the framebuffer on youtube?

I'm not making that much sense of it just looking at it and would like to grow some intuition for video

>>57498438
Well boost is dumb. Then again so is the standard.
Why do you care if using either makes you a bad programmer?
Ah.
>>
>>57495810
in C you could just %.2f while in java you have to do all that decimalformat shit
>>
>>57490037
It's not a formatted print.
I don't know much java but that's the issue.
If I recall you can put numbers into special number formatters and have them output the format you've set as a string. Lots of standard libaries do that.

I'd say it's better for reusing across a larger codebase than printf. Printf is more useful immediately.
>>
>>57490037
>>57498745
Oh and a quick search revealed that system.out.format is made to mimic printf.
So you probably want that.
>>
Does anyone know how to install Python packages on an air-gapped VM (with no access to the internet?)

I have tried downloading the tar.gzs and whl files, but every time I try pip install *.whl, it tries to connect to the internet to download the package or whatever??
>>
>>57498666
Nevermind. I solved it.
[c,c,c,m,m,m] []
[c,m,m,m] [c,c]
[c,c,m,m,m] [c]
[m,m,m] [c,c,c]
[c,m,m,m] [c,c]
[c,m] [c,c,m,m]
[c,c,m,m] [c,m]
[c,c] [c,m,m,m]
[c,c,c] [m,m,m]
[c] [c,c,m,m,m]
[c,c] [c,m,m,m]
[] [c,c,c,m,m,m]
>>
void reverse(char to[], char from[])
{
int i, y, k;

i = 0;
k = 0; //k = beginning of the line

for (i = 0; from[i] != '\0'; ++i) {
if (from[i] == '\n') {
for (y = i - 1; y >= k; --y)
to[(i - 1) - y + k] = from[y];
k = i + 1;
}
}
}


This is supposed to reverse the string char from[] line by line into char to[] without changing the order of the lines, but it only does the first line.
Pls help and no bully pls.
>>
>>57498948
what? Are you retarded?
>>
>>57493140
>>57480929
I have pretty crippling autism and programming is one of the few things I am really good at

It's not really the way you think necessarily, it's just the massive amount of time needed I am willing to put in and how you can make mistakes and fix them right away. I am abysmal at math because I make simple arithmetic errors and have poor fine motor control but I can type at around 90 wpm and when you make an error it is obvious. And I have the focus to debug for several hours at a time
>>
>>57499236
Yes. What specifically do you mean now?
>>
>>57499274
You can do it in 4 trips, anon >>57498557 did it
>>
>>57498631
if and only if you know the commands that can cross-compile your project. Tup doesn't bother to know how to use your compiler for you, it just runs commands in order and FAST.
>>
>>57499294
Anons solution doesn't take into account that someone needs to take the boat back to across the river.
>>
>>57499327
>not using a remote controlled boat
>>
>>57499357
>not using a bigger boat
>>
>>57499381
>not hanging the cannibals
>>
>>57499398
>not just letting the cannibals eat the missionaries
>>
Can you link me to a good tutorial to learn Matlab?
>>
>>57499160
- to[i] = '\n'[/code] missing.
-
(i - 1) - y + k
superfluous brackets
- maybe just do
for (j = 0; j < i - k; ++j)
instead of going down from i - 1, especially if you're going to try to do the index mapping in reverse with
i - 1 - y + k
which is probably where your problem resides. I could fix that rn but that's only due to the fact that I am autistic so it should probably be scraped.

U welkom
>>
>>57499327
i got it working btw
>>
NEW THREAD

>>57499525

>>57499525
>>
File: ran great.png (627KB, 800x800px) Image search: [Google]
ran great.png
627KB, 800x800px
>>57499536
it works thank
>>
>dont know whether boost::asio is badly designed or im just an idiot
its probably both, but god damn
>>
>make piece of software with good design
>know it will be raped to pieces by the guys im working with
i kind of dont want to check it in, it feels like sending your kid off to war
>>
>>57500349
You can always save a pure copy. That's not so easy with kids.
Thread posts: 336
Thread images: 43


[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.