22 March 2007

Rerouting old style PHP query string urls to a Rails app

I've re-written an old php application in Ruby on Rails. In anticipation of flipping the switch from the old site to the new one, it would be nice to re-route requests for the old php pages to their new home.

The old page url would look something like this:


with the new equivalent being this:


I wasn't sure if the best place to handle the rerouting would be the rails routes.rb file, or using mod_rewrite in the .htaccess file.

I didn't find a way to do it using routes.rb, so here's the solution I came up with to make it work using .htaccess:

RewriteCond %{QUERY_STRING} ^pageid=(.*)$
RewriteRule ^page\.php /page/%1? [R=301,L]

I added the two lines after the original "RewriteRule ^$ index.html [QSA]" line.

I found all kinds of information about doing the opposite - i.e. rewriting /page/pageid/mypage to redirect to page.php?pageid=mypage. I had to sift through all that to find what I needed.

13 March 2007

Sony Ericcson w300i on Mac OS X

I've been using a Sony Ericsson w300i Walkman phone since Cingular first offered it. I chose the phone not really for the Walkman capabilities, but because I was looking for a phone that I could use to replace most of the functions that my old Palm/Handspring Visor was used for.

Mostly, my Visor was used for the address book, memo pad notes, and calendar. It was getting old, and since I converted from Windows to Mac and bought a Powerbook I ran into the problem of not having compatible Sync software that would recognize the Visor and work with OS X. Ideally, I could replace the Visor with a phone and only carry one device. But, I also didn't want to spend all the money on a smartphone or Treo.

Lots of phones have decent address books. But I also wanted a decent calendar, and really important was the ability to copy text notes between my Mac and the phone. Adequate memory was also a concern, so the ideal phone would have expandable memory.

I wasn't sure the w300i would meet the text note requirement, but I gambled on it and bought it. After purchasing a third party phone plugin for iSync, it worked flawlessly. I bought a 512MB memory card for it, and it really is a great phone. The organizer tools are excellent - the address book and calendar are perfect for what I need. And using bluetooth or the data cable, I can transfer files between the phone and Mac as needed. It has a built-in web browser that is used to open text files.

It also has the other neat features like the Walkman, and even an FM radio, but I have to admit I haven't really used those. The built-in camera isn't great, and the video captures are pretty low quality. But, that's okay - it does what I need. It's a good looking phone, too.

Now, if only Cingular didn't disable other cool features, I'd be totally happy. Greed gets the best of these big companies and they just have to try to squeeze every last penny out of you at the expense of customer satisfaction. But, I'll save that for another post...

07 March 2007

vpnc vs. Cisco's vpnclient on Fedora

After breaking Cisco's vpnclient AGAIN by upgrading to Fedora Core 6, and starting to go through the headache of trying to get it to compile, I poked around a bit to look for alternatives. Voila! I found vpnc, installed it, and had it up and running in no time.

Of course I'm just using the default configuration for now until I have time to try out some advanced configuration and scripting, and maybe the GUI.

Anyhow, good riddance to the terrible Cisco client for Linux.