Skip to content

2007

OmniFocus - GTD for OSX

Being a fan of Dave Allen's personal productivity book "Getting Things Done", I was excited to hear that The Omni Group are working on a tool I can use to implement this work-life management method.

The author of kGTD (a GTD template for OmniOutliner Pro) has produced a fine introductory screencast to OmniFocus. This really explained what I needed to know to use the software.

To preview alpha versions of OmniFocus you need to sign up to their mailing list. A day after doing so I got an email inviting me to test the software.

The application is still under heavy development but it looks great. I have used kGTD in the past and liked it but found it a little clunky.

Capistrano and Rake

Last night I read the chapter on automation in Tom Limoncelli's book, Time Management for System Administrators. He spent a lot of time extolling the virtues of Make and how useful it can be in automating sysadmin tasks. Rails makes good use of Rake (think 'ruby-make') to specify administrative tasks. Make/Rake let you specify dependencies in your tasks and by checking file timestamps you can avoid running tasks unnecessarily. This has given me an idea for a change to the way deprec works.

It would be nice if I could restart mongrel on the server using the same command as I use in Capistrano. I'm not suggesting using Rake from my workstation but rather to have many of deprecs cap tasks call a Rake task on the server. So 'cap deprec:mongrel:restart' would call 'rake deprec:mongrel:restart' on the server(s).

There would be two main benefits to this.

Firstly, all deprec tasks would be available from the command line on the target host (obviously some bootstrapping would be required to install Rake, Ruby, etc initially). While I prefer not to have to log in manually to each of the servers in a cluster, there are times when I'm logged in and would like to be able to run tasks locally.

A second benefit is that we could take advantage of dependencies. Compiling PHP, after Apache has already been installed, will no longer cause Apache to be recompiled. Installing Subversion, when Apache has not already been installed, will cause it to be installed. This will reduce the amount of time tasks take to run (which is non-trivial when it involves compiling the likes of openssl!)

Back in May 2007, Bradley Taylor of Railsmachine released a nice gem called Machinify. It's a set of Rake tasks that will install a Rails stack on Ubuntu. It's very nicely written and quite readable. I considered whether I should make deprec dependent on Machinify but as it lacks some of the tasks I want (install, nginx, postgres, etc) I think it would be better for deprec come with its own Rake tasks.

So, it's very tempting to re-architect deprec2 but another thing to consider is this: would we be better off with a working deprec2 next week or a re-designed deprec2 at some later point? I think working code is a better result than ideas that won't get implemented in the available timeframe.

One issue with calling remote rake tasks via Cap is dealing with interactive dialogs. deprec currently deals with this by listening for certain output from the remote call. I can't see why deprec couldn't simply call the remote rake task and listen for the same output. This would allow deprec tasks to be extracted into rake tasks.

So my current thinking is to press on with deprec2 development and then extract the tasks into Rake tasks at some future point.

Using rails-1.2.3 with Rails 2.0 Preview release installed

Rails 2.0 Preview has been released, along with a great summary of changes it includes:

http://weblog.rubyonrails.org/2007/9/30/rails-2-0-0-preview-release

While I was excited to install the gem (gem install rails --source http://gems.rubyonrails.org) this caused problems went I got back to developing an existing app even though I had rails-1.2.3 specified in my environment.rb.

It turns out that the preview release is version 1.2.3.7707 and Rails considers that to be the most appropriate version to use when I specify 1.2.3. Not what I was expecting!

A quick fix so your existing apps will still use 1.2.3 is to change this line in their config/boot.rb.

-rails_gem = Gem.cache.search('rails', "~>#{version}.0").sort_by { |g| g.version.version }.last
+rails_gem = Gem.cache.search('rails', "#{version}.0").sort_by { |g| g.version.version }.last`

Update 2007-10-05 This morning the very entertaining new Rails Envy Podcast informed me about r2check, a script that checks your existing Rails app and let's you know what you need to do to make it Rails2.0 ready. It worked for me. Thanks to Mislav Marohnić for saving me time. :-)

Simply Jestful

Update: I'm using jester.js version 1.3.

Jester is basically ActiveResource for javascript. It's amazing. I love it! With almost no changes to my scaffold_resource generated controllers I was able to work on my models via javascript in my web browser.

All I had to do was download the javascript and put it in public/javascripts/

I put this in my layout: <%= javascript_include_tag 'jester.js' %>

Then I was able to do this in Firebug:

>>> Base.model('User')
>>> Base.model('Comment')
>>> c = Comment.create({comment: 'i love jester'})
POST http://localhost:3000/comments.xml (381ms)prototype.js (line 866)
Object _name=Comment _format=xml _singular=comment
>>> c.id
12
>>> c.user
Object _name=User _format=xml _singular=user _plural=users
>>> c.user.display_name
"Mike"

Use XML, not JSON. The Rails implementation of .to_json() is not as fully featured as .to_xml().

This patch was accepted into core in June. I used it to patch my rails-1.2.3 installation. It stops the following from failing:

format.xml  { render :xml => @post.to_xml(:include => :comments, :methods => [:obfuscated_email]) }

Jester is documented in a series of release announcement blog posts. I recommend reading them in order.

Vim Syntax Highlighting for Rails

A couple of days I updated the font settings in terminal.app on my mac. It's now in line with textmate using Anti-Aliased 14 point DejaVu Sans mono.

Terminal Window Settings

I think you'll agree, it's pretty.

Vim Syntax Highlighting

Now I want to get my vim syntax highlighting to mirror that in Textmate. My vim doesn't currently understand rhtml. I also want it to use the same colorscheme (Sunburst) that my Textmate is using.Who will join my quest?

update big response from the lists.

Install rails.vim so it will recognize .rhtml files. It also touts "easy file navigation, enhanced syntax highlighting, and more"

Install vividchalk.vim, a colorscheme like Vibrant Ink for Textmate. Apparently it has a 16 color mode for remote terminal support. I still want to find Sunburst but at least I could always make one based on this.

The Rails Wiki has a page on HowtoUseVimWithRails

Stay tuned!

Deprec Plugins using gem_plugin

I just added automatic plugin loading to deprec2 using Zeds gem_plugin gem. Now, a number of people have been asking if deprec will support other linux distro's (and even other OS's!). While I'm not interested in implementing them myself (until I get sick of Ubuntu) I love freedom so decided to extract all Ubuntu specific functionality into a plugin and allow others to write their own plugins.

You can now write a plugin that will be loaded automatically by deprec2 with no manual intervention or configuration required by the user. Follow the tutorial on the gem_plugin site but here's the core of it:

  setup_gem(name, version) do |spec|
    spec.summary = "The deprec_ubuntu GemPlugin"
    spec.description = spec.summary
    spec.author="Mike Bailey"
    spec.add_dependency('gem_plugin', '>= 0.2.2')
    spec.add_dependency('deprec', '>= 2.0.0')
    spec.files += Dir.glob("resources/**/*")
  end

Make your gem dependent on gem_plugin and deprec. The way this works is clever. When deprec starts, it requires gem_plugin which goes and looks through the other locally installed gems. If it finds any gems that have gem_plugin and deprec as dependencies, it loads their init.rb file.

So installed a third party plugin to support a new distro for deprec be as simple as:

sudo gem install deprec_beos

Note: I'm still hacking on deprec2 - hoping for a preview release this week!