[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 319
Thread images: 40

File: Literate_Programming_book_cover.jpg (21KB, 300x449px) Image search: [Google]
Literate_Programming_book_cover.jpg
21KB, 300x449px
What are you working on, /g/?

Previous thread: >>60107221
>>
I'm rewriting the linux kernel in haskell
>>
File: 1481781995516.png (580KB, 862x890px) Image search: [Google]
1481781995516.png
580KB, 862x890px
Rewriting Haskell in simply typed lambda calculus.
>>
writing my suicide note into the linux kernel source code comments
>>
Rewriting my existence in the unvierse.
>>
writing my suicide note into the Haskell-linux kernel source code comments
>>
>>60113197
class UserInput(object):
def __init__(self):
self.value = ''

def read(self, prompt):
print(prompt)
while True:
value = input()
if self.validate(value):
return value

print('Invalid input value, try again.')

def validate(self, value):
return False

class UserName(UserInput):
def validate(self, value):
return len(value) > 1

class UserLastName(UserInput):
def validate(self, value):
return len(value) > 1

class UserAge(UserInput):
def validate(self, value):
try:
age = int(value)
return age > 18
except (Exception, ):
return False

def main():
name = UserName().read('Please enter the first name.')
last = UserLastName().read('Please enter the last name.')
age = UserAge().read('Please enter the age')

print(name, last, age, )

if __name__ == '__main__':
main()
>>
Rewriting lisp in Rust.
>>
>>60113593
>class for everything

why not "class main" too

with a single "run" method
>>
>>60113641
>why not "class main" too
I would if it was supposed to store the name, last name and age values for further use.
>>
File: Scotsman_2.png (221KB, 720x540px)
Scotsman_2.png
221KB, 720x540px
>BIT TWIDDLIN'
>>
>>60113593
OOP gone wrong
>>
>>60113706
So any OOP?
>>
>>60113743
No, any OOP is programming gone wrong. This is worse.
>>
Rate my pattern matching tutorial.
>>
>>60113743
>>60113763
>>
>>60113778
what sort of future 4D keyboard do you have to get characters like that m8
>>
Java is best language. I don't understand why someone would need anything else.
>>
>>60113778
isMatch(yourTutorial, "shit") // returns true
>>
>>60113807
>I don't understand why someone would need anything else.
I would imagine the most common reason is not being subhuman.
>>
>>60113807
just because you have a hammer does not mean every problem is a nail.

especially when it's an old, plain, hammer thats been worn down to a nub by zillions of indians.
>>
>>60113796
Most fancy characters are just <esc>something<esc>

The 'and' symbol is <esc>and<esc>, prime is <esc>'<esc>
>>
>>60113835
how do you do the lady in the red dress?
>>
>>60113835
What environment ?
>>
>>60113778
10/10
>>
>>60113840
Natural language input?

>>60113865
Mathematica notebook.
>>
>>60113197
(defvar questions
'(("Enter first name" valid-first-p)
("Enter last name" valid-last-p)
("Enter age" valid-age-p)))

(defun valid-first-p (x) t)
(defun valid-last-p (x) t)
(defun valid-age-p (x) t)


(loop for i in questions
do (format t "~a: " (first i))
(setq x (read-line))

when (funcall (second i) x)
do (nconc i x))
>>
File: ulisp.jpg (350KB, 768x1024px)
ulisp.jpg
350KB, 768x1024px
just got ulisp installed on my Uno. breaking out a PS/2 right now to type to it :)
>>
>>60113706
That's not OOP though. It may look like it but it's not.
>>
>>60114103
What's OOP? I grant you that OP's code was just an abuse of Python's features. Now what's OOP?
>>
File: 1492909779234.png (821KB, 1000x750px)
1492909779234.png
821KB, 1000x750px
What kind does '*' itself have in Haskell?
>>
>>60114103
Due to lack of encapsulation or anything else?
>>
File: 1484257526493.jpg (56KB, 604x453px)
1484257526493.jpg
56KB, 604x453px
>>60114164
OOP is a programming paradigm that focuses on modeling code after real world features. It promises maintainability and reusability, but if done sloppily (like >>60113593 ) it tends to lead to more problems in the long run.
>>
>>60114235
>installed Gentoo, but still have an Ubuntu-tier beard
it's not fair
>>
File: Python_logo.png (76KB, 1890x800px)
Python_logo.png
76KB, 1890x800px
Why does everyone here hate Python?
>>
File: 1475624685457.jpg (58KB, 600x763px)
1475624685457.jpg
58KB, 600x763px
>>60114333
I don't. I use it a lot, it's helpful.

A lot of people here aren't of the opinion that a language is just a means to an end though. I'm not sure I understand the complete dedication and adherence to one language.
>>
>>60114333
Hipsters; it's too popular.
>>
>>60114333
I don't think everyone here is that intelligent, by which I mean "above 60 IQ".
>>
Python front-ends to C++ libraries.
>>
>>60114333
The same reason people hate JS.
It got too popular and widespread, but not on merit.
>>
>>60114333
Used by people who don't know what they are doing and rely on Google to solve their problems for them.
>>
finally finished my shitposting bot in python

now to make a necrobumper
>>
>>60113416
what do I read to understand how computers work?
>>
>>60114616
Intel Dev Manuals
>>
I am making an rpg game in Java and right now I am implementing a tilemap. I want to store information about each tile, right now the tile type id (int) and Entity objects

The first way I can do this is have an int[] array that stores the tile type id and another separate same size array that stores Entity objects. Also the array index corresponds to a position on the map. The amount of memory needed is about:
4 bytes * array size + 16 bytes * # of Entities + 4 bytes * (# of Entities
- array size)

The second way is have an array of Tile objects that stores the tile type and Entity object. But that means my array is filled with Tile objects and that will take as much memory as the first way plus another 16 bytes * array size for the Tile objects but this way seems easier to work with. Which method is the overall best?
>>
How dead would /dpt/ be if there was a video-game programming general on /g/.
>>
>>60114616
Start with maxwells equations
>>
>>60114649
Wrong board.
>>>/vg/
>>>/v/
>>
>>60114235
Basically I write code however I want, then call it OOP. That definition is the vaguest of all. It doesn't imply inheritance not single dispatch or even types afaict. This is the kind of definition that allow you to locate concrete objects or recognize them when you see them, like say "the washington monument is an obelisk built in front of the Capitol in Washington D. C., USA". For concepts it doesn't work --- and ironically OOP shills ignore the difference when they think about code --- and just leads you to believe whoever claims to know OOP knows the real OOP and you've found what you were looking for, even though said real OOP isn't. To me this makes the term redundant when discussing programming because everyone has a different methodology/paradigm they call OOP. So yeah, OOP is neither shit nor not shit, let's move on to discussing the value of dynamic dispatch, duck-typing, namespacing disciplines, implementation hiding and such.
>>
>>60114696
>let's move on to discussing the value of duck-typing
Stopped reading right there.
>>
>>60114684
There's very little video game programming talk as it is.
>>
>>60114701
I didn't say it was good tho. So it's so bad it doesn't even deserve to be discussed according to you? M8 Imma blow your mind: everywhere there's RPC, there's duck typing in action. Good luck swallowing that fgt.
>>
List some things that Hipsters do in Software Development/Web Development:

1.) Program in Ruby
>>
>>60113593

from itertools import starmap

name_validator = lambda x : x if len(x) > 1 else False
questions = [ ('Please enter the first name.', name_validator)
, ('Please enter the last name.', name_validator)
, ('Please enter the age.'
, lambda x : x if x.isdigit() and int(x) > 18 else False)]
name, last, age = starmap(lambda x, y:(print(x), y(input()))[1], questions)

print(name, last, age)

Pretty sure this is what you meant.
>>
>>60114805
>So it's so bad it doesn't even deserve to be discussed according to you?
It (and everyone who uses it) deserves to be laughed at. That's about it.
>M8 Imma blow your mind
I suggest you return to whichever internet cesspit you came from.
>everywhere there's RPC, there's duck typing in action
Your point being? It's fucking trash.
>>
>>60114684

Considering we already have a video-game programming general on /vg/, I don't think we'd be that dead. /dpt/ mostly does not talk about game dev.
>>
>>60114878
>MUH OOP
>>
>>60114909
>MUH
>>>/r/abbit
>>
>>60114925
Sir, excuse me, but I believe you have misunderstood my post. I was only pretending to be retard to make a point about the OP. Hopefully this can be avoided in the future.
>>
>>60114696
You seem upset.
>>
>>60113593

You should stop programming.
>>
File: metropolis.png (208KB, 790x1166px)
metropolis.png
208KB, 790x1166px
Holy shit. Weeks of trying to figure out what the Markov chain Monte Carlo algorithm was about where every internet blogger I came across was either too vague or left out a critical detail and I finally find the key in this book. Turns out it's extremely simple.

Blitzstein, "Introduction to Probability" if anyone is interested. Fantastic book. Also has a really good explanation of Bayesian inference.
>>
short table[512];
static short table1[512] = {.......};
...;
memcpy(table, table1,512*sizeof(short));

Jesus Christ, Matlab.
>>
>>60114824
Does she call her dad mom or dad?
>>
>>60115060
That what optimizers are for.
>>
>>60115060
That doesn't look like Matlab.
>>
>>60113416
Implementing a shitty undocumented internal standard into the horrid abomination of a code base that the company that hired me develops and markets to airline companies.
>>
>>60115111
It's what a matlab to c compiler did for me
>>
'big data' visualization in JavaScript front to backend
>>
Should I learn Fortran?
>>
File: 1404802234845.jpg (34KB, 640x480px)
1404802234845.jpg
34KB, 640x480px
>decide to brush up on my math
>load up Khan Academy
>start from the beginning
>realize I forgot how to do long division
>>
>>60114960
I'm sorry I'm an intellectual and you're not.

kys codemonkey
>>
>>60115060
The static one is the literal, which must be instanciated each time the function is run so it can be mutated. What's wrong with that?
>>
How to use C++ properly?
>>
>>60114696
God I hate you anon. You don't understand anything about OOP. You don't even understand he practical reality of what people call OOP. Yet you speak so surely about it. Horrible.
>>
>>60115403
Nobody really understands OOP.
>>
>>60115393
https://youtu.be/yG1OZ69H_-o
>>
>>60115419
I was undefined once.

I got better.
>>
>>60115345
I know this is a meme but that's what computers are for! Kids shouldn't have to memorize such banal algorithms now that everyone has a smart phone in their pockets. They should just be taught the IDEA behind division so they know when to apply it.
>>
what do you think about making a scripting language with C-like syntax?
>>
>>60115412
Small talk programmers understand OOP very well. And they understand what people claim to be OOP.
https://youtu.be/RdE-d_EhzmA
Here's a talk explaining the difference between actual OOP and the stuff pajeets peddle as object oriented programming.
>>
>>60115452
sounds like PHP :(
>>
>>60115374
Forgot to write that table1 was also constant and that table was also never modified after the copy.
>>
>>60115442
you're gonna eat those words when the white board tells you to make a function divide(x,y,b) that divides x by z in base b with up to 3 decimal places
>>
File: 1399339118262.jpg (19KB, 500x367px)
1399339118262.jpg
19KB, 500x367px
>>60115453
I hate programmers that are small talk.
>>
>>60115460
is php even a scripting language though? i've never thought of it as one. just thought of it as a language for websites
>>
>>60115393
Write it in Ada then write a wrapper in C
>>
>>60115432
See this claim is why you need that talk.
It's not about the program being wrong or not. It's about your intent matching the code you've written.
>>
>>60115464
...kinda

Yeah it makes no sense in the big picture. I still like the idea though.
>>
>>60115472
>base b with up to 3 decimal places

Well it wouldn't be called a decimal place if it wasn't in base 10, now would it?
>>
>>60115483
it is certainly formed to be geared towards web applications, it is also a scripted language.
>>
>>60115514
i think it still would be called that. is there any other word for it?
>>
>>60115508
The stupidity doesn't come across unless you see the whole function, I guess.
>>
File: 1492896613756.png (315KB, 1680x740px)
1492896613756.png
315KB, 1680x740px
>>60115403
>what people call OOP.
Nigger there is no such thing because there is no conceptual definition. It's at best a bunch of poor man's Grandma Wisdom for programmers, and yet people pull a cult for it. Go figure.

Fucking idolaters, burn them alive in the name of gnu.
>>
>>60115537
Hexadecimal places?
>>
XXDOMVFSSOLUTIONPROCESSINGCONTEXT * ppItin = ( XXDOMVFSSOLUTIONPROCESSINGCONTEXT *) xxdomvfsThreadAlloc(hThred, sizeof(XXDOMVFSSOLUTIONPROCESSINGCONTEXT *));
pItin->data->moredata.somedata->evenmoredata();
xxdomvfThreadTerm(pItin);
>>
>>60115555
the general term's a radix point
>>
File: 1491250434679.gif (2MB, 800x448px)
1491250434679.gif
2MB, 800x448px
>>60115561
Oh, I didn't realize we had ourselves a mathematician in the room. Here, have a rare Pepe.
>>
>>60115580
i just looked it up on google but ty for the pep
>>
SAVE ME.
I can't continue, I don't fucking know how to use this shitty tool, itext and the rest that is out there is pure garbage and there is no documentation of how things work. Why are they doing this to me...
>>
>>60115593
Use tex to generate pdf.
>>
>>60115551
If we were to directly initialize the automatic array with a compound literal, wouldn't the compiler produce code that does basically the same thing: copy in the array's content from a read-only memory section? Isn't that the essence of a literal? That's what fascinates me.

Also static locals make me go wet.
>>
File: 1444526987285.jpg (60KB, 422x600px)
1444526987285.jpg
60KB, 422x600px
>spend two weeks learning to program
>spend the rest of your life memorizing APIs, libraries, and frameworks that rarely make any kind of sense
>>
>>60115618
>spend the rest of your life googling APIs, libraries, and frameworks that rarely make any kind of sense
ftfy
>>
File: quoting.jpg (7KB, 200x135px)
quoting.jpg
7KB, 200x135px
>>60115618
hey sorry I was just wondering, of those participating in this thread which particular participant is it that you were recalling an anecdote from?
>>
>>60115345
oh yes I had the exact same problem.
also khan had me doing unit conversions in ridiculous units like gallons and yards. as a eurofag, fuck that bullshit.
>>
Working on a Python script that uses CompVision/ML to detect and filter frogposts.

Anyone interested?
>>
>>60115609
The thing is, there are 8 tables that table becomes. So it would be compiled into simple memcpys from the bss data to the stack data. There were also a few gems where it wanted to allocate a few MB sized arrays in bss.
>>
>>60115601
Wouldn't that be too wonky?
Problem is that the place I am at have a java ee application that stores data collections and other stuff, so they want me to work on something that can allow them to fetch data from DB format it neatly into a PDF.
Looking through itext and pdfbox is just a hassle, I can't even get a simple thing as filling a page to full without it overflowing and following the tips and guideline from the idiot maintainer of itext, it won't work.
>>
>>60115672
You sound like an SJW or a tranny.
>>
>>60115452
I think Perl
>>
>>60115694
Seriously tex is the most simple and most robust tool to generate pdf files. Anything else is a buggy shit. Trus me.
>>
>>60115695
Mad as fuck redditfrog poster detected in this quadrant
>>
>>60115692
Yeah nice I see so
>>
how exactly does else work?
it refers only the last "if" or all "if"s before it?
and else if?
>>
>>60115722
Care to hook me up on direct info regarding it's usage.
>>
>>60115726
Yeah, you're definitely a tranny.
>>
>>60115726
sup
>>
Is this the fastest vector library in Haskell?
http://hackage.haskell.org/package/vector
>>
File: 1451343691848.gif (463KB, 450x340px)
1451343691848.gif
463KB, 450x340px
>>60115742
Stay mad dumb frogposter
>>
>>60115553
OOP the person who coined OOP had a few problems to solve. There's programming that solves these problems according to the method he described.
There's people who don't solve these problems and don't follow the methods described yet call it OOP. That's how their supposed OOP isn't OOP.

Would you call something functional programming if it uses different global variables inside every function? I wouldn't.
>>
>>60115769
>gets mad
>starts posting frogs

Literally a mental illness.
>>
>>60115736
Wikipedia use it to generate pdf. Trust me anon, anything else is shit that you'll hate. Trust me. TeX is the best tool, made by one of the best coder in world. Don't use tool made by code monkeys. You'll regret it. Trust me anon.
>>
>>60115730
Only the last if, and all sequences of one if refered to by any number of else if. A bunch of if -> else ifs -> optional else are all mutually exclusive, ie, at most one of them will be executed at each pass (exactly one if there's a else)
Practice it and it'll come naturally.
>>
>>60115778
>the person who coined OOP had a few problems to solve.
Ok post that source please I never saw it.
>>
>>60115781
>gets butthurt because his redditfrog posts will soon be automatically filtered
Poetry
>>
>>60115778
>if it uses different global variables inside every function
What is that even supposed to mean?
>>
>>60115783
can you give me a short example on how do i make one else for multiple ifs?
>>
>>60115789
You can obviously look into it yourself. I can't be expected to present the entire history of a 60 year old idea here.
The more concise versions are available through interviews with the inventors of simula.
>>
>>60115840
Functional programming aims to reduce side effects among other things. If you constantly have side effects is it really functional programming?
>>
>>60115863
What you described doesn't seem to be a side effect.
>>
>>60115863
If I can specify that a function doesn't have side effects, does that make it functional?
>>
>>60115906
>does that make it functional?
Does that make what functional?
>>
functional programming sacrifices efficiency for conciseness. how is that not pajeet?
>>
>>60115916
Whatever the fuck "functional programming" is.
>>
>>60115883
You'd have to motivate that for me.
Using state that isn't passed as arguments to a function breaks the equivalence to mathematical functions. There's no guarantee that two invocations of the same function with the same arguments produces the same results anymore.
>>
>>60115921
As opposed to sequential programming, of course.
>>
>>60115965
as opposed to imperative programming.
>>
>>60113468
impossibru
>>
>>60115921
Are you asking if a function can be functional?
>>60115951
>Using state that isn't passed as arguments to a function breaks the equivalence to mathematical functions.
That's absolutely retarded if by "passed as arguments" you mean what any normal person would mean, namely something like "f x" where x is an argument.
>>60115965
You can do either of them in the other one, how is that "opposite"?
>>
>>60115918
because pajeet sacrifices conciseness and efficiency for employability
>>
>>60115846
You cant by definition
>>
>>60115998
>that's retarded
Motivate. You're absolutely terrible at conversion anon.
>>
File: 1478648159697.png (230KB, 624x532px)
1478648159697.png
230KB, 624x532px
>>60115992
Why is that?
>>
>>60115998
Languages aren't OOP or functional or anything else. Languages merely implement constructs to facilitate programming in a certain way more efficiently.

You can write full fledged OOP code in C, if you were so inclined. The language just doesn't have any features to really help you with that, so it's up to programmer discipline to not violate proper OOP guidelines.
>>
>>60115998
I'm asking what a functional programming language is.
>>
How do I position elements that I want to print in winforms? Say I want to make a shipping label, should I give up?
Help
>>
>>60116037
>it's up to programmer discipline to not violate proper OOP guidelines
It always is, even in Java or Simula or whatever lang is the most OO. That's why we have this pattern-antipattern Voodoo speak spread all around the place.
>>
>>60116029
well it's possible but really inconvenient
>>
>>60116050
http://stackoverflow.com/questions/968728/update-label-location-in-c
???
>>
>>60116027
It's obvious to anyone who knows the basics of any functional language. Global (immutable) state doesn't somehow break referential transparency.
>>60116037
>Languages aren't OOP or functional or anything else.
That's wrong. I can construct the set of all languages which are OOP, but that would be fucking impossible if OOP wasn't actually a thing.
>>
File: JUST frog.jpg (44KB, 374x363px)
JUST frog.jpg
44KB, 374x363px
How do I not get cucked out of my free time by my employer?

I'm currently looking for a new programming job and my biggest fear is getting duped into joining an intern farm.

How do I just work the required 8 hours a day without getting coaxed into unpaid overtime and working at home?
>>
File: 1490176958745.jpg (36KB, 512x512px)
1490176958745.jpg
36KB, 512x512px
>>60116077
You were actually correct. It's impossible since one of them isn't Turing complete. That wouldn't be a problem though, since it will be Haskell-- (Haskell without recursion).
>>
>>60116101
They call it an "object oriented" programming language because the language features keywords that place restrictions on your code such that it facilitates programming in an object oriented manner. You're free to not use said keywords and program in a purely functional way in such a language.

Similarly, in a non-object oriented language you can enforce said restrictions yourself, you're just not going to get any compiler warnings for violating them.
>>
>>60116136
i assumed you meant ST + fix
>>
>>60116156
Write me a line of C# that doesn't inherit form Object then, faggot.
>>
>>60116097
What if it's used on different printers or monitors? That's one reason I don't want to use fixed values.
>>
>>60116182
static class
>>
>>60116185
http://www.techrepublic.com/article/manage-winform-controls-using-the-anchor-and-dock-properties/
>>
>>60116156
Oh, I see, you think FP is somehow the opposite of OOP. I should have noticed that I was talking to a complete retard a lot earlier.
I can create a language in which it is only possible to write in an OOP style, therefore OOP is an actual thing.
>>
>>60116191
C# 3.0 spec, 10.1.1.3:
>A static class may not include a class-base specification (§10.1.4) and cannot explicitly specify a base class or a list of implemented interfaces. A static class implicitly inherits from type object.

>A static class implicitly inherits from type object.
>>
>>60116175
It's not going to have any recursion or looping at all. Also I'm going to fix the type system by removing bottom from all types.
>>
>>60116233
inheritance is about instances, not static
Are you high anon? Do you know what OOP is?
>>
>>60116236
>Also I'm going to fix the type system by removing bottom from all types.
https://coq.inria.fr/
>>
>>60116256
This retard seriously thinks he can argue with the spec. I bet he thinks the world is flat, too.
>>
Is Ruby a good starter language if all I want to do is practice thinking and using computer logic without worrying too much about other complicated things? I'm retarded btw.
>>
>>60116198
Thank you for the replies, but does docking and anchoring work even if I only want to print specific elements? I don't want to print radiobuttons and listboxes.
Where do I dock and anchor if I print? The document itself?
>>
File: 1489270446091.jpg (36KB, 246x274px)
1489270446091.jpg
36KB, 246x274px
>>60116275
It's not going to be that good.
>>
>>60116340
Ruby is a good starter language if you plan on becoming a girl
>>
>>60116353
Just implement calculus of constructions interpretor.
https://en.wikipedia.org/wiki/Calculus_of_constructions
>>
>>60116340
just stick with Python
>>
File: file.jpg (38KB, 418x673px)
file.jpg
38KB, 418x673px
>>60116368
I've made my decision. Th-thanks.
>>
>>60116352
Sorry, I don't understand what you mean by "print". Generally you can create whatever objects you want and position them through code, be it radiobuttons or listboxes or labels... As for where to dock and anchor them and stuff, it's hard to explain over a 4chan post. You should just try messing around with the built-in editor until you get a feel for it. Then try creating your objects from code.
>>
>>60116407
It doesn't help you become a girl though
>>
>>60116373
Should I first try implementing a simple dependently typed lambda calculus?
>>
I'm getting myself into learning neural networks.
Is this a bad meme?
>>
In C++, if I define an int pointer array ( int *a=new int [8] ) and write a value to said array ( a[1]=7 ), am I writing the address of the number to array?
>>
>>60116427
Print as in not programatically, but using a laser or inkjet printer.
I'm making a program which prints barcodes from user input, but I have hard time lining up the elements so that they look good on paper.
>>
>>60116433
No. Start with calculus of constructions. There are only four constructors.
>>
>>60116470
no, you're writing 7 to the array.
>>
>>60116470
first of all, what you described with
int *a = new int[8];
is not a "int pointer array" it's just an array of ints, represented in the machine by a pointer to it's first element.

if you write
a[1]=7;
you de-reference the second element of your array and set it to seven.
>>
>>60116491
Oh I see, literally print. It can definitely be a pain to create a usable printing template. I'd start by making a marker for each corner (by setting absolute positions of, say, radiobuttons), get them to be positioned properly on paper and then work from there. But you're pretty much just going to have to tinker with it and move stuff until everything lines up.
>>
File: suicide is bad.png (32KB, 417x209px)
suicide is bad.png
32KB, 417x209px
>>60113563
>>
Is there a good interactive advanced git tutorial anywhere?
I know the basics, but i have no idea what cherry-pick, reflog are, or how to use them.
>>
>>60116453
Not if you can understand the math instead of just using muh tensorflow
>>
>>60116947
cherry-pick is something like I want just one part of something that somebody else committed on another branch, and i merge in just that little selection to my branch
>>
how to stay motivated to do things ;_____;
>>
>>60116453
learn neural networking for a day and then tell a minecraft server you can make them a neural network anticheat for BIG BUX
>>
>>60117049
motivation doesn't work, work on determination.
>>
>>60116948
My math isn't that good but I'm reading some posts on medium and some videos on YouTube just to get comfortable before moving on the "neural evolution of augmenting topologies" paper.
Any advices on something else I should read?

>>60117051
Added to my to-do list
>>
I wrote a chip8 emulator, a text editor, a wolfenstein3d clone, a hipster blog in nodejs, a gif/lzw decoder, a huffman decoder/encoder, a deterministic AI for a simple game in scheme, a tool for image tagging with a web interface and a fizzbuzz in befunge. What should I do next?
>>
>>60117049
>this
>>
>>60117196
something actually useful.
>>
>>60117196
Statically analyze them
>>
>>60117196
Stop coming here, Bisqwit and make more videos.
>>
>>60117196
witcher 4
>>
What are /g/'s recommended books for programming/algorithm design/software engineering.

I won't have much to do in summer and other than personal projects, I might try reading some books.
>>
File: 58859010.png (972KB, 1280x720px)
58859010.png
972KB, 1280x720px
>>60117465
>>
>just starting programing
>make fun of factories and other OOP "design patterns"
>program for a while, realize all these little problems in my code
>slowly start using factories and other "design patterns"
>code is much cleaner and easier to maintain
well, fuck
>>
>>60117534
Other than SICP.
>>
>>60117465
>algorithm design
trivial, API design is the hard problem
>>
>>60117465
System Design with Ada
>>
What are some open source repos on github that are in dire need of contributors (fixing bugs, etc.)
>>
>>60117660
i just look for things i use
>>
In what situations would a STL list be appropriate and when wouldn't it?
>>
>>60117894
lists allow fast insertions and deletions but are slow to traverse
>>
File: learning-c_sharp.png (8KB, 312x312px)
learning-c_sharp.png
8KB, 312x312px
hey fellas, i have a question: is C-Cage language invented by Nicolas Cage? or does it mean it is for negro convicts? should a straight white well developed arian male like myself use it? i mean.. i like Nicolas Cage but i aint no negro convict
>>
>>60117914
Thank you, also can you think of a composite data structure that has a lookup of Order N?
>>
>>60117990
a list. O(n) lookup is bad
>>
>>60117990
a list has a worst case of O(n) => you have to traverse all n elements to get to your desired element.

an array has a constant lookup of O(1)
>>
>>60118001
Its for a final problem lol, I have to come up with a composite data structure(2), to store information about a remodel of a home. And the composite must have a lookup of O(n) .
>>
Java question. Say you want to set an instance variable in the constructor, is there a difference between using "instanceVar =x" or "this.instanceVar = x"?

The only difference I can think of is if you pass a parameter in the constructor which has the same name as inst
>>
>>60117914
>>60117894
deletions and extensions are very fast compared to an array, traversal is fine (same order of magnitude as an array), but lookups are slow. looking up the nth element requires O(n) time, looking up the element in an array takes O(1) time.

most of the time you iterate though your arrays so you dont lose much by using a list unless you need random lookup
>>
>>60118060
>>60118042
Thank you for these responses.
>>
>>60118054
You're right. It compiles to the same thing.
>>
File: books.jpg (393KB, 900x2134px)
books.jpg
393KB, 900x2134px
>>60117465
clrs is comfy

I'd add https://www.goodreads.com/book/show/284369.Computers_and_Intractability
https://www.goodreads.com/book/show/1553935.Principles_of_Artificial_Intelligence fun books, bit dated but still solid
>>
>>60118060
>traversal is fine (same order of magnitude as an array)
right, i meant lookups, my mistake.

but even so, in implementation an array is still faster traversed than a list because of cache.
>>
>>60118106
So which one is preferable? this. just for clarity?
>>
>>60118113
though, a lot of people say that dragon book should be replaced by https://www.cs.princeton.edu/~appel/modern/

and gof is just shit apparently
>>
>>60118127
Whatever your style guide says.

I would declare all parameters as final to prevent accidental overwrites, and then only use `this` if required.
>>
CSS developer here
>>
>>60118060
>traversal is fine (same order of magnitude as an array),
Is it really? Do you have a benchmark?
>>
>>60118178
post fizzb.css
>>
>>60118178
How was the bootcamp?
Meet any friends?
>>
>>60118216

ul {
list-style-type:none;
}

li:nth-child(3n), li:nth-child(5n) {
font-size:0px;
}

li:nth-child(3n):before {
font-size:16px;
content:"Fizz";
}
li:nth-child(5n):after {
font-size:16px;
content:"Buzz";
}
>>
>>60118242
ayy lmao
>>
Have you read Gödel, Escher, Bach /dpt/? Is it a decent read or a pseudointellectual wank?
>>
Great talk about why types aren't just about avoiding errors: https://www.youtube.com/watch?v=3U3lV5VPmOU
>>
>>60118113
LYAH << Haskell Programming from First Principles
>>
PASCAL programer here.
>>
>>60118361
Not an acronym
>>
>>60115726
Who's the semen demon?
>>
There are two types of programming: functional and dysfunctional.
>>
>>60118420
xD
>>
Dynamic typing is morally wrong.
>>
>>60118335
I really liked it. It's less practical than SCIP but really really interesting.
>>
Error 1 error LNK2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl ict::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class ict::Date const &)" (??6ict@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV12@ABVDate@0@@Z) referenced in function "bool __cdecl equalDates(class ict::Date const &,class ict::Date const &)" (?equalDates@@YA_NABVDate@ict@@0@Z) C:\Users\user1\Google Drive\old\visualStudioProjects\milestone1\milestone1\02-ConstructorTester.obj milestone1
>>
>>60118530
true
>>
>>60118335
it's not wank it's a good read.

>>60118562
less practical is an understatement rofl
>>
>>60118577
c++ is hecking fun innit my dude
>>
>>60117584
>>60118113
>>60117638
Thank you for the responses.
>>
>>60118577
I need help
>>
>>60118380
Programmers Advocating Structure Create Awful Languages
>>
>>60118591
Try running it through stlfilt
>>
>>60118586
std::ios_base::Init
>>
>>60118577
Forgot to include something, or its not linked properly.
>>
>>60118530
Haskell curry was an advocate of dynamic typing.
>>
>>60118661
And Newton thought the solar system is stable.
>>
>>60118609
I am very much interested in how to use stlfilt.
Can I even integrate that into visual studio 2013, its not showing up on the extensions and updates
>>
>>60118656
Your tail call leads to an infinite loop.
>>
>>60118675
Gotos are not ``tail calls".
>>
>>60118709
What's this meme about using the ` character?
>>
>>60118723
They're ``faggot quotes" from old new /prog/.
>>
>>60118723
` is useful to put something in quotes without using " or ' so that the quotation isn't mistaken for a string literal or char literal. I use them in my comments all the time

It's also used for multi-line strings in the latest Javascript
>>
is there a better data visualization library in python than seaborn
>>
>>60118723
https://tex.stackexchange.com/questions/10670/quotes-in-latex

>>60118752
>so that the quotation isn't mistaken for a string literal
use code tags

>It's also used for multi-line strings in the latest Javascript
it predates that
>>
>tfw good at programming but bad at ideas
>>
why is this general the only one without discord channel?
>>
>>60118785
I mean in a code comment like:

// The format for the task field list is `ActivityKey|CRMKey;ActivityKey2|CRMKey2` etc.
>>
>>60118816
Fuck off with your proprietary garbage.
>>
>>60118816
because discord is like IRC and teamspeak had a normie baby.
>>
>>60118816
it's a fucking 4chan thread

also,
>discord when mumble exists

do you want us to make a facebook group too

>>60118831
oh
https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code
>>
>>60118832
this tbqh
>>
>>60118816
It has one but it's terrible and full of memes, frog posters, and /pol/tards
>>
>>60118890
Isn't that all of 4chan?
>>
File: just.jpg (36KB, 482x427px) Image search: [Google]
just.jpg
36KB, 482x427px
>Trying to get tomcat to work with eclipse in linux.
>Give up after wrestling for almost 1h.
>Eclipse thinks every OS must be windows.
>abandon tomcat 8 and install a second one in /home using the wizard
>I can finally add a server.
>publish
>nothing happens
>lets press run
>now eclipse says the server is up
>still nothing happens
>lets check the tomcat page in browser
>404

I bet IntelliJ would have published and made me a sandwich by now. Sucks being poor.
>>
>>60118930
The community edition is free.
>>
these new thread baits are good, surprisingly triggering
well done
>>
>>60118979
Install Appchan X and they wont be.
>>
epic trolling /b/ros

we did it reddit
>>
>>60118930
Whom quote?
>>
>>60119015
Thee.
>>
>>60118832
have you seen riot's privacy rules?

>>60118836
doesnt answer the question

>>60118860
no one uses mumble
>>
File: scrot.png (210KB, 1010x758px)
scrot.png
210KB, 1010x758px
is this as good as it sounds?
>>
>>60119100
Yes, it sounds terrible
>>
>>60119100
no
>>
>>60119303
faggot
>>
>>60114164
OOP = Object Oriented Programming
>>
>>60119073
>have you seen riot's privacy rules?
/v/baby please go
>>
>>60118816
>>>/v/
>>>/b/
>>
>>60119464
b-but I want to socialize with my fellow autists
coworkers are ultranormie c++ dudes
>>
>>60115452
literally javascript
>>
@60119479
I don't socialize with subhumans, fuck off. You're probably neurotypical as well.
>>
Reminder to stay hydrated.
>>
>>60119479
Prove to me that you're autistic. Name your favorite language.
>>
/\[quote="([\s\S]*?)"\]([\s\S]*?)\[\/quote\]/g


Why does this only seem to match "once"?

for example

let format_search = [
/\[quote="([\s\S]*?)"\]([\s\S]*?)\[\/quote\]/g,
];
let format_replace = [
'<table class="table table-responsive"><tbody><tr><td class="quote"><b>$1</b>$2</td></tr></tbody></table>'
];

for (let i = 0, len = format_search.length; i < len; i++) {
text = text.replace(format_search[i], format_replace[i]);
}


will not work with

[quote="username1"]
[quote="username2"]
[/quote]
[/quote]
>>
>>60119529
Javascript
>>
>>60119535
https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags
>>
File: 1492831891533.png (341KB, 556x561px)
1492831891533.png
341KB, 556x561px
>>60119535
>Using regex to parse a non-regular grammar
>>
>>60119563
I'm parsing bbcode, not html
>>
>>60119595
the answers apply to bbcode too
>>
>>60119603
What a useless reply
>>
>>60119529
Haskell
>>
>>60119629
it's simply not possible to "parse" sh*t like that using regular expressions

you should look for a bbcode parsing library or a parser generator or something

or if you want a shitty solution you could replace start and end tags separately but then you'd have some edge cases to handle::

[quote][b][/quote][/b]


[quote][quote][/quote]
>>
>>60119548
I said autistic, not retarded.
>>60119648
Formally prove it.
>>
>>60119563
what is a ``regular language"?
>>
Can someone give me a blueprint on how to create a vector of priority queues?
>>
>>60119670
you're such an epic inside memer for using the meme quotes
congratz /b/ro
>>
>>60116101
>I assumed immutable state
OK so you made a stupid assumption. Got it.
>>
>>60119679
>epic
>memer
>meme
>congratz
I don't want reddit stink nearby. Fuck off.
>>
>>60119670
Any language that can be recognised by a finite automaton.
This also happens the exact same set of languages that can be expressed using a regular expression.
>>
File: me.jpg (33KB, 600x450px)
me.jpg
33KB, 600x450px
>>60119702
it was a le joke
>>
>>60119698
Why would you ever allow immutable state?
>>
>>60119698
The word "state" itself doesn't imply mutability, so of course I would assume that.
And by the way, I didn't say what you wrote.
>>
>tfw js unironically uses ` meme
is js dare I say it /ourlanguage/?
>>
File: me.jpg (96KB, 1280x720px)
me.jpg
96KB, 1280x720px
>>60119707
>le
>>
>>60119738
>tfw
>unironically
>meme
Why the fuck are you even here? If you're going to act like a fucking redditor, go to fucking reddit.
>>
>>60119664
There aren't any, only one I found crashed when I set it up (https://github.com/svenslaggare/BBCodeParser). Guess I'm fucked then.

This ghetto approach works by the way, ridiculous
var quote = text.split('[quote="');
var length = quote.length;
while (--length) {
text = text.replace(/\[quote="([\s\S]*?)"\]([\s\S]*?)\[\/quote\]/g, '<table class="table table-responsive"><tbody><tr><td class="quote"><b>$1</b>$2</td></tr></tbody></table>');
}
>>
Whats the best resource to learn programming for android?
>>
>>60119728
>>>60119698 (You)
>The word "state" itself doesn't imply mutability, so of course I would assume that.
The word state doesn't imply immutability. So why would you assume that?
Anon part of communication is questioning assumptions. If you genuinely wish to understand someone you do not hold your assumptions as fact when something doesn't seem right.
>>60119719
I don't need you to jump into this conversation without understanding the context. From context it's perfectly clear that if global state is supposed to break the purity of a function and make it a procedure it'd have to be mutable state.
>>
NEW THREAD!

>>60119799
>>60119799
>>
>>60119804
I am a reasonable person, and I was operating under the assumption that you were one as well.
Only an unreasonable person would suggest mutability as the default, therefore it is okay to assume that you were talking about immutable state.
>>
>>60119738
>js uses `
it does? when?
>>
File: Capture.png (60KB, 1133x754px)
Capture.png
60KB, 1133x754px
Wasn't sure whether to post this to /dpt/ or /sqt/. I'm learning JavaScript (inb4 ">JavaScript" + smug_asuka.png) and I feel extremely retarded, and I'm questioning how I've made it this far in life.

Pic related is the issue. I understand after some time exactly how it works. Using a for loop it sets a rudimentary "counter" called i to 0, checks each character in the string, and then the iterator i++ adds 1 to the count and loops until the if condition is met. When the condition is met it enters the second for loop

It's purpose is to search a string for a name. It's really basic and shitty since it doesn't check for the entire name, just the first capitalized letter then pushes it to an array called hits which then prints it to the console. So as long as you don't include a Capital letter the same your name starts with, it works fine. My question is this: Once the name has been pushed to the hits array it returns back to the first for loop and continues once again, but how does the first for loop's "counter", i, know where to pick up? According to my broken understanding it would just print infinitely in a loop. The only missing link is the iteratori++, what are the order of operations with this thing? When does it execute?

My whole understanding of this thing is fucked and I feel like a moron. Hopefully someone can understand my crazy ramblings.
>>
>>60120070
Wrong thread. Untyped garbage is by definition not programming since it doesn't correspond to any logic.
>>
>>60120070
>how does the first for loop's "counter", i, know where to pick up?
the second loop is still inside the first, and the i isn't changed in the second loop, so once it leaves it should have the same value and continue working as defined by the for (go until i<text.length, do i++)
>>
>>60120070
try executing a for loop and find out

i think the ++ happens at the end of the for loop though, so if it caught E at i=50, after the nested if and for loop, i would increment to 51
>>
File: 134839483.gif (2MB, 200x200px)
134839483.gif
2MB, 200x200px
>>60120257
This answer helped a lot, after playing around in the console I found the ++ iterator executes once the nested 'if' and 'for' loop finishes.

Thanks anon !
>>
>>60119759
Please refrain from making posts that are not related to programming in this thread.
Thread posts: 319
Thread images: 40


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