my recent reads..

gitfall#1: Falling off a branch

Ever had a merge fail with a fatal: git write-tree failed to write a tree message out of the blue?

It sounds terrifying, but when I got the root cause is quite mundane: file name conflicts in the merging commits that git is not smart enough to figure out without help. And when you fixup your merge, you are left with a commit that's lost one of its parents ("falling off a branch").

If you do much file reorganisation in a project with branches, it turns out this can be quite common (had it a few times on a recent project).

In an attempt to understand exactly what was going on, I put together the steps needed to reproduce and recover from the error. I've tidied these up and made it a full "tutorial/demo" script. You can find it in a repo called gitfalls - in the expectation that there are many more git curiosities and idiosynchrasies worth a similar treatment. Enjoy!

The script not only shows how to create the error, but two ways of resolving it and the "lost parent branch" issue:
  1. Merge again after fixing the first failed commit. Duh!
  2. Going a bit deeper and using git commit-tree to manufacture a new merge commit with the correct parentage

Lessons learned form all of this? Perhaps:
  1. Avoid reorganising folder structures using folder names that once were used by files (or vice versa)
  2. If you must do such a reorganisation, immediately merge or cherry-pick to other active branches if you can. This avoids laying a trap for a co-worker to hit later on.

Hope you enjoy the script, and if you have any others to contribute please be my guest!

Blogarhythm: Fall Out - The Police




read more and comment..

Mikko Hyppönen@TED

Doing more than just talking about viruses: he fires up a few classics in a DOS box and pokes around with a binary editor before looking at current threats and live infection data. Very cool and entertaining. Not many are brave enough to do live demos, but if you watch to the end you'll get to see how prepared he was for failure;-)

Best served with sides of:

  • Daniel Suarez's Daemon - for the extreme version of how bad things can go wrong,
  • Rebecca MacKinnon: Let's take back the Internet! - because maybe organised crime is the perfect distraction as we rush headlong to enslave ourselves to the Sovereigns of the Internet, and
  • Security Now! #291 - for Steve Gibson's deconstruction of stuxnet, the most spohisticated Internet-borne "weaponised payload" ever discovered... and perhaps a plausibly-deniable warning from Government(s) that "you call that a knife? THIS is a knife!"



PS: better quality vid on youtube. And yes, that is a 5 1/4" floppy.

Blogarhythm: Security - Jo Jo Zep & The Falcons
read more and comment..

It goes PING!

If you're like me, you have a bunch of trusty (and rusty) shell scripts that you reach for when doing things like testing a new load balancer.

Enough of that! igp (It goes PING!) is a simple command line utility for testing services with a range of common protocols: ICMP, UDP, TCP, HTTP/S, LDAP/S and so on.

This is nothing earth shattering I know, but it's nice to have simple cross-platform (since it's ruby) tool that does all the common protocols in one. Thankfully, most of the work has already been done by the net-ping library - igp really just provides a sleek command-line wrapper.

The only dependency is ruby+rubygems. Just:

gem install igp
And then you are ready to capture traces, for example:
igp my.server.com
# ^ ICMP assumed by default. This is the same as:
igp icmp://my.server.com

igp http://my.insecure.server.com
igp http://my.insecure.server-hiding-on-a-funny-port.com:8080/javascripts/all.js

igp https://my.secure.server.com
igp https://my.secure.server-hiding-on-a-funny-port.com:4443

igp tcp://my.tcp-service.com:9091
igp udp://my.udp-service.com:123

igp ldap://my.insecure.ldap.server.com
igp ldaps://my.secure.ldap.server.com


Blogarhythm: Keep it Up - Snap!
read more and comment..

Multi-tenancy with Rails

RedDotRubyConf 2011 in Singapore is over. It was an amazing event (ryan takes notes so we don't have to - day#1 day#2)

Somehow I managed to cheat my way into a line-up of legendary speakers that included Matz himself. Here are the slides..


I spoke about multi-tenancy - what it is and why it's increasingly relevant for Rails development. It dives a little into four of the many approaches and ends with the challenge: Isn't it about time there was a 'Rails Way'?

Blogarhythm: So Many Ways POP DISASTER
read more and comment..