Software As She’s Developed

Mahemoff’s Podcast/Blog – Web, Programming, Usability from the Author of ‘Ajax Design Patterns’ (AjaxPatterns.org)

Software As She’s Developed header image 4

Entries Tagged as 'Rails'

Preventing a Rails (Mongrel App) from Crashing

July 28th, 2007 · 1 Comment · SoftwareDev

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 [...]

[Read more →]

Tags: ····

Rails JSON, JSON Rails

July 13th, 2007 · 4 Comments · Links, SoftwareDev

<

p style="clear:both; margin-top: 2em; "> 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 [...]

[Read more →]

Tags: ·····

Ruby/Rails: Overriding NilClass

June 25th, 2007 · 3 Comments · SoftwareDev

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 [...]

[Read more →]

Tags: ··

If HTML Used Convention Over Configuration …

June 2nd, 2007 · 5 Comments · Links, SoftwareDev

Browsers would automatically pull in CSS and JS according to the filename and I would no longer have to look for an example every time I need a link or script tag.

In the absence of any other spec, /abc/def.html would cause the browser to look for /abc/def.css and /abc/site.css and /site.css. And then it would [...]

[Read more →]

Tags: ·····

Ruby is Rails is … REST

May 31st, 2007 · No Comments · SoftwareDev

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 [...]

[Read more →]

Tags: ····

Phobos – Server-Side JS Redux

November 11th, 2006 · 3 Comments · SoftwareDev

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 [...]

[Read more →]

Tags: ·······

Lessons in Javascript Performance Optimisation: 90 seconds down to 3 seconds

September 26th, 2006 · 10 Comments · Links, SoftwareDev

Summary: Avoid $$(".classname") on large DOMs!!!

I've recently been optimising the guts out of a JS webapp I wrote, which was making IE crawl to a halt. I discovered this after introducing a stress-inducing data set. (Using Rails' fixtures makes light work of this; since the fixtures are Ruby templates just like the web templates, it's [...]

[Read more →]

Tags: ········

Rails: Finding Who Called A Partial

August 16th, 2006 · 2 Comments · SoftwareDev

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 [...]

[Read more →]

Tags: ····

How Rails Handles Use of Reserved Keywords, Wow!

August 11th, 2006 · 1 Comment · SoftwareDev

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 [...]

[Read more →]

Tags: ···

Rails, Selfishness, and Opinionated Patterns

August 5th, 2006 · 1 Comment · SoftwareDev

When people talk about their favourite benefit of Rails over framework X in language Y, they'll usually mention ActiveRecord, Ajax support, etc. But at a deeper level, the thing that really stands out is that Rails is opinonated software. This is where Rails derives its power and agility.

It's pretty well-understood in software that consistency trumps [...]

[Read more →]

Tags: ····