photex _

Read this first

Building third party software packages with Scala and Akka

Recently at work I started tackling the builds of all the third party packages that we depend on. As you can imagine, once you have a certain number of these packages you end up with a bit of a web of dependency and the time to start and finish a correct build grows rather large. This tax on developer time lead to an unfortunate choice to just start symlinking previous builds instead of actually rebuilding packages when we move to a new OS (a particularly troublesome thing to do on OSX). In addition to this, as packages are added or upgraded, the configuration might not reflect the current state correctly.

So I set out to get the chores done and make this whole process easier to manage so that doing everything correctly became the simple thing to do.

Oh yeah… I also saw a perfect opportunity to write an application with Scala and Akka! :)

Determining What to build

There is an existing...

Continue reading →


Supporting Range Requests with Spray

I recently developed a simple service using Scala and Spray which needed to be able to serve videos to iOS devices. In order to do this you need to support byte range requests which isn’t immediately clear.

Spray does not currently have a formal range request routing directive but it does have everything you need to support these requests.

Here is my simple implementation. I’ve tested it on a couple of iPads running iOS 6 and 7.

https://gist.github.com/photex/6768282

The ByteRange used in the match expression is just a little regex:

val ByteRange = "^bytes=(.*)-(.*)$".r 

Continue reading →


Delaunay Triangulation in Common Lisp

tl;dr: Something that’s been on my TOCODE list for a while was to implement the triangulation of a set of random points; particularly in Common Lisp.

You can go straight to the code here.


The topic of proceduralism in art, vfx, and games has always interested me and is very likely the primary reason I’m compelled to write programs in Lisp. Clojure served as my primary introduction to the world of Lisp but I’ve ultimately come to really enjoy and appreciate Common Lisp. There isn’t much I can say about the general Common Lisp community, but the friendly confines of #lispgames on Freenode have been a tremendous inspiration and motivator. The best part is that #lispgames is home for folks using all the branches of the Lisp family tree (and even some Smalltalk).

Upon setting out to research Delaunay Triangulation I looked for reference, inspiration and code examples from anywhere and...

Continue reading →


Akka, AMQP, Play, and Scala (a follow up)

So this weekend I was following along with a very helpful blog post when I realized that the way it’s implemented prevents proper application shutdown since the primary actor for consuming messages will block eternally.

Since I’m new to this I searched around for a bit more context or possible solutions but it really came down to actually reading the RabbitMQ api docs.

The solution in the post uses a deprecated class QueueingConsumer which provides the blocking api. But you don’t need to do this at all these days. Just implementing a simple subclass of the DefaultConsumer is sufficient for streaming messages into your actor system without having to manage your own threads or worry about proper shutdown.

Here is my MsgConsumer implementation:

https://gist.github.com/4061895

And in your Global settings you need to have a setup similar to this:

https://gist.github.com/4061969

I deviated...

Continue reading →


Moving from tumblr

Because of my lame copy-paste of posts (I only have like 5) the dates will look current when in fact they are potentially rather old.

Continue reading →