I've just started learning Python WSGI (PEP-333) and thought the best way to learn would be to write some WSGI tools myself. Most recently, I chose to write a middleware application that converts all output into valid gzipped data. In this article, I will be demonstrating how my middleware gzipper works and how to implement it.
Continue reading 'Python WSGI Middleware for automatic Gzipping' »
I have put up a new script for those of you who are running Lighttpd. You can find it here. It is a dir-generator that is nearly identical to the default, but with the added bonus that you can sort by name, size, modification time, and file type. One downside is that it doesn't display mime type like the original does since to do that with PHP, it is required that an extension is insalled.
When I was in high school, I always had fun finding exceptions the "I before e, except after c" rule. I found over a hundred on my own back then just by searching around the Internet. It took me hours. Today I decided to take a better approach and wrote up a small script in to do the work for me. All in all, it found 533 exceptions to this rule.
Click here to view the list of exceptions.
Yeah, that's quite a few. If you're interested in how I did it, continue reading. Don't worry, I won't be sad if you came here just for the list.
Continue reading 'I Before E, Except After C - Not a rule, but a joke' »
A friend of mine recently embarked on creating a new website centered around search engine optimization known as Planet SEO (www.planet-seo.org). I really have to hand it to him. He's made quite a site. He managed to write up the code to run the site in a very short amount of time and kept to a schedule very well. (That's something I have a problem with.)
The site's service is simple and incredibly useful: it reads multiple feeds from websites that all deal with search engine optimization (SEO) and provides all of them at once. Combine the fact that Planet SEO already has a fair number of website feeds that it reads from, it makes sense for it to be the first spot to look at regarding SEO news & techniques.
This seems to be a great resource for those of us who aren't skilled in SEO. I'm really hoping that it'll help me expand my knowledge enough to where evanfosmark.com gets higher traffic from search engines.
Recently, I needed a quick and simple solution to buffer output of a few Python scripts. When I went to look for a module, I was astonished to find that one didn't exist. I quickly decided to change this. In this article, we'll discuss simple ways to buffer output using StringIO and I'll introduce my output buffering module that I constructed.
Continue reading 'Simple Output Buffering in Python' »
A great thing about working in Python is that it provides you with numerous methods of string formatting and interpolation. Unfortunately, it isn't as implicit as it is in PHP, where just using double-quotes will parse the string. In Python at the very minimum string interpolation requires the use of the modulo operator (%) or a custom-built function. In this article, we'll discuss building a string interpolation function using the string.Template object and Python 3.0's format method.
Continue reading 'Near-Implicit String Interpolation in Python' »
XOR encryption is a great solution to go with when a task requires that a piece of data is encrypted with a key when one doesn't have the means to use a more well-rounded algorithm. I've used it on a few occasions with great success. In this document, we'll discuss how to code the XOR cipher in Python and we'll cover the pros and cons of using it.
Continue reading 'XOR Encryption With Python' »