Havoc's Blog

this blog contains blog posts

Tag: tech

Configuring the Typesafe Stack

Update: see also this post on JSON-like config formats. My latest work project was a quick side-track to unify the config file handling for Akka 2.0 and Play 2.0. The result is on GitHub and feels pretty well-baked. Patches have now landed in both Akka and Play, thanks to Patrik and Peter. I can’t make […]

Task Dispatch and Nonblocking IO in Scala

TL;DR Modern application development platforms are addressing the related issues of globally-coordinated task dispatch and nonblocking IO. Here’s my definition of the problem, an argument for why it matters, and some suggestions for specific standard library features to add to Scala in particular. The same ideas apply to any application development platform, though. It’s rapidly […]

It has to work

Often when our minds turn to design, we think first of cosmetics. With all the talk of Apple these days, it’s easy to think they’re successful because of shiny aluminum or invisible screw holes. But this is a side issue. The Steve Jobs quote that gets to the heart of product development might be: So […]

Callbacks, synchronous and asynchronous

Here are two guidelines for designing APIs that use callbacks, to add to my inadvertent collection of posts about minor API design points. I’ve run into the “sync vs. async” callback issue many times in different places; it’s a real issue that burns both API designers and API users. Most recently, this came up for […]

Keep the JVM, dump the rest (Scala+Play+MongoDB)

I decided to try three new things at once and get back into some server-side development. Scala uses the JVM for the hard work, but feels more like Ruby or Python. It’s statically-typed, but for the most part infers types rather than making you type them in. Play ignores the Tomcat/J2EE legacy in favor of […]

Boolean parameters are wrong

Today’s simple way to improve your code. Say you’re reading a program and you see some lines like this: new ArrayBlockingQueue(10, false); box.pack_start(child, false, true); You don’t know what the booleans mean. Say you’re reading it and you see this: new ArrayBlockingQueue(10, Policy.FAIR); box.pack_start(child, Packing.FILL); Which is better? There’s only one time that a boolean […]

Web server with URL fingerprinting out of the box

Years ago when we built Mugshot we stumbled on “URL fingerprinting,” Google describes it here. We used a “build stamp” (a continuously incrementing build number) instead of an MD5, but same thing. My guess is that many web sites end up doing this. Owen implemented the feature by writing a custom Apache module. (The idea, […]

Ridiculous settings screen showdown

Here’s a new one from today: And also a classic:

A Sequential, Actor-like API for Server-side JavaScript

Idea: how a JavaScript request handler could look When I saw node.js, we’d been writing a huge pile of JavaScript code for litl based on gjs (gjs is a custom-built JavaScript runtime, created for native desktop/mobile/consumer-gadget apps rather than server-side code). At litl, we use a syntax for asynchronicity invented by C. Scott Ananian – […]

Playing a sound file

Is there really no Linux API to just play a file? Something like: id = cache_file(“foo.ogg”); // cache the sample play(id); // play to default device libcanberra seems to only support playing stuff from a sound theme, not a file. PulseAudio seems to require setting up a main loop thing, creating a context, converting the […]