Open Source Flying

April 22, 2014

Open source code is great because anyone can use it. I’ve recently been contributing code to three open source projects. Firstly. I created an iOS wrapper for the open source airport data found at Thanks for maintaining the data, ourairports!


I also contributed to a wrapper for the world magnetic model. I think this code exists in iOS already because the functionality exists in the compass app but Apple isn’t sharing it with developers.  Thanks for maintaining the model, Stephen!

The above two projects are used in the wildly popular NRST: Descent Rate & Airport Finder. I’ll post more about that later.

I’ve been using and trying to advocate for Yalldo. It’s a great social network for flying and I hope it catches on more. Their apps let you record flights that can then be posted online. I noticed that if the app quits, which is not uncommon for long running background apps, the GPS trace will be lost. I emailed Antoine and offered some code for persisting traces. See below. Thanks for maintaining the social network, Antoine!


Best Movie of 2013

April 22, 2014

The best movie I saw in 2013 was Wreck-It Ralph although some people may claim that movie is from 2012. Sugar Rush and Sarah Silverman are perfect. The allusions to old school video games never stop. Love it.


Best Movie of 2012

January 2, 2014

I haven’t been able to think of the best movie of 2013. Let me think about it some more.

Gravity was OK. My favorite line from Sandra was “No hablo Chino” when she was trying to understand the Chinese space computer.

The best movie of 2012 was clearly Cabin the Woods. It successfully satires the campy horror film genre while being a successful campy horror film at the same time. Maybe Joss will do us a favor and make a sequel, prequel or a series illustrating how they caught the merman, witch, sexy witch, etc..


Transportable Media is Passé

August 8, 2013

I’m a student pilot and thought I would try out a flight simulator for the Mac. X-Plane has a downloadable demo but to purchase it requires DVDs. They even state that the DVD must be in your computer to run the full version.

I’ve been saying to people for a long time that transportable media is passé. Apple agrees with that having removed optical drives from their computers. My building has Webpass so I could download 200 GB in less than 5 hours according to a recent speed test. Coincidently James from an earlier post works at Webpass now. Thanks for the speediness.

X-Plane seems pretty good. I did some landings at SQL (San Carlos airport) with the demo version which didn’t include scenery for that area. I’d like to see better support for multiple monitors. My MBP with no optical drive has 2 thunderbolts and an HDMI dying to power my cockpit.

So I wait for a downloadable version. Either that or maybe the old powerbook hanging on my wall as a digital picture frame has a drive that still works.

NoDB is the new NoSQL

July 23, 2013

NoSQL was all the rage a few years ago. You could shove stuff into it with no schema and maybe have an index or two to speed queries. That simplified application design in some cases. To simplify even more consider using the NoDB pattern where there is no database!

An example of a NoDB app from a few years back was a Twitter proxy we used for caching Twitter feeds and setting up security to allow Flash access. We code named it “Twoxy.” The only input was a Twitter URL and there wasn’t a need for a database. Caching was done with memcached or a file cache and we disabled the DB in Rails with “frameworks -= ‘activerecord’”.


Another example of NoDB is this Sinatra app that let’s you play 1-4-24 online. The entire state of the game is stored in the session which is an encrypted cookie. No database is required to store the odds used by the AI. Initially the odds were cached-as-you-go in memory using some memoizing but are now loaded at startup.

This NoDB pattern is wonderfully simple but there are downsides. One problem can occur when storing the state in a cookie. If the app makes synchronous requests then one request may change state simply to have the state reversed by a competing request. To prevent this make serial requests or do not change cookies when they aren’t needed. Putting session state in memcached could also prevent this problem.

Another downside is there is no history or audit trail. Another downside is there’s no way to aggregate sessions e.g. a high score list. (I lied, 1-4-24 actually has a database for this purpose: Amazon’s DynamoDB. I thought DynamoDB would be super easy to setup since it has a lightweight API. However, I needed some features not available in v1 of the Ruby API and the v2 API hasn’t been streamlined too well yet. It took longer than expected but now I know more than I need to about DynamoDB).

The end result turns out to be very scalable. For gameplay I can spin up as many Heroku dynamos as needed and there will be no contention on a database. DynamoDB claims to be very  scalable so writing or reading high scores should be fine as well.

Unique order independent combinations from rolling dice

June 25, 2013

I was interested in calculating some probabilities for a dice game. The game has 6 identical dice that are rolled from a cup i.e the order the dice are in does not matter. I pre-calculated probabilities and wanted to make sure I got them all. How many different  combinations result from 6 dice?

If the order the dice fell onto the table mattered or if the dice were all colored distinctly there would be 6^6 combinations which is 46,656. However, since rolling 1,2,3,4,5,6 is equivalent to rolling 6,5,4,3,2,1 there must be less than that. A few lines of ruby code told me that there are only 462 unique combinations. Much less.

I thought there should be a general solution so I searched the internet. I didn’t find anything right away so I got out some paper and came up with:


  • n: the number of dice
  • s: the side count of each die

If there’s an easier way to express this please let me know. Below are some examples to test the formula.

  • d( 2, 2 ) = 3 (flipping 2 coins is head/head, tail/head or tail/tail)
  • d( 2, 3 ) = 6
  • d( 1, 6 ) = 6 (rolling one die)
  • d( 2, 6 ) = 21
  • d( 3, 6 ) = 56
  • d( 4, 6 ) = 126
  • d( 5, 6 ) = 252
  • d( 6, 6 ) = 462

(The first term in the sum above is always 1. Do not forget that 0! is 1.)

The Change Club

May 17, 2013

A big life change like leaving your startup is sometimes long overdue. If you’re fortunate enough to have saved some money and still have airline status from all those business trips you took then buy a vacation to Mexico and have some free beers in the club. Enjoy it while you can because your status will run out and you might be too busy soon on your next startup idea.


Disney Offers Urban Hood Contest

September 10, 2008

Disney officials have just released the rules for an exciting new contest. Wear as much blue as possible, hoodies encouraged, and you and your family could win an all expense paid trip to Disney World. Judges will be lurking near the corner of 24th and Treat at approximately 11pm every night this week. More details to follow.


March 23, 2007

I am eating cheese ravioli.

twitter twitlings

March 23, 2007

I signed up for twitter for a while ago. I tried to get all my friends to join so they could find out what kind of raviloli I was eating now but they all refused to join. What are they doing that’s better than knowing about about my dinner? I searched for awhile to find the epitomy of twits.



Get every new post delivered to your Inbox.