Archive for the ‘Open Source’ Category

Chickenfoot – Firefox extension to automate web tasks with Javascript in your browser Jan 18 2007

This looks pretty neato.

Chickenfoot is a Firefox extension that puts a programming environment in the browser’s sidebar so you can write scripts to manipulate web pages and automate web browsing. In Chickenfoot, scripts are written in a superset of Javascript that includes special functions specific to web tasks.

Check it out: Chickenfoot

(Via the Lifehacker RSS feed at

Fixing’s IMAP date problem | MostlyGeek Dec 18 2006

Update: I’m now hosting this file here in the hopes that it can be useful to others since the original link doesn’t work anymore. Please note: I cannot provide ANY support for this. I didn’t write it. You should read through the options carefully before running this on your machine. That being said, it did work for me at the time, so hopefully it will work for you as well.

After copying an IMAP account from one server to another I ran into this same problem. The bash script that is supplied worked perfectly for me to fix the problem. They give example scripts for both BSD and Linux.

Fixing’s IMAP date problem

There is one last problem with that I finally got around to fixing today. When I upgraded to Tiger my IMAP accounts didn’t upgrade well so I deleted them and added them again. That fixed the connection and synchronization problems but introduced the IMAP Date problem.

The IMAP Date problem is the result of how figures out the Date Received time for an email. Rather than using the Date: header in the email it uses the time the file was written to the file system. This becomes a problem when files are copied to a new location on the server and the creation time of the file is changed. When the entire contents of a Maildir is copied to a new location this can cause all emails to display with the wrong date and time!

The solution is to change the time stamp of each email message that is wrong. The process is:

  1. Get the Date: header from the email message
  2. Compare it to the file system time stamp
  3. If they are different, change the time stamp to the date in the email

Here is the shell script that accomplishes this. All that needs to be done is to point it at a user’s Maildir and it will handle the rest. A word of warning, this script is likely far from perfect. I did run it on my own Maildir and it fixed about 16,000 emails in about 3 minutes.

Old link (broken): Fixing’s IMAP date problem | MostlyGeek

New link to download the script hosted here:

Here is the contents of the script:

# Date : July 4th, 2005
# Author: Benson Wong
# This shell script corrects email messages where the file system
# date does not match the Date: header in the email.
# This will fix problems with mail clients like Apple's
# which uses the file system timestamp resulting in emails with the
# wrong file system timestamp to display the wrong received date
# This script has to be run by a user [root] with the
# necessary privileges to read/modify files in a user's Maildir.
if [ $# -lt 1 ]
echo "Usage: $0 /path/to/user/Maildir"
exit 1
if [ ! -d "$MDIR_PATH" ]
echo "Error: $MDIR_PATH does not exist"
echo "Usage: $0 /path/to/user/Maildir"
exit 1
if [ ! -r "$MDIR_PATH" ]
echo "Error: $MDIR_PATH is not readable"
echo "Usage: $0 /path/to/user/Maildir"
exit 1
if [ ! -w "$MDIR_PATH" ]
echo "Error: $MDIR_PATH is not writable"
echo "Usage: $0 /path/to/user/Maildir"
exit 1
# set the internal field separator to the newline character
# instead of the default "".
# This is required for handling filenames and directories with spaces
set -f
echo "start"
# Find all emails
for i in `find $MDIR_PATH -type f | \
egrep -v "(courierimap|maildirsize|maildirfolder)"`
EDATE=`awk '/^Date: [A-Za-z]*,/ {print $4,$3,$5,$6}' "$i" | head -1`
if [ -z "$EDATE" ]
FDATE=`ls -l --time-style=long-iso "$i" | awk '{print $6,$7}'`
# Reformat the date for touch.
NDATE=`date -d "$EDATE" "+%Y%m%d%H%M"`
ODATE=`date -d "$FDATE" "+%Y%m%d%H%M"`
if [ "$NDATE" -eq "$ODATE" ]
# Skip it if the times are correct.
echo -n "_"
echo `basename $i` "from $ODATE to $NDATE"
touch -c -t "$NDATE" "$i"
echo "done"

bash script to copy all files in a directory and convert uppercase characters to lowercase Dec 14 2006

So, I recently found out that the version of PHPList that we were using on a client site (2.10.2) had a nasty bug in it where it would convert all URLs in a text version of an email message to lowercase. This bug is fixed in the latest version (2.10.3) but it left a number of subscribers complaining that the links in their email were broken.

I wrote this handy bash script to fix those links for emails that had already been sent out.

To use this script, follow these steps on your server command line. This is a bash script.

First, copy this code to your clipboard:


# This script takes the contents of a directory and will make a copy
# of every file converting any uppercase characters to lowercase
# (Useful because PHPList had a bug where it converted URLs to
# lowercase in text-only mailing list messages and the links were
# therefore broken. This script will enable those links to work.)

for file in *
if [ -f "$file" ]; then
filelower=`echo $file | tr "[:upper:]" "[:lower:]"`
if [ -f "$filelower" ]; then
echo "You are trying to copy a file that has the same name as an existing file."
echo "$filelower file was NOT copied."
echo ""
if [ -d "filelower" ]; then
echo "You are trying to copy a file that has the same name as an existing directory - $filelower"
echo "$filelower file was NOT copied."
echo ""
# not a file or directory. make a copy of the file
cp "$file" "$filelower"

Next, you are going to create a bash script file.

$ vi

Press i and then paste in the code.

Press ESC then :wq to write the file and quit vi.

Next you are going to set the executable permission on the file.

$ chmod 700

Next, change directory to the place you want to run the script on. In this case, we’ll change to the images directory.

$ cd images/

Let’s see what’s in the directory currently:

$ ls

$ Image1.jpg IMAGE2.jpg image3.jpg

Now run the script.

$ ../

The script will make a copy of any file that has an uppercase character in it and name it the same thing except all lowercase. It will tell you if the file already exists as a completely lowercase file (it won’t copy a file onto itself).

Now let’s see what it did:

$ ls

$ Image1.jpg image1.jpg IMAGE2.jpg image2.jpg image3.jpg

Now any URLs should work and any previous text-version emails that were sent out using the old version of PHPList should now have working links again.

DISCLAIMER: This script will copy files on your server. I am not responsible for any problems that this causes. I’ve tested this on my server, but you’d be wise to test what will happen first. If you add an echo in front of the cp command in the script you will see displayed what it would do without actually doing it.

Use Flash to create a custom upload button with SWFUpload beta Nov 17 2006

What is it?

  • Upload files via flash to get the flash-upload dialog goodness.
  • Only display chosen filetypes in dialog
  • Upload multiple files at once by ctrl/shift-selecting in dialog
  • Trigger javascript functions on start, cancel, progress and complete
  • Get file information/size before upload starts
  • Style upload buttons any way you want
  • Do progress-bars/information using valid XHTML and CSS
  • No page reloads, display uploaded files as they are finished
  • Works on all platforms/browsers that has Flash support.
  • Degrades gracefully to a normal html upload form if Flash or javascript isn’t available

Sounds pretty neat. MIT Open Source licensed too.

SWFUpload beta

(Via del.icio.uspopular on

WordPress 2.0.5 – Ronan – new release that also includes important security fixes Oct 28 2006

And to think, I was just browsing the WordPress Trac repository earlier today looking at their sweet upgrade scripts in /wp-admin/.

Time to upgrade our sites. There are a lot of them. We love WordPress.

It’s new release time. The latest in our venerable 2.0 series, which now counts over 1.2 million downloads, is available for download immediately, and we suggest everyone upgrade as this includes security fixes. We’re breaking the tradition of naming releases after jazz musicians to congratulate Ryan Boren on his new son (and first WP baby) Ronan.

What’s new? We have about 50 or so bugfixes, which you can review on our dev tracker here, mostly minor bug fixes around feeds, custom fields, and internationalization. If you’d like a nitty-gritty view, check out Mark’s blog post on the changes.

Development Blog – WordPress 2.0.5 – Ronan

Download the latest version of WordPress now (2.0.5)

WordPress MU 1.0 is released! Oct 28 2006

I’ll be upgrading and Share the Practice with this new release… We should also do Niner Blogs as well, come to think of it.

WordPress MU is an official branch of WordPress that is designed for managing and hosting thousands of blogs instead of just one. It’s the software that powers, for example. MU has been in heavy development for about a year now, and we’ve finally polished it up to a place where we feel like it’s ready for public consumption. Since setup is a bit more complex than the 5-minute install of regular WordPress, MU is best suited for a more server-savvy audience. You can download it on the WordPress MU site.

Development Blog – MU 1.0 and bbPress

lastRSS.php – PHP RSS parser/reader Oct 19 2006

lastRSS.php – PHP RSS parser/reader

lastRSS.php is simple yet powerfull PHP class to parse RSS. Tesseract OCR Sep 21 2006 Tesseract OCR

A commercial quality OCR engine originally developed at HP between 1985 and 1995. In 1995, this engine was among the top 3 evaluated by UNLV. It was open-sourced by HP and UNLV in 2005.

Upgraded the firmware on my Linksys WRT54G to Thibor’s HyperWRT firmware Sep 13 2006

I’d been wanting to do this for a while. The biggest feature for me was the “static” DHCP setup, where you can keep DHCP for most machines on your network but assign a couple of machines to static IPs that never change. This comes in handy when you’re running servers that need to always have a specific port forwarding to them.

The installation was really easy – just download the latest firmware, unzip it and upload it using the Linksys web gui.

One note: Use Firefox, not Safari when navigating the new/upgraded pages. It kept all the pre-existing data / preferences.

HyperWRT is a GPL firmware project for the Linksys WRT54G/WRT54GL/WRT54GS and WRTSL54GS wireless routers based on the
latest stock Linksys firmware. The original goal of the HyperWRT project was to add a set of features–such as power boost–to the Linux-based Linksys firmware, extending its possibilities but staying close to the official firmware. Over time, it has continued to be updated with newer Linksys firmware, and
incorporated many more features typically found in enterprise routing equipment.

Thibor’s HyperWRT page

Prototype Carousel – Javascript scrolling window Sep 5 2006

This class is a Prototype/ version of the excellent Bill Scott’s Carousel component.
I needed it to be able to use it in Ruby On Rails application without using the 200KB of YUI JS classes.

This library is licensed under a MIT-style license, so you can use it for anything you like, as long as you include the copyright notice.

The current version (0.1) is the first release with only few parameters. I am working on it to have a lot of more features.
This version has

* Ajax or static content
* Horizontal orientation
* Rails helper

It’s has been tested on IE 6, Firefox (PC,Mac), Opera 9, Safari and Camino.

Check it out: Prototype Carousel

sell diamonds