lime icon

Phosphorus and Lime

A Developer's Broadsheet

This blog has been deprecated. Please visit my new blog at klenwell.com/press.
More Google News: PHP API
Been waiting for this -- announced earlier today: Google Data API for PHP released. Available here:

http://framework.zend.com/download/gdata

Can they be used independently of the Zend Framework? Not sure.
The Google Wiki
A few weeks ago I was looking at the web 2.0 wikis and trying to decide which was the easiest to use. I ended up going with pbwiki.com. Today, apparently, Google made its choice. I remember looking at jotspot and preferring pbwiki for some reason.

Curious to see what becomes of this. I've been very impressed with the new Gmail Suite, which includes Analytics, Spreadsheets & Docs (which I've found very useful), and the webmaster tools among other things. The Groups makeover looks intriguing, too. It will be interesting to see how this gets incorporated.
PHP: Optimization
I've been asking questions about PHP optimization for a while now. Finally found an answer today:

Getting Rich with PHP 5 (a slideshow)

The bad news is it looks like I have a lot of work to do.
mod_rewrite successful!

more info on Apache's mod_rewrite engine on Google
PHP: html-kit codefinder plugin
Because I'm usually on an XP (I'd love to use Linux, but it's just hard to switch!), I use html-kit to do my coding. And one must-have plug-in for PHP coding is the codefinder plug-in:

http://www.html-kit.com/html-kit/download/plugin/cmcodefinder/

all php-related plug-ins
The Rise and Fall of Friendster
From today's New York Times:

The venture capitalists considered shutting down the company. But a sense of obligation (“It was my feeling that the investors and the board had done something of a disservice to Friendster,” Mr. Siegelman said) and economics (Friendster still had a well-known brand and millions of registered users, even if most had not visited the site in some time) prompted Kleiner Perkins, Benchmark and some of the private investors to sink an additional $3 million into the company at the start of 2006.

-- Wallflower at the Web Party


It's funny because I was on Friendster just yesterday for the first time in weeks. (It was in response to some spam message someone had sent me. Still spamming on Friendster? Talk about out of touch...) One thing I noticed was that they no longer tell you how long since that last time someone checked in. I took that as a bad sign.

The article did set straight one misconception: I've read more than once that Friendster failed because it didn't innovate enough but instead focused on fixing technical problems. The article makes clear that slow page loads was a major reason for its downfall. That and it's cliquey network structure -- but I've addressed that elsewhere.
hosting : My Selections
I signed up with the two web hosting companies I selected this week. I contacted all 6 companies on my short list. Based on their responses, they neatly divided into three categories and my decision was relatively easy:

My Picks
Myriad Network home webhostingtalk google
I was very impressed with the responses I received from Jeff Peterson at Myriad Network. He replied quickly and knowledgeably. He was quite frank in spelling out for me what his company could do and couldn't do for me. No sales pitches. No evasions or vagaries. And as I've already noted, he helped me solve a nagging issue with PHP.

We exchanged over a dozen emails back and forth. The following is representative of one of Jeff's responses:

Any time someone is found to be using an excessive amount of resources, we try to deal with the situation in a way that interferes with the customer's account as little as humanly possible. For example, the last time this happened, the server reported a higher load than usual, and investigation showed about 5 PHP scripts running under their account that were each using about 20% CPU a piece. 5 scripts x 20% CPU = 100% of one CPU. The issue is that the scripts didn't just run and exit quickly after, but they cotinued to run for minutes at a time, taking a large part of the total available CPU resources on the server. Our action was to stop the scripts from executing, then immediately notify the customer (or the reseller, if this was one of their customers).


Because, as Jeff made clear, MN does not provide the kind of fully managed hosting on the VPS plans that I was looking for, they are not necessarily my ideal provider. But shared hosting will satisfy this project for a while, so I signed up with them and hope to stay with them as long as possible.

Package: smart source with dedicated IP
Total Cost for First 3-months (w/ set-up): $45.61
Project Quarterly Cost: $42.61/qtr

West Host home webhostingtalk google
Matt Platis with West Host promptly replied to my query and we exchanged at least 8 emails back and forth. I get the impression that West Host give a great deal of attention to their sales and customer support (which I distinguish from technical support.) That said, Matt quickly and informatively answered my questions. The following is characteristic:

You are automatically warned multiple times if you start getting close to your limit at the end of the month for data transfer AND disk space. When you hit your limit for either one, you are warned again. At this point, I would recommend upgrading your account (if not sooner). Once you hit approximately 110% (I believe it's a little higher than this), your site will slow down and eventually be disabled. We do not upgrade (and bill) automatically, but with all the warnings and notifications, you should have no problem upgrading your limits if/when you reach them.


West Host offers more a more complete bridge between shared hosting and higher end managed hosting, so they are a better fit in that respect. There were a couple minor nuisances in setting up my account. (They also do that thing where they post discount prices that require somewhat unrealistic commitments, e.g. 24 months.) But I opened a test support ticket (of sorts, it was actually a legitimate question I had about changing php.ini settings for my account) as soon as I signed up and received a useful, detailed response within an hour.

Package: business starter with dedicated IP
Total Cost for First 3-months (w/ set-up): $39.80
Project Quarterly Cost: $29.95/qtr


Honorable Mentions
Future Hosting home google
Vik responded to the second query email I sent to Future Hosting. He was detailed and candid in his reponses, acknowledging for instance a recent brief server outage. I decided against FH on this occasion because there seemed to be a bit of a gap between their shared hosting and VPS plans. But I will look at them again when I am in the market for VPS or dedicated hosting.

Liquid Web home google
Travis at Liquid Web initiated contact with me by private message on the Web Hosting Talk site and invited me to contact him personally. In response to my query email, he asked me not to share details of his reponse publically, though I found his reponses fairly vague -- much less detailed, in any event, than the others responses I received. He didn't respond to my follow-up letter.


No Response
Host Gator home google
In response to my email, I received an automatic ticketing system reply. I then got an email inviting me to call them at their toll-free number. If I had not received more detailed responses from the other companies, I probably would have called.

A Small Orange home google
I contacted ASO twice. I received an automatic ticketing system reply, but no further reply after that. When I tried to look up my ticket, I got a PHP error. I have a shared hosting account with ASO and know that they have a devoted community and offer an informative forum and wiki.


Summary
I wouldn't rule out any of these companies on the basis of my experience here. They all made my short list on the basis of the favorable reviews and reports on them I read online.

I should also note that I am not a network or systems admin, so I have little basis for evaluating the technical merits of these companies. However, I do have experience with customer service. When I say that, I mean to discriminate between what I consider polished but ineffective customer service (a la companies like HP that outsource support and often make you jump through a ring or two of utter unhelpfulness) and genuine interest and concern for one's customers. I think I am also reasonably sensitive to both the importance and the limitations of first impressions. With that background as a reference, I have to say that I was very favorably impressed with myriadnetwork.com, westhost.com, and futurehosting.biz.

I plan, to the best of my ability, to follow up with quarterly reports on my hosting picks. I also hope to put up a page somewhere listing all the companies with which I've done business. So please accept this summary with those qualifiers and stay tuned.


Links
Blog Posts
Letter to Companies on Web Hosting Short List
Hosting : Server Requirements
Hosting : Short List
Wanted: Reliable Web Hosting

Web Hosting Talk Threads
Web Hosting: My Selections
Choosing a Host -- My Short List
Web Hosting Strategy
PHP: Get Memory Usage
In the final stages of setting up hosting service. Going with a shared host to start and really trying to get a grasp of how efficiently my scripts run, how well they scale up, and how many users they can accommodate before we'll need to step up to VPS or dedicated hosting.

I adapted the following script from the PHP site. It needs to be directly included so I've compressed the formatting as much as possible:

function inmem() {
if ( substr(PHP_OS,0,3) == 'WIN') {
exec( 'tasklist /FI "PID eq ' . getmypid() . '" /FO LIST', $output );
$mb_usage = round(preg_replace( '/[\D]/', '', $output[5] ) / 1024, 3); }
else {
$pid = getmypid();
exec("ps -eo%mem,rss,pid | grep $pid", $output);
$output = explode(" ", $output[0]);
$mb_usage = round(($output[1] / 1024), 3); }
echo "<h4>current script MB usage : $mb_usage</h4>"; } // end Fx

inmem();


Running it on my current script on my local laptop server, I find it jumps from 28 MB at the beginning of my script, before my codebase has loaded, 34 MB by the end -- which as far as I can tell at this point is not too bad.

keywords: php, server, resources, usage, optimization
PHP: SESSION array bug clarified
First posted on this here. I hastily posted some code there that summarizes the problem but doesn't actually reproduce it. The following code in fact reproduces it:

<?php

session_start();

if ( empty($_SESSION['is_reloaded']) )
{
$_SESSION['is_reloaded'] = 1;
$_SESSION['ARRAY'] = array( 1, 2, 3, 4);
session_write_close();
header("Location: {$_SERVER['PHP_SELF']}");
}

$ARRAY = array( 'new', 'values' );

if ( $_SESSION['ARRAY'][0] != 1 ) echo "you've been victimized by the PHP4 array namespace bug";
else { echo "bug not detected"; }

?>


An online demo can be seen here:

http://westerndep.com/code/phparraybugtest.php

This is a really critical issue for me in choosing a host for some of my projects.

NOTE: just found this on the PHP bug site:

http://bugs.php.net/bug.php?id=36366

The developer's response:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Turn off register_globals if you don't want this behaviour.


I have followed the instructions on php.net and turned off register globals using an .htaccess file (the site notes that you can't use ini_set to turn off in runtime). I also tried this method. Nevertheless, I am still getting the error.

Correction: the .htaccess file appears to have fixed the problem. I had to restart my browser, however, before I could detect the change.

This site was quite helpful for me in solving this problem:

http://www.nyphp.org/phundamentals/ini.php

I'd also like to thank Jeff Petersen at Myriad Network for his assistance in sorting this out.
CSS: the holy grail of IE css selective selector bugs
UPDATE

For the best part of last year proeminent webdev figures have adviced people to stop using the * html hack. The better alternative is to make use of the conditional comments supported by all versions of Explorer and conditionally include an extra .css file (or several) on top of the others, that only IE will see.


slashdot comment. but I really hate those IE conditional comment things... Oh well, my bad...


Original Post
Just discovered this, though I'm sure it's been around for ages:

* html #test-span
{
color:green;
}


That is, if you want to specify a rule that applies only to IE browsers, use this. And if you want to apply a rule that will not apply to IE browsers, use this:

html>body #test-span
{
color:green;
}


Not sure if this validates or no.

Details here:

http://centricle.com/ref/css/filters/tests/star_html/

keywords: internet, explorer, IE, hack, hacks
Public Data Sets
There are a few public data sets that are immensely useful for developers, collected by the government, and should be much easier to locate than they are. Here are as close as I have been able to find to definitive lists:

US Zip Codes
census.gov (viz., ZCTA listing)

US Area Codes
nanpa.com (viz., all states utilized codes listing)

US College and University Codes
fau.edu

It would be nice if the government kept master data files on this information that they made free and open for download -- if not a public database with open API!

Perhaps organizing this into a public database could be the next phase of the databug project.

keyword: public, datasets, data, zipcode, area code, FICE, Title IV
Letter to Companies on Web Hosting Short List
I have prepared the letter below for companies on my web hosting short list. Here, once more, are the companies:

asmallorange.com
futurehosting.biz
hostgator.com
liquidweb.com
myriadnetwork.com
westhost.com

Here is the letter: