Interesting Links #5
How Much is Your Time Worth? - Great post that really hits what I’ve been saying about pricing services.
PSA - backups - Jamie Zawinski has a great solution for backups. If you are running a business without backups you are just asking to have your business closed any day now.
Javascript Design Patterns - 1. The Singleton - I love using the singleton pattern. I’ve implemented it many different ways but post outlines one of the best I’ve seen.
If you ever want to see what I’m reading or what I have pending, check out my del.icio.us page for @check. This massive list is the links I sort through.
Redmine Timesheet plugin - v0.0.2
I’ve just released version 0.0.2 of my Timesheet plugin for Redmine.
Changes
This release was made possible from the feedback of the community. Some of the changes include:
- Timelogs can now be filtered by user account (#477)
- Multiple projects can be selected (#484)
- Subtotals are shown for each project (#485)
- Language translations to Russian and Czech (#486)
- Parent project names are shown on subprojects (#552)
- BUG: Project and Activities are being reset after submitting (#476)
- BUG: When no activities are selected, all activities should be shown (#570)
- BUG: Language label bugs (#566)
You can see more details on the Activity and Roadmap pages.
Upgrade
I’ve discovered a problem with the name of the plugin folder. If your plugin folder is not named timesheet_plugin, please rename before upgrading or you will get an error in the Administration panel.
Zip
- Download the latest zip file from https://projects.littlestreamsoftware.com
- Unzip the file to your Redmine into
vendor/plugins - Restart your Redmine
SVN
- Open a shell to your Redmine’s
vendor/pluginsfolder - Update your SVN copy with
svn update timesheet_plugin - Restart your Redmine
Install
If you are installing a fresh copy, follow these steps:
Download the archive file and extract it to your
vendor/pluginsfolder. You can also download directly from my Subversion server with:svn checkout svn://dev.littlestreamsoftware.com/redmine_timesheet_plugin/trunk vendor/plugins/timesheet_pluginFollow the Redmine plugin installation steps.
- Login to your Redmine install as an Administrator.
- Enable the “Run Timesheet” permissions for your Roles.
- Add the “Timesheet module” to the enabled modules for your project.
- The link to the plugin should appear on that project’s navigation.
What’s next
The next release will be 0.3.0 and will focus on building up the tests for the plugin. So far, I’ve gotten by with manual testing but that’s caused a few bugs to creep in. As part of this process, I’m going to be refactoring a lot of the internals in 0.3.0.
After 0.3.0, we will get to start to add some really cool features. I’m hoping to get some feedback from the community on these so we can build something really great for Redmine.
Help
If you need help you can leave a comment here or enter an issue directly into my bug tracker.
Eric
Interesting Links #4
I’ve been scrambling this past week trying to close out a few projects before I start on some new ones. Here are a few links that came across my wanderings:
- Generating the code for an older version of Rails - A customer asked me how to generate a stock Rails application from an older release. Turns out RubyGems allow you to specify the version using underscores as an argument.
- Jeff Mackey’s notes on the SEED 2008 conference - Jeff took some notes from the 2008 SEED conference put on by 37signals, Segura Inc, and Coudal Partners.
- Practical Reporting with Ruby and Rails - New book by Apress. Sounds pretty interesting, especially with all the reporting plugins I’ve been building for Redmine.
- Real Programmers - Now if I can only get Emacs to buy my wife a Valentines Day gift, C-x M-c M-gift only works in emacs CVS.
Fail Loudly with osd_cat and autotest
A key to Test Driven Development is frequently run tests. These tests are used to judge the health of a project. Like in a hospital, when things deteriorate we have to be alerted right away.
Ruby developers use autotest to monitor and run their test suite in the background. One problem with autotest is that the results are printed to the console. No alert, no notification, no loud failure. OSX users are able to hook autotest up to growl, allowing growl to flash test results above all the windows.
Unfortunately, growl is only available for OSX, I need a Linux solution. I found someone using Knotify with autotest but the result window was tiny and easy to miss. I needed something bigger and more noticeable.
I remembered a friend used a program called osd_cat to build a volume control UI for his Linux DVR. osd_cat (On Screen Display cat) is a command line program that will print text above all your windows, similar to growl. Unlike Knotify, osd_cat can print text large and bright red.
In order to use osd_cat we need to install the program, called xosd-bin in Debian, and then hook it up to Autotest. When autotest starts it will read a Ruby file called .autotest. Using that file, I was able to hook up autotest to osd_cat. My current autotest file is adapted from several sources online and works with both RSpecs and Test::Unit.
Now I got a loud and alarming message whenever my tests fails. Not a puny little alert window but a big honking in your face “Something broke!” message:


#!/usr/bin/ruby
# NOTE Copy this to your home folder as .autotest
#
# Originally from http://wincent.com/knowledge-base/Setting_up_autotest_to_use_Growl
#
# Modifications:
# * Changed from Growl to osd_cat on Linux
# [Eric Davis http://theadmin.org]
# * Minor refactoring to use .autotest_images directory
# [Geoffrey Grosenbach http://peepcode.com]
# * Test::Unit compatibility [Pat Nakajima]
#
require 'autotest/timestamp' # time plugin
module Autotest::OsdCat
# Use xlsfonts to find the different fonts
FONT="-bitstream-charter-bold-r-normal--33-240-100-100-p-206-iso8859-1"
# Will display the message on the top of the screen centered, adjust these numbers to suit.
POSITION="top" # top|middle|bottom
POSITION_OFFSET="0" # Pixels from position to display (think CSS margin)
ALIGN="center" # left|right|center
def self.osd_cat msg, color='green'
osd_command = "echo #{msg.inspect} | osd_cat --font=#{FONT} --shadow=0 --pos=#{POSITION} -o #{POSITION_OFFSET} --delay=2 --outline=4 --align=#{ALIGN} -c #{color}"
# osd_cat blocks so start a new thread, otherwise Autotest will wait
t1 = Thread.new do
`#{osd_command}`
end
end
def self.osd_cat_fail(output)
osd_cat "#{output}", 'red'
end
def self.osd_cat_pass(output)
osd_cat "#{output}"
end
Autotest.add_hook :ran_command do |at|
results = [at.results].flatten.join("\n")
if results.include? 'tests'
output = results.slice(/(\d+)\s+tests?,\s*(\d+)\s+assertions?,\s*(\d+)\s+failures?(,\s*(\d+)\s+errors)?/)
if output
$~[3].to_i + $~[5].to_i > 0 ? osd_cat_fail(output) : osd_cat_pass(output)
end
else
output = results.slice(/(\d+)\s+examples?,\s*(\d+)\s+failures?(,\s*(\d+)\s+not implemented)?/)
if output
$~[2].to_i > 0 ? osd_cat_fail(output) : osd_cat_pass(output)
end
end
end
end
# From: http://www.ridaalbarazi.com/blog/2007/04/05/autotest-growling-in-red-green/
class Autotest
# All code borrowed from:
# http://www.robsanheim.com/2006/08/07/hacking-green-bar-color-output-into-autotest/
BAR = "=" * 80
# filter output for colorized green/red bar
def filter_output(results)
filtered = ""
results.each do |line|
if line =~ /\d+ tests, \d+ assertions, 0 failures, 0 errors/
line = "\e[32m#{BAR}\n#{$&}\e[0m\n\n"
elsif line =~ /\d+ tests, \d+ assertions, (\d+) failures, (\d+) errors/
if $1 != 0 || $2 != 0
line = "\e[31m#{BAR}\n#{$&}\e[0m\n\n"
end
end
filtered << line
end
filtered
end
def run_tests
find_files_to_test # failed + changed/affected
cmd = make_test_cmd @files_to_test
puts cmd
@results = `#{cmd}`
hook :ran_command
puts filter_output(@results)
handle_results(@results)
end
end
Eric
Interesting Links #3
I upgraded a few Rails applications to 2.0 and found the following links helpful. In under an hour I was able to upgrade 2 applications from Rails 1.2 to 2.0.