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 'Ruby'

Ruby Script to Localise Images for Offline HTML

August 16th, 2010 · 1 Comment · SoftwareDev

I'm maintaining a custom HTML5 slide framework. A little similar to the canonical slides.html5rocks.com insofar as, well, it's HTML5 and slides horizontally! But the key difference is that it's very markup-based - What You See Is What You Need (WYSIWYN) - so creating new slides is easy.

Anyway, I did something similar with TiddlySlides a little [...]

[Read more →]

Tags: ·

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: ··

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: ·······

But Why?

October 7th, 2006 · 3 Comments · SoftwareDev

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

[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: ···