September 2007 Archives

Seth Godin Recommends CSS

Posted on September 29th, 2007 by Chris

Seth Godin on CSS. Not sure what to make of this to be honest. Wonder what sparked his desire to suddenly blog about it? Regardless, Seth: we here at Bust Out couldn’t agree more. Have your web team read this book, or this one, or this one. We like them all. Cheers!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Choosing The Right Technology

Posted on September 23rd, 2007 by Chris

Thought provoking article about the square peg, round hole syndrome. Oftentimes it makes sense to do what you know, as long as it works of course. It’s nice to see someone explore, even in a restrospective, the many facets that go into making a particular technology decision.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Open Source Abuse

Posted on September 22nd, 2007 by Chris

I was doing some research today on using the acts_as_ferret plugin for an upcoming Bust Out site, when I quite accidentally stumbled upon this interesting post regarding how terrible and misleading the plugin apparently is. The tone certainly seems disproportionate to the offense. And I’m no enterprise search architect, but I understand that distributing an index when running in a cluster is a fairly common architectural approach. I sure wouldn’t want to buy this guy a free meal he didn’t like.

I don’t mean to pick out this post in particular, especially as the blog advertises itself as some sort of open source debunking machine. I also don’t mean to oversimplify the (non)-validity of critical postings, as constructive criticism and community policing are both valid reasons for (negative) open exchanges. However, the frequency with which I see fairly narrow, one-sided rants about freely provided software - free to use, free to make all sorts of modifications to and likewise free to ignore, is disconcerting. It seems few things are free these days.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Local web development on Mac OS X

Posted on September 20th, 2007 by Jeff

Note: See an updated posting for local web development on OS X Leopard

By default, Mac OS X ships with an installation of the Apache web server. If you’re a web designer or developer, this is a great tool to help you develop websites locally, increasing development speed and improving your quality of life. To get up and running, follow these easy steps:

  1. Open your System Preferences… Sharing
  2. Turn on Personal Web Sharing
  3. The URL at the bottom of the screen maps to your /User/username/Sites directory, which is where you should place your local website files. You can also access your local web server by hitting http://localhost/~username/ (replacing ‘username’ with your actual username.)

You can place multiple website projects in your Sites folder by simply creating one folder per project, and accessing each project by corresponding URLs such as http://localhost/~username/MyProject/ and http://localhost/~username/MyOtherProject/. If you like to use absolute paths in your HTML code, you will have to use the following convention:



This is obviously not very convenient, especially if you’re sharing your code through a repository with other developers who do not share the same username. Additionally, once you complete local development you need to strip out the /~username/MyProject/ before deploying your code to a public web server. To get around this hurdle, you can customize your Apache server to use custom URLs by following these steps:

  1. Edit the httpd.conf file. I do this using vi in Terminal, by executing the command:
    
    sudo vi /etc/httpd/httpd.conf
    
  2. Uncomment the NameVirtualHost line and edit the line so it reads
    
    NameVirtualHost 127.0.0.1
    
  3. Add the following lines to the file:
    
    
       ServerName MyProject
       DocumentRoot /Users/username/Sites/MyProject
    
    
  4. Edit the hosts file by issuing the command:
    
    sudo vi /etc/hosts
    
  5. At the end of the file, insert the the line:
    
    127.0.0.1 MyProject
    
  6. Go back to System Preferences… Sharing, stop Web Sharing, then start it again. This action bounces the Apache web server.

You should now be able to access your project at http://MyProject/, which also allows you to use “real” absolute paths in your markup.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Getting Started With DataMapper and Rails

Posted on September 17th, 2007 by Chris

I’ve been tracking progress on the DataMapper ORM framework for a little while now and was pleased to see it moved recently to a shiny new site. To celebrate the progress, I decided to write a little bit about how to get started using DataMapper in a Rails application.

The DataMapper ORM derives its name from a Martin Fowler pattern, much like its data access brethren ActiveRecord. Very simplistically, the two patterns differ primarily in regards to how much they are ORM aware, the Mapper pattern in this case ends up trading some magic for greater flexibility. Hibernate is perhaps the preeminent (or at least most popular) open source DataMapper ORM at the moment, and its very well documented in numerous books if you feel like exploring the pattern in greater depth.

With that, lets explore setting up a simple Rails application using DataMapper. To begin with, download the DataMapper gem:


    sudo gem install datamapper
 

As a firm believer in “vendor everything”, I’m using Dr. Nic’s Gems on Rails gem to store my gems in my Rails vendor project folder. Using gems on rails (or anything similiar) is not a prerequisite to using DataMapper, but I find it makes it easier to make code tweaks (not to mention keep others you’re working with more sane in CI enviroments). If you do find yourself using the gem, you’ll need to change the following line in the datamapper init.rb file: require_options = [”datamapper”] to be [”data_mapper”].

After making those changes, go ahead and set up your database.yml file and create your database. DataMapper is able to use your database.yml. However, I had to comment out the following line in data_mapper.rb to get that working: cache WeakHash::Factory. Not exactly sure why yet, but perhaps I’ll get to that later.

Anyway, after that you need to require the following at the bottom of your environment.rb:


require 'rubygems'
require 'data_mapper'

I also turned off active_record as I’m running edge rails:


config.frameworks -= [ :action_web_service, :action_mailer, :active_record ]

Next, go ahead and define your models. In my case, I was building a restaurant application with a cocktail menu. So I created a Drink model:


class Drink < DataMapper::Base
   property :name, :string
   belongs_to :menu
end

After I created my model, I wanted to test it right away to see where I was at. So I fired up the Rails console. DataMapper has a nice feature that allows one to create a table through an ORM API, in this case via the following command:


>> database.save(Drink)
=> true
>> Drink.superclass
=> DataMapper::Base

So far so good, so I decided to make myself a drink:


>> d = Drink.new
=> #
>> d.name = “Nice Cold Beer”
=> “Nice Cold Beer”
>> d.save
=> 1
>> Drink.find :all
=> [#]

A simple example, but also a harbinger of things to come. The code base is seeing quite a bit of activity from the 0.1.1 version I’m on and I look forward to exploring more, particularly around advanced associations and performance. Cheers.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

jQuery UI Looking Good

Posted on September 17th, 2007 by Chris

jQuery UI was released Sunday night. The demos look pretty nice and quite similar to some of the work Bust Out has been doing recently for some photography and design sites. I’m looking forward to see where the jQuery team take this library, as well as the effects this release might have on some of the other popular open source libraries.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Radiant CMS for Rails Developers

Posted on September 16th, 2007 by Chris

I recently ported an existing Rails site to the Radiant CMS as our client wanted changes more frequently that initially anticipated. The good news is that the port went well. Radiant is a nice system. But I did struggle just a wee-bit. So, as I typically don’t do front-end stuff at Bust Out, I figured I would take the opportunity to post a few things about what I went through from the perspective of a Rails developer accustomed to controlling my own destiny vis-a-vis MVC/Erb, rather than letting a CMS do it for me.

I’ll start with the layout. Our Erb layout looked like the following:



<%= yield :layout %>
<%= render :partial => “/layouts/footer” %>

We’re setting the body class dynamically to highlight page navigation. The yield and render partial statements should look familiar to anyone with a working knowledge of Rails.

Now lets look at the Radiant version of the above, which uses the Radiant tagging system:



Radiant provides a number of different ways to generate content, the predominant methods being creating layouts, snippets and pages. In Radiant, our partials become shared snippets, our yield statement is replaced by a content tag, and our sidebar is replaced by a page content part (created in the pages tab) that is inherited by all child pages and can likewise be overridden by child pages with different sidebar content. Lastly, we’re using a Radiant tag that infers the title of the current page being navigated to in order to drive the “where am I” functionality of our header navigation.

A relatively simplistic example, but hopefully somewhat illuminating. In the next post, I’ll discuss creating pages and some more dynamic content. In the meantime, we encourage anyone looking for a nice clean ruby CMS to give Radiant a try. Cheers!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Capistrano SSHAgent Error

Posted on September 8th, 2007 by Chris

Small Capistrano tidbit. If you see the following error when running cap deploy (or setup for that matter):
(Errno::ENOENT: No such file or directory - /tmp/501/SSHKeychain.socket), try using the following command: unset SSH_AUTH_SOCK. I think Capistrano may just be picking up an SSH_AUTH_SOCK environment variable set by some prior ssh-agent that is potentially no longer there. Thats how it appears, at least. BTW, I’m running Capistrano 2.0 from a mac.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Programmer vs. Monkey

Posted on September 6th, 2007 by Jeff

Indeed.com provides data on job trends based on information from millions of jobs from thousands of job sites. I decided to check out a few jobs to see which direction the trends are going. I think I found my calling. I’m gonna be a monkey.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]