Rails Multiple CSS Classes

I searched online but found little help on this quickly, so figured I’d post what I found under a good name.

If you want more than one CSS class when using a Rails helper, use the format:

Read on →

Gamification Is Not Entirely Bullshit

This post was inspired by Jared Brown’s recent gamification comic and reading the temporarily popular Gamification is Bullshit article, and my recent startup experience.

Research

At the startup that I just worked at (RewardSnap), we decided to create a game to encourage people to do crowdsourcing of deal ratings. Instead of just crafting a game from scratch, I decided to do a bit of research into the mechanics of modern games. I figured there were companies like Zynga out there that were doing cutting-edge work on viral loops and making games engaging to people. Why not learn from others before setting off on a path that I had little knowledge about?

As I researched, I stumbled over Game-Based Marketing. It was an interesting look into the psychology and history of games for business purposes. Throughout history games and gimmicks have been used to sell merchandise and reward loyal customers. Everything from buy ten get one free, to loyalty cards, to frequent flier programs, to more modern alternatives like Foursquare. Frequent flier programs, in particular, are driven by status more than economic matters. People will literally go out of their way to take flights that earn them extra miles, in an effort to get a higher ranking in the program. If you’ve seen the movie Up In The Air with George Clooney, you might have an idea what this is like.

Read on →

The Case Against Writing Backlogs

If you have things you want to write about, I’ll make a case against keeping a large backlog.

Immediacy and Inspiration

It’s more useful to write about experiences at a recent conference right now instead of two months from now. The time delay not only dampens memory, it also weakens excitement. It definitely helps to write about things when I am first excited or think about them, because once the enthusiasm fades it feels more difficult.

Topics that I once thought were fascinating are no longer so after I have been exposed to them for awhile. Strike while you are inspired with learning, because after that energy passes, you are less likely to be interested in it because you have already internalized the concepts. It’s hard to get fired up about something that you see as obvious. Here is a great summary of this idea.

Read on →

Using Scalpel to Recover Lost Data in Ubuntu

So there I was, editing my personal writing journal. I realized that the file had somehow lost a large chunk of data, and only had the last few entries. My backups had the same information, so I was staring at six months of data loss on an important personal file.

This post covers how I got the data back, good as new.

Is the disk bad?

The first thing I did was to search through the hard drive to see if the text was lying around somewhere in another file or I had deleted a vim swap file. When you use vim (in my case, gvim), by default it creates a file when you are editing it. Then, if the machine goes down while you are editing it, you can restore the file from the autosaved swap file. Unfortunately, I didn’t find the data on my hard drive after searching around.

The disk itself didn’t seem to be having any problems. There were no audio indications of failure, and no other files missing to the best of my knowledge. However, I figured that I should run a disk check to ensure that I wasn’t dealing with the early stages of more widespread data loss. Tools like fsck require that you run them when the drive is not mounted, so I needed to find a way to unmount the drive and run it. Since I was running Ubuntu, I found a helpful command:

sudo touch /forcefsck

This tells Ubuntu to run fsck on the next startup, before the file system is mounted. I ran this, and the file system appeared to be the same.

Read on →

smtp.rb:14: [BUG] Segmentation fault

I just fixed a problem that I was running into on my Mac development machine. Things were running fine in my production environment (Heroku) but when I tried to send mail locally, I got the following error:

> rails c        
Loading development environment (Rails 3.0.8)
ree-1.8.7-head :001 > MyMailer.daily_email.deliver
~/.rvm/gems/ree-1.8.7-head@mygemset/gems/mail-2.2.19/
  lib/mail/core_extensions/smtp.rb:14: [BUG] Segmentation fault
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.7.0]
zsh: abort      rails c

Hmm. I indeed use SMTP to send mail, but nothing too crazy. Plus it worked in production, and up until recently it was working locally. For more background, I was also using the Sendgrid plugin.

Read on →