[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: 313
Thread images: 50

File: daily programming thread2.webm (2MB, 600x338px) Image search: [Google]
daily programming thread2.webm
2MB, 600x338px
old thread: >>60586810

What are you working on, /g/?
>>
Is there any reason to write POSIX shell compliant shell scripts instead of bash scripts?
>>
>>60590622
If you need to run on environments that may only have a simple POSIX shell and not bash, sure.

Otherwise no
>>
>>60590634
ok then

How do i create index-accessible arrays in a posix shell script?
>>
You are tasked with mapping gender as viewed by tumblr into native Java OOP with correct polymorphism and inheritance.
They need this as part of data gathering on tumblr demographics.

What do you do?
>>
>>60590651
Damn it, Jim, I'm a programmer not an anthropologist!
>>
these threads are more and more retarded
>>
>>60590651
enum gender { MALE, OTHER };
>>
File: 1495774102721.jpg (530KB, 1334x694px) Image search: [Google]
1495774102721.jpg
530KB, 1334x694px
reminder that women and queers can't program for shit
>>
>>60590650
foo[0]="bar"
echo ${foo[0]}
>>
>>60590651
Java is deprecated.

>>60590664
Except the only people lobbying for their expulsion are those who make even less of a contribution to the thread. Basically, you're everything you accuse the ``SJWs" of being - you don't write any code, you perform no useful work, all you do is persecute those more productive than yourself for not having ideologically acceptable beliefs.
>>
delete OP's webm
>>
>>60590675
>>>/r9k/

What even is your purpose here? You know this is off topic, and will result in the best case being ignored, and in the worst case being banned. So what do you expect to gain?
>>
>>60590696
you're a fag who sucks at programming. you probably don't even program at all you're just here to force your fag shit.
>>
>>60590712
No, I actually do program, I have posted code in the past and commented on other people's code. What have you done?
>>
>>60590622
Dumb question anon, why would you write scrips in bash and the like? Are you deploying to places where you can't guarantee some newfangled interpreter?
>>
File: 1494184660219.jpg (58KB, 960x958px) Image search: [Google]
1494184660219.jpg
58KB, 960x958px
>>60590712
I'm a code monkey :^)
>>
>>60590651
well, gender is a spectrum so poly/inheritance arent applicable patters for this problem

so we really only need a 'person' object containing two unsigned integers that represent the amount of male and/or female the 'person' has

the methods in the 'person' object have different behavior based on those spectrum integers
>>
>>60590731
Actual right answer
>>
>>60590731
use BigDecimal nigger
>>
>>60590726
>newfangled interpeter

like?
>>
File: 1462082471526.gif (2MB, 380x238px) Image search: [Google]
1462082471526.gif
2MB, 380x238px
Anyone know how to get rid of the if statement below in python without resorting to multiplication by -1?

    x = 10**1000
toggle_sign = True
total = 0
while x > 0:
y = floor(x * (sqrt(2)-1))
if toggle_sign:
total += ((x+y)*(x+y+1)/2 - y*(y+1))
else:
total -= ((x+y)*(x+y+1)/2 - y*(y+1))
x, toggle_sign = y, not toggle_sign
>>
>>60590770
>without resorting to multiplication by -1?
But that's literally how you invert a number you tard.
>>
How do I parse this data from my webcam stream?

--ipcamera
Content-Type: image/jpeg
Content-Length: 22124

ÿOÿà
>>
>>60590763
The guys at work keep harping on about how easy their life is after rewriting arcane shell scripts in python. That's not my area, so I'm none the wiser.
>>
>>60590770
multiplication by -1 is much faster than a branch you retard
>>
>>60590776
I dunno, how do you read jpeg images.
>>
>>60590776
Do you just want the content length number?
>>
File: 1454812025980s.jpg (9KB, 250x226px) Image search: [Google]
1454812025980s.jpg
9KB, 250x226px
>>60590749
why not just scale with ints. It would be much better than using decimals. Representing gender is an abstract concept anyways, so it decimal precision wont even matter.
>>
File: gnu.jpg (103KB, 960x960px) Image search: [Google]
gnu.jpg
103KB, 960x960px
Your code needs inspection.
>>
>>60590770
xor the sign bit
>>
>>60590770
>>60590774
>>60590780
just flip the most significant bit of the number for fastest inversion.
>>
>>60590803
>xor the sign bit
>>
>>60590780
not true. I'm dealing with very large numbers and python allows arbitrarily large integers
>>
>>60590731
>well, gender is a spectrum
:^)
>>
>>60590802
kill yourself
>>
>>60590803
>>60590815
That's the same speed as multiplying by -1 but less clear

>>60590821
You are actually retarded
>>
Why is C++ so shit?

trap.cpp:8:32: error: invalid conversion from ‘void*’ to ‘Girl*’ [-fpermissive]
struct Girl *trap = crossdress(sizeof(struct Boy));
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
>>
>>60590831
wtf is your problem? don't just assume things.

>>60590821
don't listen to these retards. keep the branch. you can turn the expression into a function to reduce code repetition.
>>
>>60590776
>>60590785
>>60590789
I dunno, I tried writing all this to a jpg file sans the headers but it doesn't werk.
>>
>>60590815
>>60590803
python hides that and allows arbitrarily large integers
>>
>>60590838
Because C++ aims to be "typesafe" by 1980s standards rather than 1970s standards.
>>
File: yukari_messy_eater.png (655KB, 624x804px) Image search: [Google]
yukari_messy_eater.png
655KB, 624x804px
>>60590770
Use a Kronecker delta, like 2(kronecker - 1/2). I suggest you use the Fourier representation of it so that you won't need to use any if statements.
int kronecker(int x,int y)
{
double sum = 0.0;
int nmax = 1000;
std::comp i = {0.0,1.0};
for(int n=0;n<nmax;n++)
{
sum += exp(i * n * (x-y)/nmax);
}
return sum;
}
>>
>>60590860
how do you receive this data? TCP stream?
>>
>>60590798
im the one with the original solution and i just realized the scale thing is wrong

each 'person' object needs to accept a string submitted by the associated user in their 'gender' field

then we need to feed the entirety of all tumblr content into a deep-learning neural net

then the gender strings are passed through the neural net and abstractly interpreted into numeric values that can be used in calculations within a 'person' object's methods
>>
>>60590873
I don't really understand the advanced math stuff, but a for loop is a kind of if statement, so it doesn't really work for what they're talking about.
>>
>>60590873
that's the worst code i've ever seen. you should be shot.
>>
File: 1461042795993.jpg (153KB, 654x867px) Image search: [Google]
1461042795993.jpg
153KB, 654x867px
>>60590873
>Anyone know how to get rid of the if statement
>proceeds to add 11 lines of code

looks interesting though desu
>>
>>60590884
What exactly is your basis for the notion that the universe of gender can be mapped to a 1-dimensional space?
>>
>>60590770
    y = floor(x * (sqrt(2)-1))
OverflowError: long int too large to convert to float
>>
>>60590890
>>60590891
>>60590894
trolled hard
>>
File: 1492618231265.png (248KB, 1000x1200px) Image search: [Google]
1492618231265.png
248KB, 1000x1200px
>>60590890
>>60590894
That's the joke.
>>
>>60590903
>I was only pretending XDD!
>>
>>60590898
my actual function uses integers instead of floats. Try 10**100

this is psuedo code
>>
>>60590910
even if you don't understand the math it's pretty obvious that it's an impractical solution
>>
>>60590915
>my actual function uses integers instead of floats
What? sqrt(2) will always be a float, and multiplying it by an int will cause a float conversion

Unless you swapped out half your code for no reason, it's still going to break
>>
>>60590896
you are absolutely correct. we need a powerful graphics rendering network so we can perform the calculations necessary in a multidimensional simulation
>>
>>60590944
>>60590896
>>60590884
Management here, it still needs to be done with Java. If you want to do neural network with native Java then go ahead. Oh and your budget is $2m.
Get to work you fucking code monkeys.
>>
>>60590896
>>60590944
>what is the Hilbert curve
R^2 is surjective to R, meaning they have the same cardinality.
>>
>>60590936
You build an int out of as many digits of sqrt(2) -1 you want

414213562373095048801688724209698078
5696718753769480731766797379907324784621
0703885038753432764157273501384623091229
7024924836055850737212644121497099935831
4132226659275055927557999505011527820605
7147010955997160597027453459686201472851
7418640889198609552329230484308714321450
8397626036279952514079896872533965463318
0882964062061525835239505474575028775996
1729835575220337531857011354374603408498
8471603868999706990048150305440277903164


Then you multiple your number by then then do a floor divide on the result and you get the same value as if you would have done the psuedo code I gave you... you can use integers instead of floats
>>
Thanks to Backpack, Haskell will now support:
applicative functors
Applicative functors
Applicative Functors
applicative Functor functors
applicative Applicative Functor functors
>>
>>60590877
No idea
>>
class IntDecimal {
int Value;
int DecimalPointLocation;
}
>>
File: dlang_chan.jpg (139KB, 470x545px) Image search: [Google]
dlang_chan.jpg
139KB, 470x545px
Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); she's super duper cute and easy to prototype in; she has contempt for false flags; and she's a blast to write in! Did I mention how cute she is? Say something nice about her, /dpt/!
>>
>>60590995
nigger how do you expect use to help you if you don't even know how you get your data?
>>
D
Go
Rust
Haskell
Common Lisp

Are these even relevant outside of /g/?
>>
File: 1494922328031.png (194KB, 562x389px) Image search: [Google]
1494922328031.png
194KB, 562x389px
Does stripping my binaries make my codes faster?
>>
>>60591008
Congratulations, you just reinvented floating point.
>>
>>60590770
x = 10**1000
sign = 1
total = 0
while x > 0:
y = floor(x * sqrt(2)-1)
total += sign*((x+y)*(x+y+1)/2 - y*(y+1))
x, sign = y, -sign

Testing shows a 9% speed increase with this code
>>
>>60591027
Who cares?
>>
>>60591038
that's not how floating point works.
>>
>>60591037
No. It only makes them smaller
>>
>>60591024
I just confirmed its TCP.
>>
File: 1462751231808.jpg (125KB, 600x600px) Image search: [Google]
1462751231808.jpg
125KB, 600x600px
>>60591008
class intString {
String myString;
int letterLocation;
}
>>
>>60591064
What are the reasons for wanting that?
>>
>>60591064
Smaller binaries means better cache locality, meaning faster execution.
>>
>>60591039
thats pretty cool. How do you test speed and get a percentage back? Is there some kind of library
>>
>>60591090
>What is math
>>
>>60591090
I ran them both a few thousand times, timed the total time taken for each one, then used basic math
>>
>>60591090
Average python coder.
>how do I import basic math?
>>
File: 1489138711283.jpg (685KB, 2335x2507px) Image search: [Google]
1489138711283.jpg
685KB, 2335x2507px
>>60590802
B-be gentle please!
void print_love() {
puts("<3");
}
>>
File: 1462291756165.png (515KB, 896x943px) Image search: [Google]
1462291756165.png
515KB, 896x943px
>>60591095
i know how to do it by hand. I was wondering if there was an inbuilt tool. Thanks for your contribution
>>
File: 1484620344522.jpg (33KB, 600x564px) Image search: [Google]
1484620344522.jpg
33KB, 600x564px
>>60591107
>print_love
>not printLove
>>
File: 噗.jpg (56KB, 408x491px) Image search: [Google]
噗.jpg
56KB, 408x491px
>>60591090
>>
>>60591077
dumb frogposter
>>
>>60591081
You might be in an embedded environment where space is at a premium, or you might be shipping very large binaries and want all the slimming you can get
>>60591083
symbols are stored in their own section of the binary, not interleaved in the code/data sections. They don't affect cache locality
>>
>>60591101
i have never used python. But nice try anyways
>>
File: the botnet wants me to starve.jpg (102KB, 1280x720px) Image search: [Google]
the botnet wants me to starve.jpg
102KB, 1280x720px
>>60591113
>>
>>60590622
Not programming related.
>>>/g/wdg/
>>
File: 192.png (217KB, 600x600px) Image search: [Google]
192.png
217KB, 600x600px
>>60591169
> >>>/
>>>/trash/
>>
>>60591069
yoyà kinda looks like the jpeg signature:
https://en.m.wikipedia.org/wiki/List_of_file_signatures

Define "doesn't work", does the image viewing program not recognise the file?
>>
>>60591113
>printLove
>not print_love
>>
>>60590980
jesus christ anon just use floats or high precision decimals
>>
Lets say I have a normalized vector like [0.702,0.701] Associated with some pixel at [5,3] for example.

How can I get the next pixel that this pixel is "pointing" to with the least amount of error?
>>
File: Looping question asking.png (15KB, 654x323px) Image search: [Google]
Looping question asking.png
15KB, 654x323px
I have figured out a simple way to loop a user input until it's within my defined numbers that doesn't involve until answer1 == '1' or answer1 == '2' or....for a hundred ors


and now I'm sure someone will tell me an even faster way I should be doing it....
>>
>>60591177
>>60591201
>ribbit.png
>rabbit.jpg
I don't want reddit stink nearby. Piss off.
>>
>>60591212
you should be able to figure this out on your own
>>
>>60591223
Clearly I am not.
>>
>>60590586
It's been like a year or two and I still want to fix the typo where I made it say "hug memory" instead of "hog memory"
>>
>>60591235
loser
>>
File: reimu_snapchat.png (891KB, 770x1063px) Image search: [Google]
reimu_snapchat.png
891KB, 770x1063px
>>60591212
Add components then use ceiling function.
>>
>>60590731
>well, gender is a spectrum

Go back to tumblr, faggot.
>>
>>60591197
No it does not recognize the format
>>
>>60591230
plug the vector components into atan2 and select one of the surrounding pixels depending on the direction
>>
File: dum forgpopstr.png (22KB, 296x378px) Image search: [Google]
dum forgpopstr.png
22KB, 296x378px
>>60591222
>I don't want reddit stink nearby. Piss off.
>>>/trash/
>>
File: soge.gif (2MB, 427x306px) Image search: [Google]
soge.gif
2MB, 427x306px
this is the fucking garbage i come up with to test my code
>>
>>60591258
Wouldn't that round all the values to -1 or 1.

If i give it [0.9,0.4] or something then they both round to just [1,1]


>>60591271
So would I reserve a range of angles to associate with the 8 surrounding pixels? Would this minimize error? It seems arbitrary
>>
>>60591284
define 'error'. your problem seems arbitrary. would 8 equally large ranges be inadequate?
>>
>>60591283
lol nice
>>
File: bres2.gif (3KB, 510x209px) Image search: [Google]
bres2.gif
3KB, 510x209px
>>60591308
minimizing error so it only picks pixels closest to the true "line"

Splitting it into 8 equal ranges might not work because it would involve projecting 8 points onto a circle and determining the angle that defines each of them, which would never allow the 45-degree-cases to be evaluated
>>
>>60591323
you didn't say the vector could be off-center dumbshit. you're trying to implement bresenham's line algorithm?
>>
>>60591283
>he's actually working on something
wrong thread
>>
File: 42233472_m.jpg (120KB, 428x600px) Image search: [Google]
42233472_m.jpg
120KB, 428x600px
>>60591346
I have an -arbitrary- vector field and need to trace a stream-line starting from any one of the pixels to the next pixel
>>
File: smug_ran1.jpg (180KB, 1732x1593px) Image search: [Google]
smug_ran1.jpg
180KB, 1732x1593px
>>60591363
Vector fields are elements of the tangent bundle TM of the manifold M, and the flows through the vector field are curves γ: R → M that satisfy the ODE γ' = Xγ.
Solve the ODE and you'll get what you want.
>>
>>60591262
>>60590825
not him but kill yourselves
>>
>>60591283
>sepples
Instant trash.
>>
>>60591404
Stop shit posting on 4chan bill
>>
>>60591409
>he doesn't use sepples
>he thinks sepples is trash
thank you very much for your time, we'll be in touch
>a year passes
>>
File: tumblr_oncis6mnZo1ts9rljo1_400.png (75KB, 348x301px) Image search: [Google]
tumblr_oncis6mnZo1ts9rljo1_400.png
75KB, 348x301px
>>60591396
the problem is that I have an arbitrary vector field that I have to integrate at a pixel by pixel level. The only samples I have of the vector field are at the individual pixels so at most I have a raster field of "lines" with each vector being a tangent. So at every integration of a streamline I -get the tangent of the current pixel, - calculate the next pixel using this tangent, - move to the next pixel

and do this for however many pixels I care for.

It is not a nice and "clean" vector field either. It's something that is totally arbitrary so all i have to work with when integrating a stream line are these normalized per-pixel tangent values.
>>
>>60591013

>she's going to have her GC tumor removed (eventually)
prove it
>>
>>60591440
>I have to integrate at a pixel by pixel level
That's literally what numerical integration is. Go read Numerical Recipes.
>>
>>60591422
>it's only shitposting when people do it to stand up for people i don't like
>mommy help the big mean leftist is bullying me again
>>
>>60591453
I sure wish this got relevant to finding out what next pixel I should choose again.

I'm doing what's basically called an euler integration.
https://en.wikipedia.org/wiki/Euler_method

I just want to pick the next best pixel man.
>>
>>60591470
Gender isn't on a spectrum but you certainly are.
>>
File: yukari_face.jpg (179KB, 637x900px) Image search: [Google]
yukari_face.jpg
179KB, 637x900px
>>60591475
>still not reading the book
Disobedient children get 10 swathes to their butts.
>>
>>60591323
>>60591440
stupid ass, don't think of the pixels as squares, think of them as points, dividing the circle into 8 equally large sectors would work
>>
File: g2tSfA.gif (172KB, 650x650px) Image search: [Google]
g2tSfA.gif
172KB, 650x650px
>>60591485
>Gender isn't on a spectrum
literally kys tbqfhfamalam
>>
>>60591496
Bill stop. This is embarrassing and isn't the right message.
>>
File: stackoverflow.png (44KB, 753x772px) Image search: [Google]
stackoverflow.png
44KB, 753x772px
>>60591489
>read an entire book
You're just as bad as those people on stackoverflow that tell others to use boost and doesn't directly help their problem domain.

>>60591491
Would an octagon give the least amount of error.

Thanks you're more helpful than >>60591489
>>
>>60590675
gay employed programmer here. fuck you.
>>
>>60591512
>MOMMY MOMMY SPOONFEED ME MOMMY!
>>
>>60591489
>trying to sell a book on /g/
>>
File: Autism_Spectrum_Disorder-1.jpg (101KB, 549x302px) Image search: [Google]
Autism_Spectrum_Disorder-1.jpg
101KB, 549x302px
>>60591496
You seem to have gotten your spectra confused.
>>
File: gellar.jpg (327KB, 800x1215px) Image search: [Google]
gellar.jpg
327KB, 800x1215px
>>60591502
>Bill
>assuming my gender this hard
off urself m9
>>
>>60591518
sorry i dont appreciate your touhou avatars man
>>
File: download (2).jpg (6KB, 262x192px) Image search: [Google]
download (2).jpg
6KB, 262x192px
>>60591521
>being this ableist
kek what a small minded loser
>>
>>60591520
PDF is free online, literally handed out to you on a platter.
>>
At what point can I write a fair amount of rust code without having to spend hours getting it to compile?

In languages where I'm experienced in typically I have a time spent writing code : time spent getting code to compile ratio of like, 100:15.

But in rust that ratio seems to be more like 100:150 (not joking).
>>
>>60591404
>>60591470
>>60591496
>>60591522
>>60591531
>sjw libcuck decides to stop taking everything so seriously and start approaching arguments with conceit and dark comedy
oh god no they're learning from us
>>
more python

import os
import binascii
import time
import zipfile
import subprocess
import keys
import base64

a = keys.password
pw = base64.b64decode(a).decode("utf8")
gen = (binascii.hexlify(os.urandom(256))).decode('utf8')

static = time.strftime('%d-%m-%Y--%H-00-00')
staticUname = time.strftime('%H-00-00')
staticTitle = time.strftime('%d-%m-%Y')

opensesame = '"C:\Program Files (x86)\KeePass Password Safe 2\kpscript.exe" -c:AddEntry "' + keys.database + \
'" -keyfile:"' + keys.keyfile + '" -pw:"' + pw + \
'" -Title:"Backup for ' + staticTitle + '" -UserName:"' + \
staticUname + '" -Password:"' + gen + '"'

encrypt = 'gpg --batch --passphrase ' + gen + ' --output ' + static + \
'.backup --symmetric --cipher-algo AES256 --digest-algo SHA256 ' + static + '.zip'

print('starting backup...')

print('Zipping files')

zf = zipfile.ZipFile(static + '.zip', 'w')
for dirname, subdirs, files in os.walk('C:\\test\\'):
zf.write(dirname)
for filename in files:
zf.write(os.path.join(dirname, filename))
zf.close()

print('Zip Complete')

print('Opening and storing Password in DB')

subprocess.Popen(opensesame, stdout=subprocess.PIPE, shell=True).communicate()

print('Complete')

print('Starting encryption AES256 hash SHA256')

subprocess.Popen(encrypt, stdout=subprocess.PIPE, shell=True).communicate()

print('encryption complete')

os.remove(static + '.zip')

# Decrypt gpg --batch --passphrase INSERT --output backup.zip --decrypt
# FILENAME.BACKUP
>>
File: 1495492838354.jpg (86KB, 750x749px) Image search: [Google]
1495492838354.jpg
86KB, 750x749px
>>
This is probably a dumb question but how do I make a random string based on the date?
I need different computers to come up with the same randomized string for each day.
>>
>>60591638
use your computers calendar based on the day mon - fri
>>
>>60591624
woah....... bro...
>>
>>60591644
No I want the algorithm for coming up with a string
>>
>>60591512
>Would an octagon give the least amount of error.
If you're fixated on selecting a pixel you are going to introduce arbitrary error at every step.
I'd rather just interpolate and do analytical integration.
>>
>>60591664
date d = current day
long v = days between (1/1/1900) and d
v = hashfunction(v)
string s = v.tostring()
>>
>>60590651
Vec3 gender;
>>
>>60591707
I need a hash function that is the same on the two computers
I am not using the same language on both computers
>>
>>60591745
Just use the hash function??
>>
How does a hash table have O(1) time if hashing something like a string requires us to check each letter in the string?
>>
>>60590651
something similar to colors, instead of r,g,b we would have a mix of male, female and retard

On a more serious note: when writing in C++ is there a correct and standard way on what type to choose as the index for a for loop traversing arrays?
I've seen people saying to use size_t, a lot of people i know go with int it.
>>
>>60591774
It has an O(1) lookup time you silly billy.
>>
>>60591757
is the hash algorithm the same for
lets say java and c++ for example?
I don't know if the hash function provided on java libraries are the same as those provided by c++
>>
>>60591782
And O(1) put/set time.
>>
>>60591787
public long hash64shift(long key)
{
key = (~key) + (key << 21); // key = (key << 21) - key - 1;
key = key ^ (key >>> 24);
key = (key + (key << 3)) + (key << 8); // key * 265
key = key ^ (key >>> 14);
key = (key + (key << 2)) + (key << 4); // key * 21
key = key ^ (key >>> 28);
key = key + (key << 31);
return key;
}
>>
Remember to eat healthily and exercise. A healthy body is a prerequisite for a healthy mind.
>>
i wish i had help writing my language :< how does terry manage coding alone for so long?
>>
File: 1405904992493.gif (1MB, 250x167px) Image search: [Google]
1405904992493.gif
1MB, 250x167px
>>60591843
Reminder that being a computer scientist and a programmer is great.
>>
>>60591787
Nope. Not even sure there is a canonical hah function in C++. Besides the hashes might change between JVM versions or be salted differently on each program run. If your goal is reproducible hashing, call a standard hash function or roll >>60591830.
>>
>>60591894
He's literally insane
>>
Should i use size_t for sizes that are decided by the user?
>>
Never, ever, seriously don't you fucking dare, nest your code more than 4 levels deep. You little fucking monkey. You insolent cur.
>>
>>60592076
I use multiple nested for loops with this to exit my loop.
break
break
break
>>
>>60592076
                                // ...
}
);
}
);
cb( `${modelNumber} @ ${currentResolution}` );
}
);
}
catch ( e ) {
console.log( `e: ${e}` );
}
}

r8 my kode
>>
>>60592076
Nice reverse psychology, faggot.
>>
>>60592036
Yes.
>>
I am writing a little header only implementation of something rather small that anyone can be free to use.
I've got two version, a template and non template, compiling without optimization has the template one going faster, while compiling with optimization they are kinda equal (template slightly faster but we are talking < 5%), should i stick with the template?
>>
>>60592264
Yes.
>>
File: pword.jpg (107KB, 864x552px) Image search: [Google]
pword.jpg
107KB, 864x552px
Threadly reminder that as3 is best language.
Pic related: code to produce the following passwords from 2 out of 256 possible keys:
,&.6)/(!2>$,
'3><97568!<?
2**:&!*+!?/#
>>
>>60592286
>>>/trash/
>>
>>60592307
Your opinion has been noted.
>>
File: 1468968741804.png (21KB, 641x585px) Image search: [Google]
1468968741804.png
21KB, 641x585px
tell me how bad my tiling code is
>>
>>60592327
do yo have a public code repository?
>>
>>60592327
function (... args):* 
{
as objectModel :: throw "Omg thats disgusting" on returnErrorException; }@enableStaticOverflow
>>
>>60592327
makes me want to barf
>>
File: 1473910188851.png (11KB, 204x783px) Image search: [Google]
1473910188851.png
11KB, 204x783px
>>60592351
no, I'm considering trying to make a game for proper commercial release.

How should I be sorting my header files /g/?
>>
>>60592376
Throw it all away and use a game engine.
>>
File: 1477086570039.png (2KB, 389x156px) Image search: [Google]
1477086570039.png
2KB, 389x156px
>>60592413
NIGGA I AM USING A GAME ENGINE
>>
>>60592425
>>>/angermanagement/
>>
>>60592425
>its c++ so its good
use a game engine
>>
>>60592439
I'm using libSDL2, which is C.
>>
>>60592425
I mean a real engine.
>>
>Every 5 minutes you spend writing code in a new language is more useful than 5 hours reading blog posts about how great the language is.
Is it true, /g/?
>>
>>60592505
Can't beat experience.
>>
>>60592505
Yep. This is true for everything.
>>
>>60592505
What are these ``blog posts"?
>>
Anyone here emplyed as a programmer?

How many hours a week do you typically work?
>>
Tuning my clickbait archive generating 4chins bot. Most of the responses are 10/10 reviews. I think targeting satire/fake news sites is the next obvious hill. A lot of shills posting those as well.
>>
>>60591777
size_t is unsigned int
if you do something like
for (int i = 0; i < list.size(); ++i)

atleast MSVC will give warning since it's theoretically possible to overflow int due to list.size() returning size_t which is actually unsigned int.
>>
>>60592566
Yes. 40
>>
>>60590586
>What are you working on, /g/?
Decided to try my hand at making a bot in OSRS
everything went well until i discovered that the screen shifts every few seconds, so after awhile of the screen shifting, it throws my bot off
so tomorrow i'm just going to maybe figure out how i can maybe get it to work with identifying pixel colors and shit and blablabla

tl;dr: shit didn't work like how i thought it would so now i have to redo everything

i know those jagex faggots implemented that screen shifting thing to fuck with me, god dammit
>>
>>60592566
No.
20.
>>
>>60592611
> size_t is unsigned int
Wrong, size_t is an unsigned integer type, but not necessarily unsigned int, and it's usually not on 64bit systems.
>>
I've gone full hipster and I'm writing a react app with relay and a graphql backend.

It's taken me two weeks to get something on the screen.

I get why graphql and relay are good, but it takes five times longer to do anything. For a hobby project; is this stupid, or is it worth it?
>>
>>60592439
>>60592460
>want him to use a game engine
>not C++

I remember when game engines were all C++.
>>
>>60592076
>4
2 is max acceptable depth
>>
Im looking for advice on my code. I know i posted it earlier, but im posting it again here.

Im making a backup program that will encrypt my files with a random 512 character password and encrypt it with AES256 and hash it with SHA256

import os
import binascii
import time
import subprocess
import keys
import base64
import shutil

a = keys.password
pw = base64.b64decode(a).decode("utf8")
gen = (binascii.hexlify(os.urandom(256))).decode('utf8')

static = time.strftime('%d-%m-%Y--%H-00-00')
staticUname = time.strftime('%H-00-00')
staticTitle = time.strftime('%d-%m-%Y')

zippity = '"C:\Program Files\\7-Zip\\7z.exe" a -t7z -m0=LZMA2:d64k:fb32 -ms=8m -mmt=30 -mx=1 -- ' + \
static + '.7z "c:\\test"'

opensesame = '"C:\Program Files (x86)\KeePass Password Safe 2\kpscript.exe" -c:AddEntry "' + keys.database + \
'" -keyfile:"' + keys.keyfile + '" -pw:"' + pw + \
'" -Title:"Backup for ' + staticTitle + '" -UserName:"' + \
staticUname + '" -Password:"' + gen + '"'

encrypt = 'gpg --batch --passphrase ' + gen + ' --output ' + static + \
'.backup --symmetric --cipher-algo AES256 --digest-algo SHA256 ' + static + '.7z'

subprocess.Popen(zippity, stdout=subprocess.PIPE, shell=True).communicate()

subprocess.Popen(opensesame, stdout=subprocess.PIPE, shell=True).communicate()

subprocess.Popen(encrypt, stdout=subprocess.PIPE, shell=True).communicate()

os.remove(static + '.7z')
shutil.rmtree('__pycache__', ignore_errors=True)

# Decrypt gpg --batch --passphrase INSERT --output backup.zip --decrypt
# FILENAME.BACKUP

What I the advice i need is ways to make it more efficient. I just went with a subprocess because its easy to work with and i have all of the software installed.

im also wondering if it wouldent be better to just create a veracrypt container and just do, if container exists, go to next else create container.

thoughts?
>>
>>60592703
I fucked up the [/code] tag

What I the advice i need is ways to make it more efficient. I just went with a subprocess because its easy to work with and i have all of the software installed.

im also wondering if it wouldent be better to just create a veracrypt container and just do, if container exists, go to next else create container.

thoughts?
>>
Anyone know why this unhash dosent produce the original of hash()?
function hash64(n:uint):uint
{
n = (~n) + (n << 21);
n = n ^ (n >> 24);
n = (n + (n << 3)) + (n << 8);
n = n ^ (n >> 14);
n = (n + (n << 2)) + (n << 4);
n = n ^ (n >> 28);
n = n + (n << 31);
return n;
}

function unhash64(n:uint):uint
{
n = (~n) - (n >> 21);
n = n ^ (n << 24);
n = (n - (n >> 3)) - (n >> 8);
n = n ^ (n << 14);
n = (n - (n >> 2)) - (n >> 4);
n = n ^ (n << 28);
n = n - (n >> 31);
return n;
}
>>
>>60592718
>why can't I reverse this hash
Gee anon I don't know
>>
heres a meme i made
>>>/asp/.net
haha get it xd
>>
What data structure would you use to represent the universe?
>>
>>60592726
No need to be a dick about it
>>
>>60592746
class Mistake {
bool yes = veryyes;
}
>>
>>60592746
really activated my almonds
>>
>>60592755
Maybe it's because hashing is meant to be irreversible by design.
>>
>>60592746
a linked list
>>
why aren't we working to convert our consciousness into a robot body so we become immortal yet?
>>
>>60592718
Because by hashing you might you are usually removing information.
>>
>>60592776
>have to iterate over all stars in the universe to find the sun
>>
>>60592780
your soul is immortal
>>
>>60592796
my body isnt
lets fix that
>>
>>60592718
>> and << are information (or data? my english is bad) loosing operation, like the modulo operation.

for example, if i tell you

f(x) = x % 10


and
f(n) = 3


was n 3? or 13? or 103? or 133? or 1184239873?

there no way to know because you lost information in the application of the operation. In mathematics, i think they call that an one-way function. this is the fundamental principle for hashing -> one way reduction of information.

now, you can try to find a collision, which is not the same thing as reversing a hash. in this example you simply find a collision by doing

fcol(x) = x


because

f(n) = fcol(n)


for any n

never forget that.
>>
>A
>B
>C

How to guarantee that C will always happen after A and B, considering compiler and cpu reordering?
>>
php looks fun first lesson today
>>
>>60592805
'Fix' is the wrong word
>>
File: albert-camus.jpg (31KB, 470x316px) Image search: [Google]
albert-camus.jpg
31KB, 470x316px
>>60592805
That's a feature, not a bug.
>>
>>60592806
made a mistake: should have wrote
f(n) = f( fcol( f(n) ) )
, sorry.
>>
>>60592820
They will always happen in that order.
>>
>>60592820
Fence instructions or atomic operations
>>
>>60592820
Memory fences.
>>
>>60590740

Bullshit. It doesn't take into account nonbinary genders, including those that happen off the spectrum entirely

:^^^^^^^)
>>
>>60592828
ok lets move my soul to another container that doesnt die
why are we humans even doing pointless shiit like wars political shiit talking about gender studies when we could try and become immortal
>>
>>60592849
Step 1) Understand you are retarded
Step 2) Get in touch with reality
Step 3) Abandon your foolish idea
>>
>>60592820
cpu reordering is irrelevant since is shall be transparent, otherwise it's flawed.
compiler reordering is dependent of the language semantics.
>>
>>60592861
everything is pointless if we die
lets fix that and maybe the rest of the shiit we do can have meaning
>>
>>60592872
It's rather the opposite actually
>>
>>60592877
:thonking:
>>
>>60590586
Source
>>
>>60592870
> cpu reordering is irrelevant since is shall be transparent, otherwise it's flawed.
Wrong, it's important for atomic operations, this is why the mfence instruction exist in every modern ISA and C/C++/Rust have the notion of memory ordering: http://en.cppreference.com/w/cpp/atomic/memory_order .
>>
>>60592872
> everything is pointless if we die
It's the other way around, noting is meaningful if you're immortal anyway.
>>
>>60592938
well at least having a choice would be better
>>
>>60592944
Choice takes the meaning out of life
>>
>>60592944
>people should live until they're bored enough to kill themselves
That's quite depressing world you're trying to build.
>>
>>60592927
mfence is for parallel threads; it's not about reordering, it's about cache issues.
>>
>>60592824
i take that back the syntax can go suck a dick
>>
What the fuck is Google Web Toolkit?
Is it still a thing or it is dead.
>>
>>60593025
it's a java to javacript compiler. it still massively used by google.
>>
>>60592978
>mfence is for parallel threads
Well yeah, instruction reordering is transparent when you have a single core.
>it's about cache issues.
No, it's not about the cache, if you update values in some order in your cache the updates will be visible in the same order from the other cores because the cache itself doesn't change the ordering.
>>
how do i insert code in 4chinz in that white thing
>>
struct A {
A(B &b) : b(b), b1(b) {}
~A() { b = b1)

B &b;
B b1;
}

struct B {
int c;
}

B b = {1};

extern void use(B b);

void func() {
A(b);
b.c = 2;
use(b);
}


Is this insane? Will this get murdered by -O2?
>>
>>60593062
Why do you have to write shit in such a complicated way? It' just for experimenting i hope.
>>
hows this https://www.esc.edu/
>>
[ code ]
your text here
[ /code ]

Only on supported boards.
>>
>>60593102
>>60593053
>>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
print("<table><tbody>");

for ($i=1;$i<=10;$i++)
{
$cube = $i*$i*$i;
print("<tr><td>$i</td><td>$cube</td></tr>");
}

print("</tbody></table>");
?>
</body>
</html>


why doesnt this show a table when i open it
>>
So are there any programmers in this thread?
Not "coders", but actual programmers.
>>
I'm learning Swift. It's the first time I've encountered optionals. What's the point of all this extra syntax and unwrapping and nonsense? Why not just check if your value is nil and move on?
>>
What's the point of char over string with 1 member?

Just makes everything harder for no reason.
>>
>>60593277
>I'm learning Swift
Stopped reading right there.
>>
>>60593320
Wut

If you want to develop in the Apple ecosystem what other choice do you have
>>
>>60593280
(((performance))))
>>
File: 1495716144204.jpg (3MB, 3872x2592px) Image search: [Google]
1495716144204.jpg
3MB, 3872x2592px
>>60593277
>mfw his language has nil/null
>>
>>60593326
>""develop"" in the Apple ecosystem
Wrong.
>>
>>60593326
>Wut
Use >>>/g/wdg/ instead
>>
File: 1369677382026.png (188KB, 500x276px) Image search: [Google]
1369677382026.png
188KB, 500x276px
>>60593331
>mfw his language is made by Simon "Cuck" Jones
>>
File: 1458588190310.jpg (37KB, 348x342px) Image search: [Google]
1458588190310.jpg
37KB, 348x342px
>>60593345
What ""language""? Huskell isn't a ""language"".
>>
>>60593320
>>60593332
>>60593338
Why is everyone so hostile to Swift? Is there a meme I'm missing or something about the language I'm not seeing?
>>
>>60593378
>apple ecosystem
>>
>>60593378
Swift is actually a decent language, but the problem is, the average Swift programmer is a retard with a background in webdev or app-dev.
>>
>>60593378
>Learning to landscape for a walled garden
>>
>>60593378
>meme
I don't want reddit stink nearby. Piss off.
>>
>>60593394
>web"""dev""" and app-"""dev""" are somehow dev
>>>/g/wdg/
>>
>>60593414
That's my point exactly.
>>
>>60593041
Sometimes cores have their own caches anon.
>>
File: cover.jpg (342KB, 1920x1080px) Image search: [Google]
cover.jpg
342KB, 1920x1080px
How hard would it be to program this in C++? It's a mod organizer for Rome II: Total War, and it sets the loading priority of mods based on user preference. I want to get this working on Warhammer:TW, but I'm not sure how easy it'd be to port this. Thoughts?

https://sourceforge.net/p/twmodmanager/code/HEAD/tree/TWModManager/TWModManager/
>>
>>60593401
It's not like I get to choose the platforms my company wants apps for. Someone has to program these in Swift, right?
>>
>>60593126
>open it
In your browser? Browsers don't interpret php, it's not their job. It's a server-side language. If you want to test your pages, you will have to set up the php interpreter somehow.
>>
>>60593423
Ask on >>>/vg/agdg/
>>
>>60593419
I know, m8, still caches by themselves don't reorder anything.
>>
>>60593453
>>60593423
do you know why he chose C# over C++?
>>
>>60590586
s-source?
>>
pls help:

I needed to generate tables in html using data from 3 lists in python. How do I do this?

Each list has title, location and image that match up to each other because of their place in the list.

These 3 pieces of data needs to go into a box on the table.
>>
>>60593609
>>>/g/wpg
>>
>>60593614
?
thought this would be the most appropriate thread
>>
>>60593261
Yes, what the fuck do you want?
>>
>>60592746
A fucking graph you ning nong strawberry tard fuck.
>>
>>60593639
>>60593609
an answer to this question if you please
>>
>>60592718
The whole fucking point of a fucking hash is to fucking make it hard to get the original fucking information out. FUCK.
>>
Want to learn Lisp.

I need a quick rundown on Common Lisp.
Or should I go with Scheme?
>>
>>60593609
Do it step by step. Yattag or some shit for the html-generating part. Treating thr lists if you are asking that means you haven't even tried.
>>
>>60592703
It's hard to make that more efficient, friend. You could concat the files together, create a header of each starting point and filename, that way the subprocesses can just encrypt one entire block..?
>>
>>60592566
Yes, 40.

>>60592505
I'd say that some blog posts that show you cool features of the language, especially when learning about a language like Python or Golang, can help a bit... bit to a limited extent.
>>
>>60593665
Both are severely outdated and practically dead, the only more or less alive lisps right now are Clojure and Racket.
>>
File: bigloo.png (145KB, 1906x976px) Image search: [Google]
bigloo.png
145KB, 1906x976px
>building it is simple:
FUCK
>>
>>60593692
>bigloo
Is this indian software?
>>
>>60593692
>bigloo
Is this a meme?
>>
>>60593697
No it's french made Scheme compiler.
>>
>>60593609
>>60593650
All programmers hate twiddly string manipulation problems. But for the fucking sake of it. Do you want a HTML table that has a row for each 3 elements, where each 3 elements is in a separate column... or? What is teh layout?
>>
>>60593688
Shame.
>>
>>60593715
I need a HTML that has two columns, with a row for each 3 elements. As in [1] in the 3 lists are together.
>>
>>60591745
Dude. Use a standard hash function like SHA256. Anything from the SHA-2 family. You would be fucking retarded to implement your own or someone elses. SHA2 hashes on ANY language are the fucking same.
>>
>>60593728
HTML table*
>>
>>60591735
What's the third gender? Other?
>>
>>60593723
The Common lisp compilers are actively maintained.
The next big thing is going to be Common lisp with easy interface to C++.
https://github.com/drmeister/clasp/tree/dev
ECL can inline c++ and there was just qt5 bindings made for it.

Also the commercial compilers(lispworks, allegro cl) have recently made you able to compile for mobile platforms.
>>
>>60593728
What's in column 1 and what's in column 2?

Is column 1 the title and location, and column 2 the image? ...?
>>
>>60591735
>not a four dimensional vector
bigot detected
>>
waiting for new thread to post my shit, come on
>>
>>60590675
This is true. You just have to look at the female computer science students. They struggle to comprehend a simple concept like reading from a file. There are exceptions though.
>>
new thread when? :3
>>
>>60593979
After 310 posts.
>>
>>60593985
gotta shitpost more
vim > emacs
>>
>>60594002
Agreed.
>>
>>60594002
Seconded
>>
>>60594002
spacemacs > ((vim + emacs) * vs-code )^sublime
>>
>>60594019
Spotted the cunt who can't python.
>>
File: Screenshot_2017-05-26_14-39-00.png (8KB, 368x111px) Image search: [Google]
Screenshot_2017-05-26_14-39-00.png
8KB, 368x111px
Anyone knows how I can remove on of the line in my vim?
The area where you type your commands is 2 characters high
>>
>>60594019
Why are you XOR'ing with sublimetext?
>>
>>60594019
Since vs-code = 0, spacemacs > 1 which is better than nothing I guess.
This doesn't tell use the value of vim tho
tl;dr, your argument is shit, neck yourself
>>
New thread:
>>60594100
>>60594100
>>60594100
>>
>>60592905
>>60593560
Himegoto. Subs aren't from the anime though.
>>
>>60594071
It's not on a sane machine. Try
vim --noplugin
and see if it's still big.
Thread posts: 313
Thread images: 50


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