Quantcast
Browsing all 27 articles
Browse latest View live

Caching a Django app with Nginx + FastCGI

I just spent a stupid amount of time trying to figure why Nginx was failing to cache my Django app responses. The Django app is running as a FastCGI backend and I have Nginx using the fastcgi_cache...

View Article


Building Nginx 0.9.5 on Debian Lenny

Nginx is available in Debian Lenny, but the version in stable is the old 0.6.x series. Perusio maintains a useful repository with development versions built for Lenny, but it requires libraries newer...

View Article


Adobe’s software update site is shit

This is written from the point of view of someone looking to keep abreast of software patches for Adobe‘s many excellent products (also Acrobat). Adobe’s Downloads page is mostly about downloading...

View Article

Adobe Software Updates

What Adobe’s software update site needs is: An RSS / Atom feed of recent updates. This way you can subscribe to a list of recent updates in your favourite news reader and be informed when a new update...

View Article

VCS for Cocoa Programming for Mac OS X

I am working my way through Aaron Hillegass‘ Cocoa Programming for Mac OS X (again). I find it a good book, despite the fact I’ve started it twice before and have abandoned my tuition twice before. I...

View Article


Styling your Excel data with xlwt

This post is about how to create styles in Excel spreadsheets with the most excellent xlwt for Python. The documentation for xlwt (version 0.7.2) is a little sketchy on how to use formatting. So here...

View Article

CSV sucks

For future reference: CSV is a terrible format for spreadsheet data. Any by spreadsheet data I mean CSV is a terrible format for text data that will be opened in Microsoft Excel (unless you only speak...

View Article

Image may be NSFW.
Clik here to view.

Lion: Spotlight still broken

I’ve installed Mac OS X 10.7 (upgrading from 10.6) and was very interested to see how the new search tokens feature would work in Spotlight. But on my Mac it doesn’t. Here’s the result of a search for...

View Article


XPath bug in old versions of ElementTree

I figured out why my XML parsing code works fine using the pure-Python ElementTree XML parsing module but fails when using the speedy and memory-optimized cElementTree XML parsing module. The XPath 1.0...

View Article


Free software FTW! Updated filetimes.py

Two years ago (flippin’ heck it seems like only yesterday) I wrote about converting between Unix timestamps and Windows timestamps using Python. In that post I linked to my very simple implementation...

View Article

Date variables in InDesign

Interesting InDesign problem: the format for a modification date variable changes per document. (This post describes a problem using Adobe InDesign CS4 but applies just as well to CS5 and CS5 and a...

View Article

Widths & Heights with xlwt + Python

This article about using xlwt to generate Excel in Python reminded me I needed to see exactly how to set column widths (the xlwt documentation doesn’t cover it). Let’s create a new Excel workbook and...

View Article

SharpZipLib and Mac OS X

TL;DR When creating zip archives with SharpZipLib disable Zip64 format if you care about Mac compatibility. Extra TL;DR When creating zip archives with SharpZipLib make sure you set the file size,...

View Article


SharpZipLib and Mac redux

I wrote a blog about generating Mac-compatible zip files with SharpZipLib, the conclusion of which was to disable Zip64 compatibility. It was wrong, wrong I tell you. The better solution is to just set...

View Article

Inspecting your routes in Bottle

Marcel Hellkamp recently added a small feature to Bottle that makes it easy to inspect an application’s routes and determine if a particular route is actually for a mounted sub-application. (Bottle is...

View Article


Custom template folders with Flask

Someone was asking on Flask‘s IRC channel #pocoo about sharing templates across more than one app but allowing each app to override the templates (pretty much what Django’s TEMPLATE_DIRS setting is...

View Article

A context manager for files or file-like objects

I usually design my Python programs so that if a program needs to read or write to a file, the functions will take a filename argument that can be either a path string or a file-like object already...

View Article


Image may be NSFW.
Clik here to view.

How to fix “ghost” files in the Finder

Sometimes the Mac Finder can get its knickers in a twist about files that you ought to be able to open just fine but Finder says no. You may see a message that says “Item XYZ is used by Mac OS X and...

View Article

Optimizing queries in Haystack results

My Adobe software updates app (which uses Haystack + Django to provide a search feature) has a very inefficient search results template, where for each search result the template links back to the...

View Article

Testing with Django, Haystack and Whoosh

The problem: you want to test a Django view for results of a search query, but Haystack will be using your real query index, built from your real database, instead of an index built from your test...

View Article
Browsing all 27 articles
Browse latest View live