Django: Serve big files via fcgid

I’ve got a django project running which requires you to login to access files.

That means that I have to serve the files via python, like this:

@login_required
def download(request, filename):
  # ... some code specific to my site ...
  response = HttpResponse(mimetype=postUpload.mimetype)
  response['Content-Disposition'] = "attachment; filename=" + original_filename
  response['Content-Length'] = os.path.getsize(filename_path)
  response.write(open(filename_path).read())
  return response

Turn demoscene modules into mp3s

Update 2018 (11 years later): I fixed the python scripts below, so they should still work! If not, then please add a comment below. Btw: Isn’t it amazing that modland is still up and running after all these years?

iTunes screenshot of purple motions tracks

If you were part of the demoscene in your former life, if you were and still are fond of modules (those sound files with the mod, xm, s3m, it, … ending), if you are a linux user and if you still want to listen to this music on your computer without doing all the tweaks of installing (or even compiling) music player plugins for itunes or amarok or if you simply want to listen to Purple Motions tunes on your mp3 player then this little tutorial is for you. If not, then you won’t have read that far anyway..

Tagsystems: performance tests

In my previous article named “Tags: database schemas” we analysed different database schemas on how they could meet the needs of tag systems. In this article, the focus is on performance (speed). That is: if you want to build a tagsystem that performs good with about 1 million items (bookmarks for instance), then you may want to have a look at the following result of my performance tests.
In this article I tested tagging of bookmarks, but as you can tag pretty much anything, this goes for tagging systems in general.

Tags: Database schemas

Recently, on the del.icio.us mailinglist, I asked the question “Does anyone know the database schema of del.icio.us?”. I got a few private responses so I wanted to share the knowledge with the world.

The Problem: You want to have a database schema where you can tag a bookmark (or a blog post or whatever) with as many tags as you want. Later then, you want to run queries to constrain the bookmarks to a union or intersection of tags. You also want to exclude (say: minus) some tags from the search result.

Apparently there are three different solutions (**Attention: **If you are building a websites that allows users to tag, be sure to have a look at my performance tests as performance seems to be a problem on larger scaled sites.)