Install this theme
Running a sinatra app with rackup

We have some small sinatra apps that are used for integration testing, and bound with ShamRack. 

Today, I found myself wanting to run one of them as a standalone app.

I created a Rack configuration file, config.ru:

require ‘my_sinatra_app’

run MySinatraApp.new

And ran it inside my bundle with the rails script runner:

bundle exec script/runner rackup config.ru

Rails migration failing after adding new column

I had a problem this morning with a rails (2.3.11) project at work.

I had added a migration that added a new column to the Partner table, but when I tried to test all migrations by rolling back to version 0 and then forward, an EARLIER migration that inserted data into Partner. 

The migration was failing (against sqlite3), trying to insert a null into the column that didn’t exist yet.

Turns out the problem is that ActiveRecord caches the columns of the model objects, so winding them back to the start and re-running them leaves it confused about which columns should be inserted. 

The fix? As found here, add

model_name.reset_column_information

into the OLD migration before the failing insert. This forces ActiveRecord to reload the object metadata, and the migration will then work correctly. 

More information: 

http://apidock.com/rails/v2.3.8/ActiveRecord/Base/reset_column_information/class

Did the New York Times paywall cause downtime after the Osama story broke?

The announcement of a Presidential press conference late on Sunday evening drove a huge amount of internet traffic

The New York Times was one of the first places I went to in search of answers. (actually, the first place I went was Twitter, but that’s another story). In spite of presumably very high traffic, the site was loading pretty quickly. However, trying to click through to any stories resulted a redirect to an error page, which timed out.

https://myaccount.nytimes.com/auth/login?URI=/2011/05/02/world/asia/osama-bin-laden-is-killed.html&OQ=_rQ3D5Q26hp&REFUSE_COOKIE_ERROR=SHOW_ERROR

I was logged in at the time, so maybe that had something to do with it. 

The paywall is probably running on a different set of servers from the rest of the regular site, maybe they aren’t as beefy. 

In any case, at times of extreme traffic load, the New York Times are going to need a better solution. They can’t let the paywall block everybody off from their content.

Copying World of Warcraft install from PC to Mac OS X


He’s here to help.
Credit: Alain-Christian | http://www.flickr.com/photos/aseraphin/986724621/

This guide is for people who have a PC install of World of Warcraft and want to install the game on their Mac, without downloading 15 GB of game client again.

I tried looking for this in Google, and didn’t find anything useful. There might be some redundant steps here, but this is what worked for me:

  1. Download and install game client from the battle.net account page, eg: https://us.battle.net/account/management/download/
  2. Once the first part of the install has completed, it’ll load the launcher and start downloading a huge amount of data files. Quit the installer.
  3. Copy the “Data” and “Updates” folders from your PC WoW install into your Mac’s Wow install folder.
  4. Run the “World of Warcraft Repair” app on the Mac. It’ll think for a while and should finish with a “Repair successful”
  5. Run the “World of Warcraft Launcher” app on the Mac. It will download the latest patch executable, about 20mb or so.
  6. At this point World of Warcraft should be fully patched, with all content downloaded. Log in and enjoy!

Anyway, that’s what worked for me. Hope this helps someone!

Australian election roundup in UK press

Observer, p13: “Labor lead shrinks thanks to strong opposition campaign, concerns about climate change — and anger at treachery over dumped leader”

Independent, p23: “Budgiegate — one election too close to call, one pair of trunks (too small)”

Telegraph, p24: “amid disillusion with woman PM, election result leaves parties seeking allies to form a new government”

More soon…

Thrilling 6 second video of Australian election queue in London!

About to vote in Australian election in London.

About to vote in Australian election in London.

Greenland iceberg = 4 Manhattans in US media, 40 Ulurus in oz. This has taught me that 1 Uluru = 0.1 Manhattans. Or 1 dectihattens. (I got my figures wrong on twitter)

Sources: 40 Ulurus: http://bit.ly/doB2o7 4 Manhattens: http://huff.to/cW26tf