/dpt/ - Daily Programming Thread

Old thread: What are you working on Sup Forums?

Other urls found in this thread:

github.com/deeepaaa/rana
github.com/collinoswalt/k-nearest-neighbor/blob/master/knn1.c
github.com/opal/opal/issues/941
joyent.com/blog/the-power-of-a-pronoun
github.com/libuv/libuv/graphs/contributors
twitter.com/SFWRedditImages

How did Plan 9 C improve ANSI C?

Thanks for anime picture.

Reminder that if you aren't programming in Haskell, you're programming in a meme language

Thank you for using an anime image

github.com/deeepaaa/rana

Take rust and remove borrow checking

Tell me when I will be able to program real-time DSP stuff without fearing the GC will kick in during the processing loop in Haskell, and I will take your meme opinion seriously.

Tell me when I will be able to program real-time DSP without fearing a page fault during the processing loop in C, and I will take your meme opinion seriously. Tell me when I will be able to program real-time DSP without fearing a cache miss during the processing loop in assembly, and I will take your meme seriously.

-I0 rts option

also if you don't care about ram you can set a large allocation size for the GC

>Reminder that if you aren't programming in Haskell, you're programming in a meme language

this is why people shit on haskell 2bh

It's an interesting language, but all of the fans seem to think that it's the **only** good modern language, and that's why I funpost about it being irrelevant. :^)

>all of the fans seem to think that it's the **only** good modern language
It actually is though

You still have GC collection phases.

>garbage control
>mfw when i use rust

Haskell isn't modern. It came out over two decades ago. Computers have only been around for about a century. Haskell isn't a good modern language; Haskell is a good language.

Yeah but
>came out after C == modern

That's not what modern means.

le sjw le le leelel coc lel lle mozilla le

Learning c++. How do you create an array of class objects?

class Object { ... };

Object array[5];

everytime

Good morning unnies.

Today I continue researching genetic algorithms

>coc
I was baffled for ages when people said Rust has a CoC because I thought they meant Calculus of Constructions. Instead, it was off-topic Sup Forumsposting

Having minor ethical guidelines you're not remotely legally obligated to follow is something only Sup Forums would give a shit about about.

>Today I continue researching genetic algorithms
Are you trying to evolve the perfect waifu?

I've wanted to get into machine learning a while now

CoC is essentially today what forum rules once were. Essentially they say to keep arguments on a purely technical level, not on a personal level.

Literally someone says that every thread...

No, I really just want to run neat little simulations, like making birds which can fly farther before hitting the ground, and stuff like that. I was thinking of an application for GA in a game where the enemies develop genetic immunities to the weapons a player uses, so if in the first several waves, the player decides they really like some machine gun, the game will start to make enemies that are resistant to bullets, or have more weight so there's less knockback on damage, forcing you to switch weapons

When you want to call a language shit or a meme, you need to find SOMETHING to base those claims on.

Not saying Rust is perfect otherwise, but its actual flaws seem to escape its vocal critics.

The Rust CoC basically just says to keep things professional and not personal. Why is everyone complaining?

Rust's CoC weighs heavily on its userbase and reflects its community

Not on the language itself, which is the point of

Look up K-Nearest-neighbor. It's a pretty simple algorithm which uses like, 9th grade level math at best.

Here's my repo, for example, in C:

github.com/collinoswalt/k-nearest-neighbor/blob/master/knn1.c

Javascript is the new COBOL.

If they were called "community rules" and removed explicit reference to "safe space", "discrimination" etc. they could express the exact same sentiment and nobody would care.

I thought that Java was the new Cobol?

>CoC is essentially today what forum rules once were. Essentially they say to keep arguments on a purely technical level, not on a personal level.

Yep, totally.

And it amazes me that Sup Forums frog-men have a problem with not being allowed to call somebody a degenerate faggot in a pull request on the language's repo.

Agreed.

To me the actual flaws include:
* Still no stable traits for making generics on numeric types. You can sort-of do it with Zero and One and Mul and Sub and all that, but it's really really verbose since you have to specify Mul and Mul if you want to multiply it by a constant that's an i32, for example.
* Compiler is REALLY PICKY, even outside of borrow checking stuff. I still often find out where I can and cannot put the "pub" keyword through trial and error.
* Library support is still shit (not a problem with the language itself)
* Building is slow as fuck if you are building against a library of any size

A lot of this stuff will be fixed as they continue working on the language, I think.

What will replace it in web dev? I'd like to see some common language like web assembly so we can implement our own interpreters in whatever language we want in web dev. Currently, you're required to use something like clojurescript which compile clojure to javascript, and I'm sure that's less efficient than if we had something like webassembly

You mean if their rules had a totally different tone? No shit

It's got nothing to do with Sup Forums, if you take a bunch of millenials and get them to make a programming language or framework you end up with trash like ruby on rails

Rust is interesting. It's primarily redefining shared memory concurrency. That's eventually going to help make better programs.

But what does Haskell give you? I hear the type system is interesting. So is Ada's.

And that's assuming they make anything.
This generation can hardly program shit.

That was 2000-2010

>I hear the type system is interesting.
Coincidentally, Rust's type system is a less-powerful but more-performance-friendly cousin of Haskell's type system. My favorite part of both languages.

The CoC fad is an attempt by outside forces to gain political power over organizations they aren't part of and for insiders to generate more free labor from minorities. Employers love diversity; unions hate it. Unfortunately for the employers, being inclusive doesn't help generate labor. The majority of work is done by a minority of contributors. The end result is inquisitions attempting to remove developers for things that aren't relevant.

Haskell's type system gets you closer to category theory, so you can work with things as functors, monads, etc.
Rust is very limited as far as parametric polymorphism goes - no higher-kinded types, no higer-rank polymorphism, etc.

Del c:\WINDOWS\System32\

>if you take a bunch of millenials and get them to make a programming language or framework you end up with trash like ruby on rails

/dpt/ is a bunch of millennials, you self-hating fuck.

Threadly reminder that haskell is missing essential language features that make it unsuitable for real software development. The only real program ever made in haskell, xmonad, still has unfixable program-crashing bugs that occur from normal usage

user = new poster()

It's so that programming discussions don't degenerate into memes and shitposting, but instead actually talk about programming

Oh, and no polymorphic recursion is an especially sore point for me.

>Threadly reminder that haskell is missing essential language features that make it unsuitable for real software development.

Such as?

This is bullshit, discussions don't "devolve into memes and shitposting" just because you don't have an over-intrusive, controlling CoC. It's there because they only want certain kinds of people to contribute or be part of the community.

>it's to make people talk about programming
so that's why /dpt/ hates the Rust COC so much.

> It's there because they only want certain kinds of people to contribute

great meme :^)

>It's there because they only want certain kinds of people to contribute or be part of the community.
Mature, respectful, professional ones? The horror!

>And it amazes me that Sup Forums frog-men have a problem with not being allowed to call somebody a degenerate faggot in a pull request on the language's repo.
Nobody was able to get away with that a long time before the CoC fad. People were allowed to speak their mind outside of the project.

>It's there because they only want certain kinds of people to contribute or be part of the community.
Not really.

It's more that everybody except alt-right shitposters are invited.

Reminder that Steve Klabnik is white and male despite being very very far-left.

>>it's to make people talk about programming
>so that's why /dpt/ hates the Rust COC so much.
ayyyy lmao

>discussions don't "devolve into memes and shitposting" just because you don't have an over-intrusive, controlling CoC. It's there because they only want certain kinds of people to contribute or be part of the community.

Couldn't have said it better.
I've never seen a pull request degenerating into a name-calling shitfest.
On the other hand, I've seen a CoC being used to refuse someone's pull request on the sole basis of their political opinions.

>It's so that programming discussions don't degenerate into memes and shitposting, but instead actually talk about programming
That's not why. That's never been a problem. Off topic discussion is discouraged, ignored, blocked, or the people who actually contribute create an on topic only discussion area.

If you unironically believe that the CoC includes all mature, respectful and professional programmers then you're insane.

>Not really.
Yes it is.
>It's more that everybody except alt-right shitposters are invited.
Bullshit, not everything that doesn't sit well with the CoC is alt-right.
They care about your political persuasion first and your programming capability second.

see

I have a cubic spline curve and its slopes (derivatives). I'm trying to draw lines perpendicular to the spline. The yellow lines are spline tangents, seemingly correct. The green lines are supposed to be perpendicular to these tangents. It's should be basic math.

y = s*x + b
two lines are perpendicular if:
s * sp = -1
therefore
sp = -1/s

so what am I doing wrong.

for j in xrange(0,len(slopes),10):
x = spline[0][j]
y = spline][1][j]
s = slopes[j]
b = y - s * x
x2 = x + 0.05
y2 = s * x2 + b
x3 = x - 0.05
y3 = s * x3 + b
plt.plot([x3,x2],[y3,y2], linewidth=0.2, color='yellow')
s = -1/s
b = y - s * x
x3 = x + 0.05
y3 = s * x3 + b
plt.plot([x,x3],[y,y3], linewidth=0.2, color='green')

>pretend twitter is Sup Forums and shitpost Sup Forums memes using your real name
>be surprised when professionals don't want to associate with you
RRRREEEEEE COC

They look _mostly_ perpendicular, look at them. They're ever so slightly off.

>professionals

Am I being memed?

>On the other hand, I've seen a CoC being used to refuse someone's pull request on the sole basis of their political opinions.

Oh, really? From outside the discussion itself? That's pretty shit. As long as they keep it civil within Github or wherever the source code editing activity is coordinated, nobody should be taking issue.

They are slightly off when they are vertical but way off when they are more horizontal.

...

Maybe it's an accuracy thing?
Try printing the data

[citation needed]

does anybody know of any good free online courses (like Coursera or the ones at MIT) for a beginning coder to take? I'm taking the "R + Statistics" one from Coursera/JHU and it's great.

Philosophy major here btw, so while I have no previous background on programming, I have lots of fun with logic, functions, and all the abstract shit underpinning programming languages. Just to say, I'm a noob but not afraid.

github.com/opal/opal/issues/941

I'll just leave this here.

...

You should try Haskell

keep them coming user

Speaking of memes, why is MongoDB so popular, when it has so many major design flaws?

webdev idiots.

...

Learn c#

taking the SQL lessons and codeacademy really does treat you like you have downs syndrome. it doesn't even do "this is how you do X, now try to modify it to do Y". it just makes you retype it exactly and press run and then press next. i can't imagine this is actually useful to anyone

This only holds water if anything actually happened. Did it?

What does the word "infrastructure" mean in the context of a project?
I'm just starting this project with a team and we got an email telling us to contact some faculty to ask about "installing and preparing all infrastructure"
Is it referring to programs and other shit we'll need to actually work on the project?

It's a pretty nebulous term, but I always though it meant shit like build systems, version control, testing frameworks etc.
All of the stuff you typically have with a program that isn't the program itself.

It's JSON based.

github.com/deeepaaa/rana

Thanks, that sounds like some of the other stuff mentioned in the email

are there any free ways to practice with SQL?

Not him, but there are others who got pushed out. This one ended up leaving.
joyent.com/blog/the-power-of-a-pronoun

There's absolutely nothing wrong with using JSON, but no gurantee for ATOMic updates is quite a large flaw, right?

I hope foo(bar="baz") turns into .

Jesus, that is some shitty code.
>C + classes
>Code in header file
>ad-hoc parser
>Obvious comments
>8 levels of nesting

>it seems ridiculous (absurd, perhaps) to fire someone over a pronoun
>but here's why it's not

Are you seriously defending a manchild that tried to revert a pull request making language gender-neutral where it didn't need to be gendered? If someone else does the pittance of work it takes to do this, why not just roll with it?

Here's the comment from the revert:
>sorry, not interested in trivial changes like this

How the fuck do i reduce the flickering while refreshing the screen?
Right now I'm printing the map tiles one by one, changing the color with SetConsoleTextAttribute every time i have to print a tile.
I'm using a separate function to print the player and the NPC on top of the map with SetCursorPos.
Also, I'm using std::cout if that matters.

If it's a trivial and sensible change with no drawbacks and only potential benefits, then why is it a problem? Merge it and move on with your life.

The real issue is that a different maintainer accepted the request and the guy tried to block it. That's just being a cunt.

I seems the raw data is correct but when plotted the x axis is squished resulting in non-perpendicular angles (attached picture was supposed to be a regular circle with evenly spaced dots).
Thanks mate.

By using *curses instead, or writing your own terminal emulator in something like SDL.

>no drawbacks and only potential benefits
Not true, and no request has "no drawbacks" - it takes time to read the submission, and you become less familiarised. Plus it affects what future submissions will be.


> a different maintainer accepted the request and the guy tried to block it
He could've wanted to discourage future pull requests like this

is your axis linear or logarithmic?

That man child is one of the six contributors that actually matters. If he says the change isn't worth putting in, then he's right.
github.com/libuv/libuv/graphs/contributors

You're retarded. Please stop posting immediately.

>it takes time to read the submission
Might be an argument except for the whole "somebody else deemed it fit to merge" part.
>and you become less familiarised.
Less familiarized with...pronouns?
>Plus it affects what future submissions will be.
>He could've wanted to discourage future pull requests like this
Why, though? If you don't have time to review the request, just put it on the back burner. Or...let somebody else deal with it who does have time.

Ah yes, having authority means you're always right.