[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: 316
Thread images: 35

File: 1447173476867.jpg (29KB, 539x385px) Image search: [Google]
1447173476867.jpg
29KB, 539x385px
What are you working on, /g/?

Old thread: >>59543141
>>
>>59549111
"The most powerful programming language is Lisp. If you don't know Lisp (or its variant, Scheme), you don't know what it means for a programming language to be powerful and elegant. Once you learn Lisp, you will see what is lacking in most other languages." -Richard Stallman
>>
File: 1490028128785.jpg (175KB, 1010x768px) Image search: [Google]
1490028128785.jpg
175KB, 1010x768px
>>59549129
>>
>>59549129
>Richard Stallman
Started reading right there
>>
>>59549129
>Richard Stallman
stopped reading right there, "mate".
>>
>>59549157
>>59549164
Two retards in a pod.
>>
>>59549129
>(((lisp)))
>>
>>59549164
>stopped
started*
>>
>>59549191
What a badass
>>
>>59549227
anime website
>>
http://www.sarahmei.com/blog/2014/07/15/programming-is-not-math/
haha, /dpt/ btfo
>>
>>59549243
>/blog/
Ain't clicking.
>>
>>59549243
who claims otherwise?
>>
>>59549279
every single person who even pretends to be sentient
>>
>>59549235
Excuse me?
>>
>>59549243
>I'm a Ruby & JavaScript developer based in San Francisco.
Oh I see. This is a a joke blog.
>>
http://redmonk.com/sogrady/2017/03/17/language-rankings-1-17/

New Redmonk language rankings, for anyone who's into the whole following fads meme.

Rust is growing crazy fast. R seems to have stabilized. Scala is the 11th biggest language. Swift has almost overtaken objective-C.
>>
>>59549305
>pretends
yeah I guess so
>>
File: 1460206898415.jpg (24KB, 289x340px) Image search: [Google]
1460206898415.jpg
24KB, 289x340px
>>59549243
>theorem proving isn't math
>>
>>59549129
RMS is a retarded faggot and list is for retarded faggots.
>>
>>59549381
What is list, anon?
>>
>>59549340
so javascript, huh
>>
>>59549388
A webdev language.
>>
>>59549340
Wait, Rust has more Github repos than Haskell already?
>>
>>59549406
Show me this list, anon. I've never heard of it!
>>
>>59549407
*Pull requests.
>>
>>59549418
I have it installed on my computer machine. Wanna come over so we can laugh at it together?
>>
>>59549340
>Swift has almost overtaken objective-C
Well, isn't Swift a next version of ObjC?
>>
>>59549432
I'm not supposed to laugh with strangers.
>>
>>59549356
Programming is only theorem proving under the right conditions.
>>
>>59549340
Based Rust
>>
For my master's thesis, I wrote software that is basically "reverse character recognition". You'd type a phrase or word and it would generate handwriting for it organically from a sample. If I took a photo or scan of a letter someone wrote, I could "steal" their penmanship and doctor documents in their writing. The algorithm would organically write it in that style, though, so two "L" wouldn't be identical to give an idea.

Should I post this online or am I opening a jar of worms?
>>
File: rotredhearts01[1].jpg (531KB, 1500x1008px) Image search: [Google]
rotredhearts01[1].jpg
531KB, 1500x1008px
>>59549557
do it
>>
Best book for learning Python3/OOP?

I can script a bit in JS but want to get away from web dev.
>>
>>59549631
Practical Common Lisp
>>
Does type declaration impact performance in a big way?

Say I have a value which can be any whole number from -1 to 1 (basically only 3 possible values). What type should I initialize this as?
>>
>>59549661
(declare (type (integer -1 1) your-variable))
>>
>>59549661
My understanding from my work in assembly is that byte/short/int all have comparable performance, and the signed versions are identical to the unsigned in performance.
>>
>>59549557
how can you not post it online? it's usually a requirement by the university
>>
>>59549711

Design specification is online but not source code.
>>
>>59549111
i am making a programming that can crack monolithic ciphers
>>
>>59549731
you're trying to you mean
>>
>>59549340
>>59549407
>>59549546
Rust will level off and start declining within the next few months. It will be forgotten in a year. Learn Ada.
>>
>>59549735
what are you trying to argue
>>
>>59549739
Ada will level off and stop existing within the next few months. It will be forgotten in a year. Learn Rust.
>>
>>59549710

I dunno if it's convention to use only types necessary or if larger-than-needed ones are okay, too.

Consider a basic loop:

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


Would the below be any faster/efficient?

for (unsigned short int i; i < 10; i++) {
...
}
>>
>>59549755
the bottom one is undefined behavior
>>
>>59549755
>Would the below be any faster/efficient?
Considering integer promotions, I doubt it.
>>
>>59549739
>>59549753
Ada is dead. Learn Chapel instead.
>>
>know C++, C, Java, Lua (not counting web languages like PHP, HTML, JS, JSON, etc)
>want to learn something else
>concentration of my studies has been computer vision/sound manipulation/image manipulation

What's a good language for me? I've been using C++ for everything.
>>
File: $002.png (3MB, 1279x704px) Image search: [Google]
$002.png
3MB, 1279x704px
So I'm stuck again, (Cfag beginner).
I am not sure how to approach this error, again it is related to memory allocation.

I was using
malloc(sizeof(argv[1])
because I'm (probably falsely) assuming that is the size of the file, and that it will be a large enough buffer to read the whole file char by char
>>
File: 1486289264051.jpg (120KB, 898x1000px) Image search: [Google]
1486289264051.jpg
120KB, 898x1000px
What is the best algorithms textbook?

CLRS or Skiena's Algorithm Design Manual?
>>
>>59549796
Skiena is what you read before you read CLRS.
>>
>>59549788
Rust is way faster than both Ada and Chapel.
>>
>>59549793
Can you explain to me the appeal of having an anime girl visible at all times?
>>
>>59549793

whats ur colorway bro, looks cool.
>>
>>59549793
also i feel that i should be reallocing
>>
>>59549557
Go for it. There are already publicly available handwriting synthesis programs.
>>
>>59549755
excepting >>59549774 , the one below would not be faster or more efficient because the only difference between signed/unsigned numbers is how values above the half way point are interpreted.

tl;dr signed and unsigned operations mostly do exactly the same thing, with a few exceptions
>>
>>59549810
I made it myself it took like 4 hours, because i fucking suck at computers
>>
File: 7376.png (175KB, 500x375px) Image search: [Google]
7376.png
175KB, 500x375px
>can't make a dynamically sized array in C

why even use this piece of shit language
>>
>>59549848
use perl then
>>
>>59549848
realloc

is it really that hard to write a simple vector implementation?
>>
>>59549790
MatLab?
>>
Am a lawyer...
>>
>>59549848
>why even use this piece of shit language
No one uses C
>>
File: 1388902169803.gif (2MB, 235x167px) Image search: [Google]
1388902169803.gif
2MB, 235x167px
$a = "b";
$b = "c";
$c = "a";
echo $a; // b
echo $$a; // c
echo $$$a; // a
echo $$$$a; // b
echo $$$$$a; // c
echo $$$$$$a; // a
...


Why is this allowed?
>>
>>59549865
Is it possible to write a vector implementation that is reusable for any type in C?
>>
>>59549848
I found it out yesterday. So glad I stayed out of autismal languages
>>
>>59549848
C99?
>>
>>59549661
enum
>>
>>59549871
I just use ms word and like to read /g
>>
Will Dlang ever become popular?
>>
>>59549807
Ada is slower than rust on that website for two reasons
1) 2 year old compiler
2) no one's bothered to update to recent rule changes
>>
>>59549557
I'm kinda curious what the outline of the algo is. If only given a single letter, presumably you would build an alphabet of average intensities per character, and interpolate (somehow?) any character not found during the scan. Do you label characters in the letter by hand, or use some learned model? For the second phase, when you 'type' a document, you could look up your character in the built alphabet and add noise in the form of small rotations/translations and modify pixel intensities based on some weight. If you had a huge amount of data you could use some generative model as well.
>>
>>59549882
CL-USER> (defparameter *cycle* '#1=("b" "c" "a" . #1#))
*CYCLE*
CL-USER> (pop *cycle*)
"b"
CL-USER> (pop *cycle*)
"c"
CL-USER> (pop *cycle*)
"a"
CL-USER> (pop *cycle*)
"b"
CL-USER> (pop *cycle*)
"c"
CL-USER> (pop *cycle*)
"a"
>>
>>59549790
Common Lisp.
>>
>>59549848
gcc is able to stack-allocate dynamic arrays.
>>
File: $003.png (1MB, 637x779px) Image search: [Google]
$003.png
1MB, 637x779px
>>59549793
you guys could make fun of me some more
>>
>>59549793
>sizeof(argv[1])
You're taking the size of a pointer.
>>
>>59550290
how do i get the file itself? or how should i go about taking reallocing
>>
>>59549848
Isn't that what malloc and realloc are for?
>>
>>59549793
aren't you supposed to typecast malloc because it returns a void pointer?
>>
>>59550346
No, Casting malloc is stupid,
void * conversions are already guaranteed in C.
>>
>>59549796
Thanks for the name. Good resource by Skiena.

"t is traditional for the author to magnanimously accept the blame for whatever deficiencies remain. I
don't. Any errors, deficiencies, or problems in this book are somebody else's fault, but I would appreciate
knowing about them so as to determine who is to blame. "
>>
>>59550374
Casting malloc is very good. I don't care if devs already know what type it involves. It's good practice because it makes clean readable code.
>>
>>59550478
>clean readable code
you realize this is about C right?
>>
>>59550602
I know. I always cast malloc.
>>
>>59550374
>He didn't use a Pre-ANSI compiler
Embarrassing
>>
File: Screenshot_20170323-221705.jpg (628KB, 1358x2219px) Image search: [Google]
Screenshot_20170323-221705.jpg
628KB, 1358x2219px
Should I get SICP or wait until I have considerably more programming experience? Any math textbooks I should add?
>>
>>59550820
>math
>programming
?
>>
>>59550820
>Any math textbooks I should add?
Maybe add some liberal arts book too while you are on that
>>
>>59550820
Just download it for free, and see if you like it. Then if you're so inclined, buy it.
>>
File: 1471937454035.png (21KB, 625x509px) Image search: [Google]
1471937454035.png
21KB, 625x509px
>>59549111
my teacher in college said you don't need complicated languages to accomplish most computer problems
ever since then i've been using basic as my main language
120 RESTORE 510 : ST$=""
130 FOR I = 1 TO 32
140 READ D : ST$=ST$+CHR$(D)
150 NEXT
160 '
170 SCREEN 2,2:COLOR 15,4,1 : CLS
180 DRAW "S4A0 BM160,191 C1"
190 DRAW "M160,178 M170,170 M207,170"
200 DRAW "M207,158 M216,152 M224,158"
210 DRAW "M224,170 M234,178 M234,191"
220 DRAW "BM216,152 M216,140"
230 DRAW "BM212,146 M220,146"
240 PAINT (216,160),1
250 LINE (212,160)-(218,168),8,BF
260 '
270 FOR I=1 TO 200
280 X=INT(RND(1)*32)*8
290 Y=INT(RND(1)*RND(1)*96)*2
300 C=INT(RND(1)*14)+2
310 PSET (X,Y),C
320 NEXT I
330 REM
340 CIRCLE (75,80),8,11 : PAINT (75,80),11
350 REM
360 SPRITE$(0)=ST$
370 IF RND(1)<2E-03 THEN GOSUB 400
380 IF INKEY$<>"" THEN END ELSE 370
390 REM
400 X0=INT(RND(1)*100)+20 : Y0=INT(RND(1)*30) : Y=Y0
410 X1=INT(RND(1)*100)+130 : Y1= INT(RND(1)*70)+60
420 YS=(Y1-Y0)/(X1-X0)*4
430 PLAY "T158L64N80N79N78N77N76N75N74"
440 FOR X=X0 TO X1 STEP 4
450 PUT SPRITE 0,(X,Y),11,0
460 Y=Y+YS
470 NEXT X
480 PUT SPRITE 0,(X,209),11,0
490 RETURN
510 DATA 128,64,32,16,8,4,2,1
520 DATA 0,0,0,1,0,0,0,0
530 DATA 0,0,0,0,0,0,0,16
540 DATA 146,84,56,255,56,84,146,16
>>
>>59550832
>>59550838
>t. Little Babies
>>
>>59550876
>t. CS toddler
>>
>>59550876
CS babby pls
>>
>>59550820
>math text books I should add
wtf
>>
>>59550832
>>59550838
I'm sorry, I was under the impression that a knowledge of higher math was fundamental in good programs.
>>
>>59550896
If you have taken math in high school you are set
>>
>>59550881
>>59550887
Nice contradiction you got there, retard
>>
>>59550912
CS babbies are physics rejects
>>
>>59550917
>>59550881
>>59550887
>C"S"
>>
I'm trying to find out if I can afford to mess with FPGA. Roughly, how many logic blocks are required to implement simple 16-bit CPUs?

The only boards I'm comfortable with buying only have 6K LEs, which is really not a lot, as I'm starting to realize. But maybe that's enough for my purposes?
>>
>>59550917
This is genuinely true. Where I took my undergraduate, the cs kids didn't take physics. They took geology like the underachieving, retards they are.
>>
>>59550907
alright well I'm interested in math anyway so fug off im going to /sci/
>>
>>59550934
How "simple" of a CPU are you talking?
>>
>>59550974
Please no, stay contained in /g/
>>
>>59550934
You in school? Altera/Terasic has DE-1 Nano, I think that's 90-100 dollars with education discount. Pretty robust, too, you can put linux desktop on it if you want.
>>
>>59550992
I only posted here to ask about programming. Trust me, I want nothing less than to keep lurking with you mouthbreathers.
>>
>>59551037
I'm only here to make statically typed fans angry.
>>
Currently trying to get my universal DFA to read its parameters from a file and then implementing it in the lexer I have to program
>>
>>59550960
DELETE THIS
>>
>>59551060
Same here. Only it's dynamically typed fags instead of statically typed ones.
>>
>>59551136
I think we'd get along rather well.
>>
File: 1458079721401.jpg (48KB, 600x390px) Image search: [Google]
1458079721401.jpg
48KB, 600x390px
>>59551149
It's all cool, right?
>>
>>59551211
Well no. Computers are shit.
>>
>>59550960
CS grad here; can confirm.

There are 3 types of CS major past 2nd year (ordered by percentage of population from largest to smallest):

1. People who are basically physics / core math rejects; they're better than your average student (not really saying much) at algorithms and abstract maths, but struggle at anything with a complex process or wide spectrum like multi variable calculus or statistics.

2. People who are capable of learning the material and managing the workload, but have no special talents of determinable skills. They're still in the program because they don't know what to do with their life or how they ended up there in the first place. (international students usually fit here)

3. People who could / did do physics (etc) and also have an entrepreneurial spirit. They are the over achievers and have recognized that they can claim the greatest benefit from their skills in the technology field. They're usually a few years older (you know, having already done another degree in some cases), attend the faculty events and win competitions for the school. (smart INTJ goes here)
>>
>>59551211
As long as you learn to love types
>>
>>59551269
I program exclusively with types.
>>
>>59549111
Google:
Let's optimise this C++ method using a retroactive data structure and metaheuristic and then use Python binding for an easy management of the computation sessions.

/dpt/:
Moar fucntional programmeng lisp haskel, OOP is sheeiiiit poo in loo!!
>>
File: 1483184268193.gif (1MB, 553x600px) Image search: [Google]
1483184268193.gif
1MB, 553x600px
>>59551275
>>
>>59551286
I'm developing OOP for Haskell as we speak.
>>
>>59551303
please stop
>>
I've got a Python script with a handful of dependencies in a virtualenv. It used to work on Windows and Linux until I added BeautifulSoup and now Windows says No module named 'bs4' but if I open an interpreter and import bs4 it works. What the fuck is this fucktrash garbage
>>
>>59551303
I am developing a proof of OOP being complete garbage as we speak.
>>
>>59551305
I'm also taking advantage of Template Haskell and type inference to make a form of duck typing for the language too.
>>
>>59551336
I suppose everything will be an object?
>>
>>59551351
Yes. All the types for example will be reimplemented as OOP classes.
>>
File: 1489262492823.gif (929KB, 264x320px) Image search: [Google]
1489262492823.gif
929KB, 264x320px
>>59551336
>>59551367
>>
Any git wizards here?
How would I go about moving unstaged changes off master to a new branch and then creating another branch that's without these changes?

Do I just:
git stash
git checkout -b new1
git stash pop
git checkout -b new2
>>
Is there a way to overwrite the whole file with a single write call (without having artifacts left over if the new text is shorter than the last one)? Right now I'm truncating the file and then writing the content but a separate program has a small chance of reading the file when it's empty (before the write happens) which is not very good.
Is there a way to achieve this, or do I need to just append spaces to the end to overwrite "garbage" data?
>>
>>59551703
http://en.cppreference.com/w/cpp/io/ios_base/openmode
>>
File: ball.jpg (52KB, 532x800px) Image search: [Google]
ball.jpg
52KB, 532x800px
What is a .NET developer? I see job ads for .NET developer, but I'm not sure what it is.

I have written a few programs in C#, does that make me a .NET developer?
>>
>>59549790
Brainfuck
>>
>>59549790
Check out Coq. It's used pretty often for your needs.
>>
>>59550277
>tabs
please get off my board normie
>>
>>59551740
How am I supposed to use this? If you are saying I should open the file up with O_TRUNC that won't work because it clears the file before the write syscall comes in.
Using a rename syscall could work, but then I would need to constantly be opening and closing fd's which I want to avoid. I think I'll just go with adding a bunch of spaces to the end to clear the garbage.
>>
Any recommended resources and starting points for Perl?
>>
>>59552036
Fork & exec and run mv
>>
>>59552229
Nope.
>>
>>59552250
That's pretty fucking stupid. I already mentioned using the rename syscall which is what mv calls internally.
>>
>>59549111
Dealing with Bitcoin's Transaction Malleability.
>>
>>59551778
yes, also, you need to be indian.
>>
>>59552287
If you are such a faggot then use semaphores on shared memory or signals.
>>
god I just love sucking cock so much
>>
>>59552337
Can't due to project restrictions. I need it to be compatible with obs's text file reader.
>>
>>59552353
C++ might be the right language for you
>>
>>59552489
that's not how you spell Ruby
>>
>>59552496
I think you mean swift
>>
god I just love shitting in the street
>>
>>59552503
that's not how you spell "any dynamically typed garbage"
>>
>>59552508
C++ might as well be dynamically typed
>>
>>59552509
it might as well be untyped.
>>
Can someone explain Alpha-Beta pruning? I think I'm retarded, I don't get this at all

I understand the desire to avoid traversing unneeded paths but I don't understand how the paths are determined to be unneeded
>>
>>59537415
>>59537419
Wow. Do C++ programmers really think exceptions is the only error handling mechanism available? I didn't except them to be this bad.

I guess Linus was right. I haven't had to interact with them all that much. But this is really bothering me. I didn't view the job market as a minefield before.
>>
>>59551778
I suspect it means they want a C# developer and preferably that developer should have some experience with the .net framework.
>>
Ruby programmer here. It is true that I fucking love sucking cock so goddamn much. I suck random cocks every day. I'm such a filthy boy.
>>
File: dpt.jpg (164KB, 800x1000px) Image search: [Google]
dpt.jpg
164KB, 800x1000px
>>59549111
>>
>>59552522
it might as well not exist
>>
>programming exam
>It's on paper
>I have to write code on paper with a pen
Fuck this retarded shit. Anyone who thinks written exams in a programming class is a good idea needs to be fucking shot.
>>
File: java_io.png (48KB, 621x501px) Image search: [Google]
java_io.png
48KB, 621x501px
I'm trying to learn more about I/O in Java.

So, my understanding is that InputStream and OutputStream read (or write) data from sources (or to destinations) by using byte values.

That is to say, if I feed "test.txt" into a FileInputStream, and call the read() method on it, it will return an int value between 0 and 255 to represent the current byte of data it has read.

I created this "test.txt" file and it only contains the numbers "123" in UTF-8. When I run the pictured program, it tells me these byte values are "49", "50", and "51" respectively.

I'm wanting to understand what the 49, 50, and 51 correspond to, exactly. I'm not quite processing what "49" means as a byte value between 0 and 255.
>>
>>59552696
49 means 49

when you interpret the bytes as ASCII characters,
49 is displayed as '1'
50 as '2'
etc

http://ascii.cl/
>>
>>59552638
They're describing the odd case (for Google) there. And I doubt Google uses retroactive datastructures to any real extent.
>>
What is the best font to use when coding? And why is it fira code.
>>
>>59552669
Programming exams aren't meant to test your skills at programming. Programming exams are meant to make sure that you have practiced enough programming that you have the syntax already in your head. That is what my professor told us at least.
>>
>>59552696
You probably want to use filereader. Fileinputstream is for reading raw bytes (which you then assign meaning to). Filereader reads text.
>>
>>59552736
What a piece of shit. It's because you don't have to worry as much about cheating. Ensuring that your computers don't have help information is harder than giving you a paper.
>>
>>59552736
Well okay, that shouldn't be a problem for me.
It's just anoying as fuck having to write it out on paper, like seriously holy shit.
>>
>>59552765
Yes it is annoying. Everyone goes through it sadly.

>>59552757
It is easier to set a paper than it is to make a custom software with help disabled and making sure a bunch of CS students don't break the system. The faculty could invest in such things sure but they rather not.
>>
>>59552785
Yes. I'm annoyed that he's lying.
>>
>>59552730
I am surprised this isn't more discussed. What is the most aesthetically pleasing font to look at considering you have to look at code for hours. Personally I use Lucida San Typewriter.
>>
>>59552785
A lot of cheating could be avoided by not connecting the computers to the internet.
>>
>>59552802
There are plenty of IDE with documentation included. Like I said, paper test are simply a test to see if you have practiced enough or not. It is no different from writing code on Notepad. It is just that it is easier to mark papers on paper instead of on a screen.
>>
File: 1489503850789.jpg (41KB, 394x353px) Image search: [Google]
1489503850789.jpg
41KB, 394x353px
Does anybody here use what is known as a "Compiler"?
>>
>>59552717
So, my "test.txt" file is encoded in UTF-8. From the UTF-8 charts I'm looking at, "1" should be 30. But the ASCII chart says "1" is 49, so I guess my Java program is reading data in ASCII rather than UTF-8 for some reason? Or am I misunderstanding again?
>>
I don't really have anything to show for it right now but, I'm working on an ext2 filesystem driver for my kernel.
>>
>>59552828
>The example that follows converts characters between UTF-8 and Unicode.
https://docs.oracle.com/javase/tutorial/i18n/text/string.html
>>
Any .net developers out there? I need help. I'm essentially making a web scrapper in C# for a particular site and I need to spoof the user-agent in the http request header. Unfortunately HttpWebRequest, WebClient, and HttpClient all won't let me do that. I've tried but it appears as though trying to set the user-agent in the header collections of these objects isn't allowed as it's considered a "restricted header". I either get an exception; or it runs, but when I examine it with Fiddler I see the user-agent was not sent. I've looked online, it seems as though in earlier versions of .net you were able to set the user-agent on these classes, but not anymore.

Can anyone tell me of any class in System.Net or other library that can get the job done? Thanks.
>>
>>59552819
Retard
Don't install an ide then, and use a simple text editor
Using a text editor is FAR different to writing on paper you fucking cock sucking nigger
>>
>>59552862
>https://docs.oracle.com/javase/tutorial/i18n/text/string.html
Ignore me; the UTF-8 chart I was looking at was wrong. The one on Wikipedia says 1 is "49" as well.
>>
>>59552879
Then you need a personal school computer provided to each individual. Fuck off moron. You are the kind of snowflake that thinks the world should cater to your whims cause "writing on paper is SO hard". Quit school then. You don't need that CS degree.
>>
File: 1470828281646.png (292KB, 363x572px) Image search: [Google]
1470828281646.png
292KB, 363x572px
>>59550820
I guess you can get knuth's concrete mathematics, not that you're going to use any of that shit.
While you're at it buy me a copy.
>>
>>59552900
I know my school have sets of laptops that classrooms can "rent" for a class / exam.
>>
>>59550820
The pragmatic programmer is not what you would expect. It does not cover programming techniques, rather focused on tools and methods of programming. If you want a book on programming techniques you should get "The Practice of Programming" by Brian Kernighan and Rob Pike.
>>
>>59552942
Good. Then bug your professor to do that instead of a paper test then. Why are you whining on /g/ for?
>>
>>59552961
I'm not the one whining.
>>
>>59552969
Then what are
>>59552757
>>59552802
>>59552879
post about?
>>
>>59549407
>Github
Nothing of value here.
>>
>>59549848
What? of course you can, with the help of realloc.
I've done it plenty of times.
>>
>>59552972
>>
can anyone help me with this? So far i've got one condescending asshole just let me know I suck

http://stackoverflow.com/questions/42994417/how-can-i-make-two-different-threads-write-to-a-variable-at-the-exact-same-time
>>
>>59553161
he's right
>>
File: 1482209151825.jpg (174KB, 1083x720px) Image search: [Google]
1482209151825.jpg
174KB, 1083x720px
>>59553172
sorry that was rude
i take it back
>>
>>59553172
about what?
>>
>finally motivated to get back into coding
>don't want to use VS so download codeblocks because I don't know better
>set up project for SFML and openGL
>linker and includes are 100% correct

>The program can't start because libgcc_s_sjlj-1.dll is missing from your computer
I wonder if codeblocks gave me a shit install of mingw.

Also what should I use instead of codeblocks or VS for C++?
>>
>>59553161
#include <stdio.h>
#include <stdatomic.h>
#include <pthread.h>

void *fn(void *arg)
{
atomic_int *n = arg;

for (int i = 0; i < 10000000; ++i) {
atomic_fetch_add(n, 1);
}

return NULL;
}

int main()
{
atomic_int n = ATOMIC_VAR_INIT(0);
pthread_t thrd[8];

for (int i = 0; i < 8; ++i) {
printf("Spawning thread %d\n", i);
pthread_create(&thrd[i], NULL, fn, &n);
}

for (int i = 0; i < 8; ++i) {
pthread_join(thrd[i], NULL);
printf("Closed thread %d\n", i);
}

printf("%d\n", atomic_load(&n));
}
>>
How would you guys go about traversing a tree of strings and summing the amount of characters?
>>
>>59553219
scala is shit
>>
>>59553215
nevermind im just going to put a timer in my main form and once it reaches 0 it processes the stuff done in the threads

thanks for writing this in what I assume is C even though im working in C#
>>
>>59553230
it's for coursework

I miss writing in languages I'm comfortable with
>>
File: 1489484162392.png (171KB, 268x390px) Image search: [Google]
1489484162392.png
171KB, 268x390px
please tell me why 3x printf shows correct output, while the single line version does not...

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

char *int2bin(int n);

int main(int argc, char **argv)
{

int x = 545341435;
int y = 345345353;

// this block of three prints does work
printf("%s\n", int2bin(x));
printf("%s\n", int2bin(y));
printf("%s\n\n\n", int2bin(x&y));

// this single line shows wrong output
printf("%s\n%s\n%s\n\n", int2bin(x), int2bin(y), int2bin(x&y));
}


char *int2bin(int n)
{
static char bits[32];
char res;

// init array
for (int i = 0; i < 32; i++)
bits[i] = '0';

// set bits
for (int i = 31; i != 0; i--)
{
res = (n % 2) ? '1' : '0';
n /= 2;
bits[i] = res;

}

return bits;
}
>>
>>59550861
What computer?
>>
>>59553502
>Returning a pointer to a static buffer
Whenever you call the function, it's going to modify the contents of the buffer, but it's always going to return the same pointer.
Since you're calling the function 3 times before printf, they're all going to have the same pointer, and the buffer is going to have whichever was the last one called in it.
Think of it like you were doing this:
int n;
int *a = &n;
*a = 10;
int *b = &n;
*b = 20;
int *c = &n;
*c = 30;

printf("%d %d %d\n", *a, *b, *c); // 30 30 30

n is modified though 3 different pointers, but they all still point to the same place.
>>
>>59553502
each call overwrites the result of the previous one as they all write into the same buffer
>>
>>59553179
>Also what should I use instead of codeblocks or VS for C++?
Codelite, Qtcreator are fine IDE if you really want to use one.
>>
>>59553179
>finally motivated to get back into coding
>don't want to use VS so download codeblocks because I don't know better
>set up project for SFML and openGL
>linker and includes are 100% correct
>The program can't start because libgcc_s_sjlj-1.dll is missing from your computer

Who wrote this?
>>
>>59553560
Go fuck yourself with your constant goddamn /jp/ tier shitposting you piece of retarded shit go back to your containment board
>>
>>59553502
>set bits
>not just
for (int i = 31; i >= 0; i--)
bits[abs(i+1-32)] = !!(res & (1 << i));
>>
>>59553568
>tier
I unironically think you're retarded.
>>
>>59553568
/jp/ is a lovely board and I won't have you disparage it
>>
>>59553161
>asking shitty homework questions on SO
lol
>>
>>59553179
-static-libgcc
>>
Since I'm a masochist I've decided to learn Rust.
>>
>>59553710
it's a slippery slope from Rust to FP memery
>>
>>59553722
rust is a toy language compared to FP memery. it's only natural.
>>
>>59553722
How so?
>>
>>59553735
be careful!
>>
>>59553710
what do you even mean? please don't tell me "people" here actually consider it "hard".
>>
>>59553751
Painful to write and read. Won the competition on ugliest syntax.
>>
File: sicp.jpg (60KB, 400x468px) Image search: [Google]
sicp.jpg
60KB, 400x468px
Have you read your SICP today, /dpt/-kun?
>>
>>59553994
Jesus christ that eye is evil
>>
>>59553994
>photoshopper was so lazy to select fingers so fingers are under the cover of the book
>>
>>59552562
I might be able to explain it to you in a couple days since I have to learn it for a school project.
What are you making?
>>
File: faded_cuh.jpg (68KB, 1280x720px) Image search: [Google]
faded_cuh.jpg
68KB, 1280x720px
who here gets /faded/ while coding?
>>
File: 1448712987446.jpg (118KB, 900x641px) Image search: [Google]
1448712987446.jpg
118KB, 900x641px
>>59554073
>doing any drug while programming besides prescription-grade amphetamines
>>
>>59551778
You can use .NET with C#, F#, and Visual Basic.

However, the majority of the time they are looking for someone with C# experience, and .NET ecosystem components like WPF/WinForms, ASP.NET, etc. Usually the job details will specify.
>>
>>59552863
You can use WebClient for this.
client.Headers.Add("user-agent", "muh user agent string");
>>
>>59554073
why is that picture aesthetic as fuck
>>
>>59554391
because it's pink, that shit gets you faded cuh
>>
>>59554027
Clearly a GIMP user.
>>
>>59549453
It's a replacement for the cancer that is objective-C
>>
Anyone moght know how I can get the classes from the application context in Spring?

I just need a way to return their name in a list of String.
>>
>>59554413
>cancer
How? It implements Smalltalk OOP, it doesn't sound to be wrong.
>>
File: 14296592845370.png (180KB, 800x713px) Image search: [Google]
14296592845370.png
180KB, 800x713px
Should I learn OCaml or Haskell? Which one of them has more information about writing functional compilers? I don't care about mutability one way or the other.
>>
>>59554724
Common Lisp.
>>
>>59554724
There should be more compilers implemented in ocaml but not sure if there's more documentation about the subject.
Ocaml's implementation seems to be faster by benchmarks also the community and development tools support seems fine.
>>
>>59554724
my professor told me Scratch is good for writing functional compilers
>>
>total heap usage: 576 allocs, 563 frees
ruh roh
>>
>>59554743
What an absolutely abhorrent post. Are you by any chance Canadian?
>>59554756
I know there are quite a few imperative languages implemented in it, not sure about functional ones though.
>>59554757
Yeah, it's true.
>>
I've written a library, and now I want to distribute it. I'm using autotools and have a few header files that I would like to install on the computer, using make install.

1:
How do I install the headers to
foo/*.h
instead of *.h?

2:
Does it matter whether I install the headers to
/usr/local/include/
instead of
/usr/include/
?
>>
in fortran (and I guess C too), should running:
DO
otherarray(i) = pure_function(maxval(array))
ENDDO


in a loop lead to slower code than say:

maxv = maxval(array)
DO
otherarray(i) = pure_function(maxv)
ENDDO


the function is declared as pure, which implies no side effects.
Neither array is declared as the target of pointers.
I would expect the compiler (gcc/gfortran) to notice that it can store the value between calls since (as far as I can tell) there is no way the value can change.

Apparently though at least when I tried, not storing the value lead to an enormous slowdown

is gcc that shit?
>>
>>59554879
I think I did something like pure_function(some_array(i), maxval(array))
but I forgot the specifics.
>>
>>59554852
I don't really know the specifics of autotools, but regarding your second question, everything should be in terms of the prefix.
So you can have a user do any of
./configure --prefix=/usr
./configure --prefix=/usr/local
./configure --prefix=$HOME/usr

or whatever they want to do.
>>
>>59554073
does codeing work anon
>>
>opens MyClass.h
>opens MyClass.cpp
>geany recognizes that MyClass is a class that has been defined
>Close MyClass.h
>geany forgets about the class definition

Is GVim just as stupid? I'm considering switching...
>>
>>59554989
yeah mang, I made my schoolproject while on it and my professor told me that my shit was lit dog I was like ye cuh I was sipping that purple drank and it made me faded cuh and hes like shit man lemme sip and then we made fizzbuzz together with our programming socks
lit
>>
>>59555031
did you include the header as well?
>>
What's the most up to date (and good obviously) book/tutorial/guide on Spring ?
>>
>>59555062
Yes ofcourse. It's just the editor that has a memory of a goldfish and forgets that the class exists as soon as I close the file for editing and stops highlighting
MyClass
correctly.
>>
>>59555100
it doesn't really bother me when my class names aren't highlighted, maybe try something else. I think VS code does a good job at highlighting stuff like that, although I'm not really sure.
>>
>>59555122
I tried VS code. It's really good for high-level languages. But have shit C++ support..
>>
File: Altera_StratixIVGX_FPGA.jpg (86KB, 504x337px) Image search: [Google]
Altera_StratixIVGX_FPGA.jpg
86KB, 504x337px
>>59550989
Simplest. I dunno. I just want to get a sense for what the number of logic blocks means in real life.

>>59551014
The problem with that is I'd rather buy two RPi 3s for that kind of cash. I know they are different in every way imaginable, but it still doesn't fell right for me. Which is why the only FPGA boards I consider are the ones below 40$ from AliExpress.
>>
>>59555122
VS Code only has an experimental plugin for C/C++. Best pick some other editor.
>>
>>59555144
>>59555158
I didn't know that. I just used it for C# and saw that it had C++ support.
>>
File: 1490098173507.jpg (72KB, 960x960px) Image search: [Google]
1490098173507.jpg
72KB, 960x960px
user0@secondary ~/d/p/dfiles> cat main.d ;and ldc2 main.d;and ./main axbcoexb 1xbnoenax
import std.stdio;

void main(string[] args)
{
if (args.length != 3)
{
stderr.writeln("Sorry, This program only processes two strings. Exiting.");
return;
}
else
{
write("Matched common substrings are: ");
writefln("%(\t%s,%)", find_match(args[1], args[2]));
}
}

//find common substrings
string[] find_match(in string a, in string b)
{
string[] matches;
for (int i = 0; i < a.length; i++)
{
for (int j = 0; j < b.length; j++)
{
if (a[i] == b[j])
{
string current_match = "" ~ a[i];
int k = 1;
while (i + k < a.length && j + k < b.length && (a[i + k] == b[j + k]))
{
current_match ~= a[i + k];
k++;
}
matches ~= current_match;
}
}
}
cleanup(matches);
sort_by_descending_length(matches);
return matches;
}

//re creating the array without duplicate values
void cleanup(ref string[] elements)
{
for (int i = 0; i < elements.length; i++)
{
for (int j = 1; j < elements.length - 1; j++)
{
if (elements[i] == elements[j])
{
elements = elements[0 .. j] ~ elements[j + 1 .. $];
}
}
}
}

void sort_by_descending_length(ref string[] elements)
{
for (int i = 0; i + 1 < elements.length; i++)
{
if (elements[i].length < elements[i + 1].length)
{
string temp = elements[i];
elements[i] = elements[i + 1];
elements[i + 1] = temp;
}
}
}
Matched common substrings are: "ax", "oe", "xb", "x", "b"
>>
>>59555178
>Deadlang
Please stop memeing.
>>
>>59555170
Don't get me wrong. I've used it for C and it's decent, but the autocompletion is really wonky. Great for the higher level languages though.
>>
>>59555192
How do you manage to shitpost 24/7? Do you not write any lines of code at all?
>>
File: --501.jpg (479KB, 2000x1500px) Image search: [Google]
--501.jpg
479KB, 2000x1500px
What's the language to write once and run everywhere today?
>>
>>59555328
write once debug* everywhere
>>
>>59555328
Go
>>
>>59555328
INTERCAL
>>
File: Jun_Amaki_1941-481x600.jpg (44KB, 481x600px) Image search: [Google]
Jun_Amaki_1941-481x600.jpg
44KB, 481x600px
Can anyone recommend a good resource for assembly?
>>
File: 128326703436.jpg (121KB, 850x850px) Image search: [Google]
128326703436.jpg
121KB, 850x850px
I've lost a pic of post showing how "awesome" JS is.
Anyone care to provide?
>>
>>59555388
Practical Common Lisp
>>
>>59555394
I've deleted all my non-lewd images, so unless it was also lewd, I don't have it.
>>
File: 1490292110317.jpg (55KB, 457x381px) Image search: [Google]
1490292110317.jpg
55KB, 457x381px
>>59555419
baka hentai
kimochi warui
>>
>>59555178
>uses D
>Doesn't use foreach
wew lad might as well use C
>>
Cool, got my webserver to serve super-simple HTTP requests.
>>
>>59555328
What do you mean by "everywhere" and what do you want it to do?
>>
What happened to the D programming language?
>>
>>59555515
>What do you mean by "everywhere"
Big number of platforms
>what do you want it to do
I want it to run
>>
>>59549111
A large Dunkin Donuts coffee, some jelly filled Munchkins, and several methods to build deep-comparison deltas of arbitrary .NET objects as part of an auditing module.
>>
>>59555525
D is like Java without the public static void autism
D is like C without the void * (int******) &arg** autism
D is like C++ without the memespace std::String <&autistic**> autism

Bad thing about D is, it lacks libraries so much
D is like C++
>>
File: 1489721554176.jpg (35KB, 500x400px) Image search: [Google]
1489721554176.jpg
35KB, 500x400px
What's the difference between subroutines and functions and why this difference exists?
>>
>>59555571
they're the same thing
>>
>>59555571
Don't know about sub routines but methods and functions are a bit different
>>
>>59555529
Then most modern languages will be fine.

.NET Core and Mono will run on just about anything.
>>
so in bash I can do
H=$(date +%H)
if (6 <= 10#$H)

right now $H is 08 but it doesn't work without the 10#
./lights.sh: line 3: ((: 6 <= 08: value too great for base (error token is "08")


why? 08 is the same as 8 but obviously not in bash? what does it see it as?
>>
>>59555665
> but obviously not in bash
Bash works with strings
>>
>>59555571
If you want to differentiate, a function will be focused on the return value, while a subroutine will be focused on the work of the actual subroutine and may or may not have a return value.
>>
I'm coding a shell in C, any suggestion of what features it should implement?
>>
>>59555737
Regex globbing
>>
>>59555676
so the 10# makes it an integer of base 10?

but it worked when $H was 06 & 07 ~.~
>>
>>59549313
/g/ is /s4s/ now
didn't you get the memo?
>>
>>59555561
>>Bad thing about D is, it lacks libraries so much
Not really, which libraries do you need that you cant feasibly do in raw D?
>>
Noob question here. How can I go from solving factorial problems and creating shitty games using an engine and following a handheld tutorial to creating A FUCKING COMPUTER OPERATION SYSTEM FROM SCRATCH? I mean, it's a completely abyssal difference of scale.
I know that if I had the "talent" I'd be programming since I was 7 and know everything now instead of starting a university course at 22 yo, but what the fuck? How can I even get to 1% of that level of expertise in programming?
>>
>>59555868
Azure Data Factory would be a PITA to manage without the SDK.
>>
>>59555871
dun' goofed some words sorry guise
>>
>>59555871
Why would you want to program an OS?

You'll never be good enough to do one on your own, much less work on a team that creates one.
>>
>>59555877
>net garbage
well no wonder.
Stick with C#.

But D has native C/++ linkage, so you could port it yoursel and then bind.
>>
I know that. I just used that as an example. How can I ever be "good enough" to be able to program an OS by myself (to escape CIA niggers), or an acclaimed game, or become a famous TI dude or something? I know there's not a recipe that I should follow and will put me in the top, that I need to really master what I do, but how can I go further than where I am to where I want to be?

I mean, I have a bunch of options, my "creativity" is the limit, and I know that if I type "how to program OS pls" in Google there will be a tutorial or a guide for it, but how these fuckers did it first, by themselves? That's another question I have.
>>
>>59555607
>.NET Core and Mono
ut it's works only on MS platforms
>>
>>59555958
forgot the post link

>>59555899


sorry, woke up retarded today
>>
>>59555929
>native C/++ linkage
>C++
orly
>>
>>59555979
extern (C++) int foo(int i, int j, int k);

void main()
{
foo(1, 2, 3);
}
>>
What's the lightweight way to develop for Windows?
>>
>>59556040
running linux in vm.
>>
>>59556040
notepad and raw win32
>>
>>59556040
Winapi or something like glfw.
>>
>>59555994
So you're saying there's a standardized ABI for C++.
>>
>>59555598
>methods and functions are a bit different
Depends on the OOP implementation. In some languages methods are just functions that implicitly take the parent as an argument.
>>
>>59556077
What languages do and what languages don't have methods that are just functions that implicitly take the parent as an argument?
>>
>>59556071
https://dlang.org/spec/abi.html
>>
>>59555571
I do know that a procedure is usually just another name for a function that returns void.
>>
>>59555871
>it's a completely abyssal difference of scale
Depends. If your first step for the OS is to create an OS that is supposed to be able to run on most machines and be commercially viable for whatever purpose then yes its obviously a big step.

But the big step you're missing for just creating an OS is the low level computer understanding.

You really don't have a clue about the scale here anon. It's important to understand that. When someone says something is a big project you have to ask why. The basics for an OS isn't particularly much. Having driver support for every machine on the planet, having a nice API so people can conveniently develop applications for your OS, having it be reliable. Those are big things.
>>
>>59556100
Go and JS are the one I know of and pure OOP languages like Java can not decouple the method from the class.
>>
>>59556100
>what languages don't have methods that are just functions that implicitly take the parent as an argument
I'm assuming you mean member functions by methods. Because a method is the kind of member function that's implicitly associated with a piece of data (i.e the object.method() syntax where there's an implicit this pointer).
C does member functions that don't have an implicit this pointer passed to the member function. They don't really serve much purpose other than programmer convenience maybe.

C isn't a language designed for OOP. So it's just a coincidence that they have member functions and objects in oop have methods.
>>
>>59556104
Does that just support gcc or other compilers with different mangling too?
>>
>>59556177
The major three + walters.
>>
New thread:

>>59556199
>>59556199
>>59556199
>>
>>59556115
I know, the OS was just an '''example'''. What I mean is, how can I jump that gap, how can I make myself better at it, not if building an OS is a big thing or not.
Do I use my basic knowledge and try to join a team of experts as an aspiring scrub? Do I keep making shit and hopefully getting better at making shit until I make some good shit? Do I keep reading books and believing I need a solid theory understanding and never doing anything?
>>
>>59555959
>ut it's works only on MS platforms
You are incorrect.

Between these you can run on Linux, macOS, and a myriad of embedded systems.
>>
I'm building an app in swift. Actually really enjoying it so far, building natively compared to using xamarin is alot smoother.
>>
>>59554365
Yeah, that's what I did. The function works, but when I check with fiddler I see the user-agent wasn't sent, and the website gives me the changed page instead of what they send to browsers. Here's what my code essentially is:

WebClient client = new WebClient();
client.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0");
return client.DownloadString(url);
Thread posts: 316
Thread images: 35


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