Skip navigation

Monthly Archives: February 2009

Although I’m sure many people already knew the answer to this, I wanted to post the solution mainly so that I don’t forget.  I spent about 30 mins looking for the answer again yesterday since I had forgotten it from the last time I used it. 

To store an array (even a multi-dimensional array) from PHP into MySQL, use the serialize() and unserialize() functions.  There’s other ways of doing it I’m sure, but this has proven quick and painless for myself.  So, sample code might be:

//To insert
$SampleArray = array();
$SampleArray = serialize($SampleArray);

$sql = “INSERT INTO table (‘ArrayField’) VALUES (‘$SampleArray’);
//Run sql statement

//To retrieve
$SampleArray = unserialize($row_table[‘ArrayField’]);

We wanted to create and run some custom error pages for 404 and 403 server errors for our site.  The standard way to do this, it seems would be to create a .htaccess page for the site and configure httpd.conf to allow for it. 

However, after some digging around, I found that since I’m running more than one site on our server (virtual hosts), the configuration can be done via the sites virtual host configuration file.  Opening up this file in a text editor (I like vi for this purpose) allows you to manipulate this as well as some other configurations for the site.

Terminal commands would thus be:

cd /etc/httpd/sites

sudo vi sitename.com.conf

If you already have a custom 404 page (which can be changed in the “Sites” tab of the Web Service under Server Admin), you should see the configuration:

ErrorDocument 404 /WhateverYourPageNameIs.htm

Now, all you have to do is add another entry below this one formatted just like that for any other error code, in our case a 403 Forbidden error:

ErrorDocument 403 /WhateverYourForbiddenPageIs.htm

If you don’t already have a custom 404 document, you can add these entries just before the start of the module listings. 

If you’re running SSL on a site, you’d need to modify the config file for the SSL version of the site. 

With this Text-to-Binary Code translator.  Hours (I mean minutes) of fun. 

It’s nice.  I like it better than the last version, but really, it looks a lot like Chrome.  I mean, it’s not Chrome, but it shares some similarities for sure.  It still isn’t enough for me to switch from Firefox, though. 

Depeche Mode, an old favorite of mine from way back when, is the first band to offer a new iTunes Pass promo.  It works like a Season Pass for a band’s music. 

Eric Ries discusses why

Software should be designed, written, and deployed in small batches

I couldn’t agree much more.  I’ve found that it makes it much easier to meet deadlines, isolate problems, and increase speed of development when things are broken into small chunks.  In one project, we attempted a vast overhaul of our application to be completed over 6months.  It was dismal failure in many aspects, but the most important lesson I learned from it was why and how to break a long project into smaller pieces.  (via O’Reilly Radar)