Thursday, March 12, 2015

A little Ruby trick to DRY up your Gemfile

Here's a trick I learned today

The Problem

You've got a Ruby on Rails project with a Gemfile and a .ruby-version file at the root of your project, and, as is quite normal, your Gemfile contains the line ruby '2.1.0'. Now you want to update Ruby to 2.2.0 so you have to remember to change both the .ruby-version and the Gemfile which is a PITA and not especially DRY approach.

The Solution

A Gemfile is just Ruby, so instead of saying ruby '2.2.0' use ruby File.read('.ruby-version').match(/(\d+\.\d+\.\d+)/).to_s instead. This will read the Ruby version info directly from your .ruby-version file and save you some hassle.

Neat huh.

Thursday, September 09, 2010

A suggestion for Apple's Numbers app

I totally love Numbers as a spreadsheeting app. Sure some people moan about a lack of pivot tables, whatever the hell they might be, but for me it's perfect and works the way I like to think, that is, all over the place and visually.

I used to love Excel but could never go back.

But more and more I find I'm building a lot of spreadsheets where I need to be able to show various scenarios based on various changes in prices outside of the control of my model. (eg exchange rates). This is not uncommon and more that once my colleague Ross and I have moaned about the absence of probabilistic range fields in spreadsheets. And today, as I hit the same issue again, I finally did something about it and sent the following Numbers enhancement request to Apple. I have no idea if they'll read it, or even care, but if they did adopt this idea I'd be thrilled as for me, and for many others, this feature is a missing killer feature in spreadsheets.

Dear Apple,

I'd like a cell that let me input a range (optionally with a probability curve) and any formula that linked off of that cell then also displayed things as a range (it could be coloured, or ignored like a quantum property and be in a superimposition of all states in the range, and only revealed when observed)

No spreadsheet system allows for this right now and I end up resorting to very clumsy workarounds for what, in an uncertain world, would seem a totally obvious feature.

Add that as a feature to the next iWork and you could advertise it as "Spreadsheets for an improbable world."

It's certainly thinking differently.

I hope you see fit to adopt this suggestion as I think it would be a totally killer-app feature for many many people trying to model uncertainty.

Cheers Dave

Wish me luck friends.

Wednesday, September 08, 2010

Let's be Frank (Sinatra)

I've got some spare time these days and my wife has, graciously, agreed to support me while I learn some new stuff. Namely Objective C and Ruby. More on my Obbjective C and iPhone ambitions later however, for now I want to introduce a little project called Frank.

How awesome is Ruby! And how amazing is the Sinatra web application language built on top of Ruby? It took me two days, starting from hardly ever having coding any Ruby, but I have a working micro-web app framework with user login and some unit tests built on Sinatra and Active Record.

I've opened a project in GitHub called Frank and now aim to round this out to be a well documented canonical example.

Frank is intended to be a very simple but feature complete web-app built on top of Sinatra that provides simple user login, password reminder, and user email verification with support for simple roles. It is intended to be used by other developers as both a well documented example of Sinatra in use, and a starting point for others wishing to implement simple web apps very quickly.

If this sort of thing interests you, and you'd like to contribute to the project at all, please get in touch via GitHub.

Saturday, June 14, 2008

Sony Rolly - WTF?



I'm really not sure what the hell this is and who (apart from maybe me) would buy it. It's sort of like a noise, high-tech Matmos toy. Wikipedia describes it as:
a personal electronics device combining music functions with robotic dancing.
which is a little dry perhaps for what must be one of the weirdest ideas ever. It's an MP3 player that, erm, dances. Not really portable, practical or even that pretty, one can't but help but wonder what the meeting was like when some senior Sony execs approved this. But it's kinda-cute and I bet my cat would like it. Actually scratch that, George the cat would ignore it and go sleep in a cupboard somewhere, as is his want.

The official website for it doesn't seem to work for me, but there's a fan site called Rolly.tv with lots of info except where to buy the bloody thing.

Specs

  • 1GB internal flash-memory,
  • Bluetooth 2.0 connectivity for receiving and streaming music,
  • Editable dance moves via user programmable and pre-set software,
  • Battery specifications:
    • 3.7V 1560 mAh rechargeable battery
    • Battery life: 5h music playback, 4.5h streaming music over Bluetooth, 4h of music and motion combined, and 3.5h for streaming music over Bluetooth with motion
  • USB 2.0 conection for transferring music and charging the batteryge
  • Supported audio formats: MP3, ATRAC, AAC up to 300+ kbps
  • Dimensions and weight: 104×65×65mm, 300g
  • Price: US $360 - $400 depending on retailer.

Enjoy

Dave

Update: Check it out there's an ad too!

Sunday, July 22, 2007

A past disaster

Amstetrdam, May 2002 - I was cycling down the Prinsengracht when a 14 year old French tourist stepped out from the Anne Frank museum right into my path.



Ouch! See the photos.

Dave

Woah, ahh fuck!

That was about as articulate as I got when, Thursday night, a concrete manhole cover gave way underneath me and I plunged through it and tipped ungraciously onto the pavement in front of me, landing on my camera bag (luckily) and spraining my left ankle and bruising my right elbow and forearm.

Ankle starting to swell

Luckily was was a mere block away from my hotel (The Orchard Hotel on Bush street) and the doorman came and rescued me with a wheelchair. My dear friend Julie was with me and she was just fantastic. Many thanks Jules... We caught a cab to St Francis Memorial Hospital on the advice of the doctor the hotel contacted for me. There I was quizzed, x-rayed, bandaged and dosed up with pain-killers. If you ever injure yourself in San Francisco I recomend the ER at St Francis. They were wonderful.

So for the last few days I've been lolling about in my hotel room, not the way I'd planned on spending my time while here, but hardly the worst way to spend a few days. I've not really been too productive alas as the pain-killers make me very woozy and my right arm/hand is still far too sore to write or type properly. This left-handed typing is for the birds I tell-ya. I have thrown a few photos up into Flickr for your amusement.

Dave.

Monday, February 05, 2007

Burning Skies over Canberra

Check out the sky over my house. There is ash falling in the garden like hot snow, my eyes are stinging and the upstrairs of the house is thick with smoke.

Burning sun

Ghastly sky

After dinner we may start hosing down the outside of the house. — Dave

Tuesday, January 09, 2007

My Tarrot Card

You are The Fool


The Fool is the card of infinite possibilities. The bag on the staff indicates that he has all he need to do or be anything he wants, he has only to stop and unpack. He is on his way to a brand new beginning. But the card carries a little bark of warning as well. Stop daydreaming and fantasising and watch your step, lest you fall and end up looking the fool. [Get your own card.]

*NOTE: I don't really believe in any of this stuff, but it's nice to see my tarrot thinks I am a fool too.