As I pursue my python adventures, I of course wanted to learn how to do one of the things I do most - pull data out of MySQL. It seems the simplest way to start doing that is Python is to use MySQL-Python. So, after a downloading the package from SourceForge, and following the […]
Forcing a Download with Apache and .htaccess
Sometime you don’t want to give your site visitors the option to open a file in their web browser. This could be a Microsoft Office document, or even a giant jpg or png image. When you want to force download a certain file type, simple add something like this to an .htaccess file in the […]
Clean File Names with Automater
Every web developer knows how it goes - now matter how many times you tell your clients not to includes spaces, slashes, etc. in the files they want posted on their website, they do it anyways - it’s part of the deadline-driven work flow. Let’s take a basic look at how to fix this easily […]
Using PEAR Pager and HTML_Ajax to Build a PDF Catalog
I have a client with a large product catalog in PDF format, which is close to 20MB to download. While this is fine for some of their customers, they wanted to give people the ability to only download what they needed, as well as the ability to sort of “flip” through it without having to […]
Absolute Relative Positioning in CSS
Often, when you’re putting a design into CSS you run into various browser support issues, especially with float behaviors. Let’s say you have a thin top layer, which may contain some navigation and/or a banner, and below that you have a main content container. Now, let’s say you have a logo, or some other element […]
Get TextMate to Recognize More Python Keywords
Syntax highlighting is definitely your friend when you’re coding, and while I love TextMate, it’s support for some languages is still a bit lacking.
For reference, you can always get my current customized theme(s) here. You can browse more themes at the Textmate Wiki.
Fortunately, it’s rather easy to customize the language packs. Here’s what I did […]
Moving Data Out of Movable Type
ChronicBabe.com started off as a smallish blog, and was powered by Movable Type. But as the site grew, features were added, and we soon started to feel a bit limited by good ol’ MT, even with it’s extensive range of plug-ins. I had been working on my own content management system, and ChronicBabe.com founder Jenni […]
Basic File Parsing with PHP and Python
I’m currently taking a masters class on dynamic languages with DaBeaz, and our first assignment was to parse a basic text file containing a stock portfolio, like so (here’s a simple text file w/ all of them):
YHOO 50 19.25
AAPL 100 143.41
SCOX 500 4.21…
The values are symbol, shares, and price. We had to produce a nicely […]
Moving to a New Domain? Use Apache to Redirct the Old to the New
So you have to move your site to a new domain - it happens. One of my clients just had to go through this because of a legal issue. But never fear - there’s no need to break your existing search engine results, or websites that have linked to your old domain, or folks that […]
Simple SQL to Track Hits/Views
I just added a feature to ChronicBabe.com, which runs a custom CMS, to keep track of how many times an article as been viewed. In the code that pulls an article from the database, this single line of SQL quickly increments a “hits” row (type=INT) in the “articles” table for a given id:
UPDATE articles SET […]