/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

sndio.org/tips.html#section_8
reddit.com/r/rust/
ncameron.org/blog/rust-is-about-productivity/
anowell.com/posts/why-rust.html
redox-os.org/news/rust-is-softwares-salvation-17/
words.steveklabnik.com/rust-is-more-than-safety
graydon2.dreamwidth.org/247406.html
thefeedbackloop.xyz/safety-is-rusts-fireflower/
words.steveklabnik.com/fire-mario-not-fire-flowers
medium.com/@ag_dubs/fire-flowers-and-marios-marketing-rust-996b3fdbe8f3#.f1bvjhkff
medium.com/@ag_dubs/fire-flowers-and-marios-marketing-rust-996b3fdbe8f3#.le618f8uc
twitter.com/SFWRedditImages

Functional programming thread;

so i wrote an operating system in haskell but it literally broke my pc? i press the power button and nothing happens anymore, i even replaced my hdd and ssd and it doesn't power on, wtf?

Spent 15 minutes on writing a solution to a discussion in a meme thread.

-module(countdown_gen).
-behaviour(gen_server).

-define(SERVER, ?MODULE).

-export([start_link/1]).

-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3]).

start_link(Start) ->
gen_server:start_link({local, ?SERVER}, ?MODULE, [Start], []).

init(Args) ->
[Start] = Args,
self() ! iterate,
{ok, Start}.

handle_call(_Request, _From, State) ->
{reply, ok, State}.

handle_cast(_Msg, State) ->
{noreply, State}.

handle_info(iterate, State) when State > 200 ->
io:format("~p~n", [State]),
self() ! iterate,
{noreply, State - 13};

handle_info(iterate, State) ->
{stop, "Clean Exit Reached", State};

handle_info(_Info, State) ->
{noreply, State}.

terminate(_Reason, _State) ->
ok.

Stop splitting /dpt/ you sick fucks

Applying for another PhD application. Woo!

Someone please post the current programming challenges list.

Functional programming isn't programming, hence why it doesn't belong here.

No. That stupid crap only shits up the thread with pointless rolling posts.

>used to program a lot every day working on a lot of different projects
>get hired by Google
>start working at the company
>get home every day tired
>just laze around the house playing videogames until it's time to go back to work again

How do I start coding for fun again? This is breaking my soul

Stanford or MIT, I assume?

Haskell has made your computer pure. No more mutable state for you.

Well after around 2 years of doing fuck all I'm ready to start programming again. I'll be freshening up on C and will probably look into algorithms and data structures. Wish me luck!

WSU. First application was to UW, which is still pretty well rated. MIT would be... a shot in the dark, and I'm not really certain I could get in there. I've got research positions on my CV, and decent GRE scores, but I'm not literally the smartest researcher in the fucking country. Also, the deadline was December 15th. Stanford... I really don't want to spend 3-5 years living in California. In fact, if possible, I should like to never live in California if I can avoid it.

Good luck, user!

>C
>algorithms
>data structures
You can do it user.

>Ruby !Sempai.oWA
Very important to the discussion at hand!

What I've gathered from /dpt/ is that I should use C for personal projects, Java for getting a job, and assembly and Haskell for impressing my friends on Sup Forums.

Thank you. I really needed that boost.

I want to learn C. Should I use the K&R book for learning or as a reference? I only know Python.

yes but there are some things in that book that aren't correct in newer versions of C

>I should like to never live in California if I can avoid it
but you'd be cool with living in eastern washington? it's just another shitty desert hell

Do you have a particular area of Informatics in mind as your research direction?

sndio.org/tips.html#section_8

>Anyway, using multiple threads to handle audio I/O buys nothing since the process is I/O bound.

If multiple threads aren't necessary in sound programming, how do I play back two or more WAV files more or less concurrently? What kind of data structure should I be looking at to manage this, if not just a bunch of threads?

Loop through all your currently playing streams, and mix them
Repeat

use epoll or equivalent

combine samples from both files into the same buffer. the process of playing the buffer is synced to the sample rate of the output device, but you can use a swap chain (have one thread play a "front" buffer while another thread populates a "back" buffer to be played next) if you want

>move mouse
>recomplie computer because state has changed

we need to have make respond to input events

2ez

You mix them together like SDL_mixer does.

Mixing would literally just be the integer value of each sample divided by the number of currently playing files, right?

Even with say, 8 or 16 files at once (a la a dum machine/sampler) this would be fast enough to fill up the buffer in time?

What's up with Rust circlejerk today? There were like 6 articles today about how Rust is the best thing after sliced bread and literally Software's Salvation.

Rust subreddit was haskelled lately.

reddit.com/r/rust/

Rust is not very good

until the linux api comes with a rust variant, I'm not using rust

Usually mixing is done at higher bit depth, and then normalized back to 16 bits

and i think you'd want it to be additive. if i'm not mistaken, averaging would make it so that if you played a loud stream and a quiet stream together, the final result would be quieter than the louder stream alone

Also: I'm guessing I should use a linked-list to manage currently playing WAVs? Since the number will fluctuate and any given file in the order can end at any time?

>you'd want it to be additive
this

if you turn up one fader on a mixer, the rest of the tracks don't get quieter

Yesterday Steve, the main fucking reason people on here bitch about rust because he's a massive hipster faggot, got in a blog argument with the language creator. In it he made some "monads are burritos" level of bullshit involving mario and fireflowers. Then a bunch of other people made fun of him for meme'ing by meme'ing harder at him in an ironic way.

Honestly, it's something all of Sup Forums should understand as that's basically all we do here all day.

>Rust is about productivity
ncameron.org/blog/rust-is-about-productivity/
>Why Rust?
anowell.com/posts/why-rust.html
>Rust is Software's Salvation
redox-os.org/news/rust-is-softwares-salvation-17/
>Rust is more than safety
words.steveklabnik.com/rust-is-more-than-safety
>Rust is mostly safety
graydon2.dreamwidth.org/247406.html
>Safety is Rust's Fireflower
thefeedbackloop.xyz/safety-is-rusts-fireflower/
>Fire Mario, not Fire Flowers
words.steveklabnik.com/fire-mario-not-fire-flowers
>Fire Flowers and Marios: Marketing Rust
medium.com/@ag_dubs/fire-flowers-and-marios-marketing-rust-996b3fdbe8f3#.f1bvjhkff

I'm fairly happy that they can move there. It's a very different kind of programming from the imperative/procedural/structured/etc paradigms.

>even Haskell hasn't reached this level of autism

The difference is that the rust people are doing it in a self-aware way. The haskell autists would be doing this in earnest.

>just pretending to be autistic

is Steve the reason people say Rust is full of sjws?

Nope. The reason people say rust is fulla SJWs is that rust is fulla SJWs.

Gee, I don't know: medium.com/@ag_dubs/fire-flowers-and-marios-marketing-rust-996b3fdbe8f3#.le618f8uc

I'm not saying it's _not_ autistic...

Pretty much. A lot of the main team is pretty chill and just goes along with it to avoid friction. Steve is a passive-aggressive Ruby faggot who has unironically used words like intersectionality. He's been called out before, but instead of owning up to it he bitches and then crawls under the team's skirt. I was using Rust will in it's pre-release development and remember what it was like before he showed up. Not only is he a faggot personally, but he brought more rails douchebags with him.

pic related: the panty-waist xerself

So for my portfolio on shithub for software engineering jobs, I have:

>shmup written in Lua
>basic django site
>java snake clone

Think that'll do for the moment for entry level jobs?

...

The nose knows

that is a good article and the tweet isn't written by the author

>writing a shmup in the cutest language
you qualify for an entry level bf desu

Ada is much cuter than Lua

>the cutest language

I'm glad I'm not the only one who has a hard-on for Lua's cuteness.

You shut your whore mouth. Does Ada have a clean and simple source code that can fit in an L1 cache?

It spawned 24 hours of autism. Not really effective and therefor not a good article. His point isn't wrong, he's just an asshole.

>he

did you just?

...

The hipsters are trying to create artificial hype for . Because it's new they can later claim that they have there from the start. Because it's new they can implement some simple library and say that they have been maintaining the language libraries for n years.
Because it's new every flaw "will be fixed" because it's still in development.

Don't fall for the Rust/Go/Clojure/... meme

Add Haskell to that list

I just want C with RAII without all the garbage C++ has

So Vala without the object orientation?

How do I use a .jar file with a file and import stuff from it?

In the java file I try to do "import algs4.StdRandom;" at the start, and I have algs4.jar in the same folder. It just says that algs4 doesn't exist.

I try "javac -classpath ".;/home/user/Desktop/Alg/1/;" PercolationStats.java" but it says the same thing.

Haskell is not new

still gets hipster-meme'd

Haskell is good

Haskell hasn't been hipster-meme'd for a couple of years now. Hipsters moved on to Rust, Go, and JavaScript.

>without all the garbage C++ has
so without the C parts? yeah, me too

GIGABYTES PER SECOND OF GARBAGE COLLECTION

that would be java but with silly ruby syntax

yes?

yes.

yes

> C with RAII without all the garbage C++ has
Literally Rust.

>:3

It's literally gay, is what it is.

>;3

Should fit you like a glove then?

I actually was going to say that, but it uses things like UTF-8 and non-null terminated strings which don't feel very C like. It has too many restrictions so you cant do stupid, yet fun stuff you can do in C.

What area of programming can i make the most money from whilst putting in the least amount of effort?

God says...

Kill yourself

I know what area you can make the least money with the most effort.
Functional Programming

web dev

Partially implemented xmonad style screen independent tabs for awesomewm to make my real development workflow more effective. I'll do the rest later.

For those interested, add this code somewhere above the keybindings:
function move_tag_to_screen(tag, mscreen)
local clients = tag:clients()
for key,value in pairs(clients) do
awful.client.movetoscreen(value, mscreen)
end
end

function steal_clients(tag_index, mscreen)
mc = mouse.coords()
for s = 1, screen.count() do
move_tag_to_screen(tags[s][tag_index], mscreen)
end
mouse.coords(mc)
end


Then put:
steal_clients(i, screen)

under the existing line:
awful.tag.viewonly(tags[screen][i])

Malware embedded in ads or ransomware.

Except that Rust's safety bullshit makes that a problem.

Shoo shoo C# shill.

prepping the bull

unsafe {

}

>manageable safety
>somehow bad
You can alway turn bound checking off and use CString if you hate youself.

>no way to use epoll in rust

trash

The point is that Rust is not 'C with RAII', it's an entirely different beast.

>systems programming language
>can't work with the system

What does /dpt/ think of the no (You)s?

An easy fix, sure, but still doesn't feel the same.

Except, you know, via the C api directly, or via mio, a library which makes a Rust api directly on top of epoll.

>an easy fix
Yeah, I can't believe Moot didn't do it sooner

Have some dots.

They were always an ugly hack, and spawned annoying memery.