[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: 331
Thread images: 36

File: 1486854282119.png (1MB, 790x960px) Image search: [Google]
1486854282119.png
1MB, 790x960px
What are you working on, /g/?

Previous Thread: >>61100986
>>
File: monads.png (797KB, 793x670px) Image search: [Google]
monads.png
797KB, 793x670px
the monad as interpreted by functional programmers is the ultimate embedding of imperative programming within functional programming and represents the pinnacle of 20th century programming innovation, uniting imperative programming, type theory, category theory, first class functions, custom data types, procedural and imperative concepts along with continuations and the lambda calculus to perfect the concept of the pure typed programming language. it is the cherry on top of the proof within the pudding that functional programming is strictly superior to imperative programming.

philistine memesters need not reply
>>
First (OP doesn't count) for
using namespace *;
>>
>>61108019
but SPJ created Haskell...
>>
>>61108019
Recursive post hiding for my liveposting board. Fuck JS. I bet this will make thread loading slower.
>>
File: everything happens so much!!.png (365KB, 524x479px) Image search: [Google]
everything happens so much!!.png
365KB, 524x479px
>when your project grows in size and demands cognitive load far greater than yours
>>
>>61108106

minecraft after very early alpha stages in a nutshell

rewrite by proper devs when
>>
>programming in C
better use this algorithm and doing it this way saves 1 sizeof(int) in each struct.
>programming in anything else
who cares if the algo is n^n it's slow anyways
>>
>>61108021
But monads still are far from perfect. They are hard to compose and to reason about. I didn't get the "hard to reason about" part well, but I think it's because you barely know anything about a monad until you see its implementation.
>>
>>61108021
>that functional programming is strictly superior to imperative programming.
He says while praising Monads for introducing imperative programming into FP.
>>
File: haskell.png (14KB, 1024x723px) Image search: [Google]
haskell.png
14KB, 1024x723px
>>61108021
amen brother
>>
File: 1495673874839.gif (145KB, 500x500px) Image search: [Google]
1495673874839.gif
145KB, 500x500px
>>61108106
ganbatte!
>>
Question for all light color scheme senpaitachi: how do you deal with bright colors like green and yellow?
>>
>>61108021
8/8 fresh copypasta
>>
File: 1496463127785.jpg (112KB, 850x850px) Image search: [Google]
1496463127785.jpg
112KB, 850x850px
>>61108167
Where does his post mention Shitkell?
>>
File: 1496809188143.jpg (45KB, 577x622px) Image search: [Google]
1496809188143.jpg
45KB, 577x622px
>>61108140
>still
What did she mean by this?
>>
>>61108106
has anyone ever put a good effort at a tool designed to ease the cognitive load of working with large, unknown codebases?

it's incredible to me that we have the resources to make open source kernels with tens of millions of LOCs but we aren't able to understand at a glance whatever we want from a 100kloc project with the help of a computer.

some code is just indecifrable unless you're a guru in that specific field. take luajit for example.

and you know what they say about code being the best docs? yeah, that would be true, if it was literally as easy as browsing some docs. and i think it could be...

it's a project i always wanted to do, but ironically i'm not competent enough to understand llvm docs, but if i had something like this i might be able to understand how other compilers use llvm and quickly grok the api... maybe i'll start with python, i think the stdlib provides a nice AST api.

>>61108121
this is how i'm feeling right now, prototyping an O(n^3) audio algorithm that has to run on n >> 1 million. in python.

>>61108355
>she
can you stop with this meme

>>61108336
CUTE
>>
>>61108382
What if you have a utility that displays all functions and global variables in your translation unit scope scope, sorted by frequency of use?
>>
File: 1489145174130.gif (2MB, 500x400px) Image search: [Google]
1489145174130.gif
2MB, 500x400px
>>61108019
Dynamic type-checking, OOP and Shitkell are compelling arguments for eugenics.
>>
>>61108019
struggling to try to learn modern opengl
>>
>>61108463
>modern opengl
You should learn opengl 2 and opengl es 2 because it has the best platform support.
Once you got that down you can start optimizing with modern opengl.
>>
>>61108531
Is opengl 2 the one with the glBegin()/glEnd() everywhere, or does it at least have VBOs?
>>
File: old_hag_langs.png (173KB, 600x355px) Image search: [Google]
old_hag_langs.png
173KB, 600x355px
>>61108019
Memeth for Meme.
>>
>>61108561
>Memeth
>Meme
>>>/v/
>>
Using variadic inheritance for comfy polymorphism.

#include <cstdio>

struct A { void print() { printf("A\n"); } };
struct B { void print() { printf("B\n"); } };

template<typename ...Ts>
struct D : Ts... {};

void print_a(A& a) { a.print(); };
void print_b(B& b) { b.print(); };

int main()
{
D<A, B> d;
print_a(d);
print_b(d);
}
>>
>>61108531
>>61108552
Already played around with some opengl2 and did all the glBegin glEnd stuff now I want to move on but there are a lot of concepts to learn and wrap your mind around before you can even draw something simple.
>>
>>61108437
I'd say that would be an extremely small but not even close to sufficient step in the right direction. You could probably already do that with off the shelf tools.
>>
File: 1483214523091.png (177KB, 424x335px) Image search: [Google]
1483214523091.png
177KB, 424x335px
>>61108597
>OOP
>>
File: satania4.png (198KB, 425x374px) Image search: [Google]
satania4.png
198KB, 425x374px
What's so hard about programming? You're literally just typing text. Any braindead retard can do this. There is no reason programmers should be making any more than minimum wage.
>>
File: fSSh7df.png (80KB, 500x421px) Image search: [Google]
fSSh7df.png
80KB, 500x421px
>didn't fall for the programming/computer science meme when I was younger
>25, sign up for FCC and github
>get in the chat
>some 14 year old asking for help in some of the advanced sections
>meanwhile I'm still stuck on the first section of the second chapter

welp
>>
Is idris worth learning or is it just another meme?
>>
>>61108597
Use real polymorphism instead
>>
>>61108611
You're not even wrong desu.
>>
>>61108627
Worth learning
>>
>>61108628
What is ``real polymorphism"?
>>
>>61108612
>ribbit the reddit frog
>ribbit filename
>meme
>welp
I don't want reddit stink nearby. Fuck off.
>>>/v/
>>
>>61108627
>meme
see >>61108644
>>
>>61108641
ideally λπω
>>
Are there any programming languages based around concurrency and actors similar to Erlang/Elixir?
>>
File: 1493951892610.jpg (195KB, 1080x1080px) Image search: [Google]
1493951892610.jpg
195KB, 1080x1080px
>>61108675
I think you mean λΠω
>>
>>61108677
https://en.wikipedia.org/wiki/List_of_concurrent_and_parallel_programming_languages
>>
>>61108734
your anime picture is cute so i guess you're right
>>
>>61108677
Scala is a shit, but it has the Akka library. I believe Clojure has something similar.
>>
>>61108675
>>61108734
Malakes
>>
>>61108121
XDD have my upboat :d
>>
int* x = nullptr;
int& y = *x;
>>
>>61108933
sasuga C++
>>
Gonna get started on screeps. A mmo rts where you write a program that controls all your units and buildings. Picked it up in the steam sale for 12,74 €
>>
>>61108984
>mmo
>rts
>steam
>>>/v/
>>
>>61108984
sounds cool but like it'd be easily hacked
>>
File: ran_do_it_again.png (25KB, 275x198px) Image search: [Google]
ran_do_it_again.png
25KB, 275x198px
>>61108933
>>
>>61108677
scheme
>>
>>61108382

let me elaborate on this.

i want semantic information on every single variable, constant, function, magic number, i want semantic information on every fucking space or semicolon, i want information on every damn token.

i want to know when a function call was added recently to that function in a git commit, i want to know if that function's code was added recently, i want to know if that function call was actually a piece of code that was refactored.

i want to know if that function gets called everywhere in the codebase, if it gets called a few times or if that's the only call. I want to know where the arguments usually come from, counters? arguments passed to the caller passed again to the callee? are they usually the return value of a single function or do they get manipulated? how does that differ from this call?

i want to know what actual value the function usually gets at runtime, for scalars i want the range, the median value, the average value, same for the length of strings, t/f count for bools, graphs of the distribution for each of those.

i want to know every single while loop in the program and how much time is spent in it at runtime. i want to be able to query the runtime info for a number of iterations... if i'm analyzing a dsp project, and I have a buffer size of 128, i want to know every single loop that has 128 iterations.

i want to know every single loop that continues or break, as well as every single loop that might continue or break but never does at runtime.

i want to have so much information that it wouldn't fit in 10 posts and i want it to be displayed intelligently based on good heuristics. i want to be able to do custom queries on everything.

fuck this, i'm dropping my DSP project and working on this

>>61108984
i thought that was a fun idea that would have never worked in reality and then i realized you're not talking about building it but playing it... so it's cool that it exists but stop playing and make your own mmo
>>
>>61109087
>stop playing and make your own mmo
gamedev is for dweebs. playing a programming game just sounds like fun
>>
>>61109087
Autism
>>
File: laugh2.webm (364KB, 1280x720px) Image search: [Google]
laugh2.webm
364KB, 1280x720px
>he needs static typing
>>
>>61109058
let x: *const usize = std::ptr::null();
let y: &usize = unsafe { std::mem::transmute(*x) };
>>
>>61109130
>he needs types
>>
>>61109130
>he concerns himself with boring housekeeping instead of letting the compiler do it for him

>laughing_anime_girls.apng
>>
>>61109130
>>61109158

>need
>want
>>
File: 1495332238152.jpg (18KB, 313x320px) Image search: [Google]
1495332238152.jpg
18KB, 313x320px
>>61109130
>he needs variables
>>
>>61109130
>he hates performance
>>
>>61109186
>>61109130
>>61109202
>he needs a programming language
>>
Python is all you need.
>>
File: 1490952062031.jpg (38KB, 466x663px) Image search: [Google]
1490952062031.jpg
38KB, 466x663px
>>61109208
>he needs a language
>>
File: file.png (422KB, 675x1603px) Image search: [Google]
file.png
422KB, 675x1603px
>>61109236
>he needs to exist in the real univese
>>
>>61109236
>he needs thought
>>
>>61109261
>he
>>
>>61109252
Fucking hate xkcd.
>>
>>61108121
C programmers use C because they think the speed of C will make up for their mediocre algorithm. Plain and simple.
>>
>>61109271
wow! flying right now to your place to to suck your dick.
>>
>>61108933
>null pointer dereference
dumbass
i bet you watch anime also
>>
>>61109284
Wow, that's an odd way to spell real-time programming needs to be fucking real-time.
>>
>>61109271
It's always been garbage. These days it's garbage with a blatant left wing political agenda.
>>
File: get_ready.png (1MB, 1181x849px) Image search: [Google]
get_ready.png
1MB, 1181x849px
>>61109286
Better get ready bitch.
>>
>>61109295
null pointers were a mistake, maybe types are superior
>>
>>61109298
>real-time programming
What is this """real-time programming""" you refer to?
>>
>>61109252
>he reads xkcd
>>
>>61109320
programming without relying on kernel interrupts to lessen the effects of your shit code.
>>
File: file.png (70KB, 677x263px) Image search: [Google]
file.png
70KB, 677x263px
>>61109295
I actually call an undefined function instead of sys.exit in python when debugging

>>61109298
but haven't you heard? go solved the gc problem

>>61109320
stay poor, bonus xkcd to trigger >>61109332 and >>61109271
>>
>>61109284
I was pointing out my own habit of thinking while programming.
C program will likely be faster regradless so I should not care that much. When programming in python, php, js some stupid implemetation can cause the page load to take few seconds which is way too much.
Kind of hard to care about performance with scripting languages when you know the underlying functions are inefficient as fuck.
>>
>>61109349
woah i'm with her now!
>>
>>61109349

Go optimized its GC for latency at the expense of everything else
A GC is a GC, nothing will change that
>>
>>61108019
I'm trying to write an arithmetic expression parser in Javascript for a web page I'm making. It's oriented in evaluating the same expression with different values for its variables many times; and possibly delegating that task to the GPU.

At the moment, it can tokenize and parse parenthesis flawlessly, but I'm stuck on how to parse operators next.
>>
>>61109320
https://en.wikipedia.org/wiki/Real-time_computing
I want first-year CS students, gamers, and NEETs to leave /g/

>>61109349
>go
I hope you're joking, even C is more pleasant to program in`
>>
>>61109318
>maybe type
>wrapper around a plain pointer
or
>waste memory when value isn't present

programming was a mistake
>>
>>61109352
>underlying functions are inefficient as fuck
but they aren't, it's literally the opposite... user code is inefficient as fuck, builtins and most potentially cpu intensive operations in the std lib are programmed in C, fortran or even asm

>>61109367
>>61109370
don't understand sarcasm, i would ironically post that tBBT image but that's too much of a shitpost even for me
>>
>>61109370
programming is the same thing as computing? so when a program adds 1 + 1 and returns 2, it's programming itself to do that? that really DOES sound pretty advanced
>>
>>61109375

this is why you make maybe a part of your language rather than a pure code wrapper, the same optimizations that apply to sentinel values like NULL can be made
>>
>>61109406
You either understand this on some metaphysical level that I do not or you are completely confused and wrong

>>61109389
Sorry, Go is a triggerword for me
>>
>>61109335
>programming without relying on kernel i
How can you program wiyhout using a kernel?
>
C program will likely be faster regradless so I should not care that much. When programming in python, php, js some stupid implemetation can cause the page load to take few seconds which is way too much.
This why I said >>61109284
>>
>>61109370
>Real-time_computing
Why did you post that?
>>
>>61109349
``go" is not for real-time programming
>>
what's a good book to read to develop fundamentals for computer networks and security for someone going from computer science undergraduate to a graduate program in information security? i took one networks class but that's it. cyb/sec is just roleplayers
>>
>>61109352
>C program will likely be faster regradless so I should not care that much.
True. C programmers only use C so that their piece of shit algorithm is implemented fast
>>
>>61109465
>real-time programming
What is "real-time programming"?
>>
>>61109451
>How can you program wiyhout using a kernel?
I work as an embedded systems developer, no kernel here. The C standard library has a fair bit in it, and a lot of dev boards are nice and give you a UART you can talk over.

>>61109463
Because she asked what real time programming was

>>61109474
Tanenbaum is what we read in college
>>
>>61109451
you even quoted a piece of what you decided to ignore: "interrupts". how is "not relying on kernel interrupts" the same as "not using a kernel", and have you never heard of a microcontroller anyway?
>>
>>61109497
>I work as an embedded systems developer, no kernel here.
I'm guessing your compiler doesn't requite a kernel just because you are an "embedded systems developer"?
>>
>>61109389
>builtins and most potentially cpu intensive operations in the std lib are programmed in C, fortran or even asm
Which is why you should call those functions from C so you can avoid the JIT FFI thunking overhead of calling them from a scripting language.

>>61109406
They're saying that programs perform computing, and if you need to perform real-time computing, you want to write your programs in a language with a minimal runtime.
>>
>>61109529
then she should've said real time computing, not real time programming
>>
>>61109529
>Which is why you should call those functions from C so you can avoid the JIT FFI thunking overhead of calling them from a scripting language.
tell that to every single deep learning reseaercher on the planet
>>
>>61109527
I'm not quite sure what you're asking here. The compiler is running on my workstation, I use a Segger to write the .elf file to the board.

>>61109555
She used the widely accepted terminology
>>
>>61109497
>I work as an embedded systems developer,
look at himguys! He can display 1 to 10!
>>
>>61108121
accurate
>>61108677
yes mine
>>61109562
"researcher"
>>
>>61109576
What did he mean by this?
>>
>>61109573
You are programming in a system that has a kernel?
>>
>>61109605
My workstation has a kernel, the target platform does not
>>
>>61109525
But you do rely on interrupts
>>
>>61109527
You generally need a kernel to RUN the compiler itself, but compilers targeting embedded systems are usually cross-compilers (i.e. the compiler runs on a regular PC, while the generated code is for some bare-metal embedded device), and the target system may not have an OS or kernel. And even on PC hardware, a kernel isn't strictly neccessary for software to run, unless you consider the BIOS services to constitute a kernel.
>>
>>61109614
Of course, which is why you are programming using a kernel
>>
File: libre stop.png (33KB, 324x63px) Image search: [Google]
libre stop.png
33KB, 324x63px
>>61109643
I was gonna post a spurdo in response but then I got this capcha
>>
the best garbage collection is the one that scans your computer for interpreters and other shit that relies on dynamic typing and uninstalls it
>>
>>61109643
They're programming in an environment that exists because of the presence of a kernel, yes. What they mean by "programming without a kernel" is that the code they are writing is capable of running in an environment that lacks a kernel.
>>
>>61109696
>"programming without a kernel" is that the code they are writing is capable of running in an environment that lacks a kernel.
Doesn't malke any sense
>>
>>61109745
for you
>>
>>61109745
What about it makes no sense? What do you imagine a kernel does?
>>
>>61109745
How does it not? If it were impossible for code to run in an environment without a kernel, how could a kernel be loaded and executed in the first place?
>>
>>61109683
it'd delete itself first
>>
>>61109745
inb4 merely pretending
>>
>>61109758
Learn English.
>>61109762
>>61109773
Because when you are programmin you are using a kernel, hence programming with a kernel. Are yoiu a brainlet?
>>
>>61109295
>He thinks that actually dereferences the pointer at runtime
Dumbass.
I bet you don't even watch anime.
>>
>>61109810
This is really good shitposting
>>
>>61109810
>getting so worked up about being wrong you can't spell properly
lamo
>>
>>61109838
>getting so worked up about being wrong you can't spell properly
lamo
>>
>>61109130
Of course I don't need static typing. I'm not a retard programmer like you.
But I prefer to have static typing because it is objectively superior.
>>
>>61109838
>being wrong
Where?
>>
>>61109810
No, we mean that the program being written does not make use of a kernel.

>>61109827
It's still dereferencing a null pointer, which is UB regardless of whether it happens at ``runtime" or not.
>>
>>61109874
>program being written does not make use of a kernel.
And? Are you using a kernel while p[rogramming?
>>
>>61109889
shouldn't you be writing some junit tests or something?
>>
>>61109854
>But I prefer to have static typing because it is objectively superior.
do you have any study proving that?
>>
>>61109920
Shouldn't you be addressing your delusions?
>>
>>61109945
I know it
You know it
Everybody knows it
>>
i have used a simple mlp nn for predicting soccer scores and have been using the probabilities to bet on the outcomes

i have lost more than 700$ so far but i am confident that this is only a fluke, it had 0.00003% error when training
>>
>>61109889
Programming is the act of making programs. While engaging in that act, they are utilizing a kernel. However, we do not say "programming with oxygen", for example, even though one engaging in that act invariably utilizes oxygen while doing so.

The phrase "programming without a kernel" means, essentially, "creating a program which, when completed, will be capable of running in an environment which lacks a kernel".
>>
>>61109945
No, it's just common sense.
>>
>>61109965
>i have lost more than 700$ so far but i am confident that this is only a fluke, it had 0.00003% error when training
No, see, you should have updated it with these outcomes.
>>
>>61109965
>>>/mlp/
>>>/sp/
>>>/biz/
>>
>>61109957
i'm getting 2nd hand embarrassment reading your posts
>>
>>61109959
>>61109973
speak for yourself
https://danluu.com/empirical-pl/
>>
Wizards, I'm in dire need of your guidance.
For some reason I get a NullPointerException on the following code:
(use '[clojure.string :only (split)])

(defn sum-diagonal [n matrix]
(reduce + (for [i (range n)] (get-in matrix [i i]))))

(let [n (Integer/parseInt (read-line))
matrix (for [i (range n)] (map #(Integer/parseInt %) (split (read-line) #" ")))]
(println (sum-diagonal n matrix)))

I tested all parts individually in the REPL and they were all OK.
>>
>>61110016
>i'm getting hand embarrassment
I know you are, mental delusions arehard to address, specially for C toddlers
>>
File: 5324626.jpg (397KB, 1673x977px) Image search: [Google]
5324626.jpg
397KB, 1673x977px
Is there any way to copy the text or am I shit out of luck?
>>
>>61110034
You accidentally quoted like 95% of your program.
Also, you forgot the ending quote too.
>>
>>61110047
you can use the current best machine learning algorithm for chinese character recognition
>>
>>61110025
I'm gonna save this in my "/g/ shitposts.txt" file to shut down python faggots
>>
>>61110062
You're no wizard.
>>
>>61110047
ur fucked if its an image
>>
>>61110047
>>61110064

not really, you just need a kNN algorithm with k = 1 and the training data built from the same font they are using, this is not OCR, this is trivial
>>
>>61110070
why python faggots? the link shows that no study could prove that static or dynamic typing is better, also, python has gradual typing.
>>
If 4chan fucks up the syntax highlighting of your code snippet, you're language is trash.
>>
>>61110107
It just means four chan is trash.
>>
>>61110107
>4chan
Isn't that a girls' website?
>>
>>61109087
>>61109116
It might be autisim but its the good autisim.
I feel exactly the same as that anon and would love a tool like this, but there is so much you can do with no extra documentation that the codebase would have to have with it in order to have all of that autistic information apart from the whole runtime data.

God speed anon.
>>
>>61110107
i bet you with a well crafted sample 4chan would fuck up you're favourite language too
>>
>>61110118
You're welcome to leave, then.
>>
>>61110133
Yeah but I have to completely burn it down before leaving
>>
>>61110131
>good autism
i didn't see an anime image
>>
File: a33r.jpg (63KB, 1217x449px) Image search: [Google]
a33r.jpg
63KB, 1217x449px
>>61110047
>>
>>61109965
Top kek.
>>
File: 1497657204142.png (22KB, 470x216px) Image search: [Google]
1497657204142.png
22KB, 470x216px
>https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/basic-linq-query-operations
>Literally map, filter, each and join
kek so this.. is the power of so-called "Linq" that microcucks swear by
>>
>>61110047
Are those Chinese doujins?
>>
>>61110172
you do realize that it's completely wrong, right?

also google keep completely disappointed me, "grab image text" just returns this:

RA
>>
haskell is god, scheme is a wee-old angel
>>
>>61110220
>left: random chingchong gobbledygook
>right: random chingchong gobbledygook
Looks correct to me.
>>
>>61110188
I'm more bothered by basically having SQL code floating around in C# code without there being anything to isolate it. It looks silly IMO, I'd much rather have it be something like:
var query = CompileQuery("from meme in 4chan where meme.dank == true select meme");
var queryResult = ExecuteQuery(query);
>>
>>61110301
Most people just write Linq using function syntax, ie db.Table.Where(...).Select(...)
>>
>>61110034
Apparently functions like 'assoc' and 'get-in' don't play nice with lazy sequences. By not making them lazy, the code works. Kinda sucks desu senpai.
(use '[clojure.string :only (split)])

(defn sum-diagonal [n matrix]
(reduce + (map #(get-in matrix [% %]) (range n))))

(let [n (Integer/parseInt (read-line))
matrix (vec (for [i (range n)] (vec (map #(Integer/parseInt %) (split (read-line) #" ")))))]
(println (Math/abs (- (sum-diagonal n matrix) (sum-diagonal n (vec (reverse matrix)))))))
>>
>>61110095
I recognize some of those words

>>61110093
Thing is there is a setting to change the text size and all but the outcome is like an image

>>61110172
It looks mostly wrong hmm

>>61110192
Chinese webnovel about a guy in China waking up as a Japanese teenage girl in a household in debt because of their runaway parents. Trying to makes end by working as an actress filming movies based on anime.
>>
>>61110166
>2017
>being an anime autist
>>
>>61110458
anime weebsite
>>
>>61108019
Learning html and css to code my own blog and hopefully move onto js.

Can do the basics but I'm having trouble moving forward. Should I move onto a framework like ruby on rails or bootstrap if I wanna make nice websites?

Feel like in adrift in a sea of info and I'm not sure where to focus my attention
>>
>>61110410
I can see the text in the developer tools.
>>
>>61110504
HTML + CSS + JS is all you need.
>>>/g/wdg/ might help you further.
>>
>>61110410
>I recognize some of those words
I suggest you give the basic scikit tutorials a read. they're fun tools every programmer should at least have a basic understanding of for when an hand engineered algorithm won't cut it

>>61110507
literally what is the image for, then
>>
>>61110504
Ruby on rails is for web backend, completely unneeded for a static website like a blog. Bootstrap is a nifty front-end framework that is widely used and widely documented, and I recommend it highly for beginners
>>
File: copyq23255.png (215KB, 1383x863px) Image search: [Google]
copyq23255.png
215KB, 1383x863px
>>61110507
That's a free chapter isn't? It's on paid chapters that they have the image protection.
>>
>>61110547
>>61110587

Thank you both! In really just having a tough time laying out the page into neatly defined sections with out overlap. I've done the max-width:100% thing etc but it doesn't scale well on mobile
>>
>>61110654
Bootstrap is specifically intended to solve these problems.
>>
ats or lisp though?
>>
>>61110624
>That's a free chapter isn't?
I have no idea. I can barely say 'hello' in Chinese, let alone read it. I did try learning it, but I have no idea how to do it properly.
Your best bet is to download the images and pull it through some OCR tool. I'm sure there's a Python library for that.
>>
>Despite minimizing the API surface with LLVM, llvmlite is impacted by changes to LLVM’s C++ API (which can occur at every feature release). Therefore, each llvmlite version is targetted to a specific LLVM feature version. It should work accross all given bugfix releases of that version (for example, llvmlite 0.12.0 would work with LLVM 3.8.0 and 3.8.1, but with neither LLVM 3.7.0 nor 3.9.0).

llvm is *still* this unstable? holy shit!
>>
So /g/ which is superior,
merge or rebase workflow?
>>
>>61110784
dumb c programmer, you are supposed rewrite your codebase every second week.
>>
>>61110814
zip file of timestamped diffs
>>
>>61110814
Both for different purposes.
It's best to rebase before merging to keep a clean history.
>>
>>61110727
I guess I'll do that, thanks for the help.
>>
>>61110654
You can do it the hard way, or use a tool like >>61110702 said.
I'm no web genius, but I've made a 'responsive' personal home page.
Making a website response basically boils down to two things: HTML viewport meta tag and CSS flexbox.
>>
Why is OpenGL so fucking autistic? Why do you need a PhD in autism to even install and use it? Why can they not supply installation and usage instructions? You would think this would be common sense after 50-odd years of computing. It's so infuriating to know that all it would take is a 5 point list of "get this file, include that file, build like this, link like that" yet somehow no one person has ever thought to actually write it down. So now if I want to try out OpenGL I have to scour the internet for gl, glu, glut, glfw, glew... basically gl.* and somehow manually compile and include them all correctly.

tl;dr whichever one of you is reponsible for this please off yourself.
>>
>>61111016
I'm glad I'm just a beginner and only work with console programs. :^)
>>
File: 1482321230979.png (175KB, 1350x2947px) Image search: [Google]
1482321230979.png
175KB, 1350x2947px
>https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ghc&lang2=gcc
H*skell BTFO by C.
>>
>>61111072
someone really needs to update those
>>
>>61111072
because obviously haskell's main selling point is its speed rivaling C
>>
C is dead
>>
File: hags_kek.png (355KB, 599x291px) Image search: [Google]
hags_kek.png
355KB, 599x291px
>>61111072
>6
>GIGABYTES
>PER
>SECOND
>>
Working on a discord bot to play UK parliament debates. Because I want to put political nerdery in my normal luxury gay space autism.
>>
java is the official language of /g/
>>
>>61111072
>>61111095

not only that, but if you run haskell with reasonable startup options that you would use in production - that the bench game doesn't allow - haskell does much better than that.
>>
>>61111111
get
>>
>>61111072
Uh, did anyone actually expect Haskell to outperform C?
>>
>>61111016
Your graphic card drivers provide GL.so.
Anything else is just bloat over it and you don't need. glew and stuff are there just to help because graphic drivers provide inconsistent API.
>>
>>61111089
>c++ regex uses boost::regex instead of std::regex which has a functional optimize tag
>>
>>61111104
Wrong.
>>
>>61111163
How many lines of code does it take to display a triangle in pure openGL then, smartass? I'm not trying to use vulkan here.
>>
>>61111190
with opengl 2 it's just getting the functions and then like 10 lines to draw the triangle. You might also need to do some configurations before, I don't remember.
>>
doing a super basic IT internship right now. I told the guy I'm pretty good with excel and he assumed I'm a guru and wants to have me automate the offices stuff. So now I'm teaching myself VBA as I do my IT functions and automating some calendar bullshit. I'm hoping to get more and more stuff to automate after this.

How should I rewrite my job title on my resume if I end up becoming the company script wizard? Also any good VBA book suggestions?
>>
>>61108382
It's called having a functioning brain.

You think it's undecipherable because you take one look at the huge codebase and say "this is too much, I give up". Meanwhile, I immediately start reading code and figuring it out and eventually I'm the guy everyone depends on for institutional knowledge, all thanks to my willingness to read.
>>
File: manofculture.JPG.jpg (27KB, 448x401px) Image search: [Google]
manofculture.JPG.jpg
27KB, 448x401px
>>61109497
>Tanenbaum
My nigga.
>>
>>61111213
Yes I know that. But first you need to write the 500 lines of winapi code to create a window and an opengl render context etc.
>>
>>61111265
use SDL for that.
>>
>>61111289
See >>61111016
>>
>>61111159
Only angry C manlets pick up fights with shitkell
>>
>>61111344
and lispfags and camlfags and pythonfags.
>>
>>61108058
He also calls it useless (in a tongue in cheek way)
>>
Can't spell cuck without C
>>
>>61111213
>opengl 2
Fuck off, grandpa.
>>
>>61111245
>functioning
while you'll be reading a single codebase i will shit documents on the organization of the top 50 repositories on github and get offers from top CEOs willing to suck my dick to get me to work for them
>>
>>61111443
Yes, but you can spell it without C++.
>>
Why can't I just call C functions from Erlang code to get the best of both languages?
>>
>language has admittedly shit documentation
>mitigation offered by its proponents is that you can just ask for help on SO or Twitter or Discord
Is Python the most millennial language ever made?
>>
File: c_for_cucks.png (200KB, 840x1050px) Image search: [Google]
c_for_cucks.png
200KB, 840x1050px
>>61111443
>>
>>61111705
2
>>
How important are function/method prototypes?
I've read that it's advised that the prototype of a function shouldn't include its definition. Why not?
>>
>>61111528
Because if your C function crashes it takes the entire Erlang VM with it.
>>
>>61111745
It's not that a prototype "souldn't" include it's definition; it's that a prototype, by definition, can not include the definition of a function.
For example:
/* Prototype */
int foo(int a, int b);

/* Definition (or implementation) */
int foo(int a, int b);
{
int c = do_stuff(a, b);
/* ... */
return c;
}
>>
>>61111789
Forgot to remove the semicolon from the definition part. It shouldn't be there.
>>
>>61111745
Function prototypes are an ugly and roundabout way to achieve modularity in C and C++. You'll mainly be using them with header files.
>>
>>61110715
lisp
>>
>>61111705
>>61111728

shouldn't it be 1? am i that dumb?
>>
Rayon is shaping up to be a really nice library: https://github.com/nikomatsakis/rayon/pull/379
>>
>write some code I'm happy with
>periodically open it and stare at for no reason, even weeks later
>>
>>61111913
Sometimes I'll change minor things, like the formatting and wording of the comments. there's something about a perfect piece of code.
>>
is "backtesting" code monkey speek for "overfitting to the validation set"
>>
>>61111871
>am i that dumb

Yep. It's baby's first pointer. You've got a long way to go, kiddo.
>>
>>61111871
// contestants = {1, 2, 3}
contestants[0] = 2;
// contestants = {2, 2, 3}
contestants[1] = contestants[2];
// contestants = {2, 3, 3}
contestants[2] = *choice (a pointer to contestants[0])
// contestants = {2, 3, 2}
>>
File: Simple example_001.png (13KB, 648x513px) Image search: [Google]
Simple example_001.png
13KB, 648x513px
>>61111016
>yet somehow no one person has ever thought to actually write it down.
I gave it a whack anon. Well, at least I explained how I did it and provided links.
8ch /robowaifu/res/29.html#185


>>61111190
>How many lines of code does it take to display a triangle in pure openGL then, smartass?
On my box, about a hundred though this could be trimmed down some.
>>
>>61111774
I'll just write code that never crashes then ;^)
>>
>>61108612
>FCC

I've never been angrier with a site's interface before.
>>
>>61108019
I want to convert the non-fractional part of a float to c++ string.

what do I do after int type-casting if to_string doesnt work with the shit compiler i'm stuck with?
>>
>>61112142
post your code
>>
>>61112260
no /g/ will steal it.
>>
>>61108644
Why do you all pretend to hate reddit when you come here? Is it to blend in?
>>
>>61112352
Who's pretending? Reddit is fucking garbage, and the users are cancerous.
>>
>>61112396
Yes, but why bring it up for no fucking reason?
Every thread is full of this "Go ba ck to reddit"
>>
>>61112440
Because you are bringing down the board's quality with your garbage.
Fuck off.
>>
>>61112471
But you bring the quality down even more with low-quality responses. Best response to shitposts is to hide / ignore, and report if rule-breaking. That way their shit takes up as little of the thread, and is little of your life and the lives of others as possible.
>>
>>61108019
>literal naziism
kill yourself
>>61108021
>muh "moan ads"
>>
>>61108021
>lambda calculus
>muh "lamb duhs"
>>
>>61109438
Ever considered that Maybe could have multiple representations?
>>
>>61111705
Of course she picks two
>>
>>61112741
Maybe.
>>
>>61108021
It's more like making an interface for continuation passing style. Bind doesn't just mean "do this and then do that".
>>
>>61112530
This, I'm tired of this "anti-cancer", barneyfags, who end up being more cancerious than the cancer they fight.
>>
>>61112841
That's the point.
ponies were banned site wide to stop the insane anti-pony autists from destroying every thread where ponies were posted, not because of some undue vendetta against bronies
>>
I haven't written anything in a month. How do you just sit down and have the motivation to program something /g/?
>>
>>61113012
Apply yourself now.
>>
>>61113037
How did you decide to work on whatever your current project is?
>>
>>61113055
By realizing that if I don't have something to show, then my livelyhood and respect from parents will be endangered.
>>
>>61113071
That's it? Just obligation? No real passion for the project you're doing right now? That's what I was hoping to avoid, but I guess that's how shit goes
>>
>>61113096
Passion is a meme.
>>
>>61113103
I wanted to fall for it
>>
>>61113148
Me too senpai.
>>
>>61113215
Well, now I'm depressed and projectless
>>
>>61113251
No he's wrong. Passion is important (but so is hard work). I am still pursuing my dreams even after over a decade w/o real results. The lack of result is simply because I'm not very talented. But the persistence is directly the result of my passion.
>>
>>61112746
Maybe not.
>>
>>61113291
>doesn't have talent, but has persistence
for what purpose
just do meaningless work, get a wife, have bastard children
>>
File: 1494541901812.jpg (105KB, 473x496px) Image search: [Google]
1494541901812.jpg
105KB, 473x496px
who operates the /dpt/.txt twitter handle?
>>
>>61113012
Once you get yourself to actually start doing something, continuing it until works at least is easy.
>>
>>61113437
Sorry friend, Nihilism isn't my shtick. You might try down the street. :^)
>>
61112715
>Getting triggered over a shitty macro parodying an ideology that was last relevant 70 years ago
You first
>>
>>61113559
Meant for >>61112715
>>
>>61108382
It's called documentation.
>>
how can i transform int a and b into int x using c?
int a = 1;
int b = 2;
int x = 12;//a and b "concatenation"
>>
>>61113612
a * 10 + b;
>>
>>61113612
//JavaScript
var a = 1;
var b = 2;
var c = "" + 1 + 2; //a and b "concatenation"

I solved it using c as requested.
>>
>>61113624
i keked but then i realized you're actually correct
>>
>>61113624
he calls for a more general solution, obviously
>>
>>61109087
Smalltalk has a lot of this.
Most of the stuff it doesn't have here probably wouldn't be too difficult to implement yourself.
>>
>>61113612
int c = a * pow(10, floor(log10(b) + 1)) + b;
>>
>>61113687
>floor(log10(b) + 1)
couldn't you do
ceiling(log10(b))
>>
>>61113687
thats impressing anon, can i ask you how you got this solution?
>>
>>61113798
log10 tells you the number of decimal digits/the number of digits to shift to the right
>>
>>61113291
I admire that persistence. Would you mind sharing a bit about what you're working on? I'm sure you want to protect your idea so It's fine if you want to keep it super general or not share at all, I'm just wondering what could keep someone working that long with so little to show
>>
>>61113808
*to the left
>>
The thing with Rust is that it started out shitty and is slowly and steadily getting better. It is pretty good right now nonetheless.
>>
>>61113559
>>61113574
>muh lamb duhs
>>
>>61113792
>ceiling(log10(b))
No, because 10 will come out as 1. It needs to be 2.
>>
In my C program I need to end up calling a secondary C program thousands of times, each time with different arguments. Each execution of the secondary program involves very little lines of code / time. Would it be practice to use fork() in my main program thousands of times in a loop? Is there a better way to call a secondary program many times with dif arguments?
>>
>>61113839
It desperately needs coroutines / generators / yield. That'll complete the concurrency story, sans syntactic sugar.
>>
>>61114108
Funny you mention it, I am thinking about that stuff right now. I believe futures can handle all that without needing more syntax. What I am really wishing for is associated type constructors.
>>
>>61114106
Fork is probably what I'd do. But premature optimization is the root of all evil. If bash scripts are good enough, you can save yourself some effort.
>>
>>61114106
Having thousands of programs open at the same time wouldn't be good, but if you did it sequentially, or limited it to X number of them running at a time, it wouldn't be so bad.
However, it seems like it would be better to modify the second program to be long-running and communicate with it using a pipe or something.

>>61114140
>premature optimization is the root of all evil
Fucking cargo-cultists.
>>
>>61114156
This is good advice. There's likely no reason to create so many processes, unless you're doing something like browsers, where you care about isolation. If you really need processes, fork is good, but chances are a thread pool is more what you want.
>>
>>61114140
>>61114156
>>61114186
Thanks. Fuck, piping came up a lot when I was looking this up but that shit makes my head hurt. I guess I'll need to learn shell scripting eventually so I'll try to learn it.

Also, the secondary program will finish executing and the process will close before the next one is run, if that makes any difference
>>
>>61114210
>shell scripting
Piping is more general than that. A pipe is just a line of communication (treated exactly the same was as a file) that two processes can use to communicate with each other.
Piping in terms of shell scripting is the same as above, but you hook the stdout of one process to the stdin of another.
>>
>>61113612
int a = 1, b = 2, x;
char b_[2], x[3];
snprintf(x_, 2, "%d", a);
snprintf(b_, 2, "%d", b);
strncat(x, b_, 2);
x = atoi(x_);
/* Done. */
>>
>>61114257
I don't know why but reading that makes my brain shut down. Maybe a youtube video of a pajeet poorly explaining the concept will help
>>
>>61114273
Correction: on the 2nd line, it should be x_[3], not x[3]. Please excuse the typo.
>>
>>61114273
>>61114319
And on the 3rd line from the bottom too, it should be x_. I did a variable renaming, which is the cause of these mistakes.
>>
How do text-based games like Roguelikes use the console for display? Do they just output <terminal rows> lines of text every update?
>>
>>61114289
Here is a simple example that I threw together which hopefully would illustrate roughly what you would need to do.
#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>

int main()
{
// [0] is the read end, [1] is the write end.
// Pipes are only one way, so we need two sets of them.
int to_child[2];
int to_parent[2];
pipe(to_child);
pipe(to_parent);

if (fork() == 0) {
// Child

int n;

// read() blocks until the parent sends us something
while (read(to_child[0], &n, sizeof(n)) >= 0) {
// We use -1 as a special value to tell us to close.
// There are other ways to do this, but this is probably
// the most simple.
if (n == -1) {
break;
}

n *= 2;
write(to_parent[1], &n, sizeof(n));
}

// Clean up resources
close(to_child[0]);
close(to_parent[1]);
_Exit(0);
}

// Parent

for (int i = 0; i < 20; ++i) {
int n;

write(to_child[1], &i, sizeof(i));
read(to_parent[0], &n, sizeof(n));

printf("Sent child '%d', got '%d' back\n", i, n);
}

// Tell the child to stop
int n = -1;
write(to_child[1], &n, sizeof(n));

// Clean up resources
close(to_child[1]);
close(to_parent[0]);
wait(NULL);
}
>>
>>61114273
>>61114319
>>61114331
That's fucking awful.
int a = 1, b = 2;

int len = snprintf(NULL, 0, "%d%d", a, b) + 1;

char buffer[len];
sprintf(buffer, "%d%d", a, b);
int c = atoi(buffer);

printf("%d\n", c);
>>
>>61114257
>>61114289
yes, piping is more general than shell scripting, but shell scripting makes it so easy and obvious (so if you've never heard of or used pipes, start with shell commands)
>>
what are some good books on graphs focusing more on programming and less on math?
>>
>>61114503
Now do it without atoi.
>>
>>61114653
We know the string is well-formed, so there is no point in using strtol or whatever. Maybe atol would be justified, if you struct two really large ints together.
>>
File: brainlet.jpg (47KB, 645x968px) Image search: [Google]
brainlet.jpg
47KB, 645x968px
>>61114638
t. brainlet
>>
>>61114486
Wow, thank you anon

I get the general idea of what's happening and the flow of information but in the parent, when write(to_child[1], &i, sizeof(i)); is executed, how did the program know to go up to the If (fork() == 0) section?

>>61114578
I use shell commands often but unfortunately I usually just end up copy pasting the code to get what I want done without really understanding what's going on
>>
>>61114638
what do you mean? graphs without math is a very narrowly-focused discussion of ADTs?
>>
>>61114653
It's really easy to implement.
If you had read K&R, you'd know how.
int atoi(char *s)
{
int n = 0;
if (!s)
return 0;
while (*s != '\0') {
n = n * 10 + ('*s' - '0');
++s;
}
return n;
}
>>
Saw some idiot in yesterday's thread unironically trying to argue that "select" in C# was just as good a name as "map" for the function that maps elements in a container to another function, because "the name map is only more intuitive if you've used Python" and "most C# devs come from an enterprise background so they're more likely to know SQL than Python."

Holy FUCKING shit.

https://en.wikipedia.org/wiki/Map_(higher-order_function)

Number of languages in which it is called map: 29
Number of languages in which it is called select: fucking ONE

The "map" function doesn't come from Python you god damn retard, it's a super basic feature that's included in almost every programming language ever. You know why it's called "select" in C#? Because the devs at MS who designed LINQ understood that the majority of so-called "programmers" using their tools are retarded code monkeys, and that while functional programming concepts can be useful even for retarded code monkeys, retarded code monkeys will never try to learn these concepts because they're fucking retards. So the MS devs changed all the names of these basic things to other random names only ever so slightly tangentially related to the original concepts, in hopes that maybe a few of the retards using the language would try them out one day because they've seen something similar once in a database query.

Seriously, calling map "select" is akin to that joke about a programming language for girls where "print" is renamed to "tweet" because otherwise girls won't understand what it does.
>>
>>61114638
My school taught it using Data Structures & Algorithms in Java by Goodrich
>>
>>61114707
They're two separate processes running independently. The parent section and the child section are happening at the same time.
It's the job of the operating system to take the data from the parent and give it to the child.
>>
>>61114719
i was the guy defending map
SQLfags btfo
>>
>>61114707
>>61114722
put another way, when fork() is called, the OS splits one process into two, and they both continue from that point. however, in the child process, fork has returned 0, and in the parent, it has returned the PID. in this case, the child executes the code inside the if, and then exits, whereas the parent skips the code in the if and continues at the for loop.
>>
>>61114719
>"most C# devs come from an enterprise background so they're more likely to know SQL."

Well, he's not entirely wrong.

Microsoft knows their target audience.
>>
>>61114716
He was probably complaining about atoi because it's kind of a shitty function which doesn't handle errors well.
It's perfectly fine for these sorts of situations though, since we have control over the input.
>>
NEW THREAD!!!

>>61114867
>>61114867
>>
New thread:
>>61114866
>>61114866
>>61114866
>>
>>61114876
Sorry bud, other other one was first.
By a single post.
>>
>>61114719
http://blog.ielliott.io/why-LINQ-is-broken/
>>
>>61114877
stop spamming the board
>>
>>61114856
Yes, and anyway, you can replace it with
(int) strtol(buffer, &endptr, 10);
if (*endptr != '\0' || endptr == buffer) {
/* handle errors */
}
>>
>>61114722
>>61114792
Ohhhh holy shit it just made sense

I'm gonna try it out with my program I hope it works

Thank you so much anon(s)
>>
>>61114891
like this?
(int) strtol(buffer, &endptr, 10);
if (*endptr != '\0' || endptr == buffer) {
p = *NULL;
}
>>
>>61114891
Normally for "untrusted" input, yes. But again, it's really not necessary in this situation.
>>
>>61114876
This one wins because trap
>>
rolling threads when?
tired of this happening ever 300 posts
>>
>>61114482
(n)curses is pretty standard, I think.
>>
File: 2017-06-27_22-15-31.jpg (225KB, 1136x818px) Image search: [Google]
2017-06-27_22-15-31.jpg
225KB, 1136x818px
>what are you working on

this

I think I worked more on its flashyness than anything
>>
File: poodr.jpg (44KB, 335x499px) Image search: [Google]
poodr.jpg
44KB, 335x499px
am just about to finish pic related tomorrow
suggest me a new book to read, /g/
Thread posts: 331
Thread images: 36


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