[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: 339
Thread images: 45

File: 7f79017e53065cc1a88c08face1a2095.jpg (206KB, 1024x903px) Image search: [Google]
7f79017e53065cc1a88c08face1a2095.jpg
206KB, 1024x903px
What are you working on, /g/?
Old thread: >>61341350
>>
imagine using a language that doesn't support multicore
>>
What's a good C# framework/library for someone who knows the fundamentals?
>>
File: akari ^^.png (310KB, 441x623px) Image search: [Google]
akari ^^.png
310KB, 441x623px
How does it feel knowing that programming without a license will become illegal in your lifetime?

>TSA: why would you carry a programming book if you don't work for a computer company???

>>61305287
>>61306664
>>
What languages are current in the industry for app/software development?
>>
blackjack server in node.js. it distributes btc addresses for clients to make deposits to then distributes cards / takes actions and relays the actions of users to the others in the game room
>>
File: hithere.jpg (122KB, 601x403px) Image search: [Google]
hithere.jpg
122KB, 601x403px
>>61346107

Always remember to properly initialize to avoid undefined behavior!

https://www.youtube.com/watch?v=FSZ25ikUKVY
>>
buddhism is basically type theory
>>
>>61346172
>buttcoin gambling
how is this not more widespread
>>
>>61346145
good for me, bad for the country
>>
>>61346145
that's what he gets for reading the Prata book
>>
>>61346145
2bh, a programming license sounds like a good and terrible idea. Depending on who runs in and how the license is given.
>>
>>61346195
its pretty widespread, fortunejack.com for ex, but i want mine to be no registration / no email required
>>
>>61346145
It's obviously going to become more restricted. The government is going to restrict the fuck out of computers in general once 3D printing stops being only shitty plastic and once we start getting programmable gene splicers and molecule assemblers.

You think faggot normies are gonna be cool if you can genetically engineer waifus? When we can pirate monsanto's seeds? When we can print guns in a little box on our desk?

No, they're gonna get propoganda'd the fuck by monsanto and the government.
>>
File: 1444957944037.gif (984KB, 280x164px) Image search: [Google]
1444957944037.gif
984KB, 280x164px
>>61344979
>tfw CS gf
>tfw she's shit so I help her with piss-easy java assignments
>tfw she worships me/ my dick for it
Living the dream.
>>
>>61346226
>once we start getting programmable gene splicers and molecule assemblers.
Obviously these things will be regulated, not programming itself. Or am I being too optimistic?
>>
>>61346231
>tfw shes using you
>tfw she's also getting dicked by chad
>tfw you're getting dumped when she graduates
>tfw she gets the job over you because diversity
>>
There is no reason not to do all new development in Idris
>>
>>61346231
Why would she want a dick that is useless ourside the JVM?
>>
File: ss-2017-07-13-03-14-26.png (104KB, 970x731px) Image search: [Google]
ss-2017-07-13-03-14-26.png
104KB, 970x731px
do you agree with this?
>>
>>61346107
Working on an HFT bot
It's always more right than wrong and thus theorically make money.
It's around 1000$ every 2 days if I have 1 bitcoin or more
>>
>>61346263
performance
>>
>>61346263
I love idris lad, but its slow as molasses.
>>
>>61346267
>Java
>Fast
AhAHAHAHAHAHAHHAHAHHAHAHAHAHHAHAHAHAHHAHAH
>>
>>61346267
The strawman is easily dismantled by uttering "LLVM".
>>
>>61346258
lolno

CS is for brainlets. I'm actually a mechanical engineer doing graduate studies.
>>
>>61346267
No, not at all.
Here's how it should really be.
>prototype a new language
>skip the VM but don't use java either
>people start using it
>and it's already faster than java-based languages
>>
>>61346267
The JVM is too limiting
>>
>>61346267
must be nice being able to believe everything you want is true with no concern for reality
>>
>>61346143
I'm not much of a C# dev, but I would imagine that you would come to a framework with a specific need.

Maybe if you provided what sort of projects you want to be working on?
>>
>>61346286
t. idiot
>>
>>61346267
>>61346295
That being said, the JVM is pretty fast when you consider that it has garbage collection for mutable data. Unfortunately it assumes that you want this.
>>
>>61346321
>no value types
>>
>>61346333
Good point.
>>
/dpt/ can sscanf be used as a parser?
>>
>>61346348
Only for very basic shit.
>>
>>61346333
>>61346337
Actually, is that even a limitation of the JVM or just Java? Surely a value type could be compiled as syntactic sugar for all of its fields.
>>
>>61346355
excuse me?
>>
>>61346355
Oh ok thanks
not me: >>61346370
>>
>>61346348
in a way that would violate the ideal of the design. you should be piping to your analysis tool
>>
>>61346368
The JVM, I don't think it can construct an array of anything other than primitives and references.
>>
File: 1412950562875.jpg (1MB, 1346x1800px) Image search: [Google]
1412950562875.jpg
1MB, 1346x1800px
Threadly reminder that type autism (AKA type """theory""") was a mistake.
>>
>>61346382
As in there's no way to get it to contiguously allocate memory outside of reference types and homogeneous arrays? That makes sense.
>>
has anyone here read the unix programming environment by brian kernighan?
>>
>>61346257
Way too optimistic I feel. At first only the nanomachines, nano assemblers, gene splicers, and 3d metal printers will be restricted, but there will obviously be ones that end up being used for things that the powers that be don't like. Units will get stolen.

Then we see calls to restrict dangerous knowledge. The future holds no computers as we know them, but restricted ones that you cannot program, that you can only install apps. That way you can't install the software that would let you program these machines.

Eventually all compilers will require government licensing and require that the government have full privilege to inspect the results.

DRM is the result of media companies who are small fries. Imagine, imagine anon, the big fries.
>>
>>61346402
why do these people season their milk with feet
>>
>>61346402
>I don't want better error detection, performance, and documentation that is forced to be accurate
>>
File: ss-2017-07-13-03-23-00.png (29KB, 802x591px) Image search: [Google]
ss-2017-07-13-03-23-00.png
29KB, 802x591px
>>61346305
it uses SubstrateVM+GraalVM and not the standard JVM. the combo is designed to handle every programming language (reasonably) imaginable

>>61346286
they've implemented Ruby on top of this thing they're working on and it's 7 times faster than the reference Ruby implementation written in C. the implementation is in Java https://github.com/graalvm/truffleruby/tree/master/src/main/java/org/truffleruby
>>
>>61346258
Pretty much. Was in the same situation. But she stopped putting out way sooner than I expected.
>>
>>61346427
he said type theory, it's not even an argument about static vs dynamic or strong vs weak typing, he just found a silly picture and wanted to post it
>>
>>61346446
>types are good but the people who came up with them are bad! the next thing they come up with will never be a thing i use!
>>
>>61346427
Stop replying to the JShitposter.
His greatest hits include:
>he needs static typing
>Javascript is a programming language
>there is nothing wrong with node
>Dynamic typing is [...]
etc
>>
>>61346420
But what if we kill them first?
If this is what it's like to be a person in the future, wouldn't deliberately ushering in the robot apocalypse be a mercy killing?
Besides, if the drivers we write for these advanced and dangerous technologies are kept reasonably simple, we could easily keep them under our control so that only the people who would have problems with people programming without a license have to die.
>>
>>61346419
of course. you have to read the book first to post in these threads
>>
>>61346231
https://www.youtube.com/watch?v=YWdD206eSv0
>>
>>61346408
Yes, I think that's right. So if you have a class that contains an int and a string, there's no way to have an array of it as a value type, or even an array of alternating ints and strings as a workaround.
>>
>>61346420
>Then we see calls to restrict dangerous knowledge. The future holds no computers as we know them, but restricted ones that you cannot program, that you can only install apps. That way you can't install the software that would let you program these machines.
I suppose we are already seeing this to some extent. Scary stuff.

>>61346437
>the combo is designed to handle every programming language (reasonably) imaginable
Which is to say that they're Turing complete? Unprecedented.
>they've implemented Ruby on top of this thing they're working on and it's 7 times faster than the reference Ruby implementation written in C. the implementation is in Java
It's funny that you think this is a meaningful result.

>>61346446
Type theory in the context of programming means what I listed.
>>
>>61346463
what languages does it discuss, and to what depth?
>>
>>61346427
Except none of those things are true.

Try again.
>>
Javascript is ok, quite fast with a JIT like v8 (faster than python, ruby, php or asp.net)

the real problem is front end frameworks and bad programmers
>>
>>61346419
realistically you should be reading it as you read K&R. at least, i wish someone had told me that way back when.
>>
>>61346494
ATS
Checkmate script kiddies.
>>
>>61346479
read the book here

http://cs2.ist.unomaha.edu/~stanw/172/csci4500/UNIXProgrammingEnvironment.pdf
>>
>>61346473
>language X is limiting
>HUR DUR IT CAN'T LIMITING BE BECAUSE THEY'RE ALL TURING COMPLETE
autism is funny

>It's funny that you think this is a meaningful result.
having true beliefs is funny sometimes too, yes
>>
>>61346462
We must not give up an inch. We must frame the debate in terms of liberating rights we have already given up, rather than saying "okay, but this time no more."

Also we should push and push to get non-human legal entities to not have constitutional rights. We need to take away corporation's free speech and ability to influence government. Corporations are NOT persons as the Milgram experiment clearly showed. Judges routinely apply the fallacy of composition to corporations.
>>
>>61346437
The limitations of the JVM mean that bytecode cannot be sufficiently optimized by the compiler or by the JVM implementation.
>>
>>61346530
I should say, it's funny that you think this is a meaningful result beside the fact it makes Ruby better. And it's a false dichotomy.
>>
>>61346286
It's faster than Python lol

And you don't need that kind of speed unless you're doing FPS games or AI
>>
>>61346553
>It's faster than Python
That's not saying much.
>And you don't need that kind of speed unless you're doing FPS games or AI
You're fucking retarded.
>lol
Jesus christ, fuck off.
>>
File: consider:.jpg (31KB, 500x375px) Image search: [Google]
consider:.jpg
31KB, 500x375px
Excessively typed languages like Rust, Scala, and Haskell are all Turing tarpits because fiddling with types occupies more of the programmer's time than actually solving problems.
>>
>>61346348
It's very useful for parsing simple delimited lists (typically using a comma or whitespace as delimiter), something that many languages lack a built-in tool for. It's pretty trivial to use it as a simple verb-noun parser for text adventures. But for more complex formats, it's far from ideal.
>>
>>61346574
imagine believing spending a moment fixing a type error is more cumbersome than writing a dozen tests that still won't catch it if you mess up elsewhere later
>>
>>61346535
this is irrelevant here because substratevm doesn't use java bytecode

>>61346546
it is going to cut the development time of language implementations and they will be fast by default
>>
>>61346567
>That's not saying much.
It's faster than Python
>You're fucking retarded.
And you don't need that kind of speed unless you're doing FPS games or AI
>Jesus christ, fuck off.
lol
>>
>>61346553
hi notch
>>
>>61346578
Imagine believing that if it compiles, it must work. Imagine believing that type checking can catch nontrivial errors.
>>
>>61346505
ECMAScript would be an excellent language, if it weren't for the fact that most code written it in has negative utility to the user.
>>
>>61346581
>fast by default
You and I have different definitions of fast.
>>
>>61346595
>has negative utility to the user
explain
>>
>>61346591
>Imagine believing that if it compiles, it must work.
imagine believing that users of static typing users believe this
>>
File: 1451363934183.jpg (50KB, 512x397px) Image search: [Google]
1451363934183.jpg
50KB, 512x397px
>>61346578
Most errors aren't type errors. Stop lying to yourself. Excessive typing makes your code highly verbose, extremely fragile, and impossible to refactor.
>>
>>61346607
99% of ECMAScript code encountered by the average user is in the form of JavaScript, specifically JavaScript used to implement spyware, ads, and miscellaneous bloat that slows your web browser to a crawl.
>>
>>61346595
I agree, as I said, we just need more competent devs and this wont be an issue
>>
>>61346618
imagine spending time arguing about useless bullshit that literally no one cares about
>>
>>61346628
t. never used first class types
>>
>>61346618
You're the one who said type checking can replace unit tests.
>>
>>61346630
post what you think its good ECMAscript
>>
>>61346628
They are, you're just not using sufficiently precise types.
>>
>>61346596
yes. yours seems to be pretty useless outside of niches like game development
>>
>>61346651
And it can. Just not all of them.
>>
>>61346666
>it can.
>Just not all of them.
>>
>>61346662
>game development
>multi billion dollar industry
>niche
>>
>>61346645
>>61346654
>you just haven't gone deep enough into the autism
It's needless mental overhead that makes programming more complicated than it needs to be. Your focus should be on solving problems, not stupid cargo cult bullshit.
>>
>>61346645
>"first class types"
what do you mean by this
>>
>>61346673
What part of this are you struggling with?
>>
>>61346689
Turing complete type systems. Not even joking.

Type autism is a mental illness.
>>
>>61346689
Where types can be used the same as literals in every regard.
>>
>>61346704
Strongly normalizing type systems.
>>
>>61346711
>pattern matching on types

>>61346704
turing completeness is a meme
>>
>>61346652
I don't think it's really a "code quality" issue, it's more that it's not the most efficient language to begin with (and it shouldn't be expected to be, since it's a scripting not a systems language) but has become excessively used on the web, causing needless slowdown to provide "features" that the average user doesn't even want. Probably more of a web culture issue than a programming one desu.
>>
File: ss-2017-07-13-03-52-34.png (143KB, 594x738px) Image search: [Google]
ss-2017-07-13-03-52-34.png
143KB, 594x738px
>>61346680
>multi billion dollar industry
it's like 100 billion dollars at most. over 50% of that is shitty mobile games that run on Java anyway.
that's literally nothing compared to other industries that are heavily reliant on software too
>>
can't remember shit in haskell, i confuse everything with python now that i've learned that and have been using it for 2 months every day. what do i do
>>
>>61346730
pattern matching isnt needed in type construction
>>
>>61346830
https://www.youtube.com/watch?v=uqsZa36Io2M
>>
>>61346894
i can use literals in patterns
>>
>>61346909
Yeah, and you can with those, im just saying that PW is less important when you have them.
>>
File: dewrtzhd.jpg (38KB, 750x487px) Image search: [Google]
dewrtzhd.jpg
38KB, 750x487px
>>61346788
working at banks is where it's at
>>
>>61346942
no, you can't pattern match on types in certain classes of theories
>>
>>61346961
shit ones.
>>
>>61346107
Writing an implementation of SRFI 89. It's probably not going to be complete tho.
>>
>>61346267
>execute using AST interpreter
>fast
What the fuck was oracle smoking when they wrote this shit

also use Racket if you want to prototype new languages quickly, that's _literally_ what Racket is for
>>
File: moan ads.png (166KB, 676x360px) Image search: [Google]
moan ads.png
166KB, 676x360px
What do you think, /dpt/?
>>
>>61347272
Agreed. I don't like working with monads because they are a pain when you need more than two at once. Monad stacks are just a headache, I can get just as much done in Racket in less lines of code or in Ocaml with still decent typechecking.
>>
>>61347272
I like to pretend I know what I'm talking about.
>>
File: 1440178982143.jpg (9KB, 260x225px) Image search: [Google]
1440178982143.jpg
9KB, 260x225px
How do I get the patience to program /g/?
I've tried learning but at one point I just run into countless errors because all the tutorials are outdated as fuck and I just give up
>>
>>61347272
I would dispute this
>>
>>61347310
Tutorials are shit.
Use books and learn by yourself.
Also Stackoverflow will most likely have your common problem's answer.
>>
File: 1468474302112.jpg (229KB, 627x720px) Image search: [Google]
1468474302112.jpg
229KB, 627x720px
>>61347339
But how do I get the mentality to not give up
>>
Why did Racket Scheme adopt multiple subtyping instead of multiple inheritance? couldn't they just take example from CLOS?
>>
>>61347357
Have a goal in mind.
Like:
I want to work for vidya games!
I want to make a website!
I want to make my own botnet
i want to make my own OS
etc etc
Or simply you just want to learn, though thats an open-ended problem once you get past your first few books or so.

Youll either fall in and get side-tracked by other learnings, or youll give up and go do something else.
Programming is a time-consuming hobby youll either love, hate, or eventually love.
>>
>>61347394
Thanks, anon
Any books you recommend?
>>
>>61347391
Do you mean in Typed Racket? Because there isn't really subtyping in untyped Racket, just predicates on numbers which may or may not overlap. Also Racket has taken little examples from Common Lisp at all so I don't think this would be a place for them to start.
>>
alright anons, how can we use our combined computing power to bring down the trump presidency?
>>
>>61347413
Depends what you want.
If you want to learn the base of most things, go grab the C book by Kernighan & Ritchie.
If you want something more modern, go give Rust,D, or Nim a try.

If you want web shit, Nim, Elm, Elixer, etc
Most modern langs should have their own book or decent tutorial.
>>
>>61346267

>Execute using AST interpreter
If you wanted to leverage the JVM for performance, you'd have to be compiling your language directly to Java Bytecode, and using the JIT to get about half of native performance.

But to be honest, you should be using LLVM for all of your code generation. If you need a garbage collector, you can actually get that functionality out of libraries like http://www.hboehm.info/gc/
>>
File: 1403101492150.gif (885KB, 245x147px) Image search: [Google]
1403101492150.gif
885KB, 245x147px
>>61347479
Thanks again, anon
>>
>>61347510
No problem mang.
Theres also Lisp and all its flavors but learning other languages will be slightly tougher because its a different world.

Functional languages i would stay away from until you are semi-confident in a more traditional language.

Its really just going to come down to what field youre interested in.

gl m8.
>>
rate the language layout:
functions have no side effects
methods belong to an object and can only alter attributes within that object and return a value
procedures are functions with side effects

syntax:
function my_fun x = y
method my_object.mymethod x = y
procedure my_procedure = do stuff
>>
>>61347586
Ive always liked the idea of controlled mutations only in pure functions.
>>
>>61347586
>functions have no side effects
good
>methods belong to an object
0/10 garbage
>>
File: ewjlwfeljhewflkhwef.png (168KB, 360x359px) Image search: [Google]
ewjlwfeljhewflkhwef.png
168KB, 360x359px
Finally got my IMU model to compile, now I'm trying to make it work...
>>
File: ss-2017-07-13-05-33-59.png (270KB, 1568x798px) Image search: [Google]
ss-2017-07-13-05-33-59.png
270KB, 1568x798px
>>61347494
it is designed to run on substratevm which doesn't run java bytecode. the produced native binary doesn't depend on the jvm.
what you get is a lot more than a (optional) gc. your language implementation is much simpler, you get advanced debugging and profiling support by default, you get no overhead interop between all sorts of languages like ruby, java, javascript and anything that compiles to llvm ir (https://github.com/graalvm/sulong)

the javascript implementation seems to be competitive with V8 in terms of performance which is pretty crazy
>>
>>61346737
>desu
I do it too desu. But back to the point, unless you're Richard Stallman everyone wants JS on the web. There's some "cool" features that should be disabled without permission like webgl but that's about it
>>
What if there were an object oriented language written to mirror english
Classes are nouns
Methods are verbs
Adjectives are traits, they can override specific methods for specific classes
Adverbs are generic traits, they can override any method that matches their pattern and the new implementation is allowed to depend systematically on the old, you can even apply an adverb to an adjective instead of just a verb and then it will try to override all the methods in that trait that it can
Prepositions are like the commas that separate method parameters
Example:
Let there be a big round ball.
Let there be a green chair.
Let the big round ball bounce quickly on the green chair.

What it does:
>presupposes "ball" as a class
>presupposes "big" and "round" as traits implemented for "ball"
>presupposes "chair" as a class
>presupposes "green" as a trait implemented for "chair"
>presupposes "bounce [on]" as a method defined by "ball" and possibly overridden by "big" or "round"
>presupposes "quickly" as a generic trait applicable to "bounce"
>allocates a ball
>gives it the big and round traits
>allocates a chair
>gives it the green trait
>attempts to match the ball's bounce-on to a generic method in quickly
>parametrizes the generic method with the ball's implementation as a parameter
>calls the resulting parametrization with the ball as the receiver and the chair as the parameter
>>
>>61348035
What if people stopped using object oriented programming?
>>
>>61348077
Then the question you just asked wouldn't make linguistic sense.
>>
>>61346107
>>61346993
My shitty highly incomplete implementation of SRFI 89 is complete. Behold its first use!

(define* (inventory-grid-alter!
inventory-grid
(x-num: x-num #f)
(y-num: y-num #f)
(x: x #f)
(y: y #f)
(w: w #f)
(h: h #f)
(x-align: x-align #f)
(y-align: y-align #f)
(x-padding: x-padding #f)
(y-padding: y-padding #f)
(u: u #f)
(v: v #f)
(uw: uw #f)
(vh: vh #f)
(spritesheet: spritesheet #f))
(apply inventory-grid-alter/all!
(cons inventory-grid
(apply list-replace-bulk
(cons (cdr inventory-grid)
(filter (lambda (e) (cdr e))
(list `(0 . ,x-num)
`(1 . ,y-num)
`(2 . ,x)
`(3 . ,y)
`(4 . ,w)
`(5 . ,h)
`(6 . ,x-align)
`(7 . ,y-align)
`(8 . ,x-padding)
`(9 . ,y-padding)
`(10 . ,u)
`(11 . ,v)
`(12 . ,uw)
`(13 . ,vh)
`(14 . ,spritesheet))))))))

Ok, that looks bad, but it actually makes things nice:
        (if (letter_down #\i) (inventory-grid-alter! hotbar x: 69 y: 69)); hide hotbar
(if (letter_down #\o) (inventory-grid-alter! hotbar x: 0 y: -1)); show hotbar
>>
>>61348035
How would you define new classes?
Let there be such a thing as
?
>>
>>61348035
So basically the ultimate normie language where everything is abstracted?

Take "Visual" programming like Alice and remove the visual element.

Itd be shit.
>>
File: p.jpg (103KB, 720x540px) Image search: [Google]
p.jpg
103KB, 720x540px
Wanna learn Idris but cannot into dependent types, particularly how Fin works.

Anyone able to help with that, or, more specifically, anyone have a pdf or torrent or whatever of Type-Driven Development with Idris?
>>
>>61348117
>Let there be such a thing as
fucking kek
>>
>>61348143
(Fin n) is a type with exactly n values
>>
>>61348035
Proposal:
1) Have generic classes, not just generic traits.
2) Generic classes would use "of" to describe their relationship to their parameter. E.g.
Let there be a box OF balls.
(Capitals for emphasis, not actual part of code.)
3) Generic classes that also happen to be containers would use "in" to describe their relationship to their contents. E.g.
Let there be 12 balls IN the box.
>>
>>61348117
You're overthinking it anon.

Let a [class] be [description]
>>
>>61348143
>>61348191
and these values are
0, 1, 2, ... n

Hence FZ and FS
FZero and FSuccessor
Successor means (1 +)

0 : Fin n | n > 0
1 + 0 : Fin n | n > 1
1 + 1 + 0 : Fin n | n > 2
1 + 1 + 1 + 0 : Fin n | n > 3
>>
If higher kinded types are pretty just generic types, what do we call things that are a higher order than types in the type way of being higher order, instead of in the function way of being higher order?

That is to say, what do we call types of which types are instances?

I mean there's no reason not to have more than one such type
>>
>>61348249
term
type
kind (type has kind Star)
sort (kind has sort Box)
-- at this point you give up on giving each one names and just replace the entire thing with a heirarchy of universes
>>
>>61348035
>>61348077
>>61348084
>>61348117
>>61348122
>>61348151
>>61348198
>>61348207
ok what do we call this language, it's now officially going to be a thing
>>
>>61348298
"Let"?
>>
So I rolled for the programming challenges and I got the coin flip.

I wanted to spice things up and make graph and charts over extensive amount of time the coin flip was played, and wanted to use xorshift but I don't know why it won't show me any random numbers.

I'm using the code from the wiki: https://en.wikipedia.org/wiki/Xorshift

#include <stdint.h>

/* The state must be seeded so that it is not zero */
uint64_t s[2];

uint64_t xorshift128plus(void) {
uint64_t x = s[0];
uint64_t const y = s[1];
s[0] = y;
x ^= x << 23; // a
s[1] = x ^ y ^ (x >> 17) ^ (y >> 26); // b, c
return s[1] + y;
}


Anyone know how to use this function correctly? I always get a 0 when I call xorshift128plus()
>>
>>61348298
Tish
>>
>>61348298
Fancytalk.
>>
>>61348298
please no
my god man you'll kill us all
>>
>>61348308
You have to set s to something nonszero anon.

Also why xorshift128plus and not xoroshiro128plus?
>>
>>61348324
Do you mean the s[2]?

Also, I never dug deep into random number generators that much, all I could remember from here a long time ago was xorshift as a suggestion. Though, I will look into xoroshiro as well.
>>
>>61348308
Here's the original full code that wikipedia stole:
http://xorshift.di.unimi.it/xorshift128plus.c
>>
>>61348341
Yeah just something like

void main() {
s[0] = 666;
s[1] = 777;
next();
}
>>
>>61348298
Cancerscript
>>
>>61348359
Ooh alright, I guess I have to use the full code, not that sample, since there is no next()

I did look up some examples, someone made a noise generator, but did not see next() I guess.

I'll see what I can do now. Thank you Anons!
>>
>>61348298
B++.

Think about it.
"Let there be a(n) ______."
"Let there be"
"Let 'ere be"
"Letter be"
"Letter B"
"B"
"B++" because B is already a language
>>
>>61348384
The wikipedia article just renamed next() to xorshift128plus()
>>
>>61348359
Doing that is always giving me the same number every time I run the program though.
>>
File: 1499893744064s.jpg (6KB, 250x201px) Image search: [Google]
1499893744064s.jpg
6KB, 250x201px
I'm going to try and learn NCURSES
>>
File: 2017-07-12-232549_1440x900_scrot.png (112KB, 1440x900px) Image search: [Google]
2017-07-12-232549_1440x900_scrot.png
112KB, 1440x900px
Why this nigger piece of code doesn't spawn four regions at the top?

void Random_Room_Seeds(int ix, int iy, int w, int h, int level)
{
TestQuadtree.add(new Rectangle(ix, iy, w, h));
if (level < 3)
{
Random_Room_Seeds(ix, iy, w/2, h/2, ++level);
Random_Room_Seeds(ix+w/2, iy, w/2, h/2, ++level);
Random_Room_Seeds(ix, iy+h/2, w/2, h/2, ++level);
Random_Room_Seeds(ix+w/2, iy+h/2, w/2, h/2, ++level);
}
else
{
int x = random.nextInt(w) + ix;
int y = random.nextInt(h) + iy;

map[x][y].cell_type = Cell.Cell_type.ROOM_START;
return;
}
}
>>
>>61348503
dumb frogposter
>>
>>61348486
Yeah because s is the seed. If you want your rng to have a different sequence each time you use it, you have to randomize the seed. Best way would be reading some bits from /dev/null
>>
>>61348576
>>61348486
Fuck. /dev/random. Or you could just have the user enter a seed. Or you could input the system time as a seed. /dev/random would be the best but the hardest
>>
>>61348534
his dumbest is your smartest
>>61348503
wish you luck!
>>
>>61348593
dumb frogposter
>>
>>61348576
>>61348586
    s[0] ^= time(NULL);
s[1] &= s[0];
s[1] ^= next();
for(;;){
printf("%"PRIu64 "\n",next());
}

I'm trying to get it down to maybe 1 to 100, any resources on how to do that with this randomizer?

Yea I guess /dev/random is nice, I have to read it in as a file, right? Or just use a shell command to get it? What's the best way to read from a file that changes a lot?
>>
>>61348605
>mfw u
>>
>>61348614
The typical way to do it is to turn the output of the random number generator into a flonum.

double xoroshiro_random_flonum() {
const uint64_t n = next();
return ((double) n) / UINT64_MAX;
}

From there you just do 1 + ((int) xoroshiro_random_flonum() * 100)
>>
>>61348643
I tried that, it only outputs 1. It broke the seed somehow.
>>
>>61348703
Hmm. Not enough parentheses.

1 + ((int) (xoroshiro_random_flonum() * 100))
>>
>>61348790
Oh wew I donno how I didn't catch that either. Was busy trying to read from /dev/random.

Got it working but I'm getting negative numbers. Is that good for the seed? I tried changing it to unsigned but nothing happened. I'll try some other things.

Thanks for the help.
>>
>>61348830
Hmm?

What do you mean is it good for the seed?

All you have to do is
int main() {
s[0] = time(NULL);
s[1] = time(NULL);
for(;;) {
printf("%i\n", 1 + (int)(xoroshiro_random_flonum() * 100);
}
}
>>
>>61348932
I meant, I didn't test it but, if negative seed numbers provide positive random numbers?
>>
>>61348932
I guess now, I have to look up how to make graphs with C. I'm thinking of some simple ASCII GRID with 2 dimensional arrays, but I donno.

#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdint.h>
#include <time.h>
#include <fcntl.h>
#include <stdbool.h>

#include "xoroshiro128plus.h"

uint64_t s[2];

double xoroshiro_random_flonum() {
const uint64_t n = next();
return ((double) n) / UINT64_MAX;
}

int main(void){

bool loop = true;
uint64_t flonum;

int byte_count = 64;
unsigned long int data[64];
FILE *fp;
fp = fopen("/dev/urandom", "r");
fread(&data, 1, byte_count, fp);
fclose(fp);

s[0] ^= (uint64_t) data;
s[1] >>= s[0];
s[1] |= next();

while(loop){
flonum = (1 + ((int) (xoroshiro_random_flonum() * 100)));
//printf("%"PRIu64 "\n",flonum);

if (flonum > 50){
printf("1\n");
}else{
printf("0\n");
}
}

return 0;
}
>>
File: 1446689620118.png (30KB, 274x187px) Image search: [Google]
1446689620118.png
30KB, 274x187px
>>61346107
Stupid question here. What's the point of inheritance?
Why can't I just make another instance of BaseClass instead of doing the whole NewClass : BaseClass thing?
>>
>>61349543
Inheritance is supposed to remove a lot repetitive so you don't have to re implement shit again. You aren't going to create a class for cats and separate class for dogs when both are four legged and move. You would create a base class like Animal which can move, then I don't need to re implement the move methods. Since Cat and Dog are separate classes, I can create a method like claw so that a cat can scratch and bite so a dog can bite independently of each other so that a dog can't scratch and a cat can't bite.
>>
>>61348249
Typeclasses.
>>
>>61349659
idiot

>>61349543
there isn't one
OOP is shit
>>
Anyone have any idea how to monitor openvpn server load and distribute client connections accordingly in C?
>>
Does .NET include any functionality for justifying text that I'm overlooking? Not seeing much on Google, so I'm guessing no.
>>
I'm too retarded for anything but C#
>>
>>61349581
Cat's and dog's explanations suck.

>>61349543
Take a look at GtkWidget's inheritance:
https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget.object-hierarchy
(Almost) all GtkWidget functions are applicable to its children.

When you try to implement with inheritance something that you shouldn't, is when OOP becomes shit. Outside of GUI libraries, that means everywhere.
>>
File: 1453302579367.jpg (91KB, 1280x720px) Image search: [Google]
1453302579367.jpg
91KB, 1280x720px
In OpenGL, is there a way to simply render a texture to the default framebuffer?
I would like to not need to use a trivial shader to do this.
>>
>>61350006
Legacy OpenGL? Yes, don't use that.
"Modern" OpenGL (ES >2.0, Core >3.0)? No, use you'll have to shaders.

Remember that modern in GPUs when you don't bind a shader (and you are using Legacy OpenGL), your driver will bind a (bloated and) generic shader for you.
>>
>>61350006
No, but it is a trivial shader anon.

I guess if you draw on every single pixel you could blend your text with each fragment, but that would likely be worse than drawing that texture. Not to mention if you draw the texture first and use early depth testing it is a potential performance increase.
>>
>>61350026
I'm actually using OpenGL ES 2, which forces you to use shaders, so I couldn't use legacy shit anyway.

>>61350061
I've already written it, actually. I just wanted to know if there was anything a could do to get rid of all of the shader bloat code.
Literally all I'm doing is taking a GL_TEXTURE_EXTERNAL_OES and drawing it straight to the framebuffer. No transforms or changes of any kind.
>>
>>61346223
Sounds like a counter's paradise.
>>
>>61350152
Nigga it's a 5 line vertex shader and a 4 line fragment shader and less than 15 lines to execute it on those 4 points.
>>
>>61350177
could be, I myself have made shitloads of BTC from the dice game. I almost built an intuition if it'll roll up and down lol, spent alot of money
>>
>>61350188
Yes I know, but there is still the code to actually compile the shaders, set up vertex attributes and all that shit. Overall, it's closer to 100 lines of code.
When I say trivial, I REALLY mean trivial. This is about as simple as it gets besides just calling glClear() or something. I am just showing an image.
>>
>>61350212
>100 lines
Holy fuck anon you made me get out of bed to post this. It should be like, 15.

GLuint menu_program;
GLuint menu_shaders[] = {
compile_shader("menu_vertex.glsl", GL_VERTEX_SHADER),
compile_shader("menu_fragment.glsl", GL_FRAGMENT_SHADER)};
menu_program = link_shader_program(menu_shaders, 2);


void menu_render() {
qsort(menu_instances, menu_mem_cursor, sizeof(menu_instance*), menu_compare);
for(int i = 0; i < menu_mem_cursor; i++) {
menu_quad * dest = menu_quads + i;
menu_quad * src = &((menu_instances[i])->grafix);
memcpy(dest, src, sizeof(menu_quad));
}
glUseProgram(menu_program);
glBindBuffer(GL_ARRAY_BUFFER, menu_vbo);
glNamedBufferData(menu_vbo, sizeof(menu_quad) * (menu_mem_cursor), menu_quads, GL_STREAM_DRAW);

glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(menu_vertex), (const void *) offsetof(menu_vertex, xy));
glEnableVertexAttribArray(0);

glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(menu_vertex), (const void *) offsetof(menu_vertex, uv));
glEnableVertexAttribArray(1);

glVertexAttribIPointer(2, 1, GL_UNSIGNED_INT, sizeof(menu_vertex), (const void *) offsetof(menu_vertex, texture_offset));
glEnableVertexAttribArray(2);

glDepthFunc(GL_ALWAYS);
glDrawArrays(GL_TRIANGLES, 0, 6 * menu_mem_cursor);
glDepthFunc(GL_LEQUAL);
}

And mine's still more complicated
>>
>>61348576
>reading some bits from /dev/null
that was amazing anon
>>
File: 1475174769704.gif (1MB, 400x225px) Image search: [Google]
1475174769704.gif
1MB, 400x225px
>>61348035
What was wrong with lolcode

>>61348503
>not just a frogposter, but a frogposter for ants

>>61350207
>mfw i find out insurance pays 6:5
>>
File: anubis.jpg (58KB, 1280x720px) Image search: [Google]
anubis.jpg
58KB, 1280x720px
>>61350263
The dead do not talk to the living
>>
I miss Ruby. He used to teach me a lot of things about computers. What happened to him? (⋟﹏⋞)
>>
File: compression.png (1MB, 1836x1130px) Image search: [Google]
compression.png
1MB, 1836x1130px
Posted a text to image compression thing I'd been working on yesterday. Worked on it a bit more today. I currently can compress the entire text of Harry Potter into an image fairly smaller than what I was originally generating.

Again, nothing groundbreaking but I thought I'd share.
>>
>>61350384
Wait, so the text is stored as image data? So if you look at the image it looks like noise, but if you read its data, you get Harry Potter?
>>
>>61350384
Is this image illegal? What is the decompression method?
>>
>>61350258
>compile_shader
>link_shader_program
I was counting the lines for those function, and the shaders themselves too.
>>
>>61350384
Seems pretty wasteful. I can fit that entire book on an sd card and that's way smaller than either of those squares
>>
File: Capture.png (72KB, 815x613px) Image search: [Google]
Capture.png
72KB, 815x613px
i had an idea for a puzzle horror game when i read about how under-tale uses the registry. (ill use parentheses to say where i got the idea from)
my idea is to get a windows xp sp3 VM and make a giant pack of vbscripts that can edit files, change sounds, replace the background, change logos and such. along with the VBS files i will have HTML files (welcome to the game) for the big chunk of the gameplay with small programs for other things. im also thinking rooting through "error logs", "programming files" and pictures to solve puzzles (Mainlining). im trying to get a message to show in the MBR (xkcd) without overwriting the windows version but im having no luck making/finding one that can do it multiple times or remove it when needed. i also have a 3rd party script that BSODs the computer (StartBlueScreen). im not really working on it and on the verge of abandoning it.

TLDR: im making a puzzle horror game out of an entire windows xp
>>
>>61350419
How could a collection of 1s and 0s be illegal, anon?
>>
>>61350418
>>61350419

Each pixel has an RGB value. I'm therefore taking the number than stores the value for each channel and using it to represent an ASCII character. So a pixel with the RGB value of rbg(97, 99, 98) produced a string of "acb". Then it just reads left to right.

>>61350433
It's obviously not practical. But a fun exercise. Have been thinking about storing heaps of data in a lossless video and reading it frame by frame and producing output text. Again, not practical but still fun.
>>
>>61350425
Oh I thought you were adding a HUD or something to an existing project. Seems like overkill to use a 3d graphics library to render a static image. I'd just use SDL for that.
>>
>>61350458
what language are you using?
>>
>>61350484
PHP. I'll await the oncoming shitstorm.
>>
>>61350384
I used to do that to share audio on 4chins. You can even hear the compression artifacts if you save the sound as a JPEG.
>>
File: 1498934037339.jpg (26KB, 367x411px) Image search: [Google]
1498934037339.jpg
26KB, 367x411px
>he uses
for (int i = 0; i < ceil; i++)

>instead of
for (size_t i = 0; i < ceil; i++)


it's like you want broken software
>>
>>61350495
Ah man. You reminded me when I used pho for generating image captchas and command line programs back in the day, when i was a dumb little 6th grader who didn't know how to use arrays well.

Good times. Simpler times.
>>
>>61350467
The shit I'm doing is very specific, and unfortunately requires me to use an OpenGL context.
All of the complicated work I'm doing is happening inside EGL and a bunch of Linux specific shit. I'm really just trying to copy something from an EGLImage to another framebuffer.
>>
>>61350495
can you upload your code?
>>
>>61350517
I just match whatever the type of 'ceil' happens to be.
>>
File: 1494309169535.png (425KB, 589x564px) Image search: [Google]
1494309169535.png
425KB, 589x564px
>>61350517
>tfw size_t masterrace
>>
>>61350549
Needs a lot of cleaning before I'll do that. I'm sure I'll put it here in the upcoming days. I'm very much a "get it working then clean it" type of programmer.

Keep your eyes peeled and your rectum sealed.
>>
does anyone hate when you stall for a bit when switching between different programming tasks, and the next task isn't necessarily very difficult but there's still overhead for the context switch
>>
File: terry a davis.jpg (321KB, 1971x1971px) Image search: [Google]
terry a davis.jpg
321KB, 1971x1971px
>>61350589
My brain is ring-0
>>
>>61350517
System dependent. It's like you want that code to break on the customer's 6502.
>>
>>61350600
>int isn't system dependent

Real men use int16_t
>>
>>61350594
https://www.youtube.com/watch?v=UDwyTx8Fh1k
>>
>>61350611
Both are shit. Always uint16_t.
>>
>>61346437
>https://github.com/graalvm/truffleruby/blob/master/src/main/java/org/truffleruby/Layouts.java
jesus hell
>>
>>61350631
Always use signed integers if you don't have an explicit reason for needing unsigned, anon. And capacity isn't a legitimate reason, if signed isn't big enough then it's unlikely that twice that is going to be sufficient - you should just use a larger type if you need to store a larger number. You should only use unsigned when working with code you didn't write that requires it, or working with low level hardware details that require it. Even things that are conceptually unsigned you're better off using signed if you're able.
>>
>>61350706
>Even things that are conceptually unsigned you're better off using signed if you're able.
But why?
>>
>>61350438
Just read the existing partition table (the last 64 bytes) and write your own bootloader, then insert the existing partition table.
>>
File: why.png (84KB, 550x751px) Image search: [Google]
why.png
84KB, 550x751px
>>61350632
>>
>>61350706
I wouldn't be using c if I weren't doing low-ish level bit bullshit anon.

>>61350738
Makes it easier to debug becaise if a negative shows up then you know corruption or overflow just happened.
>>
how do i program a madoka bot to take care of me emotionally and physically
>>
>>61350706
t. google monkey
>>
>>61350805
main = interact (unlines . map (++ " too") . lines)
>>
OCaml guy from yesterday here.
I have a sub-type declared as

type bType = 
| Int of int
(*some other stuff*)
| Dict of (string * aType) list


the problem I run into is that, when using my Dict constructor the language doesn't treat it as a list. Am I just declaring it wrong?
>>
>>61350517
C brainlets can't do this

for (decltype(ceil) i = 0; i < ceil; i++)
>>
>>61350909
(Dict l) isn't a list
l is a list, (Dict l) is a bType
>>
>>61350913
>ceil is const
>>
>>61350913
>incrementing a function pointer
for what purpose
>>
>>61350954
for (std::remove_const<decltype(e)>::type i{0}; i < ceil; i++)
>>
http://cukic.co/2017/07/12/the-long-arrow-operator-in-cxx/
>>
>>61350930
Thanks. I have so many problems with this language it's unreal.
>>
>>61351040
I don't know any OCaml resources, but Haskell is somewhat similar, and you can check the Haskell wikibook.

There's also F#, which is sort of halfway from C# to OCaml.
>>
Guys, I'm a nerd like you guys. I have a chemical engineering degree. How do I become one of those people who can actually program real world stuff that is cool? Is "just doing it" the only way, with a lot of using Google?

I think programming opens up tonnes of possibilities but I am a lazy and procrastinating person. Is all that Algorithms class / Operating systems class stuff really necessary in the real world? I'd rather not waste my time. I know stuff like loops and booleans. I've a gone through some of SICP and it hasn't given huge insights. It seems like every single real world famous programmer had no degree, while every single famous CS academic didn't do CS, they did maths.
>>
File: 1477079857755 (1).jpg (106KB, 1280x720px) Image search: [Google]
1477079857755 (1).jpg
106KB, 1280x720px
>>61351086
>programming
>cool
>>
>>61351086
Im not a nerd. Im a chad programmer
>>
>>61351039
Stop reading hacker news for god's sake.
>>
>>61351086
use a real language

https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
>>
>>61351086
If you don't know algorithms, your code will likely scale like shit.
>>
I am trying to write a program that searches txt files for keywords and appends the corresponding line to a data table if the keyword was found. Doing it in Python, worked pretty good so far. The only problem I can't seem to fix are the german umlaute (ü, ä, ö, ß) which won't be displayed properly.

I basically have a ton of .txt files that display them properly, read them into python and write parts of that to a .csv file. I tried different encodings (latin1, utf-8 ..) in all files and I can't seem to make it work. Can anyone help?
>>
>>61351239
true, but you can self-learn it pretty well, just look up sorting and pathfinding etc, and beyond that it just comes down to general problem solving and math
>>
File: lain001.jpg (1MB, 1440x900px) Image search: [Google]
lain001.jpg
1MB, 1440x900px
I want to make something (currently using C#) but I do not know what to make at the moment. Any Ideas on something to write?
>>
>>61351400
make anime real
>>
>>61351337
Use python3, also where are they not displayed properly?
>>
>>61351447
I am not good at programming at all and I kind of don't want to re-learn half of python cause of a single problem.

It's not displayed correctly in the output .csv file, there is no problem with the display inside the python file or the source .txt files. I've been searching google for ages now and I just can't seem to fix it.

also how would switching to python 3 hrlp?
>>
>>61351404
I wish I was that smart to do that, it would save multiple lives and would prove to be more important than social media.
>>
>>61351472
If you are not using tons of external libraries the most you have to do is probably change print to print(). Python3 has unicode support build-in which solves most of encoding/decoding problems
>>
File: 1475143072125.jpg (15KB, 448x283px) Image search: [Google]
1475143072125.jpg
15KB, 448x283px
>>61351540
you can do it
believe in the me that believes in you
>>
>>61351601
I will do it anon, thank you for believing in me :')
>>
File: fragzeichenanimu.png (194KB, 500x500px) Image search: [Google]
fragzeichenanimu.png
194KB, 500x500px
>>61346107
In Scheme I'm using a record type to keep track of variables. It works much like a struct in other languages, so that for record type ass, procedure
(ass-poo)
is the equivalent of
ass.poo
in C or whatever. I'm assuming that accessing these fields is done in O(1) time.

But if I'm writing in a functional style and ensuring referential transparency, that means having procedures return new structs on every single interation. I'm wondering if I should just use plain lists instead of structs and typedef them to keep track of things. It would mean that accessing a given field would be O(n), but is that really so bad for 3-4 fields? Surely there's an overall performance gain in not initializing a full struct every time I recurse in a function?

What does /g/ think the better side of the tradeoff is?
>>
File: pm-lee-hahaha.jpg (23KB, 521x426px) Image search: [Google]
pm-lee-hahaha.jpg
23KB, 521x426px
>>61351400
Sudoko solver. It's pretty fun, you have three different strategies for solving these. If you just implement the easiest strategy you can solve easy puzzles, the next strategies for harder puzzles and the last for all puzzles
>>
>>61350006
>>61350467
>>61350544
Actually, I was digging through the OpenGL ES2 extensions, and found glCopyImageSubDataOES, which basically does exactly I need to do.
>>
>>61351664
what
>>
File: 1499655348368.jpg (11KB, 300x270px) Image search: [Google]
1499655348368.jpg
11KB, 300x270px
>writing a project
>works fine consistently
>leave it alone for a day
>IDE updates
>project fails in the same place consistently
>>
>>61351774
If you were writing in a functional style, would you rather have functions that return structs or lists?

Where structs are quicker to access but slower to make.
And lists are the opposite.
>>
>>61351795
I would do it conditionally, if your project is doing a lot of allocations, use the list method, otherwise use the struct method. Best option is to perf test both and see if it's meaningful.
>>
I'm implementing a bit matrix in C. Each element is an unsigned int.
Function setBit() and getBIt() need to find the right bit. The position in the matrix is col/32, but what is the formula needed to get the right bit?
>>
>>61351795
Records are by no means opposed to functional programming or functional purity.
I would advise you to prefer structured programming to the contrary in most circumstances. In Lisp common advice is that you should minimize consing to improve performance.
I would recommend that if you'd use an array or record in C, then do the same in Lisp.
>>
How can I make my C take in a string argv?

switch case only works with characters it seems:

        for (i = 1; i < argc; ++i){
switch(*(char*)argv){
case "test":
break;
}
}
>>
>>61351840
if I'm folding x through '(xs) n times, you're saying returning n records is faster than returning n lists?

Correct me if I'm wrong, but records are implemented on top of hashtables, no? Is making n hashtables in a row faster than making n lists, where any given list is just 3-4 items consed together?
>>
>>61351876
C does not have string switches.
Use an else-if chain.
>>
>>61351913
Ah damn, alright.

Does C++ have em?
>>
>>61351935
No.
>>
>>61351878
Records should be faster in any case.
You must understand that Lisp is a rigorously structured language which has real records.
It is unlike JS or Python languages which monopolize ideas of what dynamically typed language are, and where every object is effectively organized like a hashtable.
That is a distinction of languages which are "class-based" vs "prototype-base" (aka descendants of Self)
>>
>>61351935
a switch statement just tests == equaliry right?
Should work for a std::string but not a char* in that case.
>>
File: Untitled.png (68KB, 934x616px) Image search: [Google]
Untitled.png
68KB, 934x616px
>>61352036
no
>>
>>61351966
Ok, thanks.
>>
>>61351966
>>61352097
So just for clarification, in Scheme when I am referencing a field of a record with
(ass-poo)
, it's most likely a dedicated procedure that returns a pointer directly to the field called "ass", rather than something that looks up "ass" in a hash-table?

Because I can see how that would be faster to implement.
>>
>>61352064
That fucking sucks.
>>
>>61352122
Yes, you can think of slots in Lisp as if they were methods. Good implementations should make these accesses O(1).
The fastest access is generally to use (ass-poo x) because the static type of the receiver is explicit in the method name.
If the static type isn't explicit (eg. using slot-value), the compiler may not be able to infer that x is instance of ass in the call context, and it must dispatch the slot method on the class <object>. That could be suboptimal on some implementations. (think of object as a class with a huge method vtable which may accept the messages of all the slots of all existing classes)
>>
new thread when? :3
>>
>>61352325
in approximately 30 posts
>>
>>61352348
How much time?
>>
File: 1498712695186.jpg (204KB, 1242x1247px) Image search: [Google]
1498712695186.jpg
204KB, 1242x1247px
Curious question for any post-college programmers out there with jobs/freelancing, how many do you abuse amphetamines? Like focalin, adderall, vyvanse etc? Im junior year cs major math minor and can literally program 30+ hours straight with masturbating breaks because amphetamines make me horny.
>>
https://ghostbin.com/paste/x7o4t

wew, what do you guys suggest to improve on? I know I have made some silly mistakes here and there.

Still want to go full on graph mode to show the linear line it makes.
>>
sup /g/
could someone knowledgeable give little advice (sorry for poor english)
how would you go about writing script to input multiple tax numbers to check if they are available on website like this;
https://ppuslugi.mf.gov.pl/_/#1
I mean, the script should input a data from file to every input field, submit and return what website returns.
i'm looking for a proper way to do it, appreciate some advice
>>
>>61353033
Kurwa
>>
>>61353033
python
requests library
>>
>>61352794
you have unused variables int i, j;
>>
File: anime_programmer.jpg (89KB, 424x960px) Image search: [Google]
anime_programmer.jpg
89KB, 424x960px
sorry por englis
what is good programming language for new person?
>>
>>61353198
kys
>>
>>61350632
>>61350783
generated code, who cares

>>61353198
HTML
>>
>>61353198
code.org, the angry bird tutorial.
>>
in java why does this compile
import java.util.*;
public class Main {
public static void main(String[] args) {
List<Integer>
li = null;
List<Boolean>
lb = null;
}
}

but not the correct version?
import java.util.*;
public class Main {
public static void main(String[] args) {
List<Integer>
li = null;
List<Boolean>
lb = null;
</Boolean>
</Integer>
}
}
>>
>>61353514
because that's not valid in Java
>>
where can I find some fucking documentation for MySQL Cppconn?

because https://dev.mysql.com/doc/connector-cpp/en/connector-cpp-reference.html is fucking nothing

and even though I installed mysql with an installer and told it to install documentation and examples they're nowhere to be found in the bloody mysql folder

I am so fucking angry I can't even make this post wackily exagerrated
>>
>>61353514
Almost had me
>>
>>61353554
but how does it know where your generic ends if you don't close it
>>
>>61353579
in the semi colon
>>
>>61353566
>because https://dev.mysql.com/doc/connector-cpp/en/connector-cpp-reference.html is fucking nothing
click next
>>
>>61346226
>trying to restrict knowledge
Futile. Anyone who really wants to know stuff can know stuff. Just look at how some nobody without connections like Breivik created an effective bomb.
>>
>>61353624
It's just the documentation on how you can initialize the connection. That's not an exhaustive documentation.
>>
int (*main)() = 0;
>>
>>61353514
>>61353579
upvoted XD
>>
Does anyone else suck at coding on paper for tests?
I'm fucking terrible at it.

I am so used to typing the logic I thought of into the IDE and then start correcting mistakes from there.

And I also fucking hate doing something unoptimized.
I litterally wrote nothibg at a task because I was busy trying to find a better solution to it than what I originally came up with, which was a fucking ugly way of doing it.
I was so stuck up in my head that I literally ended up writing nothing kek
>>
I don't know shit about C/C++ macros, is it possible for me to compose a string literal from a portion of another string literal that is legal in both languages?

i.e.
define MEME "abcxyz"
define SUB_MEME ???
SUB_MEME == "abc"
>>
>>61353732
No, unless you define MEME like
#define MEME SUB_MEME "xyz"
#define SUB_MEME "abc"
>>
>>61353727
just like practise it for a bit and you will stop being terrible. it's really that simple
>>
>>61353685
const main = 195;

>>61353732
#define MEME "abcxyz"
#define SUB_MEME ( strndup( MEME , 3))

i guess
>>
>>61349543
Look up polymorphism. Inheritance for the sole purpose of reusing code is shit.
>>
>>61353752
>>61353782
I should clarify that I'm trying to get the year specifically from __DATE__ and I need it to be a compile time constant since it's going to be shoved into .data, or maybe it's .bss, I forget how binaries work today because there's an excessive heat warning in my area. Either way it's going into a dynamic library and can't be generated at runtime.
>>
>>61353732
Macros are executed prior to compile time, they're just source code text substitution. You'd think even a source code text substitution engine could do something as simple as taking a substring, but actually, no.

Here's what you can do instead, since adjacent string literals are automatically concatenated:
#define SUB_MEME "abc"
#define MEME SUB_MEME "xyz"

Note you can't do this with regular variables, because the concatenation operands have to be literals at compile time.
>>
New thread:
>>61353854
>>61353854
>>61353854
>>
>>61353198
Why is she going to take a shit if she sees another keyboard?
>>
>>61353804
>Public inheritance for the sole purpose of reusing code is shit.
ftfy
>>
>>61353823
#define COMPUTE_BUILD_YEAR \
( \
(__DATE__[ 7] - '0') * 1000 + \
(__DATE__[ 8] - '0') * 100 + \
(__DATE__[ 9] - '0') * 10 + \
(__DATE__[10] - '0') \
)
>>
>>61353882
private and protected inheritance are just as shit, for a completely different reason: they imply you're using sepples
>>
>>61353859
Dumbass, someone make the actual /dpt/
>>
File: gdi.png (2KB, 141x91px) Image search: [Google]
gdi.png
2KB, 141x91px
>>61353732
and you shouldn't
macros are bad, made by really bad people for
bad people
>>
new thread

>>61353960
>>61353960
>>61353960
>>
>>61353933
>c++ is su cumplicTed mayne fuck dis shite language omg noob
>>
>>61353977
t. retard
>>
>>61353932
Thanks Anon. Would you mind breaking that down for me though? I want to understand why it works.
>>
>>61353977
They're more elegant than the options. But that's not because they're good
>>
>>61354014
It's litterally just asii maths. By subtracting the int value of '0' from a digit letter ('0'-'9') you end up with its int value.
>>
>>61354014
OK

__DATE__ is just a string that looks like "Jan 05 2017" or something.
__DATE__[7] is the 2
__DATE__[8] is the 0
__DATE__[9] is the 1
__DATE__[10] is the 7

the character literal '0' subtracted from another character literal digit (1-9) gives you its value ( '9' - '0' = 9)

then they are multiplied so the 2 represents thousands
0 hundreds
1 tens
7 ones

etc
>>
File: JUST.png (4KB, 489x210px) Image search: [Google]
JUST.png
4KB, 489x210px
>>61354053
For some reason ascii math doesn't register in my head right away when the 'char' syntax is used instead of raw ints or escaped sequences. Thanks for pointing it out, I feel dumb now, pic related is still my excuse.
>>
>>61354014
He's not really doing the calculation using macros. He's defining a macro that expands to a C expression that does the calculation. You'd achieve the same effect with this:
int const COMPUTE_BUILD_YEAR =
(__DATE__[7] - '0')*1000 +
(__DATE__[8] - '0')*100 +
(__DATE__[9] - '0')*10 +
(__DATE__[10] - '0');

This means the computation will be done at runtime, not at build-time, but it should be alright because __DATE__ is a build-time constant.
>>
File: 1463693687659.gif (4MB, 512x384px) Image search: [Google]
1463693687659.gif
4MB, 512x384px
>>61354089
Since we're past bump limit I can waste a post thanking you again/too.
>>
>>61354117
>will be done at runtime
Oh shit, I should have realized that with the arithmetic operators. I wonder if this will work. If not I might rely on the build system to just insert the date at build time instead of trying to do it inside the standard.
>>
>>61354122
I wonder how much water actually makes it into the dog's mouth. Obviously enough, but it looks like most of it flies everywhere
>>
>>61354212
They're not made for environments with sparse water supply.
>>
>>61354122
>>61354212
>>61354319
I wonder if there's any video evidence of an animal drinking without using their tongue, like a human does. This is the closest I found but it's still mimicking the old way
https://www.youtube.com/watch?v=o5X60NK1CPs
>>
I Programming
>>
>>61354428
I'm not sure dogs and cats can suck.
Elephants do but only using their trunks. Which is very similar to us actually.

I'm sure some monkeys suck just like we do though.
>>
>>61354524
S U C C
>>
File: 1478631714596.jpg (94KB, 637x459px) Image search: [Google]
1478631714596.jpg
94KB, 637x459px
>>61354729
>>
This thread has concluded peacefully.
>>
memes
>>
tfw multiple hours compilation times

>>61346107
why is madoka fanart the best drawn?
Thread posts: 339
Thread images: 45


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