April 29, 2005

Ruby Sparklines.

The being known as why has posted to RedHanded some ruby code to create in place sparklines. The PNG version makes incredibly small inline graphs - 100 datapoints in 630 to 700 bytes!

I've added sparklines to the backend sales report of a small business site that's powered by rails. Here's a screenshot of actual use (product names replaced with fakes)

Posted by Daniel at 04:40 PM | Comments (0)

April 21, 2005

Explicitly settings Rails' gem versions.

I work on several different Rails sites. With the fast pace of Rails development, often sites will break when Rails is updated. To avoid this, I always specify the version of the components that a site uses. Rubygems' magical ability to pull up old versions of libraries comes in handy.

So instead of having this in config/environment.rb

require_gem 'actionmailer'
require_gem 'actionpack'
require_gem 'actionwebservice'
require_gem 'activerecord'
require_gem 'activesupport'

I add hardcoded version numbers, like this:

require_gem 'actionmailer', '= 0.9.1'
require_gem 'actionpack', '= 1.8.1'
require_gem 'actionwebservice', '= 0.7.1'
require_gem 'activerecord', '= 1.10.1'
require_gem 'activesupport', '= 1.0.4'

Now since I don't like looking up those version numbers and entering them by hand, I have a ruby script that creates a list of the latest rails gem's on my computer.

gems = [
 'activesupport',
 'activerecord',
 'actionpack', 
 'actionmailer',
 'actionwebservice']

gem_list = `gem list`

gem_list.each{ |line|
	#Find gem name and latest version
	gem_data = /^([^ ]+) \(([^,]+),?.*\)$/.match(line)
	if gem_data && gems.include?(gem_data[1])
		puts "require_gem '#{gem_data[1]}', '= #{gem_data[2]}'"
	end
}
Posted by Daniel at 11:05 AM | Comments (0)

April 20, 2005

Big Truck v.s. Big Lighting board.

As far as I'm concerned, there is not a cooler truck than one of the huge Dodge dulie Diesels. I priced one out this morning for fun, with all the options I could think of using. Capable of towing 6.5 tons, it came out $46,575.

But in the professional lighting world, a good control board for intelligent lights costs more than that truck! The GrandMA retails for $49,500.

Posted by Daniel at 08:13 AM | Comments (0)

April 15, 2005

Colour Lovers.

Nice color selections for design ideas at Colour Lovers

Posted by Daniel at 08:58 AM | Comments (0)

Rails Day..

Build a complete web application in a day. It's Rails Day on June 4th.

If you don't know Rails, go and learn. :P

Posted by Daniel at 08:53 AM | Comments (0)

April 11, 2005

The Classes.

Some silliness from the pragmatic programers mailing list

On Tue, 5 Apr 2005, Dave Thomas wrote:
> Fundamentally, the problem is that class-based OO is flawed in its idea that everything can be categorized hierarchically.

On Apr 9, 2005, Mathieu Bouchard wrote:
It's the struggle of the classes. The classes want more power, so they coerce people into designing everything around them. I know, I've read Marx, or at least a chapter of him.

Posted by Daniel at 09:06 AM