The Python programming language excels in scope and in pre-compilation, and is very useful for object-oriented scripting. This makes it suitable for larger projects than would otherwise be handled through scripting languages.
- Adding links to PDF in Python
- It is very easy to add links to PDF documents using reportlab or platypus in Python.
- appscript AppleScript translator
- Those of us who like Applescript but want a solid command-line scripting environment no longer have to muddle through when using appscript. We can write in AppleScript and then translate to appscript.
- Automatically distributing images within XHTML
- One of the nice things about XHTML is that the tools for reading XML have finally matured. So if, for example, I want to have a series of images automatically placed within my web page, I can parse the XHTML of the content to ensure that nothing is broken.
- Automatically link related URLs in Django
- One of the features of my old blog and my new Django CMS is autolinking the URLs that I mention in the text.
- Caching DTDs using lxml and etree
- It’s not just a good idea to cache public DTDs when validating your web pages with an automated script. If you don’t do it, you might get blocked from w3.org.
- Calculating true three-fold PDF in Python
- Calculating a true three-fold PDF requires determining exactly where the folds should occur.
- Cleaning iTunes track information
- Python and appscript make it easy to modify iTunes track information in batches—if you’re willing to get your hands dirty on the Mac OS X command line.
- Custom authentication in Django
- Decorators can be used to restrict access to any view.
- Django forms and edit_inline models
- Getting edit_inline models to show up on custom forms isn’t as hard as it looks. MultiValueField and MultiWidget aren’t documented well, but they do work. Here’s how I did it in Django 0.96.
- Django Twitter tag and RSS object
- I wanted to embed my twitter feed into my Django blog, and didn’t see any simple RSS readers for Python that did what I wanted.
- Django: Beyond the SQL
- Django is a great application framework for Python and web applications. You can use it to greatly speed up your database and application development both on the web and on the command line. This tutorial is currently a very rough draft; it probably won’t be very useful without the assistance of someone who knows Django running the tutorial. If I ever run this tutorial a second time, I’ll probably update it with screenshots to make it more usable for individuals.
- Dynamic template content in Django fields
- It’s easy to run database content through Django’s templating system as if it were a template, before handing it off to the “real” template render. This allows you to put template tags inside of your dynamic content as well as inside template files.
- Easier random tables
- Rather than having to type --table and --count, why not just type the table name and an optional count number?
- Embedding Mako into Django
- You got Mako in my Django! You got Django on my Mako! Two great templates that template great together.
- Excerpting partial XHTML using minidom
- You can use xml.dom.minidom to parse partial XHTML as long as you use a few tricks and don’t mind that getElementById doesn’t work.
- How useful is Django?
- I was recently asked “how do you find Django?” after mentioning that I’ve been using it extensively. The answer is by squinting a bit.
- Learning Python
- If you’ve been looking to learn Python, or need a new language with clearly defined scope and easy objects, this is an extremely useful book.
- Media duration in Python on Mac OS X
- It turns out to be very easy to get the duration of MP3 files, MPEGs, and other media files on the OS X command line.
- minidom self-closes empty SCRIPT tags
- Python’s minidom will self-close empty script tags—as it should. But it turns out that Firefox 3.6 and IE 8 don’t support empty script tags.
- Multiple column PDF generation in Python
- You can use ReportLab’s Platypus to generate multi-column PDFs in Snakelets, Django, or any Python app.
- Multiple Input Fields with multiple inheritance
- We needed to display one TextField as either a TextInput or a Textarea, depending on the value in the field. Multiple inheritance makes it easy, if a bit wonky.
- Multiple tables on the same command
- The way the “random” script currently stands, it does one table at a time. Often, however, you have more than one table you know you’re going to need. Why not use one command to rule them all?
- MySQL for Other Applications
- The basics of working with MySQL for users of other applications such as Dreamweaver, PHP, Perl, or Python.
- Object-oriented HTML with Python
- Simple HTML creation within Python scripts, using a hierarchical organization of HTML parts.
- Parsing JSKit/Echo XML comments files
- While I’m not a big fan of remote comment systems for privacy reasons, I was willing to use JSKit as a temporary solution because they provide an easy XML dump of posted comments. This weekend, I finally moved my main blog to custom comments; here’s how I parsed JSKit’s XML file.
- A present for Palm
- Palm needs a little help understanding XML.
- Programming for Gamers: Choosing a random item
- If you can understand a roleplaying game’s rules, you can understand programming. Programming is a lot easier.
- Put a relative clock on your Desktop with GeekTool
- There are a lot of desktop clocks that show the absolute time. But sometimes you just want to know if the time is today, or yesterday, or two days ago. Here’s how to do it with Python and GeekTool.
- Python command-line option parser
- As of Python 2.3, there is a very easy to use command-line option parser to replace getopt.
- Python Imaging Library on Leopard Intel
- On Mac OS X Server 10.5, Apache runs as a 64-bit process, but wants to compile everything as 32-bit. This makes it difficult to install many modules; here is how to get the Python Imaging Library working for Django projects such as photologue.
- Python PDF generation with Snakelets
- One of the things I need to do to move my current web site over to Django is be able to automatically generate PDF documents. Step is to learn how to generate PDF using Python.
- PyTown
- General rambling in code regarding Python, Mailman, and Django.
- Quick & dirty Snakelets “blog”
- This “No Second Chances” blog engine was fun to write during spare time at ETech 2007. Snakelets appears to be a useful Python webapp server if you need a webapp server immediately.
- Save all Scribus pages as EPS
- There doesn’t appear to be a built-in way to save all pages seperately as EPS in Scribus. This script will do so.
- Thinking Python: Django cache expiration time
- Django sets the expiration time when data is cached. Sometimes it makes more sense to expire data dynamically based on later changes to the database. Does this mean a change to CacheClass? Not necessarily.
- Using appscript in Python to control GUI applications
- The appscript module for Python lets you control scriptable applications on the command line without having to coordinate your command-line script with your Applescript applications.
- Using appscript with Apple Mail to get emails and attachments
- Python and appscript can be used to get email messages out of Apple’s OS X Mail client, and even to get and save attachments.
- Using ETag and If-Modified-Since
- In the article on grabbing an RSS feed, I mentioned that if you’re grabbing a feed more than once a day, you should pay attention to the ETag and the If-Modified-Since headers. Here’s how to do that.
- Using the color picker in Inkscape extensions
- It was pretty easy, looking at the built-in extensions, to switch colors from one to another if I wanted to type their values by hand. But using the color parameter type took a bit of sleuthing.
- Write an Inkscape extension: create multiple duplicates
- Once you get past the complete lack of simple real-world examples, it’s pretty easy to make Inkscape extensions. So, here’s a simple real-world example.