Monthly Archives: July 2007

Donebox is open source

When I previously announced my last project, some people asked that I open Donebox code.

svn co donebox

Or check it out on my code site with all the other useless stuff in there.

Patches are welcome and might be deployed to the live site.


Filed under Misc

Me + Rain – Sleep – Girlfriend = Donebox

What do you do when it rains on the weekend ? Remove some sleep and my girlfriend gone on a trip and you’re pretty sure I’m hacking some code.

But before the unveiling, here goes a song by Jimi Hendrix

There must be some kind of way out of here
Said the joker to the thief
There’s too much confusion
I cant get no relief
Businessman they drink my wine
Plow men dig my earth
None will level on the line
Nobody of it is worth
Hey hey


Donebox is:

  • another to-do list manager
  • better then all of them combined !
  • using AJAX like there’s no tomorrow
  • breathing REST like it was born from its flesh
  • degrade gracefully without Javascript
  • FREE
  • live, now, today!
  • made in one weekend so don’t blame me for the bugs even if there are NONE!
  • not working on IE and never will (this is not a bug, it’s a feature)
  • using the scaffold stylesheet, I know …

The UI is pretty simple. You add tasks on the top box, on the left you got dated tasks, on the right the ones with no date (later).

Quick task creation

When submitting a new task your can use the follow syntax to be uber productive:

[category] My task description for next week


The category is optional. It must be specified inside [] at the beginning of the task. The date part is also optional. Donebox uses the amazing Chronic library to parse date. The date must be at the end of the task description. You can use any of these and more: thursday, november, mon, today, tomorrow, thursday next week, 3rd wednesday in next november.

Quick task reordering and date changing

As you might expect from any 2.0 beta to-do list manager, you can reorder tasks by drag-dropping them. But Donebox does a little more then that. You can actually change a task due date by dragging it to another date. Pretty easy and quick.
Changing date

I don’t need another web app to keep up!

Neither I! That’s why you can use Donebox API to script your way to to-do list nirvana. Or you could use one of the scripts I already coded, one bash script usable from the command line and a Quicksilver script.

Comments, suggestions are warmly welcome, as always (unless you’re using IE)!

Hope you like it!


Filed under rails, ruby

MontrealDemoCamp3 follow up

Yesterday I went to MontrealDemoCamp3 with Daniel and Gary. As usual the room was full and the demos were amazing!


Nicolas Ritoux and Evan Prodromou were first and presenting their project Vinismo. It’s a wiki about wines. Already in french and english. They’ve put lots of content in the wiki: the rules, community page, help pages, etc. and left the fun part, filling the wine description page, to the users. It was built on the MediaWiki engine, upgraded with some plugins to allow OpenId authentication and semantic markup on wine description pages.

They clearly won the public, especially when they announced they brought 6 12 (surprising, I’ve only seen 6 of them… thx Even) bottles of wines to celebrate their launch!


Heri was next, with WorkCruncher. It’s a todo list manager merged with Twitter style sharing features. But the main “feature” that caused lots of controversy was that WorkCruncher deletes all your items at the end of the day. So you start each day with an empty list. I’m really not convinced this is a good thing, as a fan of David Allen GTD, your list should be there to free your mind. But Heri says he’ve been using it for some time and it truly boosted is productivity.

A private beta if going on, register at


Finally! I got the see Defensio in action! Carl Mercier and Mat Balez were presenting their WordPress plugin and comparing it to Akismet. It sorts spam by Spaminess, so it’s faster to find false positives (good comments marked as spam). They showed some stats from Ben’s blog which I don’t remember and have no idea what’s the average efficiency of a spam filter, but it was like 98.9% 99.5% (even higher then I tought, thx Carl).

But! The greatest surprise to me was that, the WordPress plugin is built on top of a clear and simple API. Which is by far better then Akismet’s. You have choice over XML and YAML for the output format and it’s free for small project. So blog comment spam is only their initial target. I can’t wait to see with what they come up next: Facebook wall spam filter? Twitter spam filter? Rails plugin acts_as_defensio (oh that would be cool!) ?

Building a counter-clock

Simon Law was next with a live performance.
He tried disassembling a clock to make it go backward. Simon explained some details on how tipical today clocks are built compared to earlier, more expensive clocks. It didn’t worked, well almost. He fixed it during the following presentation and it worked. It was a breath of fresh air from the typical style of presentation. It was, like he called it, an artistic performance. Really great and entertaining!

Private flight planner

Jerome Paradis followed. He presented a project aggregating private flights data onto Google Maps. You could see the travel paths of each flights, planned ones in blue and live ones in green. He got the data out of emails… that’s right emails! Seems that people using this have a strict jargon when writing them, so he’s able to parse all this and end up with some useful results. They’re planning to make this a public service soon. As of now, this is strictly restricted to rich people using private jets. In which case, Jerome said, this service can help them share flights with other business people, save money and make some more by meeting other rich people. Great, where do I start ?

Also, I had the great pleasure to talk with Martin Dufort from Kakiloc, Mitch Cohen from ClixConnect, Mark Schanzleh and Amélie Racine from StayNomad, Philippe K. Chrun from MyCarpoolStation, Alexander Fedorowicz from Oracle and several other ones.

If you missed this one, be sure to put DemoCampMontreal4 on your agenda right now! Daniel will be presenting, you do not wanna miss that.


Filed under conference, Misc, montreal


DemoCampMontreal3 at SAT at 18:30, tomorrow.

It’s free!

It’s cool!

All the cool kids are there!

Be cool too:

Be there!

Leave a comment

Filed under conference, montreal

ActiveSupport hidden gems

Even though Rails, as any open source project, lacks some documentation, its source code is open so we’d be fool not to dig in it !

Here are a couple of my findings in the not so publicly documented ActiveSupport source code.

Class attribute inheritance

Ever wanted to create an attribute on a base class that is not shared among its subclasses ?

Sadly @@my_var won’t work, as it will create a class variable shared by all classes
in the inheritance tree. ActiveSupport to the rescue!

class Room
  class_inheritable_accessor :cookies_eaten

class Kitchen < Room; end
class BedRoom < Room; end

Kitchen.cookies_eaten = 3
BedRoom.cookies_eaten = 1
Kitchen.cookies_eaten != BedRoom.cookies_eaten

write_inheritable_attribute and read_inheritable_attribute are also really useful in included modules to create variables belonging to the actual class. This is commonly used in Rails macro, for example, controller filters declaration.

Others hidden gems


Encapsulates the around pattern, adding behaviour to a method without altering it, which is equivalent to:

alias_method :foo_without_feature, :foo
alias_method :foo, :foo_with_feature
Module#mattr_accessor, Class#cattr_accessor

Like attr_accessor but for module and class variables. Comes also in reader and writer flavours.


Encapsulates the delegator pattern. So rather then:

def hello


delegate :hello, :to => :greeter



A Ruby-ized realization of the K combinator

def foo
  returning values = [] do
    values << 'bar'
    values << 'baz'

foo # => ['bar', 'baz']

Turns the symbol into a simple proc, which is especially useful for enumerations.

# The same as people.collect { |p| }

# The same as { |p| p.manager? }.collect { |p| p.salary }

Converts an array to comma-seperated sentence where the last element is joined by the connector word.

%w(MacBook Guru Rock'n'roll).to_sentence # => "MacBook, Guru, and Rock'n'roll"

Have you found anything else of interest inside the mysterious ActiveSupport ?


Filed under rails, ruby

How to get in the zone in less then 60 seconds

Dr. EvilGreat hackers are 10 times more productive then mediocre programmers. What did I say ? 100-billion-gazillion times more productive. And you know it!

Getting in the zone allows you to be in a state where you’re completely separated from the outside world. It’s just you and the computer. Your fingers against a horde of bits. You know you’re in it when you notice 2 hours later that someone has walked inside the room you’re in.

Here are 5 tips that have helped me achieve that level of focus. I hope this is helpful to anyone else as it was for me.

1. Have a vision

Even before writing the first characters of code you should know in your head what you want the final product to look like. Doesn’t have to be all the details about the database schema and the methods arguments of every classes. But each classes relationship and role could be a good start. As an example, if I’m building a DVD collection website, it’s trivial to determine every possible field of the dvds database table, but it’s crucial to know my dvds table will be the centre of my app. If you have a clear vision, you’ll be driven by it and nothing and no one will be able to stop you from achieving it.

2. Find a setup and stick with it

Although I don’t think having a routine for everything is something good, you should have some fixed parts in your moving train towards coding nirvana. Determine in your vision what are the innovations and automate or routine everything else. For instance, the way you place the windows on your screen should always be the same when you enter coding mode. And when you stop programming, close all those so you record that having this setup mean you’re coding. This way you won’t be distracted by your Google Reader or Adium window.

4. Drop the mouse

no mouseNot using the mouse is the best way to become a very effective programmer. My philosophical reason is that you’re closer to the machine in the way that all you fingers are directly connected to your computer transmitting information as it pops up in your head. Switching from mouse to keyboard is costly, do it as less as possible or only for uncommon tasks.
Using the mouse is good for exploration mode, when you don’t really know what you’re looking for. But since you should have a clear vision of what you wanna do, go with the most direct method of input, the keyboard (until they find a way to connect it right into your brain).

5. Use tests to focus

A common problem with debugging is when you do it with puts (or Console.WriteLine or print) in the code. When you’re done debugging you remove all of them. So when you need to debug again, what ? You add the same puts and prints everywhere.
When debugging with tests you document your assertions in a permanent way. “I wanna make sure this returns ‘stupid puppy’ 46 times”, well don’t

  puts puppy.title


  assert_equal "stupid puppy\n" * 46, puppy_output

in a test case.
The next time you’ll have to fix a bug or add a new feature you can focus on making the test pass, not scanning the output. As with the mouse, scanning is for exploration mode.

5. Put headphones on

headphonesListening to music occupied the left part of you brain. An old study presented in the amazing book Peopleware shows that if you listen to music while coding, you will end up with a less creative approach [1]. This might be true, with new music you’re listening to for the first time. My tip is to listen to music you know by heart. The objective is to eliminate any unexpected variant in ambient sound. If you know the music really well, you won’t be surprised by any sound, it will serve as a constant background noise. It’s a great way to focus real fast and cut yourself from the outside world, you know, the real world

Now what do you do to get in the zone ?

Continue reading


Filed under Misc

Montreal on Rails

Today, I’m really honoured and excited to announce that I’ll be giving a talk at the first Montreal on Rails meeting on the 7th of August somewhere in McGill University MAASS Chemistry Building at 7 PM.

Honoured because this is big news for the Rails community in Montreal. We had some mailing list and user group for some time but it was not really active in the Rails/Ruby domain. So now is the time to make it happen. If you’re from Montreal and use Rails, get up from you seat, scratch your back, pack your MacBook, take a shower, brush your teeth and come have a blast with us. Or if you can’t come, you still can help spread the word! Hey and the fact that there’ll be donuts seems enough for me to come!

You can find more info on the site and on the Upcoming page.

My talk is gonna be about testing with external services and making them freaking fast (and hopefully fun) and if we have enough time (and donuts), possible integration with COBOL and Logo into Rails routing.

Hope to meet you there!


Filed under conference, montreal, rails, ruby

The Hacker’s Healthy Guide, a simple 3 steps algorithm

I love to eat! In fact I eat a lot! And I have the great fortune to be the partner of one marvelous chef
that cooks amazing meal almost every day!

But I’m a hacker, I like coding even more then I like to eat. So I spent most of my time sitting in front of a computer without any apparent movement, eating stuff and drinking a lot.

So what I eat everyday is important to me, but I’m not a grano-hippie carrying my bag of nuts and dried fruits. And I believe any diet or restriction on the aliments you can eat are the biggest bullshit ever. What I do is a quick check of the nutrition facts label of each product I buy at the grocery.


fat fat fatI don’t really check the fat quantity. Saturated fat should be low. But the important thing is Trans fat should be 0. Almost no product with trans fat ever enter my house. This type of fat is transformed in a way your body can not recognize it as fat, so it won’t end up in the right place and it’s not the type of fat you can loose by exercising. It’s there forever, like Microsoft hidden libraries when you install Office!


salty!This one is important because it’s high on several products that are low fat or low calories. If it’s low in fat but has more then half your daily value in sodium (often the case for dried noodle soup) it’s a no-no, it would be like eating salt!


juiceEver wondered why drinking a glass full of fruit juice will keep you hungry and only one apple can sustain you for a couple of hours ? That’s because the juice doesn’t hold any proteins. Proteins expand in your stomach and make you feel satisfied. If a meal hold lots of proteins you won’t need to eat as much to get going!

Code samples

If you find this boring just read the code bellow, it’s a simplified version of the algorithm in the language of your choice:


  def eat?(product)
    product.trans_fat == 0 &&
      product.sodium < 1000 &&


  def eatable(product):
    return product.transFat == 0 and product.sodium < 1000 \
                                 and len(product.proteins) > 0


  public bool IsEatable(Product product) {
    return product.TransFat == 0 && product.Sodium < 1000
                                 && product.Proteins.Length > 0;


  (defun eat? (product)
    (and (= (trans-fat product) 0)
         (< (sodium product) 1000)
         (/= (array-total-size (protein product)) 0)))

Closing tips

asian pearEven if you have to eat frozen food for lunch there are some good choices out there, just check out those 3 things. Plus, fruits and vegetables are always a winner. But cutting, wrapping the thing can be pretty annoying. To bring back excitement, joy and extaze to your meal think about trying new fruits like: asian pear, dragon fruit, kaki, kiwi, mango… OK that’s enough I’m starting to dribble.

Now what are your tips on being an healthier hacker ? I’d really like to know! Or maybe you’d like to contribute to the translation of the (really complex!) algorithm (or correct my poor lisp coding skills). Please do, I’ll add it with due credit!

Bon appétit!

Warning if you’re gonna submit some code in the comments:
My friend seems to eat some part of the content when we use < or >. This is stupid, but if you’re going to submit some code in a comment, replace the < by &lt; and > by &gt; or just send me your code by email at Sorry for the inconvenient.


Filed under C#, Misc, python, ruby, tutorial

High times

MTEB6Yesterday was the 6th Montreal Entrepreneur Breakfast (second for me). I had a great time! Meeting so much passionate people at the same time, throwing breakthrough ideas at each other and getting in tech discussions of all sort is an energy booster. You’ll leave the place with a need to break boundaries and get things done! I met several new people and had great talks with Pierre Phaneuf, J-F Couture, Amélie Racine and Mark Schanzleh who are starting an amazing project StayNomad and lots of other. As usual Heri got a complete coverage with pictures.

Plus, great things will be happening for the Rails community here in Montreal with Montreal on Rails. A special announcement about this is coming shortly, stay tuned!

As if this was not enough, I just learned my girlfriend is pregnant this morning! I’m going to be a father! I can’t believe it!

So much good things happening at the same time, I get the feeling I’m on top of the roller-coaster. I don’t see how this could get any better, but I’m sure it will!

Life is good!


Filed under Misc, montreal, rails

Extending your include knowledge of Ruby

extend and include are two confusing methods, but they go hand in hand like Lychee and Vodka (humm…). Hopefully I’ll try to clarify this as short as possible.

include(a_module) is called inside a class, and adds module methods as instance methods.

extend(a_module) adds all module methods to the instance it is called on.

Here’s a quick example:

  module InstanceMethods
    def an_instance_method
      "You called an_instance_method on #{self.class}"
  module ClassMethods
    def a_class_method
      "You called a_class_method_from_module on #{self}"

  class MyClass
    include InstanceMethods
    extend ClassMethods

  my_class =
  puts my_class.an_instance_method # >> You called an_instance_method on MyClass
  puts MyClass.a_class_method      # >> You called a_class_method on MyClass

  obj =
  obj.extend InstanceMethods
  puts obj.an_instance_method      # >> You called an_instance_method on Object

As you can see, because extend is called inside the class (MyClass), and because Class is an object in Ruby, it adds module methods as class methods.

A common scenario for doing all this it to split large classes in several modules (and files), like is ActiveRecord::Base. To get rid of the extend ClassMethods you can take advantage of the included callback and rewrite to:

  module InstanceMethods
    def self.included(base)

  class MyClass
    include InstanceMethods

Got any tips ? Share with us the way you use include and extend!

Chris point out another great article about include and exclude that is even more easier to understand for C#/Java programmer, thanks Chris!


Filed under ruby, tutorial