Thursday, November 18, 2010

mongodb fail

After recovering from a system crash (on my work iMac) I had this issue on my Ubuntu server vm when typing mongo at the console:

$mongo

MongoDB shell version: 1.6.4
connecting to: test
Thu Nov 18 14:55:23 Error: couldn't connect to server 127.0.0.1 (anon):1154
exception: connect failed

Trying to start the server ran into a few issues as well:

$ sudo /etc/init.d/mongodb start
* Starting database mongodb
...fail!

My collegue came across the "mongod.lock" file while searching for a solution. Removal of this lead to happiness once again :D

sudo rm /var/lib/mongodb/mongod.lock
sudo mongod -repair

sudo /etc/init.d/mongodb start

$ mongo

MongoDB shell version: 1.6.4
connecting to: test
>




Tuesday, November 16, 2010

Installing apt-get on Mac OSX

If you're setting up your development Mac machine and you're used to a Linux, you might be wondering where apt-get went to. OSX doesn't come with it as part of the standard package, but you can install it from a nifty little package called Fink.

Fink brings the power of installing Debian based packages that you need for development via the command line, making upgrades and updates heaps easier for us Ubuntu users :).

Going through the following steps should get apt-get installed on your system:

  • First download the appropriate installer for your system here.
  • Run the Fink XXX Installer.pkg file
  • Allow the installer to setup your bash config (~/.profile)
  • Reload the config (source ~/.profile)

Hey presto, the power of apt-get is now at your finger tips!

Big ups to the team of volunteers at Fink who have made our lives that much easier :D

Thursday, June 10, 2010

Irish fun with Mc'Rails

Thought I'd mention an odd issue with Rails' titlecase() method that my college Cameron discovered the other day. The client had noticed that an Irish particular surname apparently entered into the backend i.e. "McAffee" was mysteriously showing up with a space on the front end i.e. Mc Affee. After checking the database to find the text being correctly stored, he discovered that Rails' titlecase() (aka titleize) was putting in an extra space after the c.

On the Rails console:

Entering the name as just mcaffee results in the expected outcome:
>> s = "mcaffee"
=> "mcaffee"
>> s.titlecase()
=> "Mcaffee"

However, titlecasing something that is already correctly cased results with:
>> s = "McAffee"
=> "McAffee"
>> s.titlecase()
=> "Mc Affee"

Something to watch out for with Irish names if you're accepting them in the db as a mixture as properly formatted and lowercase and are using titlecase to pretty your fields

Tuesday, October 13, 2009

ACC hikes - someone hasn't thought this one all the way through...

It’s official. The current New Zealand government are a bunch of idiots.

Both the nats and the ACC Chairman and board must have put a tonne of thought into the latest attempt to increase ACC levies.

The ACC seem to have squandered its 'hard-earned' money from all their parties/hotel expenses/travel/lunch and dinner meetings, now it needs more. It’s not enough that ACC levies for motorcyclists alone have gone up by $80 over the past year (motorcyclists pay more on their ACC levy then some car owners' pay for their entire registration alone). Now we motorcyclists have to bend over and take it with nothing but a shocked look of violation.

The irony here is the fact that its wasn't too long ago the nats were crying foul on behalf of the good New Zealand public for a further increase (comparatively small it would seem) in ACC fees at the end of 2007/beginning of 2008. Seems the shoe is on the other foot.

Nick Smith hints that levies are set to rise anything from 10-50% per year, and motorcyclists and scooter owners look to be hardest hit. Figures of $300+ for scooters and $500+ for medium-sized motorcycles have emerged for ACC levies alone!

Now, not only will this hit the pocket of your average scooter/motorbike rider going to work, it’s also likely to have some not-so-well considered far-reaching effects. People won't be able to afford to maintain (lets face it, owning a bike for over half a decade will cost around as much as most bikes on the used-market go for). Bike stores will miss out, not to mention suppliers of bike apparel, service companies related to bikes/scooters and of course the ACC from a dramatic reduction in the number of bikers. This leads us to the next issue. The handful of bikers left who can afford such, quite frankly preposterous charges, will find themselves riding along side unregistered, unwarranted motorcycles from people (quite likely youngsters) who just won't pay. This is reminiscent of the whole argument against computer-chipping dogs, the idea being amongst others, that dangerous dogs could be monitored. But why is an owner of a dog who doesn't pay registration likely to get their dog chipped in the first place? With regard un-warranted bikes, the police have a hard enough time enforcing it as it is - chasing an unwarranted/reg'd moderate cc bike is tough enough for the cops, let alone doing it through peak hour traffic. The last thing they need it a huge increase in dangerous or unroadworthy bikes on the road (no doubt leading to more accidents).

Sounds like such a well thought out plan... Fat, middle aged men, working in government departments, arriving at employer paid-for schmooze sessions with cute yet expensive finger food in their Mercs, Beamers and government-paid over-priced cars will stare into the television camera and tell you that motorcycles cost more in ACC levies than they give. But who’s problem is that really? And why is it, that the reason for these accidents isn't being addressed instead of charging riders an arm and a leg as an after thought? If the government only spent a little more money on licensing/rider training and education, perhaps adding more difficulty to attaining the current learner license (which enables the holder to ride on their own, unsupervised), we wouldn't have motorcyclists 'causing accidents', the majority of which occur in the first 6 months of getting a motorcyclist getting a learner license.

Nice one guys. Next you'll be promising to solve Auckland's public transport system so all the bikers can take public transport to work... Or not... What a joke.