Upgrading project hamster to 2.25.3 from source

This post is an update to a previous post regarding project hamster.

Since installing the missing project hamster to my gnome 2.24 upgrade I have used it daily at work to track the time spent on each of the many projects I will participate in on any given day and it has been absolutely marvelous at helping me fill out my timesheets accurately.

However…

In addition to the amount of time I spend on a project and the name of the project, both of which are tracked superbly in 2.23,  I also have to enter a description of what I was doing for each period of time logged. It is at this point that I found project hamster lacking. Until now!

I’m not sure if it was in version 2.24 or 2.25 of hamster that the description field was added but it’s a very welcome addition.

Hamster 2.25 update activity dialog

Hamster 2.25 update activity dialog

When you update an activity in 2.25 you now have a description text area to store exactly that, a description! The even better way of inputting a description is with the single activity text box by splitting the activity and the description with a comma. i.e. “activity_name, here is what I did during this activity”

Additionally the single activity box can also be used to set the category of the activity by adding an @ symbol. i.e. “activity_name@Work, here is what I did during this activity” nifty eh?

So now that I’ve teased you with what the new version does here is a description of how to upgrade from source, it’s fairly straightforward especially if you’re familiar with building applications from source already.

1. In a terminal enter the following command which will install all the necessary dependencies for building hamster (the line below will cover wrap onto 3 lines though it should be entered in the terminal as a single line)

sudo apt-get install gnome-common python-pysqlite2 python-gtk2 python-gtk2-dev
python-gobject python-gobject-dev libgconf2-dev python-gnome2-dev
x11proto-scrnsaver-dev libxss-dev

2. Grab yourself a copy of the source from http://ftp.gnome.org/pub/GNOME/sources/hamster-applet/2.25/hamster-applet-2.25.3.tar.gz

3. Extract the source file to a folder, assuming you downloaded the source to your home directory you could extract it with the following commands

cd ~
tar -zxvf hamster-applet-2.25.3.tar.gz

4. Now the commands to actually build the plugin, again assuming you extracted the source in the line above to a folder named hamster-applet-2.25.3 in your home folder

cd ~/hamster-applet-2.25.3
./configure
make
sudo make install

5. And that’s it, should be rather painless, unless something goes horribly wrong (in which case leave a comment and I’ll see what I can do to help) All that’s left is to remove hamster from your panel and then add it again from the Add to panel dialog. Check that you’re running version 2.25.3 by right-clicking on the hamster applet and selecting About.

As always I hope that helps someone, comments are always appreciated.

Alternative method for opening Smarty templates with HTML syntax highlighting in gedit

Here is an update to a previous post regarding how to get gedit to recognise Smarty template *.tpl files. I’ve found that gedit prefers to use the mime type to decide what type of file it is and therefore what syntax highlighting to apply.

After a little investigation I found that most of my .tpl files were being identified as text/plain in Nautilus (found by right-clicking on the file and selecting properties, on the basic tab the type field will tell you the mime type nautilus is seeing it as)

My new solution to this problem is to convince nautilus (and gedit) that the *.tpl files are in fact HTML files and therefore syntax highlight them in the same way, and here’s how to do it:

  1. Make a backup of your freedesktop.org.xml file with the following commands:

    cd /usr/share/mime/packages
    sudo cp freedesktop.org.xml freedesktop.org.xml.backup

  2. Edit the freedesktop.org.xml file as a super user:

    sudo gedit /usr/share/mime/packages/freedesktop.org.xml

  3. Search the file for “*.php” (without the quotes). You should find a section with:

    <glob pattern="*.php"/>
    <glob pattern="*.php3"/>
    <glob pattern="*.php4"/>

  4. Add a new glob entry for tpl files by adding the line:

    <glob pattern="*.tpl"/>

  5. Save and close the file then run the following command which should be fairly self-explanatory:

    sudo update-mime-database /usr/share/mime

  6. Nautilus and gedit should now recognise .tpl files as html files and syntax highlight as such

The only drawback with this option (and I consider it a rather minor inconvenience) is that double clicking your tpl files will try and open them in Firefox by default now, you can change this to open in gedit by default but then all your .html and .htm files will open in gedit by default too.

You choose which you prefer, I personally have no problem leaving them to open in Firefox by default since I rarely double click tpl files in nautilus, I usually use the file browser plugin in gedit.

Thanks to a suggestion by Sudhanshu I’ve edited the post to add the tpl entry to the php section of the freedesktop.org.xml file instead of the html section. The benefit of this is that you can now double click tpl files and have them open in the same application as php files (usually gedit) while html files will still open in your browser.

As always comments are appreciated on whether this was helpful or if you’ve found a better way.

Failed VPN connections after upgrading to Ubuntu Intrepid Ibex 8.10

Another post concerning my upgrade experience with Ubuntu 8.10 this time with regards to VPN connections. I keep meaning to take the time to write a more comprehensive piece about the upgrade as a whole but for now I’ll keep posting little snippets of minor annoyances and how I solved them.

This problem appeared when I attempted to connect to a VPN for the first time since the upgrade. Firstly all of my saved VPN connections were gone, slightly annoying but understandable since the network manager has undertaken a major overhaul in this version. So I create a new VPN connection to a Windows 2003 Small Business Server I manage, I entered the host, username, password and domain and left everything else as default. I try to connect to the new connection and almost immediately an error message pops-up (certainly quicker than my machine could even resolve the hostname)

The precise error was “The vpn connection xxx failed because there were no valid VPN secrets” (not quite the precise error message since the connection wasn’t called xxx, having a VPN connection named xxx would conjure up unsavoury, NSFW thoughts…)

I won’t go into the whys and hows because I honestly haven’t had the time to find out but the answer for me was to go back and edit the VPN connection and remove the password. Next time I connected to the VPN I was prompted for the password and everything was back to normal and I can continue with my task of reading someone elses email mwah hahaha!

Ubuntu 8.10 upgrade experience

This is just a quick post concerning my upgrade to Ubuntu 8.10 Intrepid Ibex, there will be more to come later.

One of the new features I was most anticipating in this upgrade was the time tracking applet included with the upgrade to Gnome 2.24. I have to fill in daily time sheets at work and trying to keep track of what I work on in any one day has become a real hassle, I was hoping this applet would make completing these time sheets a lot easier so imagine my dismay when after performing the upgrade to 8.10 and opening the add to panel dialog I found no such applet!

Long story short and without explaination because I don’t know why it wasn’t there but I was able to add the time tracking applet by running the following in a terminal

sudo apt-get install hamster-applet

after installing hamster the time tracking applet was in my add to panel dialog and I am indeed looking forward to using it (apparently it took me 8 minutes to write this post!)

Better VNC viewer in Ubuntu 8.04

Another post regarding my recent switch to Ubuntu as my primary OS, this one concerns the VNC client/viewer bundled.  I’ve been having problems with Remote Desktop Viewer which is the bundled and preferred VNC client in a default installation of Ubuntu 8.04, I’ve had random freezes and disconnects with a logout/login of my machine sometimes resolving the issue temporarily.

The alternative is to use the Terminal Server Client application to connect to a VNC server, should just be a case of selecting VNC in the protocol dropdown right? nope, it’s greyed out*sigh*

To enable the VNC option in the Terminal Server Client dropdown you need to install the xtightvncviewer package either in Synaptic or with

sudo apt-get install xtightvncviewer

I fired up the Terminal Server Client, selected the VNC protocol, set the display to full screen and connected to my server.

Job done? not quite. I’m now prompted by my server with a “press ctrl-alt-del to logon” message. That’s where I had some problems, pressing ctrl-alt-del caused Ubuntu to ask me how I want to shut down. I needed some way of sending a ctrl-alt-del to the remote machine but I couldn’t see any obvious way of doing it. Queue the next problem, I’d selected full screen and that’s what I got, completely full screen, I couldn’t even switch to an alternative workspace since the VNC viewer remained on top.

I really didn’t want to restart my machine just because I couldn’t get rid of one window so I started randomly hitting buttons whereupon I found that F8 was rather useful! Pressing F8 with the VNC viewer focussed brings up a small menu with a number of options one of which was to toggle full screen and another was to send ctrl-alt-del to the remote machine, hooray!

I’ve found this VNC viewer to be a bit quicker at screen refreshes (though it does more of them) and more stable than the bundled viewer in Ubuntu, feel free to leave a comment to the contrary or suggesting another alternative that you may use.

Smarty template syntax highlighting with gedit

Update: I have posted an alternative way to do the same thing this post describes, the alternative way should be more reliable. See it here http://www.c3b.co.uk/2008/12/16/alternative-method-for-opening-smarty-templates-with-html-syntax-highlighting-in-gedit/

I’ve started using gedit as my code editor after a couple of niggles with bluefish and wanted my smarty templates (*.tpl) to use the same syntax highlighting as HTML. Not wanting to have to manually select the language each time I open a .tpl file I went searching for a way to add them to the definition of what an html file is. I was getting frustrated with all the references to a syntax highlighting tab in the preferences dialog that just didn’t exist! Even the help file in gedit 2.22.1 still mentions the syntax highlighting tab but I can assure you it’s not there.

The solution I came up with was to manually edit the HTML language definition file for gtksourceview which is what gedit uses to define the syntax highlighting. To achieve this you must change the following line in the /usr/share/gtksourceview-2.0/language-specs/html.lang file:

<property name="globs">*.html;*.htm</property>

to

<property name="globs">*.html;*.htm;*.tpl</property>

Or download my version here (html.lang) of the file and run the following command:

Backup existing file

cd /usr/share/gtksourceview-2.0/language-specs
sudo cp html.lang html.lang_bkup

Then move the downloaded version of the file into place (this assumes you download the file and extracted it to your home directory)

sudo mv ~/html.lang /usr/share/gtksourceview-2.0/language-specs/html.lang

Restart gedit and when you next open a .tpl file it will be highlighted in the same way as an HTML file.

Flash plugin with Ubuntu

I recently installed the latest and greatest version of Ubuntu, version 8.04 aka Hardy Heron, from Vista (which was pre-installed when I bought the laptop)

I managed to switch quite happily, replacing many of the applications I used daily (Notepad++, FileZilla, TortoiseSVN, Winamp) with either their linux counterparts or alternatives (Bluefish, Exaile and I’m going with the command line for SVN) one thing that was becoming annoying was the swfdec-mozilla plugin for playing flash content in Firefox, it only kinda worked for me. Google analytics graphs wouldn’t render, YouTube videos were occasionally very slow and worst of all I couldn’t watch the latest installment of Zero Punctuation!

I went to Adobe’s website and downloaded the nonfree version of the flash plugin, ran the install script, restarted FF, then restarted Ubuntu but swfdec persisted.  I couldn’t find any way to replace the default flash player in Firefox so then I had the bright idea of removing swfdec-mozilla.

Launched Synaptic, searched for swfdec, marked swfdec-mozilla for removal, shut down Firefox and hit apply. Less than 30 seconds later I’m launching up Firefox again and listening to Ben “Yahtzee” Croshaw deliver his opinion on Gods of War: Chains of Olympus and another 30 seconds later I have a huge smile on my face, thanks Synaptic and thanks Yahtzee.