Leaving Last.fm

I’ve spent 3.43 years at Last.fm, which seems almost like a lifetime. For a long time, I couldn’t ever imagine leaving; every morning I would wake up excited to go and face new challenges and do fascinating new things. In the last 6-12 months so much has changed, as Last.fm gradually slips out of being a startup to being a company that, for better or for worse, has to make some money. I will certainly think twice before working for a company that has anything to do with the music industry… it’s a pain of a situation.

I’ve babysat the wonderful creation that is Last.fm through launches (both expected and unexpected), crashes (always unexpected), overheatings (and break-ins, and power failures… All the kind of thing that should never happen to a datacentre) and plenty of blood, sweat and tears.

It’s been an amazing experience, working with some of the most amazing people I have ever met (some of which have come and gone), but it’s time for me to help another startup through getting up at 4am to fix databases and exciting scaling questions.

And that will be Etsy; another website that has an awesome product that I love, plenty of traffic and graphs that point upwards and a bunch of guys who are passionate and have an awesome method of working. I’m really excited about getting involved and learning things again, as well as enabling a different group of passionate users go about their day to day business. I’ll still be in London, but popping to NY on occasion.

Let’s hope the next 3.43 years will be just as exciting.

Fixing Android 2.2 Sync after Upgrading to Exchange 2010 SP1

Last night I upgraded my Exchange 2010 server to 2010 SP1. Unlike many other people’s experiences, this actually went rather smoothly, until I realised 2 hours later my T-Mobile G1 (aka HTC Dream) is no longer syncing my Email. I currently use Cyanogen’s Mod version 6 which brings the features of Android 2.2 aka Froyo to my poor ancient device (which I’m hanging on to because of the excellent keyboard!) and use the built-in Exchange ActiveSync (EAS) support to sync my email, contacts and calendar to my phone.

I read online about a few other people running Android 2.2 who had the same issue and some suggested it was a policy problem, so I deleted the default profile and recreated it, and deleted the device association on my phone and my account. Unfortunately this didn’t work either, leaving me with no email but more importantly, no contacts!

After enabling some extra logging on the server I could see it was unhappy about Android trying to get a folder sync without provisioning, but for some reason the device wasn’t attempting to apply the policy.

AccessState :
Blocked
AccessStateReason :
Policy
ResponseHeader :
HTTP/1.1 449 Retry after sending a PROVISION command
MS-Server-ActiveSync: 14.1

Curiously, enabling extra logging on the device just showed it successfully understanding the first OPTIONS request, then timing out.


[12:36:00] EAS SyncManager | !!! EAS SyncManager, onCreate
[12:36:00] AbstractSyncService | Testing EAS: example.contoso.com, domain\user, ssl=1
[12:36:14] AbstractSyncService | Validation (OPTIONS) response: 200
[12:36:14] AbstractSyncService | Server supports versions: 2.0,2.1,2.5,12.0,12.1,14.0,14.1
[12:36:14] AbstractSyncService | Try folder sync
[12:36:35] AbstractSyncService | IOException caught: Read timed out
[12:36:35] EAS SyncManager | !!! Eas SyncManager, onDestroy

Thinking I was going to have to apply my highly dubious Java programming skills to this solution, I downloaded the Android SDK and started up the emulator for 2.2. I attempted to set up my account on the emulator, and to my surprise it worked first time.

I can only imagine, Google have already patched up this issue and not yet released it, as the Android Open Source Project page for Mail.apk shows the last update 5 months ago. So I applied the best logic that I have as a Sysadmin… Scp the working Email.apk from the emulator to my server, and install it on my device. And it works! I lose the a few additions that have been made to the CyanogensMod version of Email.apk but I’d rather have it working.

If you’re experiencing this issue too and you want to apply my brute force method of fixing it and get your email syncing again, simply follow these instructions (you need root for this, but I suspect this is only a problem on modified builds):

  1. Download the 2.2 stock Email.apk from here using the Android browser. Don’t attempt to install it, let it go in to your download folder on your SD card.
  2. Open a terminal on your device. I use ConnectBot. Gain root using “su”
  3. Run: mount -o remount,rw /system
  4. Run: mv /system/app/Email.apk /sdcard/backup_Email.apk
  5. Run: cp /sdcard/download/Email.apk /system/app
  6. Reboot for good measure
  7. Set up your sync, and enjoy a refreshing beverage
    for your hard work

Disclaimer: I have no idea if this has any bad affects on your phone, your sex life, or anything and I make no guarantees about anything. If anything bad happens, it’s not my fault, you do this at your own risk! The process above makes a backup, so hopefully if you regret this you can put back the old version.