Locked Out
Monday, July 27th, 2009Poor Bo:

Poor Bo:

Recently I added diffashash to rspec and I’d like to show you what I did, so you can add your own differs, and it’s only a couple of lines of code. You can edit your own local gem copy of rspec using the findgem gem’s editgem command.
Let’s use the example that you want to add a BigDecimal differ.
First of all you’re going to need to add a line to this file, something that looks like the lines here, along with the other elsifs:
Secondly, in this file inside the Spec::Expectations::Differs::Default class you’ll have to define your diffasbig_decimal differ:
Now when you diff BigDecimal numbers in your rspec tests, you’ll see this output, rather than the ugly output.
However, what would be nicer is if you could expand on this diffing syntax in your own project, rather than having to hack rspec and have it wiped next time you upgrade. More on that later though.

Thanks to those who have been following my projects on github! and another thank you to those who have been linking to them! This really means a lot to me when I put a lot of effort into these plugins and they get noticed! Thanks!
Fresh on the heels of yesterdays cantouchthis I’ve released another plugin today called sort_by. It provides you a way of sorting a table by user selected fields and it even paginates *ooh* *ahh* *pause for ego boost*. Inspired by hearing people talk about having to make stuff from scratch to do this I worked on it for about the last 3 hours. Tell me what you think!
I’ve been receiving messages from spambots on Adium and today Yaroon from #macosx told me there’s Privacy Settings (Cmd+Option+P) where you can set “Allow only contacts on my contact list”! Spammers be gone!
Got a call from a blocked number today:
Me: “Hello” Them: “Is this Ian Thorpe?” Me: “Who?” Them: “Ian Thorpe.” Me: “Ian Thorpe? As in the swimmer?” Them: “Yup” Me: “I think you’ve got the wrong number, this is Ryan.” Them: “Oh, do you do computer repairs?” Me: “I can, yes” Them: “I got your number from Fiona in Secret Harbour” Me: “What state?” (because I moved in Jan and news travels slowly in the real world) Them: “WA” Me: “No sorry, I think you’ve got the wrong person!”
I’ve only ever lived in SA and Queensland.
If you don’t like reading rants, but like knowing the point of things: read the last paragraph. If you don’t like reading rants full-stop: continue no further.
Today I went to renew my license and registration at the Queensland Department of Transportation. The license expires on the 3rd April 2010 and the rego expires tomorrow, so I thought it kind-of-important that I should go register it today, lest I get pulled over. I left work after lunch, at about 1:40pm. What happened there after was… special.
I arrived there, waited 10 minutes to get served and when I got served the lady told me that the bank notice that I had wasn’t valid since it wasn’t a bank statement, it was just a letter (from my old bank, sent to my current address) about my insurance. I had already provided my Driver’s License and Medicare card as points of identity. So I had to take a trip down to the Commonwealth bank, print out a real statement from my current bank and bring it back them. I was angry that there was no other way that I could prove I’m me, but there’s other people out there who, despite all known forms of logic, would wish to impersonate me. As far as I know, there (currently) is not a Ryan Bigg fanclub.
Then I arrive back at the DoT and have to wait again, and I get served by the same lady. Then their internal system goes down. The tickets are broken. She enters my details and “ums” and “ares” for what seems like an hour. Oh wait, it was an hour. During this time I think was when I got my license. Without issue. So she calls over a co-worker and they chat about it… eventually the system (did I mention they’re running what appears to be DOS on top of Windows XP? pause for giggles) came back online and she was able to continue the registration process. At one stage she even gave me registration plates and I thought that we were on the absolute final step of the process thank you $WORDREPRESENTINGSAINTLINESS $DEITY!. Then she says more “ums” and “ares”, asks me for the registration plates back and says that the car has been reported as a “repairable write-off”.
“What?”, I uttered. This was a car that I drove from Adelaide, to Brisbane. It’s still in one piece! It was serviced LAST WEEK and wouldn’t have they notified me if the car was a writeoff or had dodgy repairs done to it? They didn’t.
She again explains that the car has been reported, once in its 11 year lifetime as a “repairable write-off” and her colleague does a marvelous impression of a parrot. I think at one stage she was even fed a cracker for doing such a great job! So I ask them if they could look it up. Apparently not. She tells me to contact the Queensland Inspection Services and writes down a number for me.
So I leave, angry, sad, confused, at about 4:30pm. Three hours, gone. Time I could’ve been working.
I call mum who’s fiance’s friend sold me the car and ask her if I could have the contact details for the guy. He rings me later on and claims that the car had 3 previous owners before me, and that it was imported from New South Wales. He says to confirm the VIN on the registration slips (and it matches), and then to call the South Aus. Department of Transport and ask them to do a VIN check on the vehicle, and that’s precisely what happens. The kind lady on the other end informs me that once a long time ago in a state far, far away the car was, indeed, reported as a “repairable writeoff”, she informs me that if I contact the NSW DoT they can clear it and I can register the car in the Best State (Queensland, duh). She’s even kind enough to give me the number for the NSW DoT! Service++!
During this call I do a quick Google for Queensland Inspection Services and find out they charge a flat rate of $450 for a car. Didn’t I just get this safety checked last week? Yeah. That’s what I thought too!
I call the NSW DoT and Kind Lady #2 informs me that she cannot clear it, nor can anyone. Uh oh. I was misled.
In further fury and anger, I vent in the office and Dr Nic suggests registering it once again in SA. This I can do over the internet. This doesn’t mean that I go to a smelly building with smellier people and wait for a number to be called, I log in, enter my registration number and credit card details (no, I’m not going to give them to you), and select “6 months” and the entire process is done in less than 5 minutes.
Registering my car over the Internet. That’s how it should be. Quick. Simple. Easy. I beg the other government organisations, please come join the rest of us in the twenty-first century.
Something’s changed since last time I played around with Ubuntu, some packages such as irb and rdoc live in the universal repository and, by default, this is disabled so when you go to install it it’ll say it’s not found:
sudo apt-get install rdoc Reading package lists... Done Building dependency tree Reading state information... Done Package rdoc is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package rdoc has no installation candidate
Uncomment the following lines using sudo vim /etc/apt/sources.list:
#deb http://us.archive.ubuntu.com/ubuntu/ jaunty universe #deb-src http://us.archive.ubuntu.com/ubuntu/ jaunty universe #deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates universe #deb-src http://us.archive.ubuntu.com/ubuntu/ jaunty-updates universe
And then run sudo apt-get update and you should be able to install irb and rdoc now.
rdoc is required for installing rubygems, and that’s where I got hung up for a couple of minutes before I found the docs on ruby-lang.org under Ruby on Linux.
I was inspired earlier in the year by Brenton Fletcher’s humanize that I decided to make my own. Today, I “finished” it with the help of Mitchell Riley and other Actionhackers. Humanize will convert numbers up to a very large number of digits long into their string versions. This means given the number:
444,333,222,111,999,777,666,555,444,333,222,111,999,777,666,555,444,333,221,111,112,176,514,321,007,310, 444,333,222,111,999,777,666,555,444,333,222,111,999,777,666,555,444,333,221,111,112,176,514,321,007,310
Yes it’s the same sequence repeated twice, I got lazy in my testing. imagine it conjoined into one very large number.
Coincidentally, this is my IQ.
I get:
four hundred and forty four quinquagintillion, three hundred and thirty three novenquadragintillion, two hundred and twenty two octoquadragintillion, one hundred and eleven septenquadragintillion, nine hundred and ninety nine sesquadragintillion, seven hundred and seventy seven quinquadragintillion, six hundred and sixty six quattuorquadragintillion, five hundred and fifty five trequadragintillion, four hundred and forty four duoquadragintillion, three hundred and thirty three unquadragintillion, two hundred and twenty two quadragintillion, one hundred and eleven novemtrigintillion, nine hundred and ninety nine octotrigintillion, seven hundred and seventy seven septentrigintillion, six hundred and sixty six sextrigintillion, five hundred and fifty five quintrigintillion, four hundred and forty four quattuortrigintillion, three hundred and thirty three trestrigintillion, two hundred and twenty one duotrigintillion, one hundred and eleven untrigintillion, one hundred and twelve trigintillion, one hundred and seventy six novemvigintillion, five hundred and fourteen octovigintillion, three hundred and twenty one septenvigintillion, seven sexvigintillion, three hundred and ten quinvigintillion, four hundred and forty four quattuortillion, three hundred and thirty three trevigintillion, two hundred and twenty two duovigintillion, one hundred and eleven unvigintillion, nine hundred and ninety nine vigintillion, seven hundred and seventy seven novemdecillion, six hundred and sixty six octodecillion, five hundred and fifty five septendecillion, four hundred and forty four sexdecillion, three hundred and thirty three quindecillion, two hundred and twenty two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety nine duodecillion, seven hundred and seventy seven undecillion, six hundred and sixty six decillion, five hundred and fifty five nonillion, four hundred and forty four octillion, three hundred and thirty three septillion, two hundred and twenty one sextillion, one hundred and eleven quintrillion, one hundred and twelve quadrillion, one hundred and seventy six trillion, five hundred and fourteen billion, three hundred and twenty one million, seven thousand three hundred and ten.
Props to this site which gives names to unimaginably large numbers.
I have yet to find a use for this, but I’m sure somebody out there can.
NOW WITH FASTER PEFORMANCE! Thanks to Jack Chen.
When you encounter the above error, it means you’re missing the ruby-openid ruby-hmac gem. I couldn’t find anything on google that clearly stated this, so I’m posting it here as a reminder for myself and others.
Thanks to the comments for clarifying the gem needed.