Webbynatra

I do a few development jobs on the side for friends. One such friend got in touch with me about a week ago wanting me to add a form emailer to his static html site (I developed it using Webby). My first thought was to set it up as a Rails app, but that seemed a little overkill for adding a single feature, especially when Webby gives me layouts for static pages and with Rails I'd have to put a solution for that together. Then I thought about using Widget Finger, but I really didn't want to push him to pay for it, especially not when I already had the site hosted on a virtual private server that we have for Hello Theory.

That's when it hit me. I could use Webby to generate an app that was mostly static, but that used Sinatra to handle the form emailer. Starting with my original Webby site, here's how I did it.

First, I added a folder to the project's content folder named public, and moved all of the existing content files into that folder.

mkdir content/public
mv content/* content/public

Next, I added a new Rackup file (config.ru) to the content folder based on these directions.'

require 'rubygems'
require 'sinatra'

root_dir = File.dirname(__FILE__)

set :environment, ENV['RACK_ENV'].to_sym
set :root,        root_dir
set :app_file,    File.join(root_dir, 'simgins.rb')
disable :run

run Sinatra::Application

I set up my Sinatra script to send email using Pony and tested it. There's a great example of using Pony to send email with Sinatra in the Sinatra FAQ.

Finally, I deployed using Webby's deploy feature:

webby deploy

The combination seems to be working like a charm, and keeps things way simpler for static page development than Rails would have. One small issue that I have is that I haven't come up with a good way to touch the tmp/restart.txt file to get Passenger to reload the app each time I deploy, but I've got a few ideas on that.
Personally I would like Microsoft to get more involved with HTML 5. They’ve sent very little feedback over the years, far less than the other browser vendors. Even when asking them about their opinion on features they are implementing I rarely get any feedback. It’s very sad.
Ian Hickson

What's Up With Rough Updates, Apple?


Tonight I installed the new OS X 10.5.7 update, and it was horrible. First I tried to use the system updater, and it failed to download 4 or 5 times in a row. Then, I manually downloaded the update from their site and installed it. As my computer restarted, it got into a weird state where a blue screen with a spinner would display, and then a lot of noise would show, and then the whole thing would repeat. I let my computer sit about 20 minutes and then powered it off. Then, my computer restarted three times as I tried to power it back on. And, this thread on MacRumors looks like a lot of people had the same experience.
Last year Apple’s rollout of the iPhone 2 software and Mobile Me was horrible. Mobile Me didn’t work for weeks, and the iPhone 2 had to be restarted every week at first. These difficult upgrades are tarnishing the brand that Apple has built of great user experience.
I love Apple, don’t get me wrong. In fact, I’m one of the biggest Apple fans that I know, and I’m sure tomorrow I’ll be defending this update and Apple in general at work. That said, I’d love Apple even more if their updates were a little less painful. I shouldn’t have to jump through hoops to get things like that working, and I don’t have to jump through hoops if I’m using a Windows machine and I want to update my operating system, it just updates.
So Apple, I’d suggest one of two things. Either stick with the really bizarre upgrade process with multiple restarts and the crazy loop of blue and black screens, but tell me what’s about to happen, or fix the process so it’s a little more painless.
I’ve got to go get some rest so I can defend you in the morning.

Introducing Control Center



For the past couple of years I’ve had a general way that I wrote admin interfaces in a lot of the web apps that I’ve written, and I finally took the time to release that as a project. So, this past Friday I released Control Center 1.0. It’s a base layout and stylesheet for Rails that helps you write admin interfaces amazingly quickly (install the gem, run script/generate control_center, and customize some links). It’s hopefully interesting to some folks, and if not, well, it being a gem makes it tons easier for me to use.

So go check out Control Center on Github.

Back To Using RSS

Well, I've been experimenting with not using a feed reader anymore for
the past month or so, and while it worked pretty well to look at just
a handful of my favorite sites on a daily basis, I miss the sheer
quantity of information that I was used to seeing every day.

With that said, I really wish that there was a feed reader that would
prioritize my news a bit better for me. I would love to see my feeds
organized by online popularity (maybe based onumber of links to the
story) and by my favorite topics. Also, I would love a reader that
would group duplicate posts together and would follow stories back to
their source. That way I could go through and see most of the news
that I probably want to see and less of the stuff that I probably
don't care about.

Gotcha When Testing Formats

It's always a little amazing to me in working with Ruby and Rails that sometimes using symbols works great and sometimes it doesn't. It's really something that should be used in moderation, because symbols are a sort of controlled memory leak. Anyway, the other day I was testing some csv generation code in Log for Life, and I ran into an instance where a symbol isn't acceptable and you might think it should be. I had a block something like this:


respond_to do |format|
  format.html { handle_html }
  format.csv { handle_csv }
end

And I was testing it something like this:


get :action, :format => :csv

My test kept failing because the application was using the html block instead of the csv one. Well, a bit of snooping around showed me that it was an issue of using a symbol versus a string, and changing :csv to "csv" fixed the problem:


get :action, :format => "csv"

Overall, I think Rails needs to be more consistent about taking in either symbols or strings, or at least tell us when they're going to accept which. In this case, it makes tons of sense to use a string, because you can't pass a symbol over http anyway, but still, it's annoying to have to search around and feel crazy because your simple test isn't working like you would expect it to.

Obama Flickr Photostream

This set of photos from Election Night is awesome . It would really be awesome if he keeps the photos coming when he gets into the White House.