Tips 'n Tricks

Dramatically improve test-driven development


Test-driven development is one of the best benefits that Ruby on Rails brings to modern web development, but it can be a bit tricky, and laborious, constantly tweaking test code, running the tests, then making required changes. Enter autotest, part of a suite called ZenTest, which makes life dramatically easier for you. Instead of having to manually run your tests, autotest runs all of the tests in the background so you immediately see the results of your changes and whether you need to fix something. Good stuff!

Keep track of Ruby on Rails changes


Here's an easy way to keep track of the on-going changes to Ruby on Rails. The Rails team use the system Trac to manage their development and it includes a page to list all of the recent changes. While nice in theory, the fact that by default it shows changes to the development website too makes it a little confusing at first glance, so instead you can use/bookmark this link to see what is going on in the code itself:

Don't leave chocolate beside laptop exhaust vent


A silly one this time. Whatever you do don't leave chocolate, be it chocolate pieces, chocolate covered nuts or anything chocolate related, sitting against the exhaust vent of a laptop as the chocolate will melt onto and into your laptop and will probably void its warranty. Just don't do it.

Slow network? Reboot your modem!


An odd one today. Over the past few days (week?) I've noticed that our cable Internet connection was a bit slower than usual, basically lots of latency and downloads running at 1/10th their usual speed which makes running a VPN connection a real pain. Calling tech support didn't get anywhere as they insist that you disconnect any router that you might have wired up and directly connect one computer to the line. I figured for SCOs and Googles (s'n'gs) that I'd try doing what they asked anyway. During the course of attempting to get my desktop to properly recognize the DHCP connection I power-cycled the cable modem probably three times and after doing so the connection suddenly was faster. To verify that the router wasn't at fault I didn't cycle its power at all, then reconnected it after the initial test and everything was working correctly again - cycling the power on the modem fixed the problem? I'm not sure why this would have happened, but it did and I'll remember it for the future.

TIP: Instant Rails problems with MySQL


I've mentioned Instant Rails before, the one-step installer for Ruby on Rails for Windows that makes life excedingly easy for beginners? Well, as it turns out there's a problem using it with the included MySQL that makes the combination simply not work - every time you try to do something with MySQL from any of the Rails or Ruby commands you're greated by the loving message

Mysql::Error: Lost connection to MySQL server during query: SELECT version FROM schema_info

Lots of fun there. As it turns out the fix is remarkably easy, simply download the following zip file and follow the instructions in the included readme.txt file, which boil down to copying a single file to somewhere specific. Why this wasn't included in the final Instant Rails release I don't know, but at least the fix is easy.

Huge thanks to Jeroen Nijenhuis for putting this fix together - the Rails newbie world is forever in your debt!


Subscribe to Tips 'n Tricks