Technical articles
These are the articles I’ve written about technical, programming-related topics in order to share some of the experience I’ve had with Python, web development, and various other topics.
Group a list into chunks in Python
More than once I've had to take a list of items and group them into tuples. Here's the code.
YouTube video embedding with XSLT
XSLT can be used to expand a simple <youtube> XML element into a full, XHTML-compliant <object> element that embeds a YouTube video.
Pylons deployment with Lighttpd and Flup
What's fast, easy to set up, and good for running web applications? Lighttpd and Pylons!
Show your IP address using a Lua/Lighttpd script
Sometimes it's useful to be able to determine your external WAN IP address from a script. Here's a simple Lua/Lighttpd approach.
Pylons multiple-domain (virtual hosting) configuration
How to run more than one Pylons app, on different domains, in the same Python process.
Pylons apps on Google App Engine
This will show you how to get a Pylons web app running on Google App Engine in about 15 minutes, assuming you already have a GAE account and a passing familiarity with Pylons and virtualenv.
Managing multiple Pylons apps with Supervisor
Supervisor is a well-documented, convenient process manager that can help you wrangle multiple long-running processes like Pylons apps and lighttpd.
Pylons from scratch 1: a barebones app
Creating by hand what code generation would ordinarily do for you helps you understand Pylons and port existing apps to the Pylons deployment scheme.
Create Pylons filters: middleware the configurable way
Using Pylons (or Paste Deploy), filters are a configurable way to apply WSGI middleware to your application without code changes.
Rename your Pylons app without going mad
Eventually, you realize that the name you gave your Pylons app conflicts with another package, or just needs to be changed. Here's what to do.
GMP bignums vs. Python bignums: performance and code examples
Sample code for n-choose-k in Python, C using Python bignums, and C using GMP. Guess which one is fastest?
YouTube video embedding in reStructuredText
Some custom Python code makes it easy to embed YouTube videos in reStructuredText documents that are converted to HTML.
WSGI decorators considered inconvenient
How and why Python's self argument makes it tricky, and possibly not a good idea, to mix function decorators and WSGI
Add bound methods to instantiated objects in Python
Quick tip on how to dynamically add bound methods to objects in Python, which is distinct from dynamically adding new methods to classes.
Basic Formencode usage pattern
Here's a useful Python snippet that shows the basics of using formencode to validate form submissions inside a typical web application controller.
Install Python Imaging Library (PIL) on Intel Mac
Python Imaging Library may need an extra command-line option to install on Intel Macs (as may similar libraries)