[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: 330
Thread images: 23

File: dpt_fortran.png (143KB, 1000x1071px) Image search: [Google]
dpt_fortran.png
143KB, 1000x1071px
What are you working on, /g/?

Old thread: >>58354286
>>
>>58361105
a software to tell a person if they need to buy eggs or milk
>>
File: 1475143072125.jpg (15KB, 448x283px)
1475143072125.jpg
15KB, 448x283px
Thank you for using an anime image!
>>
>>58361139
I wish anime fags would trip so we could filter them.
>>
>haven't done any programming before
>need to learn C for future university module

What do you guys suggest?
>>
>>58361157
It's 4chan, so if you want to filter out anime, just block this "anonymous" guy

Fucking anime posters, i swear
>>
>>58360921
my job is 100% .Net, but i'm bored out of my mind with it.
>>
>>58361164
Start with C Primer Plus from Stephen Phaggot. He actually does a good breakdown on compilation and computer program execution and memory, he'll teach you a good bit before you'll start to get diminishing returns (around where he devolves into copy pasting the GNU explanations for the standard library). Don't read K&R C until you know what is and isn't safe in C since they use a hell of a lot of practises you shouldn't.
>>
>>58361105
Nailed it
>>
>>58361164
Just learn the basic of C, it ain't that hard, ask in class for the finer details.
The nerds here will recommend reading "The C Programming Language" by Brian Kernighan and Dennis Ritchie, also know as K&R, which is terrible advice for a beginner, so don't follow that lead.
The biggest trouble you'll face will probably be setting your compiler, nothing ever touches on this well enough.
>>
Yeah, Ocaml really is the best lang.
>>
>>58361235
it's really good
>>
>>58361209
>>58361233

Thanks for the suggestions anons.
>>
>>>58361233
>>58361209
this advice is excellent
>>
>>58361229
Saved.
>>
>>58361261
Yeah, don't use an IDE to start with, do you have Linux installed? Because if you do, learn how to compile with GCC and the flags it uses before anything else. Then GNU Make, to automate your build process. If you can't install Linux normally, a virtual machine would do fine.
>>
>>58361304
Yeah, and you also should absolutely install Gentoo.
By the way have you heard of Richard Stallman and the Good Word?
>>
>>58361368
I have come to preach to you the holy church of GNU Emacs.
>>
>>58361229
Hideous. Is this Go?
>>
>>58361379
I don't think Go has pattern matching
>>
>>58361379
Is this bait?
>>
>>58361209
>>58361304

>>58361368 (cont.)
So whatever you do, don't listen to these clueless Linux nerds. Blind man leading the blind and all that. That's the best advice I can give you.
>>
>>58361409
Not an argument.
>>
Web dev thread died, so im asking my PHP question here....pls no bully.

If I start a SESSION on a successful isset() function, does it get unset and/or destroyed automatically if the submit button is NOT set? (as in the user hasn't clicked that submit button yet or they click another submit button.)
>>
>>58361209
C Primer Plus vs C Programming: A Modern Approach?
>>
>>58361379
 W         
O
L
F
R L
MATHEMATICA
M N
G
U
A
G
E
>>
>>58361417
It's fucked that I can't tell if this an utterance of an agreement like in a conversation, or is this a nerd complaining of some logical fallacy.
If you're complaining, fuck you, the rhetorical ad hominem is a normal conversational device. If not, sorry, you're cool.
>>
>>58361447
I haven't read the latter, but it looks like it's alright from a quick search.
>>
>>58361127
>>
>>58361503
Damn it, everyone seems to have read either one but not both so there's never a comparison.
>>
>>58361515
I would say the most important thing to learn immediately is how compilation works. If the book does not race into C programming and hello world but instead takes a moment to touch on how that actually translates down to a set of executable instructions, then it's probably a good book for you to start on.
>>
>>58361447
Get both. In my experience the contrast of two books brings about valuable learning opportunities and leads you better to ask questions by yourself.
>>
>>58361547
But which to read first?
>>
>>58361511
cant you connect to the url https://www.google.ca/#q=your search here
>>
http://pastebin.com/5JpkMyjh

                                                      d      
( o
y n
o '
h e r e ' s t h e a c l i i f y o u w a n t i t
)
>>
>>58361558
I've been programming since the small days so neither.
Just conflate lots of sources in your learning (books, video, google) and try to make it as organic as possible, and you should be fast set.
>>
>>58361432

nevermind i think i got it....so the session gets UNSET but not DESTROYED....
>>
>>58361637
If I had any smaller penis I'd call this dialectic pedagogy, but hell, it's worked for me.
Guys in slacks and hoodies working for snapchats call it autodidactism. I just call it the concept of self-teaching with a penchant of curiosity, which is both easy, cool and fast.
>>
File: worried-man-laptop-26452858.jpg (109KB, 1389x1300px) Image search: [Google]
worried-man-laptop-26452858.jpg
109KB, 1389x1300px
I'm writing my thesis (I'm studying CS) and I have twenty minutes until deadline. I need like hour and a half to finish it and I hope I won't be fucked for uploading it after midnight.
>>
>>58361755
Dude just submit tomorrow when it's done.
Those guys are able to bend their backs a bit.
If they don't just write a spicy viral medium post how they suck and revel in the job offers.
>>
>>58361755
Ask for an extension. If you ask up front and have a good reason then professors can and will extend. They do it all the time for their research paper submissions too.

Just don't make a habit of it.
>>
>>58361755

ive done that before, you'll probably lose a few points for turning it in late....the system did that automatically for me...
>>
>>58360235
>>58360170
>>58360164
>replying to pasta that is not even board specific
I want normies to leave.
>>
I like this dpt. Cool, calm and professional.
>>
>>58361839
Here's a piquant carbonara for you: Go stick your dick in a toaster oven. Sorry some people have jobs instead of keeping up with latest ''pastes'' and ''memes''.
>>
>>58361611
thanks saved
>>
>>58361888
why do you save it?
>>
>>58361883
>Go stick your dick in a toaster oven.
this seems like bad advice
>>
>>58361795
I won't upload unfinished thesis, I'll finish it anyway and hope for the best.
>>58361801
I have to write a paper for this and I cannot do it until monday.
>>58361810
At this point I'm so tired of this university that I just want to pass. Good grades aren't important for me now.
>>
>>58361911
Eh, the worlds just a big panini.
>>
>>58361937
thesis about what?
>>
>>58361953
Computer
>>
File: daaas.png (38KB, 736x1030px) Image search: [Google]
daaas.png
38KB, 736x1030px
>>58361953
>>
>>58361996
Nigga I think you have an encoding problem.
(what school? I'm looking for an uni)
>>
>>58361996
you have posted in /dpt/ before right?

i think i remember you
>>
>>58361996
Why don't they just rename it "App Science"
>>
>>58362046
"App Science"
"Bridge Science"
"Number Science"
Yeah I like your style.
>>
>>58362046
I picked topic that looked the easiest.
>>58362024
I do not live in Burgerland.
>>58362034
Yeah, I did. Some people helped me with few issues I had.
>>
what's the difference between measuring and benchmarking?
>>
>>58362085
>Bridge Science
Engineering?
>Number Science
Math?
>App Science
Apple?
>>
>>58362113
>I do not live in Burgerland.
What?
>>
>>58362157
he does not live in United States of America
>>
File: Untitled.webm (2MB, 960x1040px) Image search: [Google]
Untitled.webm
2MB, 960x1040px
>>
>>58362157
>(what school? I'm looking for an uni)
That.
And I don't have encoding problem. Thesis must be put in folders, that have holes in weird shapes, so everything on this page looks crooked. Don't ask me why they made folders like that.
>>
>>58362184
Pretty neat, but needs some tweaking.
>>
>tfw you want /fpt/ to succeed so you keep bumping it and delaying your responses an hour but it's been two days since the thread started and you have to sleep eventually
>>
>>58362210
pretty sure we agreed to let it die until there's another break again
>>
>>58362210
That's pretty complicated tfw.
>>
>>58362203
>improving perfection

ok, maybe a few tweaks would be nice, but the code doesn't write itself. not yet anyway.
>>
>>58362167
>>58362187
Oh, I was just was asking if it was a good school to apply to as I'm an EU national.
The encoding bit was an easy joke about ASCII character sets.
>>
>>58362261
I wouldn't recommend mine, which is PWr. Try EPFL if you're smartass.

Like real smartass, because passing exams there means getting at least 75%.
>>
>>58362294
Thanks bud.
>>
>he uses an IDE
>>
>>58362538
Sweet, sweet times when I could actually use IDE in what I'm doing.
>>
>>58362557
pajeet
wat happen u??
>>
>>58361233

>The biggest trouble you'll face will probably be setting your compiler, nothing ever touches on this well enough.

Linux: You should already have it installed. Otherwise, use your package manager to get gcc

Windows: Look up "TDM GCC". This is a simple stupid setup of MinGW-w64, or GCC for WIndows. Install it to the default installation directory, then go into control panel and modify the PATH environmental variable to include the bin\ directory underneath that TDM GCC folder. Now open up a command prompt or powershell, and type gcc --version. If you don't get some nonsense about a missing command, you have a compiler.

Mac: I can't fucking remember. You need to install XCode tools or some shit.

Using this shit:

# Compiles a single file, produced a.out or a.exe, depending on platform
gcc whatever.c

# Saves you the trouble of renaming the file afterwards. The "o" stands for "Output", or what the outputted executable should be named.
gcc whatever.c -o whatever.exe

# Produces object file without linking. The -c stands for "compile", with the meaning that it should ONLY compile. There is also -S, for aSsemble, meaning that it should ONLY produce assembly.
gcc whatever.c -c

# Specify that we want to use the C11 STandarD, instead of something else.
gcc -std=c11 whatever.c

This isn't really that hard of shit to learn, and most of these can be gleamed from just --help, rather than reading a full manpage.
>>
>>58362624
It's Ethan from h3h3.
>>
File: embroidery.png (487KB, 472x635px) Image search: [Google]
embroidery.png
487KB, 472x635px
http://www.strawpoll.me/11767105/r in hindsight, is this accurate?
>>
>>58361379

This could be Mathematica. It's hideous, indeed.
>>
>>58362738
>http://www.strawpoll.me/11767105/r
Swap C with C++ and yes.
>>
File: 1483732420062.png (25KB, 437x350px) Image search: [Google]
1483732420062.png
25KB, 437x350px
sugoi sugoi
>>
>>58362769
http://www.strawpoll.me/11767097/r this is the poll I did on /lgbt/. Does it fit you better? maybe you're trans.
>>
>>58362769
>C++
Epic meme, mate.
>>
>>58362738
>not using an oxford comma

You dun goofed.
>>
>>58362753
                                i                              
y
d o
t r y i t i n y o u r f a v o r i t e l a n g u a g e
r
e
>>
>>58362826
n o
o
>>
>>58362815
I'm against the oxford comma. I think that while it might be practical, it isn't very proper or ladylike.
>>
>>58362858
                              b          
i
t n
c i
t h a t ' s w h a t i t h o u g h t
g
a
>>
>>58362815
No that'd be

"we invited the strippers; jfk and stalin."
>>
hey /dpt/ very novice programmer here. I've written a Python script which needs to iterate through something a shit load of times and it's fucking slow, but it's only using < 1% of my CPU according to task manager. Is there anyway to force it to max out the core it's running on to make the script run faster?
>>
>>58362679
>gleamed from just --help, rather than reading a full manpage
Sure, but when you actually need a flag deep within the functionality of GCC, scouring the man page is a pain in the fucking ass
>>
>>58362919
your program is probably very inefficient. there are ways to use multiple cores of your computer, but that would probably 1) wouldn't help much and 2) is more difficult than fixing your current solution to be more efficient
>>
>>58362919
What is the scale, and how slow are we talking? Unfortunately Python is not the right tool if you want to maximize your CPU efficiency, as the language was designed to prefer single threaded execution (look up GIL).

But post your code and we can help you easier.
>>
Tell me which NN idea i should make first.

A NN that sharpens images
or
One that tries to fill gaps in images(Content aware fill)
>>
>>58363146
2nd
>>
>>58363146
content aware sounds cool, post results
>>
>>58363020
>>58363051
It's a very simple script. I'm looking to put together a time lapse from a webcam that uploads images to a website with a url being its time stamp. Only the current image is displayed however so my program essentially cycles through time stamps downloading the image if there is one there.

I understand that it's only going to be single threaded, but it's using only a fraction of a single thread from what I can tell.

import urllib.request
url='placeholder.com/webcam/'

for i in range(20140000000000, 20170000000000):
try:
urllib.request.urlretrieve(url+str(i)+'.jpg', str(i)+'.jpg')
except urllib.error.HTTPError:
continue


Currently does about 1000 iterations per minute.
>>
>>58363217
io bound

no fix
>>
>>58363171
>>58363191
Hmm, I'll have to get OpenCL up and running then, would be a pain to do it on the CPU haha
>>
>>58363284
caffe has an opencl branch i think
>>
>>58363339
Torch does too, but it's not complete.
>>
>>58363217
>>58363249
IO bound tasks in python is actually the only good target for concurrency. Your program can be easily sped up a ton by using either thread pools from the multiprocessing module, or using the asyncio module. Though they both are a bit convoluted to get into as a beginner.
>>
Thoughts on clojure.spec?
>>
>>58363217
http://stackoverflow.com/questions/31784484/how-to-parallelized-file-downloads
>>
What is a code of conduct and why is it important that my project have one?
>>
File: dpt-poll.png (13KB, 660x249px) Image search: [Google]
dpt-poll.png
13KB, 660x249px
Reminder
>>
58363697
Nobody finds your incessant fucking shitposting and forced memes funny.
>>
File: 1460409311215.png (365KB, 720x527px) Image search: [Google]
1460409311215.png
365KB, 720x527px
I use code::blocks

Shit on me all you want
>>
>>58363697

skikkeleg episk megmeg anon, bravo
>>
>>58363697
>Norwegians are faggots
who knew
>>
>>58363757
>>
File: norgeshjælpen.jpg (28KB, 327x427px) Image search: [Google]
norgeshjælpen.jpg
28KB, 327x427px
Verdens bedste land.

Sådan betegner de fleste nordmænd stolte deres latterlige olie-diktaturstat. For at få mad på bordet til jul, er millioner af nordmænd nodt til at stå i ko efter ribbenssteg helt fra slutningen af oktober som i Osttyskland under kommunismen.

Socialistregeringens fodevarekommissærer har nemlig besluttet, at uanset voldsom mangel på ribbenssteg, forbliver importskatten så hoj, at det ikke kan betale sig for danske slagterier bare at prove på at levere en enkelt lille ribbenssteg til fjeldlandet. Det fortalte slagterierne sidste år.

Da var der også fodevaremangel i Norge.

Ikke nok dermed. Der er også så voldsomt mangel på smor, at det nu handles på Den Sorte Bors til 600 kr pr. kg.!

I titusindevis af nordmænd er nodt til at rejse til nabolandene og KOBE MAD IND!

Norge = DDR!
>>
>>58363934
WALL WHEN
>>
>butthurt swedes and danes
>>
>>58364055

It's 2.30 am in CET...
>>
>>58364074
So?
>>
Who /math/ here? Anyone do any Matlab/Mathematica/Magma/etc. programming?
>>
>>58364230
I've heard Matlab is popular in finance
>>
File: dick-cheney-mtp-1200.jpg (234KB, 1200x797px) Image search: [Google]
dick-cheney-mtp-1200.jpg
234KB, 1200x797px
>>58363697
>>58363889

>oil rich posting

go ahead, tell me more
>>
>>58364281
>dat insecurity
>>
If your language doesn't have strong, static typing then it's not a real language, it's a babby toy.
>>
>>58364230
>Can't even learn Lua or Python for Torch or Tensorflow

Why live?
>>
Working on a 3D cheese pizza MMORPG on WebGL
currently working on networking using WebRTC, why doesnt websocket do peer 2 peer?
>>
>>58364412
Well, it's not like you have written a single piece of useful software with your manly man language, so how are you any different ;)?
>>
>>58364420
Never heard of Torch or Tensorflow, but I always found Python/C to be sufficient. I think Sage uses Python for scripting.
>>
Is C++ Primer Plus any good?
>>
>>58364230
i would like to find time to help out sage. i don't love python but i think it's important to have open software for mathematics
for my own work macaulay2 usually suffices. it's specialized and kinda quirky
>>
>>58364460
Torch and TF both are fully fledged sci-compute, ehm, kits that can be scripted by Lua and Python respectively.

Data loading, serialization, machine learning, tensors, graphing etc.
>>
>>58364379
sorry bro
>>
>>58364501
I wish I could help out Sage too, but I'm just a shitty programmer.
>>
>>58364452
>cheese pizza MMORPG
What did he mean by this?
>>
>>58364542
You work as a pizza delivery man, compete with other pizza places, upgrade your roller, fuck hotties as payment etc.
>>
>>58364565
this, you can even add precocious peaches on your pizza etc
>>
>>58364542
>>58364565
actually i read online it's about occult jewish pedofilia
>>
File: good.png (78KB, 194x257px) Image search: [Google]
good.png
78KB, 194x257px
>when you change your abstraction from multidimensional heterogeneous vectors to a single homogeneous, contiguous array

Premature optimization and it feels AMAZING
>>
>>58363934
I faar ikke vores grissebasser, nordmaend.
>>
>>58364687
DELET
>>
>>58364688
i mean that just sounds being plain sensible?
>>
>>58364722
I don't know. In Scheme it's rare to use arrays.
>>
What makes /g/ hate C++ So much?
>>
>>58364956
It's shit.
>>
>>58364991
I'm learning C atm and thinking why I wouldn't learn C++ instead if can do the same stuff as C. Why it is shit.
>>
>>58364956
It's not very good and the only defence for it is popularity, which is a fallacy. Soooo...
>>
Since the C standard states that an 'int' is supposed to be "at least 16 bits", a statement like this

for (int i = 0; i < 1000000; ++i) { ...

is wrong since 1000000 is too large to be expressed with 16 bits, right?
Or is the statement correct if I do an integer overflow check above it?
>>
>>58365035
Ehhh, the popularity defence does kind of hold water for programming languages, at least indirectly. Popularity = more support and more libraries.
>>
Anyone know of an alternative to Kivy in Python that works with touch screens?

I have an HDMI touchscreen attached to a raspberry pi but Kivy doesn't seem to detect my touches.
>>
>>58365033
Just people trolling mostly. Honestly don't believe most of /g/ says.

All programming languages can "do the same things", it is more how you go about doing those things. If you know C, you don't know C++, and if you know C++ you don't know C because you go about solving problems different ways, even if there is some superficial similarity in syntax.
>>
>>58365064
And more jobs.
>>
>>58363845
Me too.
>>
>>58363934
>>58364694
Is this Skyrim?
>>
>>58365033
c++ is the most semantically complex language there exists.
learning c first is educationally far far better idea.
>>
>>58365064
Everyone should know it for jobs, but it doesn't make it a good language.
>>
>>58365135
I didn't say that being popular makes it a good language. It might make it worth knowing in spite of being a bad language.
>>
>>58365117
yes, but not shit
>>
>>58365131
like no shit i give you 10 years to master c++, after 3 to master plain c.
it's a shit heap of extensions to a language from the early 70s that used to be a "portable PDP assembler"
>>
>>58365131
Can I say that I have learned C If I know the stuff you find from every "C basics tutorial" on the internet or should I go even further with C?
>>
>>58365180
can you write, in theory, a compiler for C? and can you decipher the standard text, even if slowly?
>>
if

provincies={'Zeeland','Noord-Holland','Flevoland','Groningen','Noord-Brabant','Friesland','Overijssel','Gelderland','Zuid-Holland','Drente','Zuid-Limburg','Utrecht'}
hoofdsteden={'Middelburg','Haarlem','Lelystad','Groningen','\'s Hertogenbosch','Leeuwarden','Zwolle','Arnhem','\'s Gravenhage','Assen','Maastricht','Utrecht'}


and you put following in console:

provincies - hoofdsteden


why does it print

 {'Gelderland', 'Zeeland', 'Zuid-Holland', 'Friesland', 'Noord-Brabant', 'Drente', 'Overijssel', 'Noord-Holland', 'Flevoland', 'Zuid-Limburg'}
?

It doesn't copy from the list, nor does it sort in alphabetical order. It's just complete random.
why does it do this?
>>
>>58365050
use int32_t
>>
>>58365251
i have a feeling your example could be cut down somewhat
console of what
>>
>>58365251
provincies={'A','B','C'}
hoofdsteden={'D','E','F','A'}

print provincies - hoofdsteden


prints
set(['C', 'B'])

because C and B are not in hoofdsteden. its the difference after all
>>
>>58365238
to be honest, programming languages, as they are now, are a mistake.
we would be much better off, as the human race, banging out scripts for rule engines designed by a technocratic cabal.
but i rather like what is now.
>>
>>58365309
narrowed down a bit here >>58365330

It's still in random order, and I don't understand why. what's the point?
I always thought it either would print literally or sort it.
>>
File: Package failed.jpg (123KB, 460x900px) Image search: [Google]
Package failed.jpg
123KB, 460x900px
Installing pic related for learning purposes following along with a C++ book, will I need any of the failed packages or can I ignore them?
>>
>>58365374
>Azure
no
>Visual C++ Redistributables
maybe, try building and running a simple C++ console applicaiton
>>
>>58365370
sets -- in python and in math -- aren't ordered
>>
>>58365370
They are not randomly ordered, they are arbitrarily ordered. It means you should not count on the order of insertions being maintained as the actual internal implementation details determine the order instead.
>>
is the c programming language ansi a good book to read for a guy who wants a fast read to be able to develop actually useful(ie not just comp sci exercises) things as soon as possible?
>>
>>58361105
why is there no
stupid_dataframe.drop_fucking_everything()

for a numpy dataframe? All I want is to have the dataframe empty before filling it again...
>>
File: A5.jpg (170KB, 1592x848px) Image search: [Google]
A5.jpg
170KB, 1592x848px
>>58365396
I'm gonna guess this means the redistributables need to be reinstalled?

Also maybe it's because I'm not used to C++, I only tried C# prior but, I get a "This project is out of date" debug win32 message on everything I try to build.
>>
>>58365475
>>58361209
absolutely not, see >
>>
>>58365681
thanks. I found the c primer plus pdf.
I have no problem reading the 800 pages, but will I be wasting my time reading cover to cover? Should I just read certain sections? Or should I just power through it, balls to the wall, hundred pages a day.
>>
This thread is pathetic. It is not about programming. It's just a bunch of computers illiterates and first semesters memeing about whatever they just learned.

A quick search shows that most arguments used here are not original and have been copied from some trendy tech blog or other shit site.

The only real programming questions I have seen so far are from beginners(it's fine to be a beginner btw).

This entire site is shit and I don't know why anyone would regularly come here.
>>
>>58365932
me too thanks
>>
>>58365938
you are welcome
>>
Why, WHY does this always happen, my application could have been like 5 functions in a while loop, instead I made a modular multi-purpose library, that's taken like 6x what it could have originally.
>>
>>58365988
This is what happens when you fall for the OO meme.
>>
>>58365988
Premature abstraction is at least as bad as premature optimization. Abstract as if you're a compression algorithm - if you see something being duplicated (or you absolutely know it will be duplicated) then you abstract, not before.
>>
wow did u just assume my implementation?
>>
>>58366051
Yeah, but then again, abstracting away absolutely everything looks very neat, so IDK, it's probably worth it.
>>
Fucking ree. Python update killed vim plugins for me, my work flow is dead.
>>
>>58365988
If you can use it later and if you're extending your lib later then it could easily worth it.
>>
>>58366186
Are you on Arch?
>>
>>58366314
Yep, already found out about the issue it just annoys me. Probably fixed in the next 24h though.

https://bbs.archlinux.org/viewtopic.php?id=221579
https://bugs.archlinux.org/task/52401
>>
File: 1482287377939.png (480KB, 600x849px) Image search: [Google]
1482287377939.png
480KB, 600x849px
>>58364230
Resident Mathematica shill here
>>
>>58364230

Proprietary garbage. Just use fucking R or Python. Both have plenty of heavy math libraries that will do just about whatever you need.

>>58364792

Arrays/vectors should always be the primary data structure of choice, with linked lists only used when no other data structure would be reasonable.

>>58365374

Bruh, just installl GCC. It just werks.
>>
>>58366186
>>58366314
>>58366378
that's the arch linux meme for you, a show in three acts
>>
>>58366655
Yeah, but first time it's actually happened to me and it's not critical. If I really wanted I could just revert the update but I cbf when it's probably going to be fixed in the next day.
>>
>>58366670
No shit, I was first giving you a hard time, but turns out everything worked out in the end and Linux is actually good?
Fucked up. Maybe I should install Arch...
>>
>>58366741
Unironically install Gentoo. At least it has fucking stable and testing branches. Arch is like programming a huge project without version management.
>>
>>58366741
>>58366847
Or just install Ubuntu so you have a functioning system that doesn't make you look autistic.
>>
>>58366847
Arch has documentation, unlike Gentoo. I have little time for fixing nonsense bullshit.
>>58366866
I already have MacOS.
>>
>>58366866

It is quite possible to make Ubuntu look autistic as fuck. But I will agree on it being better functioning. And if one wants bleeding edge packages, that's what the ppa repos are for. Alternatively, just use Debian unstable.
>>
>>58366866
Ubuntu is actually not very stable from my experience. I'd still be on Debian, if not for the laptop driver issues.

>>58366895
>Arch has documentation, unlike Gentoo
>unlike Gentoo
Now I know you're full of shit. Both distros have great documentation.
>>
why should I use clang instead of gcc and why should I use gcc instead of clang?
>>
>>58366915
Personal preference.
>>
>>58366911
I've never heard anyone complement Gentoo documentation, unlike the popular opinion on Arch's , which seems to be always good.
I have no horse in this race.
I certainly would use FreeBSD on desktop if it was more supported, but I'm no Don Quixote.
I'll probably end up installing Fedora and not giving a shit.
>>
>>58366979
Just because there aren't hordes of autists shouting it from the rooftops does not mean Gentoo does not have good docs.
>>
>>58366915
1. clang has far better error diagnostics and less autistic developers
2. have you ever seen the gcc source?
>>
>>58367008
Well throw me a link and I'll reconsider.
>>
x = {
f = function( a )
print( a )
end
}

y = setmetatable( {}, {__call = x.f})
y( 10 )


This prints:
> table: 0xec2730

Que?
>>
>>58367048
First thing that came to mind https://wiki.gentoo.org/wiki/AMDGPU
>>
>>58366915

>clang
Compilation speed, quality of error messages (less of an issue with very recent versions of GCC). Necessary if for whatever reason you need LLVM IR.

>gcc
Performance, some GNU extensions that might not exist in Clang.
>>
>>58367062
ah, weird, .__call sends the caller table as the first argument
>>
Can someone explain to me what is .NET?
It´s a framework only for windows?
What's '.net core', 'xamarin' etc.
>>
>>58367257
it's some shitty thing that lets Microsoft write one standard library for a bunch of different languages
>>
>>58367257

.NET is a combination of a runtime (the Common Language Runtime), supporting a bytecode standard (Common Intermediary Language), and a standard library of classes (the Framework Class Library) supported by all languages that target said runtime.

Thought it was originally supported only on Windows, this quickly became not the case at all thanks to Mono, which was an unofficial, free as in freedom implementation. The guys that made Mono then proceeded to make a framework for making cross-platform applications called Xamarin, so as to make it easier to develop mobile and desktop applications using .NET. It originally cost a bit of money to use this framework though, so Microsoft bought it and made it free.

.NET Core is another free as in freedom cross-platform implementation of .NET made by Microsoft. It isn't quite up to snuff for features compared to the original .NET Framework, so DLLs compiled for one won't run in the other, but it is nonetheless a decent tool for making cross platform .NET applications.
>>
File: hereyougo.gif (88KB, 10000x10000px) Image search: [Google]
hereyougo.gif
88KB, 10000x10000px
I have the following code to return the shortest path on a multidimensional array from top left corner to bottom right corner, with the option of removing one of wall cells (marked with '1') by changing its value to '0'. My approach is to make a list of removable walls and then by removing them one at a time in a loop, do a BFS search for the shortest path. At the end, I return the shortest path overall.

I have the following code that works. However, when I put my code in the online interpreter, I have a timeout error. Is there anything I can do to make it faster?


http://pastebin.com/qwAyrcn6
>>
>>58367537
from collections import deque

class Queue:
def __init__(self):
self.items = deque()

def isEmpty(self):
return self.items. == []

def enqueue(self, item):
self.items.append(item)

def dequeue(self):
return self.items.popleft()

def size(self):
return len(self.items)

def memodict(f):
""" Memoization decorator for a function taking a single argument """
class memodict(dict):

def __missing__(self, key):
ret = self[key] = f(key)
return ret
return memodict().__getitem__

@memodict
def adjacent_to((maze_dim, point)):
neighbors = (
(point[0] - 1, point[1]),
(point[0], point[1] - 1),
(point[0], point[1] + 1),
(point[0] + 1, point[1]))

return [p for p in neighbors if 0 <= p[0] < maze_dim[0] and 0 <= p[1] < maze_dim[1]]

def removable(maz, ii, jj):
counter = 0
for p in adjacent_to(((len(maz), len(maz[0])), (ii, jj))):
if not maz[p[0]][p[1]]:
if counter:
return True
counter += 1
return False
>>
>>58367570
part 2/2
def answer(maze):

path_length = 0

if not maze:
return

dims = (len(maze), len(maze[0]))
end_point = (dims[0]-1, dims[1]-1)

# list of walls that can be removed
passable_walls = set()
for i in xrange(dims[0]):
for j in xrange(dims[1]):
if maze[i][j] == 1 and removable(maze, i, j):
passable_walls.add((i, j))

shortest_path = 0
best_possible = dims[0] + dims[1] - 1

path_mat = [[None] * dims[1] for _ in xrange(dims[0])] # tracker matrix for shortest path
path_mat[dims[0]-1][dims[1]-1] = 0 # set the starting point to destination (lower right corner)

for wall in passable_walls:
temp_maze = maze
if wall:
temp_maze[wall[0]][wall[1]] = 0

stat_mat = [['-'] * dims[1] for _ in xrange(dims[0])] # status of visited and non visited cells

q = Queue()
q.enqueue(end_point)

while q:
curr = q.dequeue()

if curr == (0,0):
break

for next in adjacent_to((dims, curr)):
if temp_maze[next[0]][next[1]] == 0: # Not a wall
temp = path_mat[curr[0]][curr[1]] + 1
if temp < path_mat[next[0]][next[1]] or path_mat[next[0]][next[1]] == None: # there is a shorter path to this cell
path_mat[next[0]][next[1]] = temp
if stat_mat[next[0]][next[1]] != '+': # Not visited yet
q.enqueue(next)

stat_mat[curr[0]][curr[1]] = '+' # mark it as visited

if path_mat[0][0]+1 <= best_possible:
break

if shortest_path == 0 or path_mat[0][0]+1 < shortest_path:
shortest_path = path_mat[0][0]+1

return shortest_path
>>
File: the-challenge.png (68KB, 1000x312px) Image search: [Google]
the-challenge.png
68KB, 1000x312px
show me you sexy code!


write and properly document/comment a "Hello, World!" program in your favorite language.
>>
>add OOP to language
>muh encapsulation
>add friend keyword that breaks encapsulation
>all that bullshit boilerplate code for what amounts to a struct with public members
was C++ a mistake?
>>
>>58367643
KEK
These Faggots Couldn't Document Their Work Even If They Could Write Something That Worked.
>>
>>58367643
>document/comment
>"Hello, World!"
Are you simply retarded or are you one of those company retards with best practices? I guess they're the same though.
>>
>>58367643
(display "Hello, World!")
>>
>>58367701
i see you are unable to perform
>>
#include<stdio.h>


int main(void)
{

char c;

FILE *fileptr;

fileptr = fopen("testfile", "wb");
// a or b to discen between binary files and txt files
if (fileptr == '\0')
{
printf("file error");
}

putc('h', fileptr);
c = getc(fileptr);

printf("%c", c);


return 0;
}


Why isn't getc working?
>>
File: 1393645129610.jpg (87KB, 800x449px) Image search: [Google]
1393645129610.jpg
87KB, 800x449px
would you learn haskell before java or java before haskall
>>
>>58367643
// Hello world
"Hello world!"
>>
>>58367707
da fuq iz dis?
LISP?!
>>
>>58367714
Thanks, but I'm not allowed into the Special Olympics of programming.
>>
>>58367720
Learn Java, if you have no self-respect and direly need money.
Learn Haskell, if you have too much unfounded self-respect.
>>
>Be CS major
>Do well in class
>Graduate with honors
>realize school didn't teach me the skills I need to find a job

I feel FUCKING scammed
>>
>>58367716
are you sure have input in the first case?
>>
>>58367765
Didn't you do any projects in your free time?
>>
>>58367643
//entry point of program
public class HelloWorld {
//program initiated, run the following commands
public static void main(String[] args) {
// project "Hello, World!" to the terminal window.
System.out.println("Hello, World!");
//program complete
}

}
>>
>>58367748
underrated
>>
>>58367787
Interviewers were unimpressed with my flappy bird clone.
>>
>>58367765
yeah, guess they don't teach you "how to adult" in school, huh
>>
>>58367791
Holy fucking shit? Are those comments real?
>>
>>58367716
>FILE
disgusting
>>
>>58367767
What? There is input in the fie if that's what you're asking
>>
>>58367791
i wish everything was this dumbed down, would make learning a new language super fucking easy
>>
>>58363146
Make a classifier that determines if an image is ecchi or not.
Please I need one for my image collection.
>>
>>58367818
Yeah, except that almost all those comments are wrong.
>>
>>58367643
#include <iostream>
#include <string>
using namespace std;
class Greeter {
bool friendly = true;
public:
bool get_mood();
void impatient();
string purpose(bool);
};

bool Greeter::get_mood() {
return friendly;
};

void Greeter::impatient() {
if(friendly)
friendly = false;
};

string Greeter::purpose(bool mood) {
while(mood) {
cout << "Hello, World\n!" << endl;
impatient();
}
};

int main() {
Greeter shitp0st;
shitp0st.purpose(shitp0st.get_mood());

return 0;
};
>>
>>58367791
Stupid question, but why does main take arguments in C/Java? I've never seen it used for something.
>>
>>58367841
>Greeter shitp0st;
>shitp0st.purpose(shitp0st.get_mood());
lol
>>
>>58367854
string all the following in arguments in order of appearance unless order of hierarchy supersedes then use order of hierarchy
>>
>>58367537
>>58367570
>>58367584
Anyone?
>>
>>58367873
Sorry, what does that mean? Can you show an example?
>>
>>58367716
Seems like this board is actually useless
Guess I'll try reddit
>>
>>58366847
Arch has a testing and normal branch you fucking imbecile
>>
>>58367884
imagine a paper full of math prblems
you fee it into a machine that does the work for you
the main process is told to string all the stuff into one project (so it know all of what to do and when it is done)
do each problem in order (left to right, top to bottom) UNLESS order of operations dictates otherwise, (* comes before +)
>>
Can someone give a fun beginner exercise to do in Scheme? Just starting out.
>>
>>58367854

Command line arguments.
>>
>>58367884
what do you think happens here?
javac -version 

gcc --version 

g++ -std=c++11 butts.cpp -o butts.exe 


what do you think gets passed into argc/argv?
>>
>>58367931
I'm not sure...

>>58367910
What's an example of a simple program where leaving out those arguments changes its behavior?

>>58367925
How would that be used? Like for a calculator?
>>
>>58367917
fizzbuzz
dog breeding chart/recipes
random number generator
else; go see project euler
>>
>>58367944
>What's an example of a simple program where leaving out those arguments changes its behavior?
try running it without

it's just a heap of garbage unless it is organized by the rules
>>
>>58367925
ruby rooby roo!
>>
>>58367944
all commands are arguments i do believe
>>
>>58367944
>I'm not sure...
in java command line args get turned into a string array. In c/c++ they get turned into a number (of args) and a pointer (containing the args).

Write a program to echo command line args for practice.
>>
>>58367969
But I've run plenty of C++ programs without any arguments in main...
>>
>>58367904
Except everything gets pushed to normal only after two weeks of limited testing. That is not stable and tested by any margin.
>>
>>58367997
int main() just ignores command line args
>>
>>58367997
C and Java are old and OOP-ish
C++ is higher level and thus that crap is in C++ but it's hidden under the hood
>>
>>58366639
Linked lists are cool for prototyping, but in maturer version should be replaced asap, since they are fucking inefficient.

That said, they have their benefits. If nothing else there is a lot of functions in standard that work with them and it's easier to implement with them.

This is from common lisp perspective.
>>
>>58368013
Is that why I'm getting a compiling error for trying to put arguments into main in my C++ program? I wanted to echo the output.
>>
>>58367734
Scheme dialect of lisp yes.

It's elegant but too small for most of the real work. Try Racket or Common lisp instead.

Chicken Scheme is nice though, it works very well with c.
>>
>>58368044
idk, i'm not a C++ guy. sorry.
>>
>>58368044
#include <iostream>

int main(int argc, char *argv[])
{
for(int i=0; i<argc; ++i)
std::cout << argv[i] << std::endl;
}
>>
>>58367765
Well you seem to think that university is some sort of profession school... Luckily it's not.

>>58367818
Not really, it would make it way more tiresome. Imagine sorting through thousands of stupidest comments for one little kernel of knowledge.

>>58367917
Interpreters and virtual machines are rad. First try a stack based language (like forth, but simpler) and then a functional one.

My first bigger project in scheme was interpreter for stack based language with multiple stack and explicit manipulation of them. For example, you had input and output stacks, and you printed to screen by pushing to output stack. There were no variables and no functions, but you defined them instead by creating new stacks and pushing values/commands to these new stacks and evaling them.
>>
>>58368067
Thanks, I didn't realize I needed two arguments. Why is it separate? What is the purpose of each, and of main taking that info?
>>
I'm new to programming and I'm trying out the CS50 course from edx.org

The problem wants me to make a program that asks for user input and prints out the equivelant amount of bottles used.

the last line has been giving me problems. I'm trying to display the result of water * 12 but I just can't seem to get it to work. I've been stuck on this for 10 minutes now.

#include <cs50.h>
#include <stdio.h>

int main(void)
{
int water;
int result;
printf("How many minutes did you spend in the shower?\n");
water = get_int();
result = water * 12;
printf("You have wasted" "bottles of water!");

}
>>
anyone got a GOOD reference for learning databases and user uploads, user purchased content on Firebase?
>>
>>58368116
One is number of arguments given (argc) the other is array of arguments given (argv).
>>
>>58368127
I hadn't used c in decades, but you want to do this:

printf("You have wasted ~A bottles of water!", result);

Replace ~A with appropriate format character, i don't remember them.
>>
>>58368163
One last stupid question. The second is an array of characters, but when I print the first entry of the list, it's the entire input, not just one character. Why?
>>
wtf is CS50
>>
>>58368182
It's actually array of strings if i remember correctly.
>>
>>58368191
computer science 50 (not even 101)
basics introduction to programming
>>
>>58368191
Intro to CS at harvard

free online version
https://www.edx.org/course/introduction-computer-science-harvardx-cs50x
>>
test
>>
>>58368193
Isn't
char *argv[]

an array of characters? Also what's with the c & v?
>>
>>58368180

tried it with a few format characters.

all give me

>data argument not used by format string
>>
>>58368248

try %d
>>
is Alicia Vikander hotter as Ava (Ex Machina) or Heather Lee (Jason Bourne)???
>>
>>58368246

Well I don't really remember then. c is short for count (argcount) and for v i don't know anymore. I hadn't had to use c in years.
>>
>>58368274
i did.

i googled the format characters and tried %d.

i made sure to keep %d inside the one set of quotation marks like

 "niggers lynched : %d"
>>
>>58368246
It's an array of char arrays (c strings).
You can also see it written as
int main(int argc, char **argv)

probably Count and Values

>>58368311
poast code
>>
>>58368311
wow raciss much?
>>
>>58368321
Oh right, the star makes it a pointer, and the [] is what makes it a pointer of arrays. Thanks.
>>
>>58368321

This is his code:
>>58368127
>>
>>58368321
see
>>58368127


>>58368332
t. nigger
>>
I have a big fucking problem. I'm on Windows (inb4 >Windows) and my PATH variable has exceeded the max limit of characters, which is causing anything I add onto it to be truncated.

How do I fix this? I rely on tools that NEED to be in the path to work. What's worse, there's a bunch of garbage added to my PATH automatically by software that I ALSO need, but I guarantee it does FUCK ALL.

Every time I restart my PC, my mouse drivers add "C:\Program Files (x86)\Razer Chroma SDK\bin" and "C:\Program Files\Razer Chroma SDK\bin" to the VERY FRONT of my fucking PATH. Then Skype adds "C:\Program Files (x86)\Skype\Phone\". Then PhysX adds "C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common". If I could tell Windows to not let these garbage programs fill up my PATH, then I'd have enough space, delaying the problem for a little while.

Then I have about 600 characters dedicated to setting up Visual Studio command line building without having to run their shitty batch file for every cmd prompt. Now recently I was trying to install Apache Ant to build some asshole's Java project without having to install Eclipse, and my FUCKING PATH keeps getting truncated.

And it seems like it's a hard limit? So it doesn't matter how much fucking hard drive space I have, or how good my computer is, I've reached peak PATH length and Windows is such garbage I'm literally unable to fix this.
>>
>>58368381

install gentoo
>>
>>58368356
printf("You have wasted %d bottles of water!", result);
?
>>
>>58368381
sounds like win32 problem on an OLD af machine
upgrade yo shit nigga!
>>
>>58368127
printf("You have wasted %d bottles of water!", result);
>>
>>58368381
So this is how life is for a microdick cuck LOL?
>>
>>58368356
you know if it was for the contributions of african american scientists computers wouldnt even exist, right?
>>
>>58368422
Yeah, without niggers manning the sugarcane plantations we wouldn't have had paper-tape for the first computers
>>
>>58368381
>If I could tell Windows to not let these garbage programs fill up my PATH, then I'd have enough space
Yes, if only you could have an OS that didn't fill up your computer with bloatware.
>>
>>58368433
sure we would have. we'd have just used redskins rather than the darkies.
>>
>>58368415
>>58368399
What's with the f in printf? Why not just the Python
 
print

?
>>
>>58363697
>no absolute value of posters given, just percents
>>
>>58368443
Well, do you want to have the authentic nigga-paper or some cheap knock-off made by mexicans?
>>
>>58367172
It's not weird, it just sends explicit "this" pointer like, say, Python that needs "self" so you can refer to a specific instance (self.prop) rather than a generic shared variable (x.prop).
>>
>>58368451
Because it's not Python
>>
>>58368451
Because it's C. If I remember correctly f stands for formatted so printf is print formatted aka formatted print.
>>
>>58368299
Ava in my fantasies. but if i could get her IRL, i'd prefer Lee.
>>
>>58368470
But what does the f in C/C++ mean?

>>58368477
What happens if you just want a normal print? What does it add?
>>
>>58368469
Yeah, well maybe the fucking documentation could include a word about that lmao, but of course the demo there had a function without an argument, so I have to guess why my program doesn't work properly
>>
>>58368497
There is no normal print. Normal print is called puts which simply writes the string to stdout.
Printf means that it parses the unique format control characters such as %d,%f, etc.
http://www.cplusplus.com/reference/cstdio/puts/
>>
>>58368497
I guess I am to stupid not to be baited.

You can insert format characters into the string, like newline or tab or carriage return or bell, or specifiers for what to insert into it.

For example:
printf("Digit %d\n", 10);
%d will be replaced by 10 and \n with newline.

It's kinda similiar to chicken scheme printf and to common lisp format.
>>
>>58367841

This prints "Hello World\n!" an infinite amount of times. It also prints the ! character on its own separate line. This is not equivalent behavior to a standard Hello World program.
>>
>>58368505
This is because they probably used the : notation which implicitly adds self. As in:
function Class:method()
-- implicit self with :
end


vs
function Class.method(self)
-- explicit self with .
end
>>
>>58368415

>i had &d instead of %d

this is what i get for learning at 3AM and only getting 2 hours of sleep the night before.

im retarded, thanks.
>>
>>58368559
You're welcome. Yeah, I know that feeling, but it's not good for the brain, so you should get some sleep if you can.
>>
>>58368542
Nah, they just discarded the self (no argument function)
>>
>>58368299
she's too old for 4chan, plus no penis. non-furry.
she ain't getting no play here.
>>
>>58368524
>>58368515

Thanks. What if I want multiple variables to print? e.g.

printf( "Year: %d, Day: (???)", year, day)
>>
>>58361105
Anyone here programmed with nim?
https://en.wikipedia.org/wiki/Nim_(programming_language)
>>
>>58368568
i have to be up in 3 hours and gotta work all day by myself tomorrow(today)

if me = work
then
kill me
>>
what the flying fuck is the purpose of the underscores in lua? my best guess is that the ellipses represents a set of variables (knowable only to the caller) and that the underscores are for variables the function doesn't give a shit about but has to pattern-match. so in this case the function would care only about the seventh parameter passed in and assign it to local variable mU. am i close?

function(...)
local _,_,_,_,_,_,mU = ...
--stuff
end
>>
>>58368537
No, only once because impatient() toggles the bool controlling the while loop.
>>
>>58367944

>How would that be used?
Well, for a hypothetical command line calculator called calc, one might run it like
calc 1 + 1

from the command line, and the arguments would be "1", "+" and "1" in order. In C, the name of the program is also passed in as an argument that comes before everything else.
>>
>>58368600
What language is this?
>>
>>58368593
Use the same format character.

Format characters are different based on type to be inserted (one for integers, one for floats, ...). Arguments are inserted in order.

So, if both are ints:
printf( "Year: %d, Day: %d", year, day);
>>
>>58368611
[.code] poor english [./code]
>>
>>58368602
yes you use underscores for variables whose values you want to discard

it's not a language construct though, you can still access the value with _ variable, it's just some pattern that emerged I guess? same with python
>>
>>58368600
>me = work
>>
>>58368628
alright, thanks. out of curiosity, would it be safe to assume that _ holds the value of the sixth parameter?
>>
>>58368299
the asian bitch was hotter in Ex Machina
>>58368611
it's valid OCaml :^)
>>
>>58368730
>would it be safe to assume that _ holds the value of the sixth parameter?

yup
>>
Term rewriting macros enable library implementations of common data structures such as bignums and matrices to be implemented with an efficiency as if they would have been builtin language facilities
>>
New thread:
>>58368865
>>58368865
>>58368865
>>
File: download.jpg (7KB, 225x225px) Image search: [Google]
download.jpg
7KB, 225x225px
>>58361105
Stored procedures
>>
>>58366051
If you didn't use premature abstraction, your first draft of everything would be in machine code.
Thread posts: 330
Thread images: 23


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