[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: 333
Thread images: 45

File: smug filtered champagne.png (254KB, 480x456px) Image search: [Google]
smug filtered champagne.png
254KB, 480x456px
Old thread: >>57639051

What are you working on, /g/?
>>
We should get rid of for-loops, they're not practical, they're too abstract.
>>
Recursion is academic nonsense, all you need is a while-loop.
>>
>>57642589
Agreed, anything more abstract than conditional jumps belong in the bin.
>>
https://learnpythonthehardway.org/book/nopython3.html

Holy shit is Zed Shaw retarded?
>>
>>57642606
Anybody who writes subroutines should be fired.
>>
>>57642612
Yes
>>
>>57642618
Anyone who uses type systems should get the gas.
>>
Pygame
>>
Are there any games that teach coding? I'm interested in something like python or C++

I have a full time job as a DBA so I don't want a tutorial, more something relaxing that will also teach me new skills
>>
>>57642636
>>>/out/
>>
CS50 problem set 1, I just finished mario and was wondering if there is a way to complete this application by not using 23 if statements?
>>
>>57642567

Just wrote a simple LUA addon for Elder Scrolls Online. Should be publishing it on the ESOUI website soon.
>>
>>57642632
If you want a zero and your target arch doesn't have a zero register then you better fucking xor a register with itself.
>>
>>57642612
Would you care to expand on this thought?
>>
>>57642657
How much are you charging?
>>
>>57642655
What is cs50 problem set 1? LIke what is the question? Link me to it
>>
File: basedAlex1.jpg (381KB, 2417x1973px) Image search: [Google]
basedAlex1.jpg
381KB, 2417x1973px
>>57642567
>filtered champagne

that fucking file name
>>
>>57642641
SHENZHEN I/O or TIS-100, although you'll learn assembly rather than a high-level language.
>>
>>57642663
Just read the shit where he says Python 3 isn't Turing complete.
>>
>>57642679
http://docs.cs50.net/problems/mario/less/mario.html

there is no source code...
>>
>Dynamic typing is [..] one of the reasons I advocate it for beginners.
The future, ladies and gentlemen.
>>
>>57642668

I did it for myself because there aren't many UI addons out there, and there was certain information I wanted that was only available through the API and not through the stock UI.
>>
>>57642567
>no anime image
dropped
>>
File: le alex jones awoo.jpg (284KB, 862x544px) Image search: [Google]
le alex jones awoo.jpg
284KB, 862x544px
>>57642717
>alex jones
>not anime
>>
>>57642589
>for(int i=0;i<n; *entire code in here*)
>{ continue; }
it wurks
>>
>>57642837
get on my level
(do ((i 0 (1+ i))
(sum 0 (+ sum i)))
((= i n) sum)))
>>
>>57642689
>Currently you cannot run Python 2 inside the Python 3 virtual machine. Since I cannot, that means Python 3 is not Turing Complete
holy fuck i didn't realize how dumb this retard is. he's talking about how everything is "simple math" but he can't grasp any of the shit he refers to.
the best part is he tries to pass it off as a joke in the "Note" section, but he still sounds extremely autistic and tries to defend his claim, while also trying to back it up by repeating exactly what he said above
>>57642589
exactly. we should start using more concrete loops, such as map and fold
>>
>>57642984
why would you use map or fold when you can do it all in a foreach loop
>>
>Haskell still doesn't have full dependent types
trash.jpg
>>
File: TRUMP.jpg (294KB, 1066x750px) Image search: [Google]
TRUMP.jpg
294KB, 1066x750px
>>57642768
>implying Alex Jones isn't better than anime
It's nice to see some people on this board growing a pair
>>
File: 1.jpg (23KB, 310x324px) Image search: [Google]
1.jpg
23KB, 310x324px
>>57642655
>>57642697
Alright I solved it anon, its not the cleanest solution, but it beats the multiple if statements that you probably used.

import java.util.Scanner;
public class Mario {

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);
System.out.println("Enter height");
int height = scanner.nextInt();
int counter = 2;
while(height-->0){

//checking if this is the first loop, then we know it starts with 2 ##
if(counter == 2){
for(int x = counter; x > 0; x--){
System.out.print("#");
}
}

//this gets called everytime after the first loop
else{
for(int j = counter; j > 0; j--){
System.out.print("#");
}
}
counter++;
System.out.println();

}

}
}
>>
File: Capture.png (234KB, 1896x750px) Image search: [Google]
Capture.png
234KB, 1896x750px
thank god for apis haha
>>
>>57642837
>{ continue; }
You don't need this, just say {} or ;
for (...;...;..); is quite a frequent pattern. Haven't you read K&R?
>>
File: 1479878211252.jpg (198KB, 900x850px) Image search: [Google]
1479878211252.jpg
198KB, 900x850px
>>
File: 1479878211252.png (13KB, 410x211px) Image search: [Google]
1479878211252.png
13KB, 410x211px
>>
File: 1473937976518.jpg (68KB, 668x712px) Image search: [Google]
1473937976518.jpg
68KB, 668x712px
>>57642697
where the fk is my thanks. IM FKIN WAITING
>>
File: diversity in tech.jpg (299KB, 1400x814px) Image search: [Google]
diversity in tech.jpg
299KB, 1400x814px
>>
>>57643268
thank you anon
>>
File: 1479878324331.jpg (226KB, 869x1776px) Image search: [Google]
1479878324331.jpg
226KB, 869x1776px
>>
File: trump you have to get out.png (79KB, 349x334px) Image search: [Google]
trump you have to get out.png
79KB, 349x334px
>>57643256
>xkcd
>>
File: 1462076355765.jpg (333KB, 1500x1796px) Image search: [Google]
1462076355765.jpg
333KB, 1500x1796px
>>57643278
np
>>
>>57643284
The code for the fast inverse sqrt is ugly and redundant.
float Q_rsqrt(float x)
{
float y = x;
long i = 0x5f3759df - (*(long *) &y >> 1);
y = *(float *) &i;
y *= 1.5F - x * y * y * 0.5F;
return y;
}
>>
>>57642686
Thx anon
>>
File: 1475017558774.jpg (37KB, 500x375px) Image search: [Google]
1475017558774.jpg
37KB, 500x375px
>>57642567
>no anime picture
>on anime forum
why?
>>
File: nani128.jpg (46KB, 600x600px) Image search: [Google]
nani128.jpg
46KB, 600x600px
I want to play with sound programming in C.
How do I generate a PCM sine wave if I intend to pipe stdout to my soundcard?
>>
>>57643552
see >>57642768

https://www.youtube.com/watch?v=LhqUk28OwHs
https://www.youtube.com/watch?v=8Sr3BAu-zLk
https://www.youtube.com/watch?v=xihzgEsV2nw
https://www.youtube.com/watch?v=BI0gwjg0h2E
>>
File: 1479192011783.jpg (86KB, 480x360px) Image search: [Google]
1479192011783.jpg
86KB, 480x360px
>>57643716
OK
>>
does anyone here use jetbrain's rider? why?
>>
File: 1124235455445.jpg (19KB, 385x291px) Image search: [Google]
1124235455445.jpg
19KB, 385x291px
>>57642632
laughing gas?
>>
>>57643256
kys
>>
>>57643800

Nothing beats VS for C#.
>>
>>57643157
>java
it asked for C but whatever

Here's my solution
#include <stdio.h>

#include "mario.h"

const char BLOCK = '#';
const char SPACE = ' ';
int main(){
int input;
printf("Enter height:");
scanf("%d", &input);
printHalfPyramid(input);;
return 0;
}

void printHalfPyramid(int height){

int spaces;
int blocks;

for(int step = 1; step <= height; step++){
spaces = height - step;

int spaceLoop = 0;
while(spaceLoop != spaces){
printf("%c", SPACE);
spaceLoop++;
}

blocks = height - spaces + 1;
int blockLoop = 0;
while(blockLoop != blocks){
printf("%c", BLOCK);
blockLoop++;
}
printf("\n");
}
}
>>
File: 1452928617945.jpg (22KB, 225x225px) Image search: [Google]
1452928617945.jpg
22KB, 225x225px
>>57643820
cool looks neat, i didnt really line up my mario hill. I think there is a printf for writing from right to left in java.Too lazy to look it up
>>
File: 1470357344781.gif (3MB, 697x458px) Image search: [Google]
1470357344781.gif
3MB, 697x458px
>>57643911
What do you mean you didn't line up the hill? I thought that was the point of the exercise?

Not trying to be an ass if I sound like it (^:
>>
>>57643030
why would you use a for loop when you can just use >>= ?
>>
Why would you code when you can kode?
>>
I'm working on Conway's Life in Python and I have a small issue:

I know that it's just something wrong with my 'rules', since it seems to work relatively fine, and is a fully functioning cellular automata, but I'm familiar enough with Conway's Life to know that the rules aren't right, because the normal structures aren't showing up from a randomly generated array.

This is the my calculation function:

def calcStep():
global listNew
i = 0

while i < 100 :
z = 0
while z < 100 :

if( listFull[i-1][z-1] + listFull[i-1][z ] + listFull[i-1][z+1]
+ listFull[i ][z-1] + listFull[i ][z+1]
+ listFull[i+1][z-1] + listFull[i+1][z ] + listFull[i+1][z+1]) == 2 and listFull[i][z] == 1:

listNew[i][z] = 1

elif( listFull[i-1][z-1] + listFull[i-1][z ] + listFull[i-1][z+1]
+ listFull[i ][z-1] + listFull[i ][z+1]
+ listFull[i+1][z-1] + listFull[i+1][z ] + listFull[i+1][z+1]) == 3 and listFull[i][z] == 1:

listNew[i][z] = 1

elif( listFull[i-1][z-1] + listFull[i-1][z ] + listFull[i-1][z+1]
+ listFull[i ][z-1] + listFull[i ][z+1]
+ listFull[i+1][z-1] + listFull[i+1][z ] + listFull[i+1][z+1]) == 3 and listFull[i][z] == 0:

listNew[i][z] = 1

else:
listNew[i][z]= 0

z += 1
i += 1



essentially I'm just looking at every cell around my target cell ([i][z]) and figuring out if it lives, dies, or is born.

The behavior I'm getting is not Conway. It is interesting in it's own way, but not what I want.
>>
>>57644268
spotted the pajeet
>>
>>57644314

Yes I am Pajeet as fuck, but I just started programming. Any help?
>>
>>57643942
really? I thought it just about creating the right number of "#" per line. But i guess u can line it up using space = " ";
>>
>>57642567
How do I define a new type of neural activation function in Tensorflow?
>>
File: awoo eats cheetos.png (1MB, 960x1280px) Image search: [Google]
awoo eats cheetos.png
1MB, 960x1280px
Rate my sine wave generator~
It outputs 8-bit unsigned 8kHz mono pcm to your soundcard.
#define BITRATE 8000
#define AMPLITUDE 50

void sine(float freq, float sec)
{
float samplesPerCycle = (float) BITRATE / freq;
unsigned totalSamples = BITRATE * sec;
unsigned i;
for (i = 0; i < totalSamples; i++)
{
float sample = sin((i / samplesPerCycle) * (2 * M_PI)) * AMPLITUDE;
putchar((unsigned char) sample);
}
}
>>
>>57644794
>float
Stopped reading at that point
>>
>>57642657
>LUA
It's Lua or lua, no that hard
>>
Does someone have any homework or is stuck somewhere? i'm bored.
>>
>>57644852
Could you teach me how to make a square or sawtooth wave function?
>>
>>57644870
I don't know that kind of stuff. I was hoping more of algorithmic programming questions they ask in CS classes.
>>
>>57644880
So basically what you're saying is you don't know shit about math?
What are you even learning in your CS coursework?
>>
>>57644832
how else would you do it

a lookup table would be shit because it could be any frequency
>>
>>57642612
I have seen bigger bullshit from this macfag, but anyway good catch.
>>
>>57644908
CS courses just teach you algorithms now, which is why every CS grad will talk endlessly about sorting binary trees but can't do a clean fizzbuzz
>>
>>57644870
square wave is just "on/off"

sawtooth increases linearly and then drops down instantly, could use ++i in an unsigned char (unsigned integers have modulo "built in") for the simplest sawtooth wave
>>
>>57644908
They teach us discrete maths. They have a few courses on discrete signal processing but fuck if I care.
>>
>>57644870 >>57644908
>square or sawtooth wave function
>math
>>
>>57644933
Are you saying the CS courses should teach fizzbuzz instead?
>>
>>57644993

what's with the expectation being put upon the college?

the individual should be able to learn the shit they need.
>>
>>57642589
I agree. They're also redundant with while loops and goto's.
We should really only have goto's for loops.

We can't listen to an old computer scientist who hasn't been relevant in years on a topic that is as performance sensitive as flow control.
His argument weren't that good anyway.
>>
>>57644880
>algorithmic programming questions
Not sure what you're asking for but to be completely honest it sounds like computer science and not programming.
So GET OUT.
>>
File: heh43.png (204KB, 534x366px) Image search: [Google]
heh43.png
204KB, 534x366px
>>57645039
>pay $25,000 a year to self-teach

keep it up debt slave
>>
File: ilpo.jpg (106KB, 584x800px) Image search: [Google]
ilpo.jpg
106KB, 584x800px
>tfw when you realize javascript isn't even that bad

the problem is webdevs themselves, who are just bottom of the barrel in terms of intelligence. if the web ran on Lisp or C instead, they'd still be loading MBs worth of C/Lisp code to display some simple text, just like they do with javascript today
>>
>>57645059
This. It's ludicrous. I quit college early because of this. Just a complete waste of money. Ran ahead of my class by two years in 1 year. Probably learned more relevant information than they did.
Looking at the projects they did they haven't come far. It's surprising.
>>
How do I get a programming job?
>>
>>57645186
Look for junior positions
>>
>>57645059

??? i don't even have a CS degree. i've self-taught myself everything from statistics to multivar calc.

my degree is in a comfy field with a comfy job. my comment was a general response.
>>
>>57645198
But those require a CS degree and 5+ years paid experience only.
>the requirements are NOT OPTIONAL do not apply if you are missing requirements you will be blacklisted
>>
>>57645229
It rarely says that.
Very rarely.
And honestly it looks like trolling.
>>
>>57645051
Nah I'm good thanks
>>
>>57645229
I used to think so too but I just landed a job and I haven't even finished my BS. But it is a very "developers first" kind of place, so once someone at the actual company got to look at my example code rather than the recruiter they had no doubts about my ability.
>>
>>57645263
What was the example code? Something they had you code for the application or just something from your github?
>>
>>57645300
I have a Github where about half of it is stuff I've done in school and cleaned up a bit and the rest is random stuff, and then they sent me a test where I had to write a couple of small programs.
>>
>>57645307
was this in person, or via email?
>>
How do i into programing. I have no idea where to start.
>>
>>57645371
They sent the test via e-mail. I was expecting some fizzbuzz or quicksort bullshit because that's what everyone says they get to do for interviews but these were more "real" programs. I guess if they're gonna let you do the test on your own time asking for something as googleable as a sorting algorithm would be fucking retarded though.
>>
Im thinking of picking python for my first language , I've heard that is really beginner friendly and easy to learn . I don't really have plans of becoming a programmer or anything like that just think its fun , cool to know how to , you know ? Anyway I wanted to ask how good of a language python is, what is the most I can accomplish with if I'm really good, what are good examples of stuff done with python and what can I use it for in a day to day life ?
>>
>>57645229
if they say you'll get blacklisted maybe stay away but otherwise the "requirements" are really just a wishlist and they could have a really hard time finding the right guy for the right salary, you don't need to match the requirements 100% or even at all if they're desperate enough and/or you prove yourself worthy of the position
>>
>>57645411
You can do just about anything in Python. There are libraries for most things. I'd say the big pro of writing Python is how easy it is to just throw something together with really few lines of code and have it just work, but it comes at the cost of running slower than many other languages (which honestly is going to be irrelevant for the majority of programs) and it has some really weird quirks in my opinion, though if you've never used another language you're unlikely to care.

I think if you're just going to do programming as a small time thing you'll get away with learning just Python, but I would recommend learning another language like C as well.
>>
    ldx #10
: <do some shit>
dex
bne :-


The only loop I need
>>
>>57642702
Dynamic Typing can be useful for beginners, that's all though. It shouldn't be used by people being paid to program.
>>
>>57645446
I was think between that and C ++ since I am teaching myself gamedev and unreal engine, but with the option to use blueprints there I never really felt the need to start. I will probably need it later for more complex stuff. I know that a lot of people are picking C# , but I dont like unity so learning both C# and/or C++ seems a bit too much . I figure that python is good place to get start and get generally introduced to programming.
How hard/difficult is to learn C++ compared to python ?
>>
>>57645411
Python is good. This is coming from a Java developer
>>
>>57645584
If there's anyone who needs static typing its newbies. As they're more prone to basic errors. Anyone can have them obviously. Which is why dynamic typing is bad but beginners especially need static typechecking.

Sure it can be done in dynamically typed languages fairly well but assuming it's not just for newbies the loosely typed language will probably not satisfy those who like that shit.
>>
>>57645229
If Trump can be president, you can get a job by just trying regardless
>>
>>57645637
C++ in all its 'glory' is very hard and unfriendly. Some subsets are easy.
Compared to Python it would annoy you.
>>
File: 1479894546050.png (38KB, 1106x287px) Image search: [Google]
1479894546050.png
38KB, 1106x287px
Well?
>>
>>57642686
Btw, TIS-100 is on Humble Bundle now.

Another, a bit simpler game, that teaches assembly programming is Human Resource Machine.

Hack 'n' Slash i guess could also be said to teach control structures in programming. Probably not what anon is looking for, though.
>>
>>57645692
>computer scientists
kek
>>
>>57645692
Not sure why computer scientists would have a say. It's more of a political issue. Ask a women's study person. They need something to do.
>>
>>57645692
The problem is how to ensure the people auditing it stay objective. I mean it's obvious the big guys at Google and Facebook, etc. want Clinton, so are you gonna ask their employees to audit it? I doubt you can find anyone inside or outside America who will be completely objective and/or wont be influenced while working on it.

I agree that electronic voting is bullshit, as do most people knowledgeable about computers, and I don't doubt that """""glitches""""" may have provided an advantage to one of the candidate (could be Trump, could be Clinton) but there's no use talking about it after the fact. The real solution is to not have electronic voting next election.

Funny enough /pol/ wanted the electronic booths gone this election because they thought (((they))) would rig it, and no Hillary supporters cared. It really just seems like salty losers lashing out when you only start caring after losing.
>>
What will happen when a 4chan board goes past INT_MAX?
>>
>>57645788
Someone other than moot gets to claim >>0
Biggest get of them all.
>>
>>57645788
it's like 9223372036854775807 anyway since it runs php
>>
>>57645663
I generally agree, but I think for noobs there's something good about being able to start a program running as soon as possible and not have to figure out cryptic compiler error messages first for noobs. Run time errors tend to be a bit more intuitive than compile time errors in general in very small programs.

But then you could argue learning to code this way only makes it harder to learn how to use static typing properly later. And of course once you're no longer a noob, static typing is always better.
>>
>>57645838
>And of course once you're no longer a noob, static typing is always better.
Why?
This is not "of course" apparent to me.
>>
>>57645838
Sounds like a motivation issue.
Starting programming in C is very easy. You write a .c file which has a basic insertion point (be it OS specific or simply the standards main()). Type in shit.

The concept of assignment needs to be explained anyway. And with that comes explaining types.

In a loosely typed system all you really do is ignore that until you get an error and then you're really in the shitter.

Oh and C is a pretty terrible example of a statically typed language obviously.
>>
>>57645864
makes you more productive. You catch a lot of bugs at compile time instead of run time. Very often they are 10-100 times faster to fix because of this.
>>
>>57645692
>(((CNN)))
she won't challenge the results, she knows she lost, she wouldn't want to risk revealing just how many illegitimate votes there were for her
>>
>>57645864
Catches errors earlier. More compile time optimizations are available. More JIT/interpreter optimizations available.
Your development environment is cleaner because your code just has what you put there.
>>
What are big Javascript projects like? I've never seriously used javascript except when i want to hook up some things to the back end language.
>>
>>57645906
damp and disgusting
>>
>>57645906
>require
ad nauseam
>>
>>57645919
>require
Why this word? Is there a way to import something but not in a mandatory fashion?
>>
>>57643256
>>
>>57646054
lel
>>
>>57646054
I find it funny how even through the bias he doesn't make the person OK at math. Introducing pi when taking the integral of x^2 makes no sense. You'd probably see other similar comic's make the 'women know a lot but not everything and are critiziced for not being experts'-argument.

So I applaud xkcd for that at least.
But really there's plenty of men who get insecure and aggressive when they get outdone or see competition. But generally that hits both women and men. They're just misunderstood. They're asshats not sexist.
>>
File: >readability.png (33KB, 1148x647px) Image search: [Google]
>readability.png
33KB, 1148x647px
Fuck readability
>>
>>57642612
>python 3 is not turing complete
did we need any more evidence zed shaw has no fucking clue what he is talking about?
>>
>>57646270
x^2 with respect to what.
it's not written, but if it was x^2 dpi then lolmaybe
>>
>>57646274
maybe that should be done as a method of the player object so that you're not throwing the same reference into everything?
>>
>>57646274
holy shit, why??

Is that C#?
>>
>>57646315
Has to be in the "update frame" loop as far as I know

>>57646319
JS/HTML5 canvas
>>
>>57646327
What's Player.target?
>>
>>57646338
Player.moveTo just sets the "target_x" and "target_y", movement is done "automatically" each frame with that clusterfuck
>>
>>57646319
Is there even a "===" in C#?
>>
>>57646301
Suppose. We're assuming it's simple obviously.
>>
>>57642567
Exception in thread "main" java.lang.NumberFormatException: For input string: "1479266352417"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)


what did he mean by this?

fuck Java dude
>>
>>57646348
you should have a "point" object. so have it like

Player.target.x player.target.y

would make things neater.
>>
>>57646361
Input is probably too big to fit into an int.
>>
>>57646355
>Is there even a "===" in C#?
You can specify it as an operator I believe. But it'd be silly to assume.
>>
>>57646393
fuck! good point, thanks friendo
>>
>>57646274
now single line it using ternary operators.
>>
>>57646393
>somehow this is not a compile time error/warning.
Why do they do this?
>>
>>57646398
BigInteger
>>
>>57646406
How could they know the value of a variable that is only set at runtime at compile time?
>>
>>57643234
that was part of my shitty joke :^(
>>
File: giphy.gif (4MB, 350x366px) Image search: [Google]
giphy.gif
4MB, 350x366px
i've realised comp sci is not for me and i should drop out and get back to my old webdev job like the code monkey i am
>>
>>57645043
>>57642837
>>57643234
Is there really a difference between for and while loops
>>
>>57646437
Nah, they're compiled to the same JUMP instructions.
>>
>>57646437
No. Aside from syntax they're just jumps in asm/blocks in LLVM's intermediary representations.
>>
>>57646436
What don't you like about comp sci, anon?

Not judging, just wondering if I might feel the same way.
>>
>>57646436
whats so hard ?
>>
>>57646436
Same, I realized I'm so shit at math I'll never do something decent
>>
>>57646411
>BigInteger

lmao nigger, the Long type is more than enough for that size of integer. BigInteger will only take up more memory
>>
Are there cache-aware languages other than assembly?
>>
>>57646450
>>57646456
the math, i've never found math interesting or fun and its much more difficult than i imagined it would be
not to mention in my country we have to study a few weird courses like electronics, physics and mechanics which honestly is boring as shit
i just want to program
>>
>>57646480
Has any language introduced primitive data types for handling "infinite" digits numbers ? Say a program that needs to handle a shitload of decimals like superpi , do you need to write your own system to increment and print out individual digits ?
>>
>>57646508
Is there really that much math and is it really that difficult? It might be different here, but at my local Uni CS majors only take two math subjects in their first year and they don't even cover calculus.
>>
>>57646531
Java has BigInteger. There's loads of shit for high precision floating points out there too. Not sure what's langugae integrated..
>>
>>57646531
Not really.

I use gmplib.org

t. currently trying to shave off a few hundred gigs off my program's memory usage so it can run on my 1TB RAM workstation
>>
>>57646590
What does the program do?
>>
>>57646534
>is it really that difficult?
might be that i'm just stupid, i dont know

over here we take four math courses in our first year, where 3 and 4 cover calculus
after that there's an additional course in "advanced" calculus, as well as a course in linear algebra and some courses in physics (which is just applied math)
>>
>>57642612
>https://learnpythonthehardway.org/book/nopython3.html
Holy fucking shit. How can someone be this retarded and get so much money out of it. That's it mane, I'm going to prove Python3's turing completeness. Give me a minute
>>
>>57646600
Looks for gapped overlaps and other similarities in large genomic datasets.

tl;dr yuge graphs.
>>
>>57646498
C. If you use it right.

There's little point in focusing on it all the time though. Save that for the inner loops. Doing it in assembly might just not turn out as good even if you're really good because iteration time is longer.

Metaprogramming asm could be good. But at that point you're really just making your own language and JAI is already on the way so just wait instead (and email ideas to Jonathan, despite appearances he's friendly in person).
>>
>>57646531
Haskell has Integer
>>
>>57643176
haha wow anon you are le true hacker :^]
>>
Can I get help with this error?
error: could not convert ‘{1, 2, 3, 4, 5}’ from ‘<brace-enclosed initializer list>’ to ‘someclass’
someclass obj = {1, 2, 3, 4, 5};

class someclass{
vector<int> vec;
public:
someclass() : vec(){}
someclass(const vector<int> &i): vec(i){}
};

int main(){
someclass obj = {1, 2, 3, 4, 5}
return 0;
}
>>
>>57646934
try { {1,2,3,4,5} }
>>
>>57646934
Don't think it can implicitly translate to vector before calling the constructor, so it'd have to be
= std::vector({1, 2, 3, 4, 5});
>>
>>57646959
Or add a constructor for std::initializer_list
>>
>>57646647
>JAI
I'll have to add this to my list of hipster languages

thanks
>>
>>57647016
Yeah it's not even out yet and only compiles to C/C++ so far. So it's certainly hipster.
>>
>>57647043
>compiles to C/C++
Which one does it compile to?
C or C++? They aren't the same language, you know.
>>
>>57646498
>cache aware
nice meme
>>
>>57647080
Maybe the compatible subset so it can use both abis for max convenience
>>
>>57647110
>compatible subset
Talk about a fucking minefield. Even in the "Subset" of both languages that appear to be the same, there are all sorts of subtle things that can fuck you over massively.
I don't know why anyone would target something so stupid.

>Maybe
If you don't know the answer, don't post like you do.
>>
>>57647147
:^^^^^^^^^^^^^^^^ )
>>
>>57647080
Either. There's both a Compile to C mode and a compile to C++ mode.
I should have clarified the / meant or perhaps.
Why not assume it's a compatible subset though? The only reason it's done is obviously to gain from compiler optimizations those languages have.
>>
Thinking of learning Ruby/rails. What do you think /g/?
>>
Daily reminder that Gradle is a failure in every way.
>>
>>57647190
>gradle
This is an android thing right? What is it? How does it fail? Vent anon vent!
>>
>>57647188
I think you should consider suicide
>>
>>57647188
have you already told to your parents that you are gay?
>>
>>57647206
yes

ok what do you recommend?
>>
File: CLgm1XqVEAAQRzT.jpg:large.jpg (80KB, 1023x682px) Image search: [Google]
CLgm1XqVEAAQRzT.jpg:large.jpg
80KB, 1023x682px
https://www.reddit.com/r/pics/comments/5egjrc/the_woman_who_helped_code_the_software_that_got/

where are you now, misogynists?
>>
>>57647197
It's a build tool and it's shit! Shit!!!
>>
>>57647197
Gradle Daemon even existing is a travesty.
It's incedibly slow and memory hungry.
>>
>>57647221
Nobody minds cute 60's programming girls.

But why are medals and shit always so late? At that age I wouldn't care. If I built the first warp gate I want my medal in the mail the next day.
>>
>>57647221
>Isis
>>
Will this allow the jvm to BTFO ever other VM?
>>
>>57647221
Somebody should recreate the Apollo Guidance Computer in HDL along with the assembler so we can run the program
>>
>>57647330
http://svtsim.com/moonjs/agc.html

There you go, famalam
>>
>>57647221
She's the exception that proves the rule sadly. Women are largely shit at programming.
>>
>>57647388
Exceptions don't prove rules

-i-its just a saying
with no meaning or merit
>>
>>57647388
>Exception that proves the rule.
I hate misuse of this expression.
>>
I want to use an SFML Vector2i for a key in a map, but it doesn't have a less than operator so I have to write a comparison functor for it but I'm having some trouble.

struct Vector2iFunctor
{
bool operator()(const sf::Vector2i& a, const sf::Vector2i& b)
{
return (a.x < b.x) && (a.y < b.y);
}
};

std::map<sf::Vector2i, sf::Vector2i, Vector2iFunctor> vector_map;


This code is giving me an error saying that it would lose some const-volatile qualifiers in order to call the functor.

Help? I can't see what I'm doing wrong.
>>
>>57647388
most programmers in the 60's were women, anon.
>>
>>57647397
Me too, which is why I didn't misuse it.

The rule is women are shit programmers. The fact that a women doing something impressive in programming is so so rare only proves how correct the rule is.
>>
>>57647414
You forgot your point
>>
>>57647417
this
>>
>>57642681
YOU ARE A SICK MAN ROGER STONE
>>
>>57647408
Just use a quadtree.
>>
>>57647414
Didn't they literally perform the same task as Indians?
>>
>>57647453
No, they weren't taking jobs away from Americans
>>
>>57642612
>Currently you cannot run Python 2 inside the Python 3 virtual machine. Since I cannot, that means Python 3 is not Turing Complete
>Obviously it's theoretically possible to run Python 2 in Python 3

I used to think this cuck was a genuine retard but now I'm actually convinced he's doing this shit on purpose.
>>
File: isis.png (425KB, 738x585px) Image search: [Google]
isis.png
425KB, 738x585px
>>57647453
no, at that time men were considering the hardware related stuffs to be more "manly" than software stuffs. when some software programmers started getting recognized and famous (steve shirley, for example), men took programming back from women.
>>
>>57647533
I have a sad feeling that she's actually a shity progrmmer and by far the least competent on her team
>>
>>57647417
That's not it. Google it.
>>
>>57647546
Google what?
>>
File: isishinobi.png (768KB, 804x805px) Image search: [Google]
isishinobi.png
768KB, 804x805px
>>57647541
full-stack engineer

https://medium.com/the-coffeelicious/you-may-have-seen-my-face-on-bart-8b9561003e0f
https://en.wikipedia.org/wiki/Isis_Anchalee
https://en.wikipedia.org/wiki/I_Look_Like_an_Engineer
>>
>women in programming
It's just the market who wants more programmer to drive down wages. Nothing new.
>>
>>57647564
already debunked
>>
>>57647414
>programmers
You meant computers. The term computer back in the day meant someone who performs repetitive calculations in an algorithmic manner.

Lot of women got hired to do that kind of job. This was way back when mortals like you and your family were in your great grandpas balls.
>>
>>57647408
I fixed it, I was missing a const on the end of the functor,
>>
>>57647559
https://en.m.wikipedia.org/wiki/Exception_that_proves_the_rule
The closest I can get here is if you had said.
"women were good programmers in the 60's" or something that'd imply that they weren't after that. But you didn't say anything like that. What you're doing is the typical misuse.
>>
>>57647585
my dad was born in the 50's, i probably have the double of your age.
>>
>>57647597
Like i already said. The rule is women are shit programmers. Can you read?
>>
>>57647578
Where?
Because the stuff that happens now is exactly the same as it was 20 years ago.
>>
>>57642612
He seems really arrogant but I completely agree with him and hope python 3 leads to pythons death so we can finally move unto something better.


>Since I cannot, that means Python 3 is not Turing Complete and should not be used by anyone.

Of course the autists on /g/ take everything literally
>>
File: 2016-11-23-152616_1191x745_scrot.png (100KB, 1191x745px) Image search: [Google]
2016-11-23-152616_1191x745_scrot.png
100KB, 1191x745px
>>57647608
http://www.aauw.org/files/2013/02/graduating-to-a-pay-gap-the-earnings-of-women-and-men-one-year-after-college-graduation.pdf?_ga=1.7578036.722397424.1379578621

page 29 of the pdf (page 17 of the paper) (pic)
>>
File: JohnvonNeumann-LosAlamos[1].gif (281KB, 490x639px) Image search: [Google]
JohnvonNeumann-LosAlamos[1].gif
281KB, 490x639px
>>57647533
But didn't men literally describe what the program should do, how it should do it, algorithms all of that shit, and then women would translate it into a usable program? The code monkeying was thought to be a complete waste of their time.
>>
>>57647601
Kek. Actually I'm a few hundred years old, but whatever me.


Jokes aside, my father was born in 1946 so fuck off, kid.
>>
>>57642612
he was the first to predict how big companies will use FOSS to build modern slavery.
>>
>>57647668
von neumann is a fraud (computer science/engineering wise)
>>
>>57647687
more details?
>>
>>57647687
yeah ok i trust you even though we are on a chinese anime board
>>
>>57647645
Oh you misunderstand. The point isn't that you pay women less. It's that they make the field more popular and hence give the employers more bargaining power.

So its natural to market to women given they're so underrepresented and they are often attributed many of the traits desirable in programming (through and pragmatic).
Regardless you'd think they would learn from their mistakes by now.
>>
>>57647712
>>57647706

https://en.wikipedia.org/wiki/John_Mauchly
https://en.wikipedia.org/wiki/J._Presper_Eckert

these two were the real geniuses, von neumann stole their fame.

https://en.wikipedia.org/wiki/J._Presper_Eckert#.22Eckert_Architecture.22
>>
>BOYS ARE BETTER AT THING
>GIRLS ARE BETTER AT THING
What are you guys 12?
>>
>>57647731
12$ have been deposited in ur shill account
>>
>>57647736
i never said women were better, just that they were the main power in software development around the sixties,
>>
>>57647731
I don't even know why the "stored program" is attributed to Neumann when the analytical engine stored programs on punched cards. The same exact method they used 100 years later.
>>
>>57647789
>I don't even know why the "stored program" is attributed to Neumann

(((von Neumann)))
>>
>>57647736
>loaded question
>>
File: image_4192_2e-Gaia-Map.jpg (500KB, 3840x2400px) Image search: [Google]
image_4192_2e-Gaia-Map.jpg
500KB, 3840x2400px
>>57644852
I need to write a cosmic-fingerprint lookup program that takes a database of star locations, a subset of star locations in arbitrary reference coordinates containing the star we wish to locate, an index to the second argument of said star we wish to locate, and a tolerance value. The program will return a set of candidate stars.

Pretty stumped on what kind of algorithm I should use.
>>
>>57646437
Other than readability, no.

When looking at a for loop, you have a good chance at knowing exactly when it's going to stop, when is it going to start, how much it's incrementing by, what the condition is, all by reading the first line of a for statement.

While loops don't do the same thing
>>
>>57647928
You just search it.
Probably wise to run a good sorting algorithm like bionic sort first.

Introducing cache misses everywhere as you would with most other structures would be a big mistake as the actual comparison of what I'd assume is just 3 doubles (xyz vector) or another very small set of actual work is not productive.

Try the brute force solution first. Just a linear search.
Compile it to native and it should probably run pretty well.
>>
>>57647976
What's the expected runtime if the database contains on the order of a million stars and my fingerprint has on the order of ten stars. I feel like I will be searching for quite a while if I just search over all subsets of the database of the length of my fingerprint.
>>
>>57647928
Is the Stargate program really this desperate that they've taken to posting on /dpt/ threads? What happened to Samantha Carter?
>>
>>57647973
Well you can Traverse a linked list or similarly linked structure in a for loop and I find that's nicer usually.
While loops are reserved for more complex logic/arithmetic in iteration.

For me anyway.
>>57648034
I'm not sure. It's easy to implement.
Just don't do it in some language like python.

Do some print outs while you iterate (just don't make a printout every step it will kill performance completely, try every 10k steps or so.

Computers are really fast anon. It's hard to appreciate until you test them. That a word processing tool like Excel can take more than a second to open is shocking.
>>
>>57647606
>The rule is women are shit programmers.
True. Also true for men.
>>
File: 1454749861420.png (13KB, 500x399px) Image search: [Google]
1454749861420.png
13KB, 500x399px
>>57647928
If you'd like to optimize for speed, what I'd do is just compute all of possible moves for each star beforehand and just store the index inside the database of star locations. Otherwise, you're going to be doing a lot of calculation on runtime, and that's something you don't want to do if it's a mass scale project like "No Man's Sky." Lot of angry customers complaining about lag when opening up the map.
>>
Post you're fizzbuzz
Language: C
oid fp(int n) {
printf("Fizz\n");
}

void bp(int n) {
printf("Buzz\n");
}

void fbp(int n) {
printf("FizzBuzz\n");
}

void np(int n) {
printf("%d\n", n);
}

void fizz_buzz() {
void (*ftable[])() = {fbp, np, np, fp, np, bp, fp, np, np, fp, bp, np, fp, np, np};
int i;
for (i = 1; i <= 100; i++) {
ftable[i%15](i);
}
}
>>
File: 1473467203969.gif (131KB, 500x281px) Image search: [Google]
1473467203969.gif
131KB, 500x281px
>>57648106
Oh shit, linked the wrong thing.
>>
>>57648061
>Computers are really fast anon
Yes they are so fast that a quantum system of anymore than 10 particles takes the expected lifetime of the universe to simulate for a few microseconds. Clearly algorithmic efficiency should be a non-concern.
>>
>>57647541
While you could be correct, you have absolutely no reason to posit that theory other than that she is a woman supporting a feminist cause, but being a feminist doesn't make someone competent on all fronts. It doesn't help anyone to put forth purely negative speculation without basis. The Internet has become a shit storm of click bait and knee jerk reactions. I ask that you rise above that kind of intellectual laziness.
>>
>>57648109
>C-tards can't even fizzbuzz in a readable way
>>
>>57648109
lang js
class FizzBuzz{constructor(a,b,c){this.d=++a;this.e=+ b;this.f=c}};FizzBuzz.prototype.fizzbuzz=function(){console.log(Array.apply(null,new Array(this.d)).map((i,n)=>{let c='';this.f.forEach((a,b)=>{switch(this.e){case 1:/b/.test(n)&&(c+=a);default:(n%b)?c:c+=a;break}});return(c)?c:n}).slice(1).join('\n'))};var FizzBuzzer=new FizzBuzz(100,false,new Map([[3,'Fizz'],[5,'Buzz'],[7,'Woof']]));FizzBuzzer.fizzbuzz()
>>
>>57648195
Neat
>>
>>57648133
He's just talking about a few million stars with positions here.
>>
>>57648195
>Putting everything on one line
>Even though you have semicolons everywhere
I know you can do better than that, Anon
>>
>>57648280
js programmers only know how to read minified js, it's not his fault
>>
In c++, can you make a global struct and initialize it later in the code? I am trying to do it, but it seems to be giving me an error. I want something like this.

struct cube myCube;

void init(){
myCube = cube(3);
}

>>
>>57648297
When you write
struct cube myCube;

it gets initialised at that point, so you can't call the constructor again.
However, it's been a while since I coded in C++ so don't quote me on that.
>>
>>57648297
Well you're calling a constructor on something without a constructor.
>giving me an error
Usually it's smarter to say what the error is than just saying that there is an error.
You can initialize it later on using an initializing function. It's not too rare for C++ programmers to write one for their classes. It's basically a void init() function which contains some basic initialization for your cube. You can call it anywhere you want if it's public (since you're using 'struct' it's public by default).

Your globally scoped cube can have its fields assigned to anywhere in the code.

Sorry I'm just throwing information at you but it's hard to tell exactly what you're after here.
>>
What does the following do exactly in nodeJS? Im coming from a Java and C background so I like to know how stuff works underneath the hood.

var readline = require('readline');
var rl = readline.createInterface(process.stdin, process.stdout);

I understand that require() is similar to include/import from other languages, but why is it assigned to a variable? Is this like assigning a class with static methods to a variable in java, if that was even possible?

ie. something like:
Math math = import "java.util.math"

And what does the second line do? Does it create an instance of a readline object with input and output streams being stdin and stdout?

Why isnt it done the classic way with the keyword new (like in c++, java, C#, even JS)?

Really weird going from lower level languages to node, it feels as if im a poor person being given a million dollars.
>>
>>57648246
TSP just talks about a few hundred points on a map.
>>
>>57648343
Messed up my tags.

What does the following do exactly in nodeJS? Im coming from a Java and C background so I like to know how stuff works underneath the hood.

var readline = require('readline');
var rl = readline.createInterface(process.stdin, process.stdout);


I understand that require() is similar to include/import from other languages, but why is it assigned to a variable? Is this like assigning a class with static methods to a variable in java, if that was even possible?

ie. something like:
Math math = import "java.util.math"


And what does the second line do? Does it create an instance of a readline object with input and output streams being stdin and stdout?

Why isnt it done the classic way with the keyword new (like in c++, java, C#, even JS)?

Really weird going from lower level languages to node, it feels as if im a poor person being given a million dollars.
>>
>>57648297
You should be able to do that as long as the copy assignment constructor isn't being deleted for some reason.

Another problem is when you write
struct cube myCube;
it's trying to call the default constructor. If the default constructor is deleted (e.g. if the class uses a smart pointer or another class with deleted default constructors), you'll get an error.

Also you don't need to write struct before cube in C++.
>>
>>57647578
good goy
>>
>>57648357
The readline module probably acts as a singleton or something.
Besides you don't always use "new" to create new things. For example java has factories.
>>
JS noob here again (Discord bot with node.js and mongodb). I'm trying to loop through an array of objects.

collection.find(query).toArray(function (err, result) {
if (err) {
console.log(err);
} else if (result.length) {
// limited to 3 results
for (var i = 0, l = 3; i < l; i++) {
var obj = result[i];
message.channel.sendMessage(obj);


For now this would just return [Object object], so how do I get it to return the properties instead of the objects?
>>
>>57648333
>>57648324

So basically I just wanted to initialize it without actually initializing it which is impossible. but it looks like I can get around it by making myCube a pointer and initializing it later.
>>
>>57648404
I have no idea what APIs you're working with but you probably want to replace message.channel.sendMessage(obj) with message.channel.sendMessage(JSON.stringify(obj)) and use JSON.parse wherever message.channel receives a message.
>>
>>57648429
Thanks, I think I can work with that.
>>
>>57648396

Thats what I assumed but im wondering if that is the case.

Yeah I know that sometimes you create objects with factory methods. Do they use factory methods because of its event driven structure? Ive only ever seen factory methods used for very distinct objects like BorderFactory.createTitledBorder or Frame.createBorderFrame, stuff like that. It wouldnt make sense to put those into a constructor.

Wish there was more in depth explanations to this shit. I hate using things at face value and not understanding how they work, node seems like a bunch of hacks desu
>>
>>57648522
>node seems like a bunch of hacks desu
Because it's what node is. Maybe you'll get a better answer in the web development general, I'm sure they have a better understanding of nodejs than the dpt regulars
>>
>>57642655
#include <iostream>

void printPyramid(int n, int level = 2);

int main(){
int num;
std::cout << "How large of a pyramid?";
std::cin >> num;

printPyramid(num);

return 0;
}

void printPyramid(int n, int level){
if (n == 0){
return;
}
for (int i = 0; i < n - 1; i++){
std::cout << ' ';
}
for (int i = level; i > 0; i--){
std::cout << '#';
}
std::cout << std::endl;
printPyramid(n - 1, level + 1);
}
>>
sup guys, having an issue with this code here and im not sure what the fuck is wrong, see if you can take a look.


>familyStructure is a...
public static HashMap<Integer, ArrayList<Integer>> familyStructure

>the first part is working, it is printing the keys of the has map

out of space so ill put error in reply to this..
>>
>>57648674

:code:
Set set = familyStructure.entrySet();
Iterator iterator = set.iterator();
while(iterator.hasNext()) {
Map.Entry entry = (Map.Entry)iterator.next();
System.out.print("Fathers ID is: \n"+ entry.getKey() + " & List of sons: \n");
for(int n = 0; n < entry.getValue().size(); n++) {
System.out.print("at listOfSons.get(" + n + ") contains: " + entry.getValue().get(n));
}
}

:stopcode:

Error result:
:code:
HelloWorld.java:132: error: cannot find symbol
for(int n = 0; n < entry.getValue().size(); n++) {
^
symbol: method size()
location: class Object

entry.getValue() returns an ArrayList<Integer>, why the fuck would there be an issue with using .get() on that, as well as .size() ?
>>
>>57648674
>>57648686

and the other error:

:code:
HelloWorld.java:133: error: cannot find symbol
System.out.print("at listOfSons.get(" + n + ") contains: " + entry.getValue().get(n)); ^
symbol: method get(int)
location: class Object
:stopcode:
>>
>>57648061
>>57648106
Okay here's a probably a better description of the problem:
https://a.pomf.cat/govhsa.pdf

Now imagine there's millions of stars instead of 887. Does it make sense now? There's 410953673207494277377652725270225024435734663094922099619273312508381769945477140601303679419374950000 distinct subsets of length 20 in a set of one million items, so a linear search is really not a good idea. Not to mention there's a degree of noise.
>>
>>57648061
>That a word processing tool like Excel can take more than a second to open is shocking.
no it's not dumbass
>>
>>57648674
>>57648686
>>57648698
Get the fuck out, newfag.
>>
>>57648757
How so?
It's obviously not shocking from the pov of understanding that they're shit at software but it's shocking considering the machines we have.
>>
>>57648789
programs like excel and word are more complex than you seem to think they are and computers are slower than you seem to think they are
>>
>>57648825
No you're retarded. Load times wouldn't be sensibly affected anyhow.
>>
>>57648841
lol k why don't you write software that's so much faster and better than excel word photoshop etc etc
>>
File: look out.png (11KB, 146x223px) Image search: [Google]
look out.png
11KB, 146x223px
Why are condensed fonts in tabs titles not default?

Program this into a stylish stylesheet:

.tabbrowser-tabs tab
{ font-family: "you're condensed_font"; }
>>
I'm writing a virus in JavaScript to kill off all the communists and leftists in the world.
>>
>>57644916
'float' is half the precision of 'double', which is half of 'long double'

I would use long double for everything
>>
>>57649145
sure is summer in here
>>
>>57649145
>>57649172
summer here,

is double computations quicker on 64 bit hardware
>>
>>57648881
?
>>
>>57649270
no
>>
>>57648718
So locate a star based off of a set of points and accuracy?

Either binary search or hashmaps. Hashmaps being the picture I accidentally posted >>57648106

Actually, probably a combination of the two. Or as I said in that comment as well, work out all of the closest neighbors by distance beforehand and store the index inside a database of some sort.

What I'd do is have some sort of sorted hashmap of x values. Inside that hashmap would be pretty much a plane if we're talking about x,y,z space. And that hashmap either links to another hashmap which you repeat the process, or just a sorted array. Find the few elements with in distance, then what you'd have is pretty much a column and repeat the process.

If you have a cluster that's between -1 and 1, and you're looking for a tolerance of 0.005. Then an acceptable hash function for x would be something
index = star.x+1
index = (int) (index * 50)

In which case you'll be able to split up every single star into an array of 100 "planes." And each star in that plane is at most 0.02 x apart from each other.

You can repeat that process to get a small little cube of stars that are at most 0.02 x y or z distance away from each other. Meaning we can narrow down the stars inside a cube of size 2*2*2, to a cube of size 0.02*0.02*0.02. A 1,000,000th the size using only 3 lookups in arrays/vectors. Inside that cube, just do a normal search of distance <tolerance.

Also a thing to note: You'd want to search the 3x3 area of elements you found

But as I said originally, just store all of the distances beforehand. But you'd want to write the above code just to generate the distances
>>
File: 1479011685221.jpg (39KB, 374x347px) Image search: [Google]
1479011685221.jpg
39KB, 374x347px
is there a way to call multiple functions that have a similar naming scheme in a elegant fashion? For example, I want to use a for loop to get information to store in an array from many void functions with similar names like functionOne, functionTwo, functionThree, etc.

How to?
>>
>>57649394
Make an array of function pointers?
>>
I'm thinking of starting work on a non-jailbreak open source 4chan client for iOS in Swift, I've got most of the groundwork already but I could use advice or help implementing ffmpeg for webm support

Would any of you be interested in teaming up / contributing in the future?
>inb4 shitposting
>>
File: 7 (3).jpg (107KB, 1920x1080px) Image search: [Google]
7 (3).jpg
107KB, 1920x1080px
Why does ES6 feel so disgusting?

I hate 'let' and I hate arrow functions.
>>
>>57647928
>>57648718
i don't understand what you're even trying to do

use a hash? or adapt some fingerprint (actual human fingerprint) algorithm?
>>
>>57645068
This.
>>
File: crookedtrump.jpg (98KB, 700x700px) Image search: [Google]
crookedtrump.jpg
98KB, 700x700px
computer scientists unite against trump! joint the movement now!

http://edition.cnn.com/2016/11/22/politics/hillary-clinton-challenge-results/index.html?sr=fbcnni112316hillary-clinton-challenge-results0247AMVODtopLink&linkId=31471136

with donald trump as president, computer science is endangered,
>>
File: 4.png (29KB, 633x758px) Image search: [Google]
4.png
29KB, 633x758px
>UK to censor online videos of 'non-conventional' sex acts
https://www.theguardian.com/technology/2016/nov/23/censor-non-conventional-sex-acts-online-internet-pornography

I won't be able to post on 4chan anymore soon, lads. It's been a fun ride.
>>
>>57645068
Programmers are also at bottom, a software engineering degree is laughable at best.
A CS degree is barely passable.

If your degree doesn't have engineering/physics/mathematics in it then you doesn't worth shit.

The only exception are the real super-auto-didactic master wizards.

>inb4 weak bait
>>
>>57649602
Cringe
>>
Hello /g/uys, I'm new to programming and started with python, as I've heard its a good babby language to start with. I've been working on a web scraper for 4 chan, and I think I've finally got it worked out pretty well. the only thing i'm still having trouble with is the options menu, to decide what the user would like to do. I have a functionally menu, but I have no try/catch set up, and i have trouble using a while loop to return to the specific part of the menu the user fucked up on. this is the relevant code:
    def menu(self):
while True:
cmd = input(
'1 for board surface, 2 for a specific thread, '
'and 3 for every thread on a board, or q to exit: ')
if cmd == 'q':
break
self.board = input(
'What board would you like to scrape?: ')
self.max_pages = int(input(
'How many pages would you like to scrape?: '))
if cmd == '1':
self.search_board()
elif cmd == '2':
self.search_thread()
elif cmd == '3':
self.deepsearch_thread()
else:
print('Invalid choice, try again.')

and the full script: http://pastebin.com/nhEctmAq
If anyone would , be willing to critique in general I would really appreciate it, and if anyone has any resources specific to creating user input menus that covers thorough try/catch that would be awesome. Cheers!
>>
>>57649633
Why don't you use the official /g/ API?
>>
>>57649446
might work thanks forgot about those
>>
>>57645906
Either spaghetti or written in TypeScript.
>>57645928
Have you heard of left-pad? The average JS dev would rather import 3 libraries than write 10 lines of code.
>>
>>57649648
It most certainly works.
>>
>>57649648

Here's an example some anon posted in this thread btw
>>57648109
>>
>>57649660
>Have you heard of left-pad?
Just kill me now.
>>
Hello friends, I didn't know where to post this but I figured you guys could help.
I'm going to school for CS and my C++ prof just emailed me because he wants to help me acquire an internship at a defense company where he used to work.
The thing is, my resume is a little fucked.
I was gonna type out exactly why it's fucked, but this isn't my personal blog so I'll just summarize my question: Should I leave out anything irrelevant to programming? The thing with that is, if I cut out everything irrelevant, I'm barely left with anything on my resume, but my prof thinks of me as a high potential candidate. Any tips? I've never had a job that wasn't just a wageslave position so all my job experience is essentially null
>>
>>57649660
>import 3 libraries than write 10 lines of code
>dev

pick one
>>
This is my injected dll into an already running process to attempt to hook some directx8 functions. Since the process is already running, I can't/am not hooking CreateDevice, so I need to create my own to get the functions from the created devices vtable.

IDirect3DDevice8* device;
auto direct3D = Direct3DCreate8(D3D_SDK_VERSION);
if (direct3D == NULL)
return D3DERR_INVALIDCALL;

D3DDISPLAYMODE displayMode;
HRESULT result = direct3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &displayMode);
if (result != D3D_OK)
return D3DERR_INVALIDCALL;

D3DPRESENT_PARAMETERS presentParameters;
ZeroMemory(&presentParameters, sizeof(presentParameters));
presentParameters.Windowed = true;
presentParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
presentParameters.BackBufferFormat = displayMode.Format;

WNDCLASSEX wndClass = { sizeof(WNDCLASSEX), CS_CLASSDC, TempWndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, L"1", NULL };
RegisterClassEx(&wndClass);
auto hWnd = CreateWindow(L"1", NULL, WS_OVERLAPPEDWINDOW, 100, 100, 300, 300, GetDesktopWindow(), NULL, wndClass.hInstance, NULL);
result = direct3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_DISABLE_DRIVER_MANAGEMENT, &presentParameters, &device);


The CreateDevice call is failing and I'm not completely sure why just yet. Sometimes and unhelpful exception is thrown, other times the process just doesn't complete within a normal amount of time and I force close it.

The already running process writes to it's console
ERROR(AntTweakBar) >> Already initialized
[/code
after my injection, a quick google didn't yield any super useful results. Any suggestions?
>>
>>57649681
Leave out irrelevant shit, don't make excuses.

His word will probably weight more than your resume.
>>
>>57649642
Sorry, still a noob, what are you referring to?
>>
>>57648881
> CSS
> /dpt/
>>
File: its_beautiful.png (273KB, 450x600px) Image search: [Google]
its_beautiful.png
273KB, 450x600px
its sort of hit me that if you know the network protocol a game uses to communicate with its server, you could write a bot that doesn't use the gmae client, meaning no rendering
granted it would be fucking difficult to reverse in the first place, but imagine the possibilies
>running a swarm of 300 bots on a single computer
>>
>>57649745
>>57649745
>>57649745

NEW THREAD
>>
>>57649749
This was done by many people with games as recent as Pokemon GO. It was super simple to reverse engineer their API and use console applications to "play". I did it, and you could also break the game by setting your position to anywhere in the world. Was super easy to catch all pokemon, hit unlimited pokestop etc. Sold some of the accounts for $250-300 each.
>>
>>57649691
why are you creating a window?
you only need the device if all you want to do is hook functions from its virtual table
>>
>>57649774
You can't pass in NULL as a parameter to CreateWindow for HWND hFocusWindow. So I create a window myself to create/attach to make the device.
>>
>>57649773
>>57649749

Hell, server-client architecture was used for games back in the day, even for singe-player. It made single-player/multiplayer trivial. Quake 2 for example and possibly early call of duty games, medal of honor too maybe.

You could easily make an event based architecture for rendering to using a server-client model so you could trivially attach a renderer when you need to (the bot is disabled, user control activated).
>>
>>57649757
thanks, senpai
>>
>>57649804
Sorry, I meant you can't pass in NULL for HWND hFocusWindow for CreateDevice, not CreateWindow.
>>
>>57649773
you reversed the actual game or just the protocol?
because reversing an android/ios app sounds hard since there arent any good tools

i wanted to try reversing clash of clans but i couldnt break their encryption
>>
>>57649860
Just the networking stuff. You can look at https://github.com/PokemonGoF/PokemonGo-Bot for what some other people did around it.
>>
>>57649613
VPN?
>>
>>57649860
I don't know anything about that, but many games use REST API tier shit nowadays.
>>
>>57649691
i had this problem with directx a few months back
this is gonna sound weird as fuck, but try sleeping for 100-400ms after injecting and THEN try to create your device
>>
>>57649895
Something like this.

I did this kind of shit a long ago, but if I remember correctly there was some shit with DLLs not having everything available in the initial function the system calls. So if you call out from that then you need to wait for shit to settle. Maybe you can do some shit manually, idk.
>>
>>57649883
man that projects looks like a mess
still interesting tho, thanks dude
>>
>>57649895
>>57649920

Added Sleep(500); before the pasted code, no different result.
>>
>>57649964
I remember better now.
Do you do this in the DllMain?
See
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682583(v=vs.85).aspx

>There are significant limits on what you can safely do in a DLL entry point. ...

If I remember correctly all I did is start a new thread which ran my own main function in DllMain then waited a bit in my main function.

Don't do anything other than minimal bootstrapping in dll entry points.
>>
>>57650013
Ahh, fuck I got a brainfart.

What I meant is that my dll entry point only had code to run my main function using a new thread then it returned. It has to return.
>>
I got called in for an interview.

it's my first time.
>>
>>57650075
Make sure you don't shower for a week before the interview.
>>
>>57650013
>>57650047

That's all I do in my DllMain

BOOL WINAPI DllMain(HINSTANCE hInstModule, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
DisableThreadLibraryCalls(hInstModule);
DWORD threadId;
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)HookAPI, NULL, 0, &threadId);
return true;
}

return false;
}
>>
>>57650075
be sure to mention your favorite anime
>>
>>57650195
Well, I got nothing else.

I don't know much about DX so maybe that's where the problem lies.

Good luck, dude.
>>
>>57650075
If you shave and wear a suit jacket and shirt I promise you're already above 95% of their candidates. I'm pretty sure that's the only reason I have my job, they even mentioned that others solved their interview test in a much cleaner fashion so I assume the reason they didn't go with those guys is they were neckbeard spergos.
Thread posts: 333
Thread images: 45


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