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

What are you working on, /g/?

Old thread: >>60421332
>>
>>60428175

How do you fetch only a certain table from CURL? I wanna filter it using a class name
>>
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); and she's super duper cute and easy to prototype in! Say something nice about her, /dpt/!

>>60428190
I'd imagine you'd use curl to download the webpage into a file, and then use an html parser to get any elements or structures from the webpage.
>>
File: anal beads.png (51KB, 1209x469px) Image search: [Google]
anal beads.png
51KB, 1209x469px
>>60426901
>not abusing language features for the sole purpose of abusing language features
>>
>>60428276
Jesus christ dude, please stop

t. Actual D fag
>>
>>60428276
that's correct
>>
>>60428291
>Actual D fag
How does it feel to be mentally ill?
>>
>>60428331
How would I know, you, however, do know the answer though. How often do you go and see your therapist?
>>
>>60428345
I don't have one. Or at least I'm not aware of it.
>>
>>60428345
This is some D-tier banter right here.
>>
>>60428386
>I don't have one
Sure you don't anon,
>Or at least I'm not aware of it.
That'd make a sensible approach I suppose.
>>
What is the most pro-White language right now?
>>
>>60428431
Python
>>
>>60428431
Pure C is W&B.
>>
File: Screenshot_2017-05-02_12-10-15.png (191KB, 897x898px) Image search: [Google]
Screenshot_2017-05-02_12-10-15.png
191KB, 897x898px
>>60428175
|000000|00000|00000|0|00|0|0000000|00000|
|opcode| re1 | re2 |0|00|i| fun | re3 | integer register

|000000|00000|00000000|1|0000000|00000|
|opcode| re1 | litr |i| fun | re3 | integer literal

|000000|00000|00000|00000000000|00000|
|opcode| re1 | re2 | function | re3 | flaot

|000000|00000|00000|0000000000000000|
|opcode| re1 | re2 | displacement | memory

|000000|00000|0000000000000000000000|
|opcode| re1 | displacement | branch

Should I give the opcode two more bits?
>>
>>60428440
>>60428452
These "languages" are a disservice to White people.
>>
File: riscv.png (17KB, 603x223px) Image search: [Google]
riscv.png
17KB, 603x223px
>>60428468
64 instructions aren't enough even for RISC.
>>
File: img.jpg (88KB, 427x600px) Image search: [Google]
img.jpg
88KB, 427x600px
You have 10 seconds to explain why aren't you programming in Chapel right now?
http://chapel.cray.com/
>designed for HPC and parallelism
>does everything better than Go
>Desided that they don't want gc unlike D
>syntax way cleaner than in sepples
>>
>>60428571
White people are a disservice to White people, t b h f a m.
>>
>>60428600
I don't program in POOlangs.
>>
>>60428624
>Developed by Cray
>was funded by DARPA
nigger pls
>>
>>60428190
what i'm trying to achieve is to save contents of this table on a text file
<table class="db_view_table">
</table>
>>
Hey /dpt/, I'm searching for a programming language, which doesn't have version cancer (like perl 5/6, python 2/3, etc), which isn't dead and is enjoyable to use.
>>
>>60428431
HolyC
All the rest are for nigger cattle
>>
Fuck. Dynamic typing is just unbearable. Slows down development so much but I'm forced to use python.

How do I speed this up? Is there good tools for making python type-checked? Anything would help.
>>
>>60428689
LUA.
>>
>>60428704
>Dynamic typing
>Slows down development

I thought the whole point of it was that it's "easier" to use.
>>
>>60428624
>I don't program in POOlangs.
Just keep it to "I don't program", anything but that is incorrect
>>
>>60428575
Does risc-v use seven bit?
>>
Is Go a meme ?
>>
>>60428732
>>60428738
Java, C++, C#, Go, etc; Poo.

Learn C like a real man.
>>
>>60428737
Yes, it does, but you should really start with learning how to count by yourself.
>>
Hey guys, what is the best programming language? Please tell me so I can learn it and move on with my life.
>>
>>60428773
Rust, and I'm not even memeing. Well, maybe a little.
>>
>>60428773
Ook.
>>
>>60428728
If what you're doing is absolutely trivial in complexity you can probably handle the mental overhead and it'd be very slightly faster since you don't need to define types and such things. But Even then I feel that you're probably overestimating how much time it takes to define those types in contrast to the errors you have to catch at runtime.
For anything bigger you probably want some kind of static checking. The more the better.
Personally I don't find arguments for dynamic languages compelling. It seems to come from a misunderstanding of what statically type checked languages are like.
>>
Should I learn C and then C++, vice versa, or just C++?
>>
>>60428747
>Learn C like a real man.
>pajeet thinks C isn't a poo language
>>
>>60428431
>>60428571
Kill yourself, programming has nothing to do with race.
>>
>>60428656
help me please
>>
This pajeet meme needs to end now.
This is /g/, not /pol/.
>>
>>60428747
>>60428817
Agreed, C is a poo language.
Also Haskell and all dialects of Lisp; they are also poo languages.
>b--b--but anon if i can't use c dialects and i can't use haskell or lisp dialects then there are basically no languages left over bwuuuuh
Agreed. That's because programming is a poo hobby.
You wanna be a real man? Stop screwing around with your toys and go do something with your life that won't make you fat.
>>
>>60428835
It's a mental illness anon, please be patient
>>
>>60428773
Assembly.
You can do anything in it.
You can't really do anything in many other languages.
There's a lot of variants to learn though.
C is a good shortcut.
>>
>>60428893
oh this explains a lot
>>
>>60428874
t. pajeet
>>
>>60428874
>pajeet
That's from /int/ though.
>>
>>60428895
> Assembly.
Which ISA tho?
>>
>>60428874
Agreed. The pajeet meme is a poo language that only pajeets use.
>>
>>60428773
Haskell and Erlang
>>
>>60428948
6 G B P S
>>
>>60424293
>create new language that's binary compatible with C called "C1"
>it's literally C renamed to C1
>no regulations surrounding C1
>no ((((certification)))) and (((training))) needed!

Also this is going to happen basically forever until you ban computers because good luck stopping people from making new languages
>>
@60428874
>>>/r/india/
>>>/lgbt/
>>
ayo boys, I'm currently trying to wirte a web scraper in C, in this case tailored to grabbing images from a 4chan thread. I've done the equivilant in python with little difficulty, but obviously C is a little more complicated than just
import bs4
. I've looked into libcurl for retrieving the actual html response, but I have yet to truly understand how it works, with all the "easy_curl_*" stuff being kind of automagical. I was wondering if anyone had any experience retrieving and parsing html data in C. Incidentally, 4chan seems to detect that my C program is not a human being and just returns a "you are a robot solve this captcha" response whereas my python scraper gets to the actual html. Any ideas?
>>
Is ruby better than python?

It seems to make everything right.
>>
/g/ what is the best language no memes please

languages that are memes:
* any OOP languages -- they're for drooling brainlets who don't know what a cache is
* any FP languages -- they're for delusional nerds who think they're better than everyone else but have actually slipped too far into the nuances of software development and have been lost to the great glowy screen in the dark room and the smell of hotpockets
* any Web languages -- they're for normies who don't really program
* any languages that aren't Turing complete -- they're for script kiddies who can't even do Web """"programming""""
* any languages that are too verbose to actually use for anything (e.g. C, any dialect of assembly) -- they're for hardware nuts who build computers but don't actually know much about them beyond that
* any obscure languages -- they're for smelly autists who don't think they'll ever need a job
>>
>>60429203
Rust.
>>
>>60429203
Visual Basic 6.
>>
>>60429212
>fp
Meme
>>
About to finish 3rd year of Uni, so I'm going to jump into C++ before I finish my 5th year. Anyone know a decent book I could use?

https://www.amazon.co.uk/d/cka/Jumping-into-C-Alex-Allain/0988927802/ref=sr_1_1?ie=UTF8&qid=1494947116&sr=8-1&keywords=jumping+into+c

My friend recommended this last night and slung me an eBook version of it for free. I was reading the reviews and the fact it's not C++11 standard is kinda off putting, but he's at work and I can't ask him.
>>
>>60429212
>Rust.
OOP
>>60429233
Forgot one:
* any proprietary languages -- they're for poojeets
>>
>>60428874
>t. pajeet
>>
>>60429250
>>60429258
Rust is neither FP nor OOP you retards.
>>
>>60429265
>t. brainlet
>>
>>60429271
>Rust is neither FP nor OOP you retards.
it's OOP
>>
>>60429298
It's as much OOP as Haskell, which is not OOP at all.
>>
>>60428704
Just use prefix in your name variable. For instance str_op, float_op_faggotnes, int_total_you, etc.
>>
>>60429011
>wirte a web scraper in C
why tho

>>60429279
if comments on a south-sudanees coin collecting website hurt your feelings, perhaps, this isn't the best place for you, pajeet
>>
>>60429203
fortran or nothing
>>
>>60429314
I'm tempted. Feels really hacky though. There should be tools for this.
>>
>>60429258
But the closest you can get is VB6. I'm not even memeing.
>>
>>60429326
No. Not at all.
>>
>>60429314
>2017
>dynamicofags reinventing the Hungarian notation
>>
>>60429315
>if comments on a south-sudanees coin collecting website hurt your feelings, perhaps, this isn't the best place for you, pajeet
This counterargument is self-defeating. You at first expect me not to take anything posted on this site too seriously -- going so far as to call it a "south-sudanees coin collecting website," a variation of a meme usually used to discredit this website -- but then, having so discredited it, you suggest, by way of calling me "pajeet," that it's somehow a bad thing that I don't belong here. Which is it?
>>
I read about a language that is automatically multithreaded, anything that can be split up is. It's dead now though so that's fucking gay because I really wanted to use it.
>>
>>60429362
What's wrong with Hungarian notation?
>>
>>60429393
That is the worst fucking idea. To do anything synchronously you'd have to explicitly have each statement wait on the previous.
>>
>tfw too dumb for linked lists

i wish i had focus in class instead of having to learn everything by myself the day before an exam
>>
>>60429417

It does that automatically, it only splits the work up if they don't need to be carried out in a specific order
>>
>>60428345
>>60428430
>>60428291

4chan's technology board, everybody

>please ban for comments like this, including mine
>>
File: blinking.gif (1MB, 320x222px) Image search: [Google]
blinking.gif
1MB, 320x222px
>>60429454
>>
>>60429454
It's ez af.
>>
>>60429314
https://docs.python.org/3/library/typing.html
maybe this?

>>60429362
well, ppl say history is cyclical

>>60429376
>a complete stranger calls you pajeet
>on a site that is known for it's edgynes
>still get your panties in a bunch
this means that, maybe this place is not for you
what do you not understand

>>60429393
automating the discovery of parallelism is a pretty hard task, also the fork/join pair is very costly, so to multithread a few instructions just for the sake of multithreading is not the brightest idea
>>
>>60429460
Damn, that's pretty good then. Sounds like the way assembly works, except higher level.
>>
>>60428704

Cython lets you use C types and stuff directly in python and then you compile it giving massive performance gains.
>>
>>60429523
>this means that, maybe this place is not for you
>what do you not understand
Your argument is that this site is not for me. To supplement it, you suggest people on this site are not trustworthy when they call me a pajeet. Yet you call me a pajeet. Suggesting, by your own reasoning, that you are not trustworthy. So how am I to believe you when you say people here who call me a pajeet are not trustworthy? And if I am not, then why not, considering I then must believe people here who call me a pajeet ARE trustworthy, which then includes you?
>>
File: 397.jpg (262KB, 651x1600px) Image search: [Google]
397.jpg
262KB, 651x1600px
>>60429608
you are either being retarded on purpose, or are actually retarded, contributing to the racial stereotypes, I don't know which is worse
>>
>>60429691
Let me get this straight
>you manifest the liar's paradox
>i merely point out you've done so
>I'M retarded
lol ok
>>
I'm finding uni so boring. It's way too easy, it's only java and I've been using java for years. I wish I could have some C or anything else, hell even assembly would be worth the pain because it would actually be teaching me something.
>>
>>60429783
Try getting crazy with it.
>>
>>60428175
Can I inherit a constructor in Java?
For example I have Block super class, and then I have StripedBlocks, InvertedBlocks, DoubleBlocks, and they all have multiple constructors that recieve similar parameters.
Is it possible to somehow else make super constructors so I dont have to repeat it in every block type?
>>
>>60429797
Nope, you have to implement each constructor you need with explicit calls to super.
>>
>>60429817
In every type of constructor I just convert it to my "main" constructor. So super is only getting called from the first constructor.
>>
>>60429315
learning purposes, I want to minimize the amount of time I spend as a computing brainlet. I want to understand programming beyond importing libraries so that when a problem arises that doesn't have a solution I will not be helpless.

t. brainlet
>>
>>60429842
unfortunately same story
>>
>>60429779
what I was pointing at, is that you are on 4chan, you shouldn't be offended by the post here, or if you can't help yourself, then it's better (for the community and yourself) if you leave
only it seems you are to dense to even get that


>>60429875
I see, have "fun" then
>>
>>60429011

>Using C for high level things

Oh god I tried to make a web scraper, it's hell on earth. Save yourself while you can.

For the detection problem, it's probably because you're not sending a user-agent, you need to spoof one and pretend to be a windows 10 firefox computer or something like that instead of just requesting it with no information. It's the classic way of blocking newbots.
>>
File: bench.png (183KB, 1050x750px) Image search: [Google]
bench.png
183KB, 1050x750px
>>60429203
>>60428773
According to the definitive and official /dpt/ programming language benchmark, it's Haskell.

top10
Haskell GHC:                    0.454930841 seconds time elapsed
OCaml: 0.747779583 seconds time elapsed
Java OpenJDK: 1.189619693 seconds time elapsed
Scala: 1.484613540 seconds time elapsed
Scheme Gambit: 1.932229635 seconds time elapsed
Dart: 2.585097637 seconds time elapsed
Common Lisp SBCL: 3.015000773 seconds time elapsed
Crystal: 3.034363672 seconds time elapsed
Scheme Bigloo: 3.604533288 seconds time elapsed
Racket: 3.618877176 seconds time elapsed


>>60428738
Yes

https://blog.plan99.net/modern-garbage-collection-911ef4f8bd8e
http://qr.ae/drvVS
http://qr.ae/drvm8
http://yager.io/programming/go.html
http://nomad.so/2015/03/why-gos-design-is-a-disservice-to-intelligent-programmers/
http://java.dzone.com/news/i-don%E2%80%99t-much-get-go
http://dtrace.org/blogs/wesolows/2014/12/29/golang-is-trash/
http://www.lessonsoffailure.com/software/google-go-not-getting-us-anywhere/
http://www.lessonsoffailure.com/software/googles-go-not-getting-us-anywhere-part-2/
http://www.lessonsoffailure.com/software/google-go-good-for-nothing/
https://gist.github.com/kachayev/21e7fe149bc5ae0bd878

>>60428728
It is.

>>60428704
>Is there good tools for making python type-checked?
https://docs.python.org/3.7/library/typing.html

>>60428704
>How do I speed this up?
TDD

>>60428600
>designed for HPC and parallelism
Still slower than c or c++ and the memory consumption is insane.

>>60428276
>she's going to have her GC tumor removed (eventually)
Yes, eventually.

>>60428175
Thank you for using an anime image.
>>
I spent the last few days reading about rust but I really dislike it now that I try to make something with it ;_;
Is there even a way to directly slice an UTF8 string by index of code points? Like what python3 does by default with its slices.
>>
>>60429842
one thing you could try is adding a constructor in your base class that accepts a parameter of type Object[], moving your other base constructors to private scope, and calling them from this new constructor depending on the runtime types of the objects in the parameter array

then you'd only need to re-declare one constructor per derived class
>>
>>60429929
Where the fuck are those benchmark taken?
>>
>>60429900
>what I was pointing at, is that you are on 4chan, you shouldn't be offended by the post here, or if you can't help yourself, then it's better (for the community and yourself) if you leave
>only it seems you are to dense to even get that
No I understand that's what you mean, I'm just saying it's poor rhetorical form for you to mean that, given the way you tried to express it.
>>
File: ZenOfRuby.png (643KB, 1000x500px) Image search: [Google]
ZenOfRuby.png
643KB, 1000x500px
>>60429545
>giving massive performance gains.
I would not say massive.

>>60429393
https://www.wikiwand.com/en/OpenMP

>>60429147
See pic

>>60428874
It's not a meme.

https://qz.com/965291/wipro-to-h1b-more-and-more-indian-it-engineers-are-under-skilled-unwanted-and-unemployed/
https://qz.com/964843/less-than-5-of-india-engineers-are-cut-out-for-high-skill-programming-jobs/
https://qz.com/941399/indian-engineers-are-so-bad-that-hcl-technologies-wants-to-hire-high-school-graduates/
http://trak.in/tags/business/2015/08/11/reality-indian-engineers-97-cant-speak-english/>>60428874
>>
>>60428874
underrated post

seriously
>>
>>60430045

Pajeet is the funniest meme I've ever seen. It just works on so many levels. The poor quality indian code, the fact that they literally shit in the streets. There's just so much depth to it which is lacking in most memes.
>>
>>60430019
>less-than-5-of-india-engineers-are-cut-out-for-high-skill-programming-jobs
>percent sign didn't show up in the url
>this is the result
KEK
>>
>>60430045
poo in the loo
>>
>>60430062
So does the happy merchant jew meme, yet it's plain racism, spreads cancer and belongs to /pol/.
>>
>>60429393
Chapel has loop construct that will execute loops in parallel / concurrent depending how many iterations there are and how many threads you have configured it to utilize.

It also has
begin {
task1();
task2();
}
// sync(); // optional
more_code();

task1 and task2 might run in parallel.
>>
File: 1488380274642.png (11KB, 386x248px) Image search: [Google]
1488380274642.png
11KB, 386x248px
>>60430073
>>
>>60430062
Why is it funny to you that poor people have to suffer and be filthy because a higher class of slightly richer poor people hog all the basic living necessities?
>>
>>60430075
one of the oldest meme in human history

https://www.wikiwand.com/en/Cleansing_of_the_Temple
https://www.wikiwand.com/en/The_Merchant_of_Venice
>>
>>60430073
"REKT"
>>
>>60430100

Even when given toilets they still choose to shit in the streeets. The romans had sewers thousands of years ago and yet today indians still haven't figured out primitive sanitation. That's like culture 101, how you advance from being an animal to having a civilised society.
>>
>>60430133
>they
Who?
>>
>>60429929
Exception in thread "main" java.lang.NoClassDefFoundError: Test/class
Caused by: java.lang.ClassNotFoundException: Test.class
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)


Cool language bro
>>
>>60430144

http://www.bbc.co.uk/news/health-33980904

>Around 590m people defecate in the open in India
>For many it's a daily ritual and often something they do even when public facilities are available.
>>
>>60430095
>>60430131
designated shitting internet defense force
>>
>>60428874
>This is /g/, not /pol/.
Reddit mentality assumes that the boards are SUB-BOARDS that are meant to be there for containment.

Fuck off.
>>
>>60430133
>Even when given toilets they still choose to shit in the streeets.
Incorrect. "They" worship the toilets instead of shitting in them, this much is true. But that's because "they" are divided into two classes. The lesser class worships the toilets because the greater class shits in them. This is the same reason the lesser class can't shit in the toilets. So again I ask you, why is it funny to you that poor people have to suffer and be filthy so the slightly richer poor people can hog all the basic living necessities?
>>
>>60430133
They are people just like you and me. Stop acting like indians are all poor street shitting java programming microsoft workers. If you hate java, insult java, if you hate microsoft, insult microsoft, but stop blaming a race for something your fucking retard.
>>
>>60430182

Java is a good language pajeet, don't get mad just because you shit in the street
>>
>>60430179
whatever their reason, it is worthy of ridicule and they will continue to be ridiculed until their society changes. Stay mad pajeet.
>>
>have pointer object
>object contains a string member variable
>use string once after creating object
>works fine
>immediately after using string, the last character of the string changes to garbage text

It's safe to say that this is a mishandled pointer issue, right? I'm looking through my code but I can't find any mishandled pointers anywhere.
>>
>>60430215
at least indians don't have le ebin trolle as president and run around with guns shooting each other
>>
>>60430236

You do have public gang rapes though and nobody tries to intervene. This wouldn't be tolerated in a civilised society because it's mean.
>>
File: father2.jpg (49KB, 395x600px) Image search: [Google]
father2.jpg
49KB, 395x600px
>>60429929
For people interested in functional programming on a very basic level, I'm going to do a reading of the Idris book (the dependently typed language) in June and will introduce stuff on this youtube channel

https://www.youtube.com/channel/UCcrSMnEYhIPX_p127jI23qw
(subscribe)

https://en.wikipedia.org/wiki/Idris_(programming_language)

https://groups.google.com/forum/#!topic/idris-lang/phkZoQMa0IM
>>
>/dpt/ - politically incorrect
>>
>>60430228
>pointer object
What programming language has those? C++?
Post the code.
>>
>>60430215
>whatever their reason, it is worthy of ridicule
Disagree. The fact that people are shitting in the streets is worthy of ridicule. But the people themselves are not, because that fact is not attributable to them. The people worthy of ridicule are the ones whose fault it is that there are people shitting in the streets.
>and they will continue to be ridiculed until their society changes. Stay mad pajeet.
If the society is what you despise and find so funny, then why are you laughing at its victims? Why are you adding insult to injury? If it's so funny to you, laugh at the greedy bastards whose piggish natures make this repulsive behavior necessary.
>>
>>60430228
Did you forget null terminator?
>>
Is ther a offensive programming language?
Like, racism, nsa buzzwords or swear words?
>>
>>60430296
C+=
>>
>>60430288
It's a string, not a C style string. Although I do sometimes call c_str() on it.
>>
>>60430215
(cont from >>60430281 ) And by the way, if you continue to insist that the best way to laugh at our society is to laugh at the lower class that's systemically kept helpless to do anything about it, you are no better than our oppressors. Your attitude is even more disgusting than the lifestyle to which we're relegated.
>>
So I just installed 600mb of Haskel on my lil' Debian. Convince me not to remove it.
>>
>>60430345
add another 600mb of cabal
>>
max((self.getQValue(nextState, nextMove) + reward for nextMove in self.getLegalActions(nextState))))


What exactly is going on with the max and the for loop here? I'm new to python and am following a tutorial for basic game ai but I don't really understand this line at all

What is it taking the max of? Is only the max value in the list going to be added? How can .getQValue be using nextMove before it's declared in the for loop? sorry I'm dumb
>>
>>60430325
How do you use the string?
>>
>>60430228
Are you following the rule of three?
>Destructor
>Copy constructor
>Copy assignment operator
If an object has to allocate and deallocate any resources other than its own memory, it needs all three of these.
>>
>>60430271
Yo, Node question (using ES6 shit). I'm writing an API, and I want its usage to be like this:
let skills = api.character.getSkills(charName)


How can I do that? What I've tried is this:
class API {
constructor(apiKey) {
this.key = apiKey;
}

const character = {
function getSkills(charName) {
// do shit and return skills
}
}
}


But that doesn't work, it says defining a constant character inside my class is invalid syntax. How can I do it, instead?

And by the way, it has to be api.character.getSkills(charName) as opposed to simply api.getSkills(charName), because there are a lot of methods and I want to able to separate them in "subsets" so to speak (in this case the getSkills method would belong to the "character" subset of methods), for ease of usability.
>>
>>60430345
It's a pretty collection of megabytes.

Also, open a terminal and hit
>cabal install idris
>>60430269
>>
File: I+did+ask+for+this.jpg (13KB, 184x184px) Image search: [Google]
I+did+ask+for+this.jpg
13KB, 184x184px
Does Linux have any sort of "common dialogs" API? I'm primarily interested in a generic file open dialog I could call from my programs and have it pop up a windowing system -native dialog that lets the user to choose a file (or files, if multiple selection is allowed) and return the name(s) to my program. Windows has GetOpenFileName/GetSaveFileName, but I haven't found anything like those on Linux. The command-line "dialog" tool does not have file open dialogs.

The program I'd use them in is a small cross-platform 3D engine. The only "UI" it currently has is a Quake-like console. There are some variables that are file names and I thought I'd add some user-friendliness by letting users fill in those variables by actually choosing a file, instead of having to type in their names. I'm using plain SDL2 and OpenGL, no Qt/GNOME or the ilk which all have file dialogs, but I can't use them without using the whole framework. There are OpenGL GUI libraries like imgui and nuklear that have these kinds of dialogs, but retrofitting my program to use them just to get one dialog is too much of a work right now...
>>
>>60430447
I didn't mean to quote the other post, by the way. Just a question to anyone who knows ES6 Javascript/Node.
>>
>>60428887
So writing software I can sell for mad money then spend the rest of my time doing interesting shit I enjoy and being with my bitch isn't mainly enough these days?
>>
>>60430478
Try tk. But no.
>>
>>60430478
Linux is a kernel, and has no business drawing GUIs, many linux systems don't even have a monitor.

You want a standardized X11 toolkit, like GTK+ or Qt.
>>
why doesnt insertAnywhere() work

typedef struct Node {
int value;
struct Node* next;
} Node;

Node* new(int x) {
Node* newNode = (Node*)malloc(sizeof(Node));
newNode->value = x;
newNode->next = NULL;
return newNode;
}

void insertAnywhere(Node** head, Node* new, int n) {
if (n==1) {
new->next = *head;
*head = new;
}
else {
Node* temp = *head; int i;
for(i = 0; i<n-2; i++) {
temp = temp->next;
}
new->next = temp->next;
temp->next = new;
}
}

int main() {
Node* head = NULL;
insertAnywhere(&head, novo(1), 1);
}


it just prints gibberish
>>
>>60430478
GNU/Linux*
>>
>>60430509
on main, novo(1) is new(1) i copy pasted wrong
>>
>>60430484
>tfw no qt3.14 underage telephone
>>
File: 4779dca13f.gif (4MB, 426x284px) Image search: [Google]
4779dca13f.gif
4MB, 426x284px
>>60430478

I'd just like to interject for a moment. What you're referring to as Linux, is in fact, systemd/Linux, or as I've recently taken to calling it, systemd plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning systemd system made useful by the systemd corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.

Many computer users run a modified version of the systemd system every day, without realizing it. Through a peculiar turn of events, the version of systemd which is widely used today is often called "Linux", and many of its users are not aware that it is basically the systemd system, developed by the systemd Project.

There really is a Linux, and these people are using it, but it is just a part of the system they use. Linux is the kernel: the program in the system that allocates the machine's resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Linux is normally used in combination with the systemd operating system: the whole system is basically systemd with Linux added, or systemd/Linux. All the so-called "Linux" distributions are really distributions of systemd/Linux.
>>
File: re-interject.jpg (348KB, 806x938px) Image search: [Google]
re-interject.jpg
348KB, 806x938px
>>60430548
Not this time, Richard.
>>
I'm majoring in aerospace engineering and my university courses are 100% Matlab based.
Which language should I self-learn this summer between C, Fortran and python?
FYI the courses I've enjoyed the most are the fluid dynamics ones.
>>
>>60430572
That's not GNU/Linux pasta.
>>
File: code.png (16KB, 915x278px) Image search: [Google]
code.png
16KB, 915x278px
>>60430394
Right here. The string that's getting messed up is the fontFile variable. I pass it in to the object as a string literal, then for some reason, the last character changes to garbage text sometime between passing the string literal, and calling this function.
>>
>>60430597
Applies to systemd too
>>
>>60430608
code blocks
>>
>>60430496
Aw, man. I was genuinely hoping there would have been.

Sorry, *nux users. You have to type everything by hand. Windows users can do that too, but they can optionally use mouse now.

OTOH, SDL does have a cross-platform drag-and-drop support, I need to consider making it so that if you drop a file on to the window, its name is appended on the console command line at the cursor's position. Not perfect, but it's something.
>>
>>60430500
>Linux is a kernel
Linux is an operating system.
>>
>>60430548
I'd just like to infect for a moment. What you're referring to as Windows, is in fact, WanaCrypt/Windows, or as I've recently taken to calling it, my bitch. Windows is no longer an operating system unto itself, but rather another encrypted component of a fully dysfunctional WanaCrypt system made useless by your incompetence, my fat fucking ass, and vital system vulnerabilities comprising a full CC (cash cow) as defined by MDN (my drug needs).

Many computer systems run a modified version of the WanaCrypt system every day, without even realizing it. Through a peculiar turn of events, the version of Windows which is widely used today is often called "@^#^$*!$!%," and many of its users are not aware that it is basically kaput, courtesy of the WanaCrypt project.

There really is a Windows, and these people were using it, but it is now just a part of the system they can't use. Windows is the backdoor: the program in the system that allocates my resources to the other programs that you used to run. The backdoor was an essential part of an operating system, and useful by itself; but now it can only function in the context of a complete payment. Windows will soon be normally used in combination with the WanaCrypt operating system; the whole system is basically WanaCrypt eating Windows's brains, or WanaCrypt/Windows. All the so-called "Windows" distributions are really mine for the taking.
>>
File: Photo on 16-05-17 at 18.45 #2.jpg (183KB, 1080x720px) Image search: [Google]
Photo on 16-05-17 at 18.45 #2.jpg
183KB, 1080x720px
>>60430576
I did my PhD at the German Aerospace Center and am literally just leaning for my exam right now - or rather I take a break and am shilling for my youtube channel (>>60430269, subscribe) where I'll do videos when I'm on vacation.

I'm a physicist and worked in combustion kinetics, and from this perspective I can say that I've seen more Python and Matlab than the other languages. If you're actually going into CFD, learn C. Not that there aren't a lot of old codes using Fortran, but they are mostly there because of this historical reason, and there is new stuff still being done in C/C++. I'd do C++ if you have the time, or Python if you just do it 20 minutes a day in the afternoon.
>>
>>60430509
I would imagine that it's because new is a keyword and thus not allowed as a variable name.
>>
>>60428175
which episode is this from?
>>
>>60428600
Is this a statement or a question.
>>
>>60430805
>>
>>60428721
>lua
>doesn't have version cancer
wat
>>
messing around making an Erlang-like language in C/C++

https://github.com/olewhalehunter/Njor
>>
>>60429326
>I'm tempted
>It seems to come from a misunderstanding of what statically type checked languages are like.
If you're tempted by his suggestion, I think you suffer from this misunderstanding.
>>
>>60428689
>and is enjoyable to use
I'd like to hear what does it include in your opinion.
>>
>>60430745
Thanks DLR anon. Can I start directly with C++ and go to C later or it makes more sense to start first with C?
I'll try to learn Python anyway in my spare time for non-work related activities.
>>
>>60430885

also wrote notes and explaination of core mechanisms of erlang and message passing models

https://github.com/olewhalehunter/Njor/blob/master/erlang.md
>>
>>60429011
>I'm currently trying to wirte a web scraper in C
>whywouldyoudothis.jpg
>>
>>60430296
I wrote one, but I got banned for posting about it.
>>
>>60428190
What language your using?
>>
>>60430983
Malboge
>>
>>60430768
i changed and it doesnt work either

but this

void insert3 (Node* new2, Node** h) {
new2->next = *h;
*h = new2;
}


works fine. i may be blind
>>
>>60430745
>I'm a physicist
>worked in combustion kinetics
Unrelated question. Do they prefer Physicists for that or do you have many engineer colleagues?
>>
Does anyone here use TinyXML? If I wanted to upgrade to TinyXML-2, would I have to change all of my code?
>>
>>60430691
Linus is a name.
>>
Jesus Christ though
regex-redux

source secs mem gz cpu cpu load
Chapel
10.02 1,022,052 477 19.68 99% 72% 14% 12%
Java
12.31 902,528 929 38.75 73% 76% 86% 81%
>>
>>60431269
Chapel looks like shit tho
>>
>>60431358
no but wtf if that memory usage 1GB that's like Haskell tier
>>
Is ocaml really the language to learn?
It's syntax looks kind of horrible.
>>
>>60430576
All three are good. I'd suggest learning a low-level language so you understand how the computer works, Matlab gives you very bad habits imho. Then learn Python to replace the abomination that is Matlab in your own work.

Another option that will be really great eventually is Julia, but it's still pretty experimental. It's a direct upgrade over Matlab in every way though.
>>
File: 1492789817195.gif (123KB, 500x281px) Image search: [Google]
1492789817195.gif
123KB, 500x281px
how can i start implementation of SURF (or SIFT it doesnt really matter for what i need)?
do I really have to read about how the algorithm works?
>>
>>60431736
Nope.
>>
>>60430931
You can start with C++

They have a thread on resources on SO
http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list

and I've been advised to e.g. start with
https://www.amazon.com/dp/020170353X/?tag=stackoverfl08-20
even if that's a relatively old book (less than 15 year old)

>I'll try to learn Python anyway in my spare time for non-work related activities.
For Python, if you're the type, the MIT introduction to programming uses Python, see this series
https://www.youtube.com/watch?v=Pij6J0HsYFA

That's what I did.
Here this following site are a lot of tutorials and a year ago I read the GUI tutorial here
http://zetcode.com/gui/pyqt4/

and produced this thing for a Physics lab
https://github.com/Nikolaj-K/python-lab-control-GUI

I come back to a C++ recommendation because you also just want to be able to claim you know it for jobs later.

Hope that helps

>>60431095
There were mostly Engineers. I, in particular, was working in the field of plasma chemical kinetics, non-equilibrium statistical physics and so that helped. Also, practical chemistry (as opposed to simulations) is basically "cooking" and done by Chemists, hopefully. I was working in Stuttgart (=Bosch, Daimler, etc.) and all the people staying there were going into combustion engineering for cars and planes, and I'd argue that's also a whole lot of project management and so it's okay if you suck at math (and the non-physics, non-math, non-statistics majors have no math lectures for their own sake, just make for X and math for Y)

I've literally already scripted out some stuff I'll talk about on the youtube channel, I'll record that this week and spread it in between the Idris lectures as freaky Friday rants
https://www.youtube.com/channel/UCcrSMnEYhIPX_p127jI23qw
>>
>>60431799
>Nope.
You mean the syntax or that it's not the language to learn?
>>
>>60431832
It's not the language to learn.
>>
>>60431888
why tho?
>>
>>60431943
https://benchmarksgame.alioth.debian.org/u64q/which-programs-are-fastest.html
>>
>>60431958
this link should be an autoban
>>
>>60431961
Does the truth hit too close to home for you?
>>
>>60431958
Yeah but ocaml is pretty damn fast, by that benchmark it's about as fast as java but as language it's way better than java.
It's garbage collected so it's acceptable it's slower than sepples or C.
>>
File: download.jpg (7KB, 225x225px) Image search: [Google]
download.jpg
7KB, 225x225px
>>60431009
>>
>>60432012
This. OCaml is the future.
>>
>>60430902
I'm tempted because it would probably help me. to prefix my types and then write a tool that analyses the prefixes. That'd be trivial to do and leave me in a better situation than the current shit I deal with.
>>
>>60432075
It's been around for 21 years. I wouldn't count on it.
>>
Okay, here's something to ask you all...

When you write software, do you prefer dimmer lighting in the room you're in, or brighter lighting?
>>
>>60432183
What programming language is this?
>>
>>60432183
Not programming.
>>
>>60430019
>https://qz.com/964843/less-than-5-of-india-engineers-are-cut-out-for-high-skill-programming-jobs/
I don't think most western students write correct code either.
>>
>>60432183
Why do you care?
You're a computer science student, you don't even touch computers.
>>
>>60432204

This isn't a programming language. This is a question, written in English, about your preferred conditions for ambient lighting when programming.
>>
>>60432273
>you don't even touch computers.
*You shouldn't even touch
>>
>>60432276
Here's a better question, what color programming socks do you wear when programming in ruby, ruby-senpai?
>>
>>60428689
go back to school
>>
>>60428689
Common Lisp
>>
>>60428738
better learn C. python is nice too. clojure is also fun.
>>
>>60432273

>You're a computer science student, you don't even touch computers.
Computer Science is a broad field. Not everyone studies the pure mathematical aspects of it. My main interests are in security, operating system design, and to some extent, compiler optimizations.

>>60432371

I wear black crew socks, though I don't see how that affects anything.

The reason for my original question was that I feel as though I am much more distracted when I have brighter lighting, and easily work in dim to no lighting, especially if my laptop is the only light in the room. By contrast, one of my classmates has noted to me that working in dimmer light makes him feel sleepy.
>>
What do you use abstract data types for?
>>
>>60429608
damn pajeet arguing with everyone here...
>>
>>60432475

Everything.
>>
>>60432431
>security, operating system design, and to some extent, compiler optimizations.
i.e. applications of computer science. don't pollute the term

cs is about algorithms, data structures, pl theory and complexity
>>
>>60432475
To make the implementation irrelevant to the logic of your program.

>>60432431
>security, operating system design
not computer science
>>
>>60432568

It's still part of the study of computer science. Most people I've met in this field who aren't trying to become a run of the mill webdev are studying either machine learning or cybersecurity. Algorithms, data structures, and complexity are part of the standard undergraduate curriculum, but are not as commonly pursued for graduate research.

I've met a grand total of two, maybe three people who know a damn thing about PL theory.
>>
>>60432663
So, it's just encapsulation?
>>
>>60432672
Stop polluting the term you psuedo intellectual prick.
CS is math, what you're describing are applications of CS, like those fancy calculator boxes packed with transistors that do math really fast that we call computers.
>>
>>60432677
yes, encapsulation is abstraction of the data
>>
    for i in range(len(word)):
if word[-2:] == "'s":
word = mot[:-2]
[...]


If I don't put a "return word" statement directly after the last statement, I get an index out of range error
I get it, len(word) has the same value as before, but why doesn't it reset with each iteration of the for loop ? are variables local to a for loop ? what if I want to transform this transformed word further ?
>>
>>60432742
shit I made a mistake fuck it, every time

    for i in range(len(word)):
if word[-2:] == "'s":
word = word[:-2]
[...]
>>
>>60429929
>tfw Java's so fast but it's so painful to use
>>
What happens when someone invents an actually good version of drag and drop programming and puts you nerds out of a job?
>>
>>60432771
I don't give a fuck, I'm a manager.
>>
>>60431813
Thanks for the lengthy answer about my question in >>60431095
>>
>>60428277
Good structure, clean code.

You should extract new Random() to its own variable outside the loop, since its seed is timebased.

Usually PRNGs are expensive to construct since they often involve syscalls and stuff, however I'm not 100% on how C# constructs PRNGs.
>>
>>60432672
>I've met a grand total of two, maybe three people who know a damn thing about PL theory.

kek. The entry course to programming at Berkeley has a fair share of PL theory (SICP). cs education really gone shit. also,

https://www.youtube.com/watch?v=FKFH_-QogN0&t=16m50s
http://lamport.azurewebsites.net/tla/math-knowledge.html
>>
>>60432742
>>60432759
nvm I used break
>>
>>60432663

Well, security research is what's going to be getting me a master's degree in computer science.

>>60432692

Well, there isn't a separate field called "applications of computer science." The degree awarded at universities all around the world is simply, "computer science," and it's a lot more broad than just theory. And it's not as if there isn't a lot of math in the practical work too. Cryptography is mostly just number theory. Machine Learning is just linear algebra and statistics. Cybersecurity, I'd argue, has a few things in common with game theory.

>>60432771

Scratch already exists, and it hasn't killed the programming profession. You could make a compiler that perfectly understands the English language, and it still wouldn't replace the role of programmers. Why? Because managers don't have the right mindset to know how to tell a computer exactly what to do, to the most minute of details. Regardless of the representation of the language you use to communicate with them, computers are fundamentally different from humans. They don't get subtlety, and they can't extrapolate well. A programmer's job is to figure out what the layman actually wants when he gives you a "totally brilliant and original idea."
>>
Please help. I'm falling into the void*.
>be college student
>meet with team every class
>work with them out of class
>submit code that "works on MY machine (C) (TM)" but teammates don't get it
>want to apologize but my people skills are nonexistent so i just tremble in fear at home as i passively watch them bitch about me
>the more i don't apologize to them the worse i feel about not having apologized to them yet
>a week passes
>feel bad about STILL not having apologized
>don't contribute because i can't show my piece of shit face
>feel bad about not contributing
>several days pass
>people are wondering if i died
>cry about being such a useless freeloading piece of shit
>notice i sound like a fucking retard when i cry
>imagine that it's probably because i actually am a fucking retard
>cry harder
>now i sound even more like a retard
>cry harder
>several days pass
>haven't left bed
>wat do
>>
>>60433001
I've known people like this.
I like to act obtuse and and angry at them just so they'll fall apart and profusely apologize to me even though I don't care and they don't know any better.

Learn some better people skills and I won't feel that primal need to BULLY you.
>>
>>60431029
>>60431029
Well, this
int main() {
Node* head = newFunc(1);
insertAnywhere(&head, newFunc(2), 2);
}


seems to work just fine. At least up to n=2. You need initialize head and check for the end of the list.
>>
File: 1488083605962.jpg (63KB, 1280x720px) Image search: [Google]
1488083605962.jpg
63KB, 1280x720px
i have a java project within which i'll probably implement three main classes that will more or less do unrelated stuff (file I/O, api calls, general logic), but with my design in mind they all need to work together to do anything anyway.

I'd like to carry their instances as I dunno, singletons in a controller/packaging class and only share methods of that class, it will then call methods of aformentioned three classes in correct order depending on procedures.

How do I go about creating a jar that allows this? As in, a client, for example GUI, sets a dependency for my jar file and the only thing he can do with it is creating the controller object and maybe importing some custom objects to keep them in ListViews and the like.

Thanks in advance.
>>
>>60433001
Reach out to your team. Apologize for your absence. Flex that atrophied social muscle. Improving people skills is like any other skill: practice. You have nothing to lose by showing up late and busting ass.
>>
>>60433139
if he's been seriously absent like he says, they probably already complained to the prof and he's been dropped from the group already.
>>
>>60433001
Start working out. Improve your physical health and boost your confidence.
>>
Why can't memory be freed after a pointer goes out of scope? Why is garbage collection so hard? What am I missing?
>>
>>60433195
because once the pointer goes out of scope, it's gone.
It's like being given an phone number on a napkin, and you lose the napkin.
Good luck seeing that girl ever again.
>>
>>60433222
And so, you remove the phone number from memory. Shouldn't it be the purpose of garbage collection?
>>
>>60432771
Nothing. The idea that programming is a problem that will be solved is naive.
I would go further and say the idea that the entire concept of work is not something we will ever solve.
Maybe we can replace most of what people are doing today, but we will find new ways to put ourselves into work.
Because we like work.
We thrive on it.
Programming is just another thing humans do.
Programming is already accessible but jot a lot of people do it well.
Drag and drop programming is fine, but you still have to do stuff with it, add new blocks etc.
Even if we make a voice interface where you just describe the concept of your application and it appears, we will find a way to do something.
As long as there is computers, we will fond a way to use it.
The ride never ends.
>>
>>60433195

How do you know what pointers are in scope and what pointers aren't in scope?
>>
>>60433195
how do you know it will no more be used?
>>
File: neuron activation intensifies.jpg (470KB, 979x832px) Image search: [Google]
neuron activation intensifies.jpg
470KB, 979x832px
How can I get my company to hire someone to work with me / that i can delegate tasks to?

I am doing a lot of data analytics work (from the base infrastructure to the report out to senior management) and I am running short of bandwidth to do everything.

I figure the main options are
1. Make a business case to show the value of hiring someone to do things
2. Simply tell people when they make a request that it's "not in scope" for the project at the moment but "is possible with the right resources"

Of course they're not going to do it just because I ask, but how do i approach this?
>>
>>60433195
Why are brainlets so afraid of manual memory management?
A sane garbage collector would literally be a free() function, so you can describe exactly when you're done with a memory block instead of some monolithic GC daemon trying to GUESS and stop execution of your program to do it.
>>
I DON'T KNOW WHAT TO WORK ON AAAAAAAA
>>
>>60432771
what matter is logic.

from https://qz.com/964843/less-than-5-of-india-engineers-are-cut-out-for-high-skill-programming-jobs/

“Only 4.77% candidates can write the correct logic for a program, a minimum requirement for any programming job,” a recent Aspiring Minds study of over 36,000 engineering students in India revealed. The employability assessment company tested students from IT-related streams of study at more than 500 colleges across India on Automata, a machine learning-based assessment of software development skills.
>>
>>60433324

Manual memory management gets hard once heap pointers survive past the scope that created them.

This is why C++ has smart pointers.
>>
File: circuitgirls.jpg (2MB, 3840x2160px) Image search: [Google]
circuitgirls.jpg
2MB, 3840x2160px
>>60433328
A programming language implementations benchmark.
>>
>>60433293
Compiler support, when a scope ends all pointers are freed
>>60433299
memory? compiler provides a keyword for destruction of a scope, if memory pointed must be stored after pointer goes out of scope, you type a keyword
>>60433324
Just wondering why GC is considered one of the hardest problem in CS, no more
>>
>>60433328
Work on a unifying theory of machine learning
>>
>>60433341
>less-than-5-of-india-engineers-are-cut-out-for-high-skill-programming-jobs
I love url's lack of special characters sometimes.
>>
>>60433359
No, explain to me why you're unable to free things you allocated, regardless of how long ago they were created.
Are you irresponsible?
Do you have any concept of the data structures you're writing?

All a smart pointer does is handhold you by making sure memory blocks don't stay allocated after it's pointer leaves scope.
This also severely limits what you're able to do with raw pointers.
>>
>>60433324
manual memory management is tedious and error prone, especially when you have some kind of concurrency.

>>60433379
and what about this?

void foo(void *p);

void bar()
{
int *p = malloc(p);
foo(p);
}
>>
>>60433379

int* foo()
{
int* some_int_ptr = malloc(sizeof(int));
return some_int_ptr;
}

Can't free(some_int_ptr) because then you'd be passing an invalid pointer back.
>>
>>60433405

Of course not, that's why I use ownership semantics to self-document which pointers should be freed when :)
>>
>>60433423
If you keep that pointer alive somewhere, you can free it anytime during the execution of the program.
>>
>>60433451

Anon's "solution" to GC @>>60433379 is just to automatically free a pointer as soon as the pointer goes out of scope.
>>
>>60433462
So how am I supposed to create data structure contexts and pass them around?
>>
>>60433411
void foo(survive void *p);

void bar()
{
int *p = malloc(p);
foo(p);
}

P is freed when bar() finishes

>>60433423
int* foo()
{
survive int* some_int_ptr = malloc(sizeof(int));
return some_int_ptr;
}

P is not freed when some_int_ptr is out of scope.
>>
>>60433481

When is it freed, then?
>>
>>60432863
>You should extract new Random() to its own variable outside the loop, since its seed is timebased.
Good catch on this, however I don't think it's particularly an issue due to the nature of the loop.

It would be nearly impossible for two Randoms to be created in the same tick, given that it's waiting for user input on each loop.
>>
>>60433506
int *p = foo()

(relative to second example)
It's freed when p goes out of scope, if p is in main scope it survives until main finishes
>>
>>60433481
But the compiler doesn't know what foo does. foo could be this

void *pointer;

void foo(void *p)
{
pointer = p;
}


also, clean up on leaving scope already exist.
>>
>>60433584
Right, I've been naive
>>
>>60433001
Until people have told you otherwise, it is not too late to make up for it.
When you wake up late and think you might as well give up the entire day, take a shower and show up.
It is much better to be late than not to show up.
And if you are late, stay later. Make yourself a work schedule.
Then push yourself to get there earlier and earlier.
Keep strict bedtimes if that helps you.
Relax when you sleep.

As for communication, explain to yourself what you have done.
Maybe write down notes of what to say.
I often plan my social interactions ahead of time because I get nervous around people too.
What I will say, facts about the other person I might want to remember.

As for your work, your code is worthless if people don't know what you are doing.
It makes it impossible to plan and they can't use it with the rest of the system.
Two ways around this.
Document the code.
Simple clean doxygen style comments above each function declaration. What it does, what the parameters are, what are the units etc.
If you are using a library you haven't seen them use, give people notes on how to get it, I often just go back through my bash history and copy the key parts down to a script and maybe put in some comments about what is happening and what they need to do outside bash.
If they use a different platform than you, give them good general advice on where to find it and have them write a guide for their platform.
If there is something in your code which is not self explanatory, make a comment so people can read what you have done.
Where possible, make small concise functions instead of one giant function with 5 lambda functions inside.
>>
can't choose between ocaml / lisp
>>
>>60433293
A pointer should be a class with a raw pointer and a counter that increments when it is assigned and decremented when out of scope.
When it reaches 0, it is freed.

If only some had already made such a pointer type.
That would be... Smart...
>>
>>60433703
Thank you
>>
I'm having a real tough time justifying C++.

All I want to do is list the files in a directory. But C++ doesn't have that, it doesn't have anything. What kind of language doesn't include support for files in it's standard library? They expect me to fucking write my own libraries for the most menial of tasks or download bloated libraries for every platform.

It didn't even have threads supported in it's standard library until like a week ago.

Why even bother with having a library if you don't include anything in it? Compare this to java which has everything you need all perfectly just lying there begging you to embed it with no bloat. I just want to fucking make things in C++ why is it such a ball ache?
>>
>>60433660
Lisp's metaprogramming far outshines OCaml's. OCaml is marginally more performant than SBCL Lisp.
>>
>>60433701

std::shared_ptr is usually needless overhead. raw pointers and std::unique_ptr are enough for most purposes.

>>60433549

This idea of having multiple kinds of pointers with automatic destruction is exactly what C++ was thinking when it added smart pointers.

void foo() 
{
std::unique_ptr<int> my_unique_ptr = std::make_unique<int>(5);
return;
// my_unique_ptr is automatically freed here, because the pointer is deleted
}

unique_ptr<int> bar()
{
std::unique_ptr<int> my_unique_ptr = std::make_unique<int>(5);
return my_unique_ptr;
// the pointer survives, so it isn't deleted.
}

void baz(int* raw_int_ptr)
{
return;
}

void qux()
{
unique_ptr<int> surviving_ptr = bar();
// I can copy this as a plain pointer, which won't be deleted once it goes out of scope.
baz(surviving_ptr.get());
return;
// surviving_ptr finally gets deleted here.
}


With unique_ptr, you can declare one transferrable "owner" for a pointer who is responsible for its destruction. With shared_ptr you can declare several. Also it looks a lot nicer in practice, I'm just being verbose.
>>
>>60432692
All subjects are delimited according to convention.
Everyone sees the thing's ruby studies as CS, so that makes it CS.
Especially for a field such as CS which emerged from other fields.
Take your autism medication.
>>
>>60433745
Just install boost.
Think of it like the JVM for java except only necessary in rare occasions.
>>
>>60433379
>>60433703
You can make a procedure being called on a variable while leaving the scope through the attribute __cleanup__

for example,

void *p __attribute__ ((__cleanup__(foo))); // will call foo(&p) when leaving scope


As you can see, you need a procedure to do the cleanup. the procedure receives a pointer to the variable, not the value of the variable. example for a generic pointer:

void cleanup (void **pointer)
{
if (*pointer)
free(*pointer);
}


then

#define CLEANUP(function) __attribute__ ((__cleanup__(function)))


{
int *pointer CLEANUP(cleanup) = malloc(...);

// cleanup(&pointer) called when leaving scope
}
>>
>>60433786
It obviously depends on how many is sharing that pointer.
>>
>>60433745

To put the bloat into perspective:

Hello World in Java: 1KB
Hello World in C: 130KB

What a fucking meme language. I thought I would have to leave the comfy land of java but no really you can do everything in java and anyone who disagrees is a liar who should be burned at the stake for treason against java.
>>
>>60433857
These are set by GCC compiler?
>>60433882
Java bytecode can't be executed directly
>>
>>60433882
>C: 130KB
>FULL FUCKING JAVA VM
What kind of monster would force the users to install jvm?
>>
>>60433745
C++ might be compiled in an environment that doesn't have files.
I'm sure you're also complaining about C++ not having a native GUI library even through many C++ programs are designed to run on a system without any output devices of any kind
>>
pop quiz

typedef string Type;
Type initVal();
class Exercise {
public:
typedef double Type;
Type setVal(Type);
Type initVal();
private:
int val;
};

Type Exercise::setVal(Type parm) {
val = parm + initVal();
return val;
}


What is the type of the parameter `parm` of function `setVal` and what is the return type?
>>
>>60433923
not a parameter
>>
>>60433745
>>All I want to do is list the files in a directory. But C++ doesn't have that
http://en.cppreference.com/w/cpp/filesystem

retard
>>
>>60433882
Hello World in java is literally 130MB if you include the JVM
>>
File: umarusee.jpg (113KB, 1280x720px) Image search: [Google]
umarusee.jpg
113KB, 1280x720px
>>60433906
>These are set by GCC compiler?

https://ideone.com/5t8EDV
>>
>>60433976
Thanks. What is /dpt/ C library, btw?
>>
>>60429929
>That pic
I've messed about with some benchmarking before and the results are inconsistent, even when averaging, especially with the initial results.
Perhaps the first run just takes such a long-ass time that it skews the first averaged result but that wouldn't explain the C++ test.
As for Python, it's definitely taking longer than even the 9 seconds for the C++ test but it does run to completion.

Speaking about averaging, why weren't multiple runs done to average out times?
Why the (i%3==0&&i%5==0) and not (i%15==0)?
>>
>>60433913

>C++ might be compiled in an environment that doesn't have files.

If you're that autistic then you can just not include the file part of the library when you build for that device. That isn't reason to not have files.


>>60433912

Intelligent people who realise compiling for every platform is unnecessary and stupid


>>60433971

>Implying anyone uses C++17
>Implying it's fully supported by every compiler
>Implying that didn't come out like yesterday
>>
>>60433882
>>Hello World in C: 130KB

#include <stdio.h>

int main(void){
puts("Hello, World!");
}


gcc hello_world.c
du -b a.out
8368 a.out
strip -s a.out
du -b a.out
6128 a.out


>>60434028
filesystem library has nothing to do with compiler you dipshit
libstdc++ has had support since 2014, use a less shit standard library.
>>
>>60434011
there no such thing.
>>
>>60433539
Of course, I was just nitpicking on structure, in this case it should not really matter.

However, I think this can be exploited to achieve an average winrate of approx 75% by using a script and piping the keys to the program. Still just nitpicking, but it should still be noted.
Maybe I should write a short script to test it.
>>
>>60434028
>Intelligent people who realise compiling for every platform is unnecessary and stupid
The solution would be to make cross compiling as easy as possible instead of having to implement FUCK HUGE FAT FUCKIGN VM to every platform.
You are going to have package manager, compiler and propably some tool to deploy anyway. There is no need for FUCK HUGE VM anywhere.
>>
>>60434064

>Still bigger than java even with manual optimisation

Hahahahaha

>libstdc++

Look I'm no expert in meme language libraries but that sounds like an external bloated library rather than the standard library and therefore does not count.
>>
>>60434087

The VM is what like a few hundred meg and means the computer can choose the best implementation for the hardware rather than the developer writing the same thing over and over with windows and posix and all the other meme shit.

Write once, let the computer handle the bullshit.
>>
>>60434163
more like write once, debug everywhere.
>>
>>60434109
>std
>not standard library
>>
File: code.png (14KB, 362x612px) Image search: [Google]
code.png
14KB, 362x612px
Why doesn't it write "BANG" when t == pi?
If it matters, t is a float, and pi is #defined as 3.14
>>
>>60434163
Yeah you might as well just run everything in browser because write once interpret everywhere.
Fucking dumb Pajeet.
>>
>>60434163
>a few hundred meg
not
portable
>>
>>60434187

>Comparing floats
0.1 + 0.2 =/= 0.3
>>
>>60431813
Thank you again for your long answer, I've bookmarked your links and I will look for an used version of the C++ book and I'll look forward to your channel out of curiosity.

Little OT: how are career opportunities at DLR once your PhD is over? Do you plan to leave it to join a German-based company?
>>
is cpp even used outside high-level embedded systems?
>>
File: 1470348868789.jpg (322KB, 800x800px) Image search: [Google]
1470348868789.jpg
322KB, 800x800px
>>60434187
>== on floats
>>
>>60434187
https://0.30000000000000004.com/
>>
>>60434245
it's used a lot in video gaming.
>>
>>60434275
>cert not signed by trusted authority
I ain't going to that site nigga.
>>
File: THINKING EMOJI.png (53KB, 256x256px) Image search: [Google]
THINKING EMOJI.png
53KB, 256x256px
>>60434198

Look I get that you think you're wicked cool for using meme languages but java is the best language by far. It's fast but there's no bullshit and it has the comfiest syntax by far. Cpajeetpajeet just can't compete.

>>60434180

Nope, unlike C++ and other meme languages, if you use something in the standard library then it works on every platform. No bullshit, no "oh sorry but we don't actually support threads on windows lol go fuck yourself"
>>
File: 09.png (2MB, 1133x1600px) Image search: [Google]
09.png
2MB, 1133x1600px
>>60434314

https://archive.fo/8ePYE
>>
>>60434109
>manual optimisation
Not even close.

#include <unistd.h>
#include <sys/syscall.h>

int main(void){
syscall(__NR_write, 1, "Hello, World!", 6);
}


gcc -nostdlib -fwhole-program -static -Wl,--gc-sections,-s -ffunction-sections -fdata-sections hello_world.c
du -b a.out
672 a.out
>>
wtf jim
https://www.youtube.com/watch?v=TcqWok8AubE
leave terry alone, he's a fucking genius
>>
>>60434339
>https://archive.fo/8ePYE
>.io
>doesn't load without enabling js
I ain't going to that site nigga.
>>
File: 1257917041283.png (744KB, 800x600px) Image search: [Google]
1257917041283.png
744KB, 800x600px
>>60434361
How do I learn this sorcery?
>>
>>60434364
> CIA niggers are glowing in the dark
What the fuck, Terry?! HAHAHAHA
>>
>>60434333

>it has the comfiest syntax by far.
Map<String,Integer> myMap = new HashMap<>();
myMap.put("foo",1);
myMap.put("bar",2);
myMap.put("baz",3);
myMap.put("qux",4);
...

It is impossible to be terse in Java.
>>
>>60434305
oh yeah, forgot about those. why do they run like shit then?
>>
>>60434339
Well fuck that shit. So how do I compare two floats?
>>
>optimization in cpp
>not just writing your own asm injections with compiler flags for different platforms
>>
File: tad.png (54KB, 560x176px) Image search: [Google]
tad.png
54KB, 560x176px
>>60434442
terry is unphased by jim's internet celeb bs
>>
File: 1467149580111.jpg (11KB, 240x240px) Image search: [Google]
1467149580111.jpg
11KB, 240x240px
>>60434364
>retard with video game avatar picking on a guy who wrote his own functional OS for having a mental disorder
>>
>>60434484
Determine what kind of precision you want and test if your value is close enough.
>>
>>60434461

template <class E, class = std::enable_if_t<is_expression_v<E>>>
inline auto operator!(E&& e) -> not_expression<make_expression_result_t<E>> {
return {make_expression(::std::forward<E>(e))};
}

template <class E, class = std::enable_if_t<is_expression_v<E>>>
inline auto operator*(E&& e) -> zero_or_more_expression<make_expression_result_t<E>> {
return {make_expression(::std::forward<E>(e))};
}

template <class E1, class E2, class = std::enable_if_t<is_expression_v<E1> && is_expression_v<E2>>>
inline auto operator|(E1&& e1, E2&& e2) -> choice_expression<make_expression_result_t<E1>, make_expression_result_t<E2>> {
return {make_expression(::std::forward<E1>(e1)), make_expression(::std::forward<E2>(e2))};
}

template <class E1, class E2, class = std::enable_if_t<is_expression_v<E1> && is_expression_v<E2> && !(is_terminal_v<E1> && is_terminal_v<E2>)>>
inline auto operator>(E1&& e1, E2&& e2) -> sequence_expression<make_expression_result_t<E1>, make_expression_result_t<E2>> {
return {make_expression(::std::forward<E1>(e1)), make_expression(::std::forward<E2>(e2))};
}

template <class E, class = std::enable_if_t<is_expression_v<E>>>
inline auto operator<(E&& e, semantic_action a) -> action_expression<make_expression_result_t<E>> {
return {make_expression(::std::forward<E>(e)), ::std::move(a)};
}

template <class E, class = std::enable_if_t<is_expression_v<E>>>
inline auto operator<(E&& e, syntax_action a) -> capture_expression<make_expression_result_t<E>> {
return {make_expression(::std::forward<E>(e)), ::std::move(a)};
}


Oh wow nice one pajeet you sure showed me.
>>
>>60434544
dumb frogposter
>>
>>60434484
https://www.wikiwand.com/en/Machine_epsilon

https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
>>
File: code.png (3KB, 276x107px) Image search: [Google]
code.png
3KB, 276x107px
>>60434550
I just did some Googling and this is what I came up with.
>>
>>60434463
legacy codebases along with moving away from c++ in favor of scripting languages

games that use the frostbite engine run better than most in my experience, but most of the games using it aren't worth playing.
>>
>>60434555

I didn't know Java supported metaprogramming.
>>
>>60434580
Yup, that's how you do it.
>>
>>60434364
isn't that the voice of the guy who used to post videos under "Internet Aristocrat"?
>>
File: 1444688084522.png (998KB, 1631x705px) Image search: [Google]
1444688084522.png
998KB, 1631x705px
>>60434463
please, don't say that. Today game engines are truly amazing.

https://www.youtube.com/watch?v=tqtxdUpo3mk
>>
>>60434637
yes
>>
>>60434580
>>60434603

No, dont use custom constanst and stuff, use the std, good praxis.

http://en.cppreference.com/w/cpp/types/numeric_limits/epsilon
>>
I know a little bit of c++. I want to learn SQL(i know nothing). How do i implement it in c++? Where should i learn DB from scratch?
>>
>>60434851
Build a parser first.
>>
where is the new thread
>>
>>60434851

please learn to normalize your databases
>>
>>60435017
i use arround 3 db limiter, it is very efficient and good, with just a little compression before it.
>>
>>60435165
new thread
>>
File: 1465277555529-0.jpg (84KB, 782x1080px) Image search: [Google]
1465277555529-0.jpg
84KB, 782x1080px
>>60430075
Jew detected
Thread posts: 338
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.