/dpt/ - Daily Programming Thread

Welcome to the daily programming thread! What are you working on, Sup Forums?

Previous thread: Recommended /dpt/ videos:

youtube.com/watch?v=uqsZa36Io2M

youtube.com/watch?v=hIZxTQP1ifo

youtube.com/watch?v=3U3lV5VPmOU

Other urls found in this thread:

github.com/nodejs/node/issues/12115
jsfiddle.net/zeh9uv2u/
youtube.com/watch?v=QM1iUe6IofM
reddit.com/r/Steam/comments/6w4bqo/realloc_invalid_next_size_0x569eb120/
github.com/LoopPerfect/valuable
github.com/martinmoene/value-ptr-lite
en.wikipedia.org/wiki/Mars_Climate_Orbiter
twitter.com/NSFWRedditImage

Am I doing it right

github.com/nodejs/node/issues/12115

>Node occasionally gives multiple files/folders the same inode

>Node sometimes reports different files/folders to have identical ino values.
>I can't reproduce this consistently and copying/reproducing a folder structure that contains dupes elsewhere doesn't replicate the issue.

W E B S C A L E

>List

You need to be able to remove from it

people who hate on java is simply a neet whos too dumb for java and cant get a job.

How am I too dumb for Java if I just fashioned a program in it

Thoughts?

501 FORMAT(3I5)
601 FORMAT(4H A= ,I5,5H B= ,I5,5H C= ,I5,8H AREA= ,F10.2,
$13H SQUARE UNITS)
602 FORMAT(10HNORMAL END)
603 FORMAT(23HINPUT ERROR, ZERO VALUE)
INTEGER A,B,C
10 READ(5,501) A,B,C
IF(A.EQ.0 .AND. B.EQ.0 .AND. C.EQ.0) GO TO 50
IF(A.EQ.0 .OR. B.EQ.0 .OR. C.EQ.0) GO TO 90
S = (A + B + C) / 2.0
AREA = SQRT( S * (S - A) * (S - B) * (S - C) )
WRITE(6,601) A,B,C,AREA
GO TO 10
50 WRITE(6,602)
STOP
90 WRITE(6,603)
STOP
END

obsolete.

Look I can even generalize it to arbitrary dimensions

Fortran is still a far more important language today than what shitters in the open source community believe.

Jokes on you I have a job as a full stack dev, working with mostly PHP and Ruby web applications, but we would take on Java maintenance clients but fuck making a new project in Java its gross.

jsfiddle.net/zeh9uv2u/

I'm trying to figure out why the computer player sometimes doesn't work. It's essentially supposed to generate a random number, modulate it to the range of the number of buttons, then click that button number. It doesn't always do it though, but it isn't throwing an error either...

Currently dicking around with a linear type I made in D, only issue is that there's no way to get it to automatically deallocate once it's been used.

>tfw offered a nice paying job by a close friend in engineering for C++ programming
>don't even know C++, just said i might start learning it

Is C++ worth learning career-wise? I hear a lot of people (even some well known people, like Torvalds) shit on it all the time, and recommend to use C instead. Why is this?

They have different priorities than normal people might. C++ is an excellent language to learn.

That was when C++ was shit. Torvalds uses C++ for his non-Linux projects, nowadays.

Because they suck at writing it, and it illustrates their lack of talent more than any other language ever could.

>linear type
what is that?

This to be honest

There are only two kinds of languages: the ones people complain about and the ones nobody uses.

Why would you need to like a language to be able to get a job programming in that language? Isn't that the point of being the boss? To screw people by making them do something they hate?

Type that can only be used once. One implication is that it can be deallocated as soon as it's used.

Are you sure it's linear and not affine?
Affine means it doesn't have to be used, linear means it must be used at least once

Actually it's affine as of now, but it should be easy enough to add a check in the destructor that'll throw an error if it hasn't been used.

Why would you ever want to program in Ruby in 2017?

I can see why girl (female)s would

Because it's a pretty sane dynamic language, reasonably performant, with some cool meta-programming stuff (relative to the dominant paradigm) thrown in?

Ruby is quite a nice little language, if a little over bearing if you aren't a big OOP fan.

Guys. Is programming becoming outdated? Everything is slowly becoming web apps. Hell, desktop applications are slowly becoming web apps too. Atom just to name one.

SO I just found out today that C99 allows you to declare variable-length arrays on the stack wtf

Should I use this feature for simple things like reading the names of files, or is it inherently harmful since you only have a limited amount of stack space?

Is there a problem?

>I hear a lot of people (even some well known people, like Torvalds) shit on it all the time, and recommend to use C instead
Torvalds shits on it because that's what torvalds does.

Most people shit on it because it's grown to include a ton of features which don't always interoperate in the neatest way.

Java people shit on it because it has cool features they secretly wish they had but to cover the shame they make up long impassioned arguments about how cool features are "dangerous".

Electron is a pile of shit, a fucking blight upon desktop development. Just because it exists and people use it doesn't mean it's good.

Is this guy correct?

youtube.com/watch?v=QM1iUe6IofM

>OOP Is Bad
He's of to a good start with that title

Anyone here know any z80 machine code?

So since I'm so good at Java why can't I seem to find a job? I wonder why...

>sane

It's just another way to oppress and control the masses. saas is the antithesis of free software and it's whole purpose is to rob users of while minute freedoms they had left.

>not making an argument

This.

>defends procedural/functional programming
>explicitly goes into detail as to why state is bad while saying no one defends inheritance
of course not, why would you think so?

>realloc(): invalid next size: 0x569eb120 (self.Steam)
reddit.com/r/Steam/comments/6w4bqo/realloc_invalid_next_size_0x569eb120/
I don't get the weird obsession of manual memory management among the devs when it's not required. It's not the fucking game, it's a client that launches game. In for what reason would you ever think manual memory management is necessary here?

High level language should handle steam client just fine. Use C# or D or even Rust and stop breaking shit every now and then

Fuck off back to wdg, tranny.

RAII was a mistake

Its reflection and metaprogramming facilities are unmatched as far as I'm aware.
A short sampling of all the disgusting things you can do in ruby:
>method_missing -- you can override it to provide a custom undefined method handler that accepts the undefined method identifier as a symbol and the arguments passed to the undefined method as an array; you can then abuse this hook to implement custom nonstandard name resolution, e.g. to allow dictionary values to be accessed as though they were object variables, or to allow method-like syntax for calling lambdas stored in a data structure
>proc -- a lambda, except it's substituted in instead of called, so you can do things like put a break in the lambda to break out of a loop in the caller for example
>instance_exec -- executes the body of a lambda or proc as though it were a method body of the receiver -- e.g. o.instance_exec(lambda {|x| @a = x; return self }, 1) would set o's a to 1 even though it's a private instance variable, and then return o
>passing raw blocks of code as arguments with &, e.g. def do_block(&block); block.call; end; do_block { puts "this text will be printed" }
>include -- allows multiple inheritance via modules, which are like abstract classes
>extend -- allows already existing objects to newly multiply inherit from modules without affecting other objects in their class, a la traits

forgot a big one:
>the fact that classes and modules are objects and you can define new anonymous classes and modules by passing the class or module body as a code block parameter to the Class or Module class 's constructor
also my mistake, it should be o.instance_exec(1, &lambda {|x| @a = x; return self}) not o.instance_exec(lambda {|x| @a = x; return self}, 1)

well, I don't get why someone would not use manual memory management. you allocate something, and free it when finished. how are you going to keep track of the resources you use?

did you read that thread? OP said it was a bug in libdrm.
do you think graphics drivers should be written in C#? surely they don't do much with memory.

Why doesn't unique_ptr have a copy constructor and copy assignment operator? It would have been so easy to have such operations copy the pointed-to object instead of throwing exceptions, and just that simple adjustment would make writing classes that use it so much easier when you do happen to need copy construction and copy assignment. Such as linked data structures like graphs

Oops, bad example, graph nodes don't own their neighbours
Say a rooted tree then

libdrm is fine, steamfaggots is not keeping up to the pace

>instead of throwing exceptions
Also I forgot it throws compiler errors not exceptions
It's late at night and I'm sick, I'm not on my A-game

That would create confusion between whether duplicating the unique_ptr or the object it points to, and the type backed might not be copy-constructable.

ask on /vr/

how come front-end people do this graph shit

my job is having me look through applications for 3 front-end positions we have, and people keep doing this and i have no idea what it means. sorry guy but ive been doing full stack for 4 years and i have no idea what you mean by "90% html5" and "20% php". into the trash it goes

it means he can't actually quantify his experience. an easy flag to dump their cv into the trash.
I'm 70% sure of this.

It takes up a lot of whitespace, it's colorful and it makes you look quirky/fun. "Hehe i'm just made up of tech stuff". It looks nice, but really doesn't tell you much. Every front-end designer I've encountered is a numale reatrd. It's also VERY safe to say he knows nothing about jQuery or PHP.

that was meant for why would unique_ptr have a copy ctor? its design goal is >The class satisfies the requirements of MoveConstructible and MoveAssignable, but not the requirements of either CopyConstructible or CopyAssignable.

making a copy implies there are now multiple ownership of the same data, which is very much not unique. as for copying what it contains, how easy is it to deep copy /any/ T?

>High level language should handle steam client just fine.
Man I use love little programs that come with a gigabyte of stuff with them, like the .NET framework!

Though, Steam still manages to be shitty bloatware and slow as fuck.

well his website has a bit of jQuery on it but its nothing more than someone who just finished a tutorial or looked at wc3 lol

desu the real problem im seeing across the board is these guys make their websites as obnoxious as possible, probably to show that they know how to do certain things. but its never more than just random bootstrap stuff so it just makes them look worse than making a simplified html/css only portfolio

i'd be much happier about them just making a one page with picture + link to projects/experience etc

>as for copying what it contains, how easy is it to deep copy /any/ T?
It could be impossible, seeing as how not every type one could create and use with unique_ptr would be copy-constructible.

The issue is that employers like this shit. They see all these animations and graphs and think it's really cool stuff that "pops". After highschool, I had a VERY brief intern position at a webshop in my city. Most kids there just knew how to plug things into existing frameworks. Chart.js was a big one that one guy loved to talk about, but you can literally just plug values into existing lines of code. I have mixed feelings on asking someone to demonstrate some programming knowledge upfront, but a lot of people are somehow skating by and then end up fucking you over after they've been hired.

The definition of "unique" is that there's only one of something. If it had a copy constructor, it would fail that basic definition

>I have mixed feelings on asking someone to demonstrate some programming knowledge upfront,
Why?
If they can't program under pressure what good are they at crunch time?

For me, I care about what you have done in the past, jobs and side-projects and what those side-projects were. Being prepared for crunch is valid, but I think it's completely ok to be nervous during an interview. When you're asked by your future employer to do something outside of the box quickly I think there's too many factors that could cause that to end up badly. Crunch doesn't always mean "fix this thing in five minutes or we're all dead". You'll have a team with you to solve problems. Quick thinking is great, but don't beat the shit out of the poor guy. And of course, I think some type of problem or challenge should be giving. But I'd be just as likely to hire the guy who really tried his hardest and put the effort in to do his best as I would the guy who solved the problem immediately. Everyone works differently.

I was talking about copying the pointed-to object. Perhaps more apt name for a class that does this would be own_ptr, as in a pointer to an owned resource, that can be duplicated, but shouldn't be shared. As opposed to a unique resource, which is the same thing but can't be duplicated.
This hypothetical own_ptr would be trivial to implement if we allow ourselves to assume T has a copy constructor. (If it didn't, we'd be using unique_ptr, I guess.) But it just seems like a thing that should be possible without having to do it yourself. To own a resource exclusively, and also be able to create copies of the owner that exclusively own copies of the resource.

Well that's the problem with most programming interviews. If they're obviously nervous and fucking up small things, but can grasp and comprehend the problem quickly, then its fine. But most people just blanket fail anyone who doesnt 100% it.

But then again, its not like places even bother actually having their own programmers do the interviews. So theres more important problems, yet.

PROGRAMMING CHALLENGE

Make a £sd calculator. It must be able to add, subtract in £sd. Lowest coin is farting.

So far, we have a solution in APL!
What other languages will present Sup Forums later?

>non USD currencies
not even once

>Lowest coin is farting.
amazing

Is this so we could make it look like we were copying a unique_ptr?

It's not harmful. Stack space is quite massive. You can go ahead and measure it.
For storing temporary file names it's very appropriate.

Who here /Idris/?

Really missing a good package manager, but shit's fun as hell.

I think this is more a case of software bloat than a memory management issue.
But yeah a launcher for a game is a perfect example of trivial software.

>Is programming becoming outdated?

No. Just too many JavaScript-writing morons thinking they're programmers pumping out shit en masse. They guarantee our job security just like the PHP retards before them.

¼ of a penny.

It's farthing.

What happened to php people? Do they just drop like banana flies and start working at McDonald's? Or are they forced into new 'technology' like JS?

People who are "good at crunch time" are unfortunately the same people who throw modulus operations that check against zero in heavily used loops when they can almost always just use a check against another variable, and a conditional addition of that variable. A variable that will literally just sit in a register the entire run of a loop, with occasional addition, vs a modulus, every single time. Then they leave it there, forever. And they do similar things everywhere else, because in actuality, that's how they work all the time and their window for quality is more narrow than it would appear.

There's more to be being good at crunch time than not suffering paralysis about basic architectural decisions.

The latter. Some have other jobs to escape to, McJobs or not.

Hello lad.

I'd rather it have something as nice as rdmd for easy compiling of multiple modules. A nice package manager can wait since theyre pretty sparse anyway. But i kind of like the wheel reinventing with it.

>conditional addition
You really love all those pipeline flushes, aren't you.

I'm pretty okay with it when it'll execute 1/300 runs of the loop, and generally won't be mispredicted. It's little different than the modulus check for zero.

no it's so we could avoid writing trivial custom versions of default member functions for recursive data structures

you can invent new numbers in it therefore it's a bad language
data X: Nat
X is now an entirely new natural number not equivalent to any preexisting natural number

Youre literally that same autist from last time when i was idris posting.

: ^ )

the irony of this statement :^)

>Why doesn't unique_ptr have a copy constructor and copy assignment operator?
because unique_ptr is a formalization of unique ownership semantics. allowing moves but not copies enforces those semantics at compile time

>It would have been so easy to have such operations copy the pointed-to object
that's not what unique_ptrs are for. if you want copies (value semantics), either simply use a value, implement a copy constructor with deep copy functionality for pointed-to objects when that makes sense for the type in question, or even implement your own "value_ptr" or some such type (and in fact, others have done just that; see below). unique_ptr is designed specifically for unique ownership, and exposing/enforcing semantics/guarantees surrounding unique ownership. there's no doubt it has its place, it just sounds like it might not be what you're looking for right now

github.com/LoopPerfect/valuable
github.com/martinmoene/value-ptr-lite

You shouldn't need a VLA for a filename length, since those have a predictable maximum length.

>Everything is slowly becoming web apps
Pretty much. All the more reason for me to go into research.

To. 62109567
It's the same complaint you/he had last time.
Hasklets can't handle the power.

Doesn't seem like it does much over the standard compiler which already has a notion of system packages and doesn't recompile unnecessarily. Am I missing something?

Kilometers and miles are both represented in numbers. Guess it's perfectly fine to operate with a mix of them then.

Inb4 "don't do that":

en.wikipedia.org/wiki/Mars_Climate_Orbiter

That guy wasn't me but I can handle the power just fine, I simply refuse to because it's bad
Evidence of its badness: the fact that you can invent new numbers
Also Haskell sucks, it doesn't even have first class types

>Kilometers and miles are both represented in numbers. Guess it's perfectly fine to operate with a mix of them then.
That's unrelated. You're talking about inventing new numeric types, which is a great feature -- not new numbers, which is completely asinine.

Sounds like Go is right up your alley if you believe this is something confusing that's prone to create bugs.

>predictable
most of the time, but UNCs can have a variable length that isn't determinable at compile time.

>Am I missing something?
It automates linking and executing.