Archive for the 'PHP' Category

Spotted cat

I upgraded to Leopard this past Saturday. Generally a good thing — I love Quick Look and use it far more than I ever thought I would, and I’m a big fan of Spaces as well (Linux window managers have had the same functionality for years, and I’ve missed it terribly — but no longer!). And if my WD Passport external hard drive weren’t acting up, I’d probably be in love with Time Machine, too.

The main downside for me right now is that Blender is now really sluggish, and it blurs the screen at times. I’m not sure what’s up with that — other people seem to be reporting that it runs on fine on Leopard.

Yesterday I pulled open my development site (hosted locally) to work on Blank Slate, but got a forbidden error message. It was rather worrisome (and my Internet connection was acting up at the time), but then I found Working with PHP 5 in Mac OS X 10.5 (Leopard) and it solved that problem. Phew. :)

In other news, I finally bought a TextMate license yesterday. Now I just need to immerse myself in the keystroke documentation until I’m as fast as I was in Vim…

Ruby to PHP

I’ve been porting the BYUFHLC to PHP, and it’s coming along pretty well in spite of a number of mini-setbacks. The only tricky part was figuring out how to parse the HTML from the screenscrape. At first I was going to use Troy Wolf’s class_http, but it didn’t seem to have any functions for actually doing anything with the HTML once it was fetched. Then I discovered the new DOM stuff in PHP 5.

Excitedly coding up a few lines to test it, I ran into function-not-found errors. Ten minutes later, I realized that Bluehost’s servers were running PHP 4. (Side note: I’d tried to get PHP running locally on my Mac, but it wasn’t serving the PHP; instead it would just display them as plain text.) I called them up and they said it’d take a 24-hour downtime to migrate my domains over to the PHP 5 server. That was unacceptable.

So, I went hunting around in /etc/httpd/httpd.conf again, and I found a line reading “<IfModule mod_php4.c>”. Changed the ‘4′ to a ‘5′ and it all started working perfectly.

After that, it only took twenty or thirty minutes to convert my Ruby code to PHP, and I’ve got the first set of results working perfectly. But now my stomach is grumbling because I haven’t eaten in a long time, so finishing this up is going to have to wait till tomorrow. I’m glad it’s going to be a fairly easy port. (From here on out it’s smooth sailing, since I’ve worked out all the DOM issues.) Expect another status report tomorrow.

And no, I’m not converting to PHP. :) I love Ruby and will continue to use it whenever possible.

BYUFHLC

Last week on Top of the Mountains I mentioned my FHLC/UVRFHC mashup (which I’m now calling BYUFHLC). It’s written in Ruby on Rails and is 75% done (I just have to add support for the non-place searches, like surname and such). Here at the Center for Family History and Genealogy, my employer has gotten interested in it, especially with the possibility of packaging it up to deploy at other family history centers.

Which leads to the question: is Ruby on Rails good for that? I mean, I know it’s superior to something like PHP or Perl, and I much prefer it, but what are the chances that those family history centers are going to be able to support a Rails app? It seems like PHP would be a better choice, since it’s guaranteed to be installed and supported. I don’t really want to recode it in PHP, though. :)