Skip to main content

Posts

Showing posts from January, 2009

Evil Access

I was thinking today about database APIs when inspiration struck. I ended up hacking out the following class, which I think demonstrates a rather interesting approach to interfacing with a database (interesting enough at least to post here). class DBQuery implements Iterator { protected $_db; protected $_query; protected $_result; protected $_index; protected $_num_rows; public function __construct($host, $dbname, $username, $password) { $this->_db = new PDO("mysql:dbname=$dbname;host=$host", $username, $password); } public function __get($query) { $this->_query = $query; $this->_result = $this->_db->query($query); return $this->_num_rows = $this->_result->rowCount(); } public function quote($value) { return PDO::quote($value); } public function __call($query, $values) { $this->_query = $query; $this->_result = $

Motivational Posters

I've been having a hell of a time fighting with some Perl code at work lately. I tossed together a humorous Perl demotivational poster to release some of my frustration, and thought others might appreciate it. But why stop there? There are other languages worth making fun of besides Perl! So, I tossed together some more snarky posters to be fair.

7 Things You Didn't Care to Know About Me

I've been tagged by Chris Cornutt and Jeff Jones to share some things you probably don't know about me. (It's nice to see chain mails flow through the blogosphere too, eh?) So, here's seven little-known facts about yours truly... My first career choice was to be a diocesan priest, and I briefly attended Seminary after I graduated from high school. My family isn't overly religious, and my parents didn't push me to go; I think I just like to help people and felt drawn to the rich history of the Roman Catholic Church. Life has a funny way of playing out differently than we intend for it, doesn't it? After I left seminary, I attended a state university and majored in elementary education with a concentration in music history and literature. I'm not overly fond of children, though, so I didn't complete the program. I would only need to take two more classes to be a state-certified elementary teacher. I studied French for 5 years in high school

Happy New Year

I've never been one to make New Year's resolutions. If I really want to change something about myself or my life, why what until January 1st to set goals for myself? It doesn't matter to me if it's January 1st, April 15th, July 4th, or December 26th... I just set goals and go for them! Instead, I prefer to choose an over-reaching theme for the year. This suits me better because there's no success or failure benchmarks to meet; it's something I keep in mind to help guide me as I tackle the challenges and opportunities that come my way. 2006 was my "Year of Adventure." 2007 was my "Year of Change." 2008 was my "Year of Success." What will 2009 be? I've chosen to designate 2009 as a "Year of Balance" for myself. Like everyone, there's good things and bad things in my life; putting the balance back into my life again will empower me to better appreciate the good and deal with the bad more productively. So, it was ver