Sunday, February 15, 2009
Last week my Linksys WRT300N died after only 8 months use. It didn't die as much as it became so unreliable that it was useless. Every now and then it would drop the wireless connection, and then refuse to allow reconnection no matter how many times I power cycled it. This became so frequent and wasted so much of my time that I decided the unit had to go. I could probably send it back Linksys under warranty but I would need another wireless unit in the meantime anyway. As I've had an excellent run with Apple products I decided to give the Airport Extreme a shot. It was a breeze to setup, and my wife and I can both notice the speed difference when accessing the net. So far, so good! Quality costs more but it seems you get what you pay for. We'll see if I'm singing the same tune about the Airport Extreme in 12months time.
I recently created the YahooCurrency Ruby gem that gets currency exchange rates from Yahoo! Finance. Originally the code was part of a working Ruby on Rails demo I created about 12 months ago. A project we are currently working on needed exchange rates, so i created a Gem from the original code so we could easily reuse it across any of our future Ruby projects. We discussed making the project open source, and agreed that it would probably be useful for others, and also great for Global IT Creations to contribute something back to the open source. It is only a small contribution, but you have to start somewhere. Here is some example code...
exchange_rate = YahooCurrency.get_rate!("JPY", "USD") exchange_rate.from #=> "JPY" exchange_rate.to #=> "USD" exchange_rate.rate #=> 0.0111 exchange_rate.timestamp #=> Wed Feb 11 22:20:00 +0800 2009Get the source or the gem from http://github.com/scottbarr/yahoo_currency/tree/master Hopefully this will be the first of many projects that GITC releases as Open Source.
Thursday, February 12, 2009
For the last few days I've had the displeasure of working through some code that we have inherited from another company, which I will not name. One section of code I'm looking at has a 300+ line if/elseif block, up to 9 levels deep! And if you want to see some real crap, you can look anywhere else in the remaining 700+ lines of code. As for the project in general there are no meaningful unit tests, all the code is crammed into the Controllers, and it is so un-DRY you need a raincoat to get through it. Code like this makes me want to cry. This code is concrete evidence that if your parents are blood relatives you should not write software. (No offence intended to non-code writing inbreeds.)