/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Old thread:

Attached: stock-photo-54748624.jpg (900x593, 143K)

Other urls found in this thread:

blog.jorgenschaefer.de/2013/01/monads-for-normal-programmers.html
okmij.org/ftp/Computation/monads.html
homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/baastad.pdf
github.com/enfiskutensykkel/ssd-gpu-dma/tree/latency-bench-rewrite/benchmarks/latency
jdk.java.net/10/
scaleway.com/pricing/
graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax
manning.com/books/get-programming-with-f-sharp
haskell-lang.org/library/http-client
mariapilot.noblogs.org/files/2017/05/MODERN-PYTHON-COOKBOOK.pdf
papl.cs.brown.edu/2017/
matt.might.net/articles/preventing-and-managing-rsi/
twitter.com/SFWRedditVideos

Monads thread again!!!
blog.jorgenschaefer.de/2013/01/monads-for-normal-programmers.html

>A Monad is an object whose methods return monads.
At last I truly see

maybe it's better to answer what a monad isn't? is a monad a donut?

okmij.org/ftp/Computation/monads.html
Is better

homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/baastad.pdf

A monad is just a monoid in the category of endofunctors, what's the problem?

>What are you working on, Jow Forums?
Refactoring (rewriting) the latency benchmark. It's much more flexible now in terms of specifying multiple IO queues and where to host them.

Had some issues yesterday where I wrongly calculated the offset on remote GPU memory, and mapped the same memory for multiple queues, which led to a massive clusterfuck. Spent most of today implementing a verification feature and figuring out that bug.

github.com/enfiskutensykkel/ssd-gpu-dma/tree/latency-bench-rewrite/benchmarks/latency

>A Monad is an object whose methods return monads.
>A Semiring is an object whose methods return monads.
>A Semigroup is an object whose methods return monads.
>A Heyting Algebra is an object whose methods return monads.
Well... OKAY.

Oh crap. I forgot to replace the last words with the initial term. Should be:
>A Monad is an object whose methods return monads.
>A Semiring is an object whose methods return semirings.
>A Semigroup is an object whose methods return semogroups.
>A Heyting Algebra is an object whose methods return heyting algebras.

Now it is correct.

how can I find a programming job where I won't have to work very hard?

Dude, you just like sit in front of a computer n'shit. Like, how is this hard?

Anyone here use VS Code?
Is there a way I can set my C++ compiler globally in Intellisense? Every time I start a new C++ project I need to manually set it.

The first example is far clearer then that stupid sentence. At least it is if you know jQuery :
$("#element").find("ul").parent().hide()

So the function $() and the methods .find and .parent all return monads.

Or look at it another way : monad is an opaque term for objects that returns objects you can do work with.

>objects that returns objects
Objects that have methods that return objects that have methods you can do work with.

I am looking for a server for a web app I am writing. I need 1tb of fast storage on the server, also I don't want a long contract.

Is java just deprecated now that dot net core exists?

aws

TUNNEL BEAR OFFERS FAST AND SIMPLE...

"fast storage" you want SSD? Or would 10k RAID1 be enough ?

Also, what's your budget ?

AWS is the easiest, but I I want to test the app for at least 1 month and see if I get any customers. I hope there are cheaper alternatives.

>cheaper than aws
???

Java will still exist for a long long time. Just as Fortran is still around, Java will never disappear. The problem with both Java and C# is they are owned and controlled by companies (Oracle and Microsoft) that are known to screw over everybody that gets in their path.

Oracle stands out as particularly psychopathic in their destructive behaviour.
Microsoft is schizophrenic in that the some sections might be very keen on promoting C# and open source implementations of it and other sections are hell bent on destroying Linux and all it represents.

Java has a much more mature tool chain and open source implementation.
C# is just a better language, thanks in part to MS got to learn from the mistakes in Java.

OVH has dedicated servers. Lowest tier is 2TB RAID1 for under 100 bux. And it's a monthly contract so you can easily bail.

Just look for anything written in Java.

Trying to implement concurrency via threads into my prime generating/checking procedure in Racket.

It's...not going well.

microsoft is embracing open source and cross platform and has openly admitted they were wrong about being anti open source
in microsoft vs oracle microsoft is the clear winner and they don't seem nearly as scizo as they used to

So we are in the "Embrace" phrase of "Embrace, extend, and exterminate." It will take many years before I believe Microsoft won't move to the exterminate phase.

AWS is ridiculously expensive if you compare it with something like netcup.eu

Oracle is embracing open source too. They open sourced the entire JVM + graalvm

>concurrency via threads
Don't.

Or rather, don't try to do concurrency without a ironclad method of communicating between threads. Anything short of "share nothing" will cause problems.

AWS storage and bandwidth is very expensive, OVH is very cheap agains it.

Is it cheaper to just subcontract or what

Need more context.

Yes, Indian coders cost less then American coders. However, they are harder to communicate with, will produce crappier code and over the long run will cause an expensive tech debt that would be avoided by having smart programmers in-house.

referenced

Dont go for Indian,eastern euros require 3 cents more but do way better work than pajets.

yes user AWS is stupid expensive because you pay for the convenience

Reminder that the JVM is a spec. Just like C is.

No one actually owns Java and Google getting fucked there was for basically calling a bastard non-specification-compliant version of the JVM Java, when clearly it is not.

Also Java already has a totally open-source (GPL v2) implementation of the JVM+JDK in OpenJDK : jdk.java.net/10/

And finally oracle is bailing out of implementation-side (what was called Oracle JDK) and will move to a redhat-style commercial support only for shit companies that can't be bothered to update and need backported security updates.

to be precise, I know Oracle is holder of the "Java" trademark. But the code itself is actually free and open-source (unless you think GPL v2 is not foss enough)

who the fuck wants to use JVM when the erlang VM is infinitely better and scalable.

So this pic got me thinking, what IS the most efficient way to return max of two ints?
Best I could think of is
if(a>b):
return a
return b


is there an even faster way?

Attached: 1463058821587.jpg (869x1776, 226K)

> infinitely better and scalable
yeah nothing can be infinitely better to begin with, and to answer your question anyone that is not a basement autist trying to derail /dpt/ because they've got fuck else to do?

scaleway.com/pricing/
Take what you need in term of CPU/Memory and pay for the space separately.
Should be way cheaper

return a > b ? a : b;

>this is the end of the program! see you guys later XD
genious

how is this any faster, both compile down to the same thing

it doesn't have an if-statement to no branch prediction -> blazing fast code

retard

bait.jaypeg

The ternary operator still operates (usually) using branches.

IIRC floating point is not standardize by neither C nor C++ standard. They only need to be able to store floating point value,
so the Q_esqrt() will produces undefined behavior if the implementation doesn't use IEEE-754.

Q_rsqrt is undefined behavior anyway because of pointer aliasing.

What is the best source for learning fsharp? fsharpforfunandprofit feels... messy

Without devolving into fanboyism,

C# is an objectively a better language than Java.

Attached: 1523062237261.png (922x988, 94K)

graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax

nice link
*snap* for my bookmarks

manning.com/books/get-programming-with-f-sharp

tell me which one is which

Attached: baka.png (1749x658, 83K)

There's no branch prediction silly

I have this and it's garbage

branching happens on the processor level silly, not in the assembly code

install F*

Adding error handling to my Haskell program. How do I use the 'try' function from 'Control.Monad'? I get
• Ambiguous type variable ‘e0’ arising from a use of ‘try’
prevents the constraint ‘(Exception e0)’ from being solved.
Probable fix: use a type annotation to specify what ‘e0’ should be.

on this code
handleUrl :: String -> IO ()
handleUrl url = do
req putStrLn "Right"

But where does it need the type annotation?

C# and Java are business languages. Only a fool would use them for hobby projects. So most of the time you don't get to choose and just deal with it.

Anyone know if making a native Scala data loader would be faster than a C binary to convert data piped into a Spark dataframe? The data format is not easily loaded into a data frame so the binary is used to convert the data. I'm inclined to say yes, however I have seen the benchmarks and have doubts that the JVM could beat an optimized C binary with a pipe. Thoughts?

With ScopedTypeVariables you could put it on the _ in Left - Left (_ :: somee)
otherwise in try I guess. You could do something with the variable in Left that forces it to be a particular exception.

>error handling
why do you need more than a maybe type

First user is correct, the compiler will just optimize away whichever branch it thinks it's likely to follow, then the JVM and CPU will further optimize by assuming one branch will be taken.

The only difference are gigantic case statements and huge else-if trees, you'd want pattern matching for that instead of O(1) eval

*for O(1) eval

This, I don't get why anybody in a hobby project would want to drop in a gigantic enterprise language and do complicated design patterns to control global state with OOP. You're not going to hire a thousand underlings to work on each part seperately, so just write it in any productive language where you can hack around freely

Neat, that works
handleUrl :: String -> IO ()
handleUrl url = do
req case getResponseStatusCode res of
200 -> mapM_ handleItem . parseFeed . parseLBS_ def $ getResponseBody res
_ -> return ()

I guess that's how httpLBS works haskell-lang.org/library/http-client

WE
who can I complain to about cultural apropriashun?

Attached: ayo.png (862x787, 446K)

I want to specialize in a language, really get to know its ins and outs, and I want something well supported, popular, useful in a career and decently fast. So I go with C#?

I've finished How to Design Programs and I wanna learn Python.

I heard Composing Programs is a great, but isn't it more geared towards people who want to learn programming, rather than the language? If so, how's something like "Learning Python"?

mariapilot.noblogs.org/files/2017/05/MODERN-PYTHON-COOKBOOK.pdf

Best book for Python if you know programming.

>I've finished How to Design Programs
>I wanna learn Python
You're going to be extremely disappointed.

python

C++ or any language that runs on the CLR or JVM.

>I wanna learn Python
Try writing code then. Start simple, then learn to group code into reusable pieces like functions. Then learn to group functions and data into classes. Then learn to group related classes into packages. Then learn to group packages (and coordinating code) into complex programs.
Reading books is fine, but you gotta put what you read about into practice too.

What snake is that? It looks cool as shit

Attached: 1510720540093.gif (400x480, 443K)

C# will chip away at your soul

There's a sequel to HtDP in a Python-esque dialect papl.cs.brown.edu/2017/ where you can make your own types and pattern matching in Python like syntax.

If you want to learn Python you just look at the specification, or get advanced books specifically about the language like all it's tooling ect.

Bush viper.

bros my wrists hurt like shit when typing, how do i fix this problem? i don't want to end up like those guys who have to find a new career because of wrist pain

Attached: 1530325467201.jpg (664x440, 486K)

Which web browser engine do you use when "coding", /dpt/?

Attached: 1532186043438.png (403x347, 116K)

matt.might.net/articles/preventing-and-managing-rsi/
>Try a Dvorak keyboard
>Try a reg keyboard designed to prevent RSI
>Do pull ups so your grip stregnth/wrists are in better condition

holy fuck they're cute. I need one.

Attached: 3-6.png (799x485, 212K)

>intel is the best hardware vendor for Linux according to Linus
wow

Being vipers, they're venomous.

Linus Tech tips right?

trackball + split keyboard works for me

TUNNEL BEAR?!

so? I'll just get my body used to the venom by injecting it small bits at a time. They're too fucking cute to pass up.

Attached: 500679714-640x640.jpg (640x360, 181K)

Ironically for that you need to find a job that doesn't need list programming as a thing. I had a data entry and processing job about 3 years ago where I once had to go over 300k items and process them, sometimes needing to get data from other sources, and given as an excel file. We were 6 guys each with other 300k items to process. Took about 3 months to finish it, but I made some scripts to automate a shitload of it, most relaxed 3 months of my life. Now Im in charge of the payroll at another company, it's a full time job, but thanks to all the programs I've made it takes me 30h a month. Rest of the time I shitposting and improve the programs to try and get it down even more. Never get a 'programming' job in a field that knows about programming if you want to take it easy.

thanks for the link, will read. i am thinking of buying an ergonomic microsoft keyboard.
>pull ups
i can't even do one pull up properly, should i start with free weights? i do cardio somewhat regularly but have put off strength training for far too long

>trackball
thanks, good idea. got any brand/model recommendations?

???

meant to also link

bitch please

Attached: dspH2PJ.jpg (700x868, 146K)

Can I code a windows app under linux?

What is a "windows app"? Something to control your apartment's windows?

Was it murder gone wrong or a romantic mutual suicide?