FlexTime plugins

For me, FlexTime has become very useful. One of the reasons it is so useful is that I have written a few plug-ins that complement the standard functionality. For example, I have always kept a log of my working hours. It is a simple text file, written in the GNU ChangeLog style (I guess old habits really do die hard.) I use a plug-in that reads the diary file and displays it in FlexTime, providing context to the working hours spent. For me, it is very useful.

Keywords extracted from my diary file.

The projects Doorstop and Jupiter show up as keywords in FlexTime as shown in the image above. I can see at a glance how much time I have spent on each task. Since I write the diary anyway, I find it very useful to let FlexTime extract the tags and display them with time calculations.

I have a public Git repository for most of the plugins that I have written. I hope you might find the code useful too. The repository is hosted at Github.

Using an adorner with WPF DataGrid

Growing tired of manually keeping track of my work time, I wrote FlexTime, a small application that keeps track of the times I work on my computer and then summarize the result in a time sheet each week.

All good fun, but since I had a few moments to spare, I decided to add support for project information: textual information on what I have been working on. So I added a DataGrid and wrote a small plugin framework so that users can roll their own storage backend.

Again, good fun but then I wanted to indicate in each grid cell the plugin name of the particular comment. Just a small, quiet label at the bottom right, like the image below.

DataGrid Adorner
A small, quiet text (“Native”) is placed to the bottom right of each row to indicate the source of the comment.

The obvious solution to use a DataGridTemplateColumn and a Grid with two text boxes has focus problems. Instead, a cleaner solution is to use an Adorner class on a DataGridTextColumn.

The basic idea is to attach the adorner layer to the data grid cell and provide a dependency property where we can set a data template for the adorner using XAML.

First the adorner class. We simply use a ContentPresenter, passing it the template and content.

Then we derive our own class from the DataGridTextColumn where we define a new dependency property for the template and wire up the adorner class.

And finally we can utilize the new adorner column in the XAML:

Both the power and complexity of WPF does not cease to amaze me. Pretty schweet, methinks and great fun too. Look out for the next release of FlexTime.

Map engine for WPF GIS applications

Why is it so hard to buy a map engine to be embedded into a .NET WPF desktop application? When developing your typical command and control system, selecting a GIS component to embed into your WPF based client can be really difficult.

The choices available are either too limited with regards to supported map data formats, requires data pre-processing or have wholly inadequate licensing models, pricing or both. Most, if not all of the better choices are based on ActiveX which makes them somewhat cumbersome to embed in clients built on WPF.

Many organizations are moving to more agile development processes where specific architectural roles are often discouraged. Everybody are expected to be able to work on the complete application stack and that means having access to all the tools needed, including the map engine SDK. Pricing and licensing really becomes an issue for teams wanting to stay truly agile.

I feel that WPF is about to finally break through in corporate business applications. Silverlight has made a difference and the tooling, both the Expression suite and Visual Studio 2010 is getting there, albeit a little late, perhaps. This could mean trouble for the established vendors if they don’t act to accommodate this growing market.

I would like to see a map engine component that does the following:

  • Native .NET WPF control
  • Reference system supported canvas for drawing on layers
  • Complete documentation with a rich set of samples
  • $499 for the SDK
  • No charge for the runtime

I think that there might be a feature list in there somewhere that includes just the right amount of functionality that perfectly executed could have fantastic potential. What do you think?

Serving Mercurial using Apache on Ubuntu

If you have even the slightest interest in revision control systems chances are you have been keeping an eye on the development of distributed systems. The dust has not settled yet but I think that Sun’s decision to go with Mercurial for OpenSolaris and OpenJDK makes that particular program a fairly safe choice. Some history on Sun’s choice here. A good and fairly recent comparison here. Don’t miss out on Linus Torvald’s recommendations to the KDE people.

I have only very briefly tried out distributed revision control systems. The point that stands out for me is the powerful idea of the dual push-pull model. First there is the pull model; sandboxed development where one or more developers collaborate, pulling sources from each other. Each user is responsible for pulling changes from others and the model requires close collaboration and communication. This is the development model usually described and advertised for distributed revision control systems.

The second development model is the push model where changes are pushed to one or more central, master repositories, much like you would check in sources into Subversion or any other centralized version control system. For commercial projects, you will probably want to support this second mode, setting up master repositories that represents the stable state of your project. Sooner or later you will need HTTP read access to the masters. If nothing else, how else will your Hudson build server access the stable branch?

I really like Mercurial’s serve command that starts serving your repository over HTTP. Just type hg serve and others can access your repository for pulling over the net, just like that. This is not what you want for your master repositories though. For those you will want a permanent solution and that means using CGI scripts.

The Mercurial book contains a chapter about serving HTTP using CGI that is a good starting point. There are also a few posts on the net that I also found useful, here and here. The instructions below have been tested on a blank Ubuntu 7.10 (Jeos) box. I have chosen Apache as the web server.

I choose to place the root of the Mercurial repositories at /srv/hg/. See the FHS for more information on that choice. Serving HTTP access is made using a CGI script, shipped with Merurial. I prefer to place the script next to the repositories in a directory called /srv/hg/cgi-bin/.


  # mkdir /srv/hg
  # mkdir /srv/hg/cgi-bin

Below, I’ve chosen to copy the hgwebdir.cgi script which enables access to multiple repositories using the same root.

  
  # cp /usr/share/doc/mercurial/examples/hgwebdir.cgi /srv/hg/cgi-bin/
  # chmod a+x /srv/hg/cgi-bin/hgwebdir.cgi 

Create a file /srv/hg/cgi-bin/hgweb.config that contains the following two lines:


  [collections]
  /srv/hg/ = /srv/hg/

And that’s it as far as Mercurial goes. Just remember that it is Apache that will run the mercurial commands through the CGI scripts. It means that you will need to give read access to the world for the repositories


  # chmod a+rX /srv/hg/your repo(s)

All that’s left to do is setting up a web server to serve the Mercurial CGI script above. There are several servers to choose from. I’ve chosen to use Apache:


  # apt-get install apache2

Rather than edit the default site, I find it cleaner to setup a separate, new Merurial site. Create a new file /etc/apache2/sites-available/hg and add the following lines:


  NameVirtualHost *
  <VirtualHost *>
    ServerAdmin webmaster@localhost

    DocumentRoot /srv/hg/cgi-bin/

    <Directory "/srv/hg/cgi-bin/">
      SetHandler cgi-script
      AllowOverride None
      Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
      Order allow,deny
      Allow from all
    </Directory>

    ErrorLog /var/log/apache2/hg.log 
  </VirtualHost>

Disable the default site, enable our new Mercurial site and reload the Apache server.


  # a2dissite default
  # a2ensite hg
  # /etc/init.d/apache2 reload

That’s it. You should now be able to see all your repositories if you point your browser to http://yourhost/hgwebdir.cgi/

SQL Server 2008 slips

Microsoft SQL Server 2008 is late. Hardly unusual or perhaps even surprising given the complexity of these things. Microsoft is nowadays even trying to be pretty transparent about such things, blogging about changes to important roadmaps and so on. However, Francois Ajenstat’s announcement that SQL Server has slipped was more opaque than usual and quite frankly somewhat hard to understand. Enough so that Phil Factor wrote very funny reply to the market-speak of Francois Ajenstat. A must read.

You suck at Photoshop

There are plenty of good tutorials on Photoshop available on the Net. Some commercial, some free of charge. However, the “You suck at Photoshop” tutorials by Donnie Hoyle has to be the funniest of them all. There’s four of them on YouTube so far and they’re all hilarious.

  1. Distort, warp and layer effects
  2. Old school
  3. Clone stamp and manual cloning
  4. Paths and masks

“Strap on your stupid and lets get at it.”

Sixteen applications on my Mac

I’ve added quite a few applications to my Mac over the last year. Here’s the list:

Adobe Photoshop
And I’ve paid for it.
Aperture
I take thousands of images each year and managing all those photos can be a real problem. Aperture (like Adobe Lightroom) is designed for just that purpose. Previously, I could hesitate taking pictures because I knew I had to sort them out later. I don’t hesitate like that anymore.
AppZapper
It truly is the application that should have been included with my Mac from the start. I fail to see why Apple still has not bought the company and made it part of the OS X.
Disco
Yeah, like you really need a CD burning program. I bought it because my backup disks started spanning multiple DVDs and Disco handles that automatically. And it smokes. Like, really smokes.
Emacs
Emacs. Can’t do without Emacs.
LicenseKeeper
LicenseKeeper keeps all those license keys in order. Sounds a little silly; all you need is a text-file and a mail folder, no? I dunno but LicenseKeeper is one of the neatest little utilities I’ve yet to come across.
Parallels
One of the reasons I bought a Mac was that with Intel Core Duo and Parallels you could run hardware supported virtualization, promising almost native performance for Microsoft Windows. A year later, I can only attest to that promise: it works great.
Picturesque
Neat little thingie to batch process images for a small set of available effects. It doesn’t do a lot but it does it really well.
RapidWeaver
I looked for an alternative to iWeb which is really underwhelming and RapidWeaver seemed an obvious choise. It’s pretty neat when you want to make a site quickly, without any fuss. If you like to fuss, this is not for you.
Scrivener
Don’t use it much anymore but if you are a writer, or needs to write something non-trivial, it makes a lot of sense for the capturing phase. It’s not a word-processor and it’s not a mindmap thing. It’s somehwere in between… a note taking editor organizer, perhaps.
SpamSieve
I use Mail.app and the built in spam filter wasn’t good enough. I was used to the excellent performance of bogofilter on my Debian box and needed something just as good for the Mac. SpamSieve is good. I don’t get as good results as with bogofilter, but close.
SuperDuper!
Stupid name but a nice backup application. In Leopard there is Time Machine, of course, but SuperDuper! is still my choice since the application is so simple to use. But who in their right mind puts an exclamation point in their product name?
Tangerine!
Another application with an exclamation point in the name! What’s wrong with these people? I don’t use it much anymore. It has a lot of promise but fails to deliver. Needs an update!
TextMate
I got it for the buzz and because I heard that die-hard Emacs users where switching. I quickly went back to Emacs again though. I think that you can write plugins to TextMate in several different languages, which seems pretty interesting. Of course, Emacs is not only an editor, it’s a full Lisp interpreter which makes it the undisputed king of all editors.
Transmit
You’ll need a good ftp application and this is the one you are looking for.
VMware Fusion
I’ve always thought less of VMware because of how they case their company name, but they make good hypervisors. I grew tired of Parallels lack of Linux support and got VMware Fusion to replace it.

hdiutil to the rescue

I’ve been using SuperDuper! as my backup system from the start. It’s been a great program: easy to use and Smart Updates are fast enough that a complete backup of my entire drive is completed in 20 minutes. Combined, this means that backups actually gets done. I have two things I would like to see added to this program though:

  • Option to backup versions, including deleted files
  • Automator integration

SuperDuper backs up my drive to an image file. Smart Update will update an existing image file by comparing the contents on the drive with the image and only update stuff that has actually changed. That’s neat (any backup application should be able to do this) but the resulting backup overwrites the old files: there is no way to restore deleted files or previous versions of a file from a single backup image. It would be great if this was at least an option.

I also think that something like SuperDuper would be perfect for Automator. For example, since there’s no support for restoring files deleted between backups, I keep a separate image of the /Users directory and make a copy each time I back up. Thus I can always restore from a specific backup image. I keep copying images until they fill up 5GB, at which point I burn them to a DVD, delete them from my drive and start over. This is a manual process; if SuperDuper had Automator support I could code this up.

In Leopard, Apple will include Time Machine, a backup solution with some interesting application integration. We’ll see if this obsoletes SuperDuper or not. It should at least address the two issues I’ve got. Maybe the people at ShirtPocket has something competitive up their sleeves?

Oh well, here’s what I really wanted to blog about: lately the backup images have started to grow in size. It came to the point where the backup image no longer fit my Firewire disk. A quick support question and the answer is that Apple does not reclaim space within the sparseimage file aggressively enough. The hdiutil program can be used to fix this:

# hdiutil compact backup.sparseimage

That reduced the size of my images by three!

Paying for software

One unexpected effect of being a Mac user is that I’m paying for software. On Linux there’s nothing to buy. On Microsoft Windows, I used to purchase games, but since there are no games for Macs, my money is spent on utilities instead.

My two latest acquisitions are Disco and AppZapper.

Disco is an application that burns files to CDs. When I burn a CD, the application smokes — you know… since it burns a CD. It’s well implemented too. If I poke at the smoke with the mouse, it reacts; if I blow into the microphone, it reacts. Cool doesn’t even begin to describe it.

AppZapper is something as strange as an uninstaller for Mac OSX. The value it adds to the standard command-drag is that it is pretty good at figuring out what files the application has created in my home directory and offers to delete those as well. When uninstalling an application it makes a Flash Gordon-esque zapping sound and flashes the screen. Who in their right mind can resist something like that?

The ultimate radio station?

I was recently introduced to pandora.com, an online radio station. It’s great stuff: you simply enter a song or artist and you’ll get a customized radio station that plays music “resembling” your input choice. Their web page does not say much about the algorithm used to choose music, but it works out great.

Update: Doh! As I refreshed my browser, I noticed that pandora.com now requires registration, US residents only to boot.