The surprising alternative to Data Loss

I've been fiddling around with various ways to back up configs and other small but important files (encrypted password safes, etc). I considered using S3, but it became a little to annoying (which is ironic, since a large part of my job over the last few years has been convincing people to use a particular kind of database for storage, when they're used to another kind).

I've recently been fiddling with Dropbox, which I had vaguely heard of before, but appears to now be not as terrible as it used to be. There also now appears to be a CLI version for linux, which means it's actually useful, and it also supports symlinks.

So, after installing dropbox on the various linux machines at home, and on the colocated boxes I have, it's a simple case of ln -s /etc /home/doc/Dropbox/cf/$HOSTNAME/etc and suddenly you've got a backup of /etc in the scary web 2.0 internet cloud we've all been hearing about.

As an aside, I paid attention to backups a little more yesterday, since my Drobo got unexpectedly powered off (possibly due to cat), and had forgotten its partition table when it rebooted. Just so we're clear, the Drobo is a terrible product made by an evil marketing company who ignore their customers, and I regret buying it. Don't make the same mistake!

I suspect my next step is to go pick up one of those fancy WD My Book DAS boxes. I think I'm a little tired of having a small aeroplane taking off under my TV.

EDIT: Did I mention Dropbox has an android app? Awesome.


This may be the Android I'm looking for

So, since the HTC Desire is coming out in Ireland as of now, I figure I'd stick up a short synopsis of my experience with my Nexus one, fiddling with it, and developing for it.

I got a Nexus One just before christmas, and spent the holiday period acclimatising. I had an iPhone, and was keeping it on standby in case Android sucked as badly as it did last xmas when I got a G1.

Thankfully, Android appears to have gotten its finger out in a big way. It's a lot zippier, and the SDKs actually support most of the hardware in the later phones.

The Evolution of Truly Smart Phones

I should explain -- I really like the idea of developing for a platform I use every day. I don't consider myself a 'developer', mainly because I couldn't code my way out of a wet paper bag. I'd consider myself a 'super-power user'. I'm not going to go rewriting drivers to do the right thing, but I am going to write a bunch of shell scripts to make my life easier, write some dinky scripts to do things I do often, and automate away what I shouldn't have to do myself. Until recently, that was how a lot of people dealt with, say, running a linux machine. You'd have your ubiquitous ~/bin/ directory with your safety nets in it, and that'd follow you around for years that turn into decades.

What I'm getting at here is that I've always wanted to do this with a phone. The phone is growing, and the laptop shrinking so that they will eventually converge. I predict that we won't even be calling the device in our pockets a phone within a few years any more. Back 6-8 years ago when I first started hearing about Python for Symbian S60 and such, that got a bit exciting. However, S60s python support was kind of a toy. It was the early-on "Hey, look at this, it's been done" sort of feature, and I was left feeling a little disappointed.

The G1 was similar. It's a phone, it runs linux. You can do stuff to it. However, you need to do stuff to it for it to be useful. You need to track a bleeding-edge release branch and occasionally brick your phone to get the good stuff done. Fuck that. I have things to do. I am a user, not a developer.

So, when I first looked again at the Android 2.1 SDK, I was pleasantly surprised. Hardware support, an application model that's easy to understand (differences of opinion about the efficacy notwithstanding). I can do this.

The Science Bit

Anyway, here are my cliff's notes on how Android is put together:
  • Applications are made up of Activities. These are dialog items, things that you see.
  • Messages are passed around using Intents. Some of these are Broadcast Intents any application can listen for (such as an SMS coming in, call coming in, screen actions, etc).
  • Applications can also have Services. These services may be killed by the OS at any time, but can be revived by Intents.
...and that's basically it. So, if you want to, say, write an app that saves all your SMS messages to a file on the SD card, you just write a Service that listens for the "SMS Received" Intent, writes the bundle of data that comes with the intent in the format you like to wherever you like. If the OS kills your Service, it'll be revived whenever an SMS comes in because it's registered as a listener for that intent.

Obviously I'm glossing over a lot here, but this is basically how it works. This is extremely powerful, and abstracts away a lot of the shite you have to deal with when writing code for phones, or in general (i.e. it's all in Java, and you just talk to the phone using Manager interfaces).

Does it make Calls, then?

Obviously, the SDK can be as nice as you like, but the handset also has to be nice. After the disappointment of the G1, I was extremely sceptical. However, the Nexus One is actually a damn nice phone. It's roughly the same size as the iPhone (i.e. it goes into my pocket) and its screen is very nice indeed.

As an actual phone, It's ever so slightly flakier than the iPhone. I've had it freeze up once or twice on me, when finishing a call especially. However, a couple of freezes I've caused myself, with apps that do stuff that blocks. However, what's supremely cool about the phone is that you can actually debug what's going on on the phone. Let's go back to our linux machine with ~/bin/ directory for a moment. Say the machine gets a little slow, or an application crashes and I'm not sure why (hell, I've had more than my fair share of app crashes on the iPhone). Step one is you reproduce what's happening and check some logs, right? Wouldn't it be great to be able to do a tail -f /var/log/messages on a phone?

You can do that, basically, with any android phone. Turn on USB debugging in settings, plug the phone in, and run adb logcat from the SDK tools directory. Suddenly you've got broadcast intents, service actions, and stack traces from Activities and Services that crash on the phone. That's before you write a line of code, you're able to find out exactly what your phone is doing. It's not just paying lip-service to running a closed and jealously protected linux kernel and userspace -- it's actually a linux machine.


My exposure to coding in Java was extremely rusty, and I originally set out to just fiddle around. There are a lot of tutorials on Eclipse setup and how to build packages and do various things. It didn't take that long, though, and there are enough examples out there to get you going.

I can't stress enough how easy it is to build apps, once you have your head round the execution model. I've done mobile development before, and nothing compares. I don't have to learn Objective C or anything!

After getting started, I had fiddled around a bit with Locale, which is probably the most powerful Android app I've run into. I was a bit fed up having people IM me on my commute and be impatient when I didn't reply on my phone while driving. I wanted to have Locale set my IM status to busy when the phone connected to the handsfree in my car. However, there was no Bluetooth plugin for Locale, in fact it was the most requested feature on their forum. So, I fired up eclipse, grabbed their example condition, and had a go, and it worked. I didn't get bored and annoyed fiddling with bluetooth libraries or drivers, I just wrote some classes to do the things required of a plugin,a nd there was minimum drama.

After dropping the one-off $25 on an Android Market developer account, I submitted it and it went straight up. It's on the market now, and as of this writing over 2,000 people have installed it.

Since then, I've gotten bored and written some more plugins. Right now, my phone manages my presence, setting IM status to where I am, busy/unavailable when I'm probably asleep (right now it's time-based, but when I get my WakeMate it'll actually be accurate). It silences my GPS and media when I'm on a call, and lets people at work know when I'm at my desk (and my phone is docked).

My iPhone got sold sometime in March and I've never looked back.

Ever since I got my hands on a Nokia 7110, sometime in 1998 when I was doing some neolitic mobile development for AOL, I've dreamed of a phone that doesn't do everything, but at least matches what you put into it with results that affect how you do things, and doesn't patronise you. Maybe the Nexus One is that phone, maybe a later device will be it. Maybe it'll be a tablet, or a cross between the two once digital paper gets robust enough. However, I'm pretty sure that if it's in the next few years, it'll be running Android.