[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 51
File: K&R himegoto waifux2.png (1 MB, 1000x1400) Image search: [Google]
K&R himegoto waifux2.png
1 MB, 1000x1400
old thread: >>53966502

What are you working on, /g/?
>>
>>53972678
Java is the most useful programming language in existence today.
>>
File: trap_programmers.jpg (18 KB, 237x213) Image search: [Google]
trap_programmers.jpg
18 KB, 237x213
>>53972678
Finally a good OP image. I bless this thread.
>>
>>53972778
Women dressed like men make the best programmers. Hoodie, t-shirt and tracksuit bottoms.
>>
>>53972711
Javafags need to keep their shit off the streets imo
>>
>>53972803
You just don't like it because you're stuck writing Ruby 80 hours a week for worthless stock options in a startup that will go bust next year

Oh, and your rent is $3000/month
>>
File: mweeeeeeeee.png (474 KB, 1500x2050) Image search: [Google]
mweeeeeeeee.png
474 KB, 1500x2050
Rate my dumb backwards compatibility hack!
#ifdef _OPENMP
#include <omp.h> /* If OpenMP is not supported, multithreading is disabled */
#else
/* Single-threaded mode: OpenMP calls will be replaced with dummy functions */
#define omp_init_lock(mutex) ;
#define omp_destroy_lock(mutex) ;
#define omp_set_lock(mutex) ;
#define omp_unset_lock(mutex) ;
#define omp_test_lock(mutex) 1
#define omp_get_num_procs(void) 1
typedef unsigned char omp_lock_t; /* dummy mutex type */
#endif
>>
File: Sudachi.png (309 KB, 1002x684) Image search: [Google]
Sudachi.png
309 KB, 1002x684
Working on making it so you can have custom fonts for themes in my MPD front end
>>
File: 1449470254844.jpg (337 KB, 1280x1449) Image search: [Google]
1449470254844.jpg
337 KB, 1280x1449
I just finished watching and folloiwng along with a bunch of Lynda and Pluralsight Java tutorial essentials videos. Is there some site or book I can pirate that has a bunch of exercises I can try to do to apply the knowledge I just learned?
>>
>>53972868
What is it with /g/ and crossdressing?
>>
>>53972913
it's mostly just one samefagging trap fag sperg
>>
> tfw writing unit tests for my own software
> swore to never write "those useless tests"
> my software breaks on every release

I've seen the light.
>>
>>53972913
I think that programming is a unique profession because it is merit-based, openminded and can be done remotely. That's why there is quite a lot of trans people doing programming-related work.
>>
>>53972950
i support this
>>
>>53972950
Black lagoon is better than trapshit, but this one was here first.
>>
File: 1447883509980.png (85 KB, 302x385) Image search: [Google]
1447883509980.png
85 KB, 302x385
>>53972950
Go away.
>>
>>53973019
This one was posted before the bump limit.
>>
>>53973019
This one was posted before the bump limit so the trap poster would feel validated
>>
File: flat,800x800,075,f.jpg (99 KB, 600x800) Image search: [Google]
flat,800x800,075,f.jpg
99 KB, 600x800
>strips all comments from source code before sharing it with others
>>
>>53973093
>job security pro: pajeet edition
>>
File: Fuck_Yea__in_HD_by_CrusierPL.png (76 KB, 900x773) Image search: [Google]
Fuck_Yea__in_HD_by_CrusierPL.png
76 KB, 900x773
>a bunch of new code compiles the first time and is error free
>>
>>53972950
this is no better baka
>>
>>53972711
Why? There is no jobs at all.
Furthermore high tech companies just dropped java because oracle vs google.
>>
>>53973137
No code ever compiles first time, error free.
The challenge now is finding the problem.
>>
>>53973206
Unless it's a babby program
>>
>>53973137
I get deeply paranoid if I don't get several warnings at the least.
>>
>>53973254
>not using live compiler parsing
>>
>>53973285
Thanks RMS.
>>
Wearing a chastity cage is really improving my work ethic.
>>
>>53973580
What's a 'chastity cage'?
>>
>>53973580
wtf
>>
>>53973605
A lockable cage for your penis to prevent use of your penis while crossdressing.
>>
>>53973626
What the fuck? Why would you put something like that on yourself?

Also, what's the point? Presumably you can unlock it at any time.
>>
>>53973626
kill yourself and fuck off to >>>/lgbt/
>>
>>53973647
>Presumably you can unlock it at any time.
Not if you give bf the key you can't.
>>
>>53973710
Why, though?
>>
>>53973735
So it doesn't distract you. Anon he clearly has issues with sexual restraint.
>>
>>53973778
This is correct, though I don't have a bf.
>>
>>53973778
>>53973808
Why not just fap and make use of the refractory period?
>>
>>53973840
The more you fap the longer you have to fap to ejaculate. Refractory period really takes a long time.
>>
>>53973911
but you enjoy the fap
>>
>>53973946
Not when it takes that long. It gets to be a chore that you get halfway through enjoying and the period from halfway to ejaculation is just filled with regret. "I should have never started, should I stop now? I've invested so much time though, maybe it's just around the corner.". The Sunk cost fallacy hits you hard.

Well that's when you reach an hour+ anyway. If it's just 30 minutes go for it.
>>
>>53973840
no refractory period if you take hormones
>>
>>53974371
Then stop taking hormones
>>
File: php_origins.png (335 KB, 1280x720) Image search: [Google]
php_origins.png
335 KB, 1280x720
>>53974390
I can't stop it.
>>
>>53974461
Why not?
>>
>>53974461
>I don't know how to stop it
This one always haunts me.
>>
>>53974513
It would be dangerous to my health.
>>
>>53974837
?
>>
>>53974371
top kek, so this is why trannies are so sex-fixated, because they can never get off
>>
>>53974837
r u goin 2 b a gril?
>>
File: bravo.png (62 KB, 603x600) Image search: [Google]
bravo.png
62 KB, 603x600
BRAVO MICROSOFT
>>
>>53975043
they can orgasm but they don't need a cooldown before they orgasm again
>>
>>53975128
Is that out now?
>>
>>53975166
yes, but it's obviously useless
>>
>>53975174
Why?
>>
>>53975195
>lollinux
>>
>>53975195
nm, i see your arrow now. it was really hard to see. Hardly useless. Wouldn't be shocked if it works on other distros, just not officially supported.
>>
File: emsc.png (6 KB, 761x96) Image search: [Google]
emsc.png
6 KB, 761x96
send help
how do I make intellisense play nice with emscripten?
>>
>>53975151
This.
>>
>>53974461
>that pic
hehehe
>>
I'm going through http://neuralnetworksanddeeplearning.com/ and its neat, any other suggestions for learning neural networks?
>>
>>53976433
/dpt/ is over here: >>53972937

This is the thread for giving the trap attention about its hormones and dick cage.
>>
When is webassembly coming out?
>>
>>53976493
>This is the thread for giving the trap attention about its hormones and dick cage.
But that is /dpt/.
>>
What are some good toy programs to make just for practice in either Java or Python?
>>
>>53978084
Solve a problem, or make a useful tool.
>>
>>53978084
interested in this too.
>>
File: aaa.png (78 KB, 565x620) Image search: [Google]
aaa.png
78 KB, 565x620
Any C people here? Can anyone explain this syntax? It's about arrays of structures.

What are the highlighted words? Members of the structure? I thought the "members" of the structure would be char *word and int count.
>>
>>53978492

that's defining an array of anonymous structs.
the highlighted words are the char *word members. The 0's are the int count members.
>>
>>53978546
Oh I see. So do all of those members exist in, say, keytab[1]? Or is it one line of members for every instance of keytab[]?
>>
>>53978662
every line is one array member
>>
>>53978696
And the member *word is an array too? So an array of structures that each have a char array and an integer in them as members? Could the char member also be defined as char word[]?

And, to my understand, keytab[0].word[] will be "auto", keytab[1].word[] will be "break", and so on?

keytab[0].word[2] or keytab[0].*word+2 would be 't'?
>>
File: 1.png (269 KB, 863x602) Image search: [Google]
1.png
269 KB, 863x602
>>
File: wojakending.jpg (125 KB, 633x758) Image search: [Google]
wojakending.jpg
125 KB, 633x758
>TFW FELL FOR THE JAUNT-API MEME

I wanted to use it on android, someone here recommended it to me and it doesn't even fucking compile when i add the library

http://stackoverflow.com/questions/34828893/getting-this-error-execution-failed-for-task-apptransformclasseswithdexford

Tried searching but nothing just that link
>>
>>53978762
yes and yes

though i'm pretty sure your second example should be
*(*(keytab+0).word+2)
>>
>>53978841
SEND HELP i'm regretting using jaunt i got fucking rustled

I did it initially on Java it did the Following
>go to cucked.org
>Ask for user and Password
>Check successful login
>Go to cucked.org/spreadsheet.csv
>Retrieve as a table

What should i use to accomplish this on Android? fuck this Jaunt-API should have never used it
>>
>>
File: tbhfam.png (217 KB, 447x547) Image search: [Google]
tbhfam.png
217 KB, 447x547
>>53978957
XD
>Anon likes this
>>
File: image.jpg (175 KB, 1280x720) Image search: [Google]
image.jpg
175 KB, 1280x720
>>53972711
Fuck you pleb, Python is Godtier!
>>
>>53978898
I'm not going to click on "cucked.org". Take your shitty /pol/ memes back to wherever.
>>
>>53978816
>it's kinda formatted like code so it's an in-joke
>>
>>53979009
epic

alright just change it to example.com
I just want to login to a website get some data and done
>>
>>53979021
fucking typed in my tripcode wrong. now I feel dumb
>>
>>53979025
Oh. I thought it was an actual site you were trying to download some spreadsheet from.
>>
watching anime, contemplating suicide and programming a program that will rate your tastes based on your MAL.
>>
>>53978994
haha glad you like it, save it if you want!
>>
>>53979085
I'm curious to know how you intend to objectively and programmatically grade someone's taste in anime.
>>
>>53979110
you could compare their ratings to average ratings, but that's just basing it on the population which isn't really "objective"
>>
>>53979101
Wait... F-for real?
T-thanks...
>>
>>53972865
is this released, where can i find it?
>>
>>53978846
So the compiler says you can only declare one variable length array per structure. If I wanted an array of structures with several char arrays is it fine to just declare them all as *word1, *word2, *word3, and so on?

Also keytab[0].word[2] works as expected (using %c), but for some reason keytab[0].word+2 prints 'f'. There's not even an 'f' in "auto".
>>
trying to figure out how to find where infinite lists overlap in haskell

is there an intersection operation for infinite lists in haskell?
>>
>Tfw I fell for the Java meme
>>
>>53972851
Retarded/10
>>
File: OH GODWHY.png (340 KB, 540x644) Image search: [Google]
OH GODWHY.png
340 KB, 540x644
So I really need to get good at life and start learning both programming and proper math. I found this great resource for the math: http://tutorial.math.lamar.edu/ . However I need to find a way to integrate it into programming. Preferably genuinely fun/interesting so I can better retain the information. Does anyone have any ideas on challenges for programming that are pretty engaging to do that involve math?

Hopefully, I can start with Algebra and move onwards to Calculus and beyond. I'll keep you guys updated.
>>
>>53979765
you don't need math for programming all you need is basic math skills you big noob
>>
>>53979798
nuuu, i meant i want to learn higher level math but I want to integrate it into my programming education,.
>>
File: math4tards.png (4 MB, 1218x1534) Image search: [Google]
math4tards.png
4 MB, 1218x1534
>>53979818
>>
>>53979946
I'll check that out thanks
>>
>>53979765
Also https://projecteuler.net/ if you want to do programming math challenges
>>
>>53979965
ill keep it bookmarked for whenn im competent
>>
File: qqqqq.jpg (127 KB, 500x500) Image search: [Google]
qqqqq.jpg
127 KB, 500x500
What would be a good runtime to scrape everything from erowid.org and organize it? By everything I mean the main substance list, every substances information, and all of the substances external pages (Basics, Effects, Images, etc...).
>>
>tfw you finally think of a project idea for the first time in 5 months, finish it in two days, it sorta kinda works and you're depressed
fuck
>>
new thread >>53980427 adsf
>>
>>53980452
No. This thread isn't even close to the bump limit.
>>
Why is this necessary?
>>
>>53980452
Lol what?
>>
>>53980524
The Haskell one is the rightful,
Others are extra or made before autosage
>>
>>53980524
The first two should be deleted.
>>
>>53980541
why are hasklel users so autistic?
>>
>>53980551
real hasklel users don't need constant reinforcement that their language isn't shit
>>
>>53980548
YOURE A FUCKING FAGGOT THAT MONITORS DPT THREADS JUST SO YOU CAN POST THAT DEGENERATE ANIME PICTURE EVERY SINGLE TIME
KILL YOURSELF YOU WASTE OF OXYGEN
TAKE A LOOK AT YOUR LIFE AND CHANGE
DO YOU WANT TO KEEP DOING THIS UNTIL YOURE 50????
>>
>>53980288
For reference, I manage to do it around 6 minutes.
>>
>>53980551
says the faggot that monitors dpt thread just so he can post the same image
>>
File: awoo eats cheetos.png (1 MB, 960x1280) Image search: [Google]
awoo eats cheetos.png
1 MB, 960x1280
>>53980575
put down the mouse and go outside anon
none of this shit really matters
>>
>>53980594
if it doesn't matter then why do you go out of your way to post the same picture every time?
>>
File: java final project.png (20 KB, 668x427) Image search: [Google]
java final project.png
20 KB, 668x427
got my final java project working and submitted mates. glad i tossed the book's shitty psuedocode and did it my own way. i ended up with literally an 81 line program and a 37 line Customer object class for this final assignment, a shorter implementation than the convoluted psuedocode was. also glad i didn't buy that piece of shit book. DON'T BUY "Data Abstraction and Problem Solving with Java: Walls and Mirrors (3rd Edition)"

i had set aside the next 3 days to work on this so i don't know what to do now
>>
File: guzukats2.png (257 KB, 471x375) Image search: [Google]
guzukats2.png
257 KB, 471x375
I want to implement a cross platform spaced repetition system with a GUI (sort of inspired by this guy who wrote his own in PHP) in pure C to show off to employers and also to learn a lot.

I'm almost finished with K&R. Should I do it?
>>
>>53979765
I had one assignment that included calculus shit into data structures
>>
File: 1418632408897.gif (1 MB, 500x542) Image search: [Google]
1418632408897.gif
1 MB, 500x542
>>53980605
You're delusional.
>>
>>53980632
nice comeback anime faggot weaboo
>>
>>53980605
I didn't make the thread. You're talking to like 3 different people and assuming it's the same person.
>>
>>53978492

>initializing a non-const char pointer to a string literal
REEEEEEEEEEEEEEEEEEEEEEEEEEEE
>>
File: 1428247000318.jpg (154 KB, 1280x720) Image search: [Google]
1428247000318.jpg
154 KB, 1280x720
>>53980640
You too.
>>
Anyone else find webshit and new hipster languages uninspiring?

One of my profs loves selling them like they're hot shit and that things like garbage collection and everything being stored in a tree map is supposed to be cool. That shit isn't cool. Operating systems and CUDA are cool.
>>
>>53980622
Honeslty I think that is too big of a project for someone just finishing K&R. It may not seem like it to you now but if you got it into it I'm sure you'd realize that you're in over your head. It's not extremely large, but it is quite a bit. It would be very possible to work on somewhat simpler projects beforehand before building yet another SRS program (which the world doesn't need desu, anki works fine (although it's shit))
>>
>>53980646
That was my post (as this >>53980622). Why is that bad? That example is from K&R.
>>
hey guys can you respond to my post i made >>53980612

thanks
>>
>>53980646
Can you explain a reason to do that? Isn't it just a stylistic issue?
>>
My parser has hit a little above 400 lines of C, of which, 19 are just dedicated to bounds checking. Part of me wonders if I should do some refactoring to reduce that, but the assignment is due on Wednesday, after which, this particular compiler will not be worked on for the rest of the class.

I haven't even gotten to code generation in this bitch.
>>
>>53980677
You've got a warped sense of coolness.
FYI none of that is cool.
>>
>>53980677
People have different interests mate.

Although it is pretty gay that you made a post just to seek approval by hating on website and pretending to like <anything else>

altho webshit is gay, I agree
>>
File: rustmaymay.png (153 KB, 960x353) Image search: [Google]
rustmaymay.png
153 KB, 960x353
>>53980688
b-b-but the rust maymay has no garbage collection
>>
>>53980646
you're a fucking idiot it goes into .rdata anyway
>>
>>53980706
>400 lines just for a parser
Holy shit why. Are you doing a parse tree? I'm actually working on the same thing for an interpreted language and it just uses a char iterator.
>>
>>53980733
Rust is the most disgusting acceptable language there is.
It takes the ugliness of C++ and embraces it.

Also I think you didn't mean to reply to me, right?
>>
>>53980748
damn that's the most accurate description of Rust I've ever seen
>>
>tfw your parser is 100 lines because your language is written like assembly even though its interpreted
nice

Honestly it was a fun project but it's shit
although I have no interest in making another interpreted language
>>
>>53980771
Thanks; not that I've ever written a single line of rust
>>
>>53980772
once you know x86 everything you write starts looking like assembly
>>
I'm thinking of making an IRC bot. Is a python script for weechat a reasonable way to do this or is there a better alternative?
>>
File: memelang.png (38 KB, 1116x698) Image search: [Google]
memelang.png
38 KB, 1116x698
>>53980772
>interpreted assembly

Reminds me of my first meme language, and then my second meme language. SPP was 153 lines of C#.

Then I finally wrote a pseudo-lisp because assembly is annoying.
>>
>>53980689
K&R is outdated if they think this is a good idea.

>>53980697
Not simply a matter of style. C compilers often store string literals in read only memory, unless they are declared as arrays of chars on the stack. Declaring a pointer as non-const is basically giving free reign to the programmer using that pointer to modify its contents as much as they want, which should cause a segmentation fault if the programmer were to do so.

The use of the const keyword is important, because it is a contract from the programmer saying, "I will never at any point in the program modify this section of memory, or any address obtained from relative addressing with this pointer". In the C library, it is very common for functions to always use const when a pointer will not be modified, and always use non-const when a pointer will be modified. While it is possible to cast this away, this should only be done if the programmer is an absolute asshole.

>>53980743
Actually no, I'm not. I would make one, but the professor explicitly wants us to try a compiler without any ASTs or anything before we do our project (which will use them). The language I'm compiling is a very simple -- not even turing complete -- language that I am supposed to have a scanner, parser, and code generator for in 2 weeks, basically. Right now, I've got the scanner done, and I'm working on a series of functions to verify the program is correct. I've got a vector of tokens I allocated, and almost every step along the way of iterating through it, I am checking "have I gone past the edge yet?" and returning a syntax error if I do.

>>53980741
That's why it needs to be const. Why would you make a writable pointer to a section of read only memory?
>>
File: 1444663387649.jpg (41 KB, 499x499) Image search: [Google]
1444663387649.jpg
41 KB, 499x499
>>53980801
you have a long way to go kid
>>
>>53973204
>java devs
>Why? There is no jobs at all.

I wish this were true but there really are a lot of java jobs. I've been job hunting the last month or so and I haven't seen anything more common than java. Recruiters and harassing me over java positions but if I want to use literally any other JVM language it's like one or two positions are posted per month and I live in the supposed tech capitol of the world.
>>
>>53980830
or any address obtained from relative addressing with this pointer

careful with those words champ
>>
>>53980846
What should I look into?
>>
>>53980830
>K&R is outdated if they think this is a good idea.
>Not simply a matter of style. C compilers often store string literals in read only memory
K&R teaches all of that though. They wrote the language. Do you think they didn't have the thoughts you're having now? Maybe they're just on a different level than you.
>>
>>53980876
sockets and the irc RFC
>>
>>53980830
>which should cause a segmentation fault if the programmer were to do so
What? Why? There's no way that's to spec. Since when does userland have access to read only memory anyway?
>>
>>53980877
>They wrote the language.

Right, and C isn't without its mistakes.
>>
>>53980876
https://pypi.python.org/pypi/irc if you want to write it in python
>>
>>53980892
someone here has no idea what a program looks like in memory (((its you)))
>>
>>53980914
We're not talking about implementation. We're talking about whether it's appropriate to initialize a non-const char pointer to a string literal. The authors of K&R knew exactly how C compilers stored string literals (because they wrote them) and they did it in their examples without const, so I'm guessing it's fine.
>>
>>53980938
>We're not talking about implementation.

I was talking about actual mistakes within the language. There are plenty.
>>
Just started playing with threads for the first time. If you only have one core which can't do parallelization what happens if you run multiple software threads then sleep one? Will the program sleep until the period is over or will it go to the other thread while one sleeps?
>>
>>53980924
Explain to me then which part of a program's memory is read only and why something like:

char* s = "abcd";
s[0] = 'f';


would segfault
>>
>>53980956
That's not the topic of the discussion.
>>
>>53980972
Don't bother responding to tripfags.
>>
>>53980938
string literals are literally static const char arrays without a name. How about you give the string literals a name and call it a day.

>initialize a non-const char pointer to a string literal
Enjoy your segfaults when writing to a read-only data segment.
>>
>>53980869

if you have const char *a, then a+1, a+2, and a+n are all const char*, and trying to write to them is a compiler error.

>>53980877

K&R doesn't even teach the latest version of the C standard. As it stands, while early C programmers didn't use const as it should have been used, it's a standard practice in modern C. My point of the C standard library using const wherever a pointer is not written to still stands.

Also, while I will not claim that I am necessarily the best C programmer out there, or even better than Kernighan or Ritchie, I would note that it is fallacious to argue that the original creators of a language are necessarily the best programmers for it. Case in point: Bjarne Stroustrup considers himself a mediocre C++ programmer.

>>53980892

The C standard does not specify that string literals must be placed in read only memory
The majority of C compilers do this anyways.

There is no reason a userland program should not have access to read only memory. It is standard for executables to be divided into many sections, including text (code), data, and read-only data. If it is desirable that data not be modified over the course of the program, it may be placed in read-only data. Since nobody wants a statement like:

error("Something happened");


to be accidentally modified over the course of the program to say "Fuck you, customer", clearly that section of memory should segfault if it gets modified.
>>
>>53980971
char *n = "niggers"; //goes in .rodata
char n[] = "niggers"; //goes on stack

n[0] = 'f'; // you cant WRITE to READ ONLY memory (.rodata)
>>
>>53980971

>which part of a program's memory is read only
.rodata

>and why something like: ... would segfault
When your kernel copies your program image into memory, it's going to give each section its own set of permissions. The .text or .code section is going to be given read and execute privileges, but not write privileges. The .rodata section is only going to be given read permissions, and the .data and .bss sections are going to be given read and write permissions.

When you attempt to use any sort of store instruction on a section of memory that does not have write permissions, the CPU will signal a general protection fault, and the OS will send something like SIGSEGV at your program.
>>
>>53974461

While he may not be the best, I respect his brutal honesty.
>>
File: 1446935977938.jpg (86 KB, 1000x1000) Image search: [Google]
1446935977938.jpg
86 KB, 1000x1000
>>53981024
not true on windows for those at home following
>>
File: NotTrueOnWindowsAtAll.png (58 KB, 1366x768) Image search: [Google]
NotTrueOnWindowsAtAll.png
58 KB, 1366x768
>>53981040

About that...
>>
File: 1447373662712.png (53 KB, 320x320) Image search: [Google]
1447373662712.png
53 KB, 320x320
>>53981076
sorry friendo i was referring to that fact that the code section isnt writable. on windows you can rxw any section really at runtime
>>
>>53981114
I'm aware that you can use some Win32 functions to change permissions, but I'm pretty sure that the code section is by default rx only.
>>
>>53980813
:) I remember gtp, i remember :')
>>
>>53981076
reminder that you can do char foo[] and it's mutable

(not a reminder to ruby, just to the general reader)
>>
>>53980622

Yes.

If you can improve it, do it. If it will be a good portfolio piece, do it.

90% of code interviews anyway are just doing your damn-est to segue into your accomplishments long enough to raise eyebrows and make the interviewer think you know what you're talking about.
>>
How does vsync actually work? If you try to render more frames than the refresh rate allows are those frames pushed into a buffer of some sort and are processed in the next batch or are they discarded?
>>
>>53972678
Stop this programming fag meme.
>>
>>53981263
Every thread until you like it.
>>
File: q.jpg (111 KB, 500x500) Image search: [Google]
q.jpg
111 KB, 500x500
MYSQL question for you guys....

If I have an array of objects and each object has 3 properties, how do I model this in a sql database?
>>
>>53980982
>Bjarne Stroustrup considers himself a mediocre C++ programmer.
Bjarne Stroustrup isn't Kernighan or Ritchie. He didn't write Unix.
>>
>>53978084
Port scanners.
>>
>>53981408
with 3 columns ya tard.
>>
>>53972678
i hate programming so I'm stalling by making assets for my game.
>>
>>53981541
I was wondering how I would have nested tables. I decided to look in the docs.
>>
File: aoiwkndioawndljkan.png (82 KB, 1000x800) Image search: [Google]
aoiwkndioawndljkan.png
82 KB, 1000x800
>>53981408
>>
>>53981609
That's a beautiful picture you meade
>>
>>53981619
Thanks
>>
>Have bug in program, but need to sleep.

Never debug before bed, DPT.
>>
>>53981724
Sleep is for pussies, anon
>>
Where is literate programmer? I need him to suggest to me a medium sized project preferably doable in the C programming language.
>>
File: aikido.webm (491 KB, 720x404) Image search: [Google]
aikido.webm
491 KB, 720x404
programming literate is not one single person. it's you, me, him, everyone, no one.
>>
>>53981816
You're definitely not programming literate.

>>53981800
Write a command interpreter/shell and add lots of fancy features.
>>
File: blind_pug.webm (980 KB, 720x404) Image search: [Google]
blind_pug.webm
980 KB, 720x404
>>53981724
better go to sleep to look at that bug with a fresh mind. that or adderall.
>>
>>53981832
I'm so fucking tired of string manipulation. Anything else?
>>
File: 6489.jpg (497 KB, 2560x1440) Image search: [Google]
6489.jpg
497 KB, 2560x1440
>>53981800
>Where is literate programmer?
he ded

>>53981800
character generator. a program that randomly generate character attributes (force, defense, intelligence, ...). Should implement a coherent distribution for different classes (mage, sorcerer, knight, prayer, ...)

Final goal is a program usable by role players (paper games, not video games). A GUI is not necessary but could be useful to customize the distribution.

gandalf > dumbledore
>>
>>53981942
wizard > gandalf > dumbledore
>>
File: 1438522386538.png (41 KB, 1726x160) Image search: [Google]
1438522386538.png
41 KB, 1726x160
I don't get it, why would an offset of -4 point to the next instruction? shouldn't point backwards to the last instruction?
Image is from http://wiki.osdev.org/Object_Files
>>
>>53972851
You posted this already.
Fuck off.
>>
>>53972950
OH FOR FUCK SAKE, THERE HE GOES AGAIN, HE CREATES ANOTHER FUCKING THREAD ALONG SIDE THE MAIN THREAD AND SPLITS UP THE /dpt/ AGAIN LIKE THE STUPID FUCKING RETARD HE IS.
GEE NOW I DON"T KNOW WHICH THREAD TO POST IN.
FUCK YOU TO HELL.
>>
>>53982129
calm down
>>
>>53982153
No, FUCK YOU.
I'm SERIOUSLY FUCKING PISSED.
>>
>>53982181
calm down
>>
>>53982129
I'm not quite sure what is the best way to tell you, anon, but you might have aspergers.
>>
I appreciate your hard work mod/janitor, but that thread has already reached bump limit and is on page 9.
>>
>>53982091
It's -4 from the start of the next instruction, i.e. in the middle of the current one in this case. In this form the code doesn't make sense, -4 is replaced by the actual offset by a linker.
>>
File: umaru.jpg (282 KB, 640x961) Image search: [Google]
umaru.jpg
282 KB, 640x961
>>53982091
e8 is relative call.


what
e8 <offset>
actually does is
PUSH EIP ; return address on stack
EIP += offset ; jump


the problem is that EIP point to the _next_ instruction, not to the current one, therefor you need to correct the offset.

example:

; the relative call is at 0x457810
; we want to call to the procedure FOO which is at 0x467810
; relative offset is 0x467810 - 0x457810 = 0x10000
; so our relative call is

0x457810 e8 <0x00010000> ; the problem is that at this point
; EIP is equal to the next instruction
; address which is 0x457815 therefore
; the offset is wrong.
;
; (0x457815 + 0x10000 = 0x467815)
;
; it's too much of 0x5 which is the size of
; the current instruction. we need to remove
; that size from the offset.
;
; (0x457815 + 0x10000 - 0x5 = 0x467810)
;
; we have now the correct offset.
0x457815 add eax, 5
>>
Beginner C programmer here.
Is it a good idea to always put static behind functions and variables that are local to a certain file or are there some drawbacks to it?
>>
>>53982535
Yeah, it's a good idea, I can't think of any drawbacks. In this case compiler won't even generate code for a function it inlined: https://godbolt.org/g/3Neff4 .
>>
>>53982535
static prevents the variables from being recreated every time the function is called, since they will continue to exist after the function ends
>>
>>53982592
That's static local variables, not static global variables we are talking about.
>>
Is there a threshold at which sleeping becomes accurate? I know that if you sleep for a very short time the actual time you spend sleeping varies wildly. Does this imply that at some point sleeping becomes exact?
>>
jesus guys.
Help me out. I'm working in python and would like to press some keys using win32api.

such as to press the F key (hex representation 0x46):
 win32api.keybd_event(0x46, 0,0,0) 


but I can't pass the key value as an argument to the program because it becomes a string. I tried passing the base-10 value, which is 70, and turning it to hex with hex(70). but that produces a string too.

How can I pass an argument into my python function, which will then pass an integer hex value into the win32api call??
>>
>>53982736
shit, I'm stupid.
forget this.

 win32api.keybd_event(0x46, 0,0,0)

is equivalent to
win32api.keybd_event(70, 0,0,0) 


for some reason I though it can only take hex representations as these are the ones listed on Microsoft's website.
>>
>>53982730
> Does this imply that at some point sleeping becomes exact?
No, it's just the relative error margin is going down as the timeout grows. You need RTOS for sleeping to be exact.
>>
>>53982730
Say you incur 2ms of overhead calling the sleep.

If you sleep for 10ms, obviously that's a huge difference.

If you sleep for 10000ms, then it doesn't really matter.

No, it will never curve back into an exact amount unless you get lucky with some sort of machine fuckery and it 'errors' back to the exact time.
>>
File: indians3.png (17 KB, 683x450) Image search: [Google]
indians3.png
17 KB, 683x450
>>53981724
I always debug while drinking, with a drinking game to go with it.

Makes it more fun.
>>
File: nightmare_goggles.jpg (40 KB, 722x349) Image search: [Google]
nightmare_goggles.jpg
40 KB, 722x349
>>53982891
this really triggers my SQLi.
>>
fark emulators are hard
I followed the chip 8 tutorial but I can't go do a NES one, since it's just documentation and no tutorials
>>
>>53982736
You need to use the win32 post or push function, google how to push key press to programs
>>
>>53977991
>he/it is THIS delusional
fuck off cancer fag
>>
>>53976433
Looking through this now, thanks for posting.
>>
Should I first learn Angular or Node?
>>
>>53983105
learn neither, fucking FAG
>>
>>53983117
Oh, forgot I was in the sperg thread. Nvm.
>>
>>53983105
no
>>
>>53983105
>>>/g/wdg/

Node, though. Seems like I see way more job applications mention it than Angular.
>>
File: DoF.png (625 KB, 798x511) Image search: [Google]
DoF.png
625 KB, 798x511
Converting my ray tracer to a path tracer.
Don't have any shading working yet, but I hacked in depth of field.
Pic related is obviously an extreme and unnatural example.
>>
>>53975128
Can someone explain to me how you can write code which only works on Ubuntu? Unless you are building out a GUI which only works on Gnome and hooks into pre-installed deps on Ubuntu, you should have everything you need. It shouldn't be like Windows with DWORD or something.

Correct me if I'm wrong though
>>
>>53983159
wdg is dead at the moment. I'm just not sure if I'll need to know Angular to work with node, and then there is express and all that other shit.
I would actually more likely stick with Rails but I'm on win10. Can it be installed on that or should I use (and which?) VM. I heard about Vagrant, and then there is Virtualbox.
>>
>>53983210
kill yourself fag
>>
>>53983179
They just don't want to test it on all 50 linux distros so they "officially support" only Ubuntu. The same way Steam supports only SteamOS and Ubuntu, yet it works on every distro without any problems.
>>
File: rip.jpg (76 KB, 500x575) Image search: [Google]
rip.jpg
76 KB, 500x575
>TFW SDL2 has an input function which puts the thread to sleep until there is input... but only allows you to use that function on the same thread which handles rendering
>Only one thread may handle rendering
Why would you do this?
>>
>>53979256
https://github.com/DrabWeb/Sudachi
>>
>>53983219
Back to your basement, manchild.
>>
>>53983210
From what I understand, they can both be used for monolithic applications built fully in JS syntax, but Angular has got the mobile app thing going for it.

Not sure if Node has a mobile GUI.
>>
>>53983232
it's normal, at least for oldish/embedded opengl, multithreaded rendering seems more common on desktop opengl
>>
>>53983232
>>53983264
i mean
>>Only one thread may handle rendering
the thing about input and rendering being done on the same thread is disgusting
>>
struct Save<T, I: Iterator<Item=T>> {
iter: I,
curr: Option<T>,
save: bool
}

impl<T, I: Iterator<Item=T>> Save<T, I> {
fn new(iter: I) -> Save<T, I> {
Save { iter: iter, curr: None, save: false }
}

fn check<F>(&mut self, func: F) -> Option<T>
where F: FnOnce(&T) -> bool {
if let Some(x) = self.curr {
if func(&x) && !self.save {
self.save = true;
self.curr = self.iter.next();
return Some(x);
}
}
None
}
}


This is giving me error: cannot move out of borrowed content on the line if let Some(x) = self.curr. Can anyone help? The compiler doesn't give any more info and trying to google it can't find any situation like mine.
>>
>>53983264
Okay, that's fair, but why would you only give the user one function which can take input (i.e. keyboard/mouse events) without busy waiting then make that function only work on the rendering thread? What does taking input have to do with rendering?
>>
>>53983298
Jesus fucking christ, what language is this?
>>
>>53983324
looks like rust maybe
>>
>>53983324
Rust.
>>
>>53983324
Some demonic variant of C.
>>
>>53983305
the thread with the rendering context controls whether rendering is continuous or otherwise, so like if you have a static menu or something, SDL ties it to input so it only renders when you interact with the menu. i'm not familiar with SDL but that's how i'm guessing it works
>>
>>53983324
Rust
>>
>>53983298
Something like this: https://godbolt.org/g/8bAi3s ?
I don't think you can do it without either cloning or consuming self, but I may be wrong.
>>
>>53983298
I've written pretty much the exact same struct myself in the past:
pub struct Save<I>
where I: IntoIterator, I::Item: Clone {
iter: I::IntoIter,
curr: Option<I::Item>,
save: bool,
}

impl<I> Save<I>
where I: IntoIterator, I::Item: Clone {
pub fn new(iter: I) -> Save<I> {
Save { iter: iter.into_iter(), curr: None, save: false }
}

pub fn save(&mut self) {
self.save = true
}
}

impl<I> Iterator for Save<I>
where I: Iterator, I::Item: Clone {
type Item = I::Item;

fn next(&mut self) -> Option<Self::Item> {
if self.save {
self.save = false;
} else {
self.curr = self.iter.next();
}

self.curr.clone()
}
}
>>
File: 1460376207722.png (460 KB, 2000x1090) Image search: [Google]
1460376207722.png
460 KB, 2000x1090
reminder
>>
>>53983591
>not C#
>>
>>53983559
>>53983589
Thanks. So what does cloning actually do? Pass by value?
>>
>>53983639
Pretty much.
>>
>>53983639
No, It makes a copy of an object, like C++ copy constructor. The difference is, in C++ it's implicit in most cases and in Rust you have to call it manually. It's quite costly (e.g. clonning a string will allocate another one and copy the content into it) so you probably should avoid it.
>>
>>53983648
Is there any way to get the code working with references? Using Cow maybe? Seems wasteful if T is something big.
>>
>>53983700
Rust's ownership system can be a real pain in the ass. Maybe use a Rc<> or something.
>>
File: 1460376207722.png (458 KB, 2000x1090) Image search: [Google]
1460376207722.png
458 KB, 2000x1090
>>53983591
>>
File: 1460331297495.gif (140 KB, 379x440) Image search: [Google]
1460331297495.gif
140 KB, 379x440
>>53983749
>C++
>>
>>53983749
>tfw currently learning shit
A-atleast it will be easier to switch over to C++ when you know the fundamentals of programming, than if you started with it, right?
>>
>>53983954
no, start with c++

I mean I have no idea, I don't know how education/psychology works so don't take my word for it.
>>
>>53983954
No. You shouldn't learn C++ at all.
Thread replies: 255
Thread images: 51

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.