ExecutionContext for Long Running Tasks

Rule #1 of Akka: don’t block inside actors. If you do have blocking / high latency calls, wrap them in a future and toss them into a different execution context specifically meant for high latency tasks.

import java.util.concurrent.Executors
class ClassyActor extends Actor {
  val numThreads = 10
  val pool = Executors.newFixedThreadPool(numThreads)
  val ctx = ExecutionContext.fromExecutorService(pool)
  def receive: Actor.Receive = {
    // An message that needs some high latency work done
    case m: Message =>
      val future = Future {
        // do something with m: Message
      } (ctx)

        case Success(s) =>
          // do something when the task successfully completed
        case Failure(f) =>
          // do something when the task failed
      }) (ctx)
Bro, do you even #chromecast?

Bro, do you even #chromecast?

Tags: chromecast

Getting the Titan-0.3.2 Java Driver to work in Scala

Attempting to use the Java driver for Titan-0.3.2 (the current stable Titan release) with Cassandra v1.2.6 in a Scala project throws the following Astyanax error:

java.lang.NoSuchMethodError: org.apache.cassandra.thrift.TBinaryProtocol: method (Lorg/apache/thrift/transport/TTransport;)V not found

This can be traced back to a bug in Astyanax v1.56.37 which was fixed in v1.56.43.

This can be fixed by ensuring that this dependency is listed above the Titan driver in your pom.xml or sbt.build.


Setup Ruby (2.x) on Rails (4.x) in 10 lines or less

As a first time user of Ruby and Rails, I was able to setup a sane environment on Ubuntu Server 12.04 (x64) in less than 10 commands:

cd $HOME
curl -L https://get.rvm.io | bash
source $HOME/.rvm/scripts/rvm
rvm requirements
rvm install ruby
rvm use ruby --default
rvm rubygems current
gem install rails

And, if you already have a rails app to run, continue along with:

cd myapp
bundle install
rails server

This will get you up and running with a dev server.


Prevent Facebook from tracking you on the Web

A simple search for “facebook like button tracking you” turns up a bunch of articles and blog posts about how Facebook is creeping on you wherever you go; even if you’re not signed in or actively clicking their ubiquitous like button. For example: http://bit.ly/1fwCi5i

I’ve come up with a simple solution to the problem.

Caveat: This will prevent you from being able to use Facebook.

Step 1: Add the following entries to your hosts file facebook.com www.facebook.com connect.facebook.net

If you’re not familiar with editing your hosts file, here’s a tutorial.

Step 2: Reboot

And done!


Joda Time with Scala

When trying to use Joda-Time in a Scala project, I encountered a rather cryptic error:

scala: error while loading Instant, class file '/Users/asdf/.m2/repository/joda-time/joda-time/2.3/joda-time-2.3.jar(org/joda/time/Instant.class)' is broken
(class java.lang.RuntimeException/bad constant pool tag 9 at byte 48)

This can be solved by adding the joda-convert dependency into Maven/SBT.



When I started Super Meat Boy, I knew that proper controls would be the make or break for the game. I’m very picky about controls in games, to the point if the game doesn’t control well, I don’t care who makes it or what it is, I will stop playing it. I often get asked which formulas I used for…


pip install scipy on Ubuntu

On Ubuntu 12.04 Server, a pip install scipy barfs with

library dfftpack has Fortran sources but no Fortran compiler found

because it wants you to

sudo apt-get install libamd2.2.0 libblas3gf libc6 libgcc1 libgfortran3 liblapack3gf libumfpack5.4.0 libstdc++6 build-essential gfortran python-all-dev libatlas-base-dev

pip install numpy

before you try to pip install scipy

Going up.

Going up.

Glass half full

Glass half full