[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: 319
Thread images: 38

File: 1494081413904.jpg (2MB, 1920x3272px) Image search: [Google]
1494081413904.jpg
2MB, 1920x3272px
Dlang-can is dead edition
old thread: >>60651640

What are you working on /g/?
>>
>Posting before the bump limit
Delete this shit, you stupid fuck.
>>
>>60658226
gotta collect all that reddit karma senpai
>>
learning rust even though it is inferior to Haskell
>>
>>60658226
fuck off I was one post before the bump limit
>>
>>60658304
posting AT the bump limit is also wrong, you must post the new thread AFTER the bump limit, i.e. 311 or later
>>
>>60658313
not OP but you are pathetic kek, get a job stob worrying about what a good boy you are on /g/
>>
>>60658204
Wish I was programming.

Nothing but SQL for me lately. It's fine enough, I guess.
>>
>>60658304
That doesn't matter. It was before the bump limit, so the thread is invalid and should be deleted.
This sort of retarded attitude leads to thread wars.
"It was just 3 posts early". "I don't like the image the OPs have been using, so I'll post 10 posts early to make sure I beat him". "Well, I'll post 20 posts early".
I'm not just making shit up; this has happened many, many times before.
Ideally, you would actually let the old thread fall down the board a lot further as well. Posting quickly just truncates discussion.
>>
>>60658328
> >having rules

let me guess
it's 2016?
>>
>>60658340
>and should be deleted
this is just silly fetishisation
yes OP made a mistake but there's no reason to make a new thread right now, it's not like he was 20 posts early
>>
>>60658352
Janitors have been known to delete threads posted at 309, if they actually get off their ass.
The thread is invalid. Get rid of it.
>>
>>60658362
well the old thread is at 313 now, so that's that. To all of you who are not busy with crippling autism, what are some resources for best practices in setting up a large project in C?
>>
>>60658362
Stop crying and concede to the better interests of the daily.
You can post the picture you wanted to use in this thread.
>>
I'm a self-taught dev going onto 6 years of experience now. I've read that math isn't that important for programming, but I feel like that advice is only for code monkeys or front end "developers". I've been wanting to get into more advanced topics like compilers, game engines, algorithms, and coding exercises (like /r/dailyprogramming), but I just feel crippled because I lack a solid math background.

Has the internet lied to me? Math is important?
>>
>>60658385
>well the old thread is at 313 now, so that's that.
That doesn't mean shit. If you allow pre bump-limit posting, it sets a precedent that leads to thread wars.
If you weren't such a massive newfag, you would know about them.

>>60658397
I don't give a shit about the image. The one OP posted is fine.
I only take objection to the image if will have an effect on the quality of the thread (e.g. /pol/shit, redditshit, traps)
>>
>>60658420
bump, also interested in this. I am currently a golang developer myself but I consider it a pleb language and want to move on
>>
>>60658420
>Math is important?
No shit
>>
>>60658420
It's not important if you "program" web pages and CRUDs, but it's important for actual programming.
>>
>>60658420
of course math is important anon, especially for many algorithms. But it's less about actual math and more about thinking mathmatically (i.e. logically) about the problems you are trying to solve. luckily there are many resources online to learn, khan academy is the first one that comes to mind. But to be clear, any real programming does require a solid math foundation.

>>60658433
please hush sweetie we're talking about programming now
>>
>>60658420
Math isn't important unless you're applying your programming to something that needs math.

A "code monkey" is someone who only programs.

The key to becoming a good programmer is to use programming to accomplish tasks related to a greater discipline, such as physics simulations or financial analysis. If the discipline needs a certain subset of math, then you need to know that subset of math.

You don't need to just generally "be good at math".
>>
>>60658436
>>60658438
>>60658443
>>60658453
>>60658455

Well, I'm a professional gameplay programmer so I've had to teach myself just basic things like vector arithmetic, but I've gotten to a point where it's not as fulfilling or challenging anymore, and now I want to tackle more advanced programming, like game engines and compilers. But for both of those, algorithms are important if I want to make something that doesn't suck ass. I just started this book last night, in the hopes that I can at least become more proficient in math and then be able to do something like Knuth's Concrete Mathematics;

http://a.co/ghq7tWS

I did Khan Academy but it feels like I'm moving too slow. Keep in mind that I didn't graduate college and was doing liberal arts, so my math background is pretty weak. I need baby's first math to start out.
>>
>>60658521
> I need baby's first math to start out.
I really think this should be in the OP posts: https://courses.csail.mit.edu/6.042/spring17/mcs.pdf
>>
>>60658565
No. Shut up.
>>
File: 19169920.jpg (26KB, 318x413px) Image search: [Google]
19169920.jpg
26KB, 318x413px
a lot of good books here
https://github.com/miloyip/game-programmer
>>
Uni fag studying comp sci here. I recently took a class on building an interpreter for javascript using Scala. It was my first exposure to Scala and I really liked it. I decided that I would teach my self scala over the summer and go through 99scala problems and try and finish them all.

Is it worth it to learn Scala/functional programming or is it just a meme? I was also think of trying to pick up a little bit of Haskell as well
>>
File: homework.mp4.webm (787KB, 1920x1080px) Image search: [Google]
homework.mp4.webm
787KB, 1920x1080px
>>60658204
>What are you working on /g/?
I've done homewerk. It just werks :-)
>>
>>60658565
Computer science isn't programming, though.
>>
>>60658579

That's pretty fucking useful, although I saw books on UML and Design patterns and I wanted to laugh.
>>
File: gbooks.jpg (144KB, 455x1080px) Image search: [Google]
gbooks.jpg
144KB, 455x1080px
>>60658655
Ye, there are some memes there, but most parts are pretty solid as far as I can tell. gof & uml faggotry is immortal, heh, sometimes I wonder if anyone actually read gof from cover to cover

dragon book -> https://www.cs.princeton.edu/~appel/modern/basic/ml/extract.pdf
http://gameprogrammingpatterns.com/
>>
>>60658752
>"""Design Patterns"""
List discarded.
>>
>>60658646
Pretty cool looking board, did you have to make in class? Or is it something the school had?
>>
What is pushq and movq in linux prog.s?
In Windows I would get push and move.
>>
>>60658752
>Reading more than one algorith book.
>>
>>60658818
It's a retarded (aka A&T) way of saying the operation is 64bit: https://en.wikibooks.org/wiki/X86_Assembly/GAS_Syntax#Operation_Suffixes
>>
File: reeee.png (120KB, 1365x765px) Image search: [Google]
reeee.png
120KB, 1365x765px
I've started learning C# in preparation for university starting this September, it's pretty fun.
>>
>>60658420
Rule of thumb.
>Any topic you pick and you are in doubt whether this is required or not, just learn that topic only when its immediately required.
>Never waste time on thinking that I would read in advance.
>You implementation is going to be nightmare no need to waste time reading things which are not required in near time.
>>
>>60658752
>lisp
>haskell
>c

any -best-in-their-own-tier- books about relevant and non-meme languages?
>>
File: n(o)+.jpg (4KB, 300x168px) Image search: [Google]
n(o)+.jpg
4KB, 300x168px
>>60658878
>ConsoleKeyInfo

PAAAJEEEEEET!
>>
>>60658853
anyway i can generate .s in linux without that fucking syntax?
i mean wtf it look so irritating.push(q)
>>
>>60658911
-masm=intel
>>
>>60658887
there is no "one book to rule them all" for c++, one should read everything to get good: sutter, alexandrescu, bjarne, etc. several good books here >>60658579

I don't know good c#/java/js resources though, perhaps kind anons could post a few
>>
>>60658931
Thanks.
Do you know assembly x86?
>>
>>60658981
Well, I can read it.
>>
File: Screenshot_20170530-150945.png (4MB, 1440x2560px) Image search: [Google]
Screenshot_20170530-150945.png
4MB, 1440x2560px
>>60658908
No need to get upset anon, i'm white.
>>
>>60659006
What girly hands you have, anon.
>>
>>60659048
well, he's using a mac after all. what did you expect?
>>
>>60659048
I wouldn't hire a programmer with manly, redneck hands desu. It suggests that he spends his time on various irrelevant activities instead of programming and reading
>>
>>60658204
Rewriting a couple ZNC modules in C++ because modperl is broken in mysterious ways.
>>
>>60659006

did the poo in loos force you to be a .net c# programmer?
>>
>>60659217
That's a HP 2560p anon.
>>
>>60659221

kys, tranny
>>
>>60659238
fair enough. HP is also gay though so my point still holds
>>
>>60659228
Nope, Some american lecturer who I met at the open day to my uni.
>>
>>60658787
yeah in first semester we had to solder that shit. Now in third semester we programm a little with it.
The prof is basically doing it """only""" to explain how the architecture werks n some really really basic assembler shit
>>
>>60658878
use
char.IsDigit()
or
int.TryParse()
, faggot
>>
>>60659309
Learn Lisp.
>>
>>60659417
Yeah, we had a whole "microprocessor" course dedicated to register interaction and assembly. Only 20% was actually C programming. We were not lucky enough to build our own board though, we just used an MSP430.
>>
someone redpill me on pointers

so the "point" of them is to just use less memory?
instead of having a program that uses 5 variables that each have their own address in memory, you can have just 1 as long as you correctly point to that address while changing the variables content?
>>
>>60659497
Why don't you read a book or wiki first?
>>
>>60659497

what kind of programming background do you come from senpai
>>
>>60659507

i did but they give you an in depth technical aspect of it, i want a street talk version, am i understanding it correctly or not?

>>60659564

ive been programming for a year in js, lua, python, and php. Never used pointers before
>>
Writing a job posting website in Wordpress and Angular.js, it's fun :3
>>
>>60659579

Have you ever used references in PHP? It's the closes comparison I can think of out of those languages.
>>
>>60659497
No. They're just addresses.
>>
>>60658878
I will now instruct you on how to pass OOP 101 to 401 using C#

Step 1. Learn what an object is - attributes and methods

Step 2.

foreach (var eachObject in listOfObjects) 
{
doSomethingOnEachObject(eachObject);
}


Now you have a Bachelors degree in computer science. Grats
>>
>>60659735

>foreach
>not map
>>
>>60659749
map if for FP course.
>>
File: 1495524357472.gif (1MB, 303x307px) Image search: [Google]
1495524357472.gif
1MB, 303x307px
i will be fired next month so i will probably have the summer free

what are some ideas i can make over the summer that will make me rich enough to not have to cuck for wage anymore?
i do C, C++, Ada, VHDL, Matlab, R, and Lua
>>
>>60659769
Learn how to use a game engine and shit games out on steam
>>
>>60659790
Its easier said than done senpai
>>
>>60659790
>being a gaymen
any other ideas? i can literally not do design a thing
>>
what's a good c++ textbook to self-teach with for a reasonable price on amazon?
>>
>>60659827
>Buying books
>>
>>60659823
Register an LLC and hire pajeet to do your programming for you
>>
>>60659769
Start taking hormones, buy knee-high socks and cute dresses. By the end of the summer, you'll be able to find yourself some sugar daddy if you're cute enough.
>>
If system calls if for linux, Is win32 api is for windows?
or glibc == win32
>>
>>60659858
programming isnt the issue i think, visuals, gaym idea, world-design, characters, music and whatever other resources are needed is
>>
>>60659923
I meant in general instead of games.
>>
>>60659923
>visuals
>game idea
>world design
>characters
>music
You know you are girly and sjw lord.
>>
>>60659895
> Is win32 api is for windows?
No, NT kernel has a separate native API - https://en.wikipedia.org/wiki/Native_API , Win32 API is implemented by user32.dll and friends.
> or glibc == win32
Yeah, sort of.
>>
>>60659943
fuck off nigger

>>60659937
right
>>
>>60659827
Textbooks are not reasonably priced in my opinion.
I was taught using a book called "modern c++ development" which was fine, but learning C++ is not something I would spend too much time on.
I would start by reading the tutorial (http://www.cplusplus.com/doc/)
And then read documentation from the libraries that is relevant to your interests.
>>
Anyone got that png with random projects scaling from easy to hard ?
Very bored.
>>
>>60660044
Project 1: P vs NP
Project 2: solve the halting problem
Project 3: the HURD
Project 4: strong AI
>>
>>60660034
I need a structured approach to learning things, where a concept is introduced and then example programs are given, etc.

That's how I learned Python, more or less, but I haven't used it in a few years.
>>
>>60660034
>>60660122
disregard, this document looks like the perfect thing.

thanks.
>>
>>60660122
>a concept is introduced and then example programs are given
this is literally every book on programming, ever
>>
I wanna program shit but I dunno what to do.
I was thinking of doing free lance work for Linux users (when Gentoo finally let's me mount a new hard drive) for small cash, custom jobs or whatever the correct terminology is.
Thing is I don't know the language that Linux works in and I don't know where to learn it.
I do know C++, but even my noob ass its aware of bloating.
>>
>>60660177

you mean bash scripts and shit?
>>
>>60660199
Yes that thing
Again, new to this shit
But I would be happy just writing small custom software for people
Unless that's not really a thing
>>
>>60660216
It's not, really
Unless you want to make websites
>>
>>60660216

you can write C and C++ on Linux, nothing's stopping you from doing that if you want to make proper software rather than skiddie scripts.
>>
>>60660262
Skiddie scripts?
>>
>>60660398

Do you want to write actual software or do you just want to write shell scripts that automate the work you do in the terminal?
>>
>>60660216
You can get a job in bash scripting but you're not gonna be writing software, you're gonna be fixing people's broken and/or uncooperative computers.

Do you have grub (the menu that lets you pick a version of Linux to boot)? If so, try this to be thrown by necessity into a pretty good intro to bash scripting:
>arrowkey to the kernel you want to boot
>instead of pressing enter, press E
>in the text file that pops up, navigate to the line that says something like "ro quiet splash" at the end and change only that part to "ro 3"
>press F10 to start

If all goes well, you should start up with a full-screen terminal and no desktop environment. This is the perfect setup to learn your way around bash.

Some basic commands:
>help: list basic commands
>man __: view a built-in manual page on command __
>pwd: show absolute path of current directory
>ls: list files in current directory
>cd __: go to directory __
>cat __: display contents of file __
>cat > __: start writing into file __ (press ctrl+d to finish writing)
>less __: display contents of file __ in a scrollable buffer
>__ | __: run command __ and pipe its output into __'s input (e.g. "help | less" would run command "help," pipe its output into "less," and thereby give you a list of basic commands in a scrollable buffer)
>sudo __: enter your password to run command __ with administrative privileges (but only if you're an admin account)
>su: enter root password to get a shell with administrative privileges
>su __: enter __'s password to get a shell with his or her privileges
>sudo su: enter your password to get a shell with administrative privileges (but only if you're an admin account)
>sudo su __: enter your password to get a shell with __'s privileges (but only if you're an admin account)
>exit: terminate the current shell and return to the previous, or to the login screen if invoked at top level
>ctrl+c: cancel a currently running command
>ctrl+d: terminate an input stream
>>
File: 1496031237799.jpg (101KB, 500x634px) Image search: [Google]
1496031237799.jpg
101KB, 500x634px
Which is worse?
Ricing vim or ricing tmux to achieve the same effect?
>>
>>60660580
>cat > __
>what is the best text editor and why is it cat
>mfw
>>
What's the most useful program you have ever written? How long did it take you? What language is it in?
>>
File: Screenshot_1.png (223KB, 306x308px) Image search: [Google]
Screenshot_1.png
223KB, 306x308px
hello friends, how can I learn fpga programming?
>>
>>60660884
(loop (print (eval (read))))

Guess.
>>
>>60658204
So I am already familiar with C/C++ and want to learn SQL so I can further my path of wagecuckery. What's the best learning route to take?
>>
>>60660961

You made nothing useful then.
>>
>>60661049
>implement repl for a language
>not useful
Pajeet...
>>
>>60658204
Skipped work today to make a website for my rich relative, webdev is horrible. Want to kill myself, want back to my comfy office, my workmates and C++. At least pay is nice
>>
>>60661034
just like make a crud shit to learn basic ropes and go from there
>>
>>60660884
I wrote a formally-proven FizzBuzz implementation recently.
>>
File: 1494857174746.gif (2MB, 500x500px) Image search: [Google]
1494857174746.gif
2MB, 500x500px
>>60658204
hello /g/entleman, I had posted this in the last thread and made some improvements based on the advice of anons there. I wrote an image scraper for 4chan in C, if anyone more experienced than myself would look over my code and point out the terrible mistakes I've made i'd appreciate it. Also feel free to use it if you wish
>>
>>60661433
god damn it I did the same thing last thread too

https://github.com/Ethan-ks/fsic
>>
Can someone post the C vs C++ brains troll picture? I can't find it anymore.
>>
File: 1493338346104.jpg (96KB, 960x720px) Image search: [Google]
1493338346104.jpg
96KB, 960x720px
What should I be expected to be able to do entering an entry level job doing either C/C++ or Java? I want to be prepared but I don't know what to try and do after getting the advanced learning material done.
>>
>>60660948
You don't unless you get a job in the field. Otherwise you're just going to be doing basic shit an arduino or raspberry pi could do for cheaper and less effort.
>>
I want to get started in meme autonomous vehicle.
Do you know how many frame per second the usual companies / labs achieve?

I am using an nvidia Jetson tx1 and I might get 5fps if I git gud in optimizing my stuff.

I'm using 480p images so I might be better off using tiny pictures but at a faster rate.
>>
File: mr gurns.jpg (65KB, 660x960px) Image search: [Google]
mr gurns.jpg
65KB, 660x960px
I'm retarded, didn't realize the last thread was kill

Does anyone use amphetamines (adderall) specifically for programming purposes?

I'm prescribed it and honestly hate the stuff after a long time of taking it, but whenever I had an assignment for a CS class I lost myself in the code and that's the only time I've felt completely in the zone with it. Any tipz for using drugs in your development sessionS??
>>
File: 1495716237748.jpg (286KB, 1834x1200px) Image search: [Google]
1495716237748.jpg
286KB, 1834x1200px
>>60661449
only have dis one

>>60661468
count smaller elements in array on the right side of a given element, on the whiteboard right now and get a job! that's what I was tasked with anyway
>>
>>60661565
Don't do this for any serious project, look up delusions of grandeur. You're going to make mistakes and believe they aren't mistakes, your code will be spaghetti the next day.
>>
>>60661511
This.

On that subject though, does anyone have any advice or experience in that field? I love combining hardware & software and have an interview for an FPGA design type job for laboratory equipment pretty soon.
>>
>>60661574
Thanks man it's the one I was looking for
>>
You in here, hooktube-anon?
Would you mind putting your code up on github or another git host to satisfy my autism? I may run my own instance.
>>
>>60661034
>host WWI in Azure for free
>play with it
>????
>PROFIT!

https://github.com/Microsoft/sql-server-samples/releases/tag/wide-world-importers-v1.0
>>
>>60661449
>>60661574

This is fucking stupid. C can do half of this shit, and the other half is functional programming buzzwords that C++ can't do well.
>>
>>60662079
lmao @ your opinion

Being able to roll your own janky implementation does not mean it's "in C".
>>
In c++:

I have a pointer to a class and one of it's fields is a vector. If I delete the class, does the vector free what ever space it used? Similarly, if I made a vector in a body of a function, after the functions ends and the vector is removed from the stack, is the vectors destructor called and its contents freed?
>>
>>60662144

The destructor of the vector is automatically called when your object is deleted, and the vector's destructor cleans up that space.
Same thing with a stack object.
This is scope-based lifetime and it's very important to RAII
>>
>>60658579
>https://github.com/miloyip/game-programmer
>From Windows/DirectX - Unreal - Unity
And then recommends Android NDK, why? Why not to recommend OpenGL and then OpenGL ES for Android (it just takes a code revision, not rewriting your whole program from TrashX to OpenGL ES >2.
inb4 DirectX is easier than OpenGL. I learnt OpenGL first, now DirectX looks like dog shit for me (capslock, OOP interface).
>>
>>60662161
I think I heard somewhere that when the default destructor is called it in turn calls the default destructor of every field. But, what if I use a destructor I defined? Do I have to manually call a destructor for the vector then?
>>
https://pastebin.com/3WMazQZn

I am on suicide watch from this code.
I know even if it works I'll have no idea how I've made it work by tomorrow.
>>
>>60662161
What about local variables in functions? Do they perpetually exist and get reset every function call?
>>
>>60662248

It's automatically done for you. The circumstances for explicitly calling a destructor are completely rare.

>>60662282

I'm not sure I fully understand this function.
>>
>>60662308

*question
>>
So, I'm looking for an easy way in .net to output an html page in text format AFTER javascript has changed it after loading, such that it includes any information not displayed before javascript loaded.

How the fuck do you do this in .net? It seems like it would be the simplest thing in the world.

>just use the x scraper framework
No fuck off, I'm not doing any advanced scraping that requires loading every javascript on a page. I'm just looking to read whatever loads by default on 1 page. Surely this is easy to do right?
>>
>>60662337

you have to actually execute the javascript
>>
>>60662308
You have a function with a local variable.
You call that function, it executes, then outputs and it's done.
Did it create a variable that needs to now be garbage collected, or is there a perpetual space in memory for that local variable?
>>
>>60662282
I think that they get made anew every time. Local variables are basically some reserved spots on the stack when the function is called. But since the stack gets cleared all the way up to the caller function there is no trace left of old variables.
>>
>>60662355
google "stack and heap"
>>
File: Untitled.png (13KB, 802x191px) Image search: [Google]
Untitled.png
13KB, 802x191px
>>60662353
Surely the navigate function here executes the javascript, right? So then how do I get the full page in text format?
>>
>>60662355
It depends if you are thinking about a dynamic variable somewhere on the heap or a static one. In the first case if you don't free up the memory, then the pointer is lost and you got a leak, if its a static variable it's all ok since completely gone after the function returns.
>>
>>60662355

Each time you call a function, all its local variables are created in its stack frame.
When the stack unwinds and you return from that function, all the local variables are destructed as necessary.

That's why you can't do this.
int* myFunction()
{
int foo;
return &foo;
}

foo lives as long as myFunction does. When myFunction dies, so does foo. What remains is a pointer to somewhere invalid that you can potentially do a lot of damage through.
>>
>>60662337
>>60662409
Just pass the thing and scrape, moron.

    var divs = scraper.Document.GetElementsByTagName("div");

foreach (HtmlElement div in divs)
{
// suck a dude's dick
}
>>
>>60662308
One more thing. So the vector does it all by itself, but what if a field is a pointer to something in dynamic memory? Do I need to free it manually now when I want to destroy the class containing it?
>>
>>60662079
Chill bro I merely asked because I find it funny. The main languages I use are C, C++ and OCaml.
>>
>>60662450
What exactly is it doing here? Is it still interacting with the website, or is it just going through elements in the loaded page? If the latter, why can't I just grab and get the entire page as a string?
>>
>>60662402
Where can I read about this? I don't remember it from SICP.
>>
>>60662509
It's the latter, and you can.
>>
>>60662460

Raw pointers have no destructor, so forgetting to delete one explicitly results in a leak.
void myFunction()
{
int ptr = new int;
...
// forgot to delete!
}
// I just leaked memory.


This is why modern C++ discourages creation of memory with new. You should use smart pointers instead, and manage the lifetime of your objects using scope.

For example, if you know for a fact that an object only needs to live as long as one particular function, you can declare it as a stack variable and hand out pointers or references to it.
void outerFunction()
{
int myInt;
innerFunction(someInt);
}

void innerFunction(int* someInt)
{
someInt++;

// Because someInt is a raw pointer, it isn't deleted upon leaving the function.
// Trying to delete a stack object is invalid, anyway.
}



If you need to be able to transfer ownership from one scope to another, you can use unique_ptr.

void newOwner()
{
unique_ptr<int> ptr = oldOwner();
...
// Assuming the ownership of the pointer hasn't changed, it gets deleted here.
}

unique_ptr<int> oldOwner()
{
unique_ptr<int> ptr = make_unique<int>();
...
return ptr;
// The pointer has a new owner, so it doesn't get deleted here.
}


In rare circumstances shared_ptr is useful too, but it's an edge case. Stack objects and unique_ptr is enough for most things.
>>
>>60662511
Not exactly general, but it does explain the difference: https://doc.rust-lang.org/book/the-stack-and-the-heap.html
>>
>>60662628

I fucked up slightly, the middle one should look like this.
void outerFunction()
{
int myInt;
innerFunction(&someInt);
}

void innerFunction(int* someInt)
{
(*someInt)++;

// Because someInt is a raw pointer, it isn't deleted upon leaving the function.
// Trying to delete a stack object is invalid, anyway.
}

>>
In chapel you can't do
if(x)
do_stuff();


You can only do
if(x) {
do_stuff();
}

or
if(x) then do_stuff();

Seems kind of retarded...
>>
are certificates from sites like edx worth it?
i am new to programming please be gentle
>>
>>60662732
get scammed scrub
>>
>>60662616
How exactly?
>>
>>60662628
>>60662649
Thanks. It was kinda long winded though but a good read.
>>
>>60662747
are the courses any good at least? i dont have to pay, its optional
>>
>>60662867

I suggest you go read about RAII. Using scope to manage lifetime is very important in good C++.
>>
>>60662894
But what about non function scopes, like in my original question? A field in a class is a raw pointer; when I destroy the class, there is leakage if I don't manually destroy the pointer. Should I use those shared and unique pointers for that?
>>
>>60662894
He first has to have a solid grasp on static and dynamic storage. RAII is very much based on these concepts and stack unwinding.
>>
>>60662628
shared_ptr is often very useful.
A good example is for a breadth first algorithm.
Here you have two lists (usually heaps when A*) of states and you want to transfer states between the lists, so pointers are usually preferred.
Some times you optimize it further by using a hash table to make sure you are only checking unique solutions.
Whatever the case, having more references to the same state is not some weird edge case.
>>
>>60662642
arigato
>>
>>60662963

If the field is a raw pointer, you define a destructor on the class containing it that handles freeing the pointer.
>>
>>60660761
tmux ricing and vim ricing is something only webdev numale cucks do
>>
>>60662783
>>60662616
So, I made it work by just waiting for a bit to let the javascript run. Is there an event handler that activates when all the javascript has completed?
>>
>>60662708
k tard
https://www.imperialviolet.org/2014/02/22/applebug.html
>>
>>60662963

An object has a scope of its own, and when that scope is destroyed everything within it is destructed accordingly.

What kind of handle you have on a field depends entirely on the responsibility that class has over that field.
>I own this thing, when I die it dies.
Raw object.
>I own this thing, when I die it dies. However, I may want to let somebody else take care of it instead.
unique_ptr to object.
>Me and a bunch of friends own this thing. When the last of us discards the pointer to it, it must die.
shared_ptr to object.
>I don't need to worry about whether this thing lives or dies - that's somebody else's problem.
Raw pointer to object.
>>
>>60663105
>>60662708
It should have been at least be possible to do
if x {
do_stuff();
}
>>
>>60663105
lol apple """programmers"""
>>
>>60663142
yes apple programmers, mac os x is the current state of art interactive operating system.
>>
>>60663138
"no"
>>
File: dlang_chan.jpg (139KB, 470x545px) Image search: [Google]
dlang_chan.jpg
139KB, 470x545px
Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); she's super duper cute; and she's a blast to write in! Say something nice about her, /dpt/!

>Features
https://dlang.org/comparison.html
>Standard library
https://dlang.org/phobos/index.html
>GC
https://dlang.org/spec/garbage.html
https://dlang.org/blog/2017/03/20/dont-fear-the-reaper/
https://dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
>Books
https://wiki.dlang.org/Books
>>
>>60663349
you should also include the package manager

https://code.dlang.org/

>>60663349
>to have her GC tumor removed (eventually)
yeah, never.
>>
Recent graduate in a non tech field (Only way to stay living at home was to follow in the footsteps of the family)

But I want to work in a tech/computer field; what do I do to get into this field?
>Basic C++, Vb.net (lol), python

I also built my own computer and while to some normies that's amazing and so knowledgeable I understand that's below basic to actual DPT/G users.
>>
>>60663454
>you should also include the package manager
Good idea.
>yeah, never.
I believe it will happen. With that said, the effects of dlang-chan's GC are overstated.
>>
>>60663170
No, it's deprecated. GNU/Linux is better.
>>
>>60663478
Learn Lisp.
>>
File: 1470341172739.jpg (45KB, 333x333px) Image search: [Google]
1470341172739.jpg
45KB, 333x333px
>tfw getting payed to write a compiler in Ada
Who else living the dream?
>>
>>60658420
>I've read that math isn't that important for programming
>>
>>60663603
>write compiler in Ada
But why? You don't need reliability from a compiler, and other languages are way better suited for the task.
>>
>>60663637
Like what languages?
All the good ones are still made in C or sepples.
>>
>>60663637
I'm not writing it in Python so there really isn't
>>
Just finished a C++ course so think I'm good with the basics. What projects should I tackle this summer?
>>
>>60663698
>>60663713
ML-family languages are perfect for compilers. In fact, any language with ADT and pattern matching, because ADT is ideal for AST. Then you have LLVM/Clang which is written in C++ and export all of its components as libraries so you can quickly create your own compiler with state-of-art codegen and optimization for all the architectures out there. This is why Swift compiler is written in C++.
>All the good ones are still made in C
Which compilers are written in C tho? GCC migrated to C++ like 5 years ago or so.
>>
>>60663713
Don't advocate the usage of Python, even jokingly. Don't even mention the name Python ever again.
>>
>>60663827
Python is better than C or C++ for quick stuff.
>>
>>60663891
>Python is better than C or C++ for quick stuff.
>>
>>60663891
Quick is the last word that comes to mind when I think Python.
>>
>>60663910

He's right you know.
>>
>>60663910
>>60663929
i think he meant quick as in quickly throw parts together and show a prototype to your bosses
>>
>>60662460
You can do this:

#include <vector>
#include <memory>

struct Foo {
int val;
Foo(int i) : val(i) {}
};

int main() {
auto v = std::vector<std::unique_ptr<Foo>>();
v.emplace_back(std::make_unique<Foo>(3));
return 0;
}


And let your scope take care of freeing your vector of dynamic objects.
>>
>>60663939
- Global Interpreter Lock (GIL) is a significant barrier to concurrency. Due to signaling with a CPU-bound thread, it can cause a slowdown even on single processor. Reason for employing GIL in Python is to easy the integration of C/C++ libraries. Additionally, CPython interpreter code is not thread-safe, so the only way other threads can do useful work is if they are in some C/C++ routine, which must be thread-safe.
- Python (like most other scripting languages) does not require variables to be declared, as (let (x 123) ...) in Lisp or int x = 123 in C/C++. This means that Python can't even detect a trivial typo - it will produce a program, which will continue working for hours until it reaches the typo - THEN go boom and you lost all unsaved data. Local and global scopes are unintuitive. Having variables leak after a for-loop can definitely be confusing. Worse, binding of loop indices can be very confusing; e.g. "for a in list: result.append(lambda: fcn(a))" probably won't do what you think it would. Why nonlocal/global/auto-local scope nonsense?
- Python indulges messy horizontal code (> 80 chars per line), where in Lisp one would use "let" to break computaion into manageable pieces. Get used to things like self.convertId([(name, uidutil.getId(obj)) for name, obj in container.items() if IContainer.isInstance(obj)])
- Crippled support for functional programming. Python's lambda is limited to a single expression and doesn't allow conditionals. Python makes a distinction between expressions and statements, and does not automatically return the last expressions, thus crippling lambdas even more. Assignments are not expressions. Most useful high-order functions were deprecated in Python 3.0 and have to be imported from functools. No continuations or even tail call optimization: "I don't like reading code that was written by someone trying to use tail recursion." --Guido
>>
>>60663910
>>60663929
I mean quick as in simple, trivial programs, not high performance stuff.
>>
>>60663819
>Learn an entirely different way of programming to do one task
>>
File: b1fadc989b89af953afca7a7763cb40a.jpg (223KB, 1041x1473px) Image search: [Google]
b1fadc989b89af953afca7a7763cb40a.jpg
223KB, 1041x1473px
>>60663772
Socket programming. I find it really fun.
>>
>>60664115
>b-but learning new things is hard!
This is exactly how we get node.js and electron.
>>
>>60664317
>Hard
Nice projecting, I said it was a waste of time.
>>
>>60664410
Where did you say this, brainlet?
>>
>>60664422
I implied it with the words "one task". You should interact with people more.
>>
>>60660948
>hello friends, how can I learn fpga programming?
Try a cypress psoc
>>
>>60663565
>Lisp.
Any particular reason over the newer variants like ruby/python/rust?
>>
>>60664480
He's memeing, Lisp is long dead.
>>
>>60664480
Love of parentheses. If parens make you want to cream your pants, Lisp is the language for you.
>>
this isnt a programming question onto itself and more of a software design question

i have two classes:
one that reads data from a webpage, parses it and outputs objects
another that interacts with said webpage (pressing buttons, changing the state of the webpage), there are no outputs

these two classes have very different uses, but they're implemented in the same way - a http request, html parsing and css selectors

im pretty sure they belong to different layers, but do they? should i just merge them and try to handle my autism?
>>
>>60664622
>>>/g/wdg
>>
>>60664636
you've got to be shitting me dude
once something merely reads an html document it becomes web development?
>>
>>60664678
He's just shitposting; your post is on topic.
>>
>>60664509
Then what do senpai?
>>
>>60664901
Learn Lisp.
>>
>>60664901
Visit your local employment site, see which technologies are in demand, learn them, apply for a job.
>>
>>60664979
Ya, make sure to wear your striped thigh-highs too. The interviewer really appreciated them when I sucked her cock.
>>
File: images.jpg (7KB, 268x188px) Image search: [Google]
images.jpg
7KB, 268x188px
Do you program or do you code?
>>
So
>Actual, unsarcastically battle-tested programming languages list:
>C
>C++
>Java
>PHP

Am I getting this right?
>>
>>60665030
cringe.

kys
>>
>>60659735
>doSomethingForEachObject(eachObject)
>not eachObject.doSomething()
(You) have not mastered indian programming friendo
>>
>>60665171
+ JavaScript
>>
>>60665171

PHP is horiffically broken.
>>
>>60665171
Are these languages web-scale?
>>
Currently working on machine learning, testing and implementing some feature selection algorithms to predict the type of protein-protein interaction in low time
>>
I tried to take foldl from haskell and implement it in Java
this is what I've got so far, is there any room for improvement?
    public static <T, R> Function<Function<T, Function<R, T>>, Function<T, Function<List<R>, T>>> foldl() {    
return fun -> acc -> list -> {
T acc2 = acc;
for (R r : list) {
acc2 = fun.apply(acc2).apply(r);
}
return acc2;
};
}
>>
So what do I do after i've learned a fair bit of c++ to make myself more marketable?
>>
>>60665653
Improve your blowjob skills.
That or contribute to something significant.
>>
>>60658204

Want something to do? of course you do

why not use the random data that the library of congress shits out from time to time for something?

http://www.loc.gov/cds/products/marcDist.php
>>
File: 1464143124471.jpg (1MB, 1412x1200px) Image search: [Google]
1464143124471.jpg
1MB, 1412x1200px
>>60665171
>""""battle""""
>>
> be a fucking faggot bitch
> call bytes ""octets""
> kill myself
>>
File: 1200px-Blank_whiteboard.jpg (62KB, 1200x900px) Image search: [Google]
1200px-Blank_whiteboard.jpg
62KB, 1200x900px
*appears out of nowhere*

Your move?
>>
>>60665665
>>60665665
Then how are people supposed to enter the field?
>>
>>60665856
whiteboards are elitist
>>
>>60665856
>inverts a binary tree
>>
>>60665886
Portfolio my dude, the only thing we ask when hiring
>"Tell me about literally every program you ever wrote in your whole life"

Oh, and then draw red black trees on a >>60665856 but that happens if our pretentious cs fag is present
>>
>>60665856
>import btree
>>
>>60665913
>invert a binary tree
>inverts the whiteboard upside down
>>
>>60665918
So just custom write some examples of my skill sets and then insert them into a portfolio as part of my resume and submit it?

I figured i'd need more than c++ skills but ok b0ss.
>>
>>60665856
*sums all primes under 20*
Heh, nothing personnel, kid.
>>
File: 1488201956179.jpg (195KB, 2048x1536px) Image search: [Google]
1488201956179.jpg
195KB, 2048x1536px
>>60665944
A good package for someone without job experience at least for us is
- three or so "medium"-sized different enough projects done in C++ from scratch
- preferably algorithm heavy (graph algorithms library, a game with cool shit, rich text editor: pick your poison), last one I saw was neat noise generation library
- popular github repo is an obvious plus, one of our bosses has a hardon for that
- social ineptitude is a big nono here, you absolutely must be able to communicate with human beings
>>
>>60666109
>- social ineptitude is a big nono here, you absolutely must be able to communicate with human beings
I can communicate fine as long as it's work-related, I'm hopeless at small talk and knowing what to say when someone is having a baby etc.

pls no bully
>>
>>60666146
Maximus Autisto thinks he has communication skills, the post
>>
>>60666194
I said pls no bully
>>
File: time-for-g.jpg (2MB, 1700x2470px) Image search: [Google]
time-for-g.jpg
2MB, 1700x2470px
>>60665226
>being gay
HAHAHA what a fag!
>>
>>60666232
what the fuck man
>>
>>60666146
I'm the same way. The moment we stop talking about work, my mind goes blank.
>did you hear about x
>so I just bought x
>my kids blah blah
Someone just kill me please.
>>
File: trap-programming.png (1MB, 1127x1600px) Image search: [Google]
trap-programming.png
1MB, 1127x1600px
>>60666250
>>
>>60666284
ikr, those things just don't interest me, and why would they?
>>
>>60666146
>I can communicate fine as long as it's work-related
It's fine, that's what I meant - teamplay. We get decent programmers from time to time who quite literally can't talk, can't voice their opinion or concern, can't ask questions (habit which is vital for a junior) and it always leads to clusterfucks.
>>
>>60666284
go for a drink with your mates someday?
>>
>>60666374
>mates
Why did you have to remind me that I have none?
>>
>>60666387
I mean from your team, colleagues. Get some shots, talk about stupid shit. It's good sometimes for a dev I'd argue
>>
>>60666109
What industry?
>>
>>60666355
>and why would they?
Well that's exactly it. Small talk is to stave away normalfags' boredom, and filter out the undesirables. And that's fine: I just want to do my own thing and be left alone.

>>60666374
The closest thing I have to mates are anons across imageboards.
>>
File: snek.jpg (137KB, 873x1170px) Image search: [Google]
snek.jpg
137KB, 873x1170px
love python so much. i want to snuggle this snake, it's so comfy!
>>
>>60666443
That's not a python, these are pythons
>>
>Mathematics
f∈(a→a)→(a→a)

>Haskell
f::(Int->Int)->(Int->Int)

>C++
(int(*)(int)(*f))(int(*)(int))
>>
>>60666232
>>60666333
Fuck /dpt/ actually makes me want to program in thigh-highs.


So /dpt/ what should I program (in thigh highs)?
>>
File: FG3ACB1HJ6010K4.MEDIUM.jpg (10KB, 300x391px) Image search: [Google]
FG3ACB1HJ6010K4.MEDIUM.jpg
10KB, 300x391px
>>60666589
>>
>>60666545
Your "C++" (It's really C) is wrong.
Come to think of it, so is your mathematics one.
>>
>>60666589
Pantyhose, dress and heels
>>
>>60666624
look again
>>
>>60666633
At what? I know the C version is wrong, and I even ran it though a compiler to test it.
For the maths one, I know there are a lot of ways to write a function, but I've never really seen anything that mixes the "element of" and the arrow".
>>
File: trap-programming-2.png (2MB, 1058x1600px) Image search: [Google]
trap-programming-2.png
2MB, 1058x1600px
>>60666589
FTP server and client.
>>
>>60666668
The guy is retarded. Also you almost got sick digits
>>
File: Screenshot_20170507-102528.jpg (374KB, 1280x720px) Image search: [Google]
Screenshot_20170507-102528.jpg
374KB, 1280x720px
>>60666232
>>60666333
I require more of these.
>>
>>60666545
std::function<int(int)> foo(std::function<int(int)>) 
>>
File: 1486885579752.jpg (160KB, 663x960px) Image search: [Google]
1486885579752.jpg
160KB, 663x960px
>>60666737
Post more Reimu then
>>
>>60665628
Just don't.
A foldl only exists in Haskell to mend the lack of iteration (right folds space leak because they are lazy). Use loops. It's nice to get the hang of things functionally if you come from an imperative language, but please don't do that in production.

>>60666668
Not extremely rigorous, I know, but you can consider
(a→a)→(a→a) = { f | f : (a→a)→(a→a) }
, this because
Y^X = X -> Y
.
None of this is useful by itself, this is just some of the notation I see in papers, so I guess he may be right.
>>
How difficult do you figure it would be to write a program to disable a laptop's keyboard for 30 seconds so you can clean it?
>>
File: 1448845235186.png (82KB, 191x197px) Image search: [Google]
1448845235186.png
82KB, 191x197px
>>60666835
>>
>>60666835
Just turn your laptop off, idiot.
>>
>>60666854
There HAS to be a better way. (There isn't and I'm just curious.)
>>
>>60666232
>>60666333
>>60666707
>>60666808
Threadly reminder the only time a guy with a job in programming can pleasure a girl is when he is the girl
>>
Anyone have any recommendations for an online computer science course worth a damn to employers? Don't mind paying obviously. I've done some Python in my free time but I want a qualification and some teaching of the fundamentals.
>>
File: 1438842903710.gif (3MB, 512x384px) Image search: [Google]
1438842903710.gif
3MB, 512x384px
>>60666900
Just ask your onii-chan, Sanae. That's how I got my job.
>>
>>60666835
Can't you just unload the keyboard driver, sleep 30, reload the driver?
>>
>>60666900
>an online computer science course worth a damn to employers
No such thing.
>>
>>60667065
modprobe -r usbhid
sleep 30
modprobe usbhid


Can't really test it over ssh.
>>
>>60667065
Alternatively, you could create a full screen graphics application(like vidya games) that captures all keyboard input and closes after 30 seconds.
>>
File: banner.png (37KB, 892x272px) Image search: [Google]
banner.png
37KB, 892x272px
>>60658204
Just working on my imageboard, 4kev.org
>>
I'm making small music albums library in c++ object. How I should store the albums? Tab would work ?
>>
>>60666900
>Anyone have any recommendations for an online computer science course worth a damn to employers?
yeah, go look around for an accredited university that offers online courses. enjoy
>>
>>60667546
Good point, that was a little retarded of me. Cheers.
>>
>Python was not named after the venomous deadly snake but after the British comedy group Monty Python however we're going to confuse all you fucks by making your logo a snake ayyy
>>
>>60667630
Monty Python was good though, unlike the language.
>>
>>60667659
not an argument
>>
>>60667630
Rust was named after the type of fungus, but people make projects named after things relating to the chemical reaction, like Redox.
>>
>>60667796
indeed, just as python is not a language
>>
>>60667630
>Venomous
Are you 14?
>>
File: python_anime.gif (443KB, 400x480px) Image search: [Google]
python_anime.gif
443KB, 400x480px
>>60667630
Pythons aren't venomous btw. They are cute.
>>
>>60667809
>python is not a language
kys NEET faggot
>>
>>60667815
>>60667840
I-I meant to say cavernous!
>>
>>60667630
Yeah because Python is a joke rofl
>>
>>60667841
guido pls leave
>>
>>60667630
APL master race, its name is acronym for "A Programming Language"
>>
how do you mix C with python?
>>
>>60668426
You don't.
>>
>>60668426
You throw them both away and use Lisp.
>>
>>60668426
Throw python out and just write C.
>>
Do you guys have any resources on how to do a link crawler with Python? When I google it the a lot of things that are off topic appear, I just want to make a simple spider that'll check the links on a page, and check those links for more links and so on so forth, any ideas will be greatly appreciate it.
>>
How would /dpt/ generate HTML with C? Just thinking about how I'd do it makes me want to off myself
>>
>>60668810
make a tree and print it in order?
>>
>>60668810
What are you even trying to do?
>>
>>60668777
I've never written one, but I image you start at a TLD (www.website.com), request that page, and then parse the page body I'd guess using regexes to find any
[http|https]://[\code] text and store the links to parse them later?
can probably get fancy with it maybe using a thread pool to parse many pages / sub-pages in parallel.
>>
>>60668861
ha I fucked that up

you get the point though
>>
What's a Systems Developer and why is that position so in demand? I thought Web Dev was the big in demand one.
>>
>>60669050
systems dev writes backend distributed systems and services
>>
alright retards here's how to do oop correctly

1. have data records with no methods, only fields
2. have functions that take in those records and operate on them

there, oop done correctly
>>
>>60669147
What you're describing is procedural programming, not OOP.
>>
>>60669176
precisely
>>
File: file.png (172KB, 1790x843px) Image search: [Google]
file.png
172KB, 1790x843px
Still working on the tray menu.

Finished the Action Queue system, now working on rough functionality. Gonna create a combobox to add to the menu soon.
>>
>>60668861
>>60668777
To go off of what he said, you can load the web page however Python does it and run document scripts. From there if Python has libraries for it you should be able to access the DOM and regex through the HTML using

<a.*>.*</a>
>>
>>60658752
This is to small for me to read some of those names.
>>
>>60669763
>>>/g/wdg
>>
>>60669668
>parsing xml with regex

regex. Not even once.
>>
>>60669147
>>60669176
>>60669193
Wrong, methods are better than procedures. Accessing the function that operates on the record through the record is generally the superior strategy
>>
Ruby is such a comfy language. Why didn't other main stream language use ideas in Ruby, like how Ruby handles accessors and mutators?
>>
New thread:
>>60670012
>>60670012
>>60670012
>>
>>60669999
C# is fairly close to ruby's style of writing classes, with properties instead of just private data. That way for class variables you can just do

public int Count { get; set; }


instead of making accessor methods. That's why I think ruby and C# are probably the best pair for software and scripting
>>
>>60669793
I don't know if you can access the JS of the page in Python. if you could just get the return of
var _links;
document.querySelectorAll('A').forEach(function(a){_links.push(a.href)});
return _links;
>>
>>60670040
Sad thing is the IronRuby was abandoned.
>>
>>60670195
Biggest let down honestly, I found out about it shortly after they dropped it.
>>
>>60669934
Why? There is literally no advantage.
It's just syntactic fluff, and indirectly leads to things like name mangling.
>>
>>60670265
Does C# have virtual instance variables?
>>
>>60670349
You can for properties, so technically yes

public virtual Size Size
{
get { return size; }
set { size = value; }
}
>>
>>60670349

what's a virtual instance variable?
>>
>>60658453
>>60658455
So I'm no totally fucked?
I'm starting uni for CompSci later this year and taking per-calculus first semester. I'm not awful at math, just didn't take hard math courses in high school.
Thread posts: 319
Thread images: 38


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