Blogiversaire

Four years baby. Soon the blog will be toting a lunch pail and school bag, off to decades of education. Next thing I know, my little baby will be married and have little blogs of its own. Blog, you grow up so fast!

Top visited blog posts written in the past year:

As you can see, the popularity of this blog is directly related to what problems I’ve had with Ruby on Rails and people who search Google for the same issues. This is kind of unfortunate in some ways. It makes the blog pretty much narrative-free. But I’m still happy to have helped those who needed it.

While 2008’s posts have been much more rare, I think there are some gems in there. Going forward, I hope to include a mix of posts explaining a solved problem, displaying a new technique, and generally talking about the unique work life I live with day-to-day.

Distributed team horseplay

David Hasselhoff is...
Photo by toolmantim

Working day-in and day-out in a distributed team means you need to find creative ways to goof off with your teammates. Decorating a desk or pinning a questionable picture on someone’s cube wall is not really an option.

Enter David Hasselhoff. I’d like to claim I came up with the idea of Hoffing a co-worker, but it seems rather unlikely. Hasselhoff has been a cultural icon across the world, and a cultural joke in America, for years now. I don’t remember any one telling me about Hoffing. Perhaps it seeped into my unconscious somewhere along the line.

The tools of a good Hoffing are:

Find a compromising picture of The Hoff, fire it through a short URL generator, and you have yourself a perfect bomb for the Hoff wars.

Enter Get Hoffed

After visiting Brian in Portland, I realized that this Hoffing thing is a pretty big deal. Apparently he had been Hoffing people years ago on a public forum. The first thing he did to me after saying hello was to business-card Hoff me. The fact of the matter is, there is not only a desire to Hoff, but also to be Hoffed.

With an Erik-Kastner-like giddiness, last Friday I set to building gethoffed.com last Friday. It was an excuse to try some new tools. I built a couple API (Twitter, Flickr) slurpers and started generating the site yet that day. As of today the site updates every 15 minutes with fresh content from Flickr and the latest Hoff-tweets. It may surprise you to find that every day someone writes about David Hasselhoff on Twitter.

I’d like to add a Delicious link search, but I swear they don’t offer a site-search API. I thought a YouTube search would be nice, but their videos seem to be redundant more than anything.

Whatever you do, be sure to save this link for a long time. It is your trump card.

Post Redirect Get in Rails

Post St.
Photo by Terry Bain

Post/Redirect/Get (PRG) is a web application design pattern used to supply users with nice, GET-generated results pages that bookmark and reload with ease.

Say you have a results page with a filtering form at the top. The user might alter filtering options, and submit a form to winnow down her results. This is a POST, meaning params will be hidden from the user (not in the URL), making direct bookmarks to the filtered results impossible. Also, reloading the page will result in a “POSTDATA” warning message (”Do you want to resubmit POST data or would you rather we do a hurkey-jerky dance to confuse you?”) to the user. These are not things people like to deal with. Post/Redirect/Get says that your application should accept the POST command, and redirect to the results page using a GET request.

This is really quite simple to implement in Rails. Take this example action filter for an expense report controller, reduced to its bare essentials:

class ExpenseReportsController < ApplicationController
  def filtered
    redirect_to fitered_expense_report_path(params) and return if request.post?
   
    # Actual action work here.
  end
end

Very easy - the trick is really knowing the pattern more than anything. There has been some discussion on adapting this to deal with validation failures. In my experience, I’ve only made use of this pattern in non-RESTful controllers. You are sure to do better with it than I.

Tumbling with Iridesco

It’s been officially announced - we at Iridesco are tumbling. Please visit often to peep the videos, photos, stories, and music getting us all abuzz.

Fixing slow rake on Leopard

Hay Rake Third Version
Photo by JBAT

In the past few months, as a result of my clumsiness, I’ve been working on a new, Leopard-enabled MacBook. When replacing my wet and dying Tiger MacBook of yore, my one hope was that my daily executions of rake to test Harvest would execute a little faster. A 20% increase in processor speed doesn’t buy one a whole lot when web programming. The one place I figured I’d see a bump is the constant processor use of rake.

Wrong. So, so, wrong.

After moving to a new MacBook with Leopard installed, I experienced a test suite that ran 2-3 times slower than on my old machine. This became the difference between testing frequently and hardly at all; the difference between using and not using autotest. Pain to the max.

This post is going to get long, so I’m going to reveal now. For me, the issue was resolved by leaving the canonical Hivelogic world and reverting to the default Leopard installation of Ruby. Test speed returned to better-than-normal, and all at the price of only 6 hours of troubleshooting!

Continued reading >

open_id_authentication plugin and remember me

Do you run a Rails website that allows traditional username/email/password login and OpenID authentication? Do you know for sure that your “remember me” feature is working? Please do check…I’ll wait…

Good, now that you realize your “remember me” feature is not working for the OpenID login on your site, I’ll show you an easy way to hack it into the latest version of the open_id_authentication plugin. My preferred method to hack plugins is the evil twin technique.

The basic problem here is that your login form’s parameter list is not being passed back to your application after authenticity is checked at the OpenID provider. You have a remember_me checkbox, and, dammit, you want that parameter passed through. (Program note: some say this is not proper technique. I’m just trying to get you a solution, however temporary that may be.)

We need to hack the opend_id_redirect_url method:

def open_id_redirect_url(open_id_request, return_to = nil)
  open_id_request.return_to_args[‘open_id_complete’] = ‘1′
  open_id_request.redirect_url(root_url, return_to || requested_url)
end

Using the evil twin technique, create an “open_id_authentication_hacks” folder in your vendor/plugins directory. Within this directory, create an “init.rb” file and add the following:

OpenIdAuthentication.module_eval do

private

  def open_id_redirect_url_with_remember_me(open_id_request, return_to = nil)
    open_id_request.return_to_args[‘remember_me’] = params[‘remember_me’]
    open_id_redirect_url_without_remember_me(open_id_request, return_to)
  end
  alias_method_chain :open_id_redirect_url, :remember_me

end

Now you have a nicely aliased method that includes the remember_me parameter upon returning to your app.

Presentation: an audience perspective

Baked NYC

This weekend I attended RailsConf. This was my first multi-day conference. It was a great experience that I’m sure to repeat over the coming years. Met a lot of great Rails developers, working on interesting and disparate projects. Met a good number of Harvest users who spoke to me using words like “enjoy,” “love,” and, most surprisingly, “famous.” Even met people doing Important Stuff ™ who didn’t particularly care to hear about my story.

Watching speaker after speaker is terribly motivating. Soon the realization that this blog has pretty well been dormant in 2008 came to mind. The realization that I’ve not prepared a proper presentation…ever…entered my thoughts. As I sat in sessions, I found myself, with a wide sliver of irony, writing down presentation techniques that pleased and bothered me.

Humor

You have to include humor in your talk. Most presenters are aware of this. However, many presenters front-load their humor. It’s difficult to lace the entire flow of information with engaging humor, but this is one of the most outstanding ways to provide a positive experience for the audience - one that causes them to pursue the topic after the fact.

In the case of technical talks, one must be careful not to make the humor the focus. But generally speaking, presenters tend to err on the opposite end of the spectrum.

A consistent metaphor

Several sessions included an interesting, nerdy metaphor. Don’t meticulously introduce the Star Wars comparison and then drop it for the rest of the presentation. Lace that damn B-wing throughout the slides.

Know your environment

Your super-sexy, light-on-dark TextMate theme is most likely going to cause the audience fits. They will yell at you, especially if it is the cranky third day.

Greater than 15 lines of code is unlikely to be readable by the audience. Know how to zoom or bigify your code or think of other creative ways around the problem.

Slide titles should be mid-screen or higher. Cool MTV banner titles along the bottom of the screen are likely difficult for most of the audience to read, save for the most ideal conference situations.

Unless the presentation calls for frequent interaction with your computer, stand up. Give yourself the air of authority and the confidence that you are qualified to share information with the group. Don’t pace, and get yourself some sleep the day before.

Timing

Don’t hope your talk will fit into the given time slot, know it will fit. Err on the side of too short, please. Don’t promise time for questions unless you’re certain you can deliver. Plan for interruptions (technical issues, in-presentation questions, rambling, etc). You will be refreshing and set yourself apart if you deliver a well-tuned, concise message.

Tell them what they want to hear

Or Pander to the crowd.

Or Tell them what they already know, in a new way.

Or Inspire them to pursue what you know they want to pursue.

Littering your presentation with known community mores will give you at least a knee-jerk positive reaction. The audience wants to laugh, nod, clap, and feel assured in their own choices. Be a catalyst.

Ideally your whole presentation shouldn’t be comprised of such a message. But if you don’t have anything nice to say, reflecting your audience is probably your safest option.

If all else fails, blow their minds

Announce a product, process, tuning, enhancement, iteration or whatever that carries along with it jaw-dropping statistics. The nice thing about this is you don’t have to necessarily give the product in question to anyone to prove your statements - at least not right away. Plan on delivering something within a few months, and deliver something within 50% of the improvements originally touted, or you will be blasted.

This talk can be combined with telling people what they want to hear to make a powerful concoction. It is workable to describe utopian worlds where downfalls are leveled with a Sim-City-like ease. Again, any improvements will be welcomed, and the army of supporters from announcement-time will do all of you defense for you when the rubber meets the road.

It’s not about you

Indeed, some speakers enjoy well-attended presentations due to their niche fame. Still, it is not about them. It is about what the speaker can do for me, the audience member. How do you help me to relate to you? How do you help me fit your perhaps only tangentially applicable message into my situation? How can you generalize the information you have for public consumption? How can you make it all about me?

Technorati Tags: , ,

RailsConf ‘08

Just wanted to drop a note in my blog, here, that I will be attending RailsConf from Friday through Sunday. If any lurkers out there are gonna be in attendance, do drop me a note. Let’s meet each other!

If you want to stay up-to-date on any Barry-meets-RailsConf information, please check me out on Twitter.

Technorati Tags: ,

Ventorium: my lark of a project

Over the past few weeks, in spare moments, I put together a little Twitter bot which allows the service to blow off some steam. Ventorium works pretty simply. Follow “ventorium” on Twitter. Send @ventorium a message. See what spews forth from ventorium’s maw.

I must keep the secret to how ventorium writes its messages. Though if you think hard enough, you can probably figure it out.

Give ventorium a shot. It may alleviate your own need to bitch.

MinneBar 2008 and distributed teamwork

Distributed Team
Photo by Yves Hanoulle

MinneBar forewarning. I will be participating in a panel discussion on distributed teamwork. I put out a call a while back and received several responses. A good core group has formed, all with varying experiences in the distributed, or “virtual,” team environment.

My experience is clearly with Iridesco working on Harvest. My focus will be on ways to find a distributed team to work with as well as the tools we use to communicate. Soapbox-wise, I’ll be pretty adamant about creating an actual team that includes a bit of play with their work. We’re hacking on a new piece of Harvest that we think will improve this situation. We also have been trying other ways to establish a distributed watercooler.

I hope to see you at MinneBar. If you are interested in distributed teams, please come participate in our panel discussion. Even if you are just considering breaking those corporate shackles for a more humane work environment, what a great way to jump start your search!