Skip to content

Web nourishment by John Ford and crew

Archive for November, 2006

More Proof That Simplicity Pays

John Ford Nov 18, 2006

While actually on a flight, I came across an interesting New York Times article discussing US Airways bid to acquire Delta. Now, I’m interested in this possible acquisition due to all of my travels but more so due to the charts they provided.

Airline Complaints (via NYT)

As you probably noticed, US Airways and Delta rank pretty high in customer complaints, which doesn’t bode well for customers if a merger does take place. But, more importantly, take a look at Southwest. They are #2 in total passengers compared to the other major U.S. airlines and they only have a fraction of the complaints!

So how has Southwest Airlines enjoyed 33 straight profitable years and done what no other U.S. airline seems to be able to do? I think Jason Fried summarizes it best:

Simple fares (no secrets, one-way fares aren’t more expensive that round trip fares, fewer fees), simple planes (they only fly 737s — every SW pilot or flight attendant can work any flight), simple seating assignments (they don’t have any), simple meals (they don’t have any), simple friendliness (shiny happy people), less big airport hassles (serving the unserved at smaller, simpler airports), dead simple rewards program (based on # of flights, not miles), simpler fuel costs (they buy futures to lock in prices), etc.

I hope you’ll think long and hard the next time you want to make your web application, business, or product “bigger and better” because simplicity does pay.

script.aculo.us Slider Demos and Example Code

John Ford Nov 12, 2006

I’ve been following along the script.aculo.us Slider Demo discussion area recently and have tried to answer questions when possible. Since it’s difficult to post examples to the discussion I’ve compiled a more extensive set of Slider demos. Some are examples that I’ve wanted and others are in response to questions in the discussion area.

The demo code includes the following slider examples:

  • Standard Slider
  • Reversed Slider
  • Slider Controlled with Mouse Wheel
  • One Slider Controlling Multiple Sliders
  • Using Images to Spruce Up a Slider
  • Two Colored Slider
  • Submit the Slider Value in a Form
  • Use a Slider as a Scrollbar (added Nov 21, 2006)
  • Change Slider Value by Changing Text Input Field (added Jul 16, 2007)

It’s really amazing what you can do with the script.aculo.us library. Please let me know what you think!

Net Neutrality Interview with Craig Aaron of Free Press

John Ford Nov 11, 2006

If you’ve not heard about Net Neutrality please listen to the most recent and extremely informative Conversation with Andy Coon (about 25 minutes long). Everyone needs to know how important the issue of Net Neutrality is and how Congress is trying to push a law that would give telephone and cable companies the ability to decide what we see on the Internet. Those of you who made it to the Linking Thoughts presentation will appreciate the importance of this on a whole new level. You’re not going to hear about this on the news because they are the ones who would benefit from this!

has_many :through Self-referential Example

John Ford Nov 10, 2006

While using an association table for the first time with Ruby On Rails I had a bit of trouble finding an easy to understand example of has_many :through. I needed to build a self-referencing table where People could have other People as friends through a Friendship. I was getting “stack too deep” errors, “could not find the association” errors, and also crashing Webrick before I figured out the correct setup. Here’s how I did it:

# the people table
create_table :people do |t|
  t.column :name, :string
end

# the friendships association table
create_table :friendships do |t|
  t.column :person_id, :integer
  t.column :friend_id, :integer
  t.column :authorized, :boolean, :default => false
end

class Friendship < ActiveRecord::Base
  # don't have to give class_name or foreign_key b/c ActiveRecord reflection works here
  belongs_to :person

  # make sure to give class_name and foreign_key b/c ActiveRecord doesn't know what friend is
  belongs_to :friend, :class_name => "Person", :foreign_key => "friend_id"
end

class Person < ActiveRecord::Base
  # tell ActiveRecord that a person has_many friendships or :through won't work
  has_many :friendships

  # create the has_many :through relationship
  has_many :friends, :through => :friendships

  # an example of how to get only the authorized friends
  has_many :authorized_friends, :through => :friendships, :source => :friend, :conditions => [ "authorized = ?", true ]

  # an example of how to get only the unauthorized friends
  has_many :unauthorized_friends, :through => :friendships, :source => :friend, :conditions => [ "authorized = ?", false ]
end