More articles tagged 'programming'

Using Sequel and Ruby to import the Geonames database

GeoNames is a project to gather geographical information under the creative commons attribution license, which means it's ideal for commercial use and hobbyists alike.

The version I have contains a whopping 6.7 million. names of populated places, locations and all kinds of other things that have a name and ...

Sequel with Sqlite caveat: Sorting on dates

One slight hickup it's worth being aware of when storing timestamps in Sequel is that if you use the Sqlite adapter, the timestamp is stored as an ISO 8601 string with timezone, like this:


The "Z" at the end signifies UTC.

This isn't a problem if you're ...

Syntax highlighting in Ruby

I love syntax highlighting - I have gotten so dependent on it I find it painful to use editors without it. So it's extremely annoying to post code snippets without it online too.

Thankfully it's trivially simple to do in Ruby. For this blog I really wanted a solution that ...

Sequel praise and Sqlite type translation problems

I ran into a very annoying problem with Sqlite yesterday, triggered by Sequel. But first some praise for how simple Sequel makes things most of the time:

One of the nice things about Sequel is that it allows me to write complex queries in pure ruby, without ever (so ...

An 'assembly' language for parsing

I've mentioned my forays into push parsers previously. But after looking at that approach, I realised I needed a bit more flexibility. So I got the idea of designing a tiny assembly like language for building push parsers with. This is analogous to building an NFA or DFA, but with ...

Algorithmic world building the Elite way

Ever since I realised how Elite worked, the concept of using algorithms seeded by pseudo-random number generator have fascinated me.

In Elite, the whole "universe" was formed by seeding a simple pseudo random number generator with a fixed value and following fixed steps to generate "galaxies", and then seeding ...

Compile time Towers of Hanoi

A short and simple C++ template meta-programming implementation of the Towers of Hanoi