Jump to ticket bookmarklet for Redmine project management system

At our company, we have used a number of open source project management systems over the years to manage our support workflow. We haven’t been particularly happy with any of them until we adopted Redmine. We like Redmine for a number of reasons, the main one being it is written in ruby, and therefore easy to customise for our needs. The code base is fairly clean and easy to tweak and the functionality provides us with most of the features we require without feeling bloated. It is also proper open source (GPL), so we don’t need to worry about future versions being crippleware.

Our clients seem to like Redmine too. They can log in to see their own support issues and keep up-to-date with the ticket statuses. When they phone the office for help, we often ask them to refer to a ticket number. This means we can jump in and see the history of the issue. This is easy to do when you have Redmine open, but if you’re doing something else, it takes a few more clicks and key presses. To streamline this procedure, I built a simple bookmarklet called Jump to ticket. It sits in my browser toolbar, and when I need to get to a support ticket, I simply click the button, enter the ticket number, and I am taken straight to the correct page. I thought others might find this shortcut useful, and so I have built a small bookmarklet generator so you can make your own. Simply fill in the domain where you host your copy of Redmine, click build, then drag the generated link into your browser toolbar:


Enter the root of your redmine installation, e.g. http://redmine.yourcompany.com




Spotkick - Generate Spotify artist links from your Songkick gig calendar

Recently, I have been consuming a lot of music through Spotify, a desktop application that gives you instant access to millions of songs. As well as listening to music at home, I try to go to as many live gigs as possible. Living in London, there are so many touring bands to chose from that it is sometimes difficult to keep track. For the last year or so, I have been helped by Songkick.com, a fantastic online database and community for live music fans. Through the site, you can track your favourite artists, receive email notifications when they are playing near you, and mark any gigs you are going to (which in turn gets fed into my Google Calendar so I don’t forget). When I go to a gig, I like to listen to the music of the performer beforehand, which I usually do using Spotify. I find, however, that I frequently forget to do this, and end up not enjoying the gig as much.

To help me keep up to date, I decided to put together a little app to generate Spotify artist links from my Songkick gig calendar. Thanks to Spotify’s relatively new Metadata API, Phil Nash’s meta-spotify ruby wrapper, and a little bit of
Sinatra, Hpricot and Haml, this was pretty simple.

You can see the result by clicking on the image:


spotkick

If you want to have a look at the source, it’s on my github

Colorized Logs in Ruby

The logger is a really useful way to tell what is going on in your ruby application, but in Rails, it can be difficult to spot your own log entries when they are mixed up with all the ActiveRecord and ActionController ones.  One way of making your own comments stand out is to use color in your logs. You have probably noticed that Rails does this already to make the logs more readable, and the effect is fairly easy to replicate yourself. Color in the terminal is achieved using ANSI escape codes, a series of characters to tell the terminal to print the enclosed string in a particular color and style. You could just include this in your logs yourself, but this ends up looking a bit messy. To solve this, I extended String to include a method called colorize. It takes a color (”gray”,”red”, “green”, “yellow”, “blue”, “magenta”, “cyan”,”white”) and a few other optional parameters for styling.

colorize.rb:

class String
  def colorize(color, options = {})
    background = options[:background] || options[:bg] || false
    style = options[:style]
    offsets = ["gray","red", "green", "yellow", "blue", "magenta", "cyan","white"]
    styles = ["normal","bold","dark","italic","underline","xx","xx","underline","xx","strikethrough"]
    start = background ? 40 : 30
    color_code = start + (offsets.index(color) || 8)
    style_code = styles.index(style) || 0
    "\e[#{style_code};#{color_code}m#{self}\e[0m"
  end
end

Here are some examples of colorize in action:

> irb
irb(main):001:0> require 'colorize'
irb(main):002:0> s = "Some text"
irb(main):003:0> puts s.colorize "red"
Some text
irb(main):004:0> puts s.colorize "green", :bg => true
Some text
irb(main):005:0> puts s.colorize "blue", :style => "underline"
Some text
irb(main):006:0> puts s.colorize "magenta", :style => "bold"
Some text
irb(main):007:0> puts s.colorize "cyan", :style => "strikethrough"
Some text
irb(main):008:0> puts s.colorize "yellow", :style => "dark"
Some text

To include this in your Rails app, and use it with the debugger, just put the code in a place where it will be loaded.  My method of doing this is to drop colorize.rb into your application’s /lib directory, then add the following line to environment.rb

require File.join(File.dirname(__FILE__), '../lib/colorize')

Reload the server, then you will be able to add color to your logs e.g.

logger.debug("This is a message for debugging".colorize("red"))

As well as using colorize in logs, you can also use it in any script that runs on the command line. Uses for this might include test reporting, installation scripts, sysadmin script reporting and others.

Listening to The Ashes commentary on my iPhone

It’s surprisingly difficult to find a pub in Bayswater that shows the cricket during the day. I went searching for one today, hoping to catch a bit of The Ashes over my lunch hour. Of the few I did find, none had the volume turned up. Even The Elbow Room, which has individual TVs intended for watching sport, was playing loud 90s dance music instead (at 2pm).

I decided that next time I needed to more prepared. I needed my own portable commentary source. My first thoughts were a traditional AM radio, but this approach felt a bit dated. I then had a look at DAB alternatives, but was shocked that they are still so expensive.

Finally, after a bit of research, I found that I had the solution already; my iPhone. Here is how to do it:

  1. Go to the App Store and search for the App ‘FStream’. It’s free, so download it
  2. Open FStream and Select the ‘Favourites’ menu
  3. Click ‘Edit’ then ‘Add new webradio’
  4. Call the station something like ‘BBC Radio 5 Sports’
  5. Enter the URL http://www.bbc.co.uk/radio/listen/live/r5lsp.asx
  6. Click on the ‘Play’ menu and select your new station.
  7. Within a few seconds you should have BBC Radio 5 sport
  8. Find a pub

These instructions don’t just work for the Radio 5; most of the other BBC radio stations are available. You can find a list of URLs at http://bbcstreams.com/.

Reply/Star/Archive/Spam - Achieving Inbox Zero using four important keyboard shortcuts in Gmail

It’s easy to let your email get on top of you. Fortunately, since I moved to Gmail for my domain, it has been to be a lot easier to avoid being overcome by an overcrowded inbox. For the last year or so, I have been trying to implement Inbox Zero, a system that I first heard about from productivity expert Merlin Mann. It involves processing your inbox regularly and moving all emails to a trusted place where they can be processed later. After a single pass, your inbox should be empty.

My first attempt at implementation was to create a number of labels (folders) that corresponded to the lists suggested by Dave Allen in his book Getting Things Done; Next Actions, Projects, Waiting For, Someday/Maybe. I quickly found this to be over complicated and decided to move to the Trusted Trio method suggested by Gina Trapani on the Lifehacker blog. I found this much more manageable because it used fewer folders, and the follow-up Lifehacker article, “Empty your inbox with Gmail and The Trusted Trio” helped with suggestions of how to implement the system in Gmail.

Despite a significant rise in my email productivity, I still found processing my inbox fairly time consuming, and it was easy to fall out of the habit of Inbox Zero if I let my inbox get too full, particularly if I’d been away from my computer for a few days. I realised that the bottleneck for clearing my inbox was the process of moving the messages into the appropriate folders.

I tend to find using the keyboard much more efficient than the mouse and so I looked into the keyboard shortcuts to move the emails.  The ‘V’ shortcut key for “Move To” helps, but I still had to type the start of the folder name.  I needed a system where I could process the majority of emails with a single key press.

Reply/Star/Archive/Spam

And so I come to the system that I have found works best for me.  It is a hybrid of some of the ideas above, but even simpler.  I have decided that I don’t need a “Hold” category as Gmail’s search is so powerful.  Instead use Gmail’s “Star” functionality as my “Follow Up” folder.

I start processing my inbox by clicking on the first (most recent) email in my inbox.  I then make a decision on what needs to be done with it.  If it needs a reply, and the reply can be written in under two minutes, I hit the ‘r’ key and start writing.  If the email needs a reply or another action, but to do so would take more than two minutes, I hit the ’s’ key to star the email, and then ‘[' to archive it. If the email doesn't require any further actions, but I need to keep it for reference, I archive it by pressing the '[' (left square bracket) key.  Finally, if somehow an email has managed to break through Google's excellent spam filter, I hit the '!' (exclaimation mark) key. This is more helpful than simply deleting the message as it helps Google identify future spam.  I find that the majority of my emails don't require any action at all, but I prefer to keep all non-spam messages for reference.  Gmail's huge storge and lightning-fast search facility means there rarely a reason to do so.

So to summarise, the four important keys you need:

Action Shortcut Key Decision
Reply r Reply/Action required taking less than two minutes
Archive and next message [ No action required. Keep archive.
Star s Reply/Action required taking more than two minutes
Spam ! Spam. Delete and report it.

Of course this system only deals with clearing your inbox. You will also need to process your Starred folder regularly to make sure anything that needs further attention gets done, but at least you can see a clear list of emails that require action, separate from new messages.

One final note, if you'd prefer to process your inbox starting at the last (oldest) email rather than the first (newest) one, simply use the ']‘ (right angle braket) key instead of the left one.

Moving my focus from a wiki to a blog

For the last few years, my personal website has pointed at my wiki.  I use a wiki as a way of keeping notes, usually on I.T. related topics.  These notes were primarily intended for my own personal use, but if anyone else happened to find anything useful, then I was happy to share my knowledge.  My wiki is powered by DokuWiki, a fantastic open source application, which I prefer over the more popular MediaWiki for two reasons main reasons:

  1. I find the markup much more readable
  2. The topics are stored as flat text files instead of in a database

These two aspects of DokuWiki’s implemention are important to me, as I frequently read my wiki pages as raw markup instead of browsing the wiki over the web.  I keep a copy of the wiki synced with my iPhone, so I can get to my notes from anywhere without having to connect to the internet.

DokuWiki has served me well for some time now, but I am aware that it isn’t ideal as my primary web presence.  A client who visited my website recently expressed confusion when he was greeted with a contents page full of technical jargon.  It has always been my intention to start a blog, but I spent far too much time trying to make a choice between the numerous blogging engines the world has to offer.  Now that I have started working with Wordpress, I am happy that I have made the right descision. I will continue to keep notes in my wiki, but I will make an effort to rewrite the more mature and useful topics as more coherent blog posts, hopefully suitable for the consumption by others.

Wordpress

After spending ages trying to chose between Wordpress and Mephisto, I have decided to go with Wordpress.  Despite being written in PHP, I have come to the conclusion that it is a more mature product, so I won’t have to spend as much time hacking it.  Is this the right decision?  Only time will tell.