Posted by admin on Jan 26, 2012 in
Uncategorized
I have been a long time user of Things by Cultured Code, but they have been very slow implementing a couple of features that would really enhance the way I use GTD, namely time based reminders, location based reminders, and cloud-based syncing.
So I went out looking. Producteev looked pretty good, but it is woefully underpolished. Firetask also looked promising, as did Wunderlist, but both left something to be desired. Toodledo had nearly everything except a native app. Omnifocus looks like it has all the features, but is so complicated and ugly that I don’t like it.
So I’ve come up with my list of needs, wants, and wishes for a GTD app. I don’t think it’s comprehensive, but it doesn’t seem like too much to ask–and yet there is nothing in a reasonable price range to do what I want.
So here’s my list. Take it for what it is. And if you know of something that implements all the musts, most of the wants and some of the needs… let me know.
Needs
- Native Mac App (as a first class part of the solution)
- iPhone App with Sync
- Global Hotkey for capture that goes by default to the “Inbox”
- Recurring Tasks
- Easy Deferring of Tasks
- A good “Focus”/”Today”/”Now” view that makes solid sense
Wants
- Solid Cloud Sync
- Easy Delegation of Tasks (drag, e-mail/web app notification)
- Contexts / Workspaces
- Projects / tags
- Basic integration / support for Pomodoros
- Full screen mode in Lion that takes advantage of the screen real estate to show task details, sub tasks, etc for the *current* task.
- Push notifications / App badges for tasks remaining
Wishes
- Defer to Location (best – switch contexts based on location automatically, some tasks context free)
- Defer to Time: maybe not as important if location based worked, but being able to defer something until 9:00 pm gets it off my focus list until after my kids are in bed.
- Defer until Focus section is ‘empty’: Implemented as “dependent” tasks or “next” tasks or “next tasks” for within a project. Hard to get this right.
- Full on support for Pomodoro
- Start a pomodoro for a given task, tag, or context
- If started for a task, automatically mark the # of pomodoros taken
- If started for a tag or context, still record the pomo and the tasks checked off during it
- If the “interrupt” key is pressed, prompt for recording a new task in the inbox
- If not resumed, mark the pomo as failed
- Review Support
- Reports of Pomodoros for the day/week/month
- Reports of tasks completed for the day/week/context
- Graph of “productivity” based on pomos completed per day
- Calendar View, integrated with iCal calendars
Now, I know my list looks long to those in the GTD world, but if you look at the features, they seem simple to implement. Very simple. Omnifocus is the closest to this, but has no Pomodoro support and bad “Today” support. Producteev is actually really close, but lacks enough polish. Things is still the best task manager I’ve found for managing tasks AND getting out of the way. Has someone made this task manager I seek? If not, I assume I’m naive for thinking it is simple to do. I’m considering whipping together a webapp prototype that does what I want.
What’s your ideal GTD app? What features would you say are imperative?
Posted by admin on Nov 29, 2011 in
Uncategorized
Rails 3 has good TimeZone support built in, but you have to use the right Date and Time classes to get full support.
If you have this set in your application.rb
1
| config.active_record.default_timezone = :local |
, then you really need to use Time so that it properly identifies itself as being in the local timezone and not in UTC when passing to the database insert.
1 2 3 4 5 6 7 8
| ree-1.8.7-2011.03 :001 > DateTime.parse('2011-11-27 12:00:00 +0000')
=> Sun, 27 Nov 2011 12:00:00 +0000
ree-1.8.7-2011.03 :002 > DateTime.parse('2011-11-27 12:00:00')
=> Sun, 27 Nov 2011 12:00:00 +0000
ree-1.8.7-2011.03 :003 > Time.parse('2011-11-27 12:00:00 +0000')
=> Sun Nov 27 06:00:00 -0600 2011
ree-1.8.7-2011.03 :004 > Time.parse('2011-11-27 12:00:00')
=> Sun Nov 27 12:00:00 -0600 2011 |
So basically, Time.parse always returns the value in the local timezone, DateTime.parse always returns the value in UTC. To get complete compatibility, always use Time.parse. Trust me, I learned the hard way :)
Posted by admin on Oct 14, 2011 in
Uncategorized
Taken from Code Kata’s by Dave Thomas
The basic premise of this Kata is asking how you would model super market pricing. What is the price of an item? What is the cost? How do you handle price-per-pound? Buy 2 get one free? What’s the value of stock? It’s interesting, and I thought I’d take the time to blog through my thought process.
I’d like to iterate over the design and see where it takes me. First task is to represent a product.
1 2 3 4 5 6 7 8 9 10 11
| class Product
attr_accessor :name
attr_accessor :price
attr_accessor :quantity
def initialize(name, quantity, price)
@name = name
@quantity = quantity
@price = price
end
end |
Basic enough… But the :price element can’t simply be a float… no it’s it’s own object… let’s look at that closer
1 2 3 4 5 6 7 8 9 10 11
| class Price
attr_accessor :amount
attr_accessor :unit # nil, :pound, :oz, :box, etc
attr_accessor :multiple # defaults to 1, enables '3 {units} per {amount}'
attr_accessor :num_free # defaults to 0, enables 'buy {special} get 10 free!'
attr_accessor :special # defaults to nil, enables 'buy 3 get {num_free}'
def initialize(params={})
params.each {|p,v| send("#{p}=", v)}
end
end |
At first, this looks overly complicated, but it allows us to store the exact input and calculate off of that. We never want to store $0.3333333 / orange when the user enters 3 for $1–that would make our rounding happens at the EARLIEST possible moment, rather than the latest. We also want to enable flexible definitions of what costs the amount specified, thus you could say 0.99/pound, etc. There should be some units that are known, and others that are simply treated the same a nil (or /each). I’m not thrilled with the num_free or special yet… maybe those will factor themselves differently as we go forward.
So what can we represent here… let’s set up some examples:
1 2 3 4
| apple = Product.new "apples", 200, Price.new(:amount => 1.99, :unit => :pound)
soup = Product.new "soup", 100, Price.new(:amount => 1.00, :multiple => 3)
oreos = Product.new "oreos", 50, Price.new(:special => 4, :num_free => 1, :amount => 2.98)
bread = Product.new "bread", 25, Price.new(:amount => 1.69) |
There’s a couple things about these that I want to refactor as I’m going… I want the price to be a bit more readable… like:
1 2 3 4
| apple = Product.new 200, "apple", :at => 1.99, :per => :pound
soup = Product.new 100, "chicken noodle soup", :at => 1.00, :for => 3
oreos = Product.new 50, "oreos", :at => 2.98, :buy => 4, :get => 1
bread = Product.new 25, "bread", :at => 1.69, :per => :loaf |
That’s what I’d like. It reads straight across. You can represent most things here… so we’ll refactor “Price” and “Product” to look like that:
1 2 3 4 5 6 7 8 9 10 11
| class Product
attr_accessor :name
attr_accessor :price
attr_accessor :quantity
def initialize(quantity, name, price)
@name = name
@quantity = quantity
@price = price.is_a?(Hash) ? Price.new(price) : price
end
end |
1 2 3 4 5 6 7 8 9 10 11
| class Price
attr_accessor :at
attr_accessor :per # nil, :pound, :oz, :box, etc
attr_accessor :for # defaults to 1, enables '{for} {per} per {at}'
attr_accessor :get # defaults to 0, enables 'buy {buy} get {get} free!'
attr_accessor :buy # defaults to nil, enables 'buy {buy} get {get}'
def initialize(params={})
params.each {|p,v| send("#{p}=", v)}
end
end |
There! Much better! Now how about being able to call “cost” for a specific quantity of something. Should it be on the “product” or the “price”? They are closely related, but the product is what needs the call, most likely delegating some of the calculation to the price. Let’s set up “Price.of(n)” and “Product.buy!(n)” Product.buy!(n) will actually decrease the quantity we have in stock.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| class Price
# ...
def of(quantity, unit=:each)
quantity = convert(quantity, unit)
(quantity / for) * @at
end
end
class Product
def buy!(n)
@quantity -= n
price.of(n)
end
end |
This continues to be tougher and tougher, but I’m getting the idea. This would be great for a TDD driven exercise. I’d like to do the timed Kata like Corey Heines does — to music even :)
Enough for this Kata. Time to move on to Kata #2.
Posted by admin on Sep 27, 2011 in
Uncategorized
When you look at a new piece of data, most of our initial reaction is in relation to the complexity of that data. Usually this scares me, but after you get to know the data, the more the merrier! What was scary becomes rich and awesome.
How do we move from scary complicated to richly awesome? Comprehension, comprehension, comprehension. And what is the best way to grok something like that? Dive deep into the guts of the code or the task and find out why the data is there and what it does. Why was it modeled that way? In what way could it have been modeled different? Do I have the power to change it? Is it a good thing to change it? Do I understand the system fully enough to see the richness of the data and of the model itself?
In the spirit of “Practice, Practice, Practice” — pick an open source project, look at the model, figure out what all of it does and how you would do it differently, more simply, more robustly, with better error handling, with fewer models. Grok and regrok. Get used to the FEELING of comprehension.
Posted by admin on Mar 3, 2011 in
Uncategorized
I recently switched a serialized column in Rails from one type (Hash) to another (OpenStruct) and ran into a little problem when I tried to migrate, namely, that loading the model threw a SerializationTypeMismatch error. Hmm… how am I going to get at the base YAML and translate all of these without being brittle?
The answer is to copy the column, nullify it, and the load the raw YAML manually:
1 2 3 4 5 6 7 8
| add_column :my_table, :serialized_column_raw, :text
MyTable.update_all("serialized_column_raw = serialized_column")
MyTable.update_all("serialized_column = NULL")
MyTable.all.each do |mt|
mt.serialized_column = OpenStruct.new(YAML::load(mt[:serialized_column_raw]))
mt.save!
end
remove_column :my_table, :serialized_column_raw |
Posted by admin on Jan 4, 2011 in
Uncategorized
I saw a link recently on how to get to the ever elusive “Inbox Zero” and it seemed kinda lame–label everything “oldinbox” and archive everything in Gmail. Maybe that’s the only way to do it when you have 10K+ e-mails in your inbox, but it seems like the best way is to never get there to begin with.
Personally, I haven’t had more than 50 e-mail in my inbox at any given time in over 2 years. I ruthlessly archive and delete items and as soon as I’ve processed something into an action for “Things” I get it out of my inbox. For e-mails I just need to look at, reference or respond to, I use the stars feature, but I have only 8 starred items right now. I think at some point I had nearly 20… that’s about the max.
There are 3 very simple things you can do to stay at Inbox Zero:
- Use “Multiple Inboxes” – to keep things in front of you, use multiple inboxes (it’s a Gmail Labs feature) and make your own version of the priority inbox.

- Use a catch-all and your own domain – I have a catch-all address getting checked by Gmail. I give out e-mail addresses to businesses like “amazon@my.domain.com” that way and have all of the mail that comes in on that domain marked with the label “bulk” — and I have a “bulk” inbox using “Multiple Inboxes”

- Add “Send and Archive” in labs – Now, everytime you respond to somebody, send and archive, don’t just send. You’re done. Never worry about it again.

Okay, now you know how to keep a simple and clean inbox. Go forth and do likewise.
Posted by admin on Dec 3, 2010 in
tdd,
test,
Uncategorized
We are impatient people. This is something that we must work to fix in order to grow as individuals, but it is something that serves the automator well–or can be our downfall.
Joel Splosky wrote on the “Joel Test” that having anything less than the best tools money can buy is rediculous for a development team. The reasoning is this: If you’re paying developers what they are worth, then they are expensive, and wasting their time while they’re reading the Onion waiting for a build will kill your productivity–and your bottom line.
The same goes now for Test Driven Development. Having a great test suite is nearly essential, and anything more than a trivial application will have difficult and long running tests, but these tests must be managed well and there must be a way for a developer to quickly run through a cross section of the test suite as a sanity check before checking in. If your tests take 1 minute to run, then the developer is 6 times less likely to run them than if they take 10 seconds to run. If your tests take 30 minutes to run, then the developer is 60 times less likely to run them than if they take 30 seconds. Every additional test is great for coverage, but if it adds time, there is a point of diminishing returns.
Tagged tests are a must, and a solid set of fast tests that touch much of the code base is essential. It must also be easy to run individual tests–anything that hampers this reduces the liklihood of continued test driven development. Testing becomes a chore again and running the tests becomes an excuse for swordfighting in the hall.
So take the time to improve the speed of anything you wait on as developers–and reap the benefits tenfold.
Posted by admin on Aug 31, 2010 in
Uncategorized
For the last two years, I’ve been a loose GTD-er, using Cultured Code’s “Things” to dump my brain and keep track of tasks to do. I never got into the “project” side of GTD–planning out every project and asking why… I’m sure it has value, but that was never the problem I was trying to solve with GTD.
I just wanted to keep up with all the stuff everyone wanted me to do and I was tired of having things so easily slip through the cracks.
Well, 2+ years later and I’ve gotten very used to capturing, scheduling, prioritizing and crossing off items from my master list that isn’t in my brain. Things has been great for this, if only for the “Today” feature. For those of you looking for a great GTD app, I’d still recommend Things even though it doesn’t have OTA sync yet and there are many performance issues. It’s a simple app that does a simple thing.
Now, though, I’ve discovered that I have a problem getting motivated to do items on my list. Motivation is always difficult, but I tend to be paralyzed when I’m not sure how I will complete something. It makes me fail to even get started. Enter the Pomodoro Technique. I read this over the weekend and it made a huge difference on the first day. If you struggle with motivation and procrastination, this is the technique for you.
I’ve got 2 years worth of data in “Things” and my Pomodoro Technique is pretty new, so my first big question was how to use them TOGETHER. While this is neither pure GTD nor pure Pomodoro, I think I already have a great way to use Things better than I ever have and to stay motivated. If you’d like to try it, read on.
Read more…
Posted by admin on Aug 27, 2010 in
Uncategorized
Let’s take this basic class:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| class TestClass
attr_accessor :one
def my_method(branch=true)
if branch
puts "Do nothing to modify `one`"
else
puts "Modify `one` but it's a local variable"
one = "test"
end
one # local variable
end
def my_non_modifying_method(branch=true)
if branch
puts "Do nothing to modify `one`"
else
puts "Do nothing to modify `one` either"
end
one #method call
end
end |
1 2 3 4 5 6 7 8 9 10 11
| o = TestClass.new
o.one = "Value"
puts o.my_method
=> nil #might expect 'Value' if you're not paying attention
puts o.my_non_modifying_method #expects "Value"
=> "Value"
puts o.my_method(false)
=> "test"
puts o.my_non_modifying_method(false) #expects "Value"
=> "Value" |
So remember, if you create any local variables anywhere in your method, even if they’re not called, they override the accessor methods and will give you results you’re not expecting. To get around it, make sure you always use self.accessor= to assign values when there is ambiguity.
Posted by admin on Jun 4, 2010 in
Uncategorized
I had a process where I wanted users to fill out a survey which had hierarchal categories AND be able to specify some additional data for specific capabilities that the user had.

Now, you could easily do this for a small subset and hand-code every item, but I wanted a flexible survey system that allowed true hierarchy and generalized code.
Let’s start off with the basic survey and capabilities models and relationships:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| # ./script/generate model Survey name:string
# app/models/survey.rb
class Survey < ActiveRecord::Base
has_many :survey_capabilities
has_many :capabilities, :through => :survey_capabilities
end
# ./script/generate model Capability name:string parent_id:integer question:string
# app/models/capability.rb
class Capability < ActiveRecord::Base
has_many :survey_capabilities
belongs_to :parent, :class_name => 'Capability'
has_many :capabilities, :foreign_key => 'parent_id'
end
# ./script/generate model SurveyCapability survey:references capability:references answer:string
# app/models/survey_capability.rb
class SurveyCapability < ActiveRecord::Base
belongs_to :survey
belongs_to :capability
end |
Your first attempt at making a survey map to many capabilities will be something like this (formtastic):
1
| <%= f.input :capabilities, :as => :check_boxes %> |
But while that works on a basic level, it doesn’t work for capabilities that have a hierarchy and it doesn’t allow the user to specify additional data (i.e. answer a question about the capability).
So we’re going to need to accept nested resources. So we add this line to survey.rb:
1
| accepts_nested_attributes_for :site_capabilities, :reject_if => lambda { |a| a[:capability_id].blank? || a[:capability_id].to_i == 0}, :allow_destroy => true |
Now we need to recursively display hierarchal capabilities (If you show videos on your site, you might allow the user to invoke it, or require the user to invoke it, but if you don’t show videos, we don’t care about your invocation restrictions):
First, let’s make a quick way to show/hide enable/disable elements within a div:
1 2 3 4 5 6 7 8 9 10 11 12
| # public/javascripts/application.js
function toggle_fields(element_id, value) {
if (!value) {
Effect.SlideUp(element_id, { duration: 0.1 })
}
$(element_id).select('input').each(function(element) {if (value) { element.enable() } else { element.disable() }})
$(element_id).select('select').each(function(element) {if (value) { element.enable() } else { element.disable() }})
$(element_id).select('textarea').each(function(element) {if (value) { element.enable() } else { element.disable() }})
if (value) {
Effect.SlideDown(element_id, { duration: 0.1 })
}
} |
Now let’s create a helper that will set up the capabilities checkboxes and nested inputs:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| # app/helpers/survey_helper.rb
def select_capabilities(f, collection)
html = ""
collection.each do |capability|
survey_capability = f.object.survey_capabilities.select{|obj| obj.capability_id == capability.id}.first
selected = !!survey_capability
survey_capability ||= f.object.survey_capabilities.build(:capability_id => capability.id)
f.fields_for :survey_capabilities, survey_capability do |cap_form|
html += cap_form.input :capability_id, :as => :boolean, :label => capability.name,
:input_html => {:onclick => "toggle_fields('capability_#{capability.id}_details', this.checked);$('capability_#{capability.id}_delete').value = (!this.checked ? '1' : '0')"},
:checked => selected, :checked_value => capability.id
html += cap_form.input :_delete, :as => :hidden, :value => "0", :id => "capability_#{capability.id}_delete"
html += content_tag :div, (capability.question.blank? ? "" : cap_form.input(:answer, :label => capability.question)) + (capability.capabilities.any? ? select_capabilities(f, capability.capabilities) : ""), {
:id => "capability_#{capability.id}_details", :class => "details",
:style => "display:#{selected ? "block" : "none"}"
} if capability.capabilities.any? || !capability.question.blank?
end
end
html
end |
There is a lot going on here. Let’s step through.
Keep in mind that we’re recursive, so first off, we’re passing in the collection of Capabilities we’re dealing with through the “collection” parameter, but that isn’t what we need to create in terms of nested form attributes–we need SurveyCapability objects for that, so we have to find or build them:
1 2 3
| survey_capability = f.object.survey_capabilities.select{|obj| obj.capability_id == capability.id}.first
selected = !!survey_capability
survey_capability ||= f.object.survey_capabilities.build(:capability_id => capability.id) |
Then we create the fields_for section for nested form attributes and pass in the SurveyCapability we just created. Since we can specify that we want checkboxes here and specify the value, we make the checkbox the capability_id and make sure the ‘checked_value’ is the capability.id (it is ’1′ by default).
1 2
| html += cap_form.input :capability_id, :as => :boolean, :label => capability.name,
:checked => selected, :checked_value => capability.id |
And while we’re at it, we’ll create a way to remove the relationship altogether if they uncheck the capability
1
| html += cap_form.input :_delete, :as => :hidden, :value => "0", :id => "capability_#{capability.id}_delete" |
Finally, we build up the optional sub-question in the case of a click:
1 2 3 4
| html += content_tag :div, (capability.question.blank? ? "" : cap_form.input(:answer, :label => capability.question)) + (capability.capabilities.any? ? select_capabilities(f, capability.capabilities) : ""), {
:id => "capability_#{capability.id}_details", :class => "details",
:style => "display:#{selected ? "block" : "none"}"
} if capability.capabilities.any? || !capability.question.blank? |
And now we can add the :onclick option to the original checkbox so that appropriate inputs are toggled on click:
1
| :input_html => {:onclick => "toggle_fields('capability_#{capability.id}_details', this.checked);$('capability_#{capability.id}_delete').value = (!this.checked ? '1' : '0')"}, |
After we’ve got all that going on, we simply have to place it in the _form view:
1 2 3 4
| # app/views/surveys/_form.rb
<% semantic_form_for @survey do |f| %>
<%= select_capabilities f, Capability.find(:all, :conditions => {:parent_id => nil}) %>
<% end %> |
Instead of doing Capability.find…, let’s add a named scope to the Capability class:
1 2 3 4
| class Capability
named_scope :top_level, :conditions => {:parent_id => nil}
...
end |
Yeah! Now you don’t have to change your controllers at all and you can have optional, hierarchal selection of checkboxes with nested attributes!