Tuesday, May 29, 2007


email is so 1990's.

the kids now are on IM and Facebook. What is next after that?

IM is toally IRC which is so 1990s as well.

Voice chat?

Video chat?

Telepathic chat?

Etheric chat?

Monday, May 28, 2007

subdomains with account_location plugin

One critical piece of information they neglect to mention in the account_location plugin is that you need to have an Account model that the account_location plugin will use to get the account name, and it needs to set the @account instance variable.

This post at cleanair tells you how to do this step by step.

Ruby on Rails dudes, you gotta write some better documentation. I know it's great to write lots of code, but it's even better if other people can use it.

Sunday, May 27, 2007

critical mass of peace conciousness

I'm part of the critical mass of peace consciousness.

more rails

neat rails plugins

Some neat new Ruby on Rails plugins:

stickies - A better flash, they are sticky.
ActiveMessaging - Oooh sweet, this is exactly what I need for structurecloud.com

jobs at google vs jobs at meetup

This is neat.

a house that heats itself

Very neat interview with a designer of houses that heat and cool themselves. That idea of a phase change is a really awesome idea, just think of how ice takes a long time to melt or freeze, but do that inside the wood with a resin natural to the tree. Wild.

more reasons to love ruby on rails

Sometimes, Ruby on Rails just rocks. This is one of my fixture files for a new Day class that I'm developing. The fixture file lets me write all my tests and specs out so that the dates they reference keep up with the current date.

id: 1
date: <%= Time.now.yesterday.yesterday %>
id: 2
date: <%= Time.now.yesterday %>
id: 3
date: <%= Time.now %>
id: 4
date: <%= Time.now.tomorrow %>
id: 5
date: <%= Time.now.tomorrow.tomorrow %>

melanie robinson

I just woke up this morning to a song by Melanie Robinson, it was playing on CBC, in the morning when they play the Australian public broadcaster ABC. Wow, what an amazing song.

Saturday, May 26, 2007

order column in a model causes problems

Here's a little problem I ran into with Ruby on Rails recently, I figured it out and wanted to share it with you:

I had a model where I was doing a :has_many with a model that I wanted to order by a column that I named "order", it looked like this:

class CreateProgramExercises < ActiveRecord::Migration
def self.up
create_table :program_exercises do |t|

t.column :position, :integer


class Program < ActiveRecord::Base

has_many :program_exercises, :order => "order"
has_many :exercises, :through => :program_exercises


When I tried to test this, I got the following error:

3) Error:
test_spec {General tests} 003 [ProgramExercises should be ordered by order column](General tests):
ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order' at line 1: SELECT * FROM program_exercises WHERE (program_exercises.program_id = 1) ORDER BY order

It turns out that you can't call a column that you want to order "order", you have to call it something else, so I just changed the name to "position" and it worked.

(n.b. I had first changed it to the next logical name "index" but MySQL didn't like that either)

Friday, May 25, 2007


I have a lot of my resources online, but I'm finding that I can really absorb information from books in a different, maybe better, way than I can online. If you stack all the books that I'm reading right now on top of each other, it's a pretty big pile:

CSS : The Definitive Guide - Fantastic reference book, essential. I learned CSS by just determined hacking and reading the specs last year, and I wish I would have got this book before all that pain and struggle. Reading the XHTML/CSS spec is cool, but you will save yourself much pain by reading this book first.

JavaScript: The Definitive Guide - Amazing book, it paid for itself in about the first 2 hours of reading. Is really the definitive guide to Javascript, starts off with all the basics, and then gets into the really hairy stuff. Has some great reference chapters, essential.

Programming Ruby: The Pragmatic Programmers' Guide, Second Edition - Ruby is a totally awesome language, you can learn it really well off the web, but it's nice to have this book to peruse on the couch to learn really complex things like blocks and closures.

and I just ordered:

MySQL : Paul Dubois

contexts, test/spec and ruby on rails

For this new Ruby on Rails project I'm coding, I'm doing The Right Thing and am writing specifications for everything before or during the code writing process. I'm also making the application really model heavy, as I have found out the hard way that testing or speccing controllers is quite a bit more tricky than just adding more methods to your models. Model heavy applications is also probably The Right Thing, as it makes your controller code easier to understand, and moves functions to smaller Model methods.

I'm using test/spec, but I was quite confused about exactly what a "context" is. Here's a great definition from Luke Redpaths blog:

"Behaviour Driven Development favours the breaking up of specifications into individual ?contexts?. A context is
an object (or collection of objects, but generally object being specced) in a certain state."

This makes a lot of sense, since the "setup" function is within each "context". So, if you were coding an application, you would break up your unit tests into a bunch of different contexts, each of which would have a different set of model objects. Perhaps one for your most general tests, another to make sure your validations are all working, and another to test your business logic on a smaller subset of fixtures or hand built models.

habtm and migrations

An article about using has_and_belongs_to_many with migrations. They say to:

create_table :table_name, :id => false do |table|

Here's a more fleshed out example:

create_table :exercises_types, :id => false do |t|
t.column "exercise_id", :integer
t.column "type_id", :integer

Thursday, May 24, 2007

ocean and atmosphere

I was watching a TED podcast and she had images of the ocean currents, so I got curious.

wireless power

A cool article about wireless power. One very cool application would be at a dance club or rave, people could bring in little unpowered LEDs, glow sticks and devices, and they would start functioning on the dance floor.


lib2geom is a geometry library written for Inkscape but useful for other things as well.

play ogg

Play Oggs. If you have a choice, use .ogg instead of .mp3.

xanadu wiki

The Xanadu Wiki - One of the origins of hypertext.

rake db migrate test

To migrate the database to version 0, then migrate it to the current
version, then recreate the test database:

rake db:migrate VERSION=0 ; rake db:migrate ; rake db:test:clone

Terence McKenna _ Culture is NOT Your Friend

Culture is not your friend, a video of Terence McKenna talking.

Terence McKenna - The Last Word

Great video of Terence McKenna talking about culture and shamanism.

Wednesday, May 23, 2007

MIT Party Mode: MIDAS Automation System

nerd rave. i need to do this to my apartment.

MIT sketching

oooh, neato, but pretty nerdy, but hey, i like nerdy.

railsconf pdfs

All the presentations at the recent Rails Conf 2007 as PDFs. That's cool. Wish they had video as well.

the fountain

I just saw The Fountain by Darren Aronofsky, and it's one of my new favorite movies. Really sublime.

Tuesday, May 22, 2007

Observing the User Experience

A very interesting looking book: Observing the User Experience: A Practitioner's Guide to User Research

I'm really getting into UX lately. It's so important, and gets ignored most of the time, it's hard nowadays, because you need people with so many different talents on your development team, from a designer, to a user experience expert, XHTML/CSS coder, Javascript coder, Backend programmer (Ruby if you're lucky), SQL expert, Testing team, system administrator, Sales and Marketing team, Customer Support, and a CEO to bring it all together. How can you get something done quickly with a small team?

I tried to do some projects just by myself, this isn't enough people. I think maybe 5 people is the perfect size, but it might not be enough. Perhaps 3 at the core, and have people in remote locations helping with other tasks? It's so hard to coordinate remote teams and to get them all on the same page.

It's a mystery, one that I would love to solve. I want to live out in the country and still do great work.

I am here:

And I want to work with people all over here:

global aliases in zsh

Mmmm, global aliases in zsh rock.

I have one setup now to scp an image to my images directory on my webserver:

alias -g S=w:/usr/sness/www.sness.org/images

So, now I just have to type:

scp 29962050.jpg S

And the image is uploaded to my webserver. I still want to make this cooler by just typing:

S current-name.jpg new-name.jpg

But I haven't figured out how to do that quite yet.


progio exercise computer

Oooh, a shiny exercise computer. You can create custom workouts on your computer and download them to your Progio. Now, that rocks.

I was thinking though, wouldn't it be cool to do that with your iPod? I see so many people at the gym listening to iPods, hardly any other kind of music player, almost everyone has an iPod. Apple and Nike have a partnership, I wonder if they have an API?

new ux interview

I'm really enjoying the UX Interviews series. Today is an interview with Mike Kuniavsky, one of the founders of Adaptive Path.

the sun lives

A really good Astronomy Photo of the Day today, a movie showing a timelapse of the sun. I watched this over and over this morning, it's amazing.

Monday, May 21, 2007



Posted by Picasa

poem from julia butterfly hill

"Inspired by My Brother and My Father"

I waited for what seemed like an eternity. I waited for what I thought would never come. I waited for the dream to be fulfilled.

And all that time, the dream was merely me waiting to be remembered.

What I thought would never come was my life all along waiting to be fully lived.

What is the meaning of life? The meaning of life is to LIVE IT!

The meaning of life is to live it.

Oh right...

The meaning of life is to live it.

julia butterfly hill April 2007

muscle browser

A really nice muscle browser with the names of all the muscles in the human body.

muscle names

An excellent website to learn about muscle names

RailConf talks

Sunday, May 20, 2007

railsconf dhh keynote

Nick Sieger does a good job of summarizing the DHH keynote at RailsConf 2007.

A few new features in Rails 2.0, hopefully the deprecated plugin will keep us updated on what needs to change. I found this plugin really useful when moving from Rails 1.0 to Rails 1.1 and 1.2.

test/spec - assert_difference

assert_difference is really sweet with test/spec.

baked beans

1 lb navy beans
1/2 lb bacon or ham
3/4 cup chopped onions
1 green pepper
3/4 cup celery
1 can tomato soup
1 can diced tomatoes
1 1/2 tsp dried mustard
1/4 cup molasses
1/2 cup brown sugar

Wash dried beans, repeat, repeat soak overnight

Simmer 1 1/2 hours

Wash beans in hot water and drain well

Chop vegetables

Cook bacon

Drain/chop bacon

Sweat vegetables do not brown

Add rest of ingredients

Put everything in a slow cooker over low for 5 hours

Cook until done


I recently read an article about Elementeo a company that is developing an educational card game to help teach kids about chemistry in a fun way. The really cool thing is that the CEO is 13 years old.

This is so cool, bringing fun and education together, right now, so few educational toys are really fun, we need to come up with more ways to make work and education fun, so that when you're playing a game at the same time you're working or having fun.

Now, can we do something like this in the online space?


err the blog has a nice post about their enhancements to the will_paginate plugin.

Pagination will be removed from Rails 2.0, so now is a good time as any to move over to using more modern ways of paginating. I never really liked pagination in Rails, it didn't feel very slick.

The other thing that I really don't like with Rails, is the whole word choice of "has_one" and "belongs_to". Whenever I'm coding up a new project in Rails, I have to think hard if this is a "has_one" or a "belongs_to" relationship. The way I solve it is by thinking about where the foreign key should logically go, which is just ridiculous, because the ORM mapping of ActiveRecord is supposed to *help* me, not make things more complicated. Those words are just poorly chosen, and I think the problem is that the relationships we are mapping are more complicated than just a "has" and "belongs_to" relationship.

I think these words were chosen because they approximately map onto which table has the foreign key, the table with the "belongs_to" has the foreign key. Ok, that's easy enough to remember if you hammer it into your brain, but just doesn't seem to be the right choice of words.

You really see this when you start doing polymorphic associations and STI, where you pass in a parameter hash to the :belongs_to and :has_one methods. It starts getting really ugly and just doesn't map onto my mindspace about the problem.

We seriously need new words in ActiveRecord instead of "has_one", "has_many" and "belongs_to". Right now, they suck.

Saturday, May 19, 2007


I've been having a lot of fun the last couple days doing Behaviour Driven Development (BDD) with test/spec on that new Personal Training online site that I'm coding in Ruby on Rails.

I first setup a User class, modifying the User class generated by acts_as_authenticated.

Then, I added Trainer and Client classes that use a polymorphic association to subclass the User class. It was a little strange, I first was thinking about using Single Table Inheritance (STI), but I figured that the Trainer and Client classes are sufficiently different from each other to warrant their own classes.

If I used STI, I would have had to put all the data for both the Trainer and the Client into the User model. These two roles are quite different, for example, a Trainer would receive a monthly invoice from us, but a Client would receive a monthly invoice from the Trainer. With STI, things could get pretty complicated, so I'm going to try polymorphic associations for now.

To do those polymorphic association for the User, I added a role_id and role_type fields to the model, and :polymorphic to the :belongs_to

# role_id :integer(11)
# role_type :string(255)
class User < ActiveRecord::Base
belongs_to :role, :polymorphic => true

Added the "has_one :user" and the "has_many :clients" to the Trainer:

class Trainer < ActiveRecord::Base

has_one :user, :as => :role
has_many :clients


and added the "has_one :user" and "belongs_to :trainer" to the Client:

class Client < ActiveRecord::Base

has_one :user, :as => :role
belongs_to :trainer


Then, I wrote a whole bunch of specifications to test everything backward and forward. Here's the test for the Client class, the Trainer class is almost identical:

context "" do

fixtures :trainers
fixtures :clients
fixtures :users

setup do
# Trainers
@deryn = trainers(:deryn)
@gordo = trainers(:gordo)
# Clients
@sness = clients(:sness)
@matt = clients(:matt)
@melissa = clients(:melissa)

specify "Client and User should be easy to create and link together" do
t = Client.new
u = User.new
u.login = "userlogin"
u.role = t
u.role.should.be t
t.user.should.equal u

specify "Client should be able to be associated with a User" do
@matt.user.should.equal users(:matt)

specify "Client should be associated with a trainer" do
@matt.trainer.should.equal @deryn
@sness.trainer.should.equal @deryn
@melissa.trainer.should.equal @gordo

specify "Should be able to add a Trainer to a Client" do
c = Client.new
c.trainer = @deryn
@deryn.clients.length.should.equal 3


Friday, May 18, 2007

sub-domains with rails

In my new Personal Trainer website that I'm designing, I really want to have subdomain URLs for each trainer, so for example, if our site was:


For a trainer named, for example "Deryn", she would have her own URL:


URLs like these will be really easy for trainers to put on their business cards, and besides, all the cool kids are doing it.

So, I'm learning how to do this in Ruby on Rails, and am using the following resources to help me:

url for domain at the Ruby on Rails wiki
The request_routing plugin.
virtual hosts in apache
Deploying multiple applications on the railsforum
Building A Multi-Site Application
The account_location plugin
Integrating the account_location plugin with acts_as_authenticated

For authentication, I've finally moved away from the ancient Login Generator with my custom remembralls that I adapted from lightbox, and am using the modern acts_as_authenticated plugin. Some more information is on the Rails wiki. I'm thinking of integrating it with OpenID but that's probably going too far.

stop designing products

A podcast from SXSW 2007 entitled Stop Designing Products.

dhh buzzword bingo

play buzzword bingo when DHH gives his talk at RailsConf in Portland.

It's funny because it's true.

javascript tetris

A really decent Javascript Tetris.

pay what you will

Wow, this is so amazing, for her new album, Jane Siberry lets you decide how much to pay for a song.

She has five different categories:

  • A gift from artist: $0

  • Standard price: $0.99

  • Self-determined, pay now

  • Self-determined, pay later


For the Self-determined, she shows the average price paid by other people, and you can choose your own price.

So cool, quite often she actually makes more money than she would on iTunes:

The current pricing statistics listed at the site:
18% Gift from Artist
18% Standard
05% Pay Now
58% Pay Later

Avg Price/Song $1.17
07% Paid Below Suggested
80% Paid At Suggested
14% Paid Above Suggested

This is so cool, the record companies are going down, and we are going to have more music than ever. For those musicians out there, like me, it will be easier to actually make money being a musician, without selling your soul to the music companies.

track your fitness progress

trainer force

Trainer Force looks like a good site that does something similar to what I want to do with Deryn, but it's pretty expensive and looks clunky to me.

Virtual workouts can be dangerous

Virtual Trainers can be hazardous to your health. I really like having a personal trainer, I had one in Edmonton, and she really helped me to optimize my workout. I have a trainer down in Victoria, her name is Deryn Macey, and when I last when to see her, she helped me correct some of the small alignment issues that I had, these helped my workout a lot.

One of them was that I was dropping too much in the middle doing pushups, and that this was putting strain on my lower back. I'm now concious of that, and I've noticed that it's really helping.

I'm working with Deryn now to build a website for Personal Trainers, to let them interact with their clients over the internet. I think that something like this is much better than a virtual trainer, a computer program that just puts you through a programmed workout. The virtual trainer might push you too hard, or rather, you might get the program to push you too hard, which could lead to injury.

My fitness philosophy now is to go hard, but to think of getting in shape as a life-long process, something that I want to do for the rest of my life, and that getting injured in my quest to get fit too quickly isn't going to help anybody.

high tech workout

A high-tech gym. Wow, this is so cool, I love the gym that I'm at, but it could be so much cooler if all the equipment was networked together and could track my progress. I used to belong to a gym in the Netherlands where they had all the cardio equipment hooked up via a wireless network, you would sign in to a touch screen when you went into the gym, then, when you went to a cardio machine, you would just have to type in your code and it would setup your own personal workout for you.

what the agile manifesto left out

Six years later: What the Agile Manifesto left out is a good article about what things need to get added back into agile programming.

I think there are a few ideas from agile programming that really rock, but more of them are just like "WTF!?!?". Pair programming? What a bad idea. Testing? What an amazing idea. It's a strange amalgam of ideas, and I find it strange how they are all lumped in together.

I would say, though, that I consider myself to be an agile developer now. I love the quick iterative cycles, the testing baked right in, the talking to the customer at every stage, the actually delivering a product.

world wide coding

Tools for Geographically Distributed Software Development is a good article about some of the software tools you can use for developing software with developers spread over the world.

I've worked in a few geographically diverse projects, in one of them we used Google Mail, Google Chat and Trac. In one of the others we used JotSpot and Campfire.

There were things I liked and didn't like about these tools, I liked the speed of Google Chat, but wished it was more like a Campfire chatroom, where more people could come and interact together. I didn't like how slow Campfire was, and that it put these big "sness has entered the room" and "sness has left the room" messages right in the conversation flow, but I did like how it let you see the history of the conversations of the day.

I loved Trac, and will use it in the future. Jotspot, not so much, it has a lot of features, but was slow as molasses and just didn't feel fun to use.

podcast language lessons

Learn another language with Podcasts. Right now I'm signed up to the Japanese podcasts, because I really want to learn Japanese, and the Dutch podcast, to keep my little bit of Dutch speaking ability, from my two and a half years in The Netherlands.

ruby as a language for education

I love Ruby, it's just such a nice place to live. This article at O'Reilly Net talks about Ruby as an academic language. I think it's a great choice:

  1. It can get students writing useful programs quickly

  2. It introduces students to Object Oriented programming in a really logical way. Way better than C++ or Java for teaching OO

  3. It can gently introduce students to Functional Programming, which could really help them develop better software

  4. It includes Tests, which are just so fundamentally important. I think Tests built right in, like Test Driven Development (TDD) and Behaviour Driven Development (BDD) are the most important programming idea in the last 5 years, and can transform the way you program

Tuesday, May 15, 2007

Gardening for ADHD

time lapse gardening. those plants are so cute!

watermelon love

woah, so trippy and cool.

btw, i'm growing lots of watermelons in my garden, just planted 9 out in the garden today. watermelon love.

Standout Jobs is Hiring a Ruby Guru

This is really cool, it's a video job posting, two guys from Montreal trying to start a company for the Job Recruiting market. A neat way to advertise for like minded people. I like the "Mac Switcher" music in the background, and the way it's editted, it makes it pretty funky.


A Bokardo article about Why you should be part of your community. Very true.

It references Some Community tips for 2007 which also looks good.

I was really trying to do this with lovemygarden.net but I'm just so busy, I just forget to keep adding blog entries. What I need to do is to link that in with Emacs, like I have with the amazing gblogger.el so that I can just hit a button and post a blog post to lovemygarden.net. I also need something simple like Picasa to upload my pictures, or perhaps I can put some kind of hack on my snessnet picasaweb site to upload the pictures to lovemygarden.

What I am realizing more and more is that I just don't have the time to wait for slow web interfaces. I want things now and fast, or I've switched to another workspace and the idea is gone. With my new websites, I want to focus on really quick fast websites, where you don't have a lot of AJAX crap slowing things down. I am going to think very very hard about every AJAX thing I add from now on.

But I'm also going to think for all the commonly used actions if there is a way to expose an API for it, and a way to have a really small desktop client access them. I just love interacting with the web with Emacs so much, it makes life so much faster, with a standard interface and fonts.

I still want gorgeous websites to suck me in, to make me want to participate, but when I become a member of the community, I want it to be just so ultra-fast and configurable that I want to keep interacting more and more.


An article about Scratch a visual way to build programs. Neato.

my essential bookmarks

I keep these bookmarks open in Opera tabs all the time for quick reference:

Zzappers Best of ZSH Tips - Holy, zsh is so amazing, I don't think I'll ever use all the features, but it's so nice knowing that they're there, if you need them.
A (Re)-Introduction to JavaScript - Now that I have JavaScript: The Definitive Guide this is probably not quite as necessary, still it's a great reference
19 Rails Tricks Most Rails Coders Don't Know
Developer Notes for prototype.js by Sergio Pereira
The Ruby on Rails API - Actually I cache a local version, for speed and grep-ability.
Amazon EC2 Getting Started - EC2 (and services like it) are totally the future. Having your own datacenter and servers is so last century.


custom mongrel handlers


I should really get more into using autotest on my Rails projects.

test/spec and rspec

test/spec on Rails

Mocha - Mocking framework for Ruby

I'm getting heavily into testing my Rails applications, and am learning about Mocking and Stubbing. I'm learning about Mocha, a Ruby library to help with Mocking. err the blog has a good post about Mocha, as does Agile Testing.

Mocha looks like it integrates nicely with test/spec. I find Specifications to be much more useful than Tests, with Specifications, it just seems more like how I think, like "The application should do this". What I really like about test/spec, as opposed to rspec is that with test/spec, your Specifications live right alongside with your Tests, and you can use either one, depending on which makes more sense at the time.

I'm seeing some situations in my code where Tests do make more sense to program, and I like being able to use both.

UX article

An interview with Judy Ramey a pioneer in User Experience (UX).

I like hearing about the new ways people are testing the interaction of people with computers, like eye-tracking and monitoring of the users physiological response. But why stop in the testing phase? I think that computers could be much more powerful if they were made to be more aware of the person interacting with them. For instance, the computer could be monitoring your eye movement, your blood pressure, pulse, speed that you are typing, galvanic skin response, and then tailoring your experience to help you to be more productive.

One of the simplest would be to play more mellow music when you are getting stressed, or perhaps the computer could suggest you take a break. A little walk or some light exercise. Maybe it could change the colour of the background to help you to become more conscious of when you are stressed. A kind of mindfulness helper, helping you to become more aware of your inner state.

Monday, May 14, 2007


missingBDD is Behaviour Driven Development (BDD) for Common Lisp and Erlang.


A primer for Forth.


A video of a high power line worker. This is just amazing, a really neat video of a guy who inspects and repairs high power electrical lines, riding outside of a helicopter and the climbing right onto the power lines.

rails vs java

A funny video in the "I'm a Mac, I'm a PC" style, but about Java and Ruby on Rails. Pretty funny.

photoshop basics

Sunday, May 13, 2007

message based programming

Alan Kay says that he should have designed Smalltalk to have Message Based Programming. Very interesting, I think with REST and SOAP that we're moving in this direction.

Now, just to integrate that whole alphabet soup of message based systems into languages like Ruby and Python, in a way that is logical and simple to use.

synthesizers with suzanna ciani

wow, this video is so sweet! Suzanna Ciani demonstrates how synthesizers work, and she makes me feel so mellow. Must watch.

zoomable unicode chart

Wow, a huge zoomable unicode chart. Kind of like Google Maps, but for the whole Unicode character set. And wow, there are a lot of symbols for human language.

Saturday, May 12, 2007

adobe video tutorials

Adobe Video Workshop looks really cool, it has videos showing how to do lots of neat things in CS3.

For a long time, I stuck to my GPL guns and used Inkscape exclusively. I did the whole peeridol.com site in Inkscape, doing all the slicing and designing by hand.

However, my new collaborator, Jennifer Derton does her graphic designs in Adobe Illustrator CS2, and although Inkscape worked admirably when loading in Illustrator SVG files, there were some strange lingering colour matching issues and other little problems. So, for now, I'm using Illustrator. I'm really happy with it, it has a lot of powerful things.

My plan is to learn Illustrator really well, and then, in the future when I have more time, to integrate some of the powerful Illustrator features back into Inkscape, because Inkscape rocks, and if it just had better colour matching and stuff, it would be perfect.


I just learned about evince, a good PDF viewer for Gnome. It's not perfect, but it's a lot smaller than acroread, and a lot snappier in terms of performance. Here's a ps listing of both evince and acroread, evince is less than half the size:

bhairavi 1 [~] % ps -auwwx | grep evince
sness 1762 12.4 13.3 58564 34020 pts/38 Sl+ 18:40 0:04 evince agile_rails_development.pdf

bhairavi 2 [~] % ps -auwwx | grep acroread
sness 1836 16.4 23.9 123364 61160 pts/38 S+ 18:43 0:03 /usr/local/Adobe/Acrobat7.0/Reader/intellinux/bin/acroread agile_rails_development.pdf

Still, I wish it had a better fullscreen mode, and that when you click with the left mouse button, you can grab and scroll the page like in acroread.

As you can tell, I'm reading my PDF version of Agile Web Development with Rails. I just got the PDF version of the book, and I would highly recommend the book to everyone doing web development.

json ruby

I'm having a lot of fun with the Ruby JSON library. Here's some documentation

It's really simple to use, and hooks into all the classes that I am using. For example, to turn an Array into JSON:




To turn a String into an Array and then into JSON (so that you can have simpler Javascript code, and not have to parse the string yourself):

puts "123".split("").to_json

To turn something back into a Ruby object from JSON, use JSON.parse:

a = JSON.parse "123".split("").to_json


["1", "2", "3"]

refactoring with test/spec

I have some ugly code to convert a String to a JSON array:

# Split the symbols_sent string into a javascript array

def convert_symbols_sent_into_javascript_array()
str = symbols_sent
n = "["
for i in (0...str.length)
n += "\"" + str[i..i] + "\""
if i < str.length - 1
n += ", "
n += "]"
@symbols_split = n

And I wasn't happy with it, so I'm going to try the Ruby JSON library:

gem install json

With this gem, it's really simple to convert a String to an Array and
then to JSON:

puts "123".split("").to_json




So, finally, the actual test looks like:

specify "check json conversion of symbols_sent" do
orig_array = @adam.symbols_sent.split("")
json_array = JSON.parse
json_array.should.equal orig_array

Now, to refactor that original code to use the ruby json library:

# Split the symbols_sent string into a javascript array
def convert_symbols_sent_into_javascript_array()

Wow, that's so much sweeter. And having the specification running as
a test tells me that I did the refactoring correctly.

xmatrix + ethereal

Someone should really hack together xmatrix (from xscreensaver) and ethereal. Unprintable characters should be converted to matrix characters.

That way, it would be both cool and (sorta) useful.

learning test/spec

I'm starting to develop my tests with test/spec, which I really like, it makes doing BDD work really well with Ruby on Rails. It's a learning process, and I thought I would share some of it with you.

For one of my sites, telepathytest.com, I have a Sender class (a Sender is the one in the telepathy experiment who tries to telepathically "send" the symbol they are looking to the other person). Anywho, I had to test two of my Sender methods, which were:

# == Schema Information
# Schema version: 5
# Table name: senders
# id :integer(11) not null, primary key
# ip_address :string(255)
# idhash :string(255)
# created_at :datetime
# last_alive :datetime
# last_symbol_index :integer(11)
# receiver_id :integer(11)
# user_id :integer(11)
# symbols_sent :string(255)
# state :string(255)
# archived :boolean(1)
class Sender < ActiveRecord::Base
belongs_to :user
has_one :telepathy_test

before_create :generate_idhash
before_create :generate_test

def generate_idhash
write_attribute "idhash", rand(0xffffffffffffffff).to_s(16)

# Generate the 10 symbols to be guessed, these are represented by
# integers between 1 and 5

def generate_test
symbol_string = ""
NUM_SYMBOLS.times do
symbol = rand(NUM_SYMBOL_TYPES) + 1
symbol_string += symbol.to_s

The specs that I came up with were:

context "Adam sender" do

fixtures :senders

setup do
@adam = senders(:adam)

specify "id hash should be between 0 and 0xffffffffffffffff" do
@adam.idhash.to_i(16).should.be > 0
@adam.idhash.to_i(16).should.be < 0xffffffffffffffff

specify "total number length of symbols_sent should be NUM_SYMBOLS" do
@adam.symbols_sent.size.should.be Sender::NUM_SYMBOLS

specify "all symbols in symbols_sent should be in the range of 0..NUM_SYMBOL_TYPES" do
@adam.symbols_sent.each_byte { |c|
c.chr.to_i.should.be >= 1
c.chr.to_i.should.be <= Sender::NUM_SYMBOL_TYPES

And my fixtures file was really simple:

id: 1
id: 2

Friday, May 11, 2007

super and hyper keys

I want to setup my Microsoft Natural Ergonomic 4000 Keyboard to have Super and Hyper keys. I'm having some problems, but here are the resources I'm using to figure it out:

Super and Hyper Keys for XEmacs


Super and Hyper Keys

everything2 Super and Hyper Keys

Because I'm using a -nw Emacs with urxvt, things aren't quite as simple as just putting the following in my .xmodmap:

keycode 66 = Super_L
keycode 115 = Hyper_L
add mod2 = Super_L
add mod3 = Hyper_L

I'll try later. It's in my planner-mode file. :)


I use yousendit.com to send files to my clients and collaborators, it's great, you can send big files for free.

but openomy looks cool as well.


I had tried out the canonical rspec framework for testing my Rails applications, but it didn't really fit in with the way I like work. I'm trying out test/spec now, and it looks pretty neat, it fits in really nicely with test/unit, so it allows you to do TDD and BDD at the same time. I think BDD is cool, but I want to be able to do TDD when it makes sense to do it.

A lot of BDD, a little TDD.

(BDD = Behaviour Driven Development)
(TDD = Test Driven Development)


The InDesign users podcast is neat, it's a bunch of videos telling you how to better use Adobe programs.

Not really a podcast though, you have to signup to the site and then download each video, one at a time, but still, interesting. They should really just free the information up, first, don't require a login and more importantly, offer a RSS or ATOM feed.

Thursday, May 10, 2007

w3m and emacs

w3m mode in emacs just rocks. I was learning today how to use tabs in w3m-emacs:

Start a new tab:

M-x w3m-goto-url-new-session

Make a copy of the the current tab:

C-c C-t

Switch to the next and previous tab:

C-c C-n

C-c C-p

Switch between tabs:

C-c C-a

and then

M-n and M-p

Close a tab:

C-c C-w


dojo and rails

I'm learning how to integrate dojo with ruby on rails.

The dojo book also looks like essential reading.

dojo tree widget

A nice tutorial on using the dojo tree widget


It might be foolhardy to do this, but I'm going to start working on StructureCloud. It's just burning a hole in my brain, and I've got to get some code out so that I can concentrate on other projects.

StructureCloud is going to be like the new version of Crank, but for cloud computing and with a web interface. You will be able to run some of the most important crystallographic programs on it, and they will run on the cloud.

The cloud can be EC2 machines, or could be extra machines in your lab running StructureCloud processes.

My target market is people going to the Canadian Light Source (CLS), with two main users in mind, people like me, who want to be able to do lots of neat experiments using massive computational results, and users like Nham, who know how to use crystallography programs but might have trouble setting them up on their own computer.

For now, I'm going to store all the results on S3 to make things simple for me. In the future, you could move to having the data stored on your own servers, you would just have to replicate the S3 API. Since their API is available, I think it won't be too long until someone else replicates it.

We're going to use SQS as a queuing system to store the jobs that need to be run. I'll have to come up with some good way to do locking of jobs on the queue, so that you don't get race conditions where multiple StructureCloud processing nodes try to run the same job. This is probably built into SQS.

I'm going to do it all in Ruby on Rails, because Ruby really rocks.

For now, we're going to have a really simple job building system, but it would be really cool if we could move to a system where we could basically replicate what CCP4i can do. This is going to be tough on the web, because we would have to do a lot of Javascript programming to do what CCP4i does with Tcl. I'm trying to think if there is a way to abstract this with Ruby, kind of like how RJS works. For now, it will be really simple, kind of like how Crank works, where you can build up a job from individual programs, and then the Crank CCP4i interface generates an XML file that the Crank program proper runs.

It would be really nice if you could integrate this all together so that the user could look at the actual shell scripts that would be generated from different sections of the StructureCloud interface.

Oh, and it's all going to be GPLed. I don't know exactly how I'm going to make money off this, but I'm having trouble concentrating on anything else, I just think about StructureCloud all the time anyways, so I just need to get it out of my head, and into the world. If anyone wants to help, I would love to have collaborators.


e7 is a new Lisp. Lisp is nice.

css reset

reset reloaded is a new CSS reset stylesheet that looks pretty cool.

What is a CSS reset you ask? Well, when you're working with XHTML/CSS, different browsers will have different defaults for the various elements, a <h1> tag will by default be rendered in a bigger font than a <p> tag. There are a bunch of browser specific elements like this, and a CSS reset stylesheet levels the playing field by making all the elements look the same way. Then, you can use your own custom CSS styling to control the look of your document in a nice cross-browser way.

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
/* remember to define focus styles! */
:focus {
outline: 0;
body {
line-height: 1;
color: black;
background: white;
ol, ul {
list-style: none;
/* tables still need 'cellspacing="0"' in the markup */
table {
border-collapse: separate;
border-spacing: 0;
caption, th, td {
text-align: left;
font-weight: normal;
blockquote:before, blockquote:after,
q:before, q:after {
content: "";
blockquote, q {
quotes: "" "";

Wednesday, May 09, 2007


weka is an interesting looking Java enviroment to explore machine learning. There is a weka book available.

I'm learning this because you can do some neat analysis of music with a combination of Marsyas and Weka. Marsyas is a program by Dr. George Tzanetakis to do analysis of audio. It's really neat.

It's really cool that I'm involved in this project, because for years I've wanted to apply Genetic Algorithms to analyzing music, to help decompose a song into all it's constituent bits. I even had written up some code in C and called it "betabeat", but never got it into a state where it was ready for public consumption. Now, I think I'm going to try it again with the Marsyas libraries.

whale speech

An interesting article about analyzing Humpback whale speech.

I'm involved with a project to understand Orca song, recorded over many years by Dr. Paul Sprong of Orcalab. They have recorded something like 20,000 hours of whale song, and I'm helping to develop a website to let researchers access and analyze the data. I'm working with Dr. George Tzanetakis of the University of Victoria on this.

This is another article on Humpback whale speech, about how it has it's own grammar, which is similar to the grammar of human language.

I love my life that I'm creating up here on the edge of civilization, I'm working on so many different projects, from doing biochemistry programming with CMD Bioscience to building my own Ruby on Rails websites like lovemygarden.net, to doing hardcore Ruby on Rails web programming for sites like handpickedyarn.com to doing web design with my new business parterJennifer Derton. Then, I have my great garden just outside, and I go work out at the gym 5 days a week, it's a pretty sweet life.

But, the thing that is totally burning a hole in my brain right now is doing cloud computing for structural biology. In some ways, I feel that I should keep this to myself until it's ready for the world, but the ideas I'm having are just so huge that I feel that I should get them out there, so that more people can get involved with it and help it grow. The one thing I know is that I'm going to GPL the code. I'm a huge believer in the GPL, it's the only way to do software, the only way.

Tuesday, May 08, 2007

sness out in the garden

sness out in the garden.

sunset tonight

It was a really nice sunset tonight, here in paradise, on the edge of civilization.

ssl with rails

A sample Rails app with SSL. Very useful.

Get it with:

svn co svn://caboo.se/plugins/court3nay/empty_apps/ssl

Monday, May 07, 2007

mondo 2000

ah, sweet mondo 2000

don't you all think we're ready for it again? another blast of that blurring of the lines between tech, mind, biologics, entheogens? i think we're just about ready, but we have 5 years until 2012, and we don't want to peak too early.


I really miss zenmoo.

telnet zenmoo.zennet.com 7777
telnet cheshire.oxy.edu 7777

Here's a little snippet from Wired back in 1993:

"Zen MOO: Stressed-out by the pace of Net.life? Why not telnet to cheshire.oxy.edu 7777 - when you do, this calming incantation will appear: "Amid the smell of incense and the sound of gongs and chanting, you have come upon the glorious Zen MOO. Please be quiet, and enjoy your meditation." Any attempt at work summons this reproach: "Your typing detracts from your enlightenment." Try again and you may see this: "Enlightenment does not come from typing." The third time your fingers tickle the keyboard, the Net Zen Master loses patience: "You are too restless to continue meditation. Come back later." *** Disconnected ***"

Sunday, May 06, 2007


An article about Ableton Live Draggers vs. Set Freaks. Hmm, interesting. I have a pretty low powered laptop, so I'll probably lean towards the Dragger side, but I kind of like the power of having everything in a big set.

And you know me, I'm already thinking about how I can incorporate Ableton Live with Emacs... (^.^)

ableton live tutorials

sonictransfer.com has a page with a bunch of great Ableton Live Tutorials.

dancetracksdigital part 2

Wow, turns out that dancetracksdigital is way cooler than that, you can actually purchase Ableton Live Ready tracks from them that have been pre-scanned and all ready to incorporate into Live. Perfect for a DJ.


This is neat, DanceTracksDigital offers a Ableton Live Tutorial to download, it has three different songs setup in .als format, that you can play with.

Ableton Live for performances

A Create Digital Music post and comment thread that asks How do you set up your Ableton Live sets for performance DJing

mjoy - A Joystick to MIDI mapping program. Neato!

Ableton Live Keyboards

This is neat, a keyboard custom painted to control your Ableton Live. This is sure less expensive than buying or building your own custom MIDI controller. You don't get sliders or knobs with a keyboard, but perhaps you could do that with a USB joystick, some soldering and MIDIOX. This thread talks a bit about this.

Even more REST

Tim Bray says REST is easy

Saturday, May 05, 2007

Uploading Files with Rails

I've got some people who collaborate with me, and I need a good way for them to upload files to me. Now, if I were a normal human being, I'd just fork out the $29.99 per year and use YouSendIt.com, which is actually pretty decent.

But, first, I'm not normal, and second, it would be nice to have things like versioning and a bit more control over the process.

Third, after doing it before a few times for pictures using file_column and then attachment_fu, I would like to practice with bigger files, and with progress indicators.

One neat page describes Home-brewed file upload in Ruby on Rails. Another uses a Flash based Multiple File Upload. Hmmm, not so sure about Flash. The best of the bunch is probably Rails Upload Progress.

More RESTing

New Horizons zips past Jupiter

The New Horizons spacecraft just zipped past Jupiter and took some sweet pictures along the way.

S3 and Ruby

CLI to Amazon S3 Service using Ruby is a sweet little idea to access s3 like you would a filesystem, using Ruby code. Very neat.

The mighty Capazon is Capistrano meets EC2. Sweet.


3d in javascript

js3d displays simple 3d objects with pure javascript. Sadly, it's pretty slow.


Hmm, I've been doing some more research on BPEL (Business Process Execution Language and BPMN (Business Process Modeling Notation) and they just seem so huge and bloated for what I want to do. Isn't it possible to have something simpler to describe the simple pipelines that I want?

I wonder if it would be possible to have the computing resources and data represented as REST, and then have a whole bunch of ways to interact with the data and resources via whatever programming language that you want.

It's really important to be able to do this in any programming language that you want, after learning about the GData API, for interacting with Blogger via Emacs, I'm a big fan of doing it via these public RESTful APIs, I just am not sure how to tie this all in together.

phenix graphical task setter upper

PHENIX is a big huge project by some very smart guys to build a new system for solving crystal structures. It's pretty neat, but their GUI is pretty clunky.

They have a whole bunch of colours representing different states. From the documentation:

"The colors of the task indicate the activity of the strategy. A purple task means that it has finished running. The green task is the currently running task and blue indicates a task that hasn't been run. Red indicates a task that failed during calculation and yellow is used when a strategy run is stopped by the user."

Now, that is just too many colours, way too confusing. I can see green as being "currently running" and red being "error" or "stop", but for the rest, it should be something more subtle and intuitive.

I'm also not so sure about using Python as the scripting language for building the pipelines, I'm beginning to be convinced, however, after trying to come up with other ways to do this using things like BPML (Business Process Markup Language). It probably is good to have a scripting language underneath the hood, just look at Emacs with Lisp, Lisp is what gives all the power to Emacs. A lot of people look at Emacs and see weird keyboard shortcuts, but it's so not about the keyboard shortcuts, it's about the idea of having a customizable editor with a programming language inside to do the customization.

Still, so far I just cannot bring myself to code in Python, it just feels so wrong. But, everyone else in crystallography is using it, and Google is using it, so I should maybe give it more of a chance. I just can't stand that whitespace is syntax. That is just wrong. So so wrong, on so many levels.

There is also a phaser phenix tutorial

Friday, May 04, 2007


2057 - The City a documentary that they just mentioned on MobuzzTV. Looks interesting.

Thursday, May 03, 2007

Rails Deployment on EC2

A movie about how to deploy Rails on EC2.

Wednesday, May 02, 2007

Astronomy Cast rocks

I just wanted to let you all know about Astronomy Cast, it's a great podcast where Fraser and Pamela talk about the latest things in Astronomy.

not an engineer

One thing I've noticed in the last 10 years is that a lot of programmers are calling themselves engineers. I would just like to say that I am not an engineer, I'm an artist, code poet, techno-shaman, and I'm not an engineer.

Engineers are great, they help to build bridges, to build machines and airplanes, to make sure that the gears don't grind, and that things move smoothly.

I'm a breaker, I want to change the way that we think of computers and ourselves, to help people understand themselves better, to help them communicate with others. I want to play with computers, to have fun, create new things, be wild, creative and inventive.

I know that there are a lot of us out there, and we can continue to play, while the engineers perfect things and make them work smoothly. But someone has to come up with the creative ideas first, and most great creative ideas come out of play, out of art.

perl things from today

Today I had to find if a file had a length of zero. The perldoc webpage told me how:

= stat($filename);

I needed the $size entry.

Second, I needed to find the length of a string, I found the answer on the comptechdoc website:

if (length($line) < 23) {
print "Invalid ligand file. Exitting\n";

Perl is pretty neat.

sunrise from gliese 581c

What sunrise might look like from the surface of Gilese 581c, the first extrasolar planet discovered that could have liquid water on it's surface. Neato!

Tuesday, May 01, 2007

OLPC info

I'm a huge fan of the One Laptop Per Child (OLPC) project, and I think it has the potential to change the world in a fundamental way, connecting children all over the world together in a distributed community that we've never seen before. The free software/open source ideas are critical to the success, because it's going to allow children to have access to the internals of the computer in a way that we haven't seen since I was young in the 1980's, with BASIC and LOGO on personal computers.

Sugar is a really interesting metaphor, and it has some exciting concepts like TamTam. The OLPC project has some Interface Guidelines that are quite detailed and interesting. I love the keyboard as well a good layout I think. Hopefully it will be nice to type on.

But what we really need to make sure happens is that we have systems to allow children to program new applications themselves, systems like hacketyhack are going to be really important to teach programming to kids. We need more of this, ways for kids to easily create useful applications that they and their friends can hack on and extend to do what they want to do.

It's not a revolution, it's evolution. Go kids go! Leave us in the dust!

Amazon EC2 and S3 to change their pricing structure

This is interesting, Amazon just announced upcoming price changes on their EC2 and S3 services. For EC2, they will move to a flexible bandwidth pricing scheme, depending on how much you download:

New Pricing (effective June 1st, 2007)

$0.10 per instance-hour consumed (or part of an hour consumed)

Data Transfer
$0.10 per GB - all data uploaded

$0.18 per GB - first 10 TB / month data downloaded
$0.16 per GB - next 40 TB / month data downloaded
$0.13 per GB - data downloaded / month over 50 TB

And for S3, they have added charges per request:

New Pricing (effective June 1st, 2007)

$0.15 per GB-Month of storage used

Data Transfer
$0.10 per GB - all data uploaded

$0.18 per GB - first 10 TB / month data downloaded
$0.16 per GB - next 40 TB / month data downloaded
$0.13 per GB - data downloaded / month over 50 TB

Data transferred between Amazon S3 and Amazon EC2 is free of charge

$0.01 per 1,000 PUT or LIST requests
$0.01 per 10,000 GET and all other requests*
* No charge for delete requests

Storage and bandwidth size includes all file overhead

I'm not sure if this changes my strategy to host all my images and client static sites, but I can really see why they need to do this, previously, you could have a whole bunch of tiny 1kb objects, and would only get charged for the total bandwidth. This could easily get quite expensive for Amazon, since they would have had a fixed overhead for each request. I'll have to monitor how things go, and perhaps use S3 for a more coarse-grained storage than I'm currently doing.

Still, for client sites that see low bandwidth, this is still much cheaper than most other hosting providers.