Saturday, January 31, 2009

Taming Dragons with Tupperware

Below is a tale of lizards, windows, and Tom being a dork.

I decided I was going to do something productive on an otherwise lazy Saturday.  It had come to my attention earlier in the week that my girlfriend's house is damn cold.  Today, I finally decided to do something about it and went over to her house to seal up some noticeably breezy spots.  

First up were the front windows.  I moved the surrounding furniture back, pulled the blinds up a bit, and found this....


It's the middle of winter, why is this guy (or girl?) not hibernating?  This isn't the first time I have had to evacuate a lizard from the girlfriend's place, but that time the lizard was in the middle of the ceiling and also half the size. (Side note: keep ceiling textures flat otherwise capturing baby lizards on your ceiling becomes very difficult.)

So how to deal with this one...
  1. Shoo it out the window. 
  2. Kill it
  3. Attempt to reason with it
  4. Find a container of some sort and try to catch and release
  5. Leave it there and hope the girlfriend never looks behind the TV
First option, shoo it out the window. The means to open the window are right next to the lizard, the window is screened, and if I try to shoo it, it may very well just run off away from the outdoors and into the tangle of TV cords nearby.  X nay on the ooing shay.

Second option, kill the damn thing.  I tend to avoid violence if at all possible, not to mention I really didn't want to deal with the clean up, especially if I only kinda killed it and it ran away bleeding all over the house.

Option three, try the impossible and hold a conversation with a lizard.  Worth a shot right?

Option four, catch and release.  This would be the preferred method, however I have to find a container large enough to accommodate the lizard (its not huge or anything, but its tail is really long). Also the lizard is right in the corner which makes placement tricky.

Option five, keeps the bugs away right?  So I left it there.

Psyche. (I did give it away in the title.) I went into the kitchen to try and find an appropriate sized container, eventually I discovered a nice rectangular one.  I checked it against a neighboring window sill and it was a perfect fit.  However, I also made another important discovery.  The window had a small metal lip on it so people could open it or something. Whatever its purpose, the lizard's head was directly underneath it so a simple drop was not going to work.

After fetching a green folder (the stiff, thin, flat object that would be slid under the soon to be contained lizard), I stared the lizard down. I said, "Look I know your brain is smaller than my pinky, but it would simply be easier if you mozied out the door.  Why there haven't been more advances in inter-species communication is beyond me."

I grabbed the container and held it over the window sill... 

I hesitated. (It's amazing how much more bravado we men have when the women are watching.)  I contemplated just slamming the container down, but then realized I might injure the lizard and somehow lop off it's tail or kill it. I didn't like that option, and that little guy is going to need his tail once he gets outside.

I slowly lowered the container towards the sill. Slow and steady... Please don't run into the tangle of cords by the TV...  Steady now... Maybe the girlfriend wouldn't mind... almost there... the inner edge dropped onto the metal lip of the window.  Ok, the lizard hasn't moved yet, (maybe reasoning with it worked a little?) I lower the outer edge. I can feel gravity pulling the edge on the window lip. I release...

The last edge of the container falls and the lizard flips out.  It landed on his head! He frantically struggles for a second and then pulls his head back runs to one corner of the container, runs to the next, then stops. 

I notice the lizard's tail poking out through the thin sliver of space between the container and the window sill edge and quickly slide the container a quarter inch in. He shifts to another corner.

Ok, I can breathe a little easier now. I grab the green folder and gently slide it under the container.


I fetch a sturdier magazine to put underneath the folder to ensure that the folder doesn't bend while transporting the lizard outside.

I let him go in some bushes near the house and spent ten minutes feeling awesome while sealing up two small holes underneath the window. 

Saturday, January 10, 2009

Best article/blog I have ever read....

Business Requirements are Bullshit

Came across this blog when looking into a local Dallas company Viewzi and their more or less inactive twitter feed.
Full of humor and lots of good quotable nuggets:
Ideally the product you're building for yourself should be simple to describe, so that other people can quickly evaluate whether they, too, want this thing. It's often called the "elevator pitch", because you should be able to describe the product in the time between when the cable snaps and the elevator hits the ground. "Dissolves dog poooooop!!! " It used to just be the time for an elevator ride, but those investors keep raising the bar.
When you're trimming the business requirements, then you're exhibiting healthy project behavior. This contrasts directly with gathering requirements, which has both the connotation that you're clueless about the product and the connotation that you're inflating the requirements list in direct conflict with schedule, usability and fashion. Trimming: good. Gathering: bad.
Awesome.

Friday, January 9, 2009

A Different Kind of New Year Reflection

I've been attempting to get down and dirty with Zend Framework lately. It has the a la carte design that I want from a framework, but Django is still my first love. Despite all of the libraries in Zend, it still doesn't have that 'batteries' included feel I get from Django. I mean do I really have to write my own admin and authorization? Hell even RoR let's me whip up some scaffolding.... (And no phpMyAdmin is not what I would consider an acceptable admin interface). Don't even get me started on the benchmarks or how awesome Django's documentation is... but this post is about Zend and PHP....

Zend does provide a decent table abstraction (screw you mysql/mysqli functions) with some ActiveRecord like capabilities i.e.:
$table = new MyTable(); //Assumes database adapter was initialized
$newEntry = array('name'=>"TK",'state'=>"TX");
$newEntry['id'] = $table->insert($newEntry);
$oldEntry = $table->fetchRow(
$table->select()->where("id = ?",$newEntry['id']))
->toArray();

Not too shabby, an ok query builder with auto-escaping, but I still feel like something is missing...

Thankfully PHP5 introduced some decent meta programming/reflection capabilities. Of particular interest is the "magic" function __call($method,$arguments).
class My_Model_DbTable_Abstract extends Zend_Db_Table_Abstract
{
public function __call($method,$arguments){
if(strncmp($method,"getBy",5) == 0){
if(count($arguments) != 1)
throw new My_Exception("getBy(value) takes one argument");
$fieldName = strtolower(substr($method,5));
if(isset($this->_metadata,$fieldName))
return $this->_getBy($fieldName,$arguments[0]);
throw new My_Exception("$this->_name has no field '$fieldName'");
}
throw new My_Exception("Unknown method: '$method'");
}
public function _getBy($col,$value){
$result = $this->fetchRow($this->select()->where("$col = ?",$value));
return (null == $result) ? null : $result->toArray();
}
}
...
$oldEntry = $table->getById($newEntry['id']);

I'm terrified I might start writing Django's ORM in PHP, but I really don't have the time. The eventual task of writing a Zend_Form for every table I create is just as daunting... maybe I just need to Google around some more

Monday, January 5, 2009

Swarm Force

Recently found this swarmforce.com on a job board and it got my wheels turning....

What I have gathered about SwarmForce so far from the site and blog:
1) SwarmForce differentiates itself from traditional content portals by using a 'swarm' algorithm versus the usual user recommendation algorithm.
2) SwarmForce is also a content provider like Wikipedia, only the swarm algorithm is the editor and not an arbitrary person. Currently this is manifested as 'Debates' but a full fledged collaboration platform is planned.

The Idea:
I love the idea of Swarm Intelligence. Just this weekend I was contemplating how an ant determines what colony it is a part of. (I am geek, hear me roar.) But the big question is, how can Swarm Force differentiate itself from other content portals to the common person?

A quick note on debates:
The debates feature is interesting, but the few I've looked at seem very long winded and it takes a bit of reading to dig up the hard nuggets of information. Striking a balance between thoroughness and usability is always a hard problem. A site that I think has a quick and simple debate feature is http://wikinvest.com (Bear vs Bull reasons to buy/sell a stock). A challenge for the debate feature will be how to condense the 'good' points instead of false arguments such as Straw Man etc (wonder if NLP can do this....)

A note on the front page:
Why am I being shown big Hulu style graphics of the big debates? It makes sense on an entertainment portal because the same slide show is main the player so the transition to the new page is a fluid experience, but here it is kind of confusing. One alternative would be to cycle through some swarms and list out the hot debates and articles.

I think for SwarmForce to really click with some of the early adopters it needs a clear case for how a 'swarm algorithm' can filter noise and another case for how it does better than traditional user recommendation sites.

Between Digg-a-likes and Wiki-clones collaboration/user content platforms are a fairly saturated market (User generated-content was one of the defining aspects of 'Web 2.0' no?). It will require a serious disruptive technology to break into, the proof is in the pudding. (What does that actually mean?)

There is plenty of opportunity here though. How do you determine membership in a swarm seems like a big problem in of itself. It also hits up on one of my other favorite topics, what secrets will the social graph reveal?

P.S. Every employee of SwarmForce should be given an Ant Colony upon being hired full time.