Development, Howto's and News
20Jun2008
Making Campfire Work for Me (and More Like IRC)
One of the companies I work with has decided to use the 37signals line of products for internal project management and communication (which I think is great BTW). This means that I sit in a Campfire chat room for working hours of my day, along with a handful of other developers. I started to run into a problem, though, when I didn’t need to be talking with others. It is difficult to tell when people are trying to talk to me. Campfire has, by default, two methods of notifying you of new messages: an unread messages counter (dock icon or browser tab), and optional sound ‘dings’. When I’m trying to work on something though that doesn’t involve chatting with others, all the while the chat room still active with other developers, it’s really distracting to hear constant ‘dings’ or have to repeatedly check new messages to see if they pertain to me.
The situation for me is similar to lurking on IRC channels. But IRC has been around much longer than Campfire, and IRC client developers are familiar with the problem. Thus, many IRC clients allow you to specify keywords, that, when present in other users messages trigger some form of notification, like a sound or Growl message. Well, this clearly is the feature I needed to solve my Campfire problem.
Greasemokey to the rescue! I stumbled across this userscript that allows you to set triggers for Growl notifications. Boy was that a welcome find. There were still some problems though. For one, I noticed that the chat window wouldn’t always detect that it had lost focus correctly, and as a result, I would miss some of my notices. Two, I wanted the same functionality for sound notifications. Three, it would be nice if at least some of it would work in Firefox, not just Fluid.
Thus, a new userscript was born: Campfire Notifications. As expected, it aims to solve the problems mentioned above. Growl notifications of course won’t work in Firefox. I’ve read, however, that Firefox 3 has added support for Growl. If I can get more information on that I may get it working in a future version.
On a related note, the guys at collectiveidea came up with an interesting way of writing Campfire plugins for things like post_commit VCS hooks. It’s called Tinder. Enjoy!
28Apr2008
Negative Word Matching with Regular Expressions
Today on the #codeigniter IRC channel someone asked about how to match a string that didn’t start with a specific word using a regex. I quickly threw out that, off the top of my head, /^(abc){0}/ should work. Well, surprisingly, it didn’t. Turns out negatively matching words with regular expressions is a little more difficult.
After a little research and some trial and error, I came up with a working solution: /^(?!word).*/
This post by Jeff Atwood helped: Excluding matches with Regular Expressions
19Mar2008
continuous import of mercurial to bazaar
I’ve been hassling Brian to move libmemcached to bazaar for a while now, tonight we finally got a continuous import from mercurial going into bazaar, and published on launchpad. Using bzr fast-import along with hg-fast-export, this was really easy. I’m thrilled to see all the fast-export/fast-import tools that have sprouted up between git, mercurial, and bazaar. Here is the script I stuck in cron to do the continous import (every 6 hours or so), feel free to make fun of my crappy shell scripting.
!/bin/bash
# move into the hg repo and check if hg repo has new revisions
pushd ../libmemcached
# hg incoming will exit 1 if no new revisions, 0 if new revisions
hg incoming
if [ "$?" -eq "0" ]; then
# pull hg repo
echo "New mercurial revisions found upstream, pulling"
hg pull
else
echo "No new mercurial revisions found, exiting"
exit
fi
# move back to our bazaar shared repo
popd
# run fastimport to get the latest revisions into bzr
echo "Importing new revisions into bazaar repo"
export HG_FAST_EXPORT=~/.bazaar/plugins/fastimport/exporters/hg-fast-export.py
$HG_FAST_EXPORT --repo=../libmemcached/ | bzr fast-import -
export LAUNCHPAD_ID=`bzr launchpad-login`
# loop through all branches, pushing them to launchpad
#.
for directory in *
do
if [ -d "$directory" ]; then
echo "Pushing $directory to launchpad"
pushd $directory > NUL
echo "bzr push bzr+ssh://$LAUNCHPAD_ID@bazaar.launchpad.net/~libmemcached-developers/libmemcached/$directory"
bzr push bzr+ssh://$LAUNCHPAD_ID@bazaar.launchpad.net/~libmemcached-developers/libmemcached/$directory
popd
fi
done
All Rights Reserved. Icons are from