Now I Have a Blog TooNow I Have a Blog Too Christopher Finke is a software engineer at Mahalo. He is available for birthday parties and bar mitzvahs.

Posts tagged with 'PHP'

Easy-peasy podcasting

Sunday, September 2nd, 2007

Want an easy way to generate a podcast or RSS feed? At Eliot's request, I wrote a PHP script that generates an RSS feed based on the contents of its parent directory, so whenever you add files to that directory (or its subdirectories), the feed is updated with links to those files. It also supports enclosures, so if you add an audio or video file to the directory, that file will be available to podcast clients. If you modify a file in the directory, the feed updates the link so that subscribers will see that it has changed. It's a no-fuss way to syndicate content without having to tie it into a CMS like Wordpress or TypePad.

Here's how to use it:

  1. Save this file as EasyFeed.php (or dir.php or feed.php, it doesn't really matter).
  2. Copy it to a directory on your webserver.
  3. Subscribe to the feed with any RSS or podcasting client.

That's all there is to it. For example, here's the feed of all of the files I've ever uploaded for use in my blog. If you subscribe to that feed with iTunes, you'll see that I've uploaded two audio files: programming.mp3 and calacanis.mp3. iTunes will automatically download them, as well as any other audio/video files I upload. No fuss, no muss.

What's old is new again

Friday, August 3rd, 2007

A few weeks ago, I started a little side project, and I decided to write it in Python with the Django framework based on all of the good things I've heard about it. I may never go back to PHP.

It's like this: imagine you've been driving the same 1987 Dodge Dynasty for the last 8 years. It gets you around, and you know exactly how to handle it. Most importantly, you've learned just what to do when it breaks down to get it going again. Then, one day, someone offers to trade you their brand-new Mustang for your Dynasty, straight-up. (They're a collector of late '80's sedans, you see.) You are unsure, since you'll have to learn how to handle this new car, but you accept, and your entire perspective on driving changes - the tired chore of going to the post office becomes your favorite pass-time; you've volunteering to take friends to the airport even when they have no flights to catch; and you can finally drive on the interstate since you know you won't break down.

This is what it's like to switch to Python after a lifetime of writing PHP. Programming is part problem-solving and part code-writing. With PHP, the fun of solving the problems overcomes the chore of writing the code; with Python, writing the code is enjoyable enough that I find myself wanting more problems to solve just so I can code the solutions. It's a great feeling.

WAMP! BAM! POW!

Thursday, June 21st, 2007

This morning, I needed to troubleshoot an error that was occurring in my Feed Statistics plugin when running on a Windows machine as well as under PHP 5. Since I normally do all of my development in *nix environments, I didn't have such an environment readily available. Having installed Apache, MySQL, and PHP on Windows XP before, I knew that I could do it, but it would probably take the better part of an hour.

I did a quick search for WAMP (Windows Apache MySQL PHP) and found the WAMP project - a single-file download that ostensibly installs Apache, MySQL, and PHP 5 in a Windows environment. I had tried this kind of package before with little luck, but this one literally took 3 minutes to set up, and after 5 minutes of debugging, I had found and fixed the bug in the plugin. Total time spent was less than 10 minutes when I had expected that it would take more than an hour - definitely one of the best software experiences I've had in recent memory.

(As for this post's title, I think all of the comic references at Brian's blog are rubbing off on me.)

Feed Statistics Plugin Fixed

Thursday, June 21st, 2007

If you had downloaded the Feed Statistics plugin for Wordpress and couldn't use it because of an error during activation, version 1.0.3 is for you. The "Plugin could not be activated because it triggered a fatal error" message was being caused by my usage of PHP's short open tags, which I should have known are not enabled everywhere. Thanks to Veg for the help that led to the fix.

Download the zip file of the newest version here, and overwrite feed-statistics.php in your blog's wp-content/plugins/ directory if you downloaded an earlier version. If you're downloading it for the first time, just copy it to that directory and activate it from the Plugin administration menu.