Feed on
Posts
Comments

Recently I needed to upload some patches to Review Board. I foolishly tried to upload a patch that was created by git diff (I’m a git-svn user) but Review Board expects an SVN patch… While there are some simple solutions to be found on the web, I could not find any that correctly handled new files in the patch. The closest thing I found was a mail on the KDE panel-devel mailinglist.

I started looking into sed and came up with a slightly more powerful version:

This script supports updated files and new files. I have not tested it yet with deleted files.

Feel free to use it if you need it. Good luck!

Note: a friend linked me a Perl script that does the same thing. I haven’t tested it yet, so I have no idea how well it works.

My Volvo V50’s mp3 player is able to sort the folders it finds on the flash drive I plug into it, but is unable to sort the mp3 files in the folders in any useful way. It seems like it just plays them as it finds them on the file-system. This week I found a utility that sorts the files on the file-system, called FATSort. If you’re a Linux user, make sure the names of your mp3 files start with the track number (01, 02, 03, …), install this utility and run it on your flash drive’s device. Your car will now play your music in the order it was intended to be heard.

If you’re a windows user, this utility seems similar, but I didn’t test it.

I hope this helps a fellow Volvo (or other) owner out. Happy listening!

This is just a quick note to announce that I will be reviewing “Grok 1.0 Web Development” from Packt Publishing. They kindly provided me with an elektronic copy of the book. I’m looking forward to getting to know a new Python web framework (Grok) and the framework it’s based on (Zope 3). To be continued…

Being a big git fan, I was disappointed when I was forced to use mercurial at work. In my opinion, mercurial is not as flexible and powerful as git. But lately I’ve started to use the mq extension of mercurial, which gives me back some of the more powerful features of git I had missed the most.

One thing I liked about git was being able to update my commits to include the name of a reviewer in the commit message, or to include the fixes that resulted from the review in the commit. Read on to see how you can use the mq extension for this.

Continue Reading »

BurgieBot is a project that was started early 2008 by Nicolas Trangez and had some short bursts of development since. Its purpose since has been to run inside a small IRC-channel, logging, and more importantly hosting trivia games. :)

The trivia plugin is the most important feature of BurgieBot, and the one I enjoyed most over the last months. I didn’t announce it back then because it had some small bugs that needed fixing. Those are fixed now, and the bot runs quite nicely. There’s a lot that I wanted to fix/change before releasing it, but following the release early, release often philosophy, I’m releasing it now.

BurgieBot pros

  • Easy to extend with plugins
  • Trivia plugin
  • Automatic reloading of plugins without restarting the bot

BurgieBot cons

  • No i18n, most strings are in Dutch
  • No docs…
  • Automatic reloading of plugins sometimes fails

Download it
Tarball, Zip

Dependencies

  • Python 2.5 or higher
  • SQLAlchemy 0.4.4 or higher
  • twisted
  • pyinotify (used for reloading modules on the fly)

How to run it
Create a settings.py file in the folder containing the burgiebot.py file containing:


channels = ['#demochannel',]
host = 'irc.demoserver.org'
port = 6667
nick = 'BurgieBot'
dsn = 'sqlite:///file.db' # Use an sqlite db
colors = True # Display messages in color

And run the bot using python burgiebot.py

You can browse the code here (yes, that’s a Django-based gitweb-like interface, which is WIP and unreleased :) ), or clone the git repository from http://realnitro.be/git/burgiebot.git/

Het is alweer een maand geleden dat ik hier iets gepost heb, dus het is hoog tijd voor een kleine update: Ik heb deze voormiddag getekend bij Q-layer. Nicolas en ik worden dus collega’s vanaf 1 september. :) Q-layer ontwikkelt o.a. Virtual Private Datacenter software en een Datacenter Abstraction Layer. Meer info hier. Fancy screencasts hier (registratie nodig).

Nu nog die thesis op tijd afkrijgen…

Great error messages

I just ran into this error message:

$ find . -name "*/version*/*"
find: warning: UNIX filenames usually don't contain slashes (though pathnames do). That means that '-name */version*/*' will probably evaluate to false all the time on this system. You might find the '-wholename' test more useful, or perhaps '-samefile'. Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ */version*/*'.

I wish I could say the same about git. :)

Toen ik daarnet een link naar een pagina op deredactie.be volgde kreeg ik na lang wachten het volgende bericht van firefox: “Firefox can’t find the server at www.deredactie.be.”. Na wat geëxperimenteer op servers binnen en buiten het UGent-netwerk (realnitro.be, eduserv/genix, een vtk-server) blijkt dat deredactie.be overal toegankelijk is, behalve vanuit het UGent-netwerk…

Weet iemand hier meer over? Zou dit een block vanuit de vrt zijn, of zou het probleem ergens tussenin liggen? Een traceroute stopt bij “195-130-153-129.iFiber.telenet-ops.be”… Iemand?

Git op eduserv

Onder invloed van Nicolas ben ik een eindje terug git-gebruiker geworden. Git is een snel versiecontrolesysteem (version control system), zoals svn, maar dan anders. :P Een groot verschil is dat git ‘distributed’ is. Wat dat precies inhoudt ga ik hier niet uitleggen, wikipedia kan dat veel beter.

Vorige week kreeg ik plots het idee om een git-repository te maken op eduserv.ugent.be (of moet ik genix zeggen?). Het leek me handig voor studenten die gebruik wilden maken van een versiecontrolesysteem maar niet over een eigen server beschikten. De rest van deze post is een korte tutorial die je uitlegt hoe je een repository ‘pusht’ naar eduserv. Ik veronderstel dus dat je al een basiskennis van git hebt.

Log in op eduserv via ssh. Voer volgend commando uit:

cp /users/j/jgeirega/git-script.sh .

(Inclusief de ‘.’!) Als je de inhoud van dit script bekijkt (bijvoorbeeld met “cat git-script.sh”), dan zie je dat je PATH variabele hierdoor veranderd wordt. Dit betekent dat al je bestanden uit mijn home-map (/users/j/jgeirega/bin) zal gebruiken om met git te werken; Als je dit niet vertrouwt (ik kan in feite gelijk welk commando in die map stoppen, maar dat doe ik uiteraard niet) kan je je eigen git compileren, daarover meer op het einde van deze post. Pas nu ook met een editor naar keuze (pico-gebruikers vinden die terug als /opt/csw/bin/pico) je .profile bestand aan, opnieuw om de PATH variabele aan te passen. Voeg volgende regel toe:

PATH="$PATH:/users/j/jgeirega/bin"

(Hier geldt dezelfde opmerking als daarnet.) Als je nu uitlogt en opnieuw inlogt zou je op eduserv het commando ‘git’ moeten kunnen uitvoeren. De output zou moeten beginnen met:

usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate] [--bare] [--git-dir=GIT_DIR] [--help] COMMAND [ARGS]

Maak nu waar een map aan waar je je repository wil plaatsen. (Opmerking: gewoonlijk laat men de mapnaam van een git repository eindigen op ‘.git’. Bijvoorbeeld ‘test.git’.) Als je je repository via het internet beschikbaar wil maken kan je het bijvoorbeeld in je WWW map zetten. Navigeer in je repository-map en voer uit:

git --bare init

Voer nu uit:

chmod u+x hooks/post-update

Zorg dat je het preciese pad van die map kent (gebruik bijvoorbeeld het commando ‘pwd’), en je werk op eduserv zit erop!

Terug op je lokale machine open je in je lokale repository het bestand .git/config met een editor naar keuze. Voer daarvoor volgend commando uit:

git-remote add eduserv ssh://GEBRUIKERSNAAM@eduserv.ugent.be/MAPNAAM

Vervang GEBRUIKERSNAAM door je gebruikersnaam en MAPNAAM door de naam van de map waarin je zonet een lege (bare) git-repository hebt gemaakt. Om nu de volledige inhoud van je repository naar eduserv te ‘pushen’ voer je uit:

git-push --force --all --receive-pack=~/git-script.sh eduserv

De output zou moeten gelijken op:

updating 'refs/heads/master'
from 0000000000000000000000000000000000000000
to 2318059c3497c80885602654045511a58b37d9c8
Generating pack...
Done counting 6 objects.
Deltifying 6 objects...
100% (6/6) done
Writing 6 objects...
100% (6/6) done
Total 6 (delta 0), reused 0 (delta 0)
refs/heads/master: 0000000000000000000000000000000000000000 -> 2318059c3497c80885602654045511a58b37d9c8

Vanaf nu mag je de –force en –all na git-push weglaten als je je eduserv-repository wil updaten:

git-push --receive-pack=~/git-script.sh eduserv

Merk op dat –receive-pack het script doorgeeft dat je eerder op eduserv hebt gekopieerd. Dat script is (voor zover ik weet, ksh is een raar ding) nodig om te zorgen dat enkele nodige uitvoerbare (git-)bestanden in je PATH zitten.

Als je je repository onder je WWW map hebt gemaakt kan je het nu clonen over http. Bijvoorbeeld voor een van mijn publieke repositories:

git-clone http://studwww.ugent.be/~jgeirega/git-repos/test.git/

Wil je zelf git compilen op eduserv? Download dan eerst een git tarball met wget of scp hem naar je account (hier gebruik ik de .tar.gz versie), en extract de tarball met:

gzip -dc git-1.5.2.5.tar.gz | tar xf -

Verander git-1.5.2.5.tar.gz naar de versie die je hebt gedownload. Cd in de uitgepakte map en open het bestand Makefile in je favoriete editor. Om git-1.5.2.5 te kunnen compileren moest ik de regels

ifndef NO_TCLTK
OTHER_PROGRAMS += gitk-wish
endif

in commentaar zetten, en in het configuratiegedeelte van SunOs (begint met “ifeq ($(uname_S),SunOS)” en eindigt met “endif” heb ik voor die endif het volgende toegevoegd:

# EDUSERV SPECIFIC
AR = gar
TAR = tar
BASIC_CFLAGS += -I/opt/csw/include
BASIC_LDFLAGS += -L/opt/csw/lib
NO_TCLTK = NoThanks
NEEDS_LIBICONV = YesPlease
ICONVDIR = /opt/csw
CURLDIR = /opt/csw

Zorg dat /opt/csw/bin/ en /opt/csw/gcc4/bin/ in PATH zitten. Voeg daarvoor volgende regel toe aan ~/.profile:

PATH="/opt/csw/bin:/opt/csw/gcc4/bin:$PATH"

Log opnieuw in, navigeer opnieuw naar je git-map en voer eerst ‘gmake’ en daarna ‘gmake install’ uit. Als alles zonder fouten is verlopen heb je nu in je home-map een map ‘bin’ met daarin alle uitvoerbare git-bestanden… Succes!

Edit: Enkele kleine aanpassingen. Bedankt Nicolas. ;)

I’m subscribed to a few gaming-related blogfeeds and Lost Garden is one of my favorites. Today Lost Garden’s Danc posted a new game prototyping challenge: “Play With Your Peas“. The challenge is to build a game based on Danc’s game idea, using his (free!) graphics. The game idea and the graphics were both very attractive, so I decided to dive in.

I used Istanbul to record a screencast of the result after 10-odd hours of hacking with pygame. Download the .ogg here. (I’m too tired/lazy to convert it to another format. If you can’t open it with your browser, use right-click and save-as to download it and play it with VLC. I might upload a better version tomorrow.) The basic level-building code is done, the rest isn’t. :) Grab the code here, but keep in mind that it was written in a rush by a pygame noob. ;) I used the code of this tutorial as a starting point. One obvious mistake I made was reloading each sprite over and over again but that doesn’t keep it from working. The code should run on all OS’s that are supported by pygame. You’ll need a copy of Danc’s graphics, extracted to a subdirectory called ‘data’.

I threw the unfinished code online because I don’t know if I’ll keep on working on it after today. There is still a lot of work to do on my master thesis so my focus will be there from now on. :)

Older Posts »