Framework 0.1.0

Well, for all three of you out there that use Framework you’re in for either a nice surprise or something that will make you want to kill me. I was recently contacted by a company who wanted to use Framework for an upcoming project and was gracious enough to allow me to release some of the upgrades and changes publicly.

The possibly bad news for people who might actually be using Framework is that I totally rewrote some of the core internals. The highlight is that Framework will now load multiple sites without needing multiple installations. Another big upgrade are plugins which will allow you to drop hooks into your modules. All of these new features, of course, are totally beta, but appear to be working pretty well. Read on for the entire list of changes.

  • Cleaned up Framework_Session
  • Changed Framework::run() to Framework::start()
  • Fixed case sensitive bug in Framework_Module::$presenter
  • Added multi-site functionality (see Framework_Site class)
  • Added a plugin framework (see Framework_Plugin class)
  • Added Framework_Module::factory()
  • Added Framework_Module::start()
  • Added Framework_Module::stop()
  • Added Framework_Module::__shutdown()
  • Added Framework::stop()
  • Added Framework::$module for storing running module instance
  • Added Framework::$site for storing running site instance
  • Added Framework_User
  • Added Framework_User::singleton()
  • Added Framework_Object_Web
  • Added Framework_Site_Common::getUriPath()
  • Added check in Framework_Presenter_Smarty::__construct() to check for writeable cache/compile dirs
  • Added support for custom Framework_User classes
  • Assign Framework::$site to Smarty templates in Framework_Presenter_Smarty
  • Deprecated FRAMEWORK_LOG_FILE in Framework_Config.php
  • Deprecated FRAMEWORK_LOG_DSN in Framework_Config.php
  • Deprecated FRAMEWORK_USER_TABLE in Framework_User
  • Deprecated FRAMEWORK_USER_PRIMARY_KEY in Framework_User
  • Deprecated FRAMEWORK_USER_DEFAULT_USER in Framework_User

Download Framework 0.1.0

DB_Virtual 0.0.4

I’ve been working on ways to balance database traffic amongst multiple servers for about a week now. Initially, I had created a DB driver class that extended from DB_mysql, but opted for a cleaner approach using the decorator pattern.

Essentially, DB_Virtual allows you to connect to N database servers with one of them acting as the master. 100% of all manipulation queries (ie. DELETE, INSERT, etc.) are sent to the master nodes while SELECT queries are balanced amongst the remaining nodes using a weighted round robin approach.

The pros of this are obvious, you can take your database traffic and with little effort balance traffic amongst your database nodes. The con is that you have X * N connections per request where N is the number of database nodes and X is the number of databases you connect to.


require_once 'DB/Virtual.php';

$db = new DB_Virtual();

// Attach a master (you MUST do this first)
$result = $db->attachMaster('mysql://root@',50);
if (PEAR::isError($result)) {

// Attach a node (do this for however many nodes you have)
$result = $db->attachNode('mysql://root@',50);
if (PEAR::isError($result)) {

// Depending on the query DB_Virtual will either propagate the call to all
// nodes or send it to the master.

// Use DB_Virtual just as you would PEAR DB
$result = $db->query("SELECT * FROM tbl");
if (!PEAR::isError($result)) {
    while ($row = $result->fetchRow()) {


The best part is DB_Virtual is 100% compatible with PEAR’s DB package so there’s no reason to go around changing all of your code as it should work automagically through the wonders of PHP5’s overloading mechanism.

Download DB_Virtual 0.0.4

Cartoons where drawn by the Danes

Hey, you crazy Muslim fundamentalists, the US didn’t draw those cartoons so why are you burning President Bush effigies and vandalizing western businesses? You want to know why we think Muslim fundamentalists are backwards thinking crazy people? This is why. You turn every thing into a reason to burn your own provincial assembly building. This would be like us burning down the state capitol in “protest” of 9/11. Does that make any sense?

I liken Muslim fundamentalists, not regular sane Muslims mind you, to rednecks. They’re all about keeping their women bare feet and making babies while they walk around looking tough with their guns and reminiscing about the good ol’ days. The good news for us is that the rednecks appear to be content with their huge 4×4’s, trailers and booze so they don’t often go around looting and shooting up in the air.

Seriously, people, get a clue.

Greg Down South

A friend of a friend is doing what most of us only dream of doing. After working his ass off for a few years he’s quit his job and backpacking through S. America on his way to a research vessel bound for Antarctica.

He’s got a blog and documenting the whole thing photographically on Flickr.

To say I’m jealous would be an understatement.

Diagnosis: Herniated Disc

A while ago I hurt my back. I was lifting at the gym and felt something go in my back. I went to the chiropractor and got back on my feet, but never getting back to 100%. About a month ago I had an MRI done on my back and found out I have a protrusion, or herniated disc of my very last disc in my back (the one that sits between the last vertebrae and your tail bone), which is one step below a ruptured disc.

So what happens if I rupture it? Well, there are a number of things they can do, which are all bad and all involve surgery on my back. For now the doctor told me to avoid lifting heavy objects and high impact exercise.

In other news, I’m heading to Whistler snowboarding this weekend. Hopefully, I won’t be heading home on a stretcher.


31,803 is the number of emails I recently imported from various old archives the other day. Every single email from October 16th, 2000 until present day, minus the emails from September of 2003 until November of 2004 that were lost in a hard drive crash.

So why keep around all of my email? Well, it’s like a log of my entire life. Want to know what I was doing on November 14th, 2001?

  1. My friend Walter sent me a picture of a girl flashing the fans at Wrigley Field
  2. My friend Dave sent me an email through his newly created nationwide dial-up network
  3. My friend Josh scored a 33% on the geek test
  4. My friend Jeremy decided to move back from Italy
  5. Aaron and I had a debate about the merits of qmail and DJB’s software
  6. I fixed a bug in the build form for along with working on the spotlight rotator
  7. I discovered ORDER BY RAND() in MySQL
  8. My server, zebulon, had been up 119 days

See, that’s why I keep my email. Now, what should I do with all of this information? I’ve been pondering about putting it up in blog format one day at a time in a somewhat raw format. I’d change the names, etc., but I think it would be interesting. Thoughts?