Archive for September, 2007

Locked out of the Amazon Start-Up Challenge

Monday, September 17th, 2007

Last week Amazon announced “Start-Up Challenge“:

Amazon Web Services (AWS) is searching for the next hot start-up that is leveraging AWS to build its infrastructure and business.

Do you have a great idea or an existing application that uses services from AWS? Enter the AWS Start-Up Challenge to win $100,000 in cash and AWS credits, and receive an investment offer from Amazon.

This got me all excited because I LOVE AWS! I use S3 for backup  (both personal and for live database backups) and the message-queue service is forming up to be an integral part of my “Secret Project” architecture. The money would keep me rolling for 12 months at my current burn rate too.
So I just went to register and realised that I am locked out of the challenge because I am not a US resident.

 Curse my antipodean geography!

Mock testing with mocha

Wednesday, September 12th, 2007

Mocha is a library designed to let you mock objects in your test environment. It’s very useful for testing around external dependencies

Inside one of my controllers I am calling a SOAP Service:

message_result = SOAPService.send_message(message)

This leaves me with a problem in my functional test - external dependencies are not conduive to self-contained test. Enter Mocha to the rescue!

Mocha lets me create a stub for a method on any instance of my object. This means that I can intercept the calls in my test, without needing to touch the code inside my controller.

SOAPService.any_instance.stubs(:send_message).returns( MessageResult.new )
get :respond
assert_match(/1<\/status>/, @response.body)

The get :respond call above would normally invoke a SOAP call, but using any_instance.stubs(:send_message).returns( MessageResult.new ) means that the SOAPService.send_message method now will return a new MessageResult. My controller doesn’t care and now my functional test is tight and focussed, and tests the controller logic without the external dependency being a factor.

Did you find this Ruby on Rails article useful? Why not recommend Toby at Working With Rails?

RailsRumble: distro decisions decisions

Friday, September 7th, 2007

I received my Linode account for the Rails Rumble.

I logged in and the first thing I have to do is pick the Linux distro I want to install and use for the Rumble.

There are far too many options!

The available distros are:

  • Arch 0.7.1
  • Debian 4.0 (Etch)
  • Finnix 86.1
  • Ubuntu 6.06
  • Ubuntu 7.04
  • CentOS 5.0 (RHEL rebuild)
  • Fedora Core 6 (FC6)
  • Slackware 12.0 (-new-)
  • Mandrake 9.1 (Bamboo)
  • Gentoo Linux 2006.1

I’m not really a systems person … I know my way around Linux, but I don’t have a whole lot of experience setting a machine up from scratch. I’ve been lucky that for the last several years I’ve worked with truly awesome sys admins who take care of all this stuff for us.

So what to use?

I am leaning toward Ubuntu 6.06 (Dapper Drake) because it looks like there are some good tutorials around (I even think the Peepcode guys have been using Ubuntu for some of their work - it might be time to subscribe).

Any ideas are appreciated. I am definitely going to learn a lot this weekend.

Facebook Apps are very hard to debug

Tuesday, September 4th, 2007

I am working on a Facebook Application for a client and although the Facebook API itself is rich and elegant, debugging the app is very difficult. Facebook uses it’s own markup called FBML, which is pulled from your app, translated into HTML and Facebook commands and then displayed. This means that applications have to actually run on a remote server that is accesible by the Facebook back-end.

The development process reminds me of the halycon days of my J2EE days (test,fix,build,jar,war,ear,undeploy,waitdeploy,wait,swear):

  1. Make minor change in code
  2. Push the change to the server
  3. Undeploy the application from the test Facebook profile
    1. Remove application
    2. Delete all sessions and cookies
    3. Clear the local database
  4. Redeploy the application
  5. Find another ******** problem!
  6. Repeat

There has to be an easier way. I am going to look at some DNS magic so I can develop on my local machine and point Facebook to it. Problem with that, of course, is you need to reconfigure the application so the client can see it on a public server. Or run your dev box as public a server.

RailsRumble Notes - WoR! by self.Team

Saturday, September 1st, 2007

You can find all my notes for the RailsRumble in Backpack.

I changed my mind, I am going to keep my notes here in the blog.

Go self.Team!