[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: 319
Thread images: 29

File: cppmap3.jpg (3MB, 3840x2555px) Image search: [Google]
cppmap3.jpg
3MB, 3840x2555px
What are you working on, /g/?

Old thread: >>59078314
>>
>>59084645
first for pascal
>>
>cpp at all
Get a load of this fag.
>>
Third for C is a miracle of this universe.
>>
>>59084661
*Rust
>>
>>59084668
That would be anime.
>>
File: normal.jpg (11KB, 447x294px) Image search: [Google]
normal.jpg
11KB, 447x294px
Really really really basic 3D question. I have
* a 3D position, P
* a direction vector, D
* a length, L

I want to calculate P', which I define as the result of moving P, L units, in direction D.

Imagine I want to draw a line showing a triangle's normal for debugging reasons. (This isn't exactly what I'm doing, but it's analogous.) P is the centre of the triangle, D is the normal, and L is an arbitrary number.

I think I can do this by creating a full-on 4x4 transformation matrix out of the required rotation specified by D and a translation specified by L, and multiplying P by this matrix. That really seems like overkill, though- surely there's a simpler/faster way to determine P'x, P'y, and P'z given Px, Py, Pz, D, and L?
>>
>>59084710
_Dude, it's just P + L * Dn, where Dn is normalized D, i.e. D * 1/|D|.
>>
>>59084724
Thanks. I feel like that should probably have been obvious to me... I'm very new to 3D work.
>>
File: 75810h5a2ft2.jpg (220KB, 1920x1080px) Image search: [Google]
75810h5a2ft2.jpg
220KB, 1920x1080px
if you don't dress like this you aren't a real programmer
>>
File: fact.jpg (938KB, 4000x751px) Image search: [Google]
fact.jpg
938KB, 4000x751px
>>59084680
>>
>>59084746
>>59084710
>>59084746
NP, that's what normalized vectors are for: representing a direction in a way that's easy to apply.
>>
> And instead of JS, we'd be stuck with C++. Not an improvement.

HN at its finest.
>>
>>59084775
That's correct though.
As shit as JS is, C++ is definitely worse.
>>
>>59084748
if you don't wear a lab coat you aren't a real programmer.
>>
>>59084790
If I shouldn't have learned c++, what should I have learned?
>>
>>59084813
C, I suppose.
>>
>>59084813
JS
>>
I've been learning web development on the side of my current job and college, and, as projects, have made websites for local restaurants that have no/very bad websites. I'm not hoping to make much money on these, but, what would be best for approaching these businesses and presenting what I've made to sell to them? Any other advice regarding this?
>>
If I'm writing a script in python that I'll put in my path should I just remove the .py?
>>
>>59084854
hey mate that's pretty cool

how much do you get paid for making the restaurant sites?
>>
>>59084854
use squarespace and tell nobody that you're using squarespace
>>
>>59084933
Oh, what I meant is that I've been making these websites for local businesses without their knowledge, as a sort of exercise material. I haven't even approached them yet.

I was just wondering how much I ought to ask for, and how to approach it.
>>
useful tip of the day:
you can find the address of your code by calling a pop instruction:
    call .a
.a: pop eax
; now eax contains the address of the previous instruction
>>
>>59085055
>find the address of your code
Why would that be useful?
>>
Why do I feel like shit all the time, I feel like I have constant cold, anyone else experience this?
>>
>>59085055
If you're going to do that in C, make sure to push it again or else everything will break.
>>
>>59085087
go to the doctor and tell him this
>>
which linux distro should i get to run in virtualbox for the purpose of learning c?
>>
>>59085149
Gentoo. I'm serious.
>>
>>59085086
writing position-independent code
>>
>>59085168
could you further explain pls daddy
>>
>>59085087
Are you me?
>>
>>59085149
it doesn't matter
>>
>>59085087
d e p r e s s i o n
>>
>>59085189
>>5908518
>>590851891
>>
Why is the compiler giving me that error?
import std.stdio;
import std.algorithm;
//take an array, sort it and reverse it
void main(){
write("Enter the number of values you want to store: ");
int len;
readf(" %s", &len);
int[len] ins; //<-- variable len cannot be read at compile time

int i = 0;
while (i < len) {
write("\nEnter value no.", i+1, ": ");
readf(" %s", &ins[i]);
i+=1;
}
writeln("The array is: ", ins);
sort(ins);
writeln("Sorted array: ", ins);
writeln("Reversed array: ", reverse(ins));

}
>>
>>59085087

allergies, lack of sunlight exposure
>>
>>59085183
say you have a function you want multiple copies of at runtime
each function has its own local data located nearby, at a fixed offset from your code
so you find the address of your code, add the offset and now you have a pointer to the local data structure
>>
>>59085220
use D's equivalent of malloc instead
>>
>>59085189
alright

can somebody recommend a linux crash course? i've never used it before.
>>
>>59085220
D doesn't support VLA's
Use
int[] ins = new int[len];

unless you need it on the stack for some reason
>>
>>59085149
Ubuntu MATE
>>
>>59085314
Explain this to a CS101 class as their first day on arrays
>>
>>59085437
I don't understand, what do you want me to explain exactly?
>>
>>59085314
>using a stack at all
>>
>>59085601
I HAVE ONE WORD FOR YOU
STATIC ALLOCATION OF PROCEDURE ACTIVATION RECORDS
THREAD OVER
>>
Any good books for cracking? hacking software and exploits
>>
>>59085282
when you want to do something, google how to do it. like if you're in the console and need to switch directories, google how to do that. the command "man ___" will bring up the manual page for ___ if one exists. i've used linux for 2 years and just today i learned xdg-open opens the gui file viewer for a directory. e.g. xdg-open . to open the current directory, because . is the current directory. it's a lot of fun, using linux. you get more productive as you keep using it
>>
>>59085437
not >>59085531 but arbitary size arrays are not allowed to be stored on the stack, as all variables stored on the stack are on predeterminied offsets from the base pointer, The only place you are allowed to store variable length arrays is on the heap, to do this you initialise an int array of a length on the heap, and then store a pointer to it on the stack.
>>
>>59085220
myfun x = reverse $ sort x
>>
>>59085738
this can be just
 myfun = reverse . sort
because of currying
>>
>>59085735
just have the stack reform itself at double the size when it hits max capacity and someone tries to push to it
>>
>>59085755
you mean because of eta reduction

myfun x = (reverse . sort) x
myfun = reverse . sort
>>
>>59085755
λ> import Data.List
λ> let myfun = reverse . sort
λ> let x = [2, 5, 3, 2, 1, 7, 4, 3, 8, 4, 5]
λ> myfun x

<interactive>:20:7:
Couldn't match type `Integer' with `()'
Expected type: [()]
Actual type: [Integer]
In the first argument of `myfun', namely `x'
In the expression: myfun x
In an equation for `it': it = myfun x
λ>
>>
>>59085735
You can't grow a stack variable, but it definitely can be of arbitrary size
>>
>>59085738
Really, it could just be
ins.sort().reverse();

in D
>>
what does static keyword mean in programming?
>>
>>59085784
works on my machine
Prelude Data.List> wew = reverse . sort
Prelude Data.List> wew [1,2,3]
[3,2,1]
Prelude Data.List> wew [1,2,3,4,5,65,23,234,242,24,23,42,64]
[242,234,65,64,42,24,23,23,5,4,3,2,1]
>>
>>59085826
Whatever the language wants it to mean
>>
File: loli_forcing_her_way.webm (966KB, 1280x720px) Image search: [Google]
loli_forcing_her_way.webm
966KB, 1280x720px
>>59085826
usually, static environment (vs. dynamic environment).
>>
>>59085826
Google it

$"static {lang}"
>>
Are partition tables and file systems on x86 computers always stored in little-endian byte order?
>>
File: 1479219500380.gif (2MB, 400x225px) Image search: [Google]
1479219500380.gif
2MB, 400x225px
>he doesn't have the based "secondary stack"
>>
what took me an hour to set up on windows has taken me a grand total of 2 minutes to set up in ubunto because i could just apt-get install all the c libraries i needed

why can't windows have apt-get install
>>
>>59085965
>why can't windows have apt-get install
It does.
>>
is left-shifting a signed integer ok as long as it doesn't overflow arithmetically?

this is not ok:
int foo = INT_MIN;
int bar = foo << 1;


but is this ok?
int foo = -1;
int bar = foo << 1;
>>
>>59086031
>Bit shifting a number
>>
>>59086109
if i multiply a signed int by a power of 2 will the compiler optimize it into a bitshift on relevant architectures?
>>
>>59086155
yes, as long as you multiply by a const value
>>
>>59086174
cool thanks
>>
>>59086031
Sure.
>>
Script to rename file with random 4chan filename.
#!/usr/bin/env python
import os, sys, random

if len(sys.argv) != 2:
sys.exit("usage: 4chrename file")
old = sys.argv[1]
dir_path = os.getcwd() + os.sep
if not os.path.isfile(dir_path + old):
sys.exit("not a file")
i = old.find(".")
ext = old[i:] if i != -1 else ""
start = 1401427584643
end = 1487817132668
new = "{}{}".format(random.randint(start, end), ext)
while os.path.exists(dir_path + new):
new = "{}{}".format(random.randint(start, end), ext)
os.rename(dir_path + old, dir_path + new)
print "{} -> {}".format(old, new)
>>
i installed mingw so i can compile for windows from linux, how do i add libraries to mingw?
>>
>>59086387
git
>>
>>59085613
I want /prog/ back on 4chan.
>>
>>59084645

c++ 11 = patrician

c99 is ok too
>>
File: c-jesus.jpg (95KB, 350x498px) Image search: [Google]
c-jesus.jpg
95KB, 350x498px
allow me to interject for a moment

>The C language is my shepherd; I shall not want.
>He makes me lie down in reading manuals. He leads me beside mature libraries.
>He restores my stdout. He leads me in PATHs of POSIX for his name's sake.

>Even though I walk through the valley of the shadow of bloat,
>I will fear no C++, for you are with me; your structs and your unions, they comfort me.
>You prepare a triple dereference and increment before me in the presence of Rust fanboys;
>you anoint my head with pointers; my stack overflows.

>Surely malloc and goto shall follow me all the days of my life,
>and I shall dwell in the house of the Embedded forever.
>>
zedshaw 781 days ago [-]

Well this if fun folks, but frankly, you all have proven just how conservative programmers are. My chapter advocating something as "revolutionary" as including the lengths of strings when you process them has received more hate mail than anything I've written. And I'm the guy who gets death threats because I don't like Ruby.

If you are reading this and saying, "This guy's wrong about including the lengths of strings!" Then I ask: Why are you using any modern language? Nearly every language in use today include the lengths of strings and backing buffers in their string implementation, and you all use it and appreciate it, but when I advocate it suddenly it is heresy and deserving of vitriol.

I personally don't care what you all think, which I know insults your pride at being the smartest people in the room, but until you are willing to admit that your hatred of that chapter is based entirely on nostalgia and not on the merits of my fairly simple claim that K&R (or any) C code is error prone, then you are not going to advance the state of the art any further than the 1970s.

This is what makes me sad about computing today. You are all desperately clinging to the notion that you are radical free thinking futurists while you desperately cling to reverence for the past and are incredibly resistant to any change. If something as simple as a thought experiment to look objectively at how things are done and try something better makes you angry, then you are not free thinking futurists.

Anyway, enjoy your day folks. I'm going to go do some painting.
>>
>>59086483
Me programming! Which way shall I fly
Infinite wrath and infinite despair?
Which way I fly is /prog/; myself am /prog/;
And in the lowest /dpt/ a lower /dpt/,
Still threat'ning to devour me, opens wide,
To which the /g/ I shitpost in seems a heaven.
>>
>>59086483
>LANGUAGE-IMPOSED ALIGNMENT OF SOURCE CODE TO PREDEFINED SPATIAL BOUNDARIES
>>
>>59086568
He's right, Forth and Pascal had it right back in the 1970's.
>>
so how do i get python to open a webpage ? in my calculator program i want it open to a youtube video when the user inputs something wrong
>>
> http://www.yegor256.com/2017/02/21/say-no-to-google-recruiters.html
> expert in object oriented design
> doesn't know how to traverse a binary tree

really fires up your neurons
>>
>>59085011
help this nigga out i guess
>>
Write me a c# program with a method that counts the letters in a word
>>
>>59086757
string.Length
>>
>>59085645
oh shit, cool
>>
>>59086648
nvm i figured it out
>>
>>59086964
what was the answer
>>
>>59087006
import webbrowser
webbrowser.open("insert url")

no indentation needed for the second line
>>
any bash options i should enable when writing scripts besides the ones here?

http://redsymbol.net/articles/unofficial-bash-strict-mode/
>>
>>59084831
>>59084833
Too late
>>
>>59087047
hmm its returning a boolean for me... Python 2 or 3?
>>
>>59085220
You fucking whore
>>
remember when i said that linux was great

i take that back, i'll just use mingw
>>
>>59086597

ONE WORD
THE FORCED INDENTATION OF CODE
THREAD OVER
>>
>>59087132
nevermind, just realized you have to add http:// first
>>
>>59087143
That was VIP quality!
>>
>>59087137
Run mingw on Linux, test with Wine.
>>
How do i make python quit?
lets say i made it print " Would you like to continue? (Y/N)" and then the user presses "N". How would i make it quit the program?
>>
>>59087445
just let the control flow reach the end of the file
or call sys.exit()
>>
>>59087445
sys.exit()
>>
>>59087530
>>59087523
thanks
>>
>>59087445
1. exit()
def get_command_from_user():
x = raw_input('Command>")
if x in ['n', 'N']:
exit()
# ...


2. return (if context is __main__)
if __name__ == '__main__':
x = raw_input('Command>")
if x in ['n', 'N']:
return 0
# ...


3. set loop condition to false (if in a loop)
running = True
while running:
x = raw_input('Command>")
if x in ['n', 'N']:
running = False
# cleanup code
>>
>>59087121
You wasted your time.
C and JS are shit.
>>
>>59087554
What would you recommend instead? Give 2 recommendations.
>>
>>59084813
You should learn a completely useless esoteric language known only to neckbeards on the internet, so as to impress said neckbeards. AKA Haskell
>>
>>59087567
Rust and Haskell
>>
>>59087570
b r a i n l e t
>>
why would you learn a slow language that can't do everything you want when you can also learn a fast language that can do everything you want
>>
>>59087576
Done. Next?
>>
how to i send eof to a msys2 bash prompt thing
ctrl+z just quits the program
ctrl+d does nothing
please help
>>
>>59087662
type in "hacker-command send eof"
>>
>>59087662
alt-004
btw ctrl-z sends a program to the background
>>
>>59087662
google, you worthless piece of shit
>>
>>59087682
I think Crtl-z does EOF on Windows
>>
>>59087717
i have, nothing works
>>59087725
ctrl-z is eof in the normal command line but not in msys2
>>
File: BjarneStroustrup.jpg (44KB, 432x324px) Image search: [Google]
BjarneStroustrup.jpg
44KB, 432x324px
>>59084748
Why are his legs so long?
>>
>>59087785
cause he's strouscuck
>>
What's your opinion on gradients in GUI?

Personally i don't like them.
>>
>>59087907
Personally i don't like you.
>>
whats the best solution to read a directory of files and do stuff with them? each time i hit next or back on my program it reads through the entire list each time making it slow
>>
File: 1459903454109.jpg (77KB, 854x576px) Image search: [Google]
1459903454109.jpg
77KB, 854x576px
>>59087950
b-b-bully
>>
>>59087965
something like what a treeview is doing
>>
looking for a secondary language to explore, have only done backend development in my career so far. Should I pick python or javascript?
>>
>>59088089
>python or javascript
wouldn't call that a language.
>>
>>59088124

let me guess, you want me to fall for the C/Go meme
>>
>>59088202
> mentioning C in one sentence with Go
look at this heretic
>>
>>59088089
Are you a boy?
>Python

Or are you a man
>http://www.ada-auth.org/standards/12rm/html/RM-0-4.html
>>
or if you are transgender or lgbt, go ruby
>>
File: code.png (30KB, 1347x660px) Image search: [Google]
code.png
30KB, 1347x660px
>>59087551
so every time i program it to quit , it wont quit.

pic related is my code before i tried to program it to quit. ill post the rest of the code after this one
>>
File: code2.png (23KB, 583x584px) Image search: [Google]
code2.png
23KB, 583x584px
>>59088269
>>
>>59088234
>>59088224

i kinda dont even know why im asking. even if i learn new shit my managers literally are just bullshitting chatting about movies and sports and don't give a shit about deploying anything new or adding features. i'd transfer contracts but the pay is too good to pass on
>>
>>59088234
Like that one girl that posts here?
>>
>>59088283
> he fallen for the golden collar meme
>>
File: tfwuagrl.jpg (165KB, 912x657px) Image search: [Google]
tfwuagrl.jpg
165KB, 912x657px
>>59088319
tfw you are a girl and didn't tell anyone on the internet about it for 5 min
>>
>>59088224
>>http://www.ada-auth.org/standards/12rm/html/RM-0-4.html
T H I C C
>>
>>59088202
>fall for the x meme
>reddit spacing
who would've thought.
>>
teach me to program
>>
>>59088326
see >>59088424
>>
Question: if scheme function definitions are just sugar for making lambdas, how does it accomplish named recursion?
>>
>>59088438
>named recursion
What?
>>
File: you-shall-deal-with-it.jpg (26KB, 500x364px) Image search: [Google]
you-shall-deal-with-it.jpg
26KB, 500x364px
>>59088437

> he shall deal with it
>>
>>59084671
Should I fall for the Rust meme? I'm a SJW so I feel like I'm expected to, but C seems so much simpler and more straightforward.

>>59084790
Enterprise C++ is definitely worse, but clean C++ that doesn't use any more features than you actually need is arguably better than C.

>>59084912
Are you using Windows? If so, you should probably leave the extension on the file, because I'm pretty sure Windows depends on that to find the appropriate interpreter, rather than using hashbang syntax. You'll also need to make sure that .py is in your PATHEXT environment variable (though the Python interpreter may have set that when you initially installed it). Not sure if the file extension is necessary under Unix, but it's probably a good idea anyway just to help with organization.

>>59085220
Regardless of where in the function block a variable is declared, the sizes of all local/auto variables must be known at compile time so the compiler can generate appropriate code. You should really use dynamic memory allocation in this case.

>>59085437
The first lesson on arrays shouldn't involve arrays sized based on user input anyway.

>>59085601
How do you plan to store return addresses and local variables, then?

>>59085826
In C it has multiple meanings depending on context.

If used to declare a variable inside a function, it means that variable is not reset between calls of that function, in effect it makes it a global variable that can only be accessed within the function. It's useful for impure functions that need to store some kind of internal state between calls.

If used to declare a function or global variable, static means it isn't visible outside of the current "translation unit" or file. It's mainly used for variables and functions internal to a library, that you don't want external code to be able to interact with.

In C++ and Java, a static function or variable declared inside the class means it is shared between all objects of that class.
>>
>>59088607
Fuck off back to your subreddit.
>>
>>59088607
>impure functions
This is impossible by definition.
>>
>>59088607
Jesus fucking Christ
>>
>>59085895
Not sure but probably, x86 does pretty much everything little-endian.

>>59086020
Windows 10 doesn't count.

>>59086483
Same.
>>
>>59088627
Which one?

>>59088650
Not if you're using ``function" the way it's defined in C.
>>
>>59087965
save the directory tree and only update it if a file/directory access goes wrong
>>
>>59087907
They look like crap and lower contrast. Just like transparency in GUI elements. 1px border shadows are barely ok, I'd guess.
>>
>>59088627

fuck off back to africa
>>
>>59088686
It's still impossible. How C defines it doesn't somehow alter the impossibility of it.
>>
What is the first argument here?

https://www.khronos.org/registry/OpenCL/sdk/1.2/docs/man/xhtml/clCreateFromGLTexture.html

Does this mean I have to go back and create a OpenGL context without using GLFW
>>
>>59086568
Every dog has its day.
>>59087785
quick, post the version with six monitors
>>59084760
this
>>
I tried the tutorial on "Extending a C program with Guile" - https://www.gnu.org/software/guile/docs/guile-tut/tutorial.html
I'm not sure what to make of it. Having to write extra code in C just to let it be called more naturally from Scheme rubs me the wrong way, I'm a believer that the C should be gospel and the higher language using C code should be responsible to wrapping/unwrapping as necessary -- classic FFI in other words. I suppose on the positive side, I can now call Scheme functions from C.
>>
>>59088783
What C calls a ``function" can exhibit what functional programmers call ``impure behavior", i.e. side-effects and not being guaranteed to return the same value when called with the same arguments.
>>
>>59088785
Just retrieve the current context
>>
How can I find the length of an array without using strlen or converting to a string. I basically need to figure out length without using any library function.
>>
>>59088865
>What C calls a ``function"
A function by definition can't be "impure".
>what functional programmers call ``impure behavior"
What does this have to do with functional programming? Also it's called not being referentially transparent, not "impure behavior".
>>
>>59088910

how
>>
de
>>
>>59088928
In C/C++, you can try sizeof(arr)/sizeof(arr[0]). But this ONLY works in the function the array was declared in, arrays decay to pointers when passed to functions, so there's no way to determine the size from within such a function.
>>
>>59086568
Poor Zed, never was able to light fire twice was he? Didn't help that he got sucked into GPL licensing fascism.
>>
is the result of compiling c in a c++ compiler equivalent to the result of compiling c in a c compiler?
>>
making a single linked list, double, and binary tree in c++ for my algorithms class. feel free to do it for me if bored
>>
>>59089074
Try it and find out - change the compiler to that swanky emit assembly mode, where it includes both the source line and the assembly, then diff? Could be fun.
>>
>>59089119
sent :^)
>>
>>59089124
that's too much work, i just want to know if i can write c in visual studio so i can have intellisense

wait nvm, i can just write it in vs and compile it with gcc

i'm a genius
>>
>>59088982
but I can't use the sizeOf function, cause it's built in. :S
>>
>>59089204
Just remember not to write in modern C style, quite a bit of that isn't supported by C++.
>>
>>59089212
Then there's no real way of doing it. You'll have to keep track of array sizes yourself, I suggest using #define constants for statically allocated arrays, and using mutable variables to store the current allocated length of heap arrays.
>>
File: buildthewall.png (186KB, 1119x849px) Image search: [Google]
buildthewall.png
186KB, 1119x849px
umm, /dpt/, somebody wrote an article about me

http://www.omgubuntu.co.uk/2017/02/nuclear-music-player-desktop-youtube

what do I do now? inb4 reddit formatting
>>
>>59089281
>mutable variables
I don't use them.
>>
>>59089296
be rich, famous, build a mansion on hawaii, etc
>>
>>59089296
>umm
>>>/r/abbit
>>
>>59089296
Buy 4chan from Hiro and save us from Reddit
>>
>>59089409
i'm just gonna detect reddit cookies on page load and autoban ips
>>
// works fine no problems
std::thread t(some_func);
t.join();

// blows up segmentation fault panic dude boom lmao
std::thread t(some_func);
t.detach();


it's important that some_func() not block execution, I need it to run async in the background but C++ isn't having my shit.

>inb4 use boost
>>
>>59089434
No. Wait for them to post and then make it a public execution
>>
someone cloned my shit
>>
>>59088928
>>59089212
what are you even doing you gay fag

>>59089300
???
>>
>>59089454
that's why you git gud and make good shit that can't easily be cloned with the same quality
>>
File: what.jpg (17KB, 384x313px) Image search: [Google]
what.jpg
17KB, 384x313px
Are there any good graphics programming books? I don't mean tutorials teaching me how to draw a triangle in OpenGL. I mean, are there books that will teach me the terminology of graphics programming? I'm walking around and listening to people talk about global illumination, raycasting, and bump mapping and I slowly nod my head while pretending to understand half the stuff they mean. Later I'll look it up and kind of sort of understand it, but I feel like they're getting this shit from somewhere. Where can I go just to learn all this shit on a superficial level? I don't want to be the guy that goes to a graphics lecture and not understand half of what the person is talking about.

I mostly need to know because I want to learn Vulkan (not for any immediate work, but just for the sake of having knowledge) and I have a feeling I won't understand a goddamn thing anyone is talking about. Command queues, validation layers, asynchronous what the fuck are you saying? Please, I don't want to be left out of the secret club. :(
>>
>>59085149
lubuntu
>>
>>59089477
You said I should use mutable variables. They are something which I do not use.
>>
>>59089502
How good is your maths?
>>
>>59089490

they cloned my shit on git, dimwit
>>
>>59089546
Last math course I've taken is calculus III (aka vector calc) and I'm getting my PhD in biostatistics. So I think it's """okay""".
>>
>>59084645
Every language is really a variant of Lisp.
>>
>>59089520
kys
>>
>>59089579
so you got a (You) on the computer nerd version of facebook
>>
>>59089589
No linear algebra? That usually happens after calculus around here.
>>
>>59089641
Calculus III had the prerequisite of linear algebra (need to know how to do math on matrices to do vector calc).
>>
>>59089589
That should be enough.
Computer Graphics: Principles and Practice. Read this. But if your maths isn't up to par read this Vector math tutorial for 3D Computer Graphics.
>>
>>59089618
What does this mean? Is this some new reddit meme?
>>
>>59089691
I already have that book, and I'm reading through it. Thanks for the recommendation though.
>>
>>59089728
>What does this mean? Is this some new reddit meme?
>>
>>59089730
Yeah. I do computer vision so our paths aren't exactly similar but I have to know the basics of computer graphics since I work on AR stuff.
>>
>>59089296
congrats bro
>>
>>59089728
(You)
>>
>>59089740
What are you even on about?
>>59089797
Nice post.
>>
>>59089877
stop replying to this faggot he's a shitposter "pretending" to be autistic
>>
So I'm dealing with an RSA1024

I have an already-encrypted 1024 integer and its associated plain text

I have the public exponent and the modulus.

I know it would probably take thousands of billions of years to get the private keys again but theoretically how would a brute-force do this?

Testing every prime number combination p and q and checking against the decrypted message for if it's equivalent? Does a program like this already exist out there.
>>
>>59089951
install gentoo
>>
>>59089922
Why is he pretending to be autistic?
>>
>>59089951
Use a ternary operator.
>>
>>59089951
epic shitpost. nice job, bro
>>
File: java paje.jpg (127KB, 600x894px) Image search: [Google]
java paje.jpg
127KB, 600x894px
>le Java meme
>>
>>59090002
stop posting your garbage """"""""languages"""""""" here. fuck off.
>>
File: ms shill.jpg (121KB, 500x358px) Image search: [Google]
ms shill.jpg
121KB, 500x358px
>le C# meme
>>
>>59090029
stupid plebbitor
see >>59090023
>>
>>59084645
Is the most /dpt/ way to kill yourself a segfault?
>>
>>59090066
i don't use any kind of memory protection bullshit.
>>
>>59090066
just exit cleanly you shouldn't need to segfault
>>
somebody give me something somewhat original to build. skill level - intermediate, I'm a senior software engineering student. I mainly program in Java and C.
I would prefer to build something that will make use of a database
>>
>>59090386
make me a local netflix
it scans a directory, finds all the videos and turns that into a show

root/showname/season||episodes/episodes

also keeps track of what anime i watched. if i watch naruto 344 and 5 weeks later i want to watch more naruto, it can tell me that the last naruto episode i watch was 344
>>
>>59090386
A local keylogger that logs all your keystrokes and then build a database and analyze what words and sentences you use the most and from there you can infer what sites or software the user is currently using. Use it to build a profile for yourself.
>>
so im a noob at python and im trying to get my program to print out a message when someone divides by zero.

How would go about this?

This is what i have so far
def divide (x,y,):
div=x/y
print (x,"/",y,"=",div)
>>
>>59090482
>>59090512
damn I'm intimidated. but that's a good feeling.

thank you
>>
>>59090514
if y == 0
print can't divide by 0
else
print x / y
>>
>>59090545
def divide(x,y):
try:
print(x, "/", y, "=", (x/y))
except ZeroDivisionError:
print("divided by Zero")

divide(10,2)
divide(10,0)
>>
>>59090636
>If y == 0
>>
>>59090514
uh...check that if y is 0, then output "not allowed" or something
>>
>>59090514
>print out a message when someone divides by zero
Why? Why not just show the answer?
>>
With pthreads in C++, if I spawn some baby threads from a mommy thread, but then terminate the mommy thread, do my baby threads die with it?
>>
>>59090677
Try dividing by 0 and show us the answer.
>>
>>59090686
>C++
that's where I stopped reading
>>
File: 0.png (1KB, 116x51px) Image search: [Google]
0.png
1KB, 116x51px
>>59090692
>>
>>59090686
no
>>
>>59090686
yes
>>
>>59090719
How do i make sure they die with their mama?
>>
>>59090705
Hitler please
>>
>>59090686
read the documentation

it explains everything. I'm not going to google it for you.
>>
>>59090730
you need to arrange for the threads to stop before you stop the mama thread
>>
>>59090686
>pthreads
that's where I stopped reading
>>
File: 29e.jpg (77KB, 680x1020px) Image search: [Google]
29e.jpg
77KB, 680x1020px
>>59084666
>hating on cpp
>>
>>59090758
>>59090768
>>59090719
thank you amigos
>>
>>59090638
kinda unrelated but I once found a way to throw exceptions in C++ for division by zero and other hardware faults. it would've been fun, if only -fnon-call-exceptions actually did what it's supposed to.
>>
File: 268.png (9KB, 300x100px) Image search: [Google]
268.png
9KB, 300x100px
This should downloads all of 4chan's banners.
I wanted to see if they still had the banner with waha saying "4friends 4fun 4chan dot net fo' shizzle" and a swastica. Apparently they deleted it.
Maybe I just can't access it because it's not in rotation? Either way, RIP.
import requests
useragent = {'User-Agent': "Mozilla/5.0 (Linux; U; Android 4.0.3; de-ch; HTC Sensation Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/5334.30."}

filetype=['jpg','png','gif','jpeg']
for x in range(1,666):
for end in filetype:
banner = 'https://s.4cdn.org/image/title/{}.{}'.format(x,end)
request = requests.get(banner, headers=useragent)
print(banner, end=' ')
if str(request) == '<Response [200]>':
print('saved')
else:
print('404')
continue
with open(str(x)+'.'+end, 'wb') as f:
f.write(request.content)
>>
File: calc.png (14KB, 622x229px) Image search: [Google]
calc.png
14KB, 622x229px
>>59090636
didnt work. i should note this code is a small part of my calculator program
>>
>>59090879
Why are you not using the only real code that someone posted in reply to your post?
>>
File: pt1.png (42KB, 1347x660px) Image search: [Google]
pt1.png
42KB, 1347x660px
>>59090903
pt1
>>
>>59090936
Oh my God. I have some many tips for you but I am phone posting so I can't help. For one use .upper instead of checking for upper or lower case. Also use if name = main so you can import functions in the future from this program
>>
File: pt2.png (34KB, 1247x638px) Image search: [Google]
pt2.png
34KB, 1247x638px
pt2
>>
>>59090962
end yourself, meme spouting cancer
>>
Anyone know how I'm supposed to login to a website that has a captcha? I click on developer tools and view the html documents when I'm loading projecteuler.net but I cannot seem to see what type of authentication they use, basic/digest.

Tried to do the same thing for steam however they do some weird shit.

Using python3.
>>
>>59090971
kek. My teacher is a huge dark souls fan so i wanted to add something related to it
>>
>>59090982
Check the captcha api
>>
>>59090879
>Not using regex and an unambiguous syntax
>>
>>59090936
>>59090962
You suck at this. It's like you don't even understand the basics. Go read a fucking book.
also your question has already been answered
>>
>>59090986
You didn't use the try except I wrote for you
>>
I reimplemented futexes in userspace http://pastebin.com/EikkaU6E Compile with gcc -O3 -g -pthread event_objects.c -std=c99 if you add -DDO_FUTEX times are about the same. There should be more optimizations possible though.
>>
>>59090999
because you were golden from day one
>>
>>59090999
oh course i suck at this. im only 2 weeks into class lol. this is my first real experience with programming
>>59091007
my b ill go try it out
>>
>>59090992
What? Im just trying to login a website with a python script but when I click developer tools I can't see anything useful.
>>
>>59090986
like i said, remove yourself from this world.
>>
>>59090995
>regular expression for a calculator
End yourself
>>
>>59091018
The api isn't just about using captcha. Go read it
>>
>>59091013
>because you were golden from day one
Yes? I read a programming book. It's not really that hard to understand. Especially python.
This is BASIC stuff. It should be covered in like the first chapter.
>>
>>59091024
Have fun dealing with order of operations or ironing out weird fringe cases, retard.
>>
File: 106127.jpg (390KB, 620x930px) Image search: [Google]
106127.jpg
390KB, 620x930px
Is there a way to generate prime numbers starting at a specific number and ending at a specific number using a sieve implementation?
>>
>>59091013
i literally was. he's just a retard though, which is obvious from his love of retarded memes.
>>
>>59090995
>two weeks into programming
>use a regex
it's probably the person's first non-trivial program. cut them a break. I've seriously seen senior CS students with shittier code

(non-trivial as in not hello world)
>>
>>59091038
How do I even know which captcha version it is? Also thats the second problem, the first problem is how do I even know what type of authentication to send with a username and password? developer tools dont say so how do I login assuming there is no captcha?
>>
>>59091024
>not using a simple to use tool for a simple task
>>
>>59091054
Searching for substrings is just fine since operators are a single character. No need to complicate it. Much less a calculator that only does one operator at a time.
>>
>>59091058
Just do

for i = min to max:
if(i is prime) print i
>>
>>59091083
Yes re.compile all the operators is simple but it over complicates a simple program. There is no need for regular ex you tard
>>
Just finished
https://www.youtube.com/watch?v=ECsLu60n0ss
>it uses Artificial intelligence to determine each item and their nutrition facts


quick question, how do i ACTUALLY determine which are the minimun requirements for my program?
>>
>>59091068
>the person's
>them
how about you fuck off?
>>
>>59091058
of course
>>
set dirpath=audio\*.*

ren %dirpath%"01 Reign of the Septims.mp3" "tes4title.wav"
ren %dirpath%"02 Through the Valleys.mp3" "atmosphere_03.wav"
ren %dirpath%"03 Death Knell.mp3" "battle_07.wav"
ren %dirpath%"04 Harvest Dawn.mp3" "town_01.wav"
ren %dirpath%"05 Wind from the Depths.mp3" "Dungeon_01_v2.wav"
ren %dirpath%"06 King and Country.mp3" "atmosphere_08.wav"
ren %dirpath%"07 Fall of the Hammer.mp3" "battle_04.wav"
ren %dirpath%"08 Wings of Kynareth.mp3" "atmosphere_07.wav"
ren %dirpath%"09 Alls Well.mp3" "town_02.wav"
ren %dirpath%"10 Tension.mp3" "dungeon_02.wav"
ren %dirpath%"11 March of the Marauders.mp3" "battle_01.wav"
ren %dirpath%"12 Watchman's Ease.mp3" "town_04.wav"
ren %dirpath%"13 Glory of Cyrodiil.mp3" "atmosphere_01.wav"
ren %dirpath%"14 Defending the Gate.mp3" "battle_06.wav"
ren %dirpath%"15 Bloody Blades.mp3" "battle_05.wav"
ren %dirpath%"16 Minstrel's Lament.mp3" "atmosphere_04.wav"
ren %dirpath%"17 Ancient Sorrow.mp3" "dungeon_03.wav"
ren %dirpath%"18 Auriel's Ascension.mp3" "atmosphere_06.wav"
ren %dirpath%"19 Daedra in Flight.mp3" "battle_03.wav"
ren %dirpath%"20 Unmarked Stone.mp3" "dungeon_05.wav"
ren %dirpath%"21 Bloodlust.mp3" "battle_02.wav"
ren %dirpath%"22 Sunrise of Flutes.mp3" "town_03.wav"
ren %dirpath%"23 Churl's Revenge.mp3" "battle_ 08.wav"
ren %dirpath%"24 Deep Waters.mp3" "dungeon_04.wav"
ren %dirpath%"25 Dusk at the Market.mp3" "town_05.wav"
ren %dirpath%"26 Peace of Akatosh.mp3" "atmosphere_09.wav"
ren %dirpath%"01 Call of Magic.mp3" "Delete1"
ren %dirpath%"01 Nerevar Rising.mp3" "Delete1"
ren %dirpath%"02 Desperation.mp3" "MW battle1.wav"
ren %dirpath%"05 Bright Spears Dark Blood.mp3" "MW battle1.wav"
ren %dirpath%"03 Dark Caverns.mp3" "Delete2"
ren %dirpath%"04 Over The Next Hill.mp3" "Delete2"


I'm making a basic batch file that renames files in an audio folder than sends it out to be converted into another file format. Instead of renaming the files it just starts converting them and ignores all of this.
>>
>>59091106
only problem is that is way too slow, thats why I want to use a sieve implementation. The biggest then number can be on one of the test cases is 10^15.
>>
>>59091128
And what would that be?
>>
>>59091007
The try excerpt didnt work. sorry for the late reply
>>
File: 1468302971976.jpg (237KB, 884x902px) Image search: [Google]
1468302971976.jpg
237KB, 884x902px
>>59085870
>tfw no loli to rape my lap
why even fucking live
>>
>>59091204
How the fuck did it not work? You are doing something wrong.
>>
>>59091119
not sure what you're getting at
>>
>>59091226
nvm it worked.
>>
>>59084645
Daily reminder to never, ever cut and paste code because the entire Cloudflare ongoing disaster right now is because of a typical Ctrl-C/Ctrl-V error when they copied an html parser out of their old library.

Also daily reminder, never use regex to parse html unless it's rust, who's regex library has been fuzzed.
>>
>>59091259
Good. Now go read about chaining functions and using upper.
>>
>>59091116
my %do_op = (
'+', sub { return $_[0] + $_[1]; },
'-', sub { return $_[0] - $_[1]; },
'*', sub { return $_[0] * $_[1]; },
'/', sub { return $_[0] / $_[1]; }
);

while (<>) {
if (/^(-?\d+) ([+\-*\/]) (-?\d+)$/) {
print "${do_op{$2}->($1, $3)}\n";
}
}


Wow, you're right. Code with regexes is always way overcomplicated.
>>
>>59091203
calculate the state of the sieve up until that prime
>>
Why is every other programming language other then Python so fucking backwards

Why can't everything be Python
Why can't Python be the universal language
>>
>>59091336
Is there anywhere I could take a look at to learn how to do that? Or would you be so kind to tell me?
>>
>>59089296
>electron
why anon
>>
Is JavaFX the best GUI framework ever created?
>>
>>59091360
>anon
it's an attention-whoring namefag
>>
>>59091351
because Java is much better and is the most universal language right now
>>
File: Screenshot_2017-02-23_22-30-09.png (804KB, 1109x641px) Image search: [Google]
Screenshot_2017-02-23_22-30-09.png
804KB, 1109x641px
Having the time of my life writing documentation
>>
>>59091358
https://en.wikipedia.org/wiki/Sieve_of_Atkin
>>
>>59091330
You are asking someone with 2 weeks to understand and program that? God I hate autistic people like you.

Hurr durr look at me I am so good with regex. Why even type that code? To impress me? Cause it is not.
>>
>>59091391
>Java is better
>Every block needs to have 100 fucking curly braces everywhere because retards won't understand Java without it

I hate java so fucking much
>>
>>59091351
lisp contains python
>>
>>59091484
I program like this


boolean status = false;

if(status == false)
{
status = false;
}

return FizzBuzz(int num);

>>
>>59090686
a thread is a thread of its own, it doesn't rely on another thread, doesn't matter which thread created it
>>
>>59091351
python is like the second worst language after php

you're just babby duck syndroming as fuck
>>
>>59091568
I thought Java is the worse programming language of all time
>>
>>59091568
That is Rust
>>
>>59091568
Give me a reason why

I can make anything Python in half the time it takes me to format any other language

The syntexes are all simple to remember and it tells you where you went wrong down to the smallest degree

Why do I need Java or Ruby or C++
I have everything I ever need with Python
>>
>>59091582
nice meme idiot

http://www.tiobe.com/tiobe-index/
>>
File: angry racoon2.png (156KB, 451x387px) Image search: [Google]
angry racoon2.png
156KB, 451x387px
I'm at a point in programming now where I pretty much understand how things works, if anyone knows the game 'Maplestory' when I was a kid I was always intrigued about how people manipulate client sided memory to create 'hacks' and shit.

How would I begin my venture on learning how to create some basic game hacks for a game like Maplestory? How would I even view the memory? so many questions, if anyone knows what im talking about please respond
>>
>>59091628
Not good enough for game development
Dynamic typing leads to more errors in larger programs
Whitespace cancer
__lmao__
>>
>>59091568
>hurr php is the WORdST
>OOP more like POOP
>pyton sux
>>
>>59091661
Do you know C? Do you know how memory works in a computer. Stuff like register and bits?
>>
>>59091670
I've made better games in ren'py then the majority of bitch niggers who post up their garbage ass unityscript games all over steam
>>
File: 1458942024464.png (335KB, 1280x720px) Image search: [Google]
1458942024464.png
335KB, 1280x720px
>>59091672
>languages made by literally one guy are better than ones carefully designed by top experts from leading multi-billion dollar players in the industry
>>
>>59091681
I understand the basic idea yea, its ok if I don't know everything, I'm also looking forward to learning along the way, but I basically know how C/ASM work
>>
New thread:
>>59091710
>>59091710
>>59091710
>>
>>59091288

i will thanks
>>
>>59091700
But unity can make better games than renpy ever will. And unity is just one engine. Notice how you only compare amateur garbage to amateur garbage? How about unreal or source 2?
>>
>>59091661
There's a book on NoStarchPress called game hacking for changing the HUD in games, writing bots, accessing memory ect.
>>
>>59091704
Now go read up about exploits and then learn about everything you don't know. When you completely understand how a simple exploit works and how to pull it off. Move on.
>>
>>59091728
Because I am an amateur nigger
I don't have billions of dollars or hundreds of man hours to compare myself to actual studio devs

I can only compare myself to the peers that are in my group and i've made more profit with my ren'py game then most have with their unity game
Unreal always has that same janky look and Source is just for porn webm's
>>
>>59091767
Good. Then stay amateur and narrowminded faggot. I bet I can program in python better than you while being humble enough to recognize where python has limitation and try another language instead of
>Hurrr durrr I will only need Python 4EVAH
KYS cancer
>>
>>59084746
>I feel like that should probably have been obvious to me
Good intuition.
>>
Are there any good Books on Rust?

Seems there are very limited resources to learning it.
Thread posts: 319
Thread images: 29


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