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: Mongrel·Monit·MySQL·Rails·Ruby
<
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: ActiveRecord·AjaxPatterns·JSON·Links·Rails·Ruby
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: NilClass·Rails·Ruby
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: Abundance Thinking·Convention Over Configuration·HTML·Javascript·Links·Rails
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: Rails·REST·Ruby·Web 2.0·Web Standards
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: Ajaxian·Java·Javascript·Links·Phobos·Rails·Ruby·Server-Side Javascript
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: DHTML·ERb·Javascript·Links·Optimisation·Optimization·Performance·Rails·Tuning
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: ERb·Partials·Rails·Ruby·Web
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: HCI·Keywords·Rails·Ruby
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: DesignPatterns·OpinionatedSoftware·Patterns·Rails·Selfishness