I’ve had a Rails website which works fine for about 12-18 hours, then starts giving out intermittent 500 errors because the mongrels die. After searching around, I ended up fixing it on two levels. (a) Direct solution - Fix MySQL config One reason Mongrels die is MySQL connections not timing out, leading to starvation. Apparently there’s a […]
Preventing a Rails (Mongrel App) from Crashing
July 28th, 2007 · 1 Comment
Tags: SoftwareDev
Rails JSON, JSON Rails
July 13th, 2007 · 4 Comments
Man, JSON has come out of nowhere! I first came across it amid the Javascript hype in early '05, now it's everywhere. Not only in your Ajax apps, but in the On-Demand Javascript APIs of the world. Sharing an ethic of simplicity with Rails, it's not surprising these technologies have come closely together, with JSON support [...]
Tags: Links · SoftwareDev
Ruby/Rails: Overriding NilClass
June 25th, 2007 · 2 Comments
Rails uses "whiny nil", which means if you call a method on an object that happens to be nil (null), you get an exception. This is good. But with strings in a web app (in any language), you often don't know if an empty string will be nil or simply zero-length (""). That's because some [...]
Tags: SoftwareDev
Ruby is Rails is … REST
May 31st, 2007 · No Comments
Will the peripheral IT community come to view REST and Rails as equivalent? It might sound ridiculous, but consider: Unix==Linux, Wiki==Wikipedia, Ajax=Web 2.0, blogging==RSS, podcast==spoken MP3. Last but not least, every knows that Ruby==Rails So it only stands to reason that the REST equivalence shall come to pass, as REST hops on for a free ride on [...]
Tags: SoftwareDev
Phobos - Server-Side JS Redux
November 11th, 2006 · 2 Comments
On Ajaxian, Dion points to Sun's Phobos project, an attempt to build a new platform for server-side Javascript. Phobos came out six months ago, around the time of the May Ajax Experience. No-one has taken server-side Javascript seriously since it died a premature death in the mid-90s. But there is great potential... Server-side Javascript would allow for [...]
Tags: SoftwareDev
But Why?
October 7th, 2006 · 3 Comments
I often want to use an operator called "but", the complete equivalent to "and". It would let me say: if guest.wants_to_see(report) but report.is_premium_content raise PremiumContentException end As opposed to: if guest.wants_to_see(report) and report.is_premium_content raise PremiumContentException end The first example is easier to comprehend because it's closer to the business rule and the way we think [...]
Tags: SoftwareDev
Rails: Finding Who Called A Partial
August 16th, 2006 · 2 Comments
So you're coding a partial and you want to know which template has pulled it in. The magic word is "@first_render", which will give you something like "homepage/admin" for the homepage/admin.rhtml template. Trivial, I know, but I couldn't find any mention of it after much googling, so I decided to output self.inspect and was pleased [...]
Tags: SoftwareDev
How Rails Handles Use of Reserved Keywords, Wow!
August 11th, 2006 · 1 Comment
I didn't ever expect to get excited about how a framework handles keywords, but Rails just impressed me big-time. When I tried to create a model named "Activity", Rails told me it was reserved and then came back with a list of thesaurus terms that might be used instead!. That's not just opinionated software, it's [...]
Tags: SoftwareDev
