Welcome to the New-Look Sqizit

Today I’ve moved Sqizit to a new host, updated the theme, and fixed the formatting of old articles.
For those interested, a brief history of Sqizit:

  • In the distant past I tried starting blogs a few times (mostly on blogger.com), but never kept it up.
  • In April 2009, I started Sqizit on Google Sites. It was not a blog, just a place for me to document projects I was working on.
  • In April 2010, Sqizit moved to WordPress, hosted on blogetery.com, and I started writing weekly blog posts.
  • In July 2010, blogetery.com had an outage, and was not restored for a few months.  When it was finally restored, the formatting of posts and pages was rather messed up.
  • In October 2010, I resumed blogging, but did not fix the formatting of old posts.
  • I took a holiday from blogging over December and January but never fear, I have been far from idle.  I have many exciting ideas to share with you over the coming weeks!
  • Today I’ve moved Sqizit to a new host, updated its theme and finally fixed the formatting of old posts.
Posted in short | Tagged | Comments Off on Welcome to the New-Look Sqizit

Highlights

I haven’t planned anything to write about this week.  So here’s the highlights of the last few days:

  • “Going Postal” (Terry Pratchett) performed live at the Brisbane Arts Theatre – a thoroughly enjoyable performance.  Great acting and true to the book.
  • Queensland Youth Choir‘s Gala Concert.  I was performing as part of this, and it was lots of fun.
  • Adoration as part of FUEL, a local Catholic youth event.  I very rarely worship in a Catholic church, but it’s always exciting to see many young people worshipping God, and I especially appreciated treating Jesus with the awe and reverence which he deserves.
  • Catching up with friends at all of these events as well as at a friend’s engagement party (very exciting).  God has made us for community and we can worship him by sharing with each other.
Posted in short | Tagged , , , , , , , , , , | Comments Off on Highlights

Using Mercurial instead of Drop Box

Recently I’ve had a number of friends telling me how fantastic Drop Box is for synchronising files and how they don’t understand that I don’t use it.  Drop Box has one very good argument in its favour: you can use it to maintain an off-site backup of your data, so if your office burns down you still have your files.  Still, I mostly use Mercurial for synchronising my files.  In this post I’m going to share with you how I’ve optimised Mercurial for single-user projects.

Step 1: hg synchronise

I have a few mercurial repositories that I use for personal projects.  I might work on them in various locations (at work, on my laptop, on my desktop).  When I’m working on them I normally have Internet access, so I can pull and update, do some work, commit, and push.  Then I can swap computers and repeat.  But all that sounds like a lot of steps just to keep files synchronised.

So I’ve developed a mercurial extension which simplifies this process.  You can download the tool at the bottom of this post (it’s licensed under GPL).

Basically, what you have to do is this:

hg synchronise

This will commit your changes, push them to the remote repository, then pull any changes and warn you if you need to merge.  After running a synchronise, your repository and the remote repository should both be pretty much identical.  So the work flow is synchronise, do some work, then synchronise again.  Naturally, you can abbreviate “hg synchronise” to “hg sync”.

Step 1(b): But what about my commit message?

While this solution is simple, the drawback is that in this work flow you don’t get a chance to specify the commit message.  So I’ve added a few more commands to mercurial.

hg workon "Fixing bugs"

This sets what you’re working on (on the local computer only), and any calls to “hg synchronise” will include this task in the commit message.  This task will remain set until you change it with “hg workon <new task>” or set the task as complete, using another new command:

hg complete

Use “hg complete” when you’ve completed the current task.  This will perform a commit with a message saying the task and that it’s complete (it will even commit if you’ve made no changes, just to make sure the complete message is in the log).  It will then synchronise with the server.

Running “hg workon” with no task name will display the current task.  The “hg workon” command also has an alias of “hg task”.

Step 2: Making it automatic

But since we’re writing scripts here, why not write a script to make all this automatic?  Well I’ve done just that.  The code at the bottom of this post includes a tool which does the following:

  • Every 30 minutes, runs “hg synchronise” on all repositories listed in your ~/.hgrepos file; and
  • Every minute, runs “hg upsync” on those repos—this will do the same as synchronise if you have local uncommitted changes, otherwise it will do nothing.

Cool, give me the code

The code for the extension and the automatic synchronisation script is all copyright Joshua D. Bartlett 2010, and is Licensed under the GNU GPL.  You may only download the attached code under the terms of this license.

Download: Synchronise – mercurial extension

Posted in midlength | Tagged , , , , , , | Comments Off on Using Mercurial instead of Drop Box

TODO Lists

Like most people, I have lots of things to get done. One piece of software which I’ve found useful recently has been GTD-Free, a task-list tool which helps you follow the process explained in the “Getting Things Done” book. I’ve found this software very simple and useful so far.

Posted in short | Tagged , , , | Comments Off on TODO Lists

The Wrong Question: Using Ubuntu With Your Favourite WM

So as I mentioned before, I’ve been using Ubuntu with window managers other than GNOME.  But there are some things I took for granted about GNOME, such as the way that it automatically connects to my preferred wireless networks, or the way that it suspends my laptop when I close it.  So I tried to find how to do those things without running GNOME, and eventually, after asking Google the wrong questions, I discovered that it’s really quite easy.

Connecting to Wireless Networks

The wrong question: How do I connect to a WPA2 wireless network from the command line in Linux?

The real question: How do I connect to a WPA2 wireless network in i3 (or wmii, or your favourite window manager) running on Ubuntu?

While there is an answer to the command-line question, there is an easier way.  I’ve found that I can just tell my window manager to run the following command when it starts:

nm-applet &

The NetworkManager process is already running in Ubuntu (perhaps because we’re running under GDM as our login manager).  If you’ve set up wireless networks while using GNOME, the network manager applet (nm-applet) talks to the NetworkManager, and when a known wireless network is detected, nm-applet instructs NetworkManager to connect.

Suspending, Hibernating & Advanced Power Management

The wrong question: How do I suspend my laptop in Ubuntu from the command line?

The real question: How do I set things up so that I can quickly suspend my laptop in my favourite non-GNOME window manager running on Ubuntu?

As with the previous question, this turns out to be very simple, again perhaps because on Ubuntu we’re running under GDM.  Simply tell your window manager to run the following command on initialisation:

gnome-power-manager &

Now when you close your laptop, it will suspend.  Or not suspend if you’ve set things differently.  To change the settings, use the following command:

gnome-power-preferences

Storing Passwords

On Ubuntu, you are running under GDM.  So the GNOME keyring daemon should be running on your system.  With some software like Adobe AIR, you just need to fool the software into thinking GNOME is running so that it tries to talk to the GNOME keyring.

export GNOME_DESKTOP_SESSION_ID=1

Ssh-agent Authentication

It seems that on Ubuntu GNOME automatically adds your RSA/DSA identity to the authentication agent (ssh-agent).  If this is a feature you used with GNOME and are missing in your current window manager, simply add this command to your window manager’s initialisation script:

ssh-add

Last Resort: Running GNOME Too

While I was figuring out how to do these things, I did some messing around using a trick I learnt from the Linux Journal: running multiple window managers at once.  Before narrowing the networking thing to nm-applet, I found that if I run GNOME on a separate display from i3, I would still get the benefits of GNOME’s wireless network detection.  Perhaps if you’re missing something else from GNOME, this could help you.  Simply switch to a virtual terminal using Ctrl+Alt+F1.  Log in with your normal username, then type:

startx -- :1

Or, if you want to specify which window manager to run (in this example, i3), try:

xinit /usr/bin/i3 -- :1

Now you can use Ctrl+Alt+F7 to switch to the window manager you were already running (display :0), and Ctrl+Alt+F8 to switch to the one you’ve just started (display :1).

Posted in midlength | Tagged , , , , , , , , , | Comments Off on The Wrong Question: Using Ubuntu With Your Favourite WM