<?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>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;
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>
  <item>
    <title>Abusing Clutter</title>
    <link>http://www.busydoingnothing.co.uk/blog/2008/06/06#AbusingClutter</link>
    <description>&lt;p&gt;
I thought it might be fun to see how easy it is to use Clutter with
full 3D actors instead of just flat rectangles. I started off by
thinking I could make something like a table tennis game with a proper
model for a table and the bats. I made a model for the table with a
bit of wrestling with Blender so I needed a way to display the model
in Clutter.
&lt;/p&gt;

&lt;p&gt;
I decided to write a library to display MD2 models as a Clutter
actor. MD2 is the model format from Quake 2 for players and
weapons. It seemed like a good format because it's quite simple and it
already represents the model as a set of triangle fans and triangle
strips so it fits nicely with OpenGL.
&lt;/p&gt;

&lt;p&gt;
The result of that is available in a git repo here:
&lt;/p&gt;

&lt;p&gt;
&lt;tt&gt;git clone git://github.com/bpeel/clutter-md2.git&lt;/tt&gt;

&lt;p&gt;
You can create an actor from an MD2 file by passing it the
filename. When painting the model it scales the coordinates to fit in
the width and height of the actor while preserving the aspect ratio
(so you can position it easily with other pixel-based actors). You can
rotate and move the actor with the regular actor API. There is also a
new behaviour to animate the model using the frames in the file. The
frames are interpolated as key frames to make the animation a bit
smoother.
&lt;/p&gt;

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

&lt;p&gt;
I didn't have much luck with the MD2 exporter of Blender because it
kept complaining that I'd scaled the model and it made a mess when it
tried to convert it to triangles. So for now I've given up on the
table tennis game and started making a simpler game to demonstrate the
library using the ready-made MD2 models from &lt;a
href=&quot;http://www.md2.sitters-electronics.nl/models1.html&quot;&gt;here&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
The game creates a scrolling road (made entirely out of
ClutterRectangles) and animates driving past some tractors in a car
(which are MD2 models). You can move the car with the arrow keys, but
other than that it needs a lot of work.
&lt;/p&gt;

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

&lt;p&gt;
The git repo for the game is at:
&lt;/p&gt;

&lt;p&gt;
&lt;tt&gt;git clone git://github.com/bpeel/tractordodge.git&lt;/tt&gt;</description>
  </item>
  <item>
    <title>Cycling fail</title>
    <link>http://www.busydoingnothing.co.uk/blog/2008/06/01#Cycling_Fail</link>
    <description>&lt;p&gt;
&lt;img src=&quot;http://www.busydoingnothing.co.uk/bildoj/cycling_fail.jpg&quot; alt=&quot;image&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;
oops..
&lt;/p&gt;</description>
  </item>
  <item>
    <title>Twitter.el</title>
    <link>http://www.busydoingnothing.co.uk/blog/2008/05/19#Twitter-el</link>
    <description>&lt;p&gt;
Everyone and their uncle is releasing a Twitter client these days so I
thought I'd release the one I've been using too. It's just a simple
Emacs lisp script but it lets you view your friends timeline and edit
a new one so it's quite quick if you're already running Emacs (what
else would you be doing?).
&lt;/p&gt;

&lt;p&gt;
You can install it by downloading &lt;a
href=&quot;/dosieroj/twitter.el&quot;&gt;twitter.el&lt;/a&gt; and putting it somewhere in
your Emacs load-path. Then put the following in your &lt;tt&gt;.emacs&lt;/tt&gt;
file:
&lt;/p&gt;

&lt;pre&gt;
(autoload 'twitter-get-friends-timeline &quot;twitter&quot; nil t)
(autoload 'twitter-status-edit &quot;twitter&quot; nil t)
(global-set-key &quot;\C-xt&quot; 'twitter-get-friends-timeline)
(add-hook 'twitter-status-edit-mode-hook 'longlines-mode)
&lt;/pre&gt;

&lt;p&gt;
You can tell it your username and password and change the appearence
by typing &lt;tt&gt;M-x customize-group RET twitter RET&lt;/tt&gt;. Once you've
done that you can view the statuses by pressing &lt;tt&gt;C-x t&lt;/tt&gt; and you
can start editing a message with &lt;tt&gt;M-x twitter-status-edit
RET&lt;/tt&gt;. Once the message is finished press &lt;tt&gt;C-c C-c&lt;/tt&gt; to
publish.
&lt;/p&gt;

&lt;p&gt;
&lt;img src=&quot;http://www.busydoingnothing.co.uk/bildoj/twitter-el-screenie.png&quot; alt=&quot;image&quot; /&gt;
&lt;/p&gt;</description>
  </item>
  </channel>
</rss>