Older blog entries for StephanPeijnik (starting at number 8)

Summer Of Code 2009: Working for Debian

Yesterday Google announced the students and projects that have been accepted for Google Summer Of Code 2009 and guess what: my project was accepted. This means I will be working full-time on FOSS this summer.

So I guess it's about time to introduce my project to you: Distribution-independent update manager, mentored by Michael Vogt (mvo).

Okay, I believe some of you might wonder what this project is all about, as update-manager is in the Debian package archive already. There is a problem with update-manager though. As you see in the package's version number (it contains ".debian") update-manager has been adapted for use in Debian. Also, Debian contains update-manager 0.68 right now, whilst upstream (Ubuntu in this case) has released 0.111.6 (actually there were quite a few upstream versions meanwhile). The reason Debian is nowhere near being up-to-date with upstream is that right now a lot of effort has to be put into porting update-manager to Debian every time a new upstream release is made, because certain Ubuntu-specific functionality breaks update-manager in more or less severe ways on Debian.

This leads me directly to what my project is about: making update-manager (Ubuntu-) distribution-independent, but not package manager independent.
There are 6 main goals for this project, which I will be working on in the order below.

  • Analyzing the code and identifying Ubuntu-specific parts.

  • Creating a distribution-plugin interface and moving the Ubuntu-specific parts into a distribution-plugin, creating a core package that is distribution-independent.

  • Creating a special notification for important/security related updates and providing the code that handles updates from security.debian.org as such.

  • Creating a backend-plugin interface, moving the synaptics backend into a backend-plugin and optionally create a python-apt based plugin.

  • UI redesign, providing a simpler interface to average joe, whilst allowing more experienced users to optionally display more information.

  • Automatic downloading & installation of updates. This is still up to discussion, as automatic downloading is already provided by software-properties (-gtk and -kde) and automatic installation can be handled by unattended-upgrades. Both packages are part of Debian already.

Please note that this list should not be considered final and may be extended or modified over time. It exists to give you an overview of what exactly my project is about and how I am planning on carrying out the tasks.

Finally I wanted to let you know that I will keep you posted on the progress I am making, via this blog. Alternatively a blog aggregator for Debian's GSoC students has been set up over at http://soc.alioth.debian.org/feeds/blogs/, where you can not only find my posts, but those of all of Debian's students.

Syndicated 2009-04-21 07:10:00 (Updated 2009-11-09 20:21:28) from sp

Python everywhere: computer games

This is the second article in my series Python everywhere and covers the use of Python for in computer games. The first article of this series covered the use of Python for the conficker worm scanner tool and can be found here.
Games written in Python

PyGame provides a nice library for writing games purely in Python it is becoming more common to use Python for this task too. The book "Beginning Game Development with Python and Pygame" is linked directly from the PyGame homepage, and thus is probably a good resource if you want to start writing games in Python.

However, I do not want to go into detail on how this library works, but rather provide you with a few examples of games written in Python. To provide you with a few examples I had a look at the PyWeek homepage. PyWeek is a Python Game Programming Challenge which invites everyone to participate, so the winners of this contest are of high-quality, and I'm showing you the latest two winners.

There are always two winners of PyWeek in for indivduals who have created games and teams. The latest winners are "Team Rambo" in the individual effort category and "Midnight Sun" with their two-man team.

PyWeek: Team Rambo's Stringrolled (individual)

Stringrolled makes use of the pygame library I mentioned earlier and is a platform game. In a mere 2377 lines of code, including comments and blank lines, Team Rambo created an impressive game, coming with a story, easy-to-learn controls and nice 2D-graphics, screenshot below. Stringrolled screenshot @ media.pyweek.org

PyWeek: Midnight Sun's Kite Story

Kite Story is yet another interesting game, with game mechanics I have not seen ever before. You are controlling a kite with your mouse and are trying to catch objects, such as bees and birds, with the kite's rope. So what you basically do you draw a loop around an object withKite Story screenshot @ media.pyweek.org your mouse and that way catch it. Every third cought object you advance to the next level, but keep in mind not to collide with the objects, because you will lose them and in turn be doing the previous level again, screenshot below. It should be noted that this game does not make use of PyGame at all, but rather relies on pyglet, and is 1997 lines of code in length, again counting blank lines and comments too.

Games using Python

You have seen now that it is possible to write a game completely in Python, but there's another use-case of Python in games: scripting.
Some (proprietary) games, such as Civilization IV, offer Python support in their editors and SDKs. This quote from the article at 2kgames.com should give you a good idea of what can be done using Python in Civilization IV:

The next level offers Python and XML support, letting modders with more experience manipulate the game world and everything in it. XML (eXtensible Markup Language) files can be edited in standard text editors or in special XML file editors that have ease-of-use features like a grid view. Editing these files will allow players to tweak simple game rules and change or add content. For instance, they can add new unit or building types, change the cost of wonders, or add new civilizations. Players can also change the sounds played at certain times or edit the play list for your soundtrack. NOTE: You can have custom soundtracks simply by adding music to the custom folder. You only need to edit the XML in order to assign certain pieces to specific eras or remove certain pieces.

The Python scripting language is fully integrated throughout the game and offers experienced modders a chance to really strut their stuff! People with some programming skills will be able to do things to alter the game in interesting and extraordinary ways. For instance, all of the game interface screens are exposed to Python, so modders will be able to change the information that's displayed, as well as how it's positioned on the screen. We also use Python to create and generate all of the random map scripts that are included in the game. So, players will now have the ability to add scripted events to the game like automatically generating units when a tile is reached, having specific situations trigger automatic war, or get this, bringing back Civil Wars caused by unrest, Civ II style!

EVE Online is another game making use of Python, as an article over at eveonline.com points out.

Python everywhere - also in compuater games

Even though I am sure you can come up with a lot more examples of Python being used in computer games I think I have proven my point. Python is being used not only to create computer games, but sometimes also to provide developers with a way of extending games. To me personally it feels as if adoption of Python for this very task is increasing too, and I expect Python to be used even more by the game development community in the future.

You can expect the third part of this series to be released in about a week, so please check back regularly if you like the series.

Syndicated 2009-04-02 17:35:00 (Updated 2009-11-09 20:21:28) from sp

Problems running PHP as a separate FastCGI process

As some of you might have noticed this webserver has not been that responsive in the past few hours and I have been working hard on getting that fixed. I finally identified the problem and was able to fix it.

The root of the problem was my setup running PHP as a separate FastCGI process. Unfortunatly it seems as if PHP can only handle 500 requests per FastCGI process and then seems to lock up.
The old setup of this site didn't cause such problems and it seems the problem lies in not setting the PHP_FCGI_CHILDREN and PHP_FCGI_MAX_REQUESTS environment variables with the new setup.

I initially thought that the default values of those environment variables were safe, but they are not. As I already wrote PHP seems to lock up after 500 requests and the solution lies in changing PHP_FCGI_CHILDREN, which defaults to 0 (no additional processes) to something bigger than 0 (I am using 2 children to make sure I have at least one PHP process reading for answering requests at any time).
Why? Quite simple, if you increase the value the PHP root process becomes some sort of manager and delegates requests to the children, as expected. However, using PHP_FCGI_MAX_REQUESTS it only forwards the specified number of requests to a child process before killing it and starting a new one. Problem solved.

Information on this behaviour can not be found in the PHP online manual, but rather at

Syndicated 2009-04-01 12:06:00 (Updated 2009-11-09 20:21:28) from sp

Python everywhere: extending applications with Python

Extending applications with Python: gimp, Evolution, Inkscape, Paint Shop Pro, [...]

Syndicated 2009-03-31 14:33:00 (Updated 2009-11-09 20:30:21) from sp

Feeding spamassassin with fresh spam cont'd

A few days ago I wrote about how I wanted to attract some spam in order to feed my spamassassin's bayes filter with a lot of 'known-bad' emails. However, until now this experiment has not worked out as I thought it would. Even though links to the page providing the email addresses which are meant to be spammed have been placed on quite a few pages not a single spam email has been received by my system.

I am wondering if I have done something wrong or if those nasty email crawlers simply haven't stumbled across my little page yet. Does anyone have something similar up and running and would like to provide me with some input or tell me what exactly I am doing wrong?

Feeding your spamassassin with fresh spam

Recently I set up a new mailserver and the spamassassin's bayes filter running on that machine has not been feeded with enough spam yet to be working properly. So how would one go about getting that little bugger some usable information?

The way I chose was setting up a special sub domain having both a web and mailserver running. The webserver does nothing but present a robots.txt which basically disallows all access from good web crawlers and for all other requests it presents the requester with an email address. That address is randomly generated and information about the requester stored in a text-file. An email to that address will cause the email to be stored in a special mailbox. A small script in turn issue 'spamc -L spam' for all new messages in that mailbox and so feeds the bayes filter.

I am curious about how well that is going to work, but actually it should attract quite some spam


The iPhone is out...

And DefectiveByDesign has sent out an action alert. On his blog Gregory Heller of DefectiveByDesign explains the problems that exist with the iPhone and asks people to take action.

Personally I believe the iPhone is not worth buying. Besides running proprietary software and implementing digital restrictions management it doesn't support UMTS and HSDPA, which are supported by nearly every other phone out there. One should rather call that thing iPodMobileWithTouchscreen if you ask me.

29 Jun 2007 (updated 29 Jun 2007 at 16:22 UTC) »
Updating from GPLv2 to GPLv3

As this question has come up earlier I think it's a good idea to point out how to do that.

Your own project

In order to update your very own project (ie. you are the sole copyright holder) the only thing you have to do is:

  • Update the COPYING file in your source tarball
  • Update references to 'version 2' in your license notices to 'version 3'
Release it - done.

I strongly recommend checking your dependencies!
Don't forget that the GPLv3 is incompatible with GPLv2-only. This means that if you have any GPLv2-only dependencies you cannot update. The best idea might be contacting the owner of the code in question and ask them to move to GPLv3 or 'GPLv2 or later'.

Oh, and by the way, if a license notice does not explicitly state a version of the license you may choose the version yourself - so there is no problem with that.

Other's code

Even though a lot of people don't know that, you may update the license notices and the COPYING file of other packages if they state that you may choose 'either version 2, or (at your option) any later version'.

Last but not least: I AM NOT A LAWYER. The information in this post should be correct though

29 Jun 2007 (updated 29 Jun 2007 at 13:51 UTC) »

Happy GPLv3 day to everyone out there.

Today not only GPLv3 is to be released, but the GNU stalkerfs homepage also went online at gnu.org/software/stalkerfs. Have a look and if you are interested in the project, feel free to ask questions on the discussion mailing list.

What proved to be useful for me was the GPLv3 compatibility matrix, which can be found at http://gplv3.fsf.org/dd3-faq. You might want to have a look at it, as it lists how all GPL and LGPL versions are compatible to each other and what has to be done in order to have clean licensing in your project.

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!