Falling Leaves: the Ardes blog

The 12 Days of Kitschmas

November 30th, 2007

Ray Drainville

'Tis the season—to get ready for fabulous gift-giving, of course. From the Ship of Fools, here’s the Walled Nativity Set:

Walled Nativity Set

Thank you, Dan Sack, for the best Christmas ever.

Ray Drainville

This video seems to illustrate something that was mentioned briefly in the last episode of BBC Three’s Singing with the Enemy, where the lead singer of death metal group Amputated (and didn’t he look exactly like a young Murray from Flight of the Conchords?) mentions that sometimes he makes “oinking” sounds while singing. Very metal.

Why I love Safari Tidy

November 23rd, 2007

Ray Drainville

Recently I mentioned that I use Safari Tidy—a plugin for Apple’s Safari browser. I thought I’d shed a little light on why I think it’s so great.

For years now individuals—Jeffrey Zeldman most prominent among them—have been evangelising the use of standards-based (X)HTML. There are vague reasons for supporting standards, like getting the warm & fuzzies for doing so; there are abstract reasons, such as preparing work properly to be handed over to a successor; but a very real & immediate reason is that you have a very firm basis upon which to work. It’s all too easy to make mistakes in the semantic properties of HTML, which can yield disastrous rendering results in browsers. And it’s all too easy to not see the problem until late in your design process.

Safari Tidy is unobtrusive & always on: you’ll see that an error has arisen immediately, so you can go fix it. Other implementations of Tidy aren’t so automatic—you have to physically check your markup’s validity, which often means that you don’t check—this is what makes Safari Tidy so fantastic.

I’ll illustrate with a real-world example (one upon which I’m currently working, in fact):

Many out there will be aware of the generating capabilities of Ruby on Rails. A good explanation of this is beyond the scope of this article, but suffice to say you can build the general building-blocks of a web application very quickly, such as setting up a new user in a system. Here’s a rudimentary example of a ready-built form (linked to the users controller). It’s to be rendered in XHTML:

  <% form_for(@user) do |f| %>

    <p>
      Login:<br />
      <%= f.text_field :login %>
    </p>

    <p>
      Email:<br />
      <%= f.text_field :email %>
    </p>

    <p>
      Password:<br />
      <%= f.text_field :password %>
    </p>

    <p>
      <%= submit_tag %>
    </p>

  <% end %>
  

The result of all that <%= f.text_field :foo %> is to create form tags, such as input. Here’s what the above gets with the Login example:

  <p>
    Login:<br />
    <input id="user_login" name="user[login]" size="30" />
  </p>

So far, so good. But what if the user hasn’t filled out a field & you have to display associated errors? Simple in Ruby on Rails. Assuming validation has been set up in your users controller, just add the following bit in front of your form:

  <%= error_messages_for :users %>

With this in place, if your user doesn’t enter a required field, or enters a required field incorrectly, then Rails will automatically inform the user of what was wrong (in the location of the <%= error_messages_for :users %>). Moreover, it’ll wrap the offending field to highlight the user’s attention to it. It will look like this:

  <p>
    Login:<br />
    <div class="fieldWithErrors">
      <input id="user_login" name="user[login]" size="30" />
    </div>
  </p>

And now we have a problem. A div can contain a p, but cannot be contained within it. This is where Safari Tidy comes in really handy. When you test your error message (as above) by viewing it in Safari, Safari Tidy will inform you of an error in your markup. The error it makes is somewhat cryptic:

  <p>
    Login:<br /> 
    <div class="fieldWithErrors">
      <input id="user_login" name="user[login]" size="30" type="text" value="" />
    </div>
  </p>
  -----
  Line 85  Warning: inserting implicit <p>
  Line 89  Warning: trimming empty  <p>

What’s going on here? Since a p can’t contain a div, Tidy thinks you’ve not closed your p tag before you started your div. In addition, it thinks you haven’t opened your p after you’ve closed your div tag. Certainly, knowing your XHTML helps in this situation, since the error it throws is otherwise cryptic; but Tidy gives the clue where to find the error. On a form with a lots of fields, this is really helpful.

Safari Tidy helped me note there was a problem before I even realised that there was a problem—and there really was, the error screwed up my pretty design horribly.

Update: What a wally—I got so wrapped up in Safari Tidy that I didn’t explain how to fix the error! There’s a simple solution: convert your p tags to divs throughout. I don’t know why Rails screws this up in the first place—Rails seems to have been designed pretty well & this is a glaring oversight. It’s really bothersome to have to fix every automatically-generated form.

Craig Allen, R.I.P.

November 21st, 2007

Ray Drainville

A business blog may not be the best forum for this, but I don’t have another outlet.

A dear friend from my days at New College, Craig Allen, died on Saturday, 17 November 2007. There will not be a funeral, at the behest of his family.

Craig was an extraordinarily gifted individual, painfully intelligent with an incredibly caustic wit—best when turned on someone else. He greatly enjoyed music & movies, but his dearest loves were his two children, whom he idolised.

He worked as a lawyer for the National Science Foundation investigating fraud & criminal activity. While working there he developed two rare illnesses, neurosarcoidosis & pulmonary sarcoidosis. The struggle against these put an intolerable strain on him & his marriage, more so because he was inaccurately diagnosed for a considerable period of time. While fighting the pain of these illnesses, he became addicted to a cocktail of drugs.

He was fighting his addiction & was trying to pick up the pieces of his life in Florida when he lost his battle. My last message from him was written the day before he died. He was upbeat, more so than I have heard in a long time.

He leaves behind his two children, Gabriel & Jackson. He was 37 years old. He was a dear friend.

Craig Allen

Craig Allen (right), in happier days

response_for_resources_controller

November 20th, 2007

Ian White

If you're using response_for, then you might want to grab response_for_resources_controller

It simply replaces the default action modules with ones that use the response_for idiom.

This means that you can override what an action does without overriding how it responds. For example, I want a standard REST controller, that sets a protected attribute, user, on create.

class PostsController < ApplicationController
  resources_controller_for :posts

  def create
    self.resource = new_resource
    resource.user = current_user
    save_resource
  end # the standard response_for :create is used
end

If you don't know what response_for does, it lets you declaratively set the respond_to of an action. For example: if you want to override some aspect of the response, here I just want to change the flash message on successful create:

class LoginsController < ApplicationController
  resources_controller_for :logins

  response_for :create do |format|
    format.html { flash[:notice = "You have logged in" } if resource_saved?
  end
end

miscellany

I added save_resource and resource_saved? to rc, as a way of sharing the result of the save outside the scope of the action. Previously I've done this with valid?, but realised that this might hit the database unnecessarily in some circumstances. You can use either idiom.

Ray Drainville

If you’re running the newly-released Mac OS X 10.4.11 update & are having lots of crashes in Safari, then the likely culprit is going to be items in your ~/Library/InputManagers/ path. Some popular Input Managers include:

SafariTidy was the culprit for me. The developer, Kasper Nauwelaerts, has upgraded this to 0.2.4. I’ve not yet been able to successfully install the update, however—Safari just isn’t recognising its existence.

Input Managers act as a patch to the applications for which they’re intended, and as such are unsupported—even actively discouraged—by Apple, because they can patch applications in dangerous ways. Those of us who rely upon such items—as I am to Safari Tidy, so I can validate my work on-the-fly—are in something of a quandary. As Daring Fireball’s John Gruber implied regarding input managers and unsupported software, this situation isn’t going to get better but worse as time passes.

SafariTidy’s useful validation features: how can it be made a better OS X citizen?

Because the use of the InputManager system is so bad, I’m left wondering what’s the best recourse. Tidy is really useful & there are extensions for Firefox, but none are to my mind as elegant as SafariTidy. I’m left hoping that Kasper will port his plugin to a different architecture…

Update: I just got some tips from Kasper & some very good news:

…You should put [SafariTidy] in the SIMBL plugins folder, which usually resides in ~/Library/Application Support/SIMBL/Plugins/. Please remove all traces in any InputManagers folder you put the bundle, as this plugin isn't technically an InputManager (anymore).

Three cheers for Kasper! I’ll be donating to him right now.

Update 2 (03/03/09): for those using the new Safari 4 beta, you’ll want to upgrade to the latest SafariTidy.

Best book cover designs of 2007

November 17th, 2007

Ray Drainville

Book cover design is close to my heart—if you’re an avid reader, it’s nice to have a really attractive cover to the book you’re reading. Joseph Sullivan of Book Design Review publishes his favourite book cover designs of 2007.

From his list, my favourites are “Small Crimes in an Age of Abundance” (above, designed by David Drummond), “Six Degrees” (designer unknown), “One Perfect Day” (designed by Evan Gaffney), & “Brave New World” (designed by Greg Kulick). Of course I’m also very fond of “Simple Sentences”, but since I designed it I might be biased!

Separated at Birth?

November 17th, 2007

Ray Drainville

Super-Special Audio/Triplet Edition!

Spotty Interpol croonster Paul Banks

Largely-forgotten Guns 'n' Roses excrescence
Axl Rose, and

Earsplitting lollapalooza Ethel Merman?

Ugly is the new Pretty

November 14th, 2007

Ray Drainville

There’s an interesting article in Design Observer about the fairly recent trend in ugly design—nasty colour combinations, stretched type & a lot of other characteristics considered no-nos of good design.

The development of this style—perhaps we should call it “anti-design”, even though its proponents claim it’s the hardest work they’ve ever done—seems to be a reaction to the prevalence of overly-clean (and potentially overly restrictive) design as covered in the documentary Helvetica.

Michael Bierut makes a good point about negative reactions to the design:

If you’re familiar with art and design, you know the perils of condemning the shock of the new. After all, no one wants to risk being one of the bourgoisie sneering at the unveiling of Les Mademoiselles D’Avignon (sic) or booing at the debut of Le Sacre du Printemps.

I’ve always disliked people who try to paint critics with such a brush—it’s a response calculated just to shut you up, not to provoke any debate. But it’s one thing to be provocative in your work & quite another to be heedless to anything that’s actually attractive.

Time will tell whether this new trend—redolent of the early days of PageMaker & Quark design with its “ransom letter” font choice & squeezed typography—will actually last. I can’t help but wonder why we’re caught in this same spiral of reaction & counter-reaction: restrictive design vs. unfettered, even unschooled, design. We’re stuck learning & un-learning the same lessons: we’re fighting old men’s wars. After all, it’d be nice to create something new, wouldn’t it?

Ray Drainville

Gotta love that warbly voice-over.

I'm pretty sure that I, or at least friends of mine, had at least half of these items when I was an impressionable youth—it all seems so familiar.

But you have to wonder why the humans just keep getting caught. Is this fun?

Liquid error: undefined method `current_page' for #