The Big Programming Thread - Page 595
Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
FFGenerations
7088 Posts
| ||
FFGenerations
7088 Posts
On February 26 2015 15:07 Blisse wrote: the .get(ForecastResponse.class) isn't working, no clue why just call .get(String.class) and it'll give a string object you can work with instead (unless it fails) was trying to do something like this and got it to work with your encouragement coz i was giving up LOL VaadinUI.java
JsonService.java
solution to get it to work: just delete fucking everything | ||
Manit0u
Poland17202 Posts
On February 26 2015 15:17 nunez wrote: can you really put a comment in the middle of chaining calls or is that just added after for clarity? Most languages let you put comments in the middle of a chain.
A tested and working example:
Edit: I believe I misunderstood you. Were you asking of where to best put a comment? Personally, with really long chains I'd put each call on separate line and add a comment after the call if necessary (this way it's clear which call are you commenting on).
| ||
Manit0u
Poland17202 Posts
Was fun. | ||
nunez
Norway4003 Posts
i was not aware that was possible until now! | ||
Manit0u
Poland17202 Posts
On February 26 2015 23:17 nunez wrote: @manit0u i was not aware that was possible until now! Well, the compiler treats comments as blank space, so it doesn't really matter where you put them, as long as you don't obfuscate your own code too much with it. Or you can use it to add some coolness to your code, something similar to this Pi calculating program:
+ Show Spoiler [compilation] + gcc -traditional-cpp -o r r.c or this flight simulator:
+ Show Spoiler [compilation] + cc banks.c -o banks -DIT=XK_Page_Up -DDT=XK_Page_Down \ -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ -DCS=XK_Return -Ddt=0.02 -lm -lX11 -L/usr/X11R6/lib | ||
sabas123
Netherlands3122 Posts
a loop is to short to be exucted.... wtfX_X I had this problem when I was doing SDL_AddTImer in my project.... most anoying shit if seen so far like wtf.... http://pastebin.com/6rgmRuHY http://imgur.com/5CTBjtI,9Hb44E9#1 | ||
nunez
Norway4003 Posts
you wrote two infinite loops, that call printf "something" a finite number of times. my guess is that you are wondering why the example with the smaller number does not show any console output, this is because the printf function is buffering the data. with the bigger number of times it eventually has to flush the data, because it does not have anymore room to buffer. if you add a newline to the end of your string, it will force a flush, and you will see output in both examples. | ||
sabas123
Netherlands3122 Posts
On February 27 2015 08:22 nunez wrote: it's a bit unclear to me what you mean by works. you wrote two infinite loops, that call printf "something" a finite number of times. my guess is that you are wondering why the first example does not show any console output, this is because the printf function is buffering the data. with the bigger number of times it eventually has to flush the data, because it does not have anymore room to buffer. if you add a newline to the end of your string, it will force a flush, and you will see output in both examples. aaahhh thank you, that feels so unintuitive thou lol. | ||
nunez
Norway4003 Posts
| ||
sabas123
Netherlands3122 Posts
On February 27 2015 08:27 nunez wrote: it felt so unintuitive, from now on it will be the most natural thing in the world. haha ye. anyway any idea how I can make my SDL_AddTimer work? so far the only time I got it to work was to put it in an ifinity loop and then hope it doesn't crash. + Show Spoiler + Uint32 callback( Uint32 interval, void *p){ printf("something"); return 0; } int main (){ bool quit= false; SDL_TimerID timer; timer = SDL_AddTimer (6000 , callback , NULL); while(!quit){ //to keep the programm running } return 0; } | ||
nunez
Norway4003 Posts
here's a small example where the main thread spins on a boolean flag flipped by the callback, as an alternative to infinite loop. #include<cstdint> | ||
Ropid
Germany3557 Posts
| ||
nunez
Norway4003 Posts
the callback is run on a separate thread created by the library. (or that's what the SDL reference implies). in the example on the sdl site (which i'm assuming you looked at), the library thread communicates to the main thread by way of adding an event to the sdl message queue, which the main thread is blocked waiting for events on. i used a boolean flag because i figured it was a simpler demonstration. | ||
Manit0u
Poland17202 Posts
Recently I've switched jobs. I've went from creating all sorts of websites to the company that only does SaaS, which was a nice thing in itself (less bullshit, more cool things, all projects done with the same framework instead of flipping through 4 or 5 of them etc.). The thing that made me realize it was a really good move was when on the first day of work I saw the internal server names used by the company: - gitlab: drone - jabber: zerg - testing: templar etc. etc. At this point, I knew I'm home. ![]() | ||
nunez
Norway4003 Posts
| ||
phar
United States1080 Posts
| ||
FFGenerations
7088 Posts
On February 27 2015 10:12 Manit0u wrote: Allow me to share my happiness with you. Recently I've switched jobs. I've went from creating all sorts of websites to the company that only does SaaS, which was a nice thing in itself (less bullshit, more cool things, all projects done with the same framework instead of flipping through 4 or 5 of them etc.). The thing that made me realize it was a really good move was when on the first day of work I saw the internal server names used by the company: - gitlab: drone - jabber: zerg - testing: templar etc. etc. At this point, I knew I'm home. wow wtf that is godly | ||
Blisse
Canada3710 Posts
i balance it by not sleeping but i feel like there's a better way... | ||
Prillan
Sweden350 Posts
On February 27 2015 17:32 Blisse wrote: how do yall balance working with all the other stuff you wanna do? i balance it by not sleeping but i feel like there's a better way... I'll let you know when I figure it out. | ||
| ||