Josh Price and his Robot Overlords

Preparing you for when the machines take over

Sensis API Hack Night

posted Wednesday, 30 November 2011

Hacking

Last week I tried something a bit different for the last Hack Night of 2011. Sensis sponsored the evening with the traditional pizza and beers, and most importantly the prizes for the best app/s using the Sensis API (SAPI).

Ben Wiseley whipped up a little ruby wrapper around the Sensis API and released it as a gem.

The voting was close and the winner was Vaughan Allan and Dave Parry with their app isnear.me. The way this worked was pretty sweet. Looking for a pub nearby? Type the URL pub.isnear.me into your browser and the app returns a map of results for pub near your location. Quick and very handy!

Several search terms are possible by adding more subdomains to the URL:

campos.coffee.isnear.me

The second place was awarded to Scott Harvey and Jules Parry for their rather creative "Geo-office-shootout". The premise of the game was to score certain workplaces by their convenience. This was calculated as a sum of how many pubs, cafes, gyms, restaurants, etc that were nearby a given office address.

Many thanks to SAPI for sponsoring the beer, food and prizes. As always thanks to the ever-generous Lachlan Hardy and Ninefold for hosting a great venue.

Permalink development, ruby, sensis, sapi, hack night

Mobile specific websites with jQTouch and Sinatra

posted Saturday, 06 February 2010

I've been looking for an excuse to try out the awesome jQTouch plugin. It's a jQuery plugin for mobile web development on the iPhone and iPod Touch. It uses plain old HTML, CSS and Javascript so it should also work well for other mobile devices like Android and even the iPad.

Peepcode has a great jQTouch screencast if you want the TopFunky to walk you through it.

I figured that since I built my own blog using Sinatra and a bit of code and inspiration from Tim Lucas, that adding a mobile version of this site would be a good place to start. Here's what I did to make it happen.

  • The first thing I did was to download the iPhone SDK. This gives you Xcode with the iPhone simulator so you can test your site locally. You can find the simulator here /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app

  • The next step involves using some of Lachlan Hardy's code for serving mobile pages in Sinatra. This is a small collection of helper methods that I modified slightly:

All you do is call deliver("template_name") when you want to render a template, and the deliver method will look for a template called template_name.mobile.haml if a mobile browser user agent was detected in the request. If one isn't there it will simply render the usua template template.haml

  • Next I added a layout.mobile.haml template
Permalink code, web, jqtouch, sinatra, mobile, iphone, android, jquery, ruby, haml

Today I had my first major issue working in my home office. Allow me to set the scene.

It's Sunday and we'd just spent a fantastic weekend on the northern beaches with some old friends who we hadn't seen in some time. This morning we had brunch by the beach and swam in the surf. Once we got back to their place I had a dip in their pool. I lay tranquilly floating on the surface in complete sunshine, staring at the Brobdingnagian swirls of dark cloud and listening to the not so distant thunder. It was sublime.

Now my wife Suzie and I are lucky enough to have enough space at the back of the house for a dedicated home office. I've just recently left my job at a global software consultancy and started my own software consulting business, and now rely on my office to do more important businessy things than before. Despite my keenest fantasies, it is not located in a cave atop the Himalayas. It is simply at the end of a very long house.

This is all very whimsical I hear you muttering but what's this got to do with the title of this post? Patience, Dear Reader, I will get to that.

Now. I needed to make rather an important work-related phone call. This is not a task that I want to be doing on a Sunday. However, since I'm new to the concept of running my own business, and thus in direct control of the revenues it may attract from time to time, the prospect was not entirely unexciting.

I had the laptop setup up perfectly on my desk, plugged into all its various peripherals. My notepad and pen was at the ready. A glass of chilled white at my side. I was just about to click the call button, when the sounds of a film score begun bursting into my office. This wasn't going to work was it? My wife loves her movies and was rather put out by the fact that she might not be able to watch the one she had just begun. Without a door to close, we were at an impasse. A Mexican standoff.

I cursed the portability of my laptop as I dragged it into the next room that had a door between me and the odiously non-portable television. I had my phone call, minus the soundtrack to my wife's movie, and it went rather well.

As I sit here writing this post, I'm using OmmWriter. I'm staring at nothing but white snow, two trees and my words. In my ears swirls the sounds of gently lapping waves and I've been transported simultaneously to my cave high in the Himalyas whilst re-experiencing floating on pool furniture. No distractions, other than the wistful fall of raindrops as my fingers touch the keys. Not even my wife as she watches movie trailers (loudly) a desk away.

1

Thank you OmmWriter for giving me back my focus. My office. And inspiring me to write the first blog post for quite some time...

Permalink ommwriter, writing, home office

Hubris: Calling Haskell from Ruby

posted Monday, 05 October 2009

Hubris

Hubris is a light-hearted name for a very interesting Ruby gem. It allows you to call Haskell functions from your Ruby code. This could be very useful for combining the strengths of both languages: Build stuff fast with Ruby, do the computational heavy-lifting in Haskell.

Check it out over at Github.

Mark Wotton has been working hard on getting this working with GHC and it looks like it's even closer. JHC used to be required for dynamic library support, but apparently GHC now has the ability in HEAD. Mark's post has more details

Permalink development, ruby, haskell, hubris

JRuby 1.1.6 now available on MacPorts

posted Friday, 13 February 2009

I love how easy MacPorts makes installing packages on the Mac. If you own a Mac and develop software you are probably already using it. If you don't you should take a look and see what you're missing.

But sometimes the packages are a little out of date. This happened to me with Mercurial when 1.0 was released, and I'm sure it happens to others from time to time. Next time it happens, you might just be able to do something about it...

Yesterday I reinstalled JRuby from MacPorts but I got version 1.1.5 instead of version 1.1.6 which I was expecting. Charles Nutter suggested via twitter that I chase it up, so I spent the morning trying to get the JRuby port upgraded to the latest version so everyone could share the love.

Here's what I discovered:

  1. The 1.1.6 port upgrade ticket had been filed a while back but wasn't closed and had apparently fallen through the cracks
  2. When raising a ticket for a port upgrade attach a unified diff, not the whole portfile (this makes it easy to see what changed). Follow these steps.
  3. If something is out of date then an email to the [macports-dev][contacts] mailing list will probably ensure it gets done

I jumped on the MacPorts IRC channel (#MacPorts) and the friendly guys gave me the above advice and made the change almost immediately.

How's that for service?

Permalink development, jruby, ruby, macports