Recently in Python Category

In Processing Hack Week news...this past week, I've received two replies to my requests for task lists from the various Processing derivative projects. One from the Ruby-Processing developer and the other from the Clojure-Processing developer. The other news is that the GIT-repo for Processing is coming together.

A long time ago, I wrote a blog post and some code that validates file uploads in Django. In the last week, it seems a lot of people have been interested in the post and since Django finally has a stable 1.0 release, I thought I would update the previous blog post.

On Friday I was bitching about the lack of websites that can import FOAF profiles. A lot of the popular ones like Twitter and LiveJournal can export them, but they don't seem to be able to import them and make use of the actual FOAF data. A portable file format only works when you can both import and export the data.

UPDATE: This post has been updated so the code will work with Django 1.0

While working on Clapton, the Django-based Content Management System (CMS), I had to write validation code for file uploads. This is needed because Clapton contains applications specific to media types such as documents which requires Word Documents, PDFs or OpenDocumentFormat files, and podcasts which requires MP3 or OGG files. But how do you guarantee that the right files are uploaded? By using Django's custom fields and newforms module.

A reddit user by the name of alanshutko stated what was necessary to make Scheme, Common Lisp, Haskell, and other non-mainstream languages more appealing to the average programmer.

Compare that with the types of simple programs we see in Perl and Python. "I have a bunch of files, and I want to rename them all according to some pattern." Common problem, easy solution. "I've got a log file full of email addresses, I need to strip them out from the log entries, remove duplicates, and add them to a database." Again, fairly simple, fairly small, really useful. When Haskell can compete on those types of problems, it'll be easier to induce people to learn it. (Same with CL, my fav language....)

So here is a Scheme program that does this. It is written to use MzScheme because that's the only Scheme I have installed in Windows at the moment. Thus, it takes advantage of PLaneT and the other libraries that come with MzScheme.

Hopefully this can convince others that Scheme is a good language for common tasks.