[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: 316
Thread images: 37

File: 1481654229907.jpg (264KB, 1440x1080px) Image search: [Google]
1481654229907.jpg
264KB, 1440x1080px
What are you working on, /g/?

Old thread: >>58015111
>>
>>58020625
Don't post threads before the bump limit, you fucking faggot.
Not even a single post.

That's how stupid image wars start.
>>
How should I serialize basic structures in C? Like an array of pairs of int, for example. This will be running on multiple machines so it has to be portable, which is what I'm worried about.
Thanks.
>>
>>58020654
>Like an array of pairs of int, for example
An array of length 2 arrays should work. Or is that not what you're looking for
>>
>>58020714
><>serialize
>>
>>58020654
convert to text, problem solved
>>
>>58020654
Just use JSON or some other serialisation format.
There are shitloads of libraries for this.
>>
>>58020722
let's not be retarded here
>>58020724
let's not be extra retarded here
>>
>>58020745
sir, are you pre-optimizing?
you shouldn't do that
>>
>>58020774
but it's in C
it must be efficient
>>
>>58020745
How is using serialisation format retarded?
You don't have any integer size, padding, or endianess issues that just dumping to a file has, it's human readable (if that's important to you), and every language is capable of accepting it.
>>
>>58020783
that sounds like a personal problem
>>
File: 3.jpg (22KB, 640x360px) Image search: [Google]
3.jpg
22KB, 640x360px
post your github
>>
>>58020860
I'll never post code publicly
>>
>>58020654

Fixed width types, ntoh(s|l) and hton(s|l) functions, and possibly __attribute__((packed)) are likely what you want.

With fixed width types (int32_t, uint8_t, etc...), you guarantee that no matter how alien the architecture or OS, you're all speaking the same language. A long is 32 bits on 32-bit Linux and 32-bit and 64-bit Windows, but 64 bits on 64-bit Linux, so don't use long, use int32_t when you mean to say you want it to be exactly 32 bits. Don't pass pointers around for any reason, though offsets are acceptable.

Network byte order is big endian. Doesn't matter that most machines are little endian these days, SPARC beat us to the punch and that's the way things will be until the end of time. Deal with it. The ntohs, ntohl, htons, and htonl functions convert to and from network (big endian) and host (big or little endian, doesn't matter) byte orders. The s and l parts of the names are short and long, but they mean exactly 16 bits and 32 bits respectively, unsigned.

If you need structs to maintain a specific alignment, __attribute__((packed)) is the compiler extension to do that. It's not technically standard C, but GCC and Clang support it, and no other compiler matters. Keep in mind that unaligned access is slow, so if you don't need to do so, it is best to just use a normal struct.
>>
>>58020934
not good for portfolio?
>>
File: heightmap.png (17KB, 604x457px) Image search: [Google]
heightmap.png
17KB, 604x457px
right now I have a square grid of points

how do I arrange them in a buffer to get this effect?

right now I have a bug where the plane it is generating is acually like a thin strip normal to the plane I want
>>
>tfw shit the bed on my programming exam today
>>
>>58020957
don't care
I haven't had any trouble finding work without a portfolio
>>
>>58020625
Finished modifying the theme for my jekyll blog, bls subscribe.
I'm learning SQL Server right now.
>>58020860
A-Are you going to employ me?
>>
>>58021084
so how did you apply for your first programming job?
>>
>>58020956
>ntoh(s|l) and hton(s|l)
It bothers me that there is no uint64_t version.
We're stuck with non (POSIX) standard functions if we want that.
>>
File: 1445813903614.jpg (26KB, 433x380px) Image search: [Google]
1445813903614.jpg
26KB, 433x380px
Anybody doing advent of code?
>>
>>58021110
advent of code is shit
>>
>>58021099
I didn't, I did freelance programming
but if I had, I still wouldn't have included a public repo or way in my resume
>>
File: oh noes.jpg (99KB, 784x810px) Image search: [Google]
oh noes.jpg
99KB, 784x810px
>>58021116
>>
>>58021081
I post only out of here. I didn't think anyone but the mods would pretend to care. anyway the ending part was about progamming.

>>58021015
you draw triangles from the pairs of vertices that are created by every two heights?

so one segment will have two heights in each direction and can make two triangles.
>>
Is this the correct place to ask questions about UV mapping and diffuse maps in 3ds Max?
>>
>>58020625
Hey it's the guy who got his laptop stolen. I was posting in the thread earlier.

numlist = []

for i in stringg:
numlist.append(i)

for i in numlist:
if i == '\n':
numlist.remove(i)
if i == ' ':
numlist.remove(i)

newlist = []
this = str()
count = 0
for i in numlist:
this += i
count += 1
if count == 2:
newlist.append(this)
count = 0
this = str()

x, y = 0, 20
array = []
while y < 420:
array.append(newlist[x:y])
x += 20
y += 20

a, b = 0, 0
while a < 20:
print(array[a][b])
a += 1


I found a computer at a university financial aide office to do euler problems. I'm kinda going insane though without my laptop and being homeelss ;-;
>>
>>58021140
language?
>>
>>58021141
make sure to get as much help as you can from your uni
>>
>>58021146
I'll take that as a no.
>>
>>58021150
top kek. i'm homeless neet anon.

on my laptop i was building a bit torrent client but it got stolen at a homeless shelter. now i'm using online compiler to do euler.
>>
>>58021140
no, the correct thread is agdg on /vg/
>>
>>58021167
No offence, but if you're homeless shouldn't you be, uh, looking for a job? Maybe now's not the time to do Project Euler stuff.
>>
>>58021158
>post vague question on a programming thread
>asked about language
>no

fuck off retard
>>
>>58021134
I don't get why people get this whole idea of "home boards" or even "home threads". I'm not a massive proponent of tight moderation or "posting police", but just put your shit in the right place. This thread is about programming, not a chatroom for people who just happen to be programmers.
>anyway the ending part was about progamming
No it isn't. You just mentioned that you can help with "coding" which is completely tangential to your post, and is not a justification you posting in here.

Post in the right thread. You'll even get better answers that way.
>>
>>58021193
grazie famiglia
>>
>>58021207
well the thing is i did i applied to five jobs while i was on my library computer time.

you really are at the mercy of the employer.
>>
>>58021236
Ah, well that sucks, best of luck I hope you find something soon.
>>
File: 1283898432841.jpg (11KB, 230x310px) Image search: [Google]
1283898432841.jpg
11KB, 230x310px
>>58020625
How the fuck do I run a R script with input variable as an argument in Shiny AAAAAAAAAAAAAAAA
>>
>>58021134
you could do this with a linked list over the original grid.

so if you always have a height, 0, you can create a boundary, perimeter, and build according to your segment length or make it all a little more general and include the possibility that more lengths will exist and create a composite system between the two sides that the segments are connecting to as if to create a "beaten path" between the two sides. when you have enough segments hold enough space in tact you can create shapes over them and manage the shapes as composite or whole. so it can happen to be that you create a sort of fractal out of nature. or a consistency. maybe a tendency.

the original shapes slowly "cast" over the larger shapes created by your segments and the rules that make em possible.
>>
File: wf10.png (105KB, 1274x1045px) Image search: [Google]
wf10.png
105KB, 1274x1045px
Started working on the peephole optimizer now.

This is an example for compiling a +
// + compiler macro
: +
lc-lit? if ` pop-lit ` #+ -d,x ;; then
` s+ ` +sp ;

Checks if the last word compiled was a literal, if so undo the code for a literal (and extract the literal value) then compile an add, imm32 instruction.

// code for regular plus:
+:
041623A: 48 03 03 add rax,qword ptr ds:[rbx]
041623D: 48 8D 5B 08 lea rbx,qword ptr ds:[rbx+8]
0416241: C3 ret

// code when compiling 1 + (or any literal + )
inc:
0416242: 48 05 01 00 00 00 add rax,1
0416248: C3 ret


That's gonna be the basic idea for other optimizations.
I will add more lc-XXX (last-compile?) words for testing if the previous word(s) was a dup, drop, etc and then the next word being compiled can look back and undo unnecessary stack effects, or do things like strength reduction.
>>
>>58021293
i wish i was smarter like you
>>
File: 1480753972526.jpg (16KB, 480x236px) Image search: [Google]
1480753972526.jpg
16KB, 480x236px
I don´t know where to post this, so I figured the programming thread should be my best option

>have to make an appointement for a subject which consists in making a bunch of drawings with a common theme and make a "portable museum"
>I thought it could be neat , and easy, to make a page with all my drawings in it and have a personalized qr code that leads to the page printed in a t-shirt so I have a "portable museum" without carry all my shit

Should I use 3rd party shit or can a almost 0 programming skills dude do a page to hold images by himself
>>
>>58021319
should i clear some part up or were you being serious
>>
>>58021310
What are you compiling?
>>
>>58021349

being serious rn
>>
>>58021350
I'm writing a x64 Forth compiler for Windows.

https://github.com/hmrten/wf
>>
>>58021380
fucking madman
>>
>>58021380
Jesus christ.
I don't know if I should be disgusted or impressed.
>>
File: sweden.gif (17KB, 707x440px) Image search: [Google]
sweden.gif
17KB, 707x440px
>>58021380
god damn it
>>
float[] cube = {
-0.5f, 0.5f, 0.5f, // vertex[0]
0.5f, 0.5f, 0.5f, // vertex[1]
0.5f, -0.5f, 0.5f, // vertex[2]
-0.5f, -0.5f, 0.5f, // vertex[3]
-0.5f, 0.5f, -0.5f, // vertex[4]
0.5f, 0.5f, -0.5f, // vertex[5]
0.5f, -0.5f, -0.5f, // vertex[6]
-0.5f, -0.5f, -0.5f, // vertex[7]
};


What does this mean?
>>
File: o.png (232KB, 380x355px) Image search: [Google]
o.png
232KB, 380x355px
>>58021380
>all this work
>no stars
>no followers

life is suffering
>>
Any good resources to learn http, web, networking etc?
I'm reading some perl web client book from 1997 so there's probably better resources out there.
>>
>>58021429
Are you daft?
It's obviously the coordinates for a cube.
>>
>>58021451
>networking
You're going to need to be more specific than that.
Networking is a quite a large field, although I suppose you mean TCP, IP and all that.

I don't know of any online resources, but they probably exist.
I learnt most of the shit I know about networking in university.
>>
>>58021451
this is trivial stuff you just pick up whenever you need to do a project that uses it
>>
>>58021455
And how does it fit here?
I'm having trouble trying to visualize how it fits together.

        byte[] triangles = {
1, 0, 2, // front
3, 2, 0,
6, 4, 5, // back
4, 6, 7,
4, 7, 0, // left
7, 3, 0,
1, 2, 5, //right
2, 6, 5,
0, 1, 5, // top
0, 5, 4,
2, 3, 6, // bottom
3, 7, 6,
};
>>
>>58021380

Neat.
>>
>>58021515
do you expect us to tell you how a couple of arrays "fit together"?
>>
>>58021380
Why would you write the compiler itself in assembly? Unless it's self-hosting and that's the compiled compiler..?
>>
>>58021446
Don't really care about the whole 'github community' aspect, I don't intend to follow or star anyone else and I don't care if anyone follows/stars me, I just use it as a public cloud backup.
>>
>>58021446
He should had renamed his project to: Name.js
>>
>>58021486
I just want at least broad knowledge of common stuff so I don't sound like an idiot when someone talks about http requests, traffic routing, and ports.
>>58021503
I'd rather know it so I know when it's applicable.
How do people remember all the details of different protocols?
>>
Anything I can improve on with this?

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

int numbers[] = { 34,64,45,12,
76,23,98,23,
12,43,76,12,
67,84,98,87,
39,12,87,21,
57,87,34,71 };

void find_a_number(const int set_number){

int arraysize = sizeof(numbers)/sizeof(int); // Calculate Array size
int accumulator=0;
size_t f=0;

for(f=0; f<=arraysize; ++f){
int temp = numbers[f];
if(temp == set_number){
accumulator++;
}
}

/* This only makes sure that the
* text is grammatically correct
*/
switch(accumulator){
case 0:{
printf("Found %i, %i times",
set_number, accumulator);
break;}
case 1:{
printf("Found %i, %i time",
set_number, accumulator);
break;}
default:{
printf("Found %i, %i times",
set_number, accumulator);
break;}
}
printf("\nArray Size: %i", arraysize);
puts("");
}
int main(int argc, char* argv[]){
find_a_number(atoi(argv[1]));
return 0;
}
>>
File: world of c.png (2MB, 1920x1080px) Image search: [Google]
world of c.png
2MB, 1920x1080px
>>58020625
I just made some OC for the thread images. Hope your happy.
>>
File: 1481853478691.jpg (922KB, 1920x1080px) Image search: [Google]
1481853478691.jpg
922KB, 1920x1080px
>>58021589
>this image
>saved as PNG
>1.87 MB

apply yourself
>>
File: 1478899714683.png (3MB, 3000x3000px) Image search: [Google]
1478899714683.png
3MB, 3000x3000px
>>58021589
My happy.
>>
>>58021586
Case 0 and Default are identical.
>>
>>58021583
>How do people remember all the details of different protocols?
there's not much to it
tcp if you want all packets in the right order
udp if you don't care about order and if you don't care that some packets can be dropped
http requests are even simpler, you can figure out everything you need to know in 5 minutes just by looking at a couple of them in your browser
>>
File: Untitled.png (112KB, 1024x768px) Image search: [Google]
Untitled.png
112KB, 1024x768px
>>58021515
>And how does it fit here?
Each 3 numbers describes a point in 3D space: a vertex.
The triangle array lists how each of the vertexes come together to draw a triangle. In 3D rendering, everything is drawn as a triangle, as they can be used to approximate any 3D shape.
Each line specifies a triangle, and each two triangles are drawing a face.
>>
>>58021586
Yes. For one, your for loop goes out of the bounds of the array. Second, there's no need to create a temporary value. Third, f is an odd variable name for an index. Why not i? Fourth, arraysize and accumulator should be of type size_t. Fourth, you can improve the performance of your find_a_number by using a sentinel value. Finally, your brace usage in you case statements is retarded.
>>
>>58021653
thanks, I wasn't sure if braces where needed for multiline statements in a case in C/C++ or pretty much any language since all of them have switch statements
>>
>>58021586
That entire switch statement can be shortened to
printf("Found %d, %d time%s\n", set_number, accumulator, accumulator == 1 ? "" : "s");
>>
>>58021653
>you can improve the performance of your find_a_number by using a sentinel value
how's that work
>>
>>58021551
Compiler is being written in Forth.
Some of the asm is already unnecessary and could be rewritten, just haven't got to it yet, and I'm kind of figuring out what I need to expose as I go along.
One somewhat major thing missing is addressing system variables (code_here, data_here, etc), I'm working out how the code gen for them should be (probably gonna dedicate a register for them), I have the hardcoded HERE and XHERE words exposed to Forth (which drops data/code space pointers on the Forth stack), but that's just temporary.
>>
>>58021646
Thanks. I can see how it works now.
>>
In C, function variables are automatically zero, right?

would this call to memset be redundant?
struct triangle *triangle_new()
{
struct triangle *tri = malloc(sizeof(*tri));
memset(tri, 0, sizeof(*tri));
return tri;
}
>>
>>58021134

My problem really stems from the way gl_triangles_strip works

right now I'm iterating through so that it skips at the edges and I get an extra line

also it has another problem (this is what I was originally on about):
>>
File: 33.jpg (23KB, 343x350px) Image search: [Google]
33.jpg
23KB, 343x350px
>>58021701
>>
>>58021691
printf("Found: %d. Occurrences: %d\n", set_number, accumulator);
>>
>>58021721
shit nvm

tri is allocated from the heap, so it could contain garbage
>>
>>58021691
but what about when accumulator equals 0? The last word needs to be plural in that situation
>>
>>58021724

this is what it looks like with every other row with an added height

it should form V's like a height map, but they aren't connected
>>
>>58021721
no, you need the memset
>>
>>58021738
turn your adblock on
>>
>>58021110
Since there is 11k+ solutions to day 1 my guess is that yes - someone is doing AoC.
>>
>>58021751
But what if i want to know about all the celebrities who died without anyone even knowing?
>>
File: digi_screen.png (29KB, 946x560px) Image search: [Google]
digi_screen.png
29KB, 946x560px
I'm working on a mobile game, a 2D rogue-like. (The rest of what the game will be hasn't been decided yet).

I'm struggling with map generation.

>pic related
All the red sprites are highlighted because they are overlapping another sprite, this is something i'm trying to fix. Every tile should be on its own unique spot.

The problem is my algorithm for placing areas of tiles(sprites) isn't correctly spacing each area resulting in the overlaps.

Another question, what is the syntax for posting code? I'm assuming

 (code here) 
?

(guess I'll see if that works.)

TL;DR overlapping sprites in game because map generation algo is fucked, help >pic
>>
>>58021721
In this case you could use calloc() which returns zero'd memory.
>>
File: 1476073511692.jpg (89KB, 700x525px) Image search: [Google]
1476073511692.jpg
89KB, 700x525px
>>58021773
that explains
>>
>>58021110
I got stuck on day 11, I don't know how to tackle that problem.
And it doesn't allow you to proceed further until you make all previous days, right?
>>
File: ads.png (72KB, 936x212px) Image search: [Google]
ads.png
72KB, 936x212px
>>58021773
>mfw
>>
    // place areas
for i = 1 to areas.length

tmpX = 0
tmpY = 0

if( areas[i].pos.x > 0 )

// find position pixels if area is right
tmpX = areaBounds - areas[0].sizeXPDiff
for i2 = areas.length to 1 step -1

if( areas[i].pos.x > areas[i2].pos.x and areas[i2].pos.x > 0 and areas[i].pos.y = areas[i2].pos.y )

tmpX = ( tmpX + areaBounds ) - ( areas[i].sizeXPDiff + areas[i2].sizeXPDiff )

endif

next i2

elseif( areas[i].pos.x < 0 )

// find position pixels if area is left
tmpX = -areaBounds + areas[i].sizeXPDiff
for i2 = areas.length to 1 step -1

if( areas[i].pos.x < areas[i2].pos.x and areas[i2].pos.x < 0 and areas[i].pos.y = areas[i2].pos.y )

tmpX = ( tmpX - areaBounds ) + ( areas[i].sizeXPDiff + areas[i2].sizeXPDiff )

endif

next i2

endif

if( areas[i].pos.y < 0)

// find position pixels if area is down
tmpY = areaBounds - areas[0].sizeYPDiff
for i2 = areas.length to 1 step -1

if( areas[i].pos.y < areas[i2].pos.y and areas[i2].pos.y < 0 and areas[i].pos.x = areas[i2].pos.x )

tmpY = ( tmpY + areaBounds ) - ( areas[i].sizeYPDiff + areas[i2].sizeYPDiff )

endif

next i2

elseif( areas[i].pos.y > 0 )

// find position pixels if areas is up
tmpY = -areaBounds + areas[i].sizeYPDiff
for i2 = areas.length to 1 step -1

if( areas[i].pos.y > areas[i2].pos.y and areas[i2].pos.y > 0 and areas[i].pos.x = areas[i2].pos.x )

tmpY = ( tmpY - areaBounds ) + ( areas[i].sizeYPDiff + areas[i2].sizeYPDiff )

endif

next i2

endif

areas[i].pos.pX = tmpX
areas[i].pos.pY = tmpY

next i


this is the problem area. My math must be wrong.
>>
>>58021819
see: >>58021779
>>
>>58020625
I'm in the process of making a game
>>
>>58021653

Changes made based on some suggesstions, this even looks much cleaner
#include <stdio.h>
#include <stdlib.h>

int numbers[] = { 34,64,45,12,
76,23,98,23,
12,43,76,12,
67,84,98,87,
39,12,87,21,
57,87,34,71 };

void find_a_number(const int set_number){

size_t arraysize = sizeof(numbers)/sizeof(int)-1;
size_t accumulator=0;
size_t ind=0;

for(ind=0; ind<=arraysize; ++ind){
int temp = numbers[ind];
if(temp == set_number){
accumulator++;
}
}
printf("Found %d, %d time%s", set_number, accumulator, accumulator == 1 ? "" : "s");
printf("\nArray Items: %i", arraysize+1);
puts("");
}
int main(int argc, char* argv[]){
if(argc < 2) {
puts("No argument given");
return EXIT_FAILURE;
}
find_a_number(atoi(argv[1]));
return 0;
}



I added an argument validation statement in there as well so this doesn't segfault when you input no argument in a Linux/Unix Terminal, Command Prompt seems to tolerate no argument for some reason.
>>
File: 1457043347720.jpg (17KB, 500x336px) Image search: [Google]
1457043347720.jpg
17KB, 500x336px
Any software devs in here? Asking about salary negotiation advice

I'm going to graduate with a degree in CS from a tier 2 university program in May (still highly sought after in my midwestern state and regularly get recruited by the Big 4) with a 3.32 GPA and tons of intern/project experience (this is probably my best resume mark, I can talk about my experience for days in interviews and essentially am on par with a SWE 1 in knowledge).

This semester was full time and my next one is deliberately part time to devote all of my time to the job hunt. I've only applied to a few places for full time roles the past few months to test the waters and got an offer today from a smaller company that seemed to really like me, $60k (in a large midwestern city), which translates to $79k in Chicago and $115k in San Fran CoL wise so not too bad. But not the best I could get at all, entry levels in my area get anywhere from 50-70k and the average grad in my program gets 67k (obviously a little bloated from guys who bail for the West Coast).

I was considering asking for a bump up to $64k before accepting. My reasoning is that I have other options currently in progress, as well as a firm commitment from my last internship employer to find me a software engineering role within their organization. Given the circumstances I am right to ask for a little more before signing away so early, right? I'm in no rush and saved 80% of my job search for the next 5 months.
>>
>>58021887
What's a tier 2 university?
>>
>>58021697
Misread the function, thought he was just looking for one number.
>>
>>58021863
size_t arraysize = sizeof(numbers)/sizeof(int)-1;


This is bad. The actual array size is just sizeof(numbers) / sizeof(int). What you need to change is the conditional in your for loop:
for (ind = 0; ind < arraysize; ++ind)


Half-open intervals are idiomatic, so stick to that. Also, if you're using C99 you can declare the variable in the for loop:
for (size_t ind = 0; ind < arraysize; ++ind)


Finally, you should stick to using i for indices, it's idiomatic while using ind is unnecessary clutter.
>>
>>58021919

Not MIT/Caltech/Michigan/Stanford/UBerkeley/etc

I'm graduating from Ohio State, which is pretty much a Tier 2 Engineering/CS program

Before you try to meme me with college wars we are far and away the most recruited school in my state so it's a +1 on my resume with these guys
>>
>>58021919
some buzzword this faggot made up, as well as being "on par with a SWE 1 in knowledge", pretending a "Big 4" exist in software engineering, and pretending interviewers care more about his random intern experience than his knowledge / personality
>>
(define rand
(let ((x 25)) ;25 chosen instead of a random initialised number
(lambda (action)
(cond ((eq? action 'generate)
(set! x (* 2 x)) x)
((eq? action 'reset-function)
(lambda (new-value) (set! x new-value) x))))))


I answered the SICP question but I have no idea how it works. (rand 'generate) should create a new number (I set the formula to just 2 times the previous number) and ((rand 'reset-function) new-value) should set x to the new-value. That seems fine. But how the HELL does x avoid being reset to 25 every time rand is used? I just don't get it.
>>
JavaScript question for you, /dpt/. I know you guys like JavaScript.

Is there any reason why I should use .forEach over .every?

With .every I can break out of the loop by returning false, but with .forEach I have to wait for the loop to finish.
>>
>>58021733
>but what about when accumulator equals 0? The last word needs to be plural in that situation
It does do that:
accumulator == 1 ? "" : "s"

Any non-1 value will be plural.
>>
>>58022037
explain what situation that you're returning false to break out of a loop
>>
File: 1479594191497.png (838KB, 1180x842px) Image search: [Google]
1479594191497.png
838KB, 1180x842px
>>58022010

The epic quintessential 4chan cynic

I remember faggots like you making me think I wouldn't even get a job in CS when I was asking about it 4 years ago because it was a "dead field", "meme", and "overflowing"

faggot
>>
Intel x86 documentation has more pages than the 6502 has transistors
>>
>>58022029
>
x))))))
>>
>>58022037
I don't know or like Memescript, but from the documentation, they seem to have different purposes.
every() is to see if every element of the array matches some predicate.
forEach() is just to do some arbitrary thing to each array element.
>>
>>58021994
thanks, the reason the ind variable was put outside the for loop was a left over from what I was trying to do before
>>
>>58022085

> he has never seen lisp before

go back to /webdev/
>>
>>58022143
You don't have to be unfamiliar with Lisp to make fun of how many brackets there are.
>>
>>58022143
newfag
>>
>>58022029

bumping to get an answer to the above
>>
I got 1-indexed pagination to work, finally~
I also removed hard-coded assumptions so it could handle an unlimited number of pages and 404 you when you try to visit an index page that doesn't exist yet.
>>
File: faggot.jpg (112KB, 1920x1080px) Image search: [Google]
faggot.jpg
112KB, 1920x1080px
>>58021612
>still nearly a mb

You fucking apply yourself retard.
>>
>>58021738
>>58021738
i had no idea this was tied to shaders.

its looking like were missing how height gets "declared".

in the next maniold we'd treat it as a whole shape, or an incomplete prime, so maybe height increases row capacity for the largest structure. looks like the gradient there has solidified between indices which means it has moved the shape over 1 step per draw and the main shape, the "bg" that grows with the height and gradient, just kind of shows the general shape. My assumption being that all those extra lines are part of the buffer strategy and that whats drawn is pertinent to a design rather than to some more determinable use. Kind of like to show surfaces. I figure the grdient defines a range if value you can replace individual color calls for. Like a skeleton for planes over geometrical constructs.

What program is that, library? is it over C?
>>
>>58021738
err could you touch on the problem less visually? it seemed you just needed to manage making that triangle sheet and i think i may have set you off course in my attempts to pontificate over the problem.

im hoping my intuition doesnt detract yours. i was playing go earlier and the cpu kept splitting my domain at the first and greater level, meanwhile i kept trying to split its attention bc im stupid.
>>
File: 1481858489226.jpg (39KB, 1920x1080px) Image search: [Google]
1481858489226.jpg
39KB, 1920x1080px
>>58022495
>100kb
>>
>>58021107

There's no standard way, but if you can stick to one just GCC or Clang, you should be able to use compiler builtins for a fast bswap64, and to use the preprocessor to determine if you're on a little or big endian system.
>>
File: 1367737073534.png (635KB, 780x623px) Image search: [Google]
1367737073534.png
635KB, 780x623px
>>
Når jeg komme hjem er jeg alltid for trett til å programmere noe.
>>
File: 1481858849146.jpg (19KB, 1920x1080px) Image search: [Google]
1481858849146.jpg
19KB, 1920x1080px
>>58022495
>Greater than 100KB
fucking casual
>>
>>58022498

it really isn't to do with the shaders. it just uses 2 very simple shaders with some very basic perspective.

it is using a c++ opengGL debug setup I made. the shapes you see are just reference points.

>>58022531

basically what I have is a 2d array of points. I want to convert it to a plane made of triangles like this >>58021015
>>
>>58021738
i think i just saw it. the height is coming up from out of the ground and we're in birds eye, the gradient is providing an orientation and isnt significant beyond that. you expect a v but it should just be a greater surface area between segments , not visible, and maybe a few larger v's where the height passes the 2 points of perspectice off to the side.

i am on my phone so excuse me but...
having said that your height makes the change but one side of those tents is oriented to the main axis, height's axis, at an offset angle i think, so you are getting a flat side and a side that leans off that and then filling the values, then moving to the next one and doing the same.

that should account for the weord angles. I think the angles related to isometric designs are 45 and 30.

So i guess that means your basis might be 30 and 45 is used to mark halves in your equations for the other ((((((((((( axiseseses )))))))))))
>>
>>58022536
>>58022610

https://www.youtube.com/watch?v=QEzhxP-pdos
>>
>>58022597
go fuck yourself
>>
>>58022498
>>58022531

figured it out:

had to draw it row by row instead of the whole thing in one pass in order to skip the extra triangles

also it was staggered like that because I was adding a different constant to two of copies of the same node (when using GL_TRIANGLES_STRIP you need to waste a bit of memory and send the same vertex to the GPU more than once)
>>
File: print_screen1.jpg (1MB, 1906x1512px) Image search: [Google]
print_screen1.jpg
1MB, 1906x1512px
>>58022565
>>
Is Scala being taken over by the SJWs?
>>
>>58022621
you might need more room in your array to make it modifiable. the original 2d array could be used to draw the triangles by appending the draw instructions for every diagonal to the function making the drawing but youd be better served tying that to the main structure so that you don't start the structure sod eclaratively and your draw isbas efficient as possible.

but from what ive seen you want to have two points before starting, in a linked list tied to the row or sonething, where each entry defines the states of a particular point on that row, and each point carries with it iinformation like other points it can reach from there. then when you have a bunch of notes closing over an area of the map, sonething (x, y) ( x, y1) (x1, y) (x1, y1) in amy existing order, you apply a shapes atteibutes to it create a new buffer to hold any number of these and apply it to the points, partOfShape kind of thing, and have each point refer to the shape and the shape hold a reference to the vertices.

Then you just need to create a quick little algorithm that'll find the prime sizes for your rectangles to fill in. Like a sheet with 37 triangles will have 8 per square, so that would be 4 squares and 3 triangles or 2 rectangles and 3 triangles kind of thing. from there it's just cutting the squares into triangles or making the basis allow for incongruencies by making it work off of the parts of the shape you want rather than forcing it into a neat little package.
>>
>>58022768
Who cares?
>>
>>58021110
>have to sign up with social media
>>
File: test.webm (642KB, 594x394px) Image search: [Google]
test.webm
642KB, 594x394px
>>58020625
trying to make this fuckin shitkid right here stand up straight
>>
>>58022828

This desu. Would love to do some programming challenges, but won't make a Reddit account to do it.
>>
>>58021887
This is a good book to reference in regard for the negotiation thing.

http://img105.job1001.com/upload/adminnew/2015-04-03/1428055089-N7PTLH6.pdf
>>
>>58023068
>says the man with the tripcode
>>
What languages have full dependent types?
>>
File: proven.png (97KB, 685x547px) Image search: [Google]
proven.png
97KB, 685x547px
>>
>>58023131
Idris, Coq, Agda
>>
>>58023164
Thanks.

Which of those is most practical outside academia and theorem proving? Is it Idris?
>>
>>58023131
wow, it's like they're trying to make programming as frustrating as possible
>>
>>58023194
Oh I'm sorry, we shouldn't let the compiler get in the way of you running your code no matter how wrong it is, fucking webshit
>>
FP is more akin to scripting than coding.
>>
>>58023175
Yes.
>>
>>58023206
>we shouldn't let the compiler get in the way of you running your code
right, I see we're in agreement
>>
>>58023194
>>
>>58023194
Dependent types don't stop you from writing your regular shitly typed code. You just have to tell the compiler that you want everything to be a string and that you don't care about overflowing buffers or any of that nonsense in your website.
>>
>>58023247
>>58023242
>>58023206
Where will it end for you retards? Seriously.
>>
>>58023241
Fuck me, I knew webshits were dense but this is a whole new level of idiocy, are you on day release or something?
>>
>>58023274
It's not going to end. Our tools and languages will keep improving, unlike yours.
>>
>>58023281
all you're doing is putting more and more restrictions on what is legal code
it's not making programming easier, faster, or the results more efficient
you're literally introducing impediments and getting nothing out of it at this point
>>
Dependent types... isn't that what C++ has with integral values as template parameters?
>>
>>58023344
C++ templates can't depend on values at runtime, and the entire C++ system is fucked anyway.
>>
>>58023317
>he doesn't think giving the compiler more information could possibly allow it to better optimize code
>he doesn't think finding out code is wrong at compile time rather than at runtime makes programming faster
>he doesn't think writing a type is easier than writing tests
>>
>>58023349

>C++ templates can't depend on values at runtime
Pretty sure that's a prerequisite of static typing in general.
>>
>>58023365
No, it isn't.
>>
>>58023365
C++ templates are just macros.
>>
>>58023365
>>58023372
For instance, you can say,
Given Vector n a, and a Vector m a
Appending them will give you a Vector (n+m) a
You can obviously say this at compile time, or even write it in C++ templates

But dependent types mean you can actually use this function with a vector whose length is determined at runtime.
>>
Anyone have a good tutorial for Java.util.Date?
>>
>>58023402
Use the classes and APIs in java.time instead wherever possible.
>>
>>58023391
How are errors handled in this case? If I have a matrix-multiplication function, how does enforcing the correct dimensions in the type system differ from doing a manual check? Is it simply a matter of *forcing* a check vs. remembering to do the right thing?
>>
>>58023372

Well, since the definition of static typing requires all type checking to occur at compile time, how can you have a type depend on a runtime value while simultaneously only doing type checking at compile time? This sounds like something that would be a part of a dynamically or gradually typed language.

>>58023391

As long as n and m are constant values, n+m is constant, and can be used as a template parameter. If n and m are determined at runtime, it's not possible.
>>
>>58023418
It makes the inputs and output have the correct dimensions *by construction*. You don't need to check, and you don't need to worry about exceptions being thrown.
>>
>>58023418
Errors are compile time type mismatches.

I.e. Vector 0 a and Vector 3 a are completely different types.
A head function might have the type
Vector (S n) a -> a

S is the successor function, it means (+ 1) (assume n is a natural number)
From the fact it's S n, we know it isn't 0.
Because natural numbers (n) are 0 or 1 + n

Since it's not 0, we can guarantee it will have a head element.
In order to call the head function, you need to prove to the compiler that the vector is not empty.

For instance, you could create a proof that Vector (n + m) a is not empty, if either n or m are not 0
>>
>>58023411
Ok I will, but why?
>>
>>58023441
I know it doesn't work with templates, that's what I meant by but

It's not at all dynamically typed.
You have to prove to the compiler that you're calling the function with the correct type.

I.e. if you have a function like head, which returns the head of a vector
It can't work with an empty vector
So we have something like
head : Vector (S n) a -> a
aka
head : Vector (n + 1) a -> a
(where n is a natural number)
Head can only take non-empty vectors now (0 cannot be 1+a natural number)

Now in order to call head, we need to prove to the compiler that our vector is not empty.
>>
>>58023468
because you'll never get a date
>>
>>58023481
I can't tell if you were just building up a joke or srs
>>
>>58023468
java.util.Date doesn't actually represent a date, SimpleDateFormat isn't thread-safe, this is just the tip of the iceberg, the entirety of the Java 7 and earlier date/time stuff is fucking awful.
>>
I have a Python algorithms final exam tomorrow.

We are allowed a double-sided cheat sheet for the exam.

What kind of things would help to put on there? I've looked at the practice exams, and the questions reference the modules, programs, and assignments out of nowhere. I have no idea how to fit all that into a *handwritten* double-sided 8.5x11 sheet.
>>
any reverse engineers here

what are you working on
>>
/g/ I got caught cheating by my instructor and he takes these things very seriously

I ended up being straight and honest about it, and said I have been struggling with depression for awhile, and been on medication that makes depression even worse which is why I ended up fucking up.

Anyone had this shit happening to them/someone they know? How lenient are they depending on the circumstances? I kind of made clear that I wouldn't have done it if I had a more stable quarter, but shit was too much for me to handle
>>
>>58023476
>Now in order to call head, we need to prove to the compiler that our vector is not empty.
How can you prove to the compiler something determined at runtime?

I guess you can embed the compiler into every program and then execute the compiler at runtime, but that would still give you the error at runtime (i.e you compile once first, run the program which recompiles itself, and then you get the type error)
>>
>>58023490
Those are the things you should have been learning, anon.
>>
>>58023512
i would get less than 0 on my score instantly
>>
>>58023476

Seems a bit confuddling, but I can sort of understand. As long as types used in the construction of the new type are non-empty vectors, the new one must be one as well.

Although the nature of vectors is that the size is supposed to be something mutable at runtime anyways...
>>
>>58023535
>mutable
Begone, foul demon
>>
>>58023512
>struggling with depression for awhile, and been on medication that makes depression even worse
Maybe you shouldn't do that?
>>
>>58023533
on assignment or whole class?
>>
>>58023512
Auto 0
>>
>>58020625
Trying to learn C. It seems tutorials go from one basic "hello world" and explanations, and then the next example introduces several more things at once, it's very quick and discouraging
>>
>>58023564
Yeah but the medication is treating a problem only this medication can. I have no options and I have to go through the treatment...
>>
>>58023531
yeah, i know it's a question that's more suited for my classmates or prof/TA

but what should i do if the questions seem to reference modules or programs from the textbook, labs, assignments out of nowhere?
>>
>>58023580
Tutorials are notorious for that. You need a book. Try C Primer Plus by Stephen Prata.
>>
>>58023535
Dependent types rely on immutability.
In dependent typing, Vector usually means a length-indexed list.
So while
[1,2,3] is the same LIST type as [1,2,3,4,5]
[1,2,3] is a different VECTOR type to [1,2,3,4,5]

>>58023515
For instance, say we've got two functions
print : Show a => a -> IO ()
-- given some a (a type that can be shown, i.e. converted to a string)
-- return the action of printing it
doNothing :: IO ()
-- a no-op

We can do this:
case length runtimeInput of 
0 -> doNothing
_ -> print (head runtimeInput)


By pattern matching on the length of runtimeInput, I discover type information about it.

If it takes the 0 branch, I know the length of the vector is 0.
So I know the type of the vector is (Vector 0 a)
If it takes the other branch, I know the length of the vector is not 0.
Since we're using natural numbers, this means it has to be greater than 0.
This means I can use head on it.
>>
File: bonk.gif (2MB, 356x200px) Image search: [Google]
bonk.gif
2MB, 356x200px
>hes too scared to post his github
>>
>>58022029

Because define sets the symbol on the left to the result of evaluating the expression on the right.

The expression you have on the right is a let block that returns a lambda when evaluated. The let block is never executed when you call rand, just the code inside the lambda.
>>
>>58023605
thanks, that was in the gentoomen library so I'll grab that
>>
>>58023565
The assignment/test and a permanent look from the teacher while i do next tests/exams.
>>
>>58023580
any way you learn C is going to be discouraging.
It's simultaneously verbose and cryptic.
>>
>>58023512

>Anyone had this shit happening to them/someone they know?
No. I'm not a filthy cheater, and most of my friends are not in university.

>How lenient are they depending on the circumstances?
Academic honesty policies are usually pretty zero tolerance on cheating. Your professor could just give you an F for the class irrespective of the rest of your assignments.

>I kind of made clear that I wouldn't have done it if I had a more stable quarter, but shit was too much for me to handle
If you're having trouble with your classes, talk to your professor during their office hours about the problems you are facing. Most professors WANT you to succeed, and will often be willing to work out a solution for you.

>>58023619

I think we are running on different definitions of vectors. With regards to data structures, I have always heard the term "vector" in reference to "any array that can be resized at runtime."
>>
>>58023629
shit man I hope he just gives me a 0 on the assignment and not on the whole class

without the assignments I can still pass with a D which is fine by me, I just need to get over this depression shit and move on
>>
>>58023655
With dependent typing, arrays and vectors are the same thing.
To demand that something maintains the same size is just to use a fixed number for the size.
>>
>>58023655
Trip I get you like throwing people under the bus so you can feel better about yourself, I can assume you never had to deal with depression in your life and ended up making shit decisions for it, but give it a break for Christ's sake.
>>
>>58023709
Dumb cheater.
>>
>>58023719
That's what I called your wife last night (^;
>>
>>58023583
>and I have to go through the treatment...
Do you? What?
>>
>>58023728
#cucked
>>
>>58023709
You need to take responsibility for your actions, anon. You can't blame every stupid thing you do on depression.
>>
>>58023512
>/g/ I got caught assaulting someone by a police officer and he takes these things very seriously

>I ended up being straight and honest about it, I've been dealing with depression for a while

>Anyone had this happen to them?
>>
>>58023619
>By pattern matching on the length of runtimeInput, I discover type information about it.
So I guess it's similar to how C/C++ compilers do auto-simd.
Emit two loops, one which assumes it can grab 4-8 packed ints/floats at a time with no overlapping pointers, and another loop where it can only do one element at a time, then emit a branch which compares the pointers and dispatches to the appropriate loop.
>>
spaces or tabs for c++
>>
Anyone have clinical depression?
>>
>>58023748
Shit's hard man, it's like asking to run a marathon with 100 pound weights attached to your leg. I mean I will take responsibility, just asking if they know someone that had this happened to them, and if they failed the assignment or the whole class.
>>
>>58023709
Depression is not a psychotic illness and there is no evidence to suggest it makes people do things immoral. Most are more likely to off themselves at the thought of doing something immoral since they don't see themselves worthy. Cheaters that are the result of mental health issues are generally sociopaths, autists and other psychotics who lack empathy or a moral compass in one way or another.

So, to me, sounds like you're autistic considering you're blaming it on depression of all things, or just a loser with no self esteem and no sense of consequence for his actions. Everyone else is out there learning and taking tests legitimately, anon. Truly, why aren't you?
>>
>>58023663

>With dependent typing, arrays and vectors are the same thing.
To be honest, any statically typed language shouldn't do this. When an array, which has constant size, is allowed to be a distinct type from a vector, which has a mutable size, many optimizations are allowed to be made for the array. A vector can only be safely stored on the heap with a level of indirection, because it must be able to be reallocated and stored in a different location when more memory is required. An array can be stored on the stack or in .bss, and never has to be moved.

>>58023709

I tackle all of my life problems with raw force of will. Don't want to get out of bed? Don't want to do an assignment? Don't want to attend the lectures? Do it anyway, pussy! Even when emotional state is fucked beyond belief, do thing and keep do thing.
>>
>>58023764
Yes, that sounds like it.

Though with dependent types, even your result type can vary on the input.
for example:

myfunction : Bool -> Type
myfunction True = Int
myfunction False = Float

myzero : (b : Bool) -> myfunction b
myzero True = 0
myzero False = 0.0


this is like an if statement by the way:

f True = x
f False = y

->
f bool = if bool then x else y

>>58023777
>it's like asking to run a marathon with 100 pound weights
>>
>>58023792
>there is no evidence to suggest it makes people do things immoral
hmmmm
>>
>>58023800
Now that's pretty neat
>>
>>58023794
In dependently typed languages
>vectors
>are
>immutable
>>
>>58023794
Remember that both are immutable.
So what you instead have is something like an AST or a monad that represents mutability.

Then all you do is express that the type does not change in your state monad.


A type changing state monad is kind of like this:

int x = 0;
float x = 1.f + (float) x;
string x = to_string(x);
...

So it guarantees that at any point, you aren't wrongly accessing the type.
But if you instead ensure that the type remains the same, and then use a (Vect n a), then you can guarantee that it will remain a fixed array throughout that stateful operation
>>
>>58023811
hmm?
>>
>>58023812
It's nice, and you can express literally any logical requirement as a type.
But remember that if you do, you will have to logically prove that your code meets that requirement.


>>58023811
>i'm sad so i cheated
>has anyone had this happen to them?
>1 like = 1 reply
>>
>>58023792
Depression makes people unable to care about the consequences of their actions.

That's why they off themselves, or do things they wouldn't have if they didn't have the condition otherwise. They simply do not care about the consequences of what they do. So yeah, there are two outcomes that are quite reasonable, you stop giving a fuck about the class and let your grades tank (very common), or you just cut corners because you can't take the bantz, or you don't care about taking them in the first place. Got caught? Fuck it


Being depressed is like calculating the amount of fucks you give. So yeah, people who gives 0 fucks are likely to cheat as much as they're likely to give up, whichever seems easier/less stressful for them.

Also autism has 0 to do with cheating.
>>
>>58023815
>>58023823

>immutable
Those of us who come from systems programming languages would call such a structure a dynamical array, not a vector.
>>
>>58023859

>dynamical
This is what happens when you originally write "dynamically sized" and then backspace it down to "dynamic", and yet fuck up anyways.
>>
>>58023859
You can represent mutability with an AST or a state monad. Such an AST could then be lifted into an ACTUALLY mutable reference in an io monad.
>>
>>58023857
>Depression makes people unable to care about the consequences of their actions.
No, that's autism. Depressed people are ones who, when asked if they're okay because they're dropping out, go "no I just suck at life". If you were depressed and not just an autist or a sociopath, you would not disadvantage others or put yourself at an advantage over others, because you don't deserve it, and you and I both know you don't. You're a loser anon, and it's not because you're sad.

Depressed people kill themselves because they can't bare the pain and don't want to inflict their burdens any longer on others. That's why NEETS kill themselves and Japanese teenagers, they don't want to waste taxpayer dollars. Those are not cheaters.

Autism has everything to do with it, it causes severe lack of empathy, apathy towards consequences of actions, pretty much everything you've described can be summed up to your typical mildly-on-the-spectrum and untreated kid.
>>
>>58023892
Can we put him in an institution?
>>
Should I learn Elm?
>>
>>58023892
So you're saying depression has 0 impact on school performance? Sorry, but I disagree.
>>
>>58023906
Waste of money, honestly. A few meds would do if actually the right ones. Healthcare systems are notoriously lazy and end up prescribing the wrong medications and diagnosing stupid shit, like ADHD when it's clearly not that. Ironically it costs the governments more money later down the line since they do end up in an institution after they've medicated themselves into skitzoland or drunk themselves into a permanent stupor.
>>
>>58023892

>No, that's autism
No, you're thinking of antisocial personality disorder (i.e. sociopath/psychopath). Autism is typically associated with an inability to understand people's feelings and to express one's own (Alexithymia). It does not mean that you do not care about the consequences of one's own actions, however.
>>
>>58023930
Nope, not at all. Depression is a lack of motivation, no will to get up in the morning, no will to open the blinds, get exercise, learn, it's sad at the lowest of times and nihilistic and the best. Depression causes low self esteem, anxiety in social situations and poor personal health and hygiene. All of these things greatly affect performance in school, and depressed people frequently drop out if not looked after. Of course this has much impact. What someone with all of these symptoms does not do, is go and find a cheeky and immoral way of putting themselves at an unfair advantage.
>>
>>58023874

I feel as though this is a lot of mental hoops to try and justify a simple resize-able data structure.
>>
>>58023956
Not the guy but I can relate. I went through depression before getting into CS, and ended up withdrawing/dropping most of my classes and went through academic probation.

One of the classes I still went through with low grades, though, if I had a chance to cheat and pass the class without hassling I certainly would have. I wouldn't go out of my way to do that, but if I had the opportunity I just wouldn't give a damn.

I didn't do it, but I can personally relate. It was years ago though.
>>
>>58024001
What are you talking about?

I'm just talking about mutability in pure languages
>>
>>58023492
yeah
I made a hack for an mmorpg that allows me to teleport around and control 8 characters simultaneously
also placed a hook to keep track of all of the spawned entities and their coordinates, but I'm not using it much
>>
>tfw diagnosed depression
I program to escape my earthly woes.
Please stop ruining this for me.
>>
>>58024007

What I am saying is that it would be much simpler for people to both implement and understand the implementation of the language if you just said "this value is mutable" such as in Rust, for instance:

let mut x = 5;
x = 6;


First line it is 5, then it is changed to 6. No throwing around ASTs to simulate mutability.
>>
>>58023728
kek
>>
>>58024071
got a git, you using dll injection or atom bombing
>>
Rate my abstraction/design?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "transport_handle.h"
#define BUFLEN 1024

void handle(char *buffer, size_t buflen, const char *message, size_t len) {
sprintf(buffer, buflen, "Received: \"%s\"\n", message);
}

int main(int argc, char **argv) {
TransportHandle *server;
char inbuffer[BUFLEN];
char outbuffer[BUFLEN];

if (argc != 2) {
puts("usage: ./server <port>");
return -1;
}

server = new_TransportHandle(UDP, atoi(argv[1]));

for (;;) {
UDP_receive(server, inbuffer, BUFLEN);
printf("Received packet: \"%s\"\n", inbuffer);
handle(outbuffer, BUFLEN, inbuffer);
UDP_send(server, outbuffer);
}

return 0;
}

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

#include "transport_handle.h"

#define BUFLEN 1024

int main(int argc, char **argv) {
TransportHandle *client = new_TransportHandle(UDP, 0);
char buffer[BUFLEN];
char *server;
int port;
bool running = true;

if (argc != 3) {
puts("usage: ./client <IP> <PORT>");
return -1;
}

UDP_setTargetAddress(client, argv[1], atoi(argv[2]));

while (running) {
printf("> ");
fgets(buffer, BUFLEN, stdin);
buffer[strlen(buffer)-1] = 0;
running = strcmp(buffer, "quit");
UDP_send(client, buffer);
UDP_receive(client, buffer, BUFLEN);
printf(buffer);
}

destroy_TransportHandle(client);
return 0;
}

I don't know what to call the TransportHandle struct. It's just the sockaddr_in, the target sockaddr_in, the socket, the socklen_t of the target address, and UDP | TCP.
What should I call it?
I use the same struct for both client and server.
>>
Idea for a book title: "What the Fuck is a Monad? Understanding the Esoteric Gobbledygook that Functional Programmers Think Passes for English."
>>
>>58024340
>tfw you are too dumb to understand so you get mad
fox and grapes
>>
>>58024340
return :: (Monad m) => a -> m a
bind :: (Monad m) => m a -> (a -> m b) -> m b
>>
>>58023512
Yeah I had an old "friend" stealing my code when I wasn't looking. I was naive at the time and had no idea how shit went in this field.
He got caught and had a 0 on his assignment, I was let go and told the teacher I had 0 knowledge he had my shit so I managed to get the grade still

Was fucking close though, but as far as I know the dude only got an F on the assignment, not the class, dunno if he passed since we stopped talking
>>
>>58021327
you could probably do it yourself. I suggest looking at the web development general or maybe ask on /gd/ if you want some advice
>>58023227
I'd rather it be akin to neither
>>58023815
what about ATS?
>>
>>58024278
no git, I don't make any hacks public
and I simply write assembly hooks to process memory space during runtime, don't need anything more fancy than that
>>
Does anyone feel like a champ and wanna crate a simple user script for me? I'd like to add "&nohtml5=1" to youtube url's but I have no idea how to do it or even how to get started on learning how to do it. It would have to be javascript obviously but I don't know where to start.
>>
What's performance like in languages without mutability and stuff?
>>
>>58022889
What physics engine are you using, or did you create it yourself?
>>
>>58024391
If you're trying to force flash on yuoutube there's a plugin already.
>>
>>58024434
Please share one that'll work on Opera 12
>>
>>58024443
Sorry I'm on firefox.
>>
>>58024422
Terrible.
>>
>>58024422
Garbage Collected
>>
Why is creating GUIs so shit? Why do they need all these shitty dependencies? It makes me want to kill myself.
>>
>>58024422
generally slightly slower than performance in something like Java, but by only a very small amount (within one order of magnitude, usually much less). although it does very much depend on what you're trying to accomplish
>>58024566
ikr :( what GUI framework/toolkit are you going with?
>>
>>58024566
I use WPF and it's comfy, even doggo likes it.
>>
>>58024576
Thought I'd use electron since I wanted to convert a web app into a desktop app. I wasn't very surprised when it required me to install various X and GTK libs but I ditched it anyway. I thought I'd rewrite everything in Qt but I'd have to install a massive amount of libs. Only thing left to try is GTK and god damn it's terrible. I'd consider writing everything in raw xlib if I didn't have to make my shit portable across at least Linux and OSX.
GUIs were a mistake. Or maybe I'm just a shitty programmer, that's possible too.
>>
>>58020745
A textual format is a good fit at least 95% of the time.

Why are you averse to using text/JSON?
Do you need to know how big the array is before you start reading in? Because that can just be the first fucking line. Like in every programming contest challenge, where they tell you how big the arrays have to be because otherwise it would be impossible to be as productive in C as in the other languages.
>>
>>58024638
haha I went through the exact same thing (Gtk -> Qt -> Electron (dropped before even using it)). ended up settling on WPF, which still sucks but at least it's not as bad as the alternatives. at one point I considered drawing with raw opengl calls :^)
>>
>>58024566
include windows.h, call createwindowex
no dependencies needed
>>
>>58024750

Except, of course, for the dependency on Windows.
>>
>>58022091
Reading the documentation?
Now I KNOW you're not a JS developer.
>>
>>58024761
nahhh
linux users run wine anyway
>>
>>58022146
There's just as many in other languages. They're just spread across multiple lines, and have different variations of brackets.

Java indented Lisp-style is hilarious.
public class Lisp {
public static void main(String... args) {
System.out.println("Hello World!");}}

It's actually pretty readable still. Next time we have a /g/-best-fizzbuzz competition, I'll write something in Java using Lisp indentation just for the fun of it.

>>58022597
Then get some discipline. It's darktime now, so you're not going to get any sun, but make sure you go to bed at the same time every day, and get up at the same time too.

That will force your body into unfucking itself.

>>58023352
I like strict types, but they're no excuse to not write tests. Tests are what allows you to force Pajeet to apply himself. With tests, you can say that it worked when you checked it in, it worked when your coworkers code reviewed it, and it worked in prod. So when Pajeet Looson changed things, and the tests stopped working, HE fucked up.

Sustained velocity is when you write tests and shit now, so you don't have to axe Pajeet later.

>>58023468
Because java.util.Date is the first attempt by the Java guys to make a time/date library. It sucked.
So they tried to do better and made Calendar. Which also sucked.
In the meantime, some guy made a good third party library called JodaTime. So they just hired him to put JodaTime in as a standard library, that you know as java.time.

>>58023512
Depends on the type of cheating done. If it's two people copying eachother, it tends to get mysteriously not noticed. (But don't fucking fool yourself. They notice.)

You? You're fucked.
Me? I'd get thrown out of my university. And would have to finish my degree at another one.

>>58023633
C isn't really cryptic. It's just accurately representing how computers really operated in the late seventies. :^)
>>
>>58024422
In theory it's superb.
In reality it's absolutely shit.
>>
>>58024880
>In theory it's superb.
How exactly. I don't understand how someone could even come to the theoretical conclusion that immutability somehow helps performance.
>>
>>58024914
Multicore processing is helped by it.
But that's about the only thing I can think of right now.
>>
Fuck I feel like I could actually be decent at coding by now if I could actually decide on something to code. I literally have no idea, ever. I like coding but I never end up doing anything. What do you guys code? I'm not a beginner but I wouldn't say I'm advanced at all, I just need a project to work on.
>>
>>58025154
tcp chat
udp top-down online shooter
>>
>>58024914
Immutability can be optimised into mutability

Other than that
Immutability is automatically race-safe (in any situation allowing multiple reads)
Immutability means you can avoid unnecessary duplication, e.g. deep copying a tree to update the root - just keep the old pointer, it won't change
Immutability is good for programming languages
>>
>>58025256
How do I write numerical routines?
>>
>>58025273
What do you mean?
>>
>>58025256
>Immutability means you can avoid unnecessary duplication, e.g. deep copying a tree to update the root - just keep the old pointer, it won't change
Either I don't understand what you mean or you're wrong. Immutability means you have to copy shit. Passing pointer around is something you can do with mutable languages too.

>Immutability is good for programming languages
I agree. I fucking love Erlang. But aside from making multithreading easy there's not performance improvements from immutability.
>>
>>58025284
Lots of numerical routines I'm familiar with use mutable variables all the time to do inplace decompositions etc.
>>
>>58025295
I'm saying this:
You have a tree like this: (Value, Left, Right)
If it's immutable you can happily do this:
create a new tree (NewValue, Left, Right)
If not, you can't, because what if Left or Right are modified?

>performance
Yeah, but you can optimise immutability into mutability.
The real problem is memory allocation, de-allocation, cache optimisation, etc.
Those are the performance pains from implicit code.

>>58025306
Use an AST or a state monad.
For instance:

S0 = 0
.. do something with S, produce some data ..
S1 = f(S0)
.. ""modify"" S0 ..
.. do something with S, produce some data ..
.. produce some final result using SN
return SN and final result

the S given to each operation is the latest
>>
>>58025340
for the state monad, the type is

State s a = s -> (s, a)
i.e., a stateful operation, that has a state of type S, and produces a result of type A
is represented by a function from S to a pair of two values - a new S, and a result A


int myfunction() {
state++;
x = 2 * state;
return x;
}

-->
(int, int) myfunction(int state0) {
int state1 = state0 + 1;
x = 2 * state1;
return (state1, x);
}
>>
File: tmp_11359-VCN1zE-541161851.jpg (708KB, 1774x1602px) Image search: [Google]
tmp_11359-VCN1zE-541161851.jpg
708KB, 1774x1602px
>>58023776
Depression is a meme
>>
Have you fallen to any programming memes?
>you shouldn't make your own OS
>you shouldn't make your own browser
>you shouldn't make your own game engine
>>
>>58025632
>os
I have a microcontroler emulator planned, and tought about writing a minimal kernel for it once I'm done with it.

>game engine
Why shouldn't I? It's fun
>>
>>58025632
Why are these projects memes?
>>
Should I bother writing stuff in python if I want to share it with non-programmers who won't install python to run it? (Friends, etc)
>>
>>58025658
because there exists already better ones than you will ever make
>>
>>58025632

There's no reason not to make any of these on one's own. One just has to realize that it's going to take a lot of time and research to make anything close to good.

>>58025682

Programming doesn't have to be about making something that other people will use, or even that one will use one's self. Sometimes you just want to make cool shit for the sake of making cool shit.
>>
>sqlite won't accept a DELETE statement right after an INSERT in the same transaction

i can't even find this in their documentation, they just quietly prevented SQL injection and I debugged like an idiot thinking it was an issue with my program.
>>
Can someone post that big list of things to code? I really have no idea what to make
>>
>>58020860
it's got my name on it and i plan on using it for employment shit in the future, so no
>>
>>58025721
programming isn't for you, go away
>>
>>58025727
programming is for everyone anon
>>
>>58025721
have any problems with a application?
debug it and write a patch if it's open source or if not then use some assembly patching to fix it up

>>58025736
no
>>
been dicking with node.js because i want that meme money. made a discord bot for fortune today. only took like 17 lines and just werks.
>>
Programming is for everyone
https://www.youtube.com/watch?feature=player_embedded&v=dU1xS07N-FA#!
>>
>>58025783
/v/ vidyafags should not be allowed to code
>>
>>58025154
Hentai game
>>
>>58025632
>hur dur you shouldn't learn about certain things, it's bad because I said so!
Fuck off, first and third items on your list are fun as fuck to implement, you can't stop me from doing them.
Second is just suicidal.
>>
File: 1462446236295.webm (1MB, 800x400px) Image search: [Google]
1462446236295.webm
1MB, 800x400px
newbie here again. check out this script

i almost feel like if i made a gui for it and added some other features, this could be a kinda useful program?
>>
>>58025900
you're killing the site's bandwidth
>>
>>58025934
That's hiro's problem and not yours
>>
>>58025900
Couldn't you create something similar just by doing something like
wget -r 4chan.org/s4s | elinks | grep meme
?
>>
>>58025953
probably lol
>>
>>58025946
my porns in /gif/ is slowing down so it's the community's problem too
>>
>>58025953
what does elinks do?
>>
>>58025934
if the python requests are using gzip then each json request for a thread is probably near 50KB max

151 * 50 = 7.55MB

more bandwidth was used by everyone viewing that webm than what the script used
>>
>>58025980
Elinks is a terminal browser. It parses the html and outputs text. I don't have it installed so I can't check the man, maybe you need to add a specific argument to be able to pipe html into it and get text output.
>>
>>58025965
And you think that's because of this anon and not your shitty internet or hiro having no idea how to run the site?
>>
Writing matrix functions in actionscript because i hate myself. Also using FlashCS5.5 to do so because i clearly enjoy mental pain

Aaaanyway my traceMatrix function returns an undefined error and i cant be bothered to find out why, anyone of you fa/g/s see the issue?
>Inb4 its the most obvious and retarded mistake ever
function traceMatrix(matrix:Array):void 
{
var output:String = "MATRIX:\t";
for(var i:int = 0; i <= matrix.length; i++) {
for(var j:int = 0; j <= matrix[i].length; j++) {
output.concat((matrix[i][j]).toString());
output.concat("\t");
}
}
trace(output);
}

function addMatrices(matrix_1:Array, matrix_2:Array):Array
{
var matrix:Array = [[],[],[],[]];
if(matrix_1.length >= matrix_2.length) {
for(var i:int = 0; i < matrix_2.length; i++) {
for(var j:int = 0; j < matrix_2.length; j++) {
matrix[i][j] = matrix_1[i][j]+matrix_2[i][j];
}
}
} else if (matrix_1.length < matrix_2.length) {
for(var k:int = 0; i < matrix_1.length; k++) {
for(var l:int = 0; j < matrix_1.length; l++) {
matrix[k][l] = matrix_1[k][l]+matrix_2[k][l];
}
}
}
return matrix;
}
var matrix_1:Array = new Array([0,1,2,3,4,5],[5,4,3,2,1,0]);
var matrix_2:Array = new Array([0,1,2,3,4,5],[5,4,3,2,1,0]);
traceMatrix(addMatrices(matrix_1,matrix_2));
>>
Is C development on Windows worthwhile? It seems like Microsoft's tooling and APIs are more designed towards C++?
>>
File: 582365c.jpg (53KB, 480x475px) Image search: [Google]
582365c.jpg
53KB, 480x475px
How does elements of programming by stepanov compare with sickpee?
>>
>>58026067
there's not much you need C++ for if you're doing native applications for windows

C# would be better for GUIs though
>>
>>58025946
>>you're killing the site's bandwith
>That's hiro's problem
get the fuck out you stupid newbie faggot
>>
>>58026067

Literally all of the Win32 API is in C, Anon. Same with the driver framework.

That said, I recommend not using MSVC if you're gonna do C on Windows, unless you need to do kernel mode shit (Visual Studio is a royal pain in the ass, but you're forced to use it if you want to do any KMDF shit).
>>
>>58026094
Wanna fight, hey?
>>
>>58026123
Yes.
>>
>>58026068
>muh concepts
>>
new thread when? :3
>>
New thread:
>>58026223
>>58026223
>>58026223
>>
>>58025900

It would be easier/faster touse the 4chan API for that..


>>58025985

But the number of requests for scraping is very high. Some web masters will block that.
>>
>>58020625
could i do any and all kinds of programming on a thinkpad?
>>
Do you guys do anything other than fizzbuzz?
Thread posts: 316
Thread images: 37


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