faded picture of luke
a semi-random photo | click for the full photo gallery
click to browse photos
homepage navigation

Luke Melia

Debugging your RJS calls in Rails

RJS templates aka JavascriptGenerator templates are a powerful tool in the latest versions of the Ruby on Rails framework that has been a real mind-bender for me. In a nutshell, they give you the ability to respond to an AJAX request by telling the page to execute a sequence of javascript commands. And the javascript can be generated using Rails’ excellent helper classes that build on prototype.js and scriptaculous.

Turns out they can be a little hairy to debug. When I had some bad javascript, I wasn’t seeing it captured in the FireFox console. The javascript would just silently fail to execute if there was invalid javascript syntax. Rails Weenie to the rescue:

Drop this into the bottom of your layout:

<div id="debug">
<script type="text/javascript">
	// log the beginning of the requests
	onCreate: function(request, transport) {
	new Insertion.Bottom('debug', '<p><strong>[' + new Date().toString() + '] accessing ' + request.url + '</strong></p>')
	// log the completion of the requests
	onComplete: function(request, transport) {
	new Insertion.Bottom('debug',
	'<p><strong>http status: ' + transport.status + '</strong></p>' +
	'<pre>' + transport.responseText.escapeHTML() + '</pre>')

This let’s you see what ajax calls are being made and what javascript is being sent in response. Notice your boneheaded error, fix it, and smile!

CruiseControl.NET and FxCop

Quoted in Software Development Times

I was interviewed for an article about hiring software developers in November. The interview appeared in the December 15th issue of Software Development Times [PDF 3.7 MB]. Flip to page 6. Here’s a brief excerpt from “Advice From the Trenches: Building a Winning Team,” by Jennifer DeJong:

Programming expertise and creativity top the list of what these development managers want in new hires. But communication and collaboration skills matter, too. “The days when a programmer can be an anti-social person who works alone all day in a cubicle are over,” said Melia. One way to make sure you don’t end up with a throwback on your hands is to get the entire team in on the interview. That can put a candidate on the spot, but it also shows firsthand how they interact with others, said Melia, who is currently recruiting a fourth team member. “You see how they act in a meeting.”

I sent the link out to my folks, of course. My mom’s reply was choice: “I don’t understand this article, but I’m very proud of you.” She’s got it hanging on her fridge. Just like elementary school!

Speaking of recruiting, I’m looking to hire a senior OO developer for a May start. Get in touch if you’re interested!

LukeMelia.com created 1999. ··· Luke Melia created 1976. ··· Live With Passion!
Luke Melia on software development freelance web development how to contact me Luke Melia, Software Developer letters and more from my travels photo gallery personal philosophy