codeBrane Blog

hello world in commodore 64 assembly

Friday Oct 25, 2013

I’ve been rebooting my interest in the Commodore 64 recently, after a layoff of around 20 years! The last time I used a 64 was back in 1992 when I wrote a BASIC word processor on which I typed my honours thesis and printed out on an MPS printer, if I remember the model correctly. I still have the old machine, printer, tape drive etc but I’ve been relearning everything on VICE before I get round to powering them up again.

developing a simple ios sliding navigation app

Monday Aug 26, 2013

I’m working on an iOS app that lets me identify mountains based on my location and bearing but one of the first things I wanted to tackle was the navigation. How to get from screen to screen. Initially I tried a tabbed app layout but that seems so ‘yesterday’ these days and instead I plumped for a sliding navigation model, ala Facebook app. It’s not as complicated as it sounds once you’ve got your head round iOS development so this post takes you through constructing an app with three coloured views.

upload a raspberry pi camera image to dropbox with ruby

Saturday Aug 3, 2013

This is a fairly simple wee tutorial on how to get the Raspberry Pi camera module working, taking a picture with it and uploading it to Dropbox using Ruby. If you don’t have Ruby running on your Pi you can follow the steps on my Ruby on Pi tutorial. The camera itself is very easy to install if a bit fiddly. The video shows you how to do it: Once it’s plugged into the Pi, you need to update the system:

migrating wordpress post links to octopress post links

Saturday Jun 8, 2013

So I've migrated the blog to Octopress, got FTP deployment working, and deployed via FTP so what's left I hear you say? Well exitwp doesn't change the internal post links. In the Wordpress post, an internal link to another post, for my blog setup is:

while the link to the same post in the Octopress version of the blog is:

deploying an octopress site via ftp

Friday Jun 7, 2013

So I’ve managed to convert my blog to Octopress, go through the horrible process of installing lftp on OS X and now it’s time to deploy to my site. Unfortunately my hosting provider doesn’t allow rsync access but you can deploy via FTP with a few very small tweaks.

First I made sure /Users/alistair/apps/lftp-4.4.8/bin was in my PATH.

installing lftp on os x

Friday Jun 7, 2013

They say Octopress is for geeks and having converted my blog to it I needed a way to deploy as my hosting company won’t allow rsync access. Fortunately you can deploy over FTP using lftp but that’s for another post. I thought I’d done most of the geek work in converting the blog but, my oh my, was I wrong!

lftp requires two things, pkg_config and readline. pkg_config requires gettext. And most of these actually don’t work straight away on OS X. I don’t like things like homebrew and much prefer compiling from source so here goes. I’ve omitted the numerous error messages that drove me round the internet looking for solutions and instead present a copy/paste guide to installing lftp.

moving to octopress

Friday Jun 7, 2013

update ui elements from a background thread in ios

Thursday Apr 11, 2013

This is a weird one, yet not weird at all really. I was playing around with Grand Central Dispatch (GCD) in viewDidLoad:

dispatch_queue_t queue = dispatch_queue_create("com.codebrane.onlineTimeQueue", NULL);

dispatch_async(queue, ^{

  … some code to retrieve the time from an online service

  self.textField.text = responseAsText;


It worked fine when textField was a label but when I changed to use a textField to get the full response displayed, it produced this error:


Tried to obtain the web lock from a thread other than the main thread or the web thread.
This may be a result of calling to UIKit from a secondary thread.
Crashing now..

Silly me, I should have remembered you should update UI elements from the main thread:

logging in to a sinatra app with twitter and posting a tweet

Saturday Apr 6, 2013

I’ve been playing around with various integrations and decided to knock up a simple Twitter bunkup where you can login to a very simple Sinatra app using Twitter and send a tweet to say so. It’s very very simple as I wanted to concentrate on the Twitter integration rather than the app functionality. So how do you do it? First thing you need is a Sinatra app. I use rvm to manage dependencies so I like to create a .rvmrc file that loads the appropriate gemset whenever I cd into the directory:

The above will create a twitterauth directory, create a twitterauth gemset, install the required gems (note the high security on the twitter gem as it can do all sorts of things with your twitter account if you let it) and create an rvm .rvmrc file in the directory that will do the equivalent of rvm use 1.9.3@twitterauth every time you cd into it. The first time you cd in you’ll see gubbins about running the script for the first time and you have to choose to do so. After that it’s seamless and the gemset is loaded without any interaction.

The first time you cd into the directory after creating the .rvmrc file:

auditing provisioning with activemq and mongodb

Friday Mar 22, 2013

At the moment, Matrix provisioning which is based on Apache ActiveMQ has been trundling along for some time with some basic reporting. So recently I sat down with some quality coffee and some new experience of MongoDB to come up with a way of easily finding out the status of accounts. The current setup for provisioning Blackboard using ActiveMQ is shown below:

codeBrane on Github