@madpilot makes

Get all this summer’s cricket action – via twitter!

Are you a Australian? Are you a cricket fan? Are you on twitter? If you answered yes to all of these questions, you might be interested in the Twitter bot that I just coded up. Using the fantastic cricinfo.com website, some Hpricot trickery, the Twitter gem and some Ruby jiggery pokery you can get a ball-by-ball commentary of the Aussies beating everyone in there path.

So head over to http://twitter.com/baggygreen and get your summer cricket fix!

How it works:

  1. I used the WAP version of the cricinfo website, because the HTML is much simpler to deal with. First I find all games that Australia are playing. The front page has a list all all games in progress. Doing a string comparision, I grab the URLs to any Australian games.
  2. Using Hpricot, I parse the HTML from the commentary page, pulling out the score, overs, balls and commentary using X-path.
  3. I keep track of what I’ve already posted in a text file. Any new comments are posted to Twitter. If the script detects the end of an over, the score is posted as well.
  4. The script runs as a crob job every 5 minutes

Nice an easy, eh?

Update: Download the code! Excuse it’s less than optimal solution – it was hastily written :)

Blogging for Sitepoint

Is blogging about yourself blogging like Googling yourself? Whilst you ponder that thought, I should point out that there are a number of Perth web-types blogging for SitepointKay Smoljak is making Coldfusion cool again, Miles Burke is blogging about something (still waiting for your opening post Miles…), oh and some [hack][5] is writing about [Ruby on Rails][6]…

If you have any suggestions drop one of us a line!

[5]: “It’s me fool!” [6]: http://www.sitepoint.com/blogs/2007/10/15/ruby-on-rails-the-art-of-simplicity/

Web Directions over for another year

What a crazy week we have all had, a week of much drinking, socialising and occasionally learning stuff. Highlights from the second day were Andy Clarke, talking about layout techniques that can be stolen from comic books. Andy has such a effortless presentation technique and always presents beautiful slides and this year was no exception. Coming from a developer background, well presented design talks really interest me, as it is something I know little about, although there was quite a bit of overlap with some traditional user interface theories, which is what I did my honours thesis on.

Lisa Herrod‘s presentation on usability and accessibility was awesome – she tabled her idea for splitting up the official accessibility checklist between all members of the design team, emphasising the the point that it isn’t just the front-end developers responsibility. Quite often there is the situation where the copywriter, for example, will drop the content on the front-end guy, thinking there job has been done, which isn’t the case.

Finally, Mark Pesce who is an amazing speaker presented the awe-inspiring final keynote about mob rules. Basically, he noted that the internet finds a way to route around not only technical issues, but social issues such as censorship. He made mention of companies that were quietly chipping away at the traditional network infrastructure giants not with large amounts of money, but having many individuals helping out. Everyone was mesmerised.

Although, from a technical point of view many of the presentations were aimed at the beginner to intermediate level, there was much to be learnt from listening to what the presenters weren’t saying. Picking up little tidbits about what happens behind the scenes is what has inspired me. That and all of the adhoc discussion that goes on over beers.

And beers we had. Sydney has much cheaper beer prices than Perth and coupled with free beer almost every night, the pub was a very popular destination. Wednesday night was Port80 Sydney, and myself (under the guise of 88 Miles) and Adrian sponsored the bar tab. What we didn’t know was the Quarrymans’ hotel has Wednesday night trivia in which Port80 entered two teams, one of which can second. Nice work.

Thursday night drinks were provided by Adobe at the conference venue, and the Friday night closing party was lubricated by Microsoft. Andrew Krespanis managed to drink a Windows XP Home license. Myself, Grant and Joe (from Hive Media in Melbourne) stayed up at all hours on friday discussing all things web from Flash vs AJAX to running a web business. It is amazing discussing things with people that really know what they are doing.

Saturday, I headed over to the Nerf Palace to hang with a number of the Ruby on Rails Oceania clan as well as some of of the Sitepoint boys for some impromptu hacking. I decided to see what all the fuss was about by working on an iPhone/iPod Touch version of 88 Miles. Thanks must go to Tim, Cam and Mike for letting us take over their house. After this we quickly scurried over to WebJam!

Once again, I thought I would get up to the plate and present. Nick Cowie was the other local to to the three minute thing. There were some amazing talks –  Dmitry Baranovskiy presented his microformat validator, which is going to revolutionise the way we use microformats, trust me. Myles Burne showed the power of YAML and HAML and some guys from Digital Eskimo spruiked their site lobbying for the government to improve the NSW liquor licensing (Sounds like something we should do in WA). Unsuprisingly, Dmitry won – more suprisingly, my AJAX-based front end to the Ruby on Rails debugger came second, which means I can get $150 worth of Sitepoint schwag and I get to go back to Web Directions for free! (Again!) I’m publish and release the code soon – just got some clean ups to do.

So as you can see – a pretty crazy couple of days. Now to let my liver recover!

Rails were rumbled. Voting starts tomorrow

There is something obtusely magnificent about locking away geeks for long periods of time, giving them a laptop and a kick-arse framework and leaving them up to their own devices – which is what Jordan Brock, Matt Didcoe and myself did last weekend for Rails Rumble ’07.

The idea is simple – You have 48 hours to create an entire website in the ever so beautiful Ruby on Rails framework. Because the competition was run out of the US and because we have real jobs/school to go to, we only ended up with 36 hours, but we didn’t let that deter us. The result? Sandwich – a recipe sharing site. During that time, we managed to product a site with friending, tagging, bookmarking and recipe parsing which is no mean feat – I dare anyone to do it in another language in that time frame.

Part of the competition is the community judging, so help a brother out and head over to our voting page and throw us a few votes – you can make a difference in the lives of three hapless codies. Go on. I’ll wait… While you are there, go check out some of the other great entries, but don’t vote for them, because you are voting for u, remember? :)

It was a really fun weekend – it was great to kick out some great code with great peeps over a stupidly short time frame. We must do it again sometime.

Are you ready to RUMBLE!

This weekend Jordan, Matt and myself will be participating in w. Rails Rumble is an international geekfest where you have 48 hours to develop a Ruby on Rails application. We are at a bit of a disadvantage because of the timezone issues mean that we really only have 36 hours (We have to do some real work on Monday you know!).

We will be building a top secret social network, so watch this space as we post updates of our progress!

Prezz E Place goes live

Even though I left Bam two weeks ago, we have been covertly finishing off one final client project together – Prezz E Place. Prezz E Place is an online gift shop for those people how are too busy or phsyically can’t get to a shop to buy that special gift. It features a “dreamboard” where users can place products they would like to receive as well as a built in anniversary reminder system.

Prezz E Place is built in Ruby on Rails and took just over 150 hours to complete. From a technical point of view it utilises the Ferret search plugin for all of the product search, un-obtrusive JavaScript, SEO friendly URLs, plus some of the regular plugins I use such as action_mailer_layouts, custom-err-msg and paginating_find.

Let me (or Bam) know what you think!

The new AWIA (formally known as Port80) Website is live!

After a number of late nights and long hours, the volunteers on the AWIA committee have flick the big red switch on the brand-spanking new AWIA website.

The new AWIA Website{.imagelink}Thanks to Adrian Lynch for the design and Alex Graham for the HTML/CSS trickery – the site looks great!

My contribution was the Ruby on Rails powered membership system and podcast section (As a added benefit, you get to hear my dulcet tones on the first set of Port80 Mini-talk podcasts). The membership system now allows members greater control of their accounts and uses a secure credit card facility, rather than a third party payment site. If you are an existing member, you should have received a email with your password.

This is the next step in promoting the new AWIA brand. The year looks very exciting for AWIA, with plans for another Ideas event, the WA Web Awards and perhaps some other events. It also looks like the Brisbane and Adelaide chapters will be starting up this year as well. If you aren’t a member and you in the Australian Web Industry, maybe it is time to join up?

So what do you think?

Latest 88 Miles release…

In between my day-to-day job and being sick (Damn you tonsils), I’ve managed to get some more work done on 88 Miles. This release was mainly an internal update, however there are a couple of important, if not major external changes.

  1. Business accounts are now out of beta – there are a variety of plans which should suit most people and you can easily swap betwen plans at your whim. There is even a discount for paying yearly! Check out the pricing page for more details.
  2. The trial account has now become a free account! There is now no account expiry date, and you can do all the things that regular accounts can do, including adding unlimited staff members. The only catch is that you can’t clock in more than 40 hours per month. All of the expired trial accounts have been re-enabled, so if you have signed up before but ran out of time, login again and see what has changed.
  3. The reporting system has improved – you can now view graphs in the project summary view

I would really love some feedback on the system, so if you haven’t had a play with it in a while, or if you have never had a play with it, go and login and show yourself around :)

/End selfless self-promotion

Setting up a Rails app on a Media temple grid server

Now that I’m back from Sydney, I have had a bit more of a change to play with my shiny new MediaTemple grid server account. It looks like I will be pushing 88 Miles over to it over the weekend – everything is setup and ready to go, and just have to do the migrating. I though I would share with you a few thinks I found out along the way…

Setting up the Rails environment

The instructions on the media temple site are pretty good, there are just a few caveats I would make. Firstly, I’ve now started using capistrano to deployment, so I decided to change a few of the directory structures away from how MT suggests. The steps I took are as follows changes from the MT instructions are emphasised (replace testapp with you apps name – obviously):

cd $HOME/../../containers
mkdir rails && cd rails
mkdir testapp && cd testapp
mtr add testapp $PWD/current

For those of you playing at home, you may have noticed that the /current directory, doesn’t yet exist. Correct! This will get created by capistrano.

Setting up Capistrano

Everything was pretty straight forward in the deploy.rb file. The only gotchas I cam across were specific to my installation:

If your svn repository has a space in it, wrap it in single quotes when assigning the :repository variable, i.e:

set :repository, “‘svn://svn.server.com/path/to/your repository'”

If your svn repository requires a username and password for checkout or export, use the :svn_username variable, i.e:

set :svn_username,
Proc.new { “username –password password” }

The only other modification I needed to make to the deploy file was the addition of the restart task. Because MT uses custom scripts to restart containers, the restart script needs to call them reather than trying to mess with the Apache or Mongrel processes. I also discovered that my secure certificate wasn’t functioning correctly (I’ll explain why in a second) so there is a fix for that here as well.

desc Restart the rails container
  task :restart, :roles => :app do
    run mtr generate_htaccess test_app
    run echo RequestHeader set X_FORWARDED_PROTO https env=HTTPS >> #{deploy_to}/current/public/.htaccess”
    run mtr create_link test_app
    run mtr restart test_app
  end
end

Line 3 uses a MT script to make some modifications to the apps .htaccess file. Because Mt proxies all requests to the apps Mongrel server, the standard .htaccess doesn’t cut the mustard.

Line 4 makes another modification to the .htaccess file. Because I’m slack, I pull a neat trick when I do SSL. I maintain a global list of pages that require SSL – when a user browsers to that page, they automatically get redirected to the secure version if required. And the same works the other way – if they browser away from a secure page to a non-secure page, they get re-directed to the non-secure version. Unfortunately, because of the way MT proxies the request, the Mongrel server knows nothing about whether the connection is secure of not (i.e request.ssl? always returns false). Thankfully, there is a fix for this in Rails – if you include the X_FORWARDED_PROTO=https header in the request, rails knows what is going on. This line checks for the environmental variable HTTPS (Which is a flag that is set if the server is in SSL mode) and if it is, sends the modified header, which makes everything good again.

Line 5 links the web directory to the rails container and line6 restarts the server. Nice and easy!

MediaTemple’s new grid server services

What can you get for $20 per month these days? A Basecamp account? 4 88 Miles accounts? An account of a Grid server with 100Gb of disk space, 100Tb of traffic with support for upto 100 sites? Yeah. Media Temple has just released an insamely priced grid server setup that offers all of that FOR $20 PER MONTH. They even support Ruby on Rails using containers and mongrel. Needless to say, I signed up for account. hopefully it will come through before I leave for Sydney tomorrow afternoon, otherwise I’ll have to wait a week to play.

What is a grid server?

A grid server is basically lots of little servers that acts like one big server. This means that if a server becomes loaded, they can through more hardware at the problem. Google and Amazon use similar systems, infact Amazon offers a service where you can upload a virtual linux machine on to their grid.

If they pull this off, it will pretty much revolutionise server hosting. I’ll keep you posted how I go with my 88 Miles migration.

Previous Next