[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: 21
File: 1449091772190.jpg (376 KB, 2500x1000) Image search: [Google]
1449091772190.jpg
376 KB, 2500x1000
Old thread >>51699144
>>
File: gYyp8Vl.jpg (380 KB, 927x1400) Image search: [Google]
gYyp8Vl.jpg
380 KB, 927x1400
Where are the source code files for coreutils located in a unix distro? trying to gind the source files for ls, cd, etc.
>>
first
>>
what was that C book that gets recommended to begginers all the time?
>>
>>51704824
K&R C aka The C Programming Language?
http://www.ime.usp.br/~pf/Kernighan-Ritchie/C-Programming-Ebook.pdf
>>
>>51704746

You don't know how to type "gnu coreutils" into a search engine?
>>
>>51704746

Most things don't come with the source in order to save space. They aren't located anywhere in your distro unless you've downloaded them.
>>
File: DPTChristmas1.png (334 KB, 588x409) Image search: [Google]
DPTChristmas1.png
334 KB, 588x409
>>51704718
http://adventofcode.com/

Daily challenges from here until Christmas
>>
is there a way to use a Stream Socket in C and mark a particular byte to send as URG?
>>
>>51704958
I've done this and the answers aren't what I'm looking for.

>>51704996
I'm using
find / -name "*.c" -print

but am getting too many results. Interesting that the code program is here but the source isn't. I was hoping I could whittle my command down to something more specific.
>>
Thinking of picking up my old project: automatic generation of beatmaps by using beat detection. To make my live easier, I'll be using mpg123 and kissfft. Even better would be if there was a beat detection library available for C or C++.
Do you guys know of any onset detection library?
>>
>>51705008
Well, the ones up to today were pretty simple.
Let's see what the next days bring.
>>
C# > D
>>
"wiring" J-K circuit in C from individual NANDs for a simulation (visualization) of the functionality - it's not even difficult, just dull and boring.
>>
File: cat.gif (16 KB, 180x236) Image search: [Google]
cat.gif
16 KB, 180x236
>>51704824
this one is far better than K & R
>>
>>51705200
plenty 'o time for this to become a tormenting challenge
>>
alright lads what new hip programming language should I pick up?

inb4 go and swift, they're too popular
>>
>>51705008
>To play, please identify yourself via one of these services:

why
>>
>>51706242
I don't know, but here they are pastebin'd if you don't care to create a fake account:

>>51705595
>>51705907
>>
>>51706130
D
>>
There are still a hundred fucking posts left in >>51702900

What the fuck are you doing
>>
>>51706793
THAT WAS NEVER A LEGITIMATE THREAD WHAT THE FUCK YOU FUCKING RETARD

THERE WAS NO LINK POSTED TO IT

>>51699144 IS THE PREVIOUS THREAD
>>
>>51706898
retard alert
>>51702910
>>51703812
>>
>>51706898
nvm i just woke up and assumed that this OP wasn't straight up fucking retarded
>>
>>51706793
Image wars, OP of >>51702900 posted that thread early >>51702910 to force his D image, OP of this thread created a thread when the last one actually went over bump limit.
>>
>>51706920
>posted before 310
>D shill thread
unacceptable
>>
>>51706930
this is the legit one then
>>
>>51706930
>>51706950
this post was after bump limit
>>51703812
that thread has 200 posts
>b-but it's not the real dpt because raisins
>>
>>51706976
the thread was posted before the bump limit. a reminder after the bump limit doesn't suddenly make it legit
>>
>>51706938
>>51706930
literally says "do not post in until this hits 310"
literally created early (20 posts early) to avoid trap op image

>>51702910
>>51702959

there was one post linking to this thread and it was 37 posts late
>>
>>51706976
>my thread has 200 posts
FTFY
>>
>>51706999
and posting it before the bump limit doesn't make it fake either


>>51707004
>my thread has 31 posts
>>
>>51707002
Well, this will be our "pre-emptive" next thread. We'll just keep it warm until >>51702900 expires.
>>
>https://github.com/apple/swift/pull/165/files
>https://github.com/apple/swift/pull/218
are they normies for worrying this much about being politically correct... or autistic for not recognizing that it's a troll and for not having common sense enough to stick to previously established terminology

fucking pisses me off either way. glad i don't use swift but this bullshit could spread to java or even C++
>>
>>51704718
sage
>>
>>51706130
haskell, ocaml, or rust
>>
>>51707315
sage means legend in German, meaning that the thread is legendary.
>>
>>51706130
go sounds faggy
>>
>>51707155
I actually have a funny story about this: A professor of mine was explaining threads, and noted that some people did not like the master/slave terminology in programming, so maybe he should use primary/secondary or something else.
Then he smiled at us and kept using master/slave the rest of the semester because he just doesn't give a fuck.
>>
i mistook that D programming thread for a /dpt/ thread.
so here is my question.
I am using C#.
i would like to know whether joining multicast group could be programmed in a way so that the message you just sent to the group doesn't end up getting recieved by your listener thread as well.
is there some form of ID that is already set?
or should i be working on some type of identifier byte at the start of each message and only display those which don't share your id?
>>
>>51707385
it was a joke, and they took it seriously
>>
>>51704718


NEW THREAD
>>51702900
>>
>>51705008
I've only done up until day 3's part 1 (as seen below). I'll continue the rest tomorrow.

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

/* directions */
#define UPWD '^' /* 0 */
#define DOWN 'v' /* 1 */
#define LEFT '<' /* 2 */
#define RIGHT '>' /* 3 */

/* global vars */
int direction[3];

/* Santa's move */
void santa_move(int read)
{
if (read == UPWD)
direction[0] += 1;

else
if (read == DOWN)
direction[1] += 1;

else
if (read == LEFT)
direction[2] += 1;

else
if (read == RIGHT)
direction[3] += 1;
}

int main(void)
{
FILE *input; /* input file */
int x = 0, y = 0; /* coordinates */
char read; /* read direction from file */

/* open file */
input = fopen("in/input", "r");
if (input == NULL) {
exit(1);
}

/* begin reading file */
while (!feof(input)) {
if (fscanf(input, "%c", &read)) {
santa_move(read);
x = direction[0] - direction[1];
y = direction[3] - direction[2];
printf("%d,%d\n", x, y);
} else {
exit(1);
}
}

fclose(input);
return 0;
}


./pt1 | sort | uniq -c | wc -l
>>
import Cocoa
import CloudConvert


class ViewController: NSViewController {

override func viewDidLoad() {
super.viewDidLoad()

CloudConvert.apiKey = "mykey"

// Do any additional setup after loading the view.
let inputURL = NSBundle.mainBundle().URLForResource("file",withExtension: "gif")!
let outputURL = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as? NSURL

CloudConvert.convert([
"inputformat": "gif",
"outputformat" : "webm",
"input" : "upload",
"file": inputURL,
"download": outputURL!
],
progressHandler: { (step, percent, message) -> Void in
print(step! + " " + percent!.description + "%: " + message!)
},
completionHandler: { (path, error) -> Void in
if(error != nil) {
print("failed: " + error!.description)
} else {
print("done! output file saved to: " + path!.description)
}
})
}


override var representedObject: AnyObject? {
didSet {
// Update the view, if already loaded.
}
}


}



want to make a gif to webm conversion app for mac. How do I make the inputURL not return nil? getting this error
fatal error: unexpectedly found nil while unwrapping an Optional value
(lldb)
>>
>>51707421
>>51707443

I'm really confused
>>
>>51707421
this is the daily programming thread, not the D shill thread
>>
I'm trying to implement a multiplayer mahjong network, but i'm already at an impasse.
I'm wondering if I should implement an actual starting pool, pick a random position, file it in a queue randomly and use that queue to fill the walls ?
Or should I just randomly put them inside the wall directly?

It's the first time working on a game, but I want the internals to be easily adaptable
>>
>>51707507
>there's a difference
>>
Also posted in the other thread

Slowly making progress.
I finished link-layer addresses/broadcast and I started working on packet dissection for my network stack tonight.
I'm not sure yet, but I think it's best to have a flat list of all headers like [EthernetHeader, IPv4Packet, UDPPacket] , instead of a nested design.
Luckily distinguishing between 802.2 LLC and regular 802.3 frames isn't that hard, since EtherType values are all > 1518 (max MTU).
Meanwhile I'm still thinking about the filter subsystem and where to put the handlers.
I'd like to get some feedback, but no one in DPTs before nor anyone IRL thinks it's an interesting project it seems.
>>
If this is the /dpt/ thread, then why are most of the posts about whether or not this is the real thread?
>>
My friend function can't access the class's private member. I thought they could? They're in the same namespace and that's the only answer on SO.
//a.hpp
namespace dpt {
class A {
friend int func(A& a);
private:
int private_b;
};
}

//a.cpp
namespace dpt {
int func(A& a) { a.private_b = 2; }
}

$ g++ main.cpp a.cpp
a.hpp: In function ‘int func(dpt::A& a)’:
auto.hpp:20:10: error: ‘int dpt::A::private_b’ is private
int private_b;
^
a.cpp:39:18: error: within this context
a.private_b = 2;
>>
>>51707548
>shilling this hard
>>
>>51707631
>"dpt thread"
>no traps
>nothing gay
>no anime
>no SICP
>not shilling D or FP

Something just doesn't seem right here.
>>
>>51707650
>computer scientists: concerned with type systems, side effects, paradigms, etc

>programmers: concerned with available library bindings, performance, and platform support

>bosses of programmers: concerned with the language being object oriented in a way that keeps their hordes of inexperienced employees from stepping on each other's toes too much

>/g/: concerned with aesthetic issues like brackets and indentation styles


Bikeshedding is the proper word for it. /g/ mainly talks about brackets, syntax, and identation styles because it's non complex and everyone can contribute a opinion and be semi valid.

Any real issues will cause too much risk of being pointed out as incorrect or stupid if they're wrong / mistaken.

either talk about code, or stfo
>>
>>51707664
Holy shit you really are a newfag
>>
>>51707637
in haskell, how do you actually use/apply a monad
>>
File: uwotm8.png (29 KB, 826x392) Image search: [Google]
uwotm8.png
29 KB, 826x392
>>51707675
>ignoramuses who actually believe putting a computer together is some noble feat that requires critical thought or skill

>/tinfoil/s who think the nsa is out to get them, and have no concept that it's merely a big governmental organisation

>the entire hardware enthusiast community, dont even get me started on how pointless their existence is

>brand fanboys

>people who got lost trying to find /wg/ (desktop threads)

>people who got lost trying to find their way to /v/

>my preferred software is better than your preferred software for these reasons which are irrelevant and entirely subjective:

>Much like the DJ/Producer of yesteryear, programming, aka "making apps" is the latest must-have personality accessory
>>
>>51707743
>>51707664
go back to reddit
>>
>>51707762
this tb.h f.am
>>
>>51707762
struck a nerve, eh you NEET narcissist?
>>
>>51707789
didn't read it, just saw the double spaced posts; reddit needs an empty line between lines to put it it on the next line in the post
>>
>>51707606
fixed it, nvm


to anyone with same problem: check the function signature
>>
>>51707806
well, i have obligations, and am compensated for my time so i don't know as much about reddit as you ostensibly do. thanks for that though.
>>
Massive noob here, learning c++. Can anyone see pic related and tell me why I am getting the error I am getting. I see absolutely no reason for receiving the error and don't really understand the tip the error gives yet.
>>
>>51707850
why are you trying to rewrite the Source engine from scratch if you're a massive noob?
>>
>>51707850
Try including <string>.
>>
>>51707850
u need to google dat dere error. i found the answer on the first page. it's like you aren't even trying.
>>
https://www.madewithcode.com/
literally what is google trying to accomplish?
>>
>>51707894
enslave women
>>
>>51707806
takes one to know one
>>
>>51707875
Thanks a bunch for the help, that fixed it.

>>51707887
I googled the error message but not the error code, my ridiculously stupid mistake.
>>
>>51707894
>flood the job market with wymyn
>use wymyn as code monkeys
>hire competent men cheaper
>>
>>51707925
In general, if you're using something from a header, like std::string from <string>, include the header, even if it partially works. Never depend on a header including another header.
>>
>>51707919
enslave women, make them work as much as men
>>
>>51707440
is there a better way to deal with this than wrapping the calling function in an if {} statement? if i do that, what data do i assign it to?
see: https://stackoverflow.com/questions/24643522/fatal-error-unexpectedly-found-nil-while-unwrapping-an-optional-values


would this have something to do with teh fact that i haven't set up the UI in storyboard yet? (i think this is unlikely, but i could be wrong)
>>
>>51707957
Okay, thanks for the advice, I'll think about this in the future.
>>
so,
i'm using intellij,
rmi doesn't work at all.
the classes are seperate from the java files.
and whenever i run it, it says that its missing.
how the fuck can i fix this.
>>
I have a question about instancing vs geometry shading. Say I have a circle and I want to move it (0.1,0.1). With instancing would I have to adjust every vertex or is there a way to just change a single vertex like with geometry shaders?
>>
>>51708230
Each instance would have an offset, and in the vertex shader you'd use it to transform the position.
>>
>>51708248
So if I wanted to rotate a square I would be able to just rotate say, one of the corners which I have defined as the offset?
>>
>>51708298
What? You're not making any sense.

All you do in instancing is provide extra data to the vertex shader that is "per-instance". You can then use that to do per-instance transformation or whatever.
>>
i want to learn a new language, but i just keep going back to python.
every time i'm wondering how the fuck i'm supposed to implement a certain feature or write something a certain way, i just redo it in python and it makes so much more sense.
>>
>>51708320
I'm trying to discern why I should use instancing over geometry shading. I don't know anything about instancing.
>>
>>51708367
blub paradox
>>
>>51708368
I already told you. It's faster and expresses intent better.

One specific example would be providing a different model matrix for each instance, instead of using a uniform model matrix. By supplying N different model matrices and drawing N instances, you can draw N of the same thing, with different transformations, very fast.
>>
>>51708402
Alright but what I was really asking is when I have to transform a shape will I have to change literally every vertex of that shape individually. When I want to rotate a shape around a point will I have to rotate every vertex around that point.
>>
>>51708393
interesting read. i'm definitely a blub programmer.
i need to shake this blub somehow.
>>
>>51708450
Yes, but it's all happening in the vertex shader. It's much faster to draw N instances at once than to do N uniform changes and draw calls, one for each instance.
>>
>>51704746
probably somewhere in the /src/ directory hun
>>
Got malloc working on my os's heap. Free works sometimes.
>>
>>51708546
>malloc works
>free doesn't

That'll teach people to manage memory properly
>>
>>51706130
C
>>
>>51708450
you're severely overcomplicating the simple act of moving a mesh around a scene, unless im missing something here. your mesh should be stored as a collection of vertices in model space (i.e. origin of 0,0,0), then you store the mesh's location in world space (i.e. your cube is located at 3,6,0 in the scene). when you pass your vertex position to your shader you just add your world position to that vector to offset it. you don't need to fuck about with geometry shaders and instancing doesnt make a difference.
>>
>>51708607
It kind of does make a difference because I don't want to fuck around changing hundreds of vertices whenever I want to rotate a sphere.
>>
>no traps again
>>
I definitely could use a hand or two coding this thing. If anyone is interested, that is...

http://neetco.de/ZenosCave/BamfOS
>>
>>51708640
the mesh's location/rotation/scale in world space is all that changes

your graphics card does the dirty work with the transformation matrix and all the vertices
>>
www.ideone.com
Show me a program you are working on, /g/
>>
>>51708640
Literally everything in 3D rendering involves doing shit to hundreds of thousands of vertices at a time. That's what GPUs are really, really, REALLY good at.

Why are you trying to do something as "advanced" as instancing when you seem to know nothing about even basic 3D rendering?
>>
>>51708667
go to containment board /lgbt
>>
>>51708640
thats why you apply the worldview matrix to your vertices. are you following a tutorial or something because you seem to be misunderstanding really basic concepts of 3d rendering
>>
#include <iostream>
#include <windows.h>

void CreateFolder(const char * path)
{
if(!CreateDirectory(path, NULL))
{
std::cout << "The directory could not be created!" << std::endl;
return;
}
else
{
std::cout << path << " has been created!" << std::endl;
}
}

void DeleteDirectory(const char * path)
{
if (!RemoveDirectory(path))
{
std::cout << "The directory could not be deleted!" << std::endl;
}
else
{
std::cout << path << " has been deleted!" << std::endl;
}
}

int main()
{
CreateFolder("C:\\New Folder");

DeleteDirectory("C:\\New Folder");


return 0;
}


Rate my kewl program, /g/.
>>
>>51708738
>windows
sorry
>>
>>51708715
>>51708708
I've been developing a collision engine but learning actual graphics programming on the fly to speed things up. So yes my graphics programming is kind of chop shop right now.
>>
>>51708757
I mean, have you even written a shader before? You'd quickly realize that it's trivial to do something like "changing hundreds of vertices whenever I want to rotate a sphere".
>>
>>51708753
>He doesn't program memedows programs

Pham I like Linux and all but come on, the market share is almost entirely with Windows.
>>
File: 1407019323306.jpg (72 KB, 1012x580) Image search: [Google]
1407019323306.jpg
72 KB, 1012x580
>>51708738
>Using proprietary libraries
>>
>>51708714
implying /g/ doesn't have the cutest submissive traps
>>
>>51708768
I have but I've never changed a circle's position in world space without using a geometry shader.
>>
>>51708771
lol
>>
>>51708777
/g/ is into cute submissive hetero-normative, cis girls
>>
File: 1420449883418.png (149 KB, 348x379) Image search: [Google]
1420449883418.png
149 KB, 348x379
>>51708771
Why would you choose now of all times, when Microsoft is literally walling off Windows to squash third party support, to become a Windows developer?
>>
>>51708757
nothing wrong with that, but i would recommend you read some tutorials and get a better understanding of how its all working. 3d rendering definitely isn't something you want to just hack together.
>>
how can i compare an unprintable byte in a switch statement?

ie, byte = 0xff
case 0xff: case 255: don't work, it just keeps defaulting.
>>
>>51708827
You think it's bad now? You should've seen the stupid shit I was asking before I learned trig.
>>
>>51708788
Well, I think you need to go back and actually think about what you're doing, because you don't seem to understand how it all works.
>>
>>51708848
yeah rendering stuff is like incomprehensible magic when youre starting out. i dont really miss it that much, although i do wish i'd gotten further. at some point when im less busy i might resurrect my engine and make it somewhat usable, engine dev is pretty fun overall.
>>
>>51708847
dont forget your break
>>
>>51708847
maybe cast the byte to int? quick google says that switch statements must be used with an integral or enumerated type.

>>51708978
this too
>>
>>51708954
It's a great way to learn too. /v/ dev general constantly shits on engine devs but 3D engine development pretty much covers everything you would need to know to make a game that isn't shit.
>>
>>51708847
#include <stdio.h>

int main (int argc, char ** argv)
{
int len = 0xff;

switch (len)
{
case 0xff:
printf ("Here in the quote-unquote \"unprintable byte\" case\n");
break;
default:
printf ("Here in default case\n");
break;
}

return 0;
}


C:\>cl test.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.

test.c
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.

/out:test.exe
test.obj

C:\>test.exe
Here in the quote-unquote "unprintable byte" case

C:\>
>>
>>51708818
What do you mean?

I want to create programs for Windows, because over 95% of people use Windows.
>>
>>51708988
yeah working on an engine was the most engaging and maturing programming project ive ever worked on for sure. definitely made me realize how important my math deficiencies are, and now i take math a lot more seriously.
>>
>>51709004
try an unsigned int for len.
>>
>>51709004
>>51709035
wait nevermind. That is working how it should. I don't see the problem
>>
Who here /learning Winapi/?

Who here /Olly dbg/?

NIGGA WE DON'T GIVE A DAMN WHERE YOU FROM, NIGGA WE DON'T GIVE A DAMN WHERE U FROM
>>
>>51709008
The issue isn't how many people use Windows. The issue is neo Microsoft hates you and doesn't want you developing pesky little applications that allow you to trivialise and subvert their marketing department's decisions.
>>
>>51709070
But I want to make a memenet.
>>
>>51709008
>over 95% of people use windows
*over 95% of people use windows at homes and in offices
If you're making desktop applications, just use Java or C#.
>>
>>51709103
>If you're making desktop applications, just use Java or C#

Lack of performance for memenet.
>>
>>51709084
>>51709115
Just memeing.

But really though I like C++, and I wouldn't want to learn Java or C# just for developing for Windows...
>>
>>51709065
>needing to learn winapi
>>
Is it normal to write the constructors in the .h/pp and the other member functions in the .cpp? Especially if the constructors only assign passed arguments.
>>
>>51709156
Why do you like C++ for desktop applications? Are you mad?
>>
>>51709065
Literally the only thing I have ever used windows.h for is hiding the cmd. That's it.
>>
>>51709194
What do you use then when you need to write windows programs?
>>
>>51709192
>Why do you like C++ for desktop applications? Are you mad?

What else would I use C++ for? Web development front end?

It does its job, is intuitive and can be both low level and high level.
>>
>>51709205
C++

And C, because sometimes I like manually managing memory.
>>
>>51709192
are you mad?
>>
>>51709221
So how do you do it without using winapi...
>>
So I'm writing a blackjack program in C++ and I'm figuring out the odds of a computer drawing a card with a certain hand. So for example, if the two cards add up to 11, there is a 100% probability that it will draw another card. If the cards add up to 21, there is a 0% chance that it will draw another card. All card sums between 12 and 20 have a special probability.

How do I hand the if statements? I don't want it to look like
if (sum <= 11) { }
else if (sum == 12) { }
else if (sum == 13) { }


I know I can rearrange the order of the statements to change the runtime, but essentially I'm wondering if there's a better mousetrap for handling a lot of if statements. I'm not that experienced.
>>
>>51709221
You can manually manage memory just as well in C++ as in C.
>>
>>51709219
>all there is is desktop applications and web dev
confirmed for mad
>>
>>51709252
Mobile development?

Sorry that market is too saturated for me, not interested.
>>
>>51709240
By using MinGW.
>>
>>51709241
    if (sum <= 11) {}
else
switch (sum)
{
case 12: /*code*/ break;
case 13: /*code*/ break;
case 14: /*code*/ break;
default: /* code*/ break;
}

or write more generically
(if you don't break, it'll execute the next case as well)
>>
Ok I want to start learning a programming language which one should i look into and how should i start
>>
>>51709266
What? How do you interact with the OS if you're not using winapi?

How do you hook a process to monitor events then?
>>
>>51709298
APL.
>>
>>51709241
if (sum <= 11) { prob = 100; }
else if (sum == 21) { prob = 0; }
else { prob = (21 - sum) * 10; }
>>
>>51709294
Thanks a ton, I forgot all about switches since I never used them.
>>
>>51709298
C
either:
C Primer Plus by Stephen Prata
or
C Programming: A Modern Approach by K. N. King
>>
>>51709298
>Taking advice from a board of NEETs with riced arch desktops

lmao.

You'd be better off asking a forum of programming enthusiasts that don't have crippling autism.
>>
>>51709298
>>51709314
Start by getting the special keyboard, you'll need it.
>>
>>51708546
>>51708677
Free works now, Did some more testing, after freeing memory it isn't being used again. Something's still wrong, but it doesn't page fault or go beyond Kernel Heap now!
>>
>>51709332
What keyboard would you suggest i currently have a 600k with mx reds
>>
File: aplkeyb.gif (43 KB, 590x207) Image search: [Google]
aplkeyb.gif
43 KB, 590x207
>>51709355
>>
>>51709298
python or C

or download SICP and watch all of the MIT opencourseware on it
>>
>>51709396
MIT courseware is a fucking meme.

It's way too theoretical, it's like electrical engineering-tier instead of learning programming.

Sorry senpai
>>
>>51709298
My vote is for C.

You should get a book but you can learn a lot of beginner stuff from online tutorials. About a million different YouTubers have C Programming Tutorial playlists which start with installing the program and end with intermediate stuff.

Also to the rest of /g/, is there any reason why a person should learn C before C++? My sister wants to learn programming early and I'm half tempted to start her on C++ because I'm most familiar with it.
>>
>>51709409
lol just kill yourself my man
>>
>>51709298
java
https://docs.oracle.com/javase/tutorial/

C++ if you want to be more "hardcore" from the start
http://en.cppreference.com/w/cpp/language

absolutely stay away from:
>python
>haskell
>lisp
>javascript
>php
and some others but those are the worst
>>
>>51709425
Stay NEET my good man.

I'll be copying public code and getting faggots on stackoverflow to do everything for me LOL

>Mfw people work FOR FREE to make dumb things for ganoo/linoox

>Mfw people make hella dough getting others to do work for them for free in the form of "opensource" and stackoverflow
hahahahahahaha

>>51709443
>Php
>bad

Must've not heard of PHP7 then huh
>>
>>51709415
If she's any serious about it, start with C. It's less language to learn.
>>
File: 18211.png (98 KB, 400x300) Image search: [Google]
18211.png
98 KB, 400x300
>>51709459
>>>/reddit/
>>
>>51709477
>>>/r9k/
>>
>>51709459
code monkey: the person
>>
>>51709443
Bad list.
>>
>>51709459
enjoy building websites for the rest of your life
>>
>>51709509
I don't care that much, I just want to have fun and make money
>>
>>51709298
I think im gonna go with c but i have no knowlage about programming so what exactly is the best way to start
>>
>>51709474
imo learning c++ is worthwhile because of OOP which is an important topic to cover. not that it would be much work to transition from C to C++, but imo she should just start on C++.

>>51709523
on the off chance you're not just trolling, i truly feel sorry for you
>>
>>51709522
>enjoy building websites for the rest of your life

Enjoy making fizzbuzzes for the rest of yours. And using whatever else dumbshit neets on /g/ tell you to.
>>
>>51709524
google "c tutorial". its literally that easy. you're lucky to be living in a moment in time where you can learn virtually anything within minutes online, so take advantage.
>>
>>51709538
You don't start with OOP, and you can do OOP in C, not that I would have a beginner do that.
>>
>>51709524
see >>51709322
>>
File: 2015-12-05-2119-24.webm (114 KB, 1072x844) Image search: [Google]
2015-12-05-2119-24.webm
114 KB, 1072x844
Mane, collision detection was easier than I thought. Still need to work out radius as you can see.
>>
>>51709538
>C++ is worthwhile because of OOP

>baiting both the C and C++ fags
>>
>>51709582
No you cannot do object oriented programming in C.

It does not exist.
>>
>>51709582
true, but its an easier transition than having to go from C to C++ just to understand OOP.

>>51709613
hahahaha

>>51709624
fake it till you make it
>>
>>51709611

>particles collide and the yellow one lands right next to two who did not collide

kek, work on your code bruh
>>
>>51709624
structs with values and function pointers
>>
>>51709624
https://www.cs.rit.edu/~ats/books/ooc.pdf
Have fun.

>>51709645
>true, but its an easier transition than having to go from C to C++ just to understand OOP.
I suppose that's the case. You can teach imperative programming before introducing classes in C++ too, so I guess it works. "cout <<" is going to be hard to explain, though.
>>
>>51708738
rate progam desu senpaitachi
>>
can someone help me figure out what i'm doing wrong? i'm doing a compression algorithm off of a huffman tree

this is my function for reading the encoded character tree
// Function treeFromBinary returns the tree read in from the binary file at the second spot in the command line.
Node* treeFromBinary(BFILE* filename)
{
if(readBit(filename)==1)
{
Node* leaf = new Node(readByte(filename));
printf("leaf added: character = ");
printChar(leaf->ch);
printf("\n");
return leaf;
}
else if(readBit(filename)==0)
{
Node *left = treeFromBinary(filename);
Node *right = treeFromBinary(filename);
Node *nonleaf = new Node(left, right);
printf("node added: left character = ");
printChar(left->ch);
printf(", right character = ");
printChar(right->ch);
printf("\n");
return nonleaf;
}
else
{
printf("end of file\n");
return NULL;
}
}


this is the trace for my encoding program
http://pastebin.com/665wPVVz

this is the trace for my uncompressor program
http://pastebin.com/bmH5Lig8


this is the text file containing the encoded huffman tree
0000000011110111111011111101000010100101000101101000100101110001101110000101101100101101001001011100101011011100000101100111101100110010111100010111011000101100010001010101011010011000110111011101101000010010111010010110010111010100010110111110110000101011101000101100011101101101010010000000101110011101100100101100101

why is it only reading 2 of the values? is it completely messed up or only minor-ly messed up?

pls send help
>>
>>51709664
>>51709664
yeah "cout <<" was always kind of a mystery you just ignored as a beginner lol
>>
>>51709543
You don't have to go on /g/ to know that SICP is a god tier programming book. MIT taught it for years and, correct me if I'm wrong, still do to this day.
>>
>>51709677
can someone help me figure out what i'm doing wrong? i'm doing a compression algorithm off of a huffman tree

this is my function for reading the encoded character tree
// Function treeFromBinary returns the tree read in from the binary file at the second spot in the command line.
Node* treeFromBinary(BFILE* filename)
{
if(readBit(filename)==1)
{
Node* leaf = new Node(readByte(filename));
printf("leaf added: character = ");
printChar(leaf->ch);
printf("\n");
return leaf;
}
else if(readBit(filename)==0)
{
Node *left = treeFromBinary(filename);
Node *right = treeFromBinary(filename);
Node *nonleaf = new Node(left, right);
printf("node added: left character = ");
printChar(left->ch);
printf(", right character = ");
printChar(right->ch);
printf("\n");
return nonleaf;
}
else
{
printf("end of file\n");
return NULL;
}
}


this is the trace for my encoding program
http://pastebin.com/665wPVVz

this is the trace for my uncompressor program
http://pastebin.com/bmH5Lig8


this is the text file containing the encoded huffman tree
0000000011110111111011111101000010100101000101101000100101110001101110000101101100101101001001011100101011011100000101100111101100110010111100010111011000101100010001010101011010011000110111011101101000010010111010010110010111010100010110111110110000101011101000101100011101101101010010000000101110011101100100101100101

why is it only reading 2 of the values? is it completely messed up or only minor-ly messed up?

pls send help
>>
>>51709695
>SICP

I only read(drink) sizzurp nigga.
>>
>>51709703
How you got to huffman with that indentation is beyond me.
>>
>>51709723
i left align stuff i have to take out before submitting it
>>
>>51709723
i huffed a bunch of paint out of your mom's pussie
>>
>>51709723
The only thing about his indentation that looks fucked is the prints, which I would suspect he has line that so that he can easily identify his debugging code when he goes to remove it.
>>
>>51709749
Gotcha, carry on. Although allman is shit.
>>
>>51709752
nice. i was going to help you but i guess you can figure it out yourself
>>
>>51709266
>>51709300
Well retard?

How do you interact with the OS if you don't use Winapi?

LMAO the things you autists post don't even make sense, get back to ricing arch linux
>>
>>51709842
1) MinGW uses winapi
2) If he's using windows, and you're the one bashing him, why are you the one telling him to get back to ricing arch? Wouldn't that be you in this situation?
>>
File: 2015-12-05-2140-38.webm (196 KB, 840x618) Image search: [Google]
2015-12-05-2140-38.webm
196 KB, 840x618
>>51709611

Some jank is to be expected.
>>
File: wrappashot.png (914 KB, 2560x1024) Image search: [Google]
wrappashot.png
914 KB, 2560x1024
Working on basic wrapper for OpenCL for my old ass ATI Radeon 1850
>>
>>51708818
>Why would you choose now of all times, when Microsoft is literally walling off Windows to squash third party support
Why wouldn't you choose now of all times, when Microsoft is literally FOSSing their languages and tools to encourage third party support, to become a windows developer?

It's literally the best time it's ever been to be or be interested in being, a windows developer
>>
What's the point of abstract classes without a single pure virtual function? Can't I just inherit from a normal class? Sepples btw.
>>
>>51709973
This...

.net is becoming actually good
>>
>>51709995
It's not an abstract class if it doesn't have any pure virtuals. In fact, the only thing that can make a class abstract in C++ is the presence of a pure virtual.
>>
>>51708807

no g is into traps. also cross dressing makes you program better
>>
>>51709871
MemeGW is le compiler.

That doesn't even make sense... How would you be able to interact with the OS and hook processes without "using windows.h", as he said?

Do the processes magically hook themselves?
>>
>>51710010
I thought just having any virtual function made a class abstract. If that's not the case, then that makes sense, thanks.
>>
>>51709999
.net was always good as a technology, politics/philosophy notwithstanding.
>>
>>51710036
Well, I suppose you could also have an abstract class without any pure virtuals if you delete the default constructor. But yeah.
>>
>>51710019
MinGW is not the compiler. MinGW uses gcc. MinGW pretty much calls the winapi for you.
>>
>>51709459
wow, this idiot
>>
>>51710047
For developing for windows it's great.

Having everything built into framework is fantastic and saves a lot of needless headache.
>>
>>51709518
^true
>>
>>51709523
your iq is lower than 100, isn't
>>
>>51706130
nim
>>
>>51710096
>Talks about IQ while typing out that incomprehensible jumble of words

l m a o
m
a
o
>>
>>51709703
>>51709723
pls help
>>
>>51710012
go away, don't trigger people. you guys do Ruby, right? and complain about php, c++
>>
>>51710121
seems like you have trouble understanding words
>>
>>51710127
The only people who complain about PHP are retards and faggots.
>>
>>51709523
Please rethink your life
>>
>>51710141
>your iq is lower than 100, isn't
>isn't

what
>>
>>51710161
what a monkey
>>
>>51710157
>if u dont want to have fun and make money, u have to either get a love and interest in my hobby or rethink ur life!

You sound like a nerd tbqh.
>>
>>51710157
>>51710096
ITT jealous NEETs without a fucking dollar to spend

Being a code monkey is easy money
>>
>>51710167
what a faggot nigger(you)

pic relate is u phem
>>
>>51710170
well don't live out of others work
>>
>>51710182
k
>>
>>51710177
Whatever man, just acknowledge that you're literally a freeloader living off of other people's work :)
>>
>>51710177
>ITT jealous NEETs without a fucking dollar to spend

THIS.

>Mfw NEETs get mad that they're unemployed while other people are making money off others' work and are literally smoking cigars thanks to other people's (selfless) hard work

lmao

>>51710184
Why?

>NEET does a bunch of work FOR FREE, exactly like a janitor
>Someone else monetizes his work using others work

Are you mad because you're not making money and someone is?
>>
>>51709663
ridiculously shitty
>>
>>51710195
>Tfw freeloader
>tfw feels good

U jelly senpai?
>>
>>51710184
so, you don't work
all the libraries, all the programs, all the APIs, all the OSes were made by someone else, not by you.
>>
>>51710197
stay proud, parasite
>>
>>51710195
Alright buddy, I guess all companies should write their own frameworks too instead of using pre existing ones. Fucking freeloaders amirite :)
>>
>>51710221
no
>>
>>51710216
>stay proud, parasite

Stay poor, NEET.

I'll smoke my next $100 cigar thinking of you and your selfless hard work.

Remember, keep contributing to open source projects and posting code on StackOverflow!
>>
>>51710221
The dude said he copy/pastes all of his code lol
>>
>>51710233
Welcome to the world of software engineering, kid.
>>
>>51710231
karma will get you one day
>>
File: 1447300585968-0.png (398 KB, 1000x769) Image search: [Google]
1447300585968-0.png
398 KB, 1000x769
>>51704718
New friend here, what first language to learn would you recommend to someone with untreated diagnosed ADD (I lost my health insurance, currently moving to another state hoping Medicaid will help). Hoping to learn enough of this new language to get a job. Unfortunately I learned to type with my front and middle fingers so I'm forcing myself to type properly now, but hopefully within a year I'll have learned something that would help me get a job.
>>
>>51710161
literally retarded

he obviously meant
>your iq is lower than 100, isn't it?
>>
>>51710233
What is wrong with that?

If he doesn't care about it and doesn't even act like he does, why does it matter if he wants to do it the easiest way possible?

I literally know people who got a Computer Science degree and have a full time job as a developer and they cheated their way through school and copy/paste and pretend to work hard during their job.
>>
>>51710233
lots of people do that.
what's the difference between doing that and using a library?
>>
>>51710197
>literally smoking cigars
wow you're living the life man. at this point why don't you just retire and dedicate your life to philanthropy and fucking bitches, and smoking cigars of course
>>
>>51710245
For what? Copy pasting public code isn't illegal.

What is wrong with using the easiest method possible to achieve a needed goal?

If I need a script to parse some files why do I have to manually write it when I just can copy it and modify it to my needs?
>>
>>51710266
NEETs don't understand.

They have severe autism so the only achievement in their pitiful life is knowing they spent weeks doing something the hard way when you could've used a library and asked someone for help and do it in a few hours then relax the rest of the time, or focus on something else.
>>
>>51710273
>Copy pasting public code isn't illegal
Sometimes ;)
>>
Absolutely nothing wrong with copying and pasting code if you understand it.
>>
>>51710287
not everyone is a wage slave who only works on doing trivial shit that has already been solved. you're probably too stupid to even realize how sad you are for bragging about being a mediocre code monkey
>>
>>51710299
Especially if your job isn't being a developer or a computer science enthusiast.

if you just need something "to werk", who the fuck cares?
>>
>>51710299
in fact, I'd say it's practically impossible to do that without understanding it, at least a bit. in all cases, you have to understand the concepts to make something that actually works.
>>
hey guys. i have an awsum idea for a game. i just need a coder to help me make it. i'll even offer u 50% of any profits. any takers? :)
>>
>>51710287
>Seriously thinking copy and pasting code will work
>>
>>51710314
>not everyone is a wage slave who only works on doing trivial shit that has already been solved

Ok then what is your "highly-esteemed" job?

I'm willing to bet you make under $80k/yr and more likely you're unemployed or a student.
>>
>>51710332
Senior Java monkeys make like 120k m8
>>
>>51710322
sent ;)
Thread replies: 255
Thread images: 21

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.