/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?
Old thread:

Other urls found in this thread:

github.com/rust-lang/rfcs/blob/master/text/1216-bang-type.md
blog.cleancoder.com/uncle-bob/2017/01/11/TheDarkPath.html
unix.stackexchange.com/questions/20035/how-to-add-newlines-into-variables-in-bash-script
twitter.com/AnonBabble

>void

() > void

Nothing > () > Nil > void

U0 > all

! > U0
github.com/rust-lang/rfcs/blob/master/text/1216-bang-type.md

Anyone might know why this throw a ParseException

SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy") ;
Date date = sdf.parse(deletedDateString);


When deletedDateString's value is "Wed Jan 24 00:00:00 CET 2018"

You are either mind-numbingly dumb or just baiting.

Unit uber alles fags

Hans, speak english.

I hate PowerShell.
Scripting in it is fine (if the authors were autistic and implemented every bit of parameter passing trickery) but writing it is shit.

>Unit uber alles wankers
besser?

is this French?

Polish

handy rule of thumb to recognize if something's frenchy or superior germanic language master race:
- spelling looks sane: germanic
- spelling's absolutely fucktarded: french, or its illegitimate child, english

which island is that

No it's Russian

>german
>sane spelling

please explain why you think it shouldn't throw an exception

Hwæt did þú say about Ænglisc?

>said literal ghoti-writer

such is the life of miserable programmer wageslave.

you are a brainwashed prideful child who thinks he got it all figured out, nut in reality you are sad and wretched hiding behind a persona.

i pity you.

Yes, it is.

i tell you hwat

srs post tho: hwat > what i m h o, that reform sucks balls

>my side is pretty
>ur side is a ugly dumb hysterical strawman
solid argument there m8

Can properties of an Object - such as methods and variables - be treated as primitive object in themselves? For example, say a project "xyz" of an object is read-only, but not writable; so, can we think of properties as simple object in themselves responding to certain messages?

you can use lenses as values in Haskell

You're a living argument against all forms of welfare.

>t.wagecuck

>8 hours is to much
8 hours in office is a bliss compared to what humans have to endure to make it even 100 years ago unless you were already rich.
If not for there "wage slaves" you'd never be able to live as NEET

too*
had*

Oh thanks for the 8 hours of braindead soulsucking job!

Being a neet in 2017+1 Its a moral choice

Unless you are rich it's also a choice of being a poorfag.

This, unless you're a 20yo living with your parents, there're too many problems that could be solved only by throwing (a lot of) money at them, like health issues, housing, random shit happening, etc.

just deployed my first elixir phoenix project

now what do I do with my life?

How do you like phoenix?

>arguing against a strawman
must be nice being a brainlet

>problems that could be solved only by throwing (a lot of) money at them, like health issues
and sometimes even money doesn't help for those

>braindead soulsucking
Why don't you get a job that stimulates your mind? Scientist, Engineers and Biologists get pretty good cash while requiring problem solving mind

>Why don't you get a job that stimulates your mind?
Because he's a loser, and he knows that a McJob is the only thing he's cut out for. The eugenicists were right.

considering it's the only MVC web framework I've used, pretty good, there's a lot to it, the channels thing is pretty awesome if you ever need websockets

Working on a text based game, implemented some quick & dirty scrolling text. I love it for some reason.

nice, can it do fidget spinners? | / - \ | / - \ |

I used to be an engineer but I made the mistake of being involved in everything and now I am basically support for a retarded Ops team

no, but it is a 100% sciene based dragon mmorpg for windows xp

template
struct Foo { /* ... */ };
Is it possible to specialize the implementation of Foo for cases where T is a function type?

I give up. I'm too much if a brainlet to even comprehend what is going on here.

yeah, reading upside down is pretty hard

yes

How?

What is "a function type"? You can specialize for a pointer to a function, something like
template
struct Foo {};

template
struct Foo;

template
struct Foo { ... }

interfaces are trash, you shouldn't use them, or Java.
But you should still understand them, what are you confused about?

which part do you find difficult?
1. it's an interface for a dict
- the dict can insert, delete, search, say if its empty
2. the key/value are K, E. Key is extracted from value in some way that's specified in the KeyProvider interface

>Spelling looks sane
>Schifffahrt
>Schlossschraube
>fff
>sss
Whereas it may be easy to figure out how to pronounce something from it's spelling (in contrast to English with "through", "bough", "cough", "enough"), I occasionally have difficulty picking the words apart in compound words (nonsense example: "Kellnerinformationen" -> "Kellner-Informationen" or "Kellnerin-Formationen").

Remove the (*) and you have a function type.

Thanks, this is fine.

>Schiff + Fahrt = Schifffahrt
That's pretty sensible user.

>compound words
yeah, that's one of german's retardations
the other one is their refusal to fix their shit up, cuz their orthography still has a few warts
not to mention the grammar clusterfuck (4 cases, etc)
english niggas got it right there
- no cases
- no noun genders
- get bent
pros and cons to every lang, i'm afraid

< K extends Comparable
So class K has to implement Comparable interface. Sure. But how why Comparable and KeyProvider, how are interfaces also generic?

using hyphens would've been even more sensible than the unreadable mess that compound words become, especially given the sch/ff/-h/etc consonant mess that is german spelling

K has to be comparable to another K, rather than any object.
K must implement a method int compareTo(K other); rather than int compareTo(Whatever other);

I think you forgot to close a code tag there
>why Comparable
most likely due to the interface needing the concrete type for method signatures, e.g.
bool lt(K a, K b);
likewise, KeyProvider prolly has some shit like `K getKey()`
without that K parameter, the interface would have no way to specify those signatures

I don't get how I'm not failing my data structures course
I have to implement a tree where visiting one node gives access to a sibling in the same tree, however there is a limit to how many nodes can be visited at a time, and each node should be visited by a max-profit first approach (assuming each node has a profit to be had)
I've tried backtracking but I'm too much of a brainlet to make it work

>I think you forgot to close a code tag there
Yes, sorry.

Alright, thanks, I'm starting to see the picture here.
The book says exact same thing, I see that after I re-read the pages after your posts, but it takes 4 pages to do so.

It's only sensible when you recognise the words within them; otherwise, you start reading triple-f's and triple-s's.

I do have to admit that the four cases are intriguing, especially as I've rationalised the genitive case as simply translating into "of".
It does give a better understanding of English, which only has subjective and objective cases (as well as giving a possible explanation to the origin and use of "whom" as opposed to "who").
The parts where they start to boil my brains is when their applications are extended beyond how words relate to a verb (e.g: prepositions).

>using hyphens would've been even more sensible
Although I agree, I can see an issue arising when you get compound words within compound words...

How the fuck is this allowed??

Triple Fs and triple Ss are clear delimiters, because they don't occur in other circumstances.

>book says exact same thing, I see that after I re-read the pages after your posts, but it takes 4 pages to do so.
niggas paid by the page

>ssue arising when you get compound words within compound words...
only if you use the hyphens as a hierarchy hint (in which case you can go full autism and start using brackets/etc)
my main gripe is to at least fix the readability issue, which a bit of space (e.g. via a hyphen separator) improves quite handily

blame your shell
compare
echo "foo\nbar"

and
echo -e "foo\nbar"

>the four cases are intriguing, especially as I've rationalised the genitive case as simply translating into "of".
I prefer just using plain-ass prepositions, instead of some arcane over-complicated (read: typically German) system of relationships between half the words in a sentence
note I'm an ESL fag, my lang also has some leftover case-like shit but thankfully it was mostly removed back in the day

does sicp teach anything or is it just a for fun meme book

so how do i fix it in a simple way?

trying to make a program that finds out how many binary codes exist, but heres the catcher. It cannot be the oppisate of another one (0011 and 1100 are invalid for instance because they are equal to each other in reverese). Its fucking impossible to find an algorithm.
I know that given 3 numbers there are 5 different codes and given 6 numbers there are 35 codes. 000 and 000000 are not included

*trying to make a program that finds out how many different binary codes exist given a lenght of the binary sequence

divide by two, since every sequence only has 1 mirrored sequence?

what do you mean "fix"?
your shell (I assume bash) doesn't automagically convert '\n' to a single ASCII 10 character
note how echo has an explicit flag to do that instead of it being a shell setting
if you want to give a newline-containing arg to a program, there's many ways, e.g. heredocs

a trivially different thing i was going to suggest: under this equivalence everything has a unique representative that begins with 0

user
2^n is all the possible combinations
if you mirror it, than half of that
(2^n)/2

blog.cleancoder.com/uncle-bob/2017/01/11/TheDarkPath.html
why do people listen to this fag?

thanks ill try to find a nice solution.

>Swift and Kotlin
Stopped reading there.

jewgle 'bash pass argument with newline'
unix.stackexchange.com/questions/20035/how-to-add-newlines-into-variables-in-bash-script
>In bash you can use the syntax
>str=$'Hello World\n===========\n'
>Single quotes preceded by a $ is a new syntax that allows to insert escape sequences in strings.
so
./my-shitprog $'get\nbent'

might work depending on your version of bash
works on my machine(tm)

>uncle bob
cuz they're cargo cultists
uncle bob fanbois have that predilection

what a load of shit

React node tree ui

not to mention you can literally add a literal newline and be done
$ cat t.py
import sys
for i, a in enumerate(sys.argv):
print i, a
$ python t.py "get
bent" and other args
0 t.py
1 get
bent
2 and
3 other
4 args

The fuck am I reading?

>typeshits calling anyone else a cult

...

lispletism is a cult

You mean digits, rite?
As other anons said, every number has one mirrored version. So if the number is even, half of them are going to be mirrors of another number, if it's odd one of them will not have a mirror so that makes (n-1)/2 or you can divide the odd number directly and floor the number.
say that n is the digits of the number
you find how many numbers without mirrors can be there using Math.floor((2**n)/2). In your respective programming language, use the provided floor function (turns 5.4 into 5 and 5.9 also into 5) and look up powers and shit (the ** operator in javascript)

PS: If we don't count the zero, you should substract one from the final result. Don't forget that when writing your program.

>X is a cult!
>Y is a cult!
>Z is a cult!
>everybody else is a cult!
>t. unironic typeshit

It's close, but (2^3)/2 is 4 not 5. And (2^6)/2 is 32 not 35. The assigment spesifies that these are the correct answers to these examples

>so I tried these new languages
how about actually doing a fucking job you lazy fucking cunts

by rules for exponents that's just 2^{n-1}

i read it too quickly but in my defense your example and spelling were atrocious. start by doing small cases. don't wait for an answer

Ninety-eighth for Rust the best lang

Exceptions are misused.

c++ is the greatest language of all time