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.


<?php

require_once 'DB/Virtual.php';

$db = new DB_Virtual();

// Attach a master (you MUST do this first)
$result = $db->attachMaster('mysql://root@192.168.10.25/enotes_com',50);
if (PEAR::isError($result)) {
    die($result->getMessage()."n");
}

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

// Depending on the query DB_Virtual will either propagate the call to all
// nodes or send it to the master.
$db->setFetchMode(DB_FETCHMODE_ASSOC);

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

?>

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

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 Care2.com 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?

No Protesting Allowed

America is supposedly the world’s standard for freedom and democracy. If you were to play a drinking game where you had to take a shot every time Bush said “freedom” or “democracy” during this upcoming State of the Union address you’d be on the floor by the end of the first sentence. Well, if you were to actually read the various laws already on the books you’d know that the federal government could care less about freedom or democracy for the most part.

There are two bills right now that are pretty upsetting to me. One called USA PATRIOT Improvement and Reauthorization Act Of 2005 and the other Secret Service Authorization and Technical Modification Act of 2005. A few excerpts from these two bills.

There is hereby created and established a permanent police force, to be known as the `United States Secret Service Uniformed Division’.

… make arrests without warrant for any offense against the United States committed in their presence, or for any felony cognizable under the laws of the United States if they have reasonable grounds to believe that the person to be arrested has committed or is committing such felony …

willfully and knowingly to enter or remain in any posted, cordoned off, or otherwise restricted area of a building or grounds so restricted in conjunction with an event designated as a special event of national significance

by inserting `willfully, knowingly, and’ before `with intent to impede or disrupt’;

The first one, from what I can tell, basically creates a uniformed federal police force that can arrest anyone at events of “national significance” on suspicion of committing a felony. The second one appears to make it illegal to “impede or disrupt” events of “national significance” if you’re within a posted/cordoned off/restricted area. Okay, I get the cordoned off and restricted areas as I assume this is where significant targets are, but what are “posted” areas? What would stop them from making the entire venue a posted area and then arresting anyone who shouted “Fuck off Mr. Cheney!”?

Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, and to petition the government for a redress of grievances.

It’s time we quit worring about the terrorists and start worrying about our own government. If you think they aren’t creating laws like this just so they can exploit them in the way I’ve described you’re insane.

Update: Peace activist Cindy Sheehan was arrested Tuesday in the House gallery after refusing to cover up a T-shirt bearing an anti-war slogan before President Bush’s State of the Union address.

How to poop at work

My friends all know I’m a huge fan of flatulence. Thanks to Garren for this.

We’ve all been there but don’t like to admit it. As much as we try to convince ourselves otherwise, the Work Poop is inevitable. For those who hate pooping at work, following is the Survival Guide for taking a dump at work.

Crop Dusting

When farting, you walk briskly around the office so the smell is not in your area and everyone else gets a whiff but doesn’t know where it came from. Be careful when you do this. Do not stop until the full fart has been expelled. Walk an extra 30 feet to make sure the smell has left your pants.

Fly By

This is the act of scouting out a bathroom before pooping. Walk in and check for other poopers. If there are others in the bathroom, leave and come back again. Be careful not to become a Frequent Flyer. People may become suspicious if they catch you constantly going into the bathroom.

Escapee

This is a fart that slips out while taking a leak at the urinal or forcing a poop in a stall. This is usually accompanied by a sudden wave of embarrassment. If you release an escapee, do not acknowledge it. Pretend it did not happen. If you are standing next to the farter in the urinal, pretend you did not hear it. No one likes an escapee. It is uncomfortable for all involved. Making a joke or laughing makes both parties feel uneasy.

Jail Break

When forcing a poop, several farts slip out at a machine gun pace. This is usually a side effect of diarrhea or a hangover. If this should happen, do not panic. Remain in the stall until everyone has left the bathroom to spare everyone the awkwardness of what just occurred.

Courtesy Flush

The act of flushing the toilet the instant the poop hits the water. This reduces the amount of airtime the poop has to stink up the bathroom. This can help you avoid being caught Doing the Walk of Shame.

Walk of Shame

Walking from the stall, to the sink, to the door after you have just stunk up the bathroom. This can be a very uncomfortable moment if someone walks in and busts you. As with farts, it is best to pretend that the smell does not exist. This very uncomfortable walk can be avoided with the use of the Courtesy Flush.

Out of the Closet Pooper

This is a colleague who poops at work and is damn proud of it! You will often see an Out Of The Closet Pooper enter the bathroom with a newspaper or magazine under his or her arm. Always look around the office for the Out Of The Closet Pooper before entering the bathroom.

PFN

A group of co-workers who band together to ensure emergency pooping goes off without incident. This group can help you to monitor the whereabouts of Out Of The Closet Poopers, and identify Safe Havens.

Safe Havens

A Safe Haven is a seldom-used bathroom somewhere in the building where you can least expect visitors. Try floors that are predominantly of the opposite sex. This will reduce the odds of a pooper of your sex entering the bathroom.

Turd Burglar

This is someone who does not realize that you are in the stall and tries to force the door open. This is one of the most shocking and vulnerable moments that can occur when taking a poop at work if this occurs, remain in the stall until the Turd Burglar leaves. This way you will avoid all uncomfortable eye contact.

Camo-Cough

A phony cough that alerts all new entrants into the bathroom that you are in a stall is called a Camo-Cough. This can be used to cover-up a Watermelon, or to alert potential Turd Burglars. The Camo-Cough is very effective when used in conjunction with an Astaire.

Astaire

An Astaire is a subtle toe-tap that is used to alert potential Turd Burglars that you are occupying a stall. This will end all doubt that the stall is occupied. If you hear an Astaire, leave the bathroom immediately so the pooper can poop in peace.

Watermelon

A watermelon is a big poop that creates a loud splash when hitting the toilet water. This is also an embarrassing incident. If you feel a Watermelon coming on, create a diversion. See Camo-Cough.

Havana Omelet

A case of diarrhea that creates a series of loud splashes in the toilet water. Often accompanied by an Escapee. Try using a Camo-Cough with an Astaire.

Uncle Todd

An Uncle Todd is a bathroom user who seems to linger around forever. This person could spend extended lengths of time in front of the mirror or sitting on the pot. An Uncle Todd makes it difficult to relax while on the crapper, as you should always wait to poop when the bathroom is empty. This benefits you as well as other bathroom attendees.

Karma 4 5, Joe 0

When it rains, it pours.

  1. Doesn’t look like I’ll be going to Cold Play since the tickets are with a friend who’s no longer talking to me.
  2. Roommate troubles.
  3. I accidentally spilled an entire drink onto Dana’s laptop rendering it completely broken.
  4. My flight back from San Diego was diverted to Portland. At 1AM this morning we departed for Seattle’s airport. I arrived home around 5AM.
  5. My phone died the day before I was supposed to leave. The replacement phone arrived today and does not work either (not to mention it’s the wrong color). I bought a complete turd of a phone as a replacement for now, which is killing me.

I’m exhausted and completely drained from the last week or so. Thankfully I have a ton of bathroom work and a small contract job staring me in the face. Not. On the bright side the two California Burritos I brought back from San Diego survived the trip and are currently awaiting me eating them.