[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: 42
File: himegoto considered harmful.png (1 MB, 1000x1400) Image search: [Google]
himegoto considered harmful.png
1 MB, 1000x1400
`'Frob'` Edition

Previous thread;
>>55326123

What are you working on, \g\?
>>
>>55338200
>\
wincuck detected
>>
File: 1466120522034.png (287 KB, 599x450) Image search: [Google]
1466120522034.png
287 KB, 599x450
>>55338208
>using strings for filepaths
Shitty OS detected
>>
>>55338200
I'm making a testcase for a library in java called jawampa.
>>
File: 1406803019377.jpg (103 KB, 1280x720) Image search: [Google]
1406803019377.jpg
103 KB, 1280x720
>>55338200
Please stop posting your forced meme trapshit, and kill yourself.
>>
File: s9e2pidp.png (966 KB, 1152x873) Image search: [Google]
s9e2pidp.png
966 KB, 1152x873
I wrote a program that says if a person in a picture is nude or clothed.
>>
>>55338363
Nice, what does it use, a neural network or something?
>>
>>55338396
Yes, I used Google's TensorFlow.
>>
>>55338200
Donald Trump will purge your degenerate ass.
>>
>>55337929
>also don't use linked lists
why not?
>>
>>55338363
can you do one to detect anime images or kpop images?
>>
>>55338538
Probably. I'm still new at this. I'm tweaking the model right now and causing it to break in most unexpected ways. It's going to be a long road for me.
>>
>>55338558
Hello tumblr.
>>
>>55338569
I'm YUGELY more conservative than you are, Trumpkin. Believe me. Believe me.
>>
Anime girls reading programming books is my fetish desu senpai.
>>
you should no longer say "recursion"
you should now say mise en abyme

https://en.wikipedia.org/wiki/Mise_en_abyme
>>
File: required reading for (You).png (381 KB, 528x528) Image search: [Google]
required reading for (You).png
381 KB, 528x528
>>55338481
l.lists are worse than vectors in almost every imaginable way

>>55338795
excellent taste
>>
>>55338334
>>55338558
POLITICS PLEASE LAVE
>>
Delphi :-( I don't understand we are using delphi.
>>
A realistic 3D cheese pizza MMORPG
Looking for free 3d models now lel
>>
>>55338363
source?
>>
File: this article is real and true.png (329 KB, 711x610) Image search: [Google]
this article is real and true.png
329 KB, 711x610
>>55338954
Stop posting this every thread.
This isn't even programming related.
Go to /v/ or /vg/ or wherever that game dev general is.

>>55338883
At least it isn't Java
>>
>>55338978
>game programming
>not related to programming
hurrrr
>>
>>55338852
>lists are worse than vectors
in case you don't know, they have different use cases
>>
>>55338962
Here: http://pastebin.com/nzyz2G7A

It's mostly from advanced google's MNIST for TensorFlow tutorial.

If anyone here could help me find out why the model completely fails to learn anything when I feed it pictures sized 56x56 instead of 28x28, it would be extremely helpful.

I am probably going to ask this on stack exchange somewhere if I can't figure it out.
>>
>>55338996
None of your post was about programming you dumbass.

>>55339012
There are no good use cases for a mutable linked list.
>>
>>55338200
Working on creating a BlackJack game using the gtk toolkit
>>
>>55339038
you wrote 3 posts crying about things not being related while I made one post asking for a component in the development of the game, stop shitposting moron
>>
File: PhD in Incompetence.png (125 KB, 813x600) Image search: [Google]
PhD in Incompetence.png
125 KB, 813x600
>>55339052
>it's game related so it's programming related
Back to /v/ you go
>>
>>55339077
>what are requirements for the development of something
Back to the short bus senpai
>>
>>55339038

LLs have one good use case, which is making your software slower. This will allow you to majorly increase performance in future revisions, so it looks like you're actually doing something.
>>
>>55339077
In any decent language you should be able to simply
a[0], a[1] = a[1], a[0]
>>
>>55339153
>In any decent language you should be able to simply
std::swap(a[0], a[1])
>>
>>55339175
In any decent language you should be able to simply work with immutable structures efficiently
>>
>>55339038
fib heaps require linked lists

binary trees are essentially linked lists

skip lists require linked lists
>>
>>55339198
In any decent language you should be able to simply declare the start and outcome and have it compute the result.
>>
>>55339144
You are completely in the wrong.
You've literally just told us you're fetching models.

What the fuck does that have to do with programming?
Fucking nothing. Nothing whatsoever.

Are you going to ask us about what our favourite music is? After all, that might help with what music you'll put in the game, and therefore you'd say it's programming related because it relates to game development.

>>55339216
Binary trees are not "essentially linked lists".
Binary trees are binary trees.
>>
>>55339243
Thread asked what I was doing right now that is programming related.
I said I am programming a 3d cheese pizza MMORPG.
You had a BPD meltdown telling me to gobak2/v/ and wrote long paragraphs telling me to go for what?
If you're this desperate for online spotlight in your cyber refuge from real life, you can have it, you just had to ask.
>>
>>55339269
>Thread asked what I was doing right now that is programming related.
>asked what I was doing right now that is programming related
>programming related

>A realistic 3D cheese pizza MMORPG
>Looking for free 3d models now lel
>looking for free 3d models
>>
>>55339285
again
>what is asking for potential leads to resources in the building / programming of my game
>not related to the development / programming of it
dude, this is the internet, you dont have to fight for attention, you can have it.
>>
>>55339038
>There are no good use cases for a mutable linked list
are you admitting I'm smarter than you?
>>
>>55339334
>not related to the programming of it
Exactly, you finally understand.
Procuring resources for X is not programming related just because X is.
Please in future refrain from posting in every /dpt/ about how you're making a game, and every individual non-programming task that requires you to perform.
>>
>>55339153
>having = as a mutating operator
Disgusting.
>>
>>55339269
anime lolis are better.
>>
>>55339431
>not having mutable arrays
kek
>>
File: moot.jpg (85 KB, 1024x512) Image search: [Google]
moot.jpg
85 KB, 1024x512
>>55339452
Who are you quoting?
>>
>>55339463
(You)
>>
>>55339480
I don't recall saying anything about no mutable arrays
>>
if 5x5x5m cube of steel weighs 10 tons, how much does 15x15x15m cube made of steel weigh?
I am coming up with 270 tons, but that seems like bullshit number to me
>>
>>55338404
You can do that? Is it some downloadable thing or are you dependat on connecting to some online google server (which would made it useless shit) ?
>>
>>55339444
I want to make it as realistic as possible while maintaining it's legality to piss people off
>>55339410
but what if I am asking for models in order to transform them into matrices / vertices which is code? owned kiddo
>>
>>55339530
>in order to transform them into matrices / vertices which is code
>matrices/vertices which is code
???

>>55339510
3375m^3 * 10T/125m^3
= 10T * 27
= 270 T
>>
>>55339510
270 it's right
>>
>>55338200
I want to improve my coding. I always manage to cum my code all over the classes but I name my variables and methods well and I also follow diagrams.
>>
>>55339605
>diagrams
You aren't one of those UML cunts are you?
>>
>>55339631
YOU DECIDE! :^>
>>
>>55338978
Sorry, I prefer Java :-)
>>
File: qt1.png (34 KB, 1235x617) Image search: [Google]
qt1.png
34 KB, 1235x617
>>55338200
Panafrican SMS-based application where all kinds of producers as small as they might be can "publish" whatever produce they have on sale using nothing but numbers (apparently there are many analphabets but everyone knows how to type in numbers).

Basically a peasant would have a list of produce like wheat, maniok, corn or whatever, different quality grades and from that they would send a number code per sms to a number with the ammount of items they have on sale.
Anyone looking to sell would immediately receive the location, price and volume of those willing to sell near them.

Right now its probably going to be some hashlist or hashbased data structure with built-in checksum so that a typo is automatically caught.

Because of performance requirements and probably limited resources on the server side its going to be a C++ project, maybe some Qt for the GUI.

Was thinking about setting it up using something like IPFS to ensure maximum availability but that might be a bit of an overkill.

Kickoff is probably going to be in 1-2 weeks in Tansania.
Already got two ministers of economy that cant wait to see this get started.
>>
>>55339711
> things that never happened
S14E88
>>
File: 1450282508397.jpg (65 KB, 541x651) Image search: [Google]
1450282508397.jpg
65 KB, 541x651
>>55338280
You wot m8
>>
>>55339711
P cool, good luck mate.
>>
File: 1406627084942.jpg (28 KB, 509x511) Image search: [Google]
1406627084942.jpg
28 KB, 509x511
>>55339750
screenshot it and wait a few month.
Might not be superbig if there are budget cuts, but there will be at least two countries participating.
>>
>>55339750
>never accomplished anything in my life so im gonna tell everyone they're lying so i can keep feeling better about being a loser
ok lol
>>
>>55339803
We all have succeeded.

When our father filled our mom's internal HDD with millions of malware only one could remain unnoticed inside and that one is we. :>
>>
Check my fizz buzz without any conditionals.

#include<stdio.h>
#include<stdlib.h>

int fizz(int i){
int (*f[])(int) = {fizz, exit};
static char* s[] = {"%d\n", "fizz\n", "buzz\n", "fizzbuzz\n"};
printf(s[!(i%3) + !(i%5)*2], i);
f[i/100]((i+1)%101);
}

int main(void){
fizz(1);
}
>>
File: anime.png (201 KB, 335x365) Image search: [Google]
anime.png
201 KB, 335x365
>>55340080
Very good, well done.
>>
File: FB_IMG_1466222897859.jpg (26 KB, 480x492) Image search: [Google]
FB_IMG_1466222897859.jpg
26 KB, 480x492
>>55340080
Ugh..

That's why they came up with the garbage collector
>>
>>55340080
fucking disgusting
i like it
>>
>>55339711
>Tansania
>two ministers of economy

I laughed, thanks
>>
>>55340141
why would anyone thrash a perfectly good loli
>>
File: R-a-dio OSX.png (239 KB, 896x480) Image search: [Google]
R-a-dio OSX.png
239 KB, 896x480
Working on requesting and favouriting songs in my R/a/dio front end
>>
>>55340080

Nice.
>>
>>55340255
I swear if this is some Electron bullshit I'm going to rm -rf / remotely
Your font rendering looks fucked up
Make the Song name - Artist separation more readable
These colors are awful
>>
File: linus the serial killer.jpg (204 KB, 575x467) Image search: [Google]
linus the serial killer.jpg
204 KB, 575x467
>>55340182
well the one of Tansania and of another country.
Im not doing the PR though, I am/will be in charge of the software department.
>>
File: FB_IMG_1466568047844.jpg (19 KB, 278x395) Image search: [Google]
FB_IMG_1466568047844.jpg
19 KB, 278x395
>>55340255
>>
>>55340311
>I swear if this is some Electron bullshit I'm going to rm -rf / remotely
No, its a native cocoa app

>Your font rendering looks fucked up
Trying to fix this, its a problem with the text field when its unselected

>These colors are awful
The application is vibrant so it shows the background blurred, my background is yellow so the application looks yellow
>>
I ditched my GitHub account and I'm currently setting up my own server.
>>
No one can possibly fathom how much I now wish I could just delete the damn project and restart it from scratch with new knowledge.

25 years of programming experience and I somehow manage to fuck up the whole architecture so thoroughly (not bad algorithms or storage choices, just thoroughly hacked-up design) that I can't do anything else than just stare at the whole mess and weep. A year's worth of code down in the drain.

Sorry, I just had to vent.

I think I'm going to play games or something for the next few months instead and forget this whole thing.
>>
>>55340255
Since when can you favourite with the r/a/dio API?
>>
>>55340510
You cant, im putting my own implementation in the app
>>
>>55340507
can you try to refactor it somehow?
define your function as black boxes (what goes in, what goes out) and rewrite them one by one?
>>
Does anyone have experience with network coding here?

I was thinking about making a program with a networking component. I know I could hack something together to make it work, but I don't want to have to rewrite the whole thing if it ever gets to the point of having a lot of users.
I know networking is one of those instances where performance is critical, but I don't know how early that kicks in.

For the sake of giving a more concrete example, let's say I want to make a chess server, where clients can connect, get matched up with someone, submit moves, have the server validate the moves and relay to the opponent/any spectators.
What kind of a server do I need to support 100, 1,000 or 10,000 clients like this? I figure for 100 I'll definitely be fine using a highlevel language, and just running each connection on a separate thread synchronously. But at what point do I need to worry about using async sockets, or even switching over to C/C++?
>>
>>55340745
>I know networking is one of those instances where performance is critical, but I don't know how early that kicks in.
wut
>>
>>55340745
>and just running each connection on a separate thread synchronously. But at what point do I need to worry about using async sockets, or even switching over to C/C++?

You need to worry about it already because you're doomed to fail if you're going to do thread per connection. You want async sockets/polling. A lot of the performance will also boil down to tuning the kernel's network stack.
>>
I started CS50x Monday and just finished Week 0 yesterday.
Currently watching the first Week 1 lecture now.
I had 0 knowledge of programming before starting.

AMA
>>
>>55340873
>AMA
When will you go back tu reddit?
>>
>>55340745
>muh performance
Just write that shit and call it a day. Optimize it when you need to.
Simply having some way of handling connections concurrently is enough for now.
>>
File: Untitled.jpg (218 KB, 1013x1057) Image search: [Google]
Untitled.jpg
218 KB, 1013x1057
Still working on anime usenet indexer.

Just finished working on a script that matches a post to its respective series. Seems accurate enough, and lets me show the alternative titles like animebyt.es does. Will eventually be able to incorporate it in the search so searching for "Nichijou" series will show results that contain "日常" and such.

I think the site itself looks pretty shit. It's all white and blue, and looks like the godawful default bootstrap theme even though it's all my own style without a framework. Hopefully it looks better with some thumbnails when I get around to that.
>>
>>55340745
For chess you need to support exactly exactly two users. Think about it.
And performance would not at all be critical, people have been playing chess over postal mail for centuries and having fun.

Have cache at your network connection, parse the "packets" i.e. the moves actually, for validity.
If they pass, move them forward to the opposite side and write them to the server, discard the packet.
You will need to have at most #users/2*sizeOfMoveInKB caching space.

>>55340891
AMA started here, dipshit.
Plebbit just stole it like they steal everything.
>>
> tfw too cheap to buy this

http://papilio.cc/

I hate being such a greedy bastard. I really want this but FUCK IT'S 40 DOLLARS
>>
>>55340927
>tfw made enough money today so far to buy two of these
Poorfags btfo
>>
File: reddit.gif (2 MB, 255x245) Image search: [Google]
reddit.gif
2 MB, 255x245
>>55340873
What the fuck is CS50x?

>>55340915
>AMA started here
So did troll and rage faces, as well as reddit man face (pic related)
>>
>>55340988
Harvard's introduction to computer science course.
>>
>>55341002
How do you get into Harvard compsci knowing nothing about programming?
>>
>tfw Thursday and Friday are when all the qts show up at work
>>
>>55341049
Its free for anyone and meant for people with 0 knowledge.
>>
>tfw your coworkers see you as a magician just because you use git and vim
>>
>>55341057

>im going to impress them with my sponge bob memes
>>
>>55340911
Season 2 when?

;_;
>>
>>55341233

if only they new im kinda good at them
>>
>>55340819
>tuning the kernel's network stack.
That seems excessive, and the kind of optimization that can be done later on if it ever gets to the point that it's needed.

>>55340909
Normally I'd agree with you but it's a case of having to literally rewrite the entire thing if it's too slow.

>>55340915
Two users per game, yes. But if you go on any chess server (lichess.org is open source for example), you'd see that there can be hundreds if not thousands of games running concurrently. What you are describing works well for correspondence (similar to postal mail) chess, but not live chess.

I guess I'll have to buckle up and learn how to use async sockets properly like the first anon said. But I think I can still stick with a high level language.
>>
>>55341262
No no no anon, I'm going to throw a virus on their computer and then come in to save the day
>>
>>55341263
Never. Nichijou is the last good anime Kyoani have ever and will ever make.
>>
File: convicted pedo.jpg (54 KB, 980x490) Image search: [Google]
convicted pedo.jpg
54 KB, 980x490
>>55341233
>tfw you see your vim using coworkers as subhuman trash
>>
>>55341297
>Normally I'd agree with you but it's a case of having to literally rewrite the entire thing if it's too slow.
Well, some framework to lift your burden. Go is pretty good when it comes to handling lots of requests. boost::asio looks good too.
Just keep in mind that most of your performance comes from disk/network I/O. CPU time is not an issue.
>>
>>55339528
It's a python library basically, they have a great tutorial @ https://www.tensorflow.org/
>>
>>55341297
You could also balance the workload by splitting the server into multiple parts. Have something like auth/session, matchmaking and the game server separate entities, then make them communicate using some MQ. Also since you're mentioning C++ then go with Boost.Asio, it's pretty straightforward once you get familiar with the docs and it's quite performant because it can adapt the polling depending on the platform it's running. Also, while I know we already established that you're using C++, your initial idea with threads per connection would have been alright had you used a language with green threads but otherwise it's too expensive to spawn & switch context with so many threads.
>>
8, 4 or 2 tab width?
>>
>>55341551
3
>>
>>55341551
4
2 is eye cancer and 8 is just a waste of space
>>
>>55341551

4 is clearly the superior option.
>>
>>55341551
16
>>
File: 1466329334062.jpg (24 KB, 258x263) Image search: [Google]
1466329334062.jpg
24 KB, 258x263
>>55341551
>using tabs
>>
>>55341467
>You could also balance the workload by splitting the server into multiple parts. Have something like auth/session, matchmaking and the game server separate entities, then make them communicate using some MQ.
Yes, the design I had in mind would have one thread listening for new clients, then authenticate them etc, then hand them over to a match making thread. The match making thread would start a session between 2 users, and this session would be handed of to another thread.
It's the approach I've used before and had success with. It has an intuitive separation of responsibilities and there's no reason the matchmaking or log-in threads can't run on different servers entirely (I know some big MMOs do this).

However I have no idea what this would look like if it were implemented with async sockets. Can I even do it in the same way or do I need a completely different overarching design?

>green threads
I didn't even know this was a thing. My experience with high-level languages is pretty restricted to C# (unless you count C/C++ as high level), and C# doesn't seem to have green threads. However it does have a ton of other threading features like background workers and async/await. Boost.asio looks promising though so I might have to brush the dust off my C++.
>>
>>55341551
5 mustard race
>>
>\
remove cucks
>>
>>55341745
>However I have no idea what this would look like if it were implemented with async sockets. Can I even do it in the same way or do I need a completely different overarching design?
Basically the basic idea behind it is that you keep three threads. One for the async polling and data receiving, one to enqueue tasks based on incoming data, and one to dispatch these tasks, plus of course locking mechniasm to prevent data races, you can then expand from there.
>>
File: rtm.png (104 KB, 540x435) Image search: [Google]
rtm.png
104 KB, 540x435
Working on this thing, it's coming along
>>
>>55342044
Is it a virus?
>>
>>55342044
>Yolopr0_smoker
>>
File: w3mimgdisplay.png (18 KB, 546x518) Image search: [Google]
w3mimgdisplay.png
18 KB, 546x518
>>55341551
8 width tabs with 4 space indentation.
like w3m does
>>
>>55342111
>w_op->async(w_op)

For what purpose?
>>
>>55342111
Literally why not just use 4 space tabs, or just 4 spaces?
>>
File: umaru.gif (4 MB, 480x480) Image search: [Google]
umaru.gif
4 MB, 480x480
Hey /g/, rate my captcha verification code!
int validate_captcha(char *captcha_response)
{
/* open a shell and validate captcha externally */
char *cmd_str = (char *) malloc(sizeof(char) * BUF_MAX);
sprintf(cmd_str, "curl -d \"secret=%s&response=%s\" %s > /tmp/aaaaaaaa.ok",
captcha_secret, captcha_response, captcha_url);
system(cmd_str);
free(cmd_str);
char *verify_str = create_filebuffer("/tmp/aaaaaaaa.ok");
system("rm -rf /tmp/aaaaaaaa.ok");
int success = (strstr(verify_str, "\"success\": true")) ? 1 : 0;
free(verify_str);
return success;

}
>>
File: umaru happy ending - no sound.webm (511 KB, 1280x720) Image search: [Google]
umaru happy ending - no sound.webm
511 KB, 1280x720
>>55342158
> { on newline
Disgusting. 0/10 never post again.
>>
>>55342176
>being a retard
>>
>>55342086
No, it's a RTM tool for PS3s
>>
>>55342176
Fuck you

int master ()
{
if (race) {
} else {
}
}
>>
File: AAY.png (182 KB, 1344x584) Image search: [Google]
AAY.png
182 KB, 1344x584
doing "C programming a modern approach"
some anon told me yesterday that it was not modern, is this book outdated?
>>
>>55342290
>else if else if else if else if
>>
>>55342290
Not really. It covers C99 and still does a great job explaining C.
>>
>>55342317
is that wrong?
>>
>>55342290
I did. As long as the book covers C99, you're fine.
>>
>>55342355
It works but it's absolutely disgusting
>>
>>55342355
you could use a switch.
switch (wind_speed) {
case INT_MIN ... 1:
case 2 ... 3:
case 4 ... 27:
case 28 ... 47:
case 48 ... 63:
case 64 ... INT_MAX:
}
>>
>>55342401
Non-standard extension
>>
>>55342401
it says in the book that you cant use switch with ranges of numbers
>>
>>55342290
struct Entry { int speed; char *name; };
struct Entry entries[] = {
{63, "Hurricane"},
{48, "Storm"},
// ...
};


int num = sizeof(entries) / sizeof(Entry);
for(int i = 0; i < num; ++i)
{
if(speed >= entries[i].speed)
{
fprintf(stdout, "%s\n", entries[i].name);
break;
}
}
>>
>>55342420
right, looks nice though.
>>
>>55342446
It's been a while since I've tried C, but I thought you could do:

switch(true)
{
case wind_speed < 1:
...
case wind_speed < 4:
...
etc...
}
>>
>>55342466
> { on new line
> unnecessary pair of braces
Disgusting
>>
>>55342395
It's not even bad...
Not everything has to be ridiculously complex.

Would you prefer this?
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

struct ws
{
int max_speed;
const char* name;
};

struct ws ws_table[] = {
(struct ws) { 1, "Calm" },
(struct ws) { 4, "Light air" },
(struct ws) { 28, "Breeze" },
(struct ws) { 48, "Gale" },
(struct ws) { 63, "Storm" },
(struct ws) { INT_MAX, "Hurricane" },
};

int main ()
{
char buffer[64];
int i, wind_speed;

printf("Enter a wind speed (knots): ");
fgets(buffer, 63, stdin);
wind_speed = strtol(buffer, NULL, 0);

for (i = 0; i < sizeof(ws_table) / sizeof(*ws_table); i++)
{
if (wind_speed < ws_table[i].max_speed)
{
puts(ws_table[i].name);
break;
}
}

return 0;
}

Or perhaps I should've implemented binary search

>>55342501
You can't.
Also I've never seen
case a ... b:

form, it's probably a very nonstandard extension.

Keep learning C, anon, don't listen to any of these fucks.
>>
>>55342550
In a decent language this would be much easier
>>
>>55342550
https://gcc.gnu.org/onlinedocs/gcc/Case-Ranges.html
>>
>>55342550

Compound literals are goat.
>>
>>55342572
wsTable = [ (1,"Calm")
, (4,"Light air")
, (28,"Breeze)")
, (48,"Gale")
, (63,"Storm")
, (9999,"Hurricane") ]

main = do
putStr "Enter a wind speed (knots): "
inp <- getLine
putStrLn
$ snd $ head
$ filter (((read inp) <) . fst) wsTable

wew
>>
So can someone tell me why its a bad idea to use opengl for gui programming.
>>
>>55342145
subtype polymorphism
>>
>>55342204
>muh inconsistency
>>
>>55342762
Because using OpenGL is the biggest pain in the ass in all of programming and putting yourself through the fuckign OpenGL pipeline just to draw some buttons on the screen sounds almost as painful as stabbing yourself in the arm with very large needles.
>>
>>55342762
A lot of work to do yourself when there are already libraries out there for you to use.
>>
>>55342752
>$ $ $
pls
>>
File: Screenshot_2016-06-30_22-28-28.png (359 KB, 679x407) Image search: [Google]
Screenshot_2016-06-30_22-28-28.png
359 KB, 679x407
Working on a shitty imageboard's configuration webUI. The backend for this part is practically done and need the frontend now. Everything is done through websockets. No page refreshes, no frameworks.
>>
>>55342804
>mad that Haskell programmers make more $$$ than C programmers
>>
>>55342752
easier to code maybe, not easier to read
>>
>>55338200
>99% of nu-/dpt/ have no idea what ]Frob[ even is
>>
>>55342747
and useless for that example
>>
>>55342859
>ive been here last summer
>>
My gaem in Unity. No bully please, I wrote my own breast physics and everything.
>>
>>55342910
>claims to have written breasts physics
>doesnt post any webms

fuck off
>>
>>55342550
>char buffer[64];
>64
>fgets(buffer, 63, stdin);
>63
cargo-culting
>sizeof(ws_table) / sizeof(*ws_table)
cargo-culting
>>
>>55342941
well memed
>>
I just i need help i really want to learn to code but i dont know what should i read or practice i know some java and thas all fuck i want to die
>>
>>55342965
Learn maths first, then category theory, and then you'll be ready for Haskell
>>
>>55342550
>int main ()
>return 0
anon...
>>
>>55342879

You're useless.
>>
>>55342961
>I don't even know C
>>55342988
>I'm a retard as proven again and again
>>
>>55342985
>>55342941
Fucking sue me, autismos. My code compiles with -Wall and produces the correct results on any input.
>>
>>55342939
I would, but I don't know how to make webms :( Man, they are jiggly though
>>
>>55343021
>don't educate me, I'm happy with my ignorance
enjoy
>>
>>55343013
>I'm a retard

You sure are.
>>
>>55342158
>what is libcurl
lad...
>sizeof(char)
oh, you're retarded, my bad
>>
>>55343051
>fgets(buffer, 63, stdin)
I had the man-page open and I read it wrong. Besides the C stdlib is so inconsistent with lengths and null bytes. But I'm not going to be parsing 63 character integers anyways.

>sizeof(ws_table) / sizeof(*ws_table)
What's wrong with this? It's exactly the same as (... / sizeof(struct ws)), arguably better. I should have omitted the condition, though.

>int main ()
What, I forgot the fucking (void)? What year do you think it is? Besides nobody is going to fucking call my main.

>return 0
Wow, I like being explicit even though the standard TECHNICALLY says I don't have to return anything


It's not ignorance, it's called not being absurdly nitpicky.
>>
>>55342965
write a program that prints every prime number less than 10,000
>>
>>55343139
main = show [ 1 .. 10000 ]
>>
>>55343161
*print
main = print [ 1 .. 10000 ]
>>
There any good books to start learning programming?
>>
>>55343288
pic related
>>55338852
>>
I'm supposed to graduate with this

https://www.youtube.com/watch?v=e1r5VrDtG7k

https://github.com/jose-villegas/VCTRenderer
>>
>>55342747
That's one of the things C99 poorly copied from Algol 68.

Algol 68 is one of the languages every CS program should teach, along with PL/I and Simula 67.
>>
>>55343398
Do Algol 68 compilers even exist?

Also, CS curriculums are always dumbed down to cater to "tha industry!"
My university teaches Lisp (Racket) in their intro course, and supposedly people like to shit on them because "it's not what the industry uses!"
Fuck Java.
>>
Hmm, I fancy writing some asm/bare metal stuff, but a whole x86/x64 kernel sounds horrifying...

What should I write? I'd like to learn more x64 assembly but like I said, bare metal means wading through decades of legacy bullshit.
>>
File: hr1.png (70 KB, 1212x884) Image search: [Google]
hr1.png
70 KB, 1212x884
>>55343288
you only read a book if you're in college and you have no choice
if you actually want to learn something you go out and do it
hackerrank.com
>>
>>55343449
>programming is now hacking
>social engineering is now hacking
>knowing how to use a computer is now hacking

Who /masterhacker/ here?
>>
>>55343449
I been trying code academy i will try this one too
>>
>>55343448
Get a pi or another small processor and try to interface it with another piece of hardware.
>>
Quick question.
If I have these structs declared
struct q_pair {
char *field;
char *value;
};
struct q_container {
struct q_pair *queries;
unsigned count;
};


And I do something like
struct q_container q;
q.queries = (struct q_pair *) malloc(sizeof(struct q_pair) * 10);
q.queries[0].field = (char *) malloc(len + 1);
q.queries[0].value = (char *) malloc(len + 1);


How do I access the *field and *value pointers?
Because
strcpy(self.queries[i].field, "dicks");
doesn't work.
>>
Anyone here have experience learning a new language while taking Ritalin?
>>
>>55343545
Yes it does work. Why doesn't it work? Maybe some other code isn't working ('self', or 'i'?)
>>
Are there any reasons to use C over C++?
>>
File: 1440563118852.gif (49 KB, 69x120) Image search: [Google]
1440563118852.gif
49 KB, 69x120
>>55343552
I used various stims while learning my first language and, to no one's surprise, it helps a lot as far as motivation and focus is concerned.
>>
>>55343584
Dynamic arrays, compound literals.

That's it
>>
>>55343584
Masochism
>>
>>55343601
But in all seriousness, if you're writing extremely low level code (baremetal), you probably won't need 90% of the features of C++. In that case you usually go for C, also because of its lack of name mangling
>>
>>55343482
It has always been. Educate yourself, fag.

https://www.gnu.org/philosophy/words-to-avoid.en.html#Hacker
>>
>>55343666
>guessing someone's password 'playful cleverness'
>knowing how to use a computer 'playful cleverness'
>knowing how to program 'playful cleverness'

Nice try Satan
>>
>>55343398
>PL/I

This is one of those things that it's a serious shame history forgot.
>>
>>55342158
If BUF_MAX is a constant then why do you need malloc?
>>
What's the best way to learn programming, by doing the examples or taking notes on every single detail in the book?
>>
>>55343774
if i tried char buf[BUF_MAX] it segfaults immediately, you can't put it on the stack
>>
>>55343398
My CS course actually had one course that was a journey through programming language history, starting with Fortran and Lisp, and through things like Algol and Smalltalk and Pascal and ML, to Scala (which was exciting and new at the time)
>>
>>55343120
>read it wrong
>What's wrong
>I forgot
>It's not ignorance
it's either that or mental illness
>>
>>55343800
Do the exercises

Don't make copious notes, you won't learn anything. Learn by doing
>>
>>55343800

Both, and frequently. Better to come up with personal projects than do exercises all the time. In the course of working on projects, you will be forced to learn things.
>>
>>55343545
>undeclared identifier len
>undeclared identifier self
>doesn't work
I wonder why
>>
>>55340745
I'm an expert at network coding. You seem like a beginner so I suggest you just read a fucking tutorial and do the shit in Python. Try that shit in C with no prior experience and you'll spend most of your time figuring out what parameters to put in your make file instead of working on the actual game.
>>
>>55343866
I'm not going to put everything, you get the idea.
I'm asking about access operators.
>>
>>55343821
>I don't really know the language I just try random shit until il works
>>
>>55343581
Ok, I found the problem.
I'm assigning pointers like this.
char *ptr = (i % 2) ? self->queries[j].value : self->queries[j].field;
ptr = (char *) malloc(len + 1);
ptr[len] = '\0';
j += (i++ % 2);


I can write to the char *ptr and the text is still there but they're not assigning to the self->queries[j],value.
>>
>>55342158
>captcha_secret
>captcha_response
>captcha_url

are all undefined
did you remove them before posting it here?
>>
>>55341297
>rewrite the entire thing
no, the entire server logic remains the same, you only have to rewrite the way you acquire packets and the way you send packets
>>
>>55344048
>int x=0;
>x=1;
>why doesn't 0 have the value 1 now?
m8...
>>
>>55344048

Try rewriting the ternary operation as a if else statement and then step through that section of the code in a debugger to see what is happening.
>>
>>55344118

-_- shh that gives it away outright. This is a good chance to improve on logic and stepping through code.
>>
>Application using xcb for windowing/input and vulkan for rendering.
What should I use for audio?
>>
>>55344122
>>55344118
Oh I got it. I was assigning the wrong way.
        if (i % 2)
self->queries[j].field = ptr;
else
self->queries[j].value = ptr;


Named structures suck. I'll just use arrays next time.
>>
>>55344276
pulseaudio
>>
>>55344085
Which could be a very substantial amount of code compared to the server logic. It all depends on how complex the interaction protocol is vs. the computing that happens on the server. So "rewrite the entire thing" is definitely an exaggeration but it's not quite as easy as doing a search and replace for getSynchronous with getAsychronous either.
>>
>>55344295
Isn't pulse just a wrapper around ALSA?
Why not just use ALSA?
>>
>>55344409
That's like saying "Isn't vulkan just a wrapper around DRI? why not use DRI?" or "Isn't xcb just a wrapper around a socket? Just open a socket and send raw X opcodes down the wire."
>>
File: ss (2016-06-30 at 11.01.36).jpg (162 KB, 833x659) Image search: [Google]
ss (2016-06-30 at 11.01.36).jpg
162 KB, 833x659
haskell a goat <3
>>
>>55342111

You know when people tell you not to mix tabs and spaces? This is what they are talking about. Please for the love of all that is good in programming, either switch to smart tabs or tab entirely with spaces.
>>
>>55344454
seen this article before
>>
>>55344494
Yeah, Dan Piponi is awesome. Too bad he doesn't seem to write anything anymore.
>>
To everone in this thread who's using a proprietary IDE or text editor: Please quit your job. Thanks!
>>
>>55344533
How do you quit unemployment?
Please tell me
Please
>>
>>55344561
Get a job you NEET.
>>
>>55344533
I use a text editor.
>>
>>55344533
d-does emacs count as a text editor?
>>
>>55344533

I use Sublime Text 3 on Linux
No, I will not quit my job

What will you do now?
>>
>>55344533

Telling the majority of the industry to quit their job..

Proprietary software is a unrelenting plague. You'd have a easier time putting big pharma and bankers on the noose they deserve.
>>
>>55344598
No, it's an OS that happens to ship with a text editor.
>>
>>55338200

Trying some 'artsy' projects generating various colour pallet

I found this guys Java/EE/Fx tutorials and they are awesome.

https://www.youtube.com/channel/UCmjXvUa36DjqCJ1zktXVbUA
>>
File: title-screen-r1.png (33 KB, 842x485) Image search: [Google]
title-screen-r1.png
33 KB, 842x485
Trying to come up with a title screen for my disassembler. I did what everybody does and ripped of Apple. I can't into color.
>>
>>55343879
>expert
>parameters
>make file
anon...
>>
>>55344647

Did you try a "Saturn" style color scheme? Sandy gradients and black.
>>
File: panopticon.png (250 KB, 1048x601) Image search: [Google]
panopticon.png
250 KB, 1048x601
>>55344647

Panopticon text should be at the centre and a thinner font.

Underneath that the two columns should be centred and have a sunk in effect using an inner glow.

There should be a darker bar at the top with the version number.

That's more into Apple.


The brownish hue is just msPaint fucking up png alpha channels. The background should be white.
>>
elisp question
why does this not work?

(defun square (x)
(* x x))

(defun testfunc (f n)
(f n))

(testfunc square 9)



it outputs this

Debugger entered--Lisp error: (void-variable square)
(testfunc square 9)
eval((testfunc square 9) nil)

>>
File: animu23.jpg (216 KB, 923x866) Image search: [Google]
animu23.jpg
216 KB, 923x866
>>55338200
Is that image what they seem to call a "Dicky Ricky?"
>>
>>55344888
(testfunc #'square 9)
>>
>>55344935
gross
>>
Can I dump struct arrays directly to a binary file and then open the file again and copy it back to a malloc'd struct array of identical size?

Would it still work?
>>
>>55344950
yes, that's why java is king and lisp is shit
>>
>>55344992
Sure, and why don't you summon Satan while you're at it as well.
>>
>>55344992
that's how wav files work

http://soundfile.sapp.org/doc/WaveFormat/

you just read the file into the struct
>>
>>55344992
>Would it still work?
of course, how bad is your mental illness?
>>
File: 1405270908531.png (7 KB, 438x298) Image search: [Google]
1405270908531.png
7 KB, 438x298
Can someone explain this?
Is the output the address of v[0]?
>>
>>55344950

The " #' " is just shorthand for " (function square)"
>>
>>55345100
what's the difference between that and just using the quote ' ?

does the # mean I don't have to use funcall?
>>
>>55345080
i should be 1
>>
>>55345080
int& i is a reference to an int

you want

int i = &v[0]

which is the same thing as
int i = v

btw
>>
>>55345080
I guess the vector reallocates which makes your reference refer to a place in memory that doesn't belong to the vector any more and as such can be filled with whatever.
>>
I've got a really fucking weird problem. For some reason
     float viewportVBO[36]={-1.0f,1.0f,0.0f,  0.0f,1.0f,0.0f,
1.0f,1.0f,0.0f, 0.0f,1.0f,0.0f,
-1.0f,-1.0f,0.0f, 0.0f,1.0f,0.0f,
1.0f,1.0f,0.0f, 0.0f,1.0f,0.0f,
-1.0f,-1.0f,0.0f, 0.0f,1.0f,0.0f,
1.0f,-1.0f,0.0f, 0.0f,1.0f,0.0f,
};
float meshArray[100000];
glBindBuffer(GL_ARRAY_BUFFER,VBO[2]);
glBufferData(GL_ARRAY_BUFFER, 400000, viewportVBO, GL_DYNAMIC_DRAW);

Works while
     float viewportVBO[36]={-1.0f,1.0f,0.0f,  0.0f,1.0f,0.0f,
1.0f,1.0f,0.0f, 0.0f,1.0f,0.0f,
-1.0f,-1.0f,0.0f, 0.0f,1.0f,0.0f,
1.0f,1.0f,0.0f, 0.0f,1.0f,0.0f,
-1.0f,-1.0f,0.0f, 0.0f,1.0f,0.0f,
1.0f,-1.0f,0.0f, 0.0f,1.0f,0.0f,
};
glBindBuffer(GL_ARRAY_BUFFER,VBO[2]);
glBufferData(GL_ARRAY_BUFFER, 400000, viewportVBO, GL_DYNAMIC_DRAW);

crashes.

It's not a size factor, I've got other applications with buffers that size without having to have a completely unrelated array declared of that size. I don't even fucking know.
>>
>>55345194
Oh yeah, this
>>
>>55345214
How exactly is it crashing? Segfault?
>>
>>55345214
You're trying to send 400k bytes from an array that's 36*4 bytes large
Thread replies: 255
Thread images: 42

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.