SWFupload with Flash 10 Fix 3

Posted by Ben Reubenstein Tue, 25 Nov 2008 20:58:00 GMT

It took me a while to reproduce errors that users were reporting with the SWFUpload plugin, but I finally traced it to users using Flash 10. Flash 10 changes how javascript and flash are allowed to interact thus breaking the html upload button that calls javascript to present the file choosing dialog box. If you run SWFUpload in debug mode you will get Error #2176. To fix:

  1. Download SWFUpload v2.2.0 Beta 3 Core.zip
  2. (optional) Backup your swfupload.js and your swfupload.swf file
  3. Unzip and overwrite your existing swfupload.js and your swfupload.swf file. You might need to rename the swf to match your swf name. If you try the uploader at this point you will receive a javascript error: SWFUpload Could not find the placeholder element.
  4. Create a button image that will be used instead of the upload html input.
  5. Adjust your JavaScript to include the following attributes:

    button_placeholder_id : "spanSWFUploadButton",
    button_image_url : "http://www.yourdomain.com/yourbutton.png",
    button_width : 61,
    button_height : 22
  6. Add a span tag with the element ID you specified above.

Update: In order for your image to work properly, it must have 4 states. Refer to this post.

If things are still not working for you, be sure to turn debug: true and review the javascript error log. Hope this helps others.

Netgear WNR834B to WNR834B Internet Connection Briding

Posted by Ben Reubenstein Sun, 28 Sep 2008 21:42:00 GMT

A friend of mine had horrible reception at the far end of his house for his wireless network. He purchased matching WNR834B Netgear routers and needed to bridge them. Let me start by saying, the below setup CAN BE DONE, but it is not straight forward, well documented, or easy to do. This is the setup I finally got working

Internet Modem -wired- WNR834B (master router) -wireless- WNR834B (wireless repeater)

Here are some tips to get it going:

  • Setup the first router and make sure everything is working properly
  • When setting up the wireless repeater, wire your computer to it and statically set your IP address, do not try to set it up wirelessly
  • Turn off the DHCP server of the wireless repeater
  • Meet all the requirements in section 4-12 of this document

Backing up Subversion Repositories using hot-backup.py 8

Posted by Ben Reubenstein Tue, 24 Apr 2007 13:12:00 GMT

Subversion is an excellent tool for versioning your code and projects. Backing up this data is crucial in case of a catastrophic failure. Subversion has several ways to create backups, this tutorial will focus on using hot-backup.py to accomplish the task. For more information on the various methods for backing up subversion consult the documentation.

This tutorial assumes you have an existing repository and focuses on a *nix environment interacting with the shell as root.

1. Get the latest version of the script.

# wget http://svn.collab.net/repos/svn/trunk/tools/backup/hot-backup.py.in

2. On my system (gentoo) I moved the script into /usr/sbin so that the file is in my path.

# mv ~/hot-backup.py.in /usr/sbin/hot-backup.py

3. Open the file in your favorite text editor adjusting the paths to svnadmin and svnlook. Be sure to give the full path or the script will fail even if those executables are in your path (at least it did for me).

# vi /usr/sbin/hot-backup.py
# Path to svnlook utility
svnlook = "/your/path/to/svnlook"

# Path to svnadmin utility
svnadmin = "/your/path/to/svnadmin"

4. In order to automate the task, we'll create a simple cron script to call the hot-backup.py for each one of our repositories. In order to save disk space, we'll pass the script an option to compress the files. Valid archive types include gz, bz2, and zip. Be sure that the directory you are backing up to exists, or the script will fail.

# vi /etc/cron.daily/backup_subversion
# backup_subversion v.1
hot-backup.py --archive-type=gz /my/repository1 /my/backup/location1
# if you have more than 1 repository, simply
# add a new line for each one
# hot-backup.py --archive-type=gz /my/repository2 /my/backup/location2
# chmod +x /etc/cron.daily/backup_subversion

5. Test the script.

# /etc/cron.daily/backup_subversion
Beginning hot backup of '/my/repository1'.
Youngest revision is XX
Backing up repository to '/my/backup/location1/repository1-XX'...
Archiving backup to '/my/backup/location1/repository1-XX.tar.gz'...
Archive created, removing backup '/my/backup/location1/repository1-XX'...

That's it. Feel free to post questions or corrections in the comments.

New Tutorial: Using Crontab 2

Posted by Ben Reubenstein Sat, 06 May 2006 11:36:00 GMT

For a while now I have been doing a lot of regular tasks manually on my OS X box. On my linux boxes I have been using good old Cron for these tasks. Today I started using crontab, since it is installed by default on Mac OS X. There are several tutorials and sites that have information on crontab, but they were not as direct as I would have liked so I put together this tutorial, Using Crontab with Mac OS X, Unix, and Linux. Enjoy!

Google Maps Snippet 3

Posted by Ben Reubenstein Wed, 15 Feb 2006 11:52:00 GMT

Lately I have been working with the Google Maps API. I put together an example of adding and removing a marker from a Google map.

Read about it here

Lighttpd and AWStats 1

Posted by Ben Reubenstein Mon, 23 Jan 2006 14:38:00 GMT

Want to use AWStats but don't run Apache? Here is a tutorial I wrote on getting AWStats and Lighttpd to work together. If you don't know what I am talking about, AWStats is a log analyzing package. It is a very useful tool to get some good metrics on website traffic. When I moved to Rails I also moved to Lighttpd as a webserver. Luckily AWStats came along for the ride.

Tutorial: Lighttpd + AWStats