[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: 313
Thread images: 27

File: 1491145897328.gif (473KB, 500x355px) Image search: [Google]
1491145897328.gif
473KB, 500x355px
What are you working on, /g/?

Old thread: >>59700932
>>
>>59707778
Tomorrow i think i will learn how to make WndProc handle keyboard input.
>>
What language should I use for math computations?
>>
>>59708021
Matlab
>>
>>59707778
why this no work? output just is 'I'

def removepunct(s):
sminus = ""
for letter in s:
if letter not in string.punctuation:
sminus = (sminus + letter)
print(sminus)
return sminus
>>
>>59708040
It's non-free
>>
File: rstudio_2017-04-02_23-18-05.png (23KB, 569x510px) Image search: [Google]
rstudio_2017-04-02_23-18-05.png
23KB, 569x510px
I'm annoyed at how incredibly stupid some of this R/Rshiny syntax is. Is anyone else programming in R, or even better Rshiny?
>>
reposting from old thread:
Why does [32724153825,32724153825,32724153825] decode to JSON in php but [32724153825,01/01/2017,Event Lift-Off at Night] doesn't?
>>
>>59708050
Then Octave.

I've heard people like SciPy as well.
>>
>>59708043
Looks like you're returning at the first iteration of the loop.
>>
>>59708118
Any more solutions?
>>
>>59708118
Mathematica. But that's also non-free i think.

Maybe R. That's supposed to be for statistics.

Or write your own math lib in C or whatever other language your comfortable with.
>>
>>59708058
[32724153825,"01/01/2017","Event Lift-Off at Night"]
>>
>>59708368
>>59708436
>>
>been working on a complex, ongoing personal project for fun for months
>don't touch it for a while due to work, life, writing some other smaller week / weekend type projects
>open it back up today because bored
>literally no idea what's going on, where I left it, seems like I was in the middle of some kind of refactor when I stopped

fuck. guess it's time to start something new
>>
>>59708508
>in the middle of some kind of refactor when I stopped
Well that was dumb.
>>
>>59708508
git checkout -- . and start refactoring over
>>
File: 1461625696451.jpg (84KB, 720x960px) Image search: [Google]
1461625696451.jpg
84KB, 720x960px
>>59707892
Check out my thread if you guys can talk to me about software dev.
>>
What are some programming ideas that have never been done before?
>>
>>59708589
yea pretty stupid of me

>>59708614
meh
>>
>>59708050
... and?
>>
>>59708789
you seem like you're seriously asking this. no one will tell an original idea for free anywhere
>>
>>59708021
>>59708368
Scilab.
>>
>>59708368
Maxima + Common Lisp
>>
>>59708789
General artificial intelligence.
A solution to the halting problem.
A program that tells you whether or not the Reimann Hypothesis is true.
A program that prints the numbers from 1 to 100, but if the number is divisible by 3 it instead prints "Buzz," if it's divisible by 5 it prints "Fizz," and if it's divisible by both 3 and 5 it prints "FuzzBizz."
>>
>>59708789
https://en.wikipedia.org/wiki/List_of_unsolved_problems_in_computer_science
>>
>use intellij idea for a while
>nice, but slow as fucking molasses
>meanwhile, visual studio is consistently very fast and responsive
>install intellij resharper on vs to see what it's about
>visual studio crawls to a fucking halt immediately
I'm starting to get curious about what the fuck they're putting in their software that makes everything slow
They're like the King Midas of performance death
>>
I'm getting demotivated learning programming. I've already finished C, A Modern Approach
and did a majority of the projects there and don't know what else to do. Every program
that somebody would need or want has already been done both on linux and windows, and
I'm not at a level of knowledge yet where I can contribute to existing programs.
I'm just going to give up programming because now I see how worthless (outside of a job)
and uninteresting it is. Is this really all you guys do here? Do simple and worthless small
programs and circle jerk over which programming language is the best?
>>
I'm planning to make a program that downloads all of the images on a page.

Some pajeet's project I looked at uses multithreading for the downloading but personally I don't think that makes sense because bandwidth and writing to disk are the bottlenecks so surely using a single thread would be better to avoid sharing and slowing everything down.

Am I right on this one?

I guess my final plan would be to have multiple independent threads scrape all the pages and find the image links, then they send these to a queue which a single thread reads from and downloads the images.

Is that a good solution?
>>
>>59709488
Try CLion and see if that's also slow.
>>
>>59709614
No, most of us are at a level of knowledge to contribute to existing programs or working hard at getting to that level.
>>
>>59709614
>already been done
This isn't something you should worry about. Just write what you want to write.
>how worthless (outside of a job) and uninteresting it is
I think the act of programming itself is interesting. You don't need to be solving the world's problems to enjoy it.
Also, most of the programs I really enjoy writing are the ones that solve a problem that I alone have,
I've written a lot of programs which automate a lot of the shit I do, and I still use them all of the time.
>>
>>59709614
You know software has bugs right?
>>
>>59707778
Working on an imageboard: 4kev.org
>>
>>59709662
your bandwidth and disk concerns would have been relevant in maybe 1995
>>
File: Screenshot_2.jpg (29KB, 425x643px) Image search: [Google]
Screenshot_2.jpg
29KB, 425x643px
90% of pajeets can solve this.

Are you dumber than a pajeet?
>>
File: 1489239221275.jpg (107KB, 321x424px) Image search: [Google]
1489239221275.jpg
107KB, 321x424px
What to do if I feel to be hating programming?
>>
Whatever happened to the gentoomen list? Is there somewhere I can download it? t.bookmarked years ago incase I ever decided to learn programming. Well I've decided.
>>
>>59709793
>automation
can be done with bash scripts
no need for programming
for it to be programming it needs to be complied into binaries
>I think the act of programming itself is interesting.
>Textbook examples
>>
>considering buying the C Programming Language Book

anybody read it?
Is it worth the 40 shekels?
>>
>>59710093
>can be done with bash scripts
I do have several bash scripts.
Some of them are a little too complicated for bash scripts though.
>for it to be programming it needs to be complied into binaries
That's not a requirement.
>>
>>59709964
its 3
>>
>>59710106
>Is the 40 year old book on an outdated standard worth it?
>>
/dpt/ self taught programmers

where did you start and how did you progress?

ive been working through codecademy but its boring, any tips fellas?
>>
>>59710218
I read books
>>
>>59710229
nice, anyone in particular you can recommend to new guy
>>
>>59710254
I dunno, it was long ago.
I learnt BASIC back then.
>>
>>59710218
read programming lang tutorials
>>
File: images.jpg (8KB, 275x183px) Image search: [Google]
images.jpg
8KB, 275x183px
>>59710119
function f(x) {
x += 1;
}

var a;

f(a);

console.log(a)
>undefined
>>
>>59707778
I have to make an array in C#, and then do some sort of operation with the values inside and save it in the array or something like this, I can't remember it now. Someone know how to do it? I know is basic but I'm too busy in my career.
>>
>>59710318
What would you except from uninitialised variable?
>>
>>59710281
like their documentation, or any old tutorials i find online which seem credible?
>>
>>59709963

I want maximum meme throughput and I'm not talking server hardware here, I don't have a gbit line so bandwidth is actually an issue.
>>
>>59710318
But #1 & #4 are not possible because b would be 2
I have never programmed in java script so i dont know how it indicates undefined vars.
>>
>>59710742
Javascript is one word.
>>
>>59710318
undefined+1
>NaN
>>
I've been working on a text based Chess game in java. It takes move input in the form of algebraic chess notation. I let the player pick their color, and then the program generates a list of all possible moves for the opposite color and picks one at random.
>>
>>59710928
>then the program generates a list of all possible moves for the opposite color and picks one at random
Next level AI right there
>>
>>59710375
What are you actually trying to do?

You probably want to use a List so you can use LINQ for whatever it is.

Explain your desired input/output or what the operations are.
>>
real thread faggots
>>59707776
>>59707776
>>59707776
>>
>>59711026
Eventually I will add weights to the moves, but not yet.
>>
>>59711070
just got here

I have analysed the old thread and deduced that this is in fact, the correct thread, having been made and posted after the bump limit, whilst the other thread was made and posted earlier
>>
Are there other vortual machines like .NET or JVM?
>>
>>59711387
lua, python ...
>>
>>59711422
What if I wanted to compile code and distribute it like .jars?
>>
>>59708043
def removepunct(s):
sminus = ""
for letter in s:
if letter not in string.punctuation:
sminus = (sminus + letter)
print(sminus)
return sminus
>>
>>59709968
learn a better language
>>
>>59708054
No, but it look's very annoyed
>>
>>59708058
The string must be in quotechar.
>>
>>59711387
any brainfuck interpreter
>>
I need to get a regular expression to match text up until a |, comma, or a # if they appear within the pattern.

For example the strings

var text1 = "Hello world [[I want to extract this#but not this]] and keep the ending double brackets";

var text2 = "Here is [[another example]] of text I should keep";

var text3 = "And one more [[example keep this|but not this]] but keep closing double brackets";

var text4 = "I want [[to keep this,not this]] same keep closing brackets";


Right now I've got the regex to get what I want from text2 in scala as

var pattern = """\[\[(.*?)\]\]""".r


Which returns everything inside of the [[ ]] but the fucking conditionals to find if a |, comma, or # appear are confusing as fuck.
>>
>>59712836
Here it is, using sed. I assume it has the same syntax as whatever you're using. I'm wasn't sure if you wanted to trim the stuff outside of the brackets, although it's an easy fix.
Unfortunately, you're trying to match a lot of shit which requires being escaped, so it's a pretty ugly expression;
$ sed -r 's/^.*\[\[([^\|,#]*).*\]\].*$/[[\1]]/' <<< "Hello world [[I want to extract this#but not this]] and keep the ending double brackets"
[[I want to extract this]]
$ sed -r 's/^.*\[\[([^\|,#]*).*\]\].*$/[[\1]]/' <<< "Here is [[another example]] of text I should keep"
[[another example]]
$ sed -r 's/^.*\[\[([^\|,#]*).*\]\].*$/[[\1]]/' <<< "And one more [[example keep this|but not this]] but keep closing double brackets"
[[example keep this]]
$ sed -r 's/^.*\[\[([^\|,#]*).*\]\].*$/[[\1]]/' <<< "I want [[to keep this,not this]] same keep closing brackets"
[[to keep this]]
>>
File: branching_and_merging.png (14KB, 117x1125px) Image search: [Google]
branching_and_merging.png
14KB, 117x1125px
Here's what our git history looks like after 2 weeks on a 6-person project.
>>
>>59712983
I had to strip off the beginnings and endings of your expressions but it worked! Thanks

result is

var pattern = """\[\[([^\|,#]*).*\]\]""".r
>>
not first for rust
>>
>>59708754
who is this lass
>>
>>59715183
C is the best
>>
>>59715191
c is
S H I T
>>
>>59715200
You are shit
>>
>>59715200
>>59715213
rude
>>
Explain this "putting your data structure on the stack" meme.
>>
>>59715268
>Mov sp down the size of your data structure
>Put values in the space you just allocated
>>
File: 1491004661820.jpg (445KB, 724x1023px) Image search: [Google]
1491004661820.jpg
445KB, 724x1023px
Friendly reminder that Rust is for straight white men.
>>
>>59715336
how so
>>
>>59715336
>xir thinks xir can decide who is a straight man
>>
>>59715352
>xir
what does this even mean
>>
>>59715351
The fact that I'm using it
>>
>>59715375
yeah well there's also straight white men who live in california, but that doesn't make it a straight, white, or male state by any stretch of the imagination
>>
>>59715368
Something that C programmers keep asking me to call them by
>>
>>59715385
literally never heard C lads say anything of the sort

C++ on the other hand
>>
>>59715384
>expecting logic from Rustoddlers
>>
rust is for sissy nerds
>>
>>59715408
t. sjw faggot
>>
>>59715419
t. butt blasted """rustacean"""
>>
>>59715419
>>59715385
>>59715336
is today opposites day or something
>>
Anyone participating in the Google Code Jam this weekend? :)
>>
>>59715732
Can I do it in python :^)
>>
>>59715307
>>59715352
>>59715396
Who said this?
>>
>>59715780
You can do it in anything.
Most people use C++, but people use everything from C, Python or Java to Brainfuck and LOLCODE.

I failed last year in the qualification stage. Looking to get into the Distributed Code Jam stage this time.
>>
So I'm working on a c# application that has two forms open at the same time and I want to update a datagridview on the second form when I insert some data into the database in form1.
Anyone know how I could do this?
>>
https://isocpp.org/files/papers/p0636r0.html
>>
>>59716004
>fold expressions
>three dimensional hypotenuse
why not arbitrary dimension, using a concise fold expression?
>>
>>59716004
>The type any type-erases copyable objects. There are essentially three things you can do with an any: 1. put a value of type T into it. 2. Make a copy of it. 3. Ask it whether it contains a value of type U and get that value out, which succeeds if and only if U is T.

wew
>>
>>59715822
meh, the key to doing well in these things is having knowledge about obscure algorithms that have no practical use besides in carefully set up programming challenges
>>
>>59716004
>>59716109
int length(vector<any> v);
-- no templates needed
>>
>>59716004
>A byte type
Why the fuck does C++ need FOUR primitive byte types?
>>
>>59715336
Rust is for those who wear striped programming socks.
>>
>>59710318
a = f(a); //g
>>
>>59716202
What do you mean four?
There's three AFAIK?
char (which is not exactly a byte because it has different semantics than numbers)
u8 (which is fixed-size)
byte (the new one, which is not fixed-size)
>>
I made an Android app to post gists to Github. Took me a couple days because I'm not too familiar with Java.
>>
>>59716162
I mean, it might seem obscure in the context it's in, but it demonstrates your ability to problem solve and what people Google are trying to attract are people that can solve a problem that may need an obscure algorithm.
>>
>>59716230
signed char, unsigned char, and "plain" char (this is not the same as signed char).
In terms of C, a char is literally the definition of a byte. I assume sepples is the same.
The <stdint.h> types don't really count as a "byte" type; just integers of exact sizes.
So 3 chars + a pointless "byte" type which is literally just another unsigned char.
>>
>https://blog.codinghorror.com/why-isnt-my-encryption-encrypting/
what's the goal here? to prevent a third person from seeing the secret by snooping on the internet traffic? not to prevent the client from seeing anything?
>>
can someone please explain condition variables in c to me? i really do not understand them and the resources i've tried online seem to all be about issues in implementing them
>>
>>59716284
encrypting the secret so someone cant just scoop it up in plaintext essentially and decrypt the encrypted data

>then they go onto say dont transmit the secret
>>
The pleb man struggle street here again.

I keep getting a:

File "program.py", line 11, in comp101_score
if points[i] == 0:
IndexError: list index out of range

Error.

I feel like my code should be ok but how to i keep that i in range?

Again. Thank you heaps to the guy that is helping me out.
>>
i plan to use some ORM like entity framework in WPF and i have some questions

when i insert query and send to the sql server and the data i receive back, it that data put into something like observablecollection and displayed in a list or gridview still visible after i close my connection to the server? Better question is this, is connection always open while i see any data in gridview in wpf?
>>
>>59716301
but if it's decrypted on the client side it amounts to obfuscation (not true encryption) doesn't it, since the client can reverse engineer the client side code and read the client memory to find the encryption method and key and the secret
>>
File: help 1.png (105KB, 1859x920px) Image search: [Google]
help 1.png
105KB, 1859x920px
>>59716313
>>
>>59716264
I've done a number of these in the past
what I'm trying to say is that, the "tough" problems turn out to be something that you just can't solve without knowing the obscure algorithm
so the people who end up in the top ranks are the kinds of people who were geography-bee finalists as kids
they practice for months/years by reading up on hundreds of obscure algos that they will never use outside of these competitions
it's fairly retarded and not enjoyable
>>
>>59716333
Arrays are indexed from 0.
>>
>>59716346
i have tried i = 0 but still gives me this range error.

Again, I know this isn't the place for this but i love /g/ and want to get good at coding. Hopefully i can help new people here in the future.
>>
>>59716369
Change "<= len" to "< len"
>>
File: 1489280453482.jpg (257KB, 596x588px) Image search: [Google]
1489280453482.jpg
257KB, 596x588px
>>59716374
yep i was just about to fix that. Thanks.
>>
>>59708054
This is what happens when functions are encouraged to take a litany of arguments, rather than sensible number, like two, i.e., this is a semantic problem as much as a syntactic one.

I would also suggest that it suffers from an excess of punctuation (i.e., both parentheses and commas) to indicate a function call, which is a syntactic problem, as you say.
>>
File: 1448179279439.png (264KB, 1608x882px) Image search: [Google]
1448179279439.png
264KB, 1608x882px
>>
>>59708058
'01/01/17' is not valid syntax.

'Event Lift-Off at Night' is not valid syntax.

This website describes why incredibly well:
http://www.json.org/


I would suggest wrapping both in double-quotes, though treating dates as strings is not ideal.
>>
>>59716427
>rather than sensible number, like two
Functions should take one argument and return 1 result
>>
>>59709248
One of these is provably impossible, and one is commonly suspected to be impossible.
>>
>>59716449
That's a stupid restriction. All that would do would cause a bunch of pointless new data types to be made.
>>
>>59716449
Also a sensible option.

Some might also argue for multiple return values, but let's not get into that.
>>
>>59716462
Not necessarily true. He's implying that all functions should be curried by default, which I agree is also a sensible option.
>>
>>59708789
an educational robot that shows how to poo in the loo
>>
>>59716472
Take your curry back to India, pooinloo.
>>
>>59716462
>>59716463
Tuples with syntax support

bonus: old function call syntax
f (a,b,c)
and
f (a)

still work
>>
>>59709488
>using proprietary software
>>
>>59716478
In the engineering department at my alma mater, the toilets had signs describing exactly that.

>>59716481
I see what you did there.

>>59716483
A bit ugly, but viable.
>>
>>59716435
That idea of Calvianism is a very relevant point and in fact a driving factor in why the West has become so successful recently.

Nothing 'fringe' about it. In fact its main stream Weberian school of thought.
>>
>>59716483
by syntax support I mean this:

(Int, Bool, Float)
is a tuple with 3 elements - an Int, Bool and a Float

(3, true, 4.f)
is a value of this type

So we could do
tuple = (3,True,4.f)
someFunc tuple
or
someFunc (3,True,4.f)

Assuming we have pattern deconstruction, this means when we want to "return multiple values" we can just do
(a,b) = function (arg)

We could also use whitespace application, i.e.
function arg
rather than
function(arg)
(but the latter still works, because it's just putting the argument in brackets)


>>59716490
It's not ugly, it's much better than the alternative.
>>
File: 1488114663963.jpg (117KB, 1280x720px) Image search: [Google]
1488114663963.jpg
117KB, 1280x720px
Guys what's the difference between neovim and vim? What are the advantages? How hard would it be to transfer my config and plugins and colorscheme? Is it worth doing?
>>
>>59716509
an optimized fork with built it vimshell and easier to make into a quasi-IDE
>>
>>59716527
>optimized
You shouldn't throw that word around.
I'm pretty sure they just removed a lot of a legacy cruft, and are trying to make it more extendible.
>>
File: js.jpg (80KB, 660x650px) Image search: [Google]
js.jpg
80KB, 660x650px
>>59710318
Feel free to amend and redistribute.
>>
>>59715880
>insert data in Form1
>data is stored in an object that Form2 has access to
>Form 2 uses data from object
>????
>PROFIT!
>>
>>59716505
I'd argue implicit currying is a better alternative, but we're well into personal preference.

>>59716509
They cut a lot of the laughably useless codebase.
They simultaneously added new features and modularised the engine in a sane and extensible way.
They maintained full compatibility.

Failing a total re-write, it's how software should be improved. Unfortunately, while it's a vast improvement over vim, I am not convinced it will gain traction.
>>
>>59716552
FooNaN is my favorite
>>
>>59716552
Nice JPG you have there.
It really compliments the text.
>>
File: 1459602999066.jpg (59KB, 655x527px) Image search: [Google]
1459602999066.jpg
59KB, 655x527px
Sup gee

I'm currently trying to wrap my head around linkedlists in java. Right now I'm making a program that signs up people and gives them a car, maybe even multiple cars. I have to be able to delete or exchange the car between people later. Question is, should I make a "car" object or just smash it all up the "people" object? thx in advance
>>
>>59716588
Stupid frogposter.
>>
>>59716571
>I'd argue implicit currying is a better alternative, but we're well into personal preference.
implicit currying can still be done


>>59716588
fuck off frogposter
>>
>>59716552
There is absolutely nothing wrong with that first line.
>>
>>59716579
You can thank the original posters.

>>59716572
>'foo' + + 'foo' + 'i'
'fooNaNi'


It's funny because both 'foo' and 'punani' mean 'vagina'.
>>
>>59716595
>webdevs actually believe this
>>
>>59709964
>>>/g/wdg
>>
>>59716603
I'm not a webdev.

Do you know what
parseInt
does with two arguments?

I don't even use Javascript, but a quick search of the function will help you understand exactly why that is occurring. I'd be willing to explain in another language if it helps you understand.
>>
>>59716324
anyone?
>>
>>59716595
kys

>>59716627
parseInt should be explicit
>>
>>59716435
There are some good points in this, but the very first sentence is patently false.

A reasonable analogy would be "there's nothing more to learn in vehicular engineering: we already know how to build cars".
>>
>>59716627
Not him, but this sort of stupid weak dynamic typing is unacceptable.
>>
File: aew.jpg (197KB, 1133x1600px) Image search: [Google]
aew.jpg
197KB, 1133x1600px
>>59716594
>>59716592
S-sorry. Should I have posted an anime girl instead? I have plenty of those

Please answer question
>>
>>59716627
Actually I've teased you about this plenty, so I know your argument.

Just because you understand the semantics, it doesn't meant that JavaScript's "interpretation" of map is sane.
>>
>>59716645
There is no dynamic typing happening in the line in question.
>>
>>59716656
i thought you were talking about '5' - 3
>>
>>59716653
>I've teased you about this plenty
What are you even talking about?

I don't know who you think I am, but I'm probably not that person.

>>59716663
Clearly, "first line" is difficult to understand.
>>
>>59716648
Stupid Anime poster
>>
>>59716648
Go away, frogposter
>>
>>59716648
I refuse to help frogposters.
>>
>>59716672
the map(parseInt) stands on its own and doesn't belong to the other lines you retard
>>
>>59716687
It is also literally the first line of text in that image.
>>
>>59716680
>>59716674
I don't even have any cartoon frogs saved on my hard drive, I just thought the retarded pepe would be funny for this question so I went out of my way to google it. Pls no bully everyone makes mistakes.
>>
>>59716588
make a Car object and each Person has a linked list of Cars
>>
>>59716672
You're the guy that always gets triggered by that specific example, and attempts to justify it by explaining the semantics... while everyone else says "we also understand how it works, but that doesn't make it sane".

Note that this is what is happening right now.
>>
>>59716697
>person dies
>Cars spontaneously blink out of existence

Nice try, guy.
>>
>>59716693
i admitted my mistake you don't need to be an smug retard about it. i would literally punch you irl fucking stupid waste of breath
>>
>>59716592
>>59716594
>>59716680
>>59716681
hurr durr frogposter so funny repeating the same thing ahehehe
>>
>>59716708
>say that to my face fucker and not online I swear I'll hit you with my fists
>>
>>59716712
Fuck off and kill yourself.
Any order is fine.
>>
>>59716713
have a (You)
>>
>>59716697
Thanks man

>>59716712
I kind of understand why they dislike the cartoon frog
>>
>>59716717
hurr durr kys so funny repeating the same thing ahehehe
>>
What does it mean if the alpha channel on my DirectX texture is working, but has very subtle black artifacts around some details?

Blending problem? Multiply problem?
>>
>>59716732
>I kind of understand why they dislike the cartoon frog
It's more sad than that, they feel like they're part of a gay little contrarian club
>>
>>59716740
might be blending/gamma related
>>
>>59716712
I bet you say the same thing when people call you a redditor
>>
>>59716702
It IS sane if you actually understand the example.

I am curious, though; what about it confuses you and/or makes you think it is not sane?

Other languages allow for this same behavior by passing in a function, rather than using a lambda expression. In this case, if the second parameter is optional, the call for the "mapping" function, whatever that is called in the language you're using, will use the overload that can satisfy all of the parameters, option or not.
>>
>>59716754
yeah that's pretty much the same thing
>>
>>59716648
sissy
>>
i want to wrtie a simple http server on top of sockets

i don't know where to start though, the protocol is huge and i just want to implement some useful parts of it, for example asking for a file and receiving it using a get and a post
>>
>>59716740
gotta replace the vga cable on your voodoo card
>>
How do I into string manipulation
>>
>>59716773
>the protocol is huge
Just stick with HTTP/1.0 for now.
It's not that bad to implement.
>>
File: 1490040934363.jpg (26KB, 661x767px) Image search: [Google]
1490040934363.jpg
26KB, 661x767px
What is the best python textbook?

This online 'auto mark' gimmick is going to be the end of me
>>
>>59716779
>use a modern high level language
>google what you're doing

And now you're manipulating strings.

Can you give an example of what you're trying to accomplish?
>>
>>59716764
Mapping a function over a collection results in a collection containing the results of applying that function to the value(s) within the original collection.

It's so simple it almost sounds tautological.

JavaScript's poor implementation of 'map' breaks this sanity, demonstrated by most people's reaction to that example.

But we've been over this before, so why do it again?
>>
>>59716791
>>>/sqt/
>>
>>59716795
>Mapping a function over a collection results in a collection containing the results of applying that function to the value(s) within the original collection.

That is literally what has occurred here.

If you think otherwise, you do not understand the map or parseInt functions in Javascript.
>>
>>59716776
I miss Voodoo. Some great games came out on that tech.
>>
How to I access the colorbar "object" in a matplotlib plot?

Basically I'm using a module which has a function that spits out a well formatted graph with a color bar but I want to change the font size on the tick labels on the color bar without having to rewrite the whole plotting function.

Seems like it should be doable.

It's a 3d plot if that changes anything.
>>
>>59716791
>Python
Literally the official docs. Best learning material for Python there is, even as a beginner.
https://docs.python.org/2/tutorial/index.html
https://docs.python.org/3/tutorial/index.html
>>
>>59716814
You explain it every time, and every time EVERYONE reiterates that they understand. Map passing the value's index implicitly (alongside parseInt taking a radix as an implicit second argument) is the reason for this garbage.

The fact that you can explain this does not make the resulting behaviour sane. It is a flawed implementation, as evidenced by most people's horrified reaction to the code in question.

If you cared to, one could also explain all of the explicit type conversions in the rest of that image (I personally couldn't, since I don't pretend to understand JS's type conversion voodoo). The fact that it can be explained does not make it sane.
>>
>>59716832
>>>/sci/sqt
>>
>>59716876
Fair enough g
>>
>>59707778
Dependently typed assembly.
>>
>>59716871
>Map passing the value's index implicitly (alongside parseInt taking a radix as an implicit second argument) is the reason for this garbage.
It is precisely due to parseInt having an optional second argument that the proper form of map is used to supply both the value and the index.

This example is received poorly because this is not immediately apparent, but this same behavior occurs in other popular languages in the same exact way when you supply a function with an optional second parameter with a map function that has an overload to supply the value and the index.

It is sane, but it is written in such a way that it is not intuitive.

The language's implementation of the concepts here is not flawed at all.
>>
>>59716905
>It is sane, but it is written in such a way that it is not intuitive.
Ultimately, this is where our opinions differ. Unintuitive garbage behaviour due to implicit arguments is a great example of what I would not consider 'sane'.

See also: the rest of that image.
>>
>>59716944
It just werks, faggot
>>
File: 1482161331654.jpg (9KB, 240x193px) Image search: [Google]
1482161331654.jpg
9KB, 240x193px
Guys help, I'm new at this.

I'm using Windows and sublime text 3, I downloaded and installed minGW from this site right here nuwen.net/mingw.html

From what I understand it's a distro that already contains some useful libraries.
But how the fuck do I link to those libraries?
I'm trying to use the SDL that's supposed to be included but my code won't compile.
The compiler can't find the SDL.
>>
File: anal beads.png (8KB, 635x107px) Image search: [Google]
anal beads.png
8KB, 635x107px
>>59716944
>See also: the rest of that image.
I'm not defending Javascript as a whole; only this particular example that is contrived in such a way that it meant to evoke a knee-jerk response to something that is actually correct and sane.

Any time you write something poorly and don't understand the functions you're working with, it's going to look "weird".
>>
>>59716988
dumb frogposter
>>
Last question of the day.

the ideal function should have:

>>> input: (comp101_tiebreaker([1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0], 0))

output: ('7-4', 0, [0])

where the 2nd term in the tuple is the winner, last the remainder. If there's no winner the 2nd term is none.

how do i make 'a' stop counting once there's a winner?

I tried to put conditions of:

a<7 and (len(points) - a) < 2

but these conditions could stop the function working if one player was winning by more than 2 but doesn't reach 7
>>
File: 1480711057957.gif (2MB, 179x320px) Image search: [Google]
1480711057957.gif
2MB, 179x320px
>>59716973
Except when you map parseInt over an array of numeral strings.

>>59717000
Unintuitive garbage behaviour due to implicit arguments is a great example of what I would not consider 'sane'.

'Correct', maybe. But I could write a language where addition had a special case for adding two and two to make five: my implementation might be correct as per spec, but I would never call it 'sane'.
>>
File: x0ilgjipzcetmpwdxjgo.gif (2MB, 374x219px) Image search: [Google]
x0ilgjipzcetmpwdxjgo.gif
2MB, 374x219px
>>59716847
thanks.
>>
File: HORr43D.png (548KB, 750x1125px) Image search: [Google]
HORr43D.png
548KB, 750x1125px
Okay guise, I'm making the car list now. It asks me for a paramete for the add car command, Should I just leave it null? Here's how it looks:

import java.util.LinkedList;
public class Carlist {
private LinkedList<Car> ListaC;
public Carlist() {
this.ListC = new LinkedList<Car>();
}
public void addCar(){
this.ListC.add(null);
}
}



Should I create a Vehicle parameter?

>>59716988
Don't post frog, post anime girls
>>
>>59716004
>std::iterator is deprecated
How do you iterate over things in C++17?
>>
>>59717041
>Unintuitive garbage behaviour due to implicit arguments
Unintuitive behavior due to poorly written code*

There are examples in every language of what is apparently simple code that has unintuitive results to someone unfamiliar with the language, or the functions used.
>>
>>59717061
>
public void addCar(){
this.ListC.add(null);
}


Holy shit, you are actually retarded.
>>
>>59716988
wipe that and use
https://sourceforge.net/projects/mingw-w64/

delete sublime and get codeblocks.
>>
>>59717066
And I'm arguing that that's because of the language: JavaScript's implementation of map has unintuitive behaviour because of *poor design*.

I honestly never thought I'd hear some argue against JS having poor design here.
>>
>>59717061
just become a trap prostitute anon
>>
>>59717080
Wait is this it:

public void addCar(Car code){
this.ListC.add(code);
}



?
>>
>>59717095
JavaScript DOES have poor design, generally speaking.

However, the implementation of map in JavaScript is not unique to JavaScript. Other languages do the very same thing in offering the availability of the element and that element's index.
>>
>>59717065
there will still be iterators, just not std::iterator
so instead of vector<int>::iterator, just do auto
>>
>>59717125
>Other languages do the very same thing in offering the availability of the element and that element's index.
Sure. And if those languages allow examples such as this to occur because of that choice, their design is not sane either.
>>
>>59717105
>>59717101
>>59717080
Shit I just figured it out


public void addCar(){
Car code = new code();

this.ListC.add(code);
}


Now I just need to create 3 methods on the original car object and call them in that blank space.
>>
>>59717151
hey bruh
do you have any idea what you're doing?
>>
is there a discord where i can ask questions for coding here?

its too exposed here my uni bans posting code online or sharing
>>
>>59717171
Yeah, bro, just use the /dpt/ discord
>>
>>59717180
m-m-may i join?

NEED assistance
>>
>>59717151
nah, just quit and suck cocks for cash anon
>>
>>59717087

What's the difference?
>>
>>59717188
Yeah man just join the server
>>
>>59717165
No. I'm just reading off a of a caelum pdf I found.

>>59717189
Come on man, everyone's gotta start off somewhere
>>
>>59717194
less bloat and no fucking boost.
>>
>>59717212
true, start with my cock sissy
>>
>>59716988
point your IDE to the include folders
>>
>>59717195
a link?
>>
>>59717243
https://discord.gg/dtCYd
>>
>>59716588
Dont throw something into an object that really doesnt belong, make a car object and have it do "car" things
>>
>>59716109
How does it determine the size of the object?
What does sizeof(any) return?
How do you allocate an any?
>>
>>59717266
it's just a union, you should know the size of a union already
>>
>>59717319
>it's just a union
A union of every single type in existence?
>>
unions are shit and bad practice no matter what language youre using.
>>
File: 1469656490556.png (14KB, 166x166px) Image search: [Google]
1469656490556.png
14KB, 166x166px
>>59717171
>its too exposed here my uni bans posting code online or sharing


What lol?
>>
>>59717400
muh bad, I confused it with the other thing
for this thing you have to ask if it contains a value of type x, and if it does, then you know the size because it is sizeof x
>>
>>59717446
My uni did this too. It's so all the other students can't just take the work you uploaded and copy it.
>>
>>59717505
literally why dont CS classes just remove exercises for homework, and keep them to a tightly watched lab in class?
>>
How do I remove an entire linked list from existence?
>>
>>59717550
null = list
>>
>>59717550
delet.this.list
>>
Pretty sure this is a stupid question but are enums implicitly public?
>>
>>59717577
enums in a sane language will still follow the usual scope conventions.
>>
>>59717505
What's stopping you from taking it and going off campus and uploading or using a vpn or any sort of encrypted data link to upload it?
>>
File: 1486054566819.gif (5KB, 320x180px) Image search: [Google]
1486054566819.gif
5KB, 320x180px
Implementing Floyd–Steinberg dithering to make 1 bit black and white images, works pretty well.
Although I would like to be able to control the amount of diffusion like the "save for web" dialog in photoshop but I don't really know how it works. I guess it's just dividing the kernel values?
>>
>>>/r9k/35991037

Which one of you fags post here?
>>
>>59717446
If it's examinable code for an assignment, then I can understand.
>>
>looking for some cs book online
>simply search the name + github
>some chinese student of course has it uploaded as a pdf to his repo for the class he took it in

god bless the chinks
>>
>>59717785
>search for a textbook
>pdf uploaded by some american college on the first page of results
>>
More about enums because I can't find an answer to this elsewhere.
In Java can an enum type constant start with a number?
>>
>>59717904
>ever wanting names as numbers
or do you mean values?
>>
>>59717904
I don't know java, but I highly doubt it can start with a number
>>
Learning TensorFlow. What's up with the trX, trY, teX, teY nomenclature? feeling pretty dumb here
>>
>>59717955
With no knowledge of tensorflow, I would guess test and train.
Can't you read the documentation?
>>
>>59717971
Ah, test
I had figured train for the one
it's not listed anywhere in the docs or style guide but it's pretty ubiquitous in the sample projects and tutorials I've been going through, you're probably right, thanks

polite sage
>>
Has anyone read this? Is it worth my time?
>>
>>59707778
Starting first day of 42 Piscine http://42.us.org
>>
>>59717947
I had an enum for Books with 1984 as one of the books so I wanted to call the enum constant 1984. It doesn't specify it in the naming conventions but apparently it's not allowed.
Ended up calling the constant NTEF
>>
>>59718121
seems like another webshit scam
>>
>>59718126
You can't start with numbers but you could do something like b1984
>>
>wrist pain
>numb hands
>ears ringing

Am I dying?
>>
>>59718172
Ah that's a nicer work around, thanks anon.
Changed it to B1984.
:)
>>
>>59718178
Eat something.
>>
>>59707778
Rewriting Linux in HTML+CSS+JS
>>
>>59718178
>tfw tooth pain from stress grinding in my sleep
>>
>>59718178
No you're just having a seizure
>>
>>59718178
Drink water and go for a walk every once and a while
>>
>>59718178
You been sleeping enough? Getting enough water? Eating alright? Been sitting too long? Are you overweight?
>>
>>59718178
Stop typing and try eating, drinking and sleeping.
>>
/g/ - Health & Medicine
>>
>>59718224
/g/ - Pretend Doctors
>>
>>59718224
>tfw we didnt get paired with fit
>>
>>59718239
/g/ - I searched the symptoms on Google
>>
>>59718224
>programming: 1 post every 2 minutes or so
>healthcare: multiple posts in a few minutes
>>
/g/ - Renaming the board title
>>
>>59718240
pairing with /fa/ - /fag/ would be more appropriate since you're so into crossdressing and trap/transfaggotry
>>
>>59718265
/g/ - Everything but technology
>>
>>59718201
I woke up today with my gums bleeding around one of my teeth due to all the grinding
shit sucks, yo
>>
>>59718274
/g/ - Reddit
>>
>>59718303
/g/ - Kill youreself
>>
/g/ - Technology
>>
File: vt1IMmq.jpg (112KB, 600x799px) Image search: [Google]
vt1IMmq.jpg
112KB, 600x799px
>>59718316
I loli'd
>>
>>59718362
see>>59718303
>>
/g/ - Pedophiles and /pol/ rejects
>>
>>59718369
joke
ur head
>>
correct()
{

}

trash() {
}
>>
>>59718224
>>59718239
>>59718240
>>59718244
>>59718256
>>59718265
>>59718274
>>59718303
>>59718316
>>59718355
>>59718378
/g/ - One Real Physician and Several Common Sense Responses, Followed by Shitposting

Guess which one is me.
>>
>>59718392
>wasting vertical screen space for absolutely no reason
>correct
>>
>>59718394 (You)
all me
>>
>>59718406 (me)
No, me.
>>
i love low-level programming so much
>>
>>59718415
Trash.
>>
>>59718401
CantWasteASingleWhiteSpaceInThePursuitOfEnterPriseQuality() { }
>>
>>59718427
no u xD
>>
>>59718392
>Not using the One True Style
https://golang.org/cmd/gofmt/
>>
File: 66d.jpg (22KB, 600x469px) Image search: [Google]
66d.jpg
22KB, 600x469px
>>59718439
>PascalCase
>>
>>59718467
Underscores are a waste of horizontal space
.>>59718458
please delete this.
>>
>>59718392
>writing stubs on multiple lines
Why.
>>
iWrite_whateverI_Want
>>
Why do people not like Pascal?
>>
>>59718522
I like pascal
>>
>>59718495
Its cleaner and much easier to decipher scope at a glance.
>>
>>59718551
your argument makes no sense if you're also using cuddled else to save space
>>
New thread:

>>59718594
>>59718594
>>59718594
>>
>>59718551
What.
For a stub? But with a stub you don't need to know scope at all.
For normal functions the prototype+brace on one line differentiates it better than prototype without brace. You have a consistent place to look for the brace. If you have it on a separate line you have to look at the braces and then look at the line above to see if it just a block or there's special significance here (a function).

People who put braces on their own lines are just people who care about aesthetics. Code is a practical matter though.
Thread posts: 313
Thread images: 27


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