Friendster re-written in PHP

Friendster is still alive and kicking, and according to Salon, it’s adding 200,000 users every week. In the past, I’ve commented about their business model and I still don’t see any resolution of those problems (lest we forget, taking VC money is not a business model!). But, I’m not here to write about the business model of Friendster today.

I check in, periodically, to Friendster to see if anyone new has joined, or added a new picture, or come up with a new catchy slogan for themselves. When I joined, it was daily, now it’s monthly. One of the things that detracted from the experience was the speed of the site. It was sloooow. Well, they’ve dealt with that–it’s now a peppy site (at least on Saturday morning). And it appears that one of the ways they did this was to switch from JSP to PHP. Wow. (Some folks noticed a while ago.) I wasn’t able to find any references comparing the relative speed of PHP and JSP, but I certainly appreciate Friendster’s new responsiveness.


Book review: The Great Divide

The Great Divide, by Stephen Pern, explores one man’s trip from Mexico to Canada along the Continental Divide. Now, this book explores the backbone of the USA, but the author is definitely (perhaps defiantly) English–and in many ways, from his frequent stops for tea to his sardonic wit to his idioms (biro, peg), it adds to the charm of the book. From New Mexico to Montana, Pern relates the obstacles, emotional, physical and personal, which confront him during his journey. Typically tongue-in-cheek in his prose, he also strikes true notes, especially when commenting on life in America. He lays out a succinct contrast between the New World and the Old: when confronting the lack of historic artifacts on his jounry, he muses “Life [in America] was first established, then lived. Back home [in Europe], it was the other way around.”

The logistics of supplying his 2500 mile journey were worth the read alone–his description of peanut butter rationing chimes with anyone who has backpacked with luxury foods. He also includes an appendix with much information, including suggested maps, useful equipment and obstacles encountered. should you wish to follow in his footsteps. In 1986, when he wrote the book, there was no Continental Divide Trail, although it looks like Congess designated a (still incomplete) route in 1978. Pern is also very clear when he diverges from the Divide, providing maps with small comments and textual explanations of his detours. Many of these are for good reasons–bad terrain, a hot shower, a resupply mission.

But the most interesting sections of this book was not the physical exertion nor the beauty that he described (though a picture section would have been a fantastic addition). No, in the tradition of Least Heat Moon’s ‘Blue Highways’ and Bryson’s ‘In A Sunburned Country,’ it is his interactions that really lend depth and meaning to his book. Whether it’s the innumerable breakfasts fixed for him, a surly shopkeeper in Montana, or a Navajo shepherd who can’t speak English and doesn’t understand the lifestyle of her grandchildren, Pern takes each encounter and uses it to reflect a bit of the American psyche.

All in all, this book was inspiring and well worth a read.


Trust, but verify

As I’ve mentioned previously the web lets smaller players get into the publishing arena, and we all know there are some amazing websites chock full of interesting and useful information. If you’re tired of hearing the hyperbolic claims of either presidential candidate, and want to see them debunked, check out factcheck.org. Non-partisan and detailed examinations of ads can only help voters make an informed choice. Now, if only they had an RSS feed!


java memory management, oh my!

How much do you understand basic java? Every day I find some part of this language that I’m not aware of, or don’t understand. Some days it’s cool APIS (like JAI) but today it’s concurrency. Now, language managed memory is a feature that’s been present in the languages in which I’ve been programming since I started. I’ve looked at C and C++, but taking a job coding in those seems to me it’d be like a job with a long commute–both have obstacles keeping you from getting real work done. (I’m not alone in feeling this way.) But this thread of comments on Cameron Purdy’s blog drove home my ignorance. However, the commenters do point out several interesting articles (in particular, this article about double checked locking was useful and made my head hurt at the same time) to alleviate that. I took a class with Tom Cargill a few years back, which included his threading module, that helped a bit.

However, all these complexities are why servlets (and EJBs) are so powerful. As long as you’re careful to only use local variables, why, you shouldn’t have to worry about threading at all. That’s what you use the container for, right? And we all know that containers are bug free, right? And you’d never have to go back and find some isolated thread related defect that affected your code a maddeningly miniscule amount of time, right?


Symlinks and shortcuts and Apache

So, I’m helping install Apache on a friend’s computer. He’s running Windows XP SP1, and Apache has a very nice page describing how to install on Windows. A few issues did arise, however.

1. I encountered the following error message on the initial startup of the web server:

[Tue Jun 15 23:09:11 2004] [error] (OS 10038)An operation was attempted on something that is not a socket. : Child 4672: Encountered too many errors accepting client connections. Possible causes: dynamic address renewal, or incompatible VPN or firewall software. Try using the Win32DisableAcceptEx directive.

I read a few posts online that suggested I could just follow the instructions–I did and just added the Win32DisableAcceptEx directive to the bottom of the httpd.conf file. A restart, and now localhost shows up in a web browser.

2. Configuration issues: My friend also has a firewall on his computer (good idea). I had to configure the firewall to allow Apache to receive packets, and respond to them. Also, I had to configure the gateway (my friend shares a few computers behind one fast internet connection) to forward the port that external clients can request information from to the computer on which Apache was running. Voila, now I can view the default index.html page using his IP address.

3. However, the biggest hurdle is yet to come. My friend wants to server some files off one of his hard drives (a different one than Apache is installed upon). No problem on unix, just create a symlink. On windows, I can use a shortcut, right? Just like a symlink, they “…can point to a file on your computer or a file on a network server.”

Well, not quite. Shortcuts have a .lnk extension, and Apache doesn’t know how to deal with that, other than to serve it up as a file. I did a fair bit of searching, but the only thing I found on dealing with this issue was this link which basically says you should just reconfigure Apache to have its DocRoot be the directory which contains whatever files you’d like to serve up. Ugh.

However, the best solution is to create an Alias (which has helped me in the past) to the directories you’re interested in serving up. And now my friend has Apache, installed properly as a service, to play around with as well.


PL/SQL

I recently wrote a basic data transformation program using Java and PL/SQL. I hadn’t used PL/SQL (which is an Oracle-specific procedural language for stored procedures) since writing a basic data layer for my first professional project (a Yahoo! like application written in PL/SQL, perl and Story Server–don’t ask). Anyway, revisiting PL/SQL reminded me of some of the things I liked and disliked about that language.

I like:

Invalidation of dependencies. In PL/SQL, if package A (packages are simply arbitrary, hopefully logical, groups of procedures and functions) calls package B, A depends on B. If the signatures of B are recompiled (you can separate the signatures from the implementations) package A simply won’t run until you recompile it. This is something I really wish other languages would pick up, because it at least lets you know when something you depend on has changed out from under you.

I dislike:

The BEGIN and END blocks, which indicate boundaries for loops and if statements, are semantically no different than the { and } which I’ve grown to love in perl and Java. But for some reason, it takes me back to my pascal days and leaves a bit of a bad taste in my mouth.

I’m unsure of:

The idea of putting business logic in a database. Of course, schemas are intimately tied to the business layer (ask anyone trying to move to a different one) and anyone who pretends that switching databases in a java applications is a simple matter of changing a configuration file is smoking crack, but the putting chunks of business logic in the data layer introduces a few problems. Every different language that you use increases the complexity of a project–and to debug problems with the interface between them, you need to have someone who knows both. Also, stored procedures don’t fit very well into any of the object relational mapping tools and pretty much force you to use jdbc.



© Moore Consulting, 2003-2017 +