lime icon

Phosphorus and Lime

A Developer's Broadsheet

This blog has been deprecated. Please visit my new blog at
css Moshi Garden
In between hunting down a quality web host and squashing php bugs, I planted a garden of sorts:

details here:
tools : Firefox Screen Grabber
Just learned about this on digg! (Well, a dugg site.) Finally, a screen grabber that takes a snapshot of a complete webpage (not just the viewport). Just one more reason to use Firefox:

Screen Grab! Extenstion
hosting : Server Requirements
Here is a list of the requirements for the hosting I am looking for for our project. This is still evolving and is predicated on many factor that can't be easily predicted at this point. But I've tried to error on the side of caution (requesting more resources than necessary at this point).

Immediate Requirements
Budget: $20-$50/mo to begin
Managed hosting on Linux server
Monthly Bandwidth: 300-400 visitors/day on PHP/MySQL CMS to start
No or High Email Limits -- need to send several (hundreds?) script-triggered emails per hour
Data Storage: 5 GB to start
MySql 4+
CPanel (or other Control Panel)
Minimal Downtime
Seamless Scalability (see below)

Near Term
https certificate
seamless upgrade of bandwidth
seamless upgrade of storage
eventually, a managed dedicated server

Comments welcome.
hosting : Short List
Here is my current short list of potential hosts (listed alphabetically) for my next web project:

This is based largely on threads in the webhostingtalk forums and other online research I've been doing.

I'm going to post this list on the webhostingtalk site with a request for comments. Feel free to add any comments below.

Update: I've started a new thread on this topic on Click here to view it.
Wanted: Reliable Web Hosting
I have a couple projects about ready to launch. I've been running the alpha versions on development servers but I want to roll out the beta versions on the actual servers that will be hosting them.

Finding a web host reminds me of finding a cell phone provider -- except 1000x worse. I've been trolling the forums on for the last few months. So many choices. So many baseless accusations. So many vague endorsements. And so many other sites out there fluffing recommendations to the top bidder.

I posted my first thread on outlining my goals this weekend. The responses, while not unencouraging, are typical of the kind of generic responses typical of the forums. I suspect a certain number of responses are from people just wishing to boost their per-post account status and get eyeball on the service they're promoting in their signature. This is not to say the forums haven't been helpful -- they're the best thing I've found out. But not the kinda clean organized breakdown that I've been looking for. What I really want is something like: (or, even better)

I'm in the process of narrowing down my options to a short list of 5-6 companies and drafting an email to them based on this questionnaire at introducing myself and what I'm looking for. I plan to document my efforts here and on the site in the coming days.

I hope in the end to find a reliable host or hosts for my project whom I can freely recommend to others.
CSS: moshi Style Sheet v0.9 released
Available at moshi google code site.

Details on moshi blog.
PHP: PHP 4 Array Namespace Bug
note: the code examples below do not reproduce the problem. For code that does reproduce it, see this post

This drives me crazy. Until it was fixed in PHP 5 (or a late version of PHP 4), PHP had a problematic namespace conflict involving associative arrays that shared their key names with other variables or arrays.

Consider this code:

$_SESSION['ARRAY'] = array( 1, 2, 3, 4);
$ARRAY = array( 'new', 'values' );

if ( !$_SESSION['ARRAY'] ) echo "you've been victimized by the PHP4 array namespace bug";

That summarizes it. I don't know if that will actually cause the error, or if it requires some other factor. But it's a variation on this theme and I'm always running into this problem because I like to do neat-freakish things like use consistent key names for related arrays. For instance, the code I was working on today:

$_DATA[$kid] = array();
$_SESSION[$kid] = $_DATA[$kid];
$_HTML[$kid] = 'html goes here';

What's even more maddening for me is that the problem doesn't occur in PHP 5, which I have on my local development server. So I won't run into the problem until I load it up to one of my remote host servers still running PHP 4.

I did come up a solution for a project today that was rather far along in development and I didn't have time to more fully refactor. It uses the serialize function.

The problem was that some session variables that I was depending on to be present after a form got submitted were being overwritten. So I serialized the session array, stuffed it in a hidden form tag and unserialized it on the next page.

page 1
// Prior to redirect to problematic page
$_serial_session_data = htmlentities(serialize($_SESSION['DATA']), ENT_QUOTES);
$_MHTML['workaround_tag'] = '<input type="hidden" name="serial_session_data" value="' . $_serial_session_data . '" />';

page 2
$_decode_data = html_entity_decode($_POST['serial_session_data'], ENT_QUOTES);
$_SESSION['DATA'] = unserialize($_decode_data);

This worked for me. Probably not the most secure technique, but this wasn't especially sensitive data. I'm hoping it's a somewhat unique situation that won't have to be repeated ad infinitum. A better solution -- only sign up with hosts using PHP 5!

keywords: PHP, array, namespace, conflict, solution, session, clash
CSS: .apple2e
Apple ][e, my latest swatch, honors my first computer. It is intended for textareas:

height:240px; width:400px;
margin:5px; padding:5px;
font-family:"Lucida Console", Monaco, monospace;
border:8px solid #d6d0b6;

Design: D.C. Mayoral Campaign Websites
Reading in the NY Times just now about the Washington D.C. Democratic Party mayoral primary and ended up surfing over to the two leading candidates websites:

Impressed by both. Actually preferred Linda Cropp's, though Adrian Fenty won the primary 57% to 31%.

Incidentally, I''m currently reading Malcolm Gladwell's Blink and it looks like "youth and vigor" (with a dash of masculinity) and the image thereof played a major part in this campaign. Although not necessarily an error in this case (I probably would have voted for Fenty, too), you could probably cite this as a textbook example of the "Warren G. Harding Error". Or, perhaps more aptly now, the "George W. Bush Error".
CSS Swatches Icon
Just finished my icon for

CSS: .wikipedia (updated)
Been working on my wikipedia swatch for the CSS Swatches project, but I've discovered that wikimedia's parser doesn't like inline background-image settings. So here's the wikipedia swatch as it would appear with the inline background-image settings rendering correctly:

Lorem Ipsum
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

for code, see
CSS: swatches
Recently heard a story on public radio about Wikia -- the commercial cousin of Wikipedia. I really like the mediawiki software and was interested in starting a wiki for my moshi project, which I did, sort of. But you have to apply to start your own wiki and my moshi idea was sent back to the drawing board and eventually ended up being the css wikia:

I've tried to give a unique focus, however, by calling it css swatches. The idea is taken from some single-rule css definitions I've posted here -- specifically, css reference styles

It's a wiki, so it's open season to all comers. Feel free to check it out and become part of the community.
PHP: batch queries with ADODB
I had rolled my own function using PHP's mysql functions to handle batch queries. But now I'm using the ADODB_Lite library. This example is pretty much self-explanatory:

$_DATA_BIND = array
array('', 'Ahmed', 20),
array('', 'Barbara', 33),
array('', 'Cecilia', 41),

$ok = $ADO->Execute('insert into table (uid, name, age) values (?,?,?)', $_DATA_BIND);

source: ADODB Manual

keywords: php, ado, adodb, mysql, batch
JS: css inliner
This function simply converts your ordinary external stylesheet setting to an inline setting, saving you valuable seconds of your time.

A form to do the work for you is available at klenwell sos.

// css_inliner
function css_inliner(string)
// *** DATA

// Debug
var _debug = 0;

// Regex
var re_replace = /(\n|\/\*.*\*\/)/igm;
var re_deshell = /\{(.*)\}/i;
var re_tidy = /(\;\s+)/;

// Internal
var _contents = '';

// Return
var inline_css = '';


// debug
if ( _debug ) alert("input: " + string);

// remove newlines
string = string.replace(re_replace, ' ');
if ( _debug ) alert("single line: " + string);

// deshell brackets
matched = string.match(re_deshell);
if ( matched == null )
alert('no result: make sure your input was in the proper .class { rule:value;... } format');
return 'invalid format';
string = matched[1];
if ( _debug ) alert("deshelled: " + string);

// tidy inline
inline = string.replace(re_tidy, '; ');
if ( _debug ) alert("tidy: " + string);

// sanity check
if ( inline == '' || inline == null )
alert('no result: make sure your input was in the proper .class { rule:value;... } format');
return 'invalid format';

inline = 'style="' + js_trim(inline) + '"';

// *** RETURN

return inline;

} // end Fx