Archive for the ‘Developer’ Category

April 19 2009

Windows, Rails 2.2+, InstantRails & MySQL: bundled mysql.rb driver error

by Hang

If you get the error:

!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please
install the mysql gem and try again: gem install mysql.
rake aborted!

Here’s what happened.

Windows, InstantRails & Rails 2.2+ will not work out of the box

gem install mysql will successfully install the gem but then silently fail if the gem cannot find MySQL. Because InstantRails is designed to install cleanly, it doesn’t modify your path and so gems cannot find the MySQL path. To fix this, go to Control Panel->System->Advanced System Settings->Environment Variables->Path and add C:InstantRailsmysqlbin & C:InstantRailsrubybin to the path. Restart everything that can be restarted and try again.

Windows, Ruby, MySQL 5.1 & Rails 2.2+ will not work out of the box.

Install MySQL 5.0 instead.

either of these should fix the problem.

April 14 2009

Gmail sent mail spam

by Hang

I just noticed an interesting new spam tactic. Spammers are now injecting spam into my Gmail sent mail folder. I view all my mail through thunderbird and my sent mail folder currently has 26 unread messages. Inside the folder, I see several messages sent from me to me with typical spam contents (Hollywood stars threw up! is a sample subject). I’m not familiar enough with the intricacies of SMTP or IMAP to figure out exactly what’s going on here but I’d be interested to hear how this was done.

February 23 2009

no provisioned iPhone device could be found

by Hang

I occasionalyl get this error in XCode. A quick reboot of the iPhone seems to fix the problem.

February 7 2009

Rails without Rails

by Hang

After working for a while on my first non-web based ruby project, I’ve tried to integrate nicely with a number of different components which I was already familiar with within the rails environment like ActiveRecord. Having struggled a bit with the pure approach, I wouldn’t reccomend it.

Instead, what I’m doing is just spinning up an empty rails instance and just ignoring all the web based stuff. That is, I’m not spinning up a passenger instance, my app folder is empty but I can still access everything else inside Rails like:

  • ActiveRecord
  • Migrations and rake tasks
  • ruby script/console so I can interactively poke at the db
  • ruby script/runner to spin up my server
  • All the rails based testing frameworks

So even though it’s a bit more messy, it ends up saving a lot of hassle in the long run. So much for modular design huh?

Evidence that opt out ads aren’t harmful

by Hang

A few months ago, I wrote about a better way of serving ads by replacing the ad with a donate button. A recent Wall Street Journal article reports that wikiHow also recently started doing opt out ads and their revenue dropped less than 1%. I wonder if they’ll also include a donate button?

January 15 2009

Evaluating Languages

by Hang

I suppose I should be writing more about the work that I’m actually doing since a) it’s the actual purpose of this blog and b) it’s far easier to write about. Today, I’ve been evaluating languages for this new project I’m working on which all I can talk about at this point is that it involves iPhones and a server. The iPhone portion obviously has to be written in Objective C (on which I’ll have more to talk about later).

Because I’m coding for myself, I have the luxury that my number 1 criteria for the language is that i enjoy coding in it and so I’ve narrowed the list down to a shortlist of contenders based on a number of criteria:

  • Strong and natural support for functional programming without getting in the way of actually getting work done. I’ve dabbled with functional programming on and off for a number of years and I think I’ve gotten my head sufficiently wrapped around the paradigm but I’ve yet to dive in with any serious gusto. This seems like a good project to make a serious push towards significant use of the functional paradigm
  • Abstractions for elegant horizontal scaling. Tying in with the functional aspect, the ability to at least do dumb scaling in the horizontal direction without significant rework would be a major win. I don’t know how successful this application will be and my opinion is still that thinking about scaling is a case of premature optimization but it seems plausible that properly engineered, this app should be naturally built to scale.
  • Rich library support. This is kind of a no brainer and one that’s unfortunately got nothing to do with the actual language itself. I’ve had to eliminate many beautiful, clever languages from the running because of this.
  • Good tool support. I’ve an unavowed IDE slut. Talk all you like about how you can configure emacs to give you blowjobs on demand in only 8000 lines of elisp, I’m just not smart enough to handle that sort of thing. I love my auto complete, i love my step through debugger and I love one button source control integration. You can talk all you like about how the standard library is so small that it can be memorized in a day, I’m 3 weeks into programming Obejective C and I *still* need to Google for the command to turn a NSString to a CString and vice versa.
  • Great documentation and tutorials. I happened to start working on Ruby on Rails during the great 2.0 upgrade and the mishmash of confusing 2 year old blog posts and scant API docs made it a major pain in an otherwise wonderful framework.
  • Interactive console. I’ve found the best way for me to get my head fully around a concept is to play with it a bit in an interactive console with some toy examples.

Based on these criteria, here’s my shortlist in order from most to least likely:


Python is a language I’ve never touched although it’s always been one I’ve felt like I should know. From what I’ve seen of random code samples I’ve come across, it’s as nice as everyone keeps telling me it is and I doubt the learning curve will be that steep after having learnt Ruby. From what I’ve seen, Python supports functional programming just a wee bit better than Ruby does and the way it chooses to express it fits my style better. Like Ruby, it’s roots are in the hippie open source/linux world which means I have to deal with all the tireless ideological crap that comes along with it. Not a big deal but one to consider.


One major advantage with Ruby is that I already know it so I can hit the ground running. Half of my current prototyping is done in Ruby already and the language attracts a lot of smart people which makes keeping up with it actually intellectually stimulating rather than overwhelming. It also seems to have the nicest testing facilities of all the languages and the most scarily powerful metaprogramming.


The other language I’ve been doing prototyping in, I have a lot of love for C# and it’s a beautifully designed language although from a completely different design philosophy for the Perl/Python/Ruby crowd. One major advantage of working with C# is that I get to work inside Visual Studio, my absolute most favourite IDE in the world. Static typing also gives me autocomplete that doesn’t suck and the corporate backing that C# has means it has absolutely staggeringly fabulous documentation. Since .NET 3.0, C# has apparently gotten some pretty nice functional support although I’m not sure how elegantly it integrates with the rest of the language. I’m curious to check out F# and leveraging the strengths of each language. I’ve downloaded the F# runtime a few times but have never worked up the incentive to learn the thing. It’s an interesting possibility.


I keep on hearing Groovy and Scala are the next big thing for all the cool kids but I don’t even know what they are yet let alone what they’re good for. Still, it would be an interesting chance to learn. I dislike the wordiness of Java but the ability to use any JVM library is an intriguing possibility. I’ve also never worked on a project using multiple languages before and I’d like to see what that would be like.


I have a special affinity towards Haskell as it’s the first programming language I’ve ever learnt and I became somewhat spoilt as a result of it. Still, I haven’t even scratched the surface of it and I’ve so far failed in my many attempts to grok how monads work. This blog post at Integer Overflow really sold me on the viability of Haskell as a serious albeit choice. Frankly, the ability to code search based on type signature is just so nifty that it’s pushing Haskell way up on the list. I would love working in the language but my only concern is whether it’s sufficiently flexible to adapt to the kind of work I want it to do.


We worked with Erlang in a distributed systems class in undergrad and my impression of it then was that it was a beautiful idea marred by poor language design. The weird syntax and lack of first class functions in Erlang was a majorly baffling design decision and made programming ugly and painful. However, it’s an intruging choice based on it being designed from the ground up to scale.


I can write some lisp and understand the rudiments of the language but Lisp nerds annoy me. I would love to code something in Lisp in theory but I very much have not yet found something in practice which I would want to code.

Over the next couple of days, I’m going to do a lot more reading and digesting of the various languages, mainly as an excuse to take a kind of “holiday” away from coding and I’ll be updating on the various things I’m learning. Now… onto Real World Haskell.

December 23 2008

Some tips for jailbreakers

by Hang

I’ve been developing a few ideas for iPhone applications and the app verification process is taking so long that it was just easier to jailbreak my phone than wait for Apple to finish “verifying” me. The applications for jailbreaking the iPhone all seem very well designed and easy to use but the documentation surrounding them is lacking. Here’s some tips that could save you a great deal of stress in case you decide to jailbreak your iPhone:

  1. If you care at all about how your apps are arranged, write down the order your apps appear on a piece of paper or something. The reason for this will be apparent later on.
  2. There’s no way of irrevocably damaging your iPhone via this procedure. No matter what happens to it, there’s always a way to get back to a virgin state so take a deep breath and chill if something unexpected happens.
  3. Backup your iPhone via iTunes immediately before jailbreaking it. To do this, right click on the phone and select backup
  4. Run through either Pwnage Tool or QuickPWN and follow all the steps. Hopefully, you should have a fully jailbroken iPhone at this step.
  5. If your phone comes out of the jailbreak at the apple boot logo screen and continually restarts, see this post for a fix
  6. If anything goes wrong with the jailbreak, you can always restore your phone to it’s original settings but the only thing that mysteriously seems to not get remembered is the order your apps are in, hence the handy cheat sheet.
December 23 2008

How to recover from an infinite boot loop after QuickPWN

by Hang

If, after a jailbreak, you’re experiencing your iPhone continually being stuck on the Apple boot screen and restarting every 10 – 15 minutes. The problem comes from one of the apps on your phone being incompatible with the jailbreak.

Here’s what you need to do:

  • Press the power and home button simultaneously for 10 seconds to shut off the phone.
  • Hold down the home key and plug your iPhone while keeping the home key pressed
  • Go into iTunes and choose to restore your phone
  • In the Application tab of your phone in iTunes, deselect “Sync Applications” and choose apply. This will uninstall all apps from your phone
  • Run the jailbreak software again

This fix worked for me but I can’t guarentee that it will work in your case. Please post a comment if you’re still experiencing this problem.

November 18 2008

“Remember me” sucks at remembering me

by Hang

Why does remember me tend to work so universally poorly? WordPress for example, is a particularly irritating case, logging me out seemingly at random. Some sites manage to get it right, facebook almost never logs me out. Is there some subtle issue with cookie management that most sites manage to get wrong?

Coupled with this, what’s the basis for remember me only lasting a few weeks? Is this a legitimate security feature? I don’t really see the basis for it. If I check remember me, I want the site to remember me until I am old and grey (or at least until 2038).

October 21 2008

Oct 21st (day 9): Test driven management

by Hang

Mike Burns has some interesting thoughts on how non-testing code is trivial and it lead me to thinking about placing testing above development in the corporate heirarchy. In a normal organization, people start off in testing and maintenence and then only move up to development once they’ve proven their chops.

What I am envisioning is that everybody starts out as a developer and the development work is considered trivial and mindless because it’s aimed solely at passing tests. Once you’ve proven yourself as a good developer, you get promoted into testing. Once you start testing, you can’t ever write code again on that project and the job of the testers is to make the developer’s lives hell by making sure the code base is rock solid.

This has a number of nice features that I can see: First of all, it replicates the common “hazing” pattern that we know reinforces group solidarity. The job of the senior members is to make the lives of junior members horrible and junior members put up with it because they know some day they will get to do the same. (As an aside, there’s an interesting educational theory which says that bullying is a product of an age segregated education system. Before mass public education, children mainly interacted in mixed age groups with status based on age which was far more egalatarian because everyone at some point got to be the alpha of a group)

By forbidding testers and developers to communicate except through a chinese wall, it encourages both groups to form a unique culture and language which further enhances solidarity and cohesion. Additionally, the develop–>test heirarchy naturally encourages an evolution into develop –> test –> design which can allow for a much more organic growth into a design oriented company.

Of course, there’s a few downsides to this management structure as well: Development inherently requires more technical skill than testing and so it’s an inefficient use of expertise as those most competent at developing will be siphoned off. Additionally, not everyone is equally adept at both soft skills and hard skills and having a promotion path that moves from hardcore technical skills to people skills is only suitable for some people.

Say you’re a hardcore algorithms guy who loves working on scalability problems. You don’t want to move up to testing, testing is boring to you. Whats more, even if we let you become a senior developer, you’re going to get frustrated because all the smart programmers under you are going to move on.

Test driven management seems like an interesting way to structure a company and I’d be interested in hearing examples of people who are using something similar to this sort of approach.

Copyright ©2009 BumblebeeLabs — Theme designed by Michael Amini