[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: 39
File: himegoto.jpg (337 KB, 1280x1449) Image search: [Google]
himegoto.jpg
337 KB, 1280x1449
Old thread: >>51726786

Remember to report all non-anime /dpt/s everyday!
What are you working on, /g/?
>>
>>51731325
Writing a basic SDL wrapper for C++ (I know there definitely is one) for use in a project/further projects.

>>51731210
Good work; you're the huffman in C++ anon right?
>>
Which looks nicer to you?
char *blk_xor(char *dst, const char *src, size_t len)
{
const char *sp = src;
for (char *dp = dst; sp - src < len; sp++, dp++)
*dp ^= *sp;
return dst;
}


func blk_xor(dst: UnsafeMutablePointer<CChar>, src:
UnsafePointer<CChar>, len: Int) -> UnsafeMutablePointer<CChar> {
for i in 0..<len {
dst[i] ^= src[i]
}
return dst
}


Guess which one is considered ancient and obtuse by open source faggots?
>>
File: Screenshot_2015-12-07_00-40-17.png (91 KB, 1600x900) Image search: [Google]
Screenshot_2015-12-07_00-40-17.png
91 KB, 1600x900
Add together two n-bit binary integers and print the result
>>
>>51731376
Open source faggots love C?
>>
>>51731379
>i3
good
>Sublime
bad
>green on black
bad

visit >>>/g/desktop/ for a week
>>
>>51731325
Studying for exams atm. Plan on starting my chess engine when exams are over.
>>
>>51731398
Nigga how else am I going to look like a l33t haxx0r
>>
>>51731376
what fucking language is that holy shit that is ugly
>>
File: puzzle.png (237 KB, 742x476) Image search: [Google]
puzzle.png
237 KB, 742x476
>tfw you're a genius
how long will it take for you plebs to solve this geometry puzzle?
>>
>>51731435
Looks like Rust.
>>
>>51731446
on that image or on a blank canvas?
>>
File: easy.png (24 KB, 800x400) Image search: [Google]
easy.png
24 KB, 800x400
>>51731446
>>
>>51731461
you start with that image and add 3 straight lines
>>
>>51731493
>1
>triangle
>>
File: IMG_20151207_245319127.jpg (2 MB, 2340x4160) Image search: [Google]
IMG_20151207_245319127.jpg
2 MB, 2340x4160
>>51731446
Where's my prize
>>
C++
class A {
private:
int x;
public:
int thing() const;
};

that const just means the function doesn't change x, right? I keep using it like that's what it does but I'm not sure.
>>
File: m8...png (814 KB, 585x1040) Image search: [Google]
m8...png
814 KB, 585x1040
>>51731508
>>
>>51731525
yes.
>>
>>51731525
shouldn't the const go before int?
yes, all it does is make it immutable
>>
>>51731609
noice, ty
>>
>>51731612
that would make thing return a const int
>>
>>51731612
a const always applies to whatever is left of it (except when it's the first keyword, then it applies to whats right of it)

in this case, the function itself is const, not the return type.
>>
Is it worth writing object oriented C by pretending C structs support functions using function pointers?
>>
File: IMG_20151207_011422158.jpg (2 MB, 2340x4160) Image search: [Google]
IMG_20151207_011422158.jpg
2 MB, 2340x4160
>>51731551
Where's my prize?
>>
File: 0072.jpg (28 KB, 300x335) Image search: [Google]
0072.jpg
28 KB, 300x335
>>51731325
I'm trying to figure out why
read-bitmap
fails to display an image while
(send bmp load-file "/path/to/img")
works.
>>
>>51731376
>Which looks nicer to you?
The part where there isn't any code.
>>
>>51731720
congratulations, you have autism
>>
File: triangles.png (203 KB, 742x476) Image search: [Google]
triangles.png
203 KB, 742x476
>>51731446
Done.
>>
everyone report OP for being a subhuman
>>
>>51731525

Correct. Tho it should be noted that as this is c++ that can be got around. It would be bad practice but it can be done.
>>
>>51731689

It depends. If the problem is small/trivial, prolly not.
If the problem is non-trivial/large and it maps well to OO, maybe.

If you have more detail I could give a better answer.
>>
>>51731720
>israel
>>
I have a class with a member object, I don't want that member's destructor to be called when the class's destructor is, wat do
>>
>>51731941
redesign your class

or allocate it on the heap with new then free (not delete) it
>>
File: 2015-12-06-0038-15.webm (3 MB, 854x912) Image search: [Google]
2015-12-06-0038-15.webm
3 MB, 854x912
>>
>>51731914
>not satan
>>
who front end dev here?
>>
>>51731971
>there's a difference
>>
>>51731951
redesigning
the difference is
Interface interface(720, 480);

//this
Rectangle rect(interface, 10, 10);
rect.render();
// vs
Rectangle rect(10, 10);
rect.render(interface);
>>
>>51731968
what is that?
>>
>>51731988
rect.render(interface);
every time
the other makes no sense
>>
>>51731968
I'm guessing the way you prevent performance from becoming ass with all those objects is that the path of each object is rasterized onto some sort of buffer every frame.
>>
File: 2015-12-06-1530-55.webm (2 MB, 690x788) Image search: [Google]
2015-12-06-1530-55.webm
2 MB, 690x788
>>51732004

Particle simulator.

>>51732010

In the .webm I posted, a line segment is made for every animation step, so each particle has like 5000+ lines attributed to it. Plus paths are drawn until a particle dies.

I've changed it so lines are made for every 10 steps of the animation (so instead of 5000 line records, only 500). The path is aliased but still smooth enough and doesn't kill performance.
>>
File: Untitled.png (67 KB, 683x337) Image search: [Google]
Untitled.png
67 KB, 683x337
So I was reviewing my code, and the one thing that I get wrong is that smallest gets reported right, but largest gets me a huge negative number instead of the lowest number that I inputed. Is there a way to fix this?

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

Here is the program that I was doing.
>>
>>51732058
is that just openGL?
>>
>>51732122

C and GLUT, yes.
>>
>>51732111

I meant biggest gets reported right and the smallest gets reported wrong.
>>
So, Code Blocks for C++ then?
>>
>What are you working on, /g/?
http://www.nask.co
fixed a few bugs, quality of audio should be better now. I'm now thinking how to promote it.

here are some examples, with memes:
- u wot m8
http://www.nask.co/hear/BO60IWpmZq

- atheist, vid, audio from http://nask.co/hear/coWjMUQ31O
http://www.nask.co/see/xV0O7OAwzg

GNU/Linux by RMS, audio from http://www.nask.co/hear/zE3tbeGXNu
http://www.nask.co/see/aLL8VC9lSE

linus to RMS, vid from http://www.nask.co/hear/Rw6PSOq9vQ
http://www.nask.co/see/8Is9gmuwnx

sadly, I improved the quality of the audio AFTER making these videos.. gotta remake them
>>
What's your background in math and CS?
Did you do this for an assignment?
I've been playing with 3D graphics and it's way harder than I expected.
>>
File: part.png (6 KB, 308x351) Image search: [Google]
part.png
6 KB, 308x351
>>51732058

The aliasing is pretty bad at maximum heights of the bounce.
>>
>>51732169
Visual Studio is better, it's Microsoft's flagship product (besides Windows)

Code Blocks works but you don't have an excuse not to use Visual Studio considering there's a free edition now

>>51732141
meant for
>>51732181
>>
>>51732189
>Code Blocks works but you don't have an excuse not to use Visual Studio considering there's a free edition now
Ya but I'd like to use FOSS shit when I can
>>
>>51732189

I don't have a background in math or physics. I did well in calculus, but not in geometry or trig. There wasn't a lot of math involved truth be told, only took me a couple of days to write it: it's only 800 lines.

The most math intensive thing I did was camera controls since I have a hard time with angles.
>>
>>51731325
cute girl op what's her name
>>
>>51732169
vim and g++
>>
How do I find out which board gets more traffic, our /g/ or infinity chan's /tech/?
>>
Trying to create a universal pizza ordering system that displays prices for everything before you check out. For example you could create a 16" pepperoni pizza and see prices from pizzahut, dominos, etc.

Having a big fight with angular right now though and its a pain in the ass
>>
>>51732253
They're both shit.
>>
>>51732264
Where do you frequent then?
>>
>>51732274
The place that isn't shit.
>>
>muh data structures
>muh algorithms
>>
>>51732242
>Gurl
ajajajajajajajajajaj
>>
Can someone give me a nontrivial example of where they've use a curiously recursive template definition in real code? I understand the concept, but I fail to see an occasion where reconsidering what I'm trying to achieve hasn't resulted in a better outcome. The trivial example of a counter makes perfect sense though, anything larger seems doomed to be overly complex.
>>
Rustfags

What is your dev environment?
>>
File: hmmm.jpg (21 KB, 393x360) Image search: [Google]
hmmm.jpg
21 KB, 393x360
SQL question here.

I have a table "teacher" and a table "class". I need to make a trigger AFTER INSERT ON teacher that will prevent me from putting a teacher when I put him in the table "class".
So he's not available anymore and it'll return me a number that'll say that the teacher is already teaching something.

I need help on making that trigger.
>>
>>51731398
What's wrong with Sublime?
>>
File: O2w5gx4.webm (623 KB, 720x404) Image search: [Google]
O2w5gx4.webm
623 KB, 720x404
Ask your beloved programming literate anything.
>>
>>51733428
You act as a tripfag, yet you don't have a trip. How come?
>>
>>51733442
Because Schrödinger
>>
File: ss+(2015-12-07+at+11.48.27).png (10 KB, 677x343) Image search: [Google]
ss+(2015-12-07+at+11.48.27).png
10 KB, 677x343
>tfw making it

are you making it anon?
>>
>>51733533
what's that?
>>
How the fuck do I solve graph problems in idiomatic C? I am having some trouble implementing Djikstra's algorithm from pseudocode... specifically I don't really understand the data structure it operates on. I just pass it a bunch of nodes with pointers to their neighbors and weights? And then the function manages the arrays and somehow returns the shortest path?

All the implementations I've looked up have clearly been written by retards. Like, what the fuck is this: http://www.codewithc.com/dijkstras-algorithm-in-c/ ?? If you're seriously using [] instead of * in your function arguments, that's fucked.
>>
>sigh...
>>
File: 336969.jpg (193 KB, 1024x768) Image search: [Google]
336969.jpg
193 KB, 1024x768
>>51733542
the current ongoing league tournament matches of Blood Bowl in the FUMBBL website/client, I'm making an IRC bot that will announce the matches from the /tg/ league tournament which is currently happening so people can spectate without necessarily knowing when the match is happening

It's my first 'real' project and I've already gotten the bits that were the most intimidating to me, now I just need to click it together
>>
>>51733598
Is that better than the video game version or something?
>>
Also fuck people who do this shit:
typedef struct graph *Graph;

OK COOL YOU HID THE FACT THAT IT'S A POINTER, FUCK YOU
>>
File: paths.png (9 KB, 505x516) Image search: [Google]
paths.png
9 KB, 505x516
I could probably add a forward path, too. I know all the environment variables when a particle is spawned, I could predict where it'll go and draw the path it'd take, not just the path it took.

>muh performance impact
>>
>>51733634

>jaggies

>>>/agdg/
>>
>>51733617
FUMBBL has everything from the tabletop game and official rules, super friendly and tight community, spectator sounds (all games with spectator modes should have this, so good) and is 100% free, but has super shitty graphics, is less friendly to beginners due to giving you less information and the community is smaller

the videogame has better graphics, has a bigger community, is more friendly to beginners but it's incomplete in terms of teams and rules, some stuff is buggy, the community is flakier, it's not free, has some dumb rule changes, no spectator sounds!! and Cyanide

so it depends on what you're looking for
>>
>>51733630
typedef struct graph * GraphPtr;
>>
>>51731376
The swift example only suffers from AppleNamingConventions otherwise it's far more readable and still the same amount of lines even though you ommited curly braces in the C code and split the swift function signature into two lines.
>>
>>51733742
This is fine, at least it's clear. If the only difference between your structs and your struct pointers is that one has a capitalized letter, you're retarded.
>>
>>51732527
So I guess no one has actually used these... Perfect
>>
>>51731376
char *blk_xor_fixed(char *dst, const char *src, size_t len)
{
char* faggot = dst;
while(--len)
*dst++ ^= *src++;
return faggot;
}
>>
>>51733630
That good practice actually, especially if the user never need to deference the pointer.
>>
>>51733817
Is it already lunchtime in Bangalore, Sanjay?
>>
>>51732111
>>51732150
You are accessing memory outside of your array. Change "i <= 10" to "i < 10" in your second loop.
>>
>>51733814
>not using a Duff's device and unrolling your loop
Absolutely disgusting.
>>
>>51733853
>Duff's device
>nicer
nice try faggot

Also >>51733814
It's
while(len--)
>>
>>51731325
well i believe i bit off more than i can chew.

I have a project, Its to take a UV light and have a camera/sensor identify a certain threshold of blood/stains on a washcloth. it must be all handled through a standard arduino uno and must be capable of identifying the wash cloth at 150 ft/m and 500 pieces an hour.

Before i even start on the hardware side of this project, does this seem feasible?
>>
>>51733877
What the fuck? Are you going to MI6 Gadget School or something?
>>
File: primefactor.png (28 KB, 677x342) Image search: [Google]
primefactor.png
28 KB, 677x342
http://pastebin.com/fKUqTXEM

I never thought low-level programming can be that fun.
>>
>>51733902
ahahahahaha
>>
>>51733901
industrial technician.
>>
>>51733853
But anon, why wasting your time with such inane optimisations when the compiler vectorizes the code
>>
>>51733761
>for i in 0..<len
>no semicolons
disgusting
>>
/dpt/ in a non-professional / non-technical (in terms of official titles) way, what is the difference between "coders", programmers, engineers, etc.. What would you say defines or differentiates these kinds of people? Despite all my studies I don't know where I would actually fall under if evaluated, I don't know how to gauge my understanding of this kind of field. I always feel like I know less than hobbyists too and don't know how to improve myself (what to improve).
>>
>>51733911
I'm open to constructive criticism, so make up a proper sentence like an adult instead of laughing like a retard.
>>
>>51733877
kek that sounds pretty fucked

is it for refugees? i bet you get a lot of jizz from those "children"
>>
>>51733946
no, nothing of the sort.

its just for "quality" control

the retail version of the system costs 1.3Mil

trying to build an open source alternative.
>>
>>51733918
>expecting any compiler but ispc to vectorize your code effectively
You're in for a world of disappointment, anon
>>
>>51733926
A coder writes code, a programmer designs code, and an engineer designs things

why was that hard?
>>
>>51731376
Both are absolutely horrible by modern software engineering standards, not only do they lack proper encapsulation and blatantly violate the single responsibility principle, but they also use unsafe languages features and way too terse variable names. I can hardly decipher this shit and chances are your joke of a toy language doesn't even support multiple inheritance and dependency injection.
>>
>>51733634
quick question, Im interested in how you did the paths. Do you keep a list of sampled points and then connected them or do you save each path's image and just blit them together? If it's neither Id like to hear how it works
>>
>>51734000
>save each position
>draw line between each position
wow that was hard
>>
>>51733985
I see a lot of people fight over the terms a lot, mostly people from the lower tiers trying to say they're from the higher tiers.
>I know HTML I'm a programmer
>I wrap JS libraries I'm a web engineer
I'm being a bit hyperbolic but I hope you get what I mean.

What does "design" mean in this context though? Like writing a spec? Can you give me an example, I'd appreciate it. I know I'm being goofy about it but I just want to get an understanding.
>>
>>51734016
If you're going to get into specific terms a coder=Code Monkey, is told generally what to write into code by a lead programmer, web engineer is just a fancy term some faggot wants to use
>>
>>51734036
I just really don't want to mislead people, if I say "I'm a programmer" I want to know what people expect of me, I want to make sure I can meet the expectations, lest I get in over my head when participating with a group. I'm still consider myself new to this and don't have any real experience with a team I don't know already.
>>
>>51734066
Quit being a faggot and worrying so much, you're whatever the job you're applying for needs
>>
>>51734090
I need your help Anonymous!
>>
>>51733975
well i think an arduino will be too weak to do a lot of image capturing and processing but otherwise you could probably do it
>>
Why doesnt this C code work?

I decided to pick up C today, started by making a command parser program

#include <stdio.h>
int main(int argc, char *argv[])
{
int count;
for (count=0; count<argc; count++)
puts (argv[count]);
if (*argv[2] == 1) {
printf("one\n");
}
else if(*argv[2] == 2) {
printf("two\n");
}
else{
printf("neither desu\n");
}
}
>>
>>51734036
a code monkey is still a programmer. coders are people who write in markup and scripting languages
>>
>>51734146
ok.

thanks.

i would like build one, regardless of what the hardware is needed, just something that is cheaper than the retail version. I know it would make the workers lives a bit easier that they wouldnt have to visually inspect each individual item. (roughly 10k per day)

im going to start building most of the hardware today, should be fun.
>>
>>51734172
Stop using C and use Python or something..
>>
>>51733989
stroutstrup pls
>>
>>51734172
Aren't you comparing a string to an int?
"1" != 1
You need to convert your arguments.
>>
>>51731379
what font is that (sublime) familia?
>>
>>51734252
And you stop spouting crap.
>>
>>51734257
I thought that was legitimately the problem, geez.
>>
>>51731325
int c = 5, d;
d = ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c;


How much is d?
>>
>>51734268
Wasnt the guy who wrote the code. I'm familiar with a language that parses ints automatically.

Thanks ill try that.
>>
>>51734252
That was it, thanks! (char not string though)
>>
>>51733994
This just shows how disconnected from reality you are, if anyone ever dared to commit code like this in a mission-critical project he'd be fired. I mean look at this thread, there's people arguing about the difference between programmers and code monkeys while others are showing off their 'knowledge' of irrelevant trivia like duffs device, stuff so obscure it doesn't even belong in the computer history museum. I doubt anyone here is actually a certified professional, so go right ahead and keep fooling yourself into thinking plain for-loops like that were still a thing. But that's not how software gets done in the real world.
>>
>>51734172
yay for shitty code
>>
>>51734296
>>51734257
What are you doing?
>>
>>51734252
It worked

I just put atoi() around the argv references in the if-loop

Thanks
>>
>>51734377
are you sure you need the pointers and count?
>>
>>51734377
No problem, good luck with C. I like it and think it's fun.
>>
File: 1437951008140.jpg (7 KB, 300x303) Image search: [Google]
1437951008140.jpg
7 KB, 300x303
>tfw starting to use java exceptions

holy fuck, it's like my code can't crash now.

feels like a superpower wizard.

>tfw no longer have to deal with outofboundserror
It's like finally losing my virginity.

;)

I can now write java enterprise code.

;)
>>
>>51734385
I removed the pointers for that solution

>count
Not sure
Honestly im just fiddling around with the language for the first time, not everything is gonna make sense, and its not gonna be LOC perfect
>>
>>51734385
I didn't even notice that, they should not be using a pointer there for argv.

Count should be declared and initialized in that loop too.
for (int count=0; count<argc; count++)
>>
>>51733390
bumping this
>>
>>51734420
okay, gl with C, mate. this is just the start but soon you'll be writing great code
>>
What's the fastest way to "convert" a 128 bits integer to 16 bits ?

By convert, I mean setting a bit in a 16 bits integer if a byte in the 128 bits integer is non-null.
>>
>>51734580
Also, consider you can only access the 128 bits through 4 32 bits ints.
>>
>>51734580
In what language? A 128 bit number is 16 bit is you interpret it as 16 bits. just ignore everything after the first 2 bytes.
>>
File: 1428723268025.png (43 KB, 296x369) Image search: [Google]
1428723268025.png
43 KB, 296x369
I asked yesterday, but got no replies, so I tried to find the answer through google, but no avail.

http://pastebin.com/Y1ErDMEB

It's a simple quiz game with 4 choices where I want to highlight the correct answer when someone gets the answer wrong. The point is to get kids to learn the word, not to penalize. However, I have no idea how to highlight the correct answer. I thought it was the "elseif btnoption1,2,3,4.text.equals.correct1" parts I put under each button, but that doesn't work. It takes the vocabulary from a text file, as well as the correct and incorrect words. Does anyone know how to highlight the correct word when someone clicks the wrong one?

Yes, it's Windows, yes, it's Visual Basic. Insult me as much as you guys want, I don't mind. But if anyone can just point me in the right direction, I'd appreciate it, thanks.
>>
>>51734580
>By convert, I mean setting a bit in a 16 bits integer if a byte in the 128 bits integer is non-null.
what

integer != 0
>>
File: 1613.jpg (15 KB, 500x375) Image search: [Google]
1613.jpg
15 KB, 500x375
anyone care explaining how do i deal with audio encoding in video? with video its no problem, i have with*height*4 = frame size, i also know fps so i can easly process it, but with audio its all unknown for me. ive set
params.audioBits = 16;
params.audioRate = 44100;
params.audioChannels = 1;

what buffer size should i set? how do i calculate fps for audio?
>>
>>51734414
>no exceptionfactories
plebian code*
>>
>>51734887
128 bits = 16 bytes -> 1 bits per byte.

he want the nth bit to be turned on/off is the nth byte is non null

n16 = n16 | (n128 & 0xFF > 0)
n16 = n16 | (((n128 >> 8) & 0xFF > 0) << 8)
n16 = n16 | (((n128 >> 16) & 0xFF > 0) << 16)
n16 = n16 | (((n128 >> 24) & 0xFF > 0) << 24)
...
>>
>>51734943
made an mistake: should have been << 1, << 2, << 3
>>
>>51734928
wtf is a factory?
>>
>>51734758
This looks pretty bad, and for the most part not simply because you're using VB (although you really should be using C#).

            If btnOption4.Text.Equals(key) Then
Incorrect = Incorrect + 1
allpoints = allpoints + 2
btnOption4.BackColor = Color.Red
ElseIf btnOption2.Text.Equals(correct1) Then
btnOption2.BackColor = Color.Green
ElseIf btnOption3.Text.Equals(correct1) Then
btnOption3.BackColor = Color.Green
ElseIf btnOption1.Text.Equals(correct1) Then
btnOption1.BackColor = Color.Green
End If


There are 4 blocks of code here, and because they all are inside if/elseif/endif, at most one of them is going to happen. What you want, as far as I can see, it for two of them to happen.

So, in pseudocode, rewrite your code to be this:
if(btn4 is incorrect){
incorrect = incorrect + 1;
}

if(btn1 is correct){
btn1.color = green;
} else if(btn2 is correct){
btn2.color = green;
} else if(btn3 is correct){
btn3.color = green;
} else{
MessageBox("There was no correct answer, sucker!");
}
>>
>>51734963
A factory as the name implies builds objects.
>>
>>51735004
why should I care?

I though they were memes.
>>
>>51734982
Actually, since correct1 appears to be a collection of keys, why are you comparing a string to it in btnOption2.Text.Equals(correct1)?

If my previous suggestion does not work, please clarify what correct1 and incorrect1 are.
>>
>>51734903
>i have with*height*4 = frame size
Do you realize that depends on pixel bits and pixel mode and won't work in all cases?
>>
File: image.png (635 KB, 1136x640) Image search: [Google]
image.png
635 KB, 1136x640
>>51731325
will this help my son Learn to program? he's 14.
>>
>>51735113
do those kids look 14 to you?
>>
>>51735025
>why should I care?
You wanted to write enterprise code
People use factories because they're scared of 'new' and it's a good way of ensuring every class has only one responsibility
I don't use factories much myself

>I though they were memes.
You're never going to make it with this attitude, anon.
>>
>>51735113
dude he's 14, he can just read documentation and learn to program in actual programming language, i've started with programming at age of 13, don't treat your son like a retard
>>
>>51735096
works for me (tm), seriously that was just an example, its the audio synchronization that i have problem with. basically i use library that provides callback function with data and data size, but i dont know what time its from, its length, nothing
>>
>>51735113
code.org is the only thing you will need
>>
>>51735113
>14
>toys
nigga
just teach him java or C#

they're retard friendly.
>>
>>51735151
lel
>>
>>51735113
Sign him up for a course somewhere instead
One where he has to physically be an interact with others
>>
>>51735178
>it's funny because it says nigger
>>
>>51735188
code.org is literally for kids and you don't learn anything worth mentioning, >>51735151 must be joking
>>
>>51735113
That kid on the left looks annoyed.
>>
>>51735025
>>51735132
I used quite an amount of those in C++ and Java because I actually had to have an object that creates new objects (the most simple case is when depending on input string I have to create different kinds of objects).

I never called them factories, though, because I am not a faggot.

Playing around with C# right now, and its reflection system is rich enough to create stuff without having to write code that creates it.
>>
>>51735178
yeah, u r a funny guy.

>>51735202
yes it's for kids and it's very good for the targeted audience.
>>
File: Valutron.png (17 KB, 750x216) Image search: [Google]
Valutron.png
17 KB, 750x216
>>51731325
The algorithmic language Valutron.

Valutron is my algorithmic language for programming computers. Derived principally from Scheme (as defined in R6RS) and from ISO Lisp it provides an object-oriented and functional environment in which to build software.

The two main features Valutron offers that define it apart from other languages are, first, a powerful object model descended from iLOS (ISO Lisp Object System) and that of Objective-SmallTalk, which permits extreme dynamism and uses total-late-bound multimethods; the second, a code representation called V-expressions, which provide an algebraic syntax option for the language.

The implementation I am working on is called Valutron QuickSilver Performance Engine. It is written in Objective-C. Input is first transformed into Cons trees and then compiled into bytecode, which is executed in a precision virtual machine whose design incorporates influence from Gnu Guile and the SECD Machine. A clean Trace-and-Sweep garbage collector is used to manage memory use; this collector is very efficient and fast, and leaves little reason for anyone to prefer manual management.

Finally, Valutron offers a pleasant interactive REPL environment.
>>
>>51735240
>>yeah, u r a funny guy.
>being this buttmad
>>yes it's for kids and it's very good for the targeted audience.
not for 14 year olds though
>>
>>51735227
Then what do you call them without confusing other people
>>
If older than 12, give him C Primer Plus or K&R before he gets into contact with Java / C# / Visual Basic (seems very popular for kids) cancer.
>>
>>51735305
>how to get your kid to instantly drop programming
>>
>>51735305
C is way too autistic. start him off with java and maybe move over to C++ as a second language
>>
>>51735252
if you are a total beginner, the artist and angry bird course are decent for any ages.

>>51735305
>starting with c
now, you really funny.
>>
>>51735289
For example, if this is an object that creates something inherited from FilterItem class, its base class could be named FilterItemType. I also used Spawner for another project.
>>
>>51735305
>tfw I only mainly know how to program in php
>tfw I finally realize how shitty this language is
Is C# MVC a good place to start moving away from php?
>>
>>51735338
How is that any funny? 30 years ago most started with C.
>>
>>51735338
I honestly think that either extreme is good, no in between stuff, either go highest level or lowest level within reason of practicality.

With something like Python you can still learn concepts just fine without knowing all the details then learn more later if you want/have to, starting on the other end with C you'll learn a lot from it which translates to other languages being easier to pick up or work with later as well as some insight which may be useful even in other languages.
>>
>>51735363
C# seems very convenient to write code in. Especially latest versions. There is honestly nothing in it that Java can't do, but C# just offers a much easier path to achieve your task.
>>
>>51735375
30 years ago everything was CLI garbage.

Java is a fine choice, good salaries, easy to work, shit ton of documentation and libraries.

better than C for most shit, unless you wanna do drivers and kernels.
>>
>>51735375
>>51735390
Have any of you actually tried teaching a skill to someone?
>>
>>51735410
so, what would you reccomend?
>>
>Getting kids interested in programming
>Helping them to get started
>Showing them how
>Gentle introductions
>Playful explorations

Faggots, just give up on them crooked kids already.
>>
>>51735375
>How is that any funny? 30 years ago most started with C.
nope, c never been popular in academics (take looks at the papers of the time if you doubt). pascal, simula, lisp, fortran, ... those were popular.
>>
>>51735410
Yes, why? I've succeeded using different methods for different people. There is no perfect answer for everyone and everyone learns differently, some people react better to lectures while other react better to books on their own, some people prefer to dive in while others would rather start slow and shallow.

What I'm saying is what worked for you will not work for everyone and what worked for me won't either, no one approach is inherently good or bad it's very personal and specific.
>>
>>51735390
>recommending python or C, nothing in between, to a first-timer
you just went full retard

and python is absolutely fucking disgusting and downright harmful to beginners. whatever you do don't start with python, haskell or lisp
>>
>>51735434
Just like your parents gave up on you?
>>
>>51735434
>not teaching kids how to do games using java or python
LOL
O
L
>>
>>51733284
Lots of oxidised iron.
>>
>>51735363
C# is a very good choice because it's easy to then switch to Java if you need to (almost identical syntax, different framework), and it's good for learning other C-like languages (namely C, C++, and D).

You also end up learning the .NET framework, which lots of languages like VB.NET, F#, and IronPython use.

You can also use C# as a direct replacement for PHP by means of ASP.NET.
>>
>>51733390
>>>/g/wdg
>>
>>51735249
what happend to the github repository ?
>>
>>51735448
In between is a mess, if you're going to start you should start at one end or the other not in the middle. I'd say lisp in itself is on par with C in terms of a starting point although it's certainly a different path.

What in particular do you have against Python?
>>
>>51735429
Using their creativity to think of something they want to build and help them pick out a language. It might not be the best language they choose, but it's important that beginners have fun and are not bound to a language because it's a very good language to understand concepts with.

>>51735446
Putting people on the hardest shortest path to picking up a new skill never worked with anyone I worked with.
>>
>>51735485
inb4 autists say that /wdg/ is only for web design and that database shit belongs in /dpt/ when the OP of /wdg/ explicitly mentions
>Backend development
>>
>>51735492
What do you mean? The repository is working fine.
>>
>>51731325
Anime is trash.

What can we do about these troll OPs?
>>
>>51733390
Well done not mentioning what database you're using.
>>
>>51735494
>What in particular do you have against Python?
i'm not going to bother with this shit for the nth time

but basically python hides as much as possible from you, no explicit types when declaring variables, doesn't teach that you're doing very simple operations on sets of binary bits. it's a bunch of "magic" that you don't know how it works. at least C is much better in that regard but you should pick a solid middle ground instead. you fucking murricans have no concept of "lagom"
>>
File: 1420590337676.png (154 KB, 364x370) Image search: [Google]
1420590337676.png
154 KB, 364x370
>>51735061

Thank you for your previous suggestion, but changing it did not work. Yeah, I should have clarified; correct1 is a textfile with all the correct choices, and incorrect1 is a textfile with all the incorrect choices, it's declared at the top. Do you want me to upload the text files? Would that help?
>>
>>51735511
>Putting people on the hardest shortest path to picking up a new skill never worked with anyone I worked with.
It's the minority for me for sure, to reiterate there is no "cure all" when it comes to teaching. In my experience the hard path is not the short one either, learning C certainly takes longer for a beginner as there's much more to cover which for some people is actually counter productive since it's information overload on all these new concepts. It's certainly not the right approach for everyone but it can be for some, obviously if people benefit from this then they should go that route, if they're struggling too much it's the wrong way to go about it but it should be obvious when you question them before you even begin down the path at all. It can be as simple as
>how do you normally learn things?
>would you rather dive in or tread lightly
>here's a basic overview of what you'd have to go over and learn, how do you feel about this
etc.

Take into account I'm no expert this is all anecdotal.
>>
>>51735456
What's that supposed to mean? I worked to pay for my first computer and figured that shit out all by myself with a battered copy of K&R. If they're not interested by themselves, just accept them for the inferior breed they are.
>>
>>51735600
Then the problem arises that a beginner wants to take shortcuts, trying to discover a 'secret' way. Overestimating how good they can learn and picking the fast route, which will bore them after a while.
>>
>>51735519
Blind yourself.
>>
>>51735399
>There is honestly nothing in it that Java can't do
Working generics
structs
pointers
easy native interop
SIMD
properties
operator overloading
async/await
unsigned integers
>>
>>51735551
You're not wrong, it's certainly magic but there can be value in learning higher level programming concepts first and the mechanical details of it later, for some people (this is key to what I'm saying).

I'm going to use a shit analogy here but it's like teaching someone how to mow a lawn, they just need to know how to work the thing not how it works, they can get the task done and then learn how the mower itself works and how to build one themselves later. I doubt that applies to what I said but I'm really fucking tired so bear with me.

>>51735640
I think that's highly personal, some people may have that problem but I don't think those that care will. I think that's why I have had such success, the people I am teaching want to learn these things for their own reasons, it's not like compulsory classes where people need to just get it over with. For more adept people the short path seems like a shortcut but to some it's not really a short path, they may struggle with it just as hard as others on the hard path, if anything the people starting shallow spend more time overall since they have to go over the same concepts again later. I hope that made sense, I'm doing a poor job right now which doesn't support what I'm saying. lol
>>
You guys happen to know where I can find code for a java-based probability outcome simulator that takes a csv file and calculates based on an algorithm I already got? Normally I wouldn't ask for something so specific from here, but I'm at my wit's end.
>>
>>51735217
he really doesn't
are you an aspie?
>>
>>51735178

Hehehehehehe epin xD
>>
>>51735789
Probably, maybe just jaded.
>>
>>51735769
>and calculates based on an algorithm I already got
so whats the problem?
how to open and read a csv file?
you need to learn how to break down your problem into several smaller ones anon
>>
>>51733877
who are you killing?
>>
If you were to write a specification for your own language, how would it look like? Is there any standard form that it should look like or should I just start throwing random descriptions about the specific features of the language?
>>
>>51735815
Well, yeah, basically. I need to take the data, do my calculations, and then store it in a list so it can be displayed in a tabular view.
I'm not really sure what to do.
>>
>>51735844
>describe his problem
>dunno what to do
LOL
O
L
>>
>>51734305
>certified professional
>muh fizzbuzz
>muh nodejs
webfag detected
>>
>>51735865
I meant that I don't know how to go about writing the code. If you're curious, this is the full detail of what I'm trying to do.
http://pastebin.com/JxyMtUPM
>>
>>51735516
What about the C Memory Model?
>>
>>51735516
https://github.com/JX7P/Valutron-old-
>-old-
>>
>>51735519
Ignore and keep posting? It's just one post in a thread of 200 after all. All that matters is that it contains the /dpt/ text in it.
>>
>>51735893
First build the GUI, it doesn't have to do anything, just that it can start up
Second build that you load a file and print the contents in a console
Third build the algorithm in the program and print the results in the console
Last make it display the results in the GUI.

Those steps should be pretty google-able.
>>
I have a number of frames in a certain animation.

I want to instantiate a list and add a rectangle to each frame.

I want to use a foor loop.

should I use:

for (int id = 0; id < animation.size(); id++)

or

for (int id = 0; id = animation.size(); id++)

Which one?
>>
>>51735947

2nd one
>>
>>51735399
>>51735477
Thanks
>>
>>51735947
I know nothing about animation but I would think the first one.
>>
>>51735947
The second one will assign animation.size() to id on the first iteration, are you sure that's what you want? Also you probably want to get the size before the loop.
>>
>>51735821
https://en.wikipedia.org/wiki/Metasyntax
https://en.wikipedia.org/wiki/Formal_system
https://en.wikipedia.org/wiki/Denotational_semantics
https://en.wikipedia.org/wiki/Operational_semantics
https://en.wikipedia.org/wiki/Hoare_logic
http://homepage.cs.uiowa.edu/~slonnegr/plf/Book/
>>
>>51735947

What's wrong with "<="
>>
>>51735998
When your animation has 8 frames it'll do 0 1 2 3 4 5 6 7 8, resulting in looping over 9 frames instead of 8.
>>
>>51736021
so, should I use < instead?
>>
>>51736034
I don't think it would be a good idea to try to loop over 9 frames when you only have 8.
Try it though, you'll see it'll give an out of bounds exception
>>
>>51735947
You should also consider assigning the size() to a variable before the loop. For all you know, it may be re-computed on each call.
>>
>>51735989
Thank you!
>>
>>51735947
I would also try using this instead, unless you have to use id for something.
//Replace Object with whatever class you use
for (Object frame : animation) {
//Do something with frame
}
>>
>>51736070
dunno, < gives me the number of frames I want.
>>
>>51732188
what lenguage & visual librarie are you using?
>>
my old-man prof just used the phrase "on the bare metal"

i thought that was just a 4chan thing
>>
>>51735685
Those are all features of the language. Not tasks you would want to complete using the language.
>>
File: plebs vs pats dpt.png (56 KB, 839x777) Image search: [Google]
plebs vs pats dpt.png
56 KB, 839x777
>>51735401
>>51735338
>>51734414
>>51735227
>>51735457
>>51735769
>>51735685
>java
get the fuck out
>>
Any ideas for a program to create as a beginner in C? I have done some Lua before. I think I'll create a basic text editor.
>>
>>51736272
>PHP
Nice picture faggot
>>
>>51736179
>Not tasks you would want to complete using the language.
Almost every language can accomplish the same tasks in that sense.
>>
>>51736295
Well, for example, in Pascal you can't create a library that would accept a string of a vriable length, in C and C++ you can't have inspect/debug your program reliably after something goes wrong, in Javascript, you can't do file i/o without third part extensions...
>>
>>124551909
nice
>>
>>51736322
but you can still solve the same problem with all those languages.

Java methods can't return unsigned integers, accept pointers or invoke native code easily.

>in Javascript, you can't do file i/o without third part extensions...
io libraries have nothing to do with the core language.
>>
>>51731376
Terrible. This is far more idiomatic;
 
char *
xorblock(char *dest, const char *src, size_t len) {
for (size_t i = 0; i < len; ++i)
*dest++ ^= *src++;
}
>>
>>51736343

Have you looked into nodejs and npm?
>>
>>51736398
yes why?
>>
How do I communicate with a RabbitMQ server in elisp ?
>>
>>51736322
>in Pascal you can't create a library that would accept a string of a variable length
what?
>>
>python

def function(var):
whatever(var)

How do I run something like this without passing var?
>function()
The function has 4 different options and one of them I'm trying to add needs the variable.
But it breaks all the other ones because no variable...
>>
>>51736586
If one of them is not optional you must pass that argument. If you just don't know how to do optional parameters in Python, then Google that.
>>
>>51736628
Thanks, anon. I googled before this but I didn't have the words.
>>
>>51736586
Refactor.
>>
>>51734580
movdqa xmm0, [yourdata]
pxor xmm1, xmm1
pcmpeqb xmm0, xmm1
pmovmskb eax, xmm0
not eax
>>
>>51737032
holy shit
>>
>>51737032
Why did you learn ASM and what do you use it for? I've considered it myself but can't really commit to it.
>>
Bummer, couldn't be on to solve the AoC D7 challenge to keep myself in the leaderboard =[
Thread replies: 255
Thread images: 39

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.