<?xml version="1.0"?>
<!-- name="generator" content="blosxom/2.0" -->
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">

<rss version="0.91">
  <channel>
    <title>Neil's Blog   </title>
    <link>http://www.busydoingnothing.co.uk/blog</link>
    <description>Neil's unimaginative blog</description>
    <language>en</language>

  <item>
    <title>Splinter as a Firefox extension</title>
    <link>http://www.busydoingnothing.co.uk/blog/2009/10/23#splointer-ff</link>
    <description>
&lt;p&gt;
If you haven't noticed it on bugzilla.gnome.org already, &lt;a
href=&quot;http://blog.fishsoup.net/2009/09/23/splinter-patch-review/&quot;&gt;Splinter&lt;/a&gt;
is the nifty patch review system created by Owen Taylor. It allows you
to view a patch as a side-by-side diff and insert comments directly
inline with the code. The comments are stored as regular Bugzilla
comments that are meant to be readable by both computers and humans.
&lt;/p&gt;

&lt;p&gt;
The package is implemented entirely with client-side Javascript which
does XML requests to Bugzilla using existing API. The only server-side
code is a Bugzilla extension to add links inside bugs to start
Splinter. As it is mostly client-side, I thought it would be fun to
try packaging it as a Firefox extension so you can use it with any
Bugzilla. The results are on a bug post here:
&lt;/p&gt;

&lt;a href=&quot;https://bugzilla.gnome.org/show_bug.cgi?id=599249&quot;&gt;
https://bugzilla.gnome.org/show_bug.cgi?id=599249&lt;/a&gt;

&lt;p&gt;
or you can install it directly from here:
&lt;/p&gt;

&lt;a href=&quot;http://www.busydoingnothing.co.uk/splinter.xpi&quot;&gt;
http://www.busydoingnothing.co.uk/splinter.xpi&lt;/a&gt;

&lt;p&gt;
The extension works by packaging all of the Javascript and HTML from
Splinter into a Chrome jar. There are some minor tweaks to the
Javascript so that it doesn't depend on the Bugzilla URL being
relative to the Splinter installation. There is also an overlay to
insert 'Review' links next to attachments in pages which look like a
Bugzilla installation.
&lt;/p&gt;

&lt;p&gt;
I'm not sure whether it's entirely sensible to use it on a Bugzilla
that doesn't have Splinter installed natively because it may confuse
other people reading the bug report. However it does provide an easy
way to play with Splinter for example on landfill.bugzilla.org and at
least the reviews should be readable without Splinter.
&lt;/p&gt;</description>
  </item>
  <item>
    <title>Emacs Corner</title>
    <link>http://www.busydoingnothing.co.uk/blog/2008/11/14#Emacs_Corner</link>
    <description>
&lt;p&gt;
I seem to be making a habit of posting random snippets of Emacs Lisp
code. Well today is no exception so I've got a little function to
share which helps search and replace symbols in glib-style C code. For
example, if you want to rename &lt;tt&gt;MyCleverWidget&lt;/tt&gt;,
&lt;tt&gt;MY_CLEVER_WIDGET&lt;/tt&gt; and &lt;tt&gt;my_clever_widget&lt;/tt&gt; to
&lt;tt&gt;MyDumbMess&lt;/tt&gt;, &lt;tt&gt;MY_DUMB_MESS&lt;/tt&gt; and &lt;tt&gt;my_dumb_mess&lt;/tt&gt;
respectively then this function can do it for you in one step. You
just type in the symbol with words separated by underscores and it
replaces with the right version. It asks about each match like
&lt;tt&gt;query-replace&lt;/tt&gt; does.
&lt;/p&gt;

&lt;pre&gt;
(&lt;span style=&quot;color : #A020F0&quot;&gt;defun&lt;/span&gt; &lt;span style=&quot;color : #0000FF&quot;&gt;renamespace-get-replacement&lt;/span&gt; (repl-data replace-count)
  (&lt;span style=&quot;color : #A020F0&quot;&gt;cond&lt;/span&gt; ((match-string 1)
         (car repl-data))
        ((match-string 2)
         (cadr repl-data))
        ((match-string 3)
         (caddr repl-data))))

(&lt;span style=&quot;color : #A020F0&quot;&gt;defun&lt;/span&gt; &lt;span style=&quot;color : #0000FF&quot;&gt;renamespace&lt;/span&gt; (full-symbol old-namespace new-namespace)
  &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;Interactively replace one glib-style symbol with another.
OLD-NAMESPACE should be a symbol with words separated by
underscores (like gtk_widget). A search will then be done for
three different variants of that symbol: gtk_widget, GTK_WIDGET
and GtkWidget. Each match will be replaced with NEW-NAMESPACE
which will be converted to the right format for that match.

If FULL-SYMBOL is non-nil (prefix arg if interactive) then the
search will be anchored to a complete symbol, otherwise it can
match part of a symbol.

The replacement is done interactively the same way
`&lt;/span&gt;&lt;span style=&quot;color : #5F9EA0&quot;&gt;query-replace&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F&quot;&gt;' would.&amp;quot;&lt;/span&gt;
  (interactive &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;P\nsOld namespace, (like gtk_widget): \nsNew namespace: &amp;quot;&lt;/span&gt;)
  (&lt;span style=&quot;color : #A020F0&quot;&gt;let*&lt;/span&gt; ((parts (split-string old-namespace &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;_&amp;quot;&lt;/span&gt;))
         (class (mapconcat 'capitalize parts &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;))
         (const (mapconcat 'upcase parts &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;_&amp;quot;&lt;/span&gt;))
         (func (mapconcat 'downcase parts &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;_&amp;quot;&lt;/span&gt;))
         (re (concat &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;&lt;/span&gt; (regexp-quote class) &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;&lt;/span&gt;
                     &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;&lt;/span&gt; (regexp-quote const) &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;&lt;/span&gt;
                     &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;&lt;/span&gt; (regexp-quote func) &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;&lt;/span&gt;))
         (nparts (split-string new-namespace &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;_&amp;quot;&lt;/span&gt;))
         (nclass (mapconcat 'capitalize nparts &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;))
         (nconst (mapconcat 'upcase nparts &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;_&amp;quot;&lt;/span&gt;))
         (nfunc (mapconcat 'downcase nparts &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;_&amp;quot;&lt;/span&gt;))
         (case-fold-search nil))
    (&lt;span style=&quot;color : #A020F0&quot;&gt;if&lt;/span&gt; full-symbol
        (setq re (concat &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;\\_&amp;lt;&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;(?:&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;&lt;/span&gt; re &lt;span style=&quot;color : #BC8F8F&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F; font-weight : bold&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color : #BC8F8F&quot;&gt;\\_&gt;&amp;quot;&lt;/span&gt;)))
    (perform-replace re &lt;span style=&quot;color : #B22222&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;color : #B22222&quot;&gt;from-string
&lt;/span&gt;                     (list 'renamespace-get-replacement nclass nconst nfunc)
                     t &lt;span style=&quot;color : #B22222&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;color : #B22222&quot;&gt;query-flag
&lt;/span&gt;                     t &lt;span style=&quot;color : #B22222&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;color : #B22222&quot;&gt;regexp-flag
&lt;/span&gt;                     nil &lt;span style=&quot;color : #B22222&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;color : #B22222&quot;&gt;delimited flag
&lt;/span&gt;                     )))
&lt;/pre&gt;

&lt;p&gt;
I also made a little script to export Emacs' syntax highlighting to
HTML which is how I got the purdy colours above. Maybe if I tidy that
up I will blog that too.
&lt;/p&gt;</description>
  </item>
  <item>
    <title>Boston GNOME summit</title>
    <link>http://www.busydoingnothing.co.uk/blog/2008/10/14#GNOME_Summit</link>
    <description>
&lt;p&gt;
I spent the last week in Boston for the GNOME UI hackfest and
summit. It went pretty well and it was great to see so many
enthusiastic hackers from all over the world working together.
&lt;/p&gt;

&lt;p&gt;
The highlight for me was a talk by David Richards about the user
experience in the &lt;a
href=&quot;http://live.gnome.org/Boston2008/GUIHackfest/CityOfLargoPresentation&quot;&gt;City
of Largo project&lt;/a&gt;. He is a sysadmin for a large city-wide
installation of Linux and GNOME which uses NoMachine to access a
remote shared server. He had many surprising insights into how GNOME
is perceived by regular people. For example he reported that most
people just don't understand files and folders and have no idea how to
move content from one application to another. And somethingty percent
of his users don't know how to right-click. The upside of his talk was
that he is successfully using Compiz for a full composited desktop
even over a remote session and it is very well received by his
users. This bodes will for a Clutter-based desktop.
&lt;/p&gt;

&lt;p&gt;
We also had a session in the summit about canvases. It was entitled
'Canvas Deathmatch' but it turned into almost unanimous agreement that
we should use Clutter as the standard GNOME canvas. There was
surprising support for just requiring a working OpenGL implementation
for GNOME 3.0 to facilitate the fancy new panel and WM discussed
during the hackfest.
&lt;/p&gt;

&lt;p&gt;
There was another talk by some of the Novell employees about Linux on
netbooks and they were specifically trying to rally people to support
the Moblin project.
&lt;/p&gt;

&lt;p&gt;
I was also able to use a lot of the time to make a Clutter version of
Aisleriot (which is a collection of card games in GNOME games). It
replaces the custom Cairo-based canvas with Clutter and has some
animations for flipping over cards. I got a chance to talk to Jason
Clinton who maintains GNOME games and he seemed pretty keen to get
more of the games using Clutter. He had already started work on
Clutterizing Gnometris and he had no objection to just dropping
support for the non-GL versions of the games. Here is a screencast of
my progress so far. It still has some glitches to work out and I'd
like to make the animations more fancy.
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;http://www.busydoingnothing.co.uk/bildoj/aisleriot-clutter.ogg&quot;&gt;
&lt;img src=&quot;http://www.busydoingnothing.co.uk/bildoj/aisleriot-screenie.png&quot; alt=&quot;image&quot; /&gt;&lt;/a&gt;</description>
  </item>
  <item>
    <title>blame-browse</title>
    <link>http://www.busydoingnothing.co.uk/blog/2008/08/16#Blame-Browse</link>
    <description>
&lt;p&gt;
The one thing that's worse about Git compared to Subversion is that
git-blame is so much harder to use than svn blame. The output from
git-blame is very wide so if you run it on the terminal then often
most of the line of source code will be cropped off the right
edge. SVN's revision numbers are replaced with a git commit hash so
it's also not immediatly obvious what the parent of a commit is from
the information in git-blame. When I use either blame command, I often
find the commit reported against a given line is not the change that
I'm interested in so I usually want to re-run the annotation with the
parent commit.
&lt;/p&gt;

&lt;p&gt;
I thought it might be fun to knock up a program to browse the output
of git-blame. I initially thought 'oh that's easy, that'll take about
half an hour' so I cobbled together a quick program in Ruby with the
GTK bindings. It was pretty quick to write because Ruby (like Perl)
has excellent support for processing text. However I eventually got
fed up with the Ruby GTK bindings because they are randomly missing
bindings for some functions that I wanted and it's difficult to
debug. After discovering &lt;a
href=&quot;https://sourceforge.net/tracker/?func=detail&amp;atid=470969&amp;aid=2043970&amp;group_id=53614&quot;&gt;
this bug&lt;/a&gt; I got fed up and rewrote it in C. I also ended up making
it much more complicated because now it tries to run git
asynchronously and process the output as it comes using the glib
main-loop.
&lt;/p&gt;

&lt;p&gt;
So far you can see the source code for the file you've annotated with
the hash of the commit for the that line. A tooltip is displayed for
the commit with a short summary. If you click on the commit you get
more information in a dialog and you can jump to the parent commit
from there.
&lt;/p&gt;

&lt;p&gt;
&lt;img src=&quot;http://www.busydoingnothing.co.uk/bildoj/blame-browse-screenie.png&quot; alt=&quot;image&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;
The screenshot gives away that I stole a function from ebassi's &lt;a
href=&quot;http://live.gnome.org/Tweet&quot;&gt;Tweet&lt;/a&gt; and also that I fixed a
tiny bug in it :)
&lt;/p&gt;

&lt;p&gt;
There's quite a lot left to do:
&lt;/p&gt;

&lt;p&gt;
&lt;ul&gt;
&lt;li&gt;I would like to add forward and back buttons to the main window so
that you can move through the history of what you have visited.&lt;/li&gt;
&lt;li&gt;Searching the source and jumping to a line number are probably
pretty essential.&lt;/li&gt;
&lt;li&gt;It should probably use GtkSourceView instead of my
crazy custom widget.&lt;/li&gt;
&lt;li&gt;The UI looks nasty&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
I also should probably have tried to implement within the giggle
source code but I didn't look at this until I'd got too far. It looks
like giggle already has a lot of code to handle running git
asynchrously so I could've avoided a lot of work.
&lt;/p&gt;

&lt;p&gt;
The code is available on Github at &lt;a
href=&quot;http://github.com/bpeel/blame-browse&quot;&gt;http://github.com/bpeel/blame-browse&lt;/a&gt;</description>
  </item>
  <item>
    <title>Compiling Clutter on Windows with MinGW + MSYS</title>
    <link>http://www.busydoingnothing.co.uk/blog/2008/07/13#ClutterWin32</link>
    <description>
&lt;p&gt;
&lt;b&gt;*Update*&lt;/b&gt; these instructions have been updated and are now in the git repo here:
&lt;a href=&quot;http://git.clutter-project.org/cgit.cgi?url=clutter/tree/build/mingw/README&quot;&gt;
http://git.clutter-project.org/cgit.cgi?url=clutter/tree/build/mingw/README&lt;/a&gt;

&lt;p&gt;
I keep getting asked how to compile Clutter on Win32 now that we have
a native backend so here is some instructions to compile with MinGW
and MSYS on a fresh Windows installation.
&lt;/p&gt;

&lt;p&gt;
First you need to install the MinGW and MSYS packages from &lt;a
href=&quot;http://sourceforge.net/project/showfiles.php?group_id=2435&quot;&gt;
here&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
Select the top package called 'Automated MinGW Intaller' and download
the exe of the latest version. Run the executable and install to the
default location. Make sure you DON'T install 'MinGW make' to make
life easier.
&lt;/p&gt;

&lt;p&gt;
Next download the 'MSYS Base System'. Use the &lt;tt&gt;.exe&lt;/tt&gt; installer
from 'Current release' (not the technology preview). Run the
executable and install to the default location. Answer yes to whether
you want to continue with the post install and tell it the location
where you installed MinGW (which should be &lt;tt&gt;c:/MinGW&lt;/tt&gt;).
&lt;/p&gt;

&lt;p&gt;
Next install the 'MSYS supplementary tools'. Again select .exe from
the current release and install it to the default location.
&lt;/p&gt;

&lt;p&gt;
To make downloading the dependencies for Clutter easier, we want to be
able to run the &lt;tt&gt;mingw-cross-compile.sh&lt;/tt&gt; script which will do
some of the leg work automatically. However to do this we first need
some extra utilities.
&lt;/p&gt;

&lt;p&gt;
Make a directory called &lt;tt&gt;c:/msys/1.0/clutter-work&lt;/tt&gt; and another
directory called &lt;tt&gt;downloads&lt;/tt&gt; under that. Go back to the
SourceForge page for MinGW and select the 'User Contributed:
mingwPORT' section. Download the wget tarball to the newly created
downloads folder.
&lt;/p&gt;

&lt;p&gt;
Start MSYS and type the following to install wget.
&lt;/p&gt;

&lt;pre&gt;
cd /clutter-work/downloads
tar -jvxf wget-1.9.1-mingwPORT.tar.bz2
cd wget-1.9.1/mingwPORT
mkdir /usr/src
PATH=&quot;$PATH&quot;:&quot;$PWD&quot; ./mingwPORT.sh 
&lt;/pre&gt;

&lt;p&gt;
Press enter at each question to just use the default
&lt;/p&gt;

&lt;p&gt;
Next we need to install &lt;tt&gt;unzip.exe&lt;/tt&gt; which we can get from the
GNUWin32 ports. Visit &lt;a
href=&quot;http://gnuwin32.sourceforge.net/packages/unzip.htm&quot;&gt; here&lt;/a&gt;
and download the 'complete package, except sources'. Install it to the
default location.
&lt;/p&gt;

&lt;p&gt;
Now we can type the following to download and install the clutter
dependencies using the helper script:
&lt;/p&gt;

&lt;pre&gt;
cd /clutter-work
wget -O downloads/mingw-cross-compile.sh \
'http://svn.o-hand.com/view/*checkout*/clutter/trunk/clutter/build/mingw/mingw-cross-compile.sh'
PATH=&quot;$PATH:/c/Program Files/GnuWin32/bin&quot; sh ./downloads/mingw-cross-compile.sh
&lt;/pre&gt;

&lt;p&gt;
Press enter to all of the questions to get the default except the 'Do
you want to download and install Clutter...' questions because these
will try to use SVN which we don't have installed.
&lt;/p&gt;

&lt;p&gt;
Next we need to install pkg-config to get Clutter's configure script
to work. Type the following:
&lt;/p&gt;

&lt;pre&gt;
cd /clutter-work/downloads
wget 'http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz'
tar -zvxf pkg-config-0.23.tar.gz
cd pkg-config-0.23
prefix=/clutter-work/clutter-cross
libdir=&quot;${prefix}/lib&quot;
includedir=&quot;${prefix}/include&quot;
CFLAGS=&quot;-g -O2 -Wall -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include&quot; \
LDFLAGS=&quot;-L${libdir} -lglib-2.0 -lintl -liconv&quot; \
./configure
make all install
&lt;/pre&gt;

&lt;p&gt;
Now we should finally be ready to compile Clutter:
&lt;/p&gt;

&lt;pre&gt;
cd /clutter-work/downloads
wget http://www.clutter-project.org/sources/clutter/0.8/clutter-0.8.0.tar.bz2
cd ..
tar -jvxf downloads/clutter-0.8.0.tar.bz2
cd clutter-0.8.0
PKG_CONFIG_PATH=/clutter-work/clutter-cross/lib/pkgconfig \
 PATH=&quot;$PATH:/clutter-work/clutter-cross/bin&quot; \
 CFLAGS=&quot;-mms-bitfields -I/clutter-work/clutter-cross/include -g -O2 -Wall&quot; \
 ./configure --prefix=/clutter-work/clutter-cross --with-flavour=win32
make all install
&lt;/pre&gt;

&lt;p&gt;
Now to prove that it worked we can run test-actors. Windows needs the
Clutter DLL to be in the system path for this to work so type the
following:
&lt;/p&gt;

&lt;pre&gt;
export PATH=&quot;$PATH:/clutter-work/clutter-cross/bin&quot;
cd /clutter-work/clutter-0.8.0/tests
.libs/test-actors
&lt;/pre&gt;

&lt;p&gt;
If you want to compile a simple app without using autotools, it's
easiest to use the libtool generated in the Clutter source so that it
can work some voodoo with the included libraries. This assumes you've
still got your path set up from the previous test:
&lt;/p&gt;

&lt;pre&gt;
libtool --mode=link gcc -Wall -g -o simple-app simple-app.c \
-I/clutter-work/clutter-cross/include \
`PKG_CONFIG_PATH=/clutter-work/clutter-cross/lib/pkgconfig pkg-config clutter-0.8 --cflags --libs`
&lt;/pre&gt;

&lt;p&gt;
Enjoy!
&lt;/p&gt;</description>
  </item>
  </channel>
</rss>