Showing posts from July, 2007

Git problems... when moving.

There is a good explanation of the problems people have because of gits lack of move support. This is Linus explaining this problem he has with git.

The problem is that git gets confused when you move code from one file to another, and change it at the same time. Since it uses code similarity to find moved code - changing the code at the same time that you move it confuses it's move detection code.

So the solution is a convention of making almost no code changes when moving a file. Delete the file, and create your new file with no changes, and merge - then make your code changes in the new file.

See the problem with git and move for more details.

Of course systems which don't use move detection by code similarity completely fail when people delete a file, and create a new file(eg. bzr).

So both git, and bzr fail when you forget to follow conventions. An ultimate system would do both - detect code moves automatically, and allow you to do explicit moves.

Update: Jay Parlar comment…

Why urlencoding is a good 'format' for ajax.

urlencoding works for most languages. eg, javascript, flash, python, php. So you can use it in a limited sense to encode stuff for transport.

eg. a script could return this:

Streaming is the cool thing you can do that you can't really do with json, or xml. Well you can, but it's a tad harder. Decode/encode is really quick for urlencoding, and can be slightly better than json/xml.

This is an old trick that's been used in the flash world forever, but you can do it with js too(but no one seems to). Since not many people seem to be doing it in js, I thought I'd share the technique. Json is probably a better encoding to use most of the time, but this method has it's advantages.

With the partial data you download you can try to urldecode it. If you put markers in the data, then you can check up to that point.


at data == "a=3&r=hello+th"
You can tell that a=3 is correct, but not what r equals. You also no you aren't at…

Revision tracking of functions is more important than file names.

With git, and bazaar two differences are that one tracks code moves fairly well and one tracks file moves well. One was originally written mostly by someone managing a code base, and the other is originally written by a company doing an operating system. So you can see their priorities - one has lots of code it cares more about, and the other has a lot of files it cares more about. (There are quite a few other priorities and features that each have).

I guess tracking the code itself is much more important than tracking file renames - for me. Much more useful anyway.

However *both* are important parts of revision control.

Many times during development I might cut a function/class from one file and move it into another. I can't get reports of this information in a meaningful way with bazaar (or can I?).

Also I might accidentally move a file with the command line tools, change it, then add it in again to the revision control system. This is because I forget that I need to use the r…

My issues with python ORMs

If a python ORM you know of addresses these issues, please let me know.
Python ORMs break with multiple processes.
Multiple processes are not assumed. Python ORMs all seem to use heavy local caching, which fails when the database is modified by another process. This is unfortunate as for me I like to use different tools for different jobs. Or there might be different people I work with that write tools in different processes. Or even the common case that each web request is run in a different process - or on a different machine.

It is not commonly known that just because something outside of a python app changes a database that the python app will break. Most applications that use databases do not break if the database changes from outside of the application.

Using memcache or something like it seems to be a solution to some of this problem. Also optionally allowing the ORM to not cache certain queries - or even stopping all caching. Caching using python dicts is bad anyway, becaus…

europython 2007 - batching apis as applied to webpages


Here's my paper and code for combining multiple images - and other things.

europython2007 - Taking advantage of multiple CPUs for games - simply

Here's my Multiple CPU paper I am presenting tomorrow morning at europython. The pdf on the europython website is a bit old.

Hope to see you there! ... if you're not too hung over.


Taking advantage of multiple CPUs for games --- simply, is the topic of this paper. Using a simple interface that many are already familiar with --- Pythons 'map' function. It talks about how to avoid the Global Interpreter Lock (GIL) limitation in Pythons threading libraries. As well as how to choose which parts of a game to thread. Finally it shows how easy it can be, by converting a full pygame to make use of multiple CPUs --- and benchmarking the game.

snakes on a phone - europython 2007

This talk was about Python on Nokia s60 phones.

These are my notes...

Discusses implementation details - like what they had to change to get it working nicely. He also discussed what you can do with the phone - which turns out to be most things. Like accessing the camera, and sending/receiving sms.

It's based on python 2.2, but has had some things back ported. Like the pymalloc. He said at some point they might update the python to a newer version. The schedule is 'The future - a closer future than before.'. Then of course before that he said 'the future is now' - probably those two statements aren't related, and were taken out of context.

Including not using writable static data, and the modifying interpreter for the security model on the phone. The security model includes using capabilities, and signing executables. There are different levels of signing certificates. The basic ones are free, but others require contracts and money.

By default as python can…

europython 2007 - hello from Vilnius


I'm sitting at my hostel in Vilnius preparing for my presentations.

I've managed to get wireless internet working from windows here, but for some reason my linux doesn't like this particular access point.

After a marathon 38ish hour journey I arrived at almost midnight, then fell asleep. I spent half the day today wandering around the old town looking at things.

I'm looking forward to when the conference starts. Should be good to meet everyone, and see what everyone is up to.

Here's some pictures from my adventures in old town today...


I have been working on a virtual lounge room for - an online rug shop. The owner (David), also has a real shop a few blocks from me, and is a young guy who's got good ideas about websites.

This is a flashy website where you can select a rug, some furniture, and some paintings by a local artist. So you can kind of see how the rug might look in a room of your own. I guess kind of like an Ikea catalogue where you can change the items in the photo.

You can also change the colour of the walls, the shadows of the room, and the type of floor under the rug.

The front part was made with flash - with a lot of action script.

One of the hard parts was doing a 3D transform of the photo of the rug. So it sat in the room with the correct perspective. All of the photos were taken over head, so the transform needed to be done to make the rugs look ok in the scene. Since all of the photos were already taken, retaking the photos from a different angle wasn't practical.