Paul M. Jones

Don't listen to the crowd, they say "jump."

Drucker on Quitting

In my regular calls with my dad, he mentioned that it seems Baby Boomers, when unhappy with their jobs, tend to do little but whine about it, whereas Gen-Xers tend to quit. I thought that observation meshed well with this insight from Peter Drucker ("The Essential Drucker", p. 314):

But increasingly also, knowledge workers, and especially people of advanced knowledge, see the organization as the tool for the accomplishment of their own purposes and, therefore, resent ... any attempt to subject them to the organization as a community, that is, to the control of the organization; to the demand of the organization that they commit themselves to lifetime membership and to the demand that they subordinate their own aspirations to the goals and values of the organization. This is inevitable because the possessor of knowledge ... owns his or her "tools of production" and has the freedom to move wherever opportunities for effectiveness, for accomplishment, and for advancement seem greatest.

Managers in IT organizations might do well to remember this.


Solar 1.0.0beta4 released, with new manual chapters

Yesterday I released the beta4 version of the Solar Framework for PHP. You can see the change notes here.

We have also added three new chapters to the manual:

Take Solar for a quick test-drive with the blog demo and see if it suits you.

(Cross-posted from the Solar blog.)


Put down the political pom-poms

Many of those who had no problem with government control or power growing under President Clinton were horrified to see control or power growing under President George W. Bush. Yet, as vociferously as they objected to what they saw as abuse of power by Bush, many of these same people welcome growing government control and power under President Obama. And those who supported Bush as he expanded government, even domestically and even outside of areas related to national security, were then horrified at the growth of government under Obama.

It’s time to stop cheering for a team, to put down the political pom-poms and to allow the government, when it is your party in office, to only have as much power as you would be comfortable with it having if the other side were in power. Because at some point it will be the other side in power. And if you were cheering for one side to have that power, most likely you won’t be happy about how that power is used when the other side has it (even when both parties take us in the same direction).

via When Falls the Coliseum » Put down the political pom-poms.


May Cooler Heads Prevail

I feel I’ve been had.

One thing I could not have known in 1996 was that the IPCC’s warming predictions would be wrong. Mean global surface temperatures have not risen since 1998, and, by some measures, have dropped since 2001. The CRU e-mails show scientists trying to hide this decline, to give one detail--I don’t have room in this column to detail the extent of CRU’s shenanigans, nor could I tell the story as well as others, so please read this “Editor’s Page” online for links (see below).

This doesn’t necessarily mean manmade global warming is disproven. But it does deflate the certainty and moral righteousness of the Al Gores and the IPCCs of the world.

via Editor's Page: May Cooler Heads Prevail - Honolulu Magazine - February 2010 - Hawaii.



Solar 1.0.0beta3 Released

Yesterday, I released Solar 1.0.0beta3. You can see the very short change log here. Special thanks to “kalkin” for committing a series of fixes and improvements.

These days I’m concentrating more on documentation. Previously, we had only the ubiquitous quick-start blog demo. This release includes a new chapter on Solar’s dynamic dispatch cycle; i.e., the bootstrap, front controller, page controller, action method, and view. (I’m starting a chapter on the DataMapper-style model system today.)

Incidentally, I’ve been writing the docs in DocBook 5 and building them with xsltproc. You can see the whole build system in the Solar docs repository. I tried using the new PhD build system, but it required more effort and energy than I could spare. PhD is screamingly fast, but it’s not doing everything that xsltproc does just yet, and I barely have enough time to work on my own projects as it is.

(This announcement is cross-posted from the Solar framework blog).


Barney Frank Doesn't Know What To Do

Here’s an idea. Why not let people of who want to borrow money to buy a house convince the people who lend the money that there’s a good chance that the money will get paid back. Creative, no? It’s called voluntary exchange. Or a market. Or normal. Fannie and Freddie were abnormal. We don’t need a “new system.” The old system didn’t work because you, Barney Frank, and others, tried to steer it. Let’s have NO SYSTEM that you figure out and control and steer. Let’s let the housing market emerge that has the built-in feedback loops of profit and loss.

via Frank on Fannie and Freddie.


Mr. Right has left the building....

So our society has created a mess where men are vilified in the classroom, fed PC rhetoric, told their life's goal is to make women happy and do anything that assists her with her goals, while simultaneously told that he is a dope, idiot and unable to care properly for children, and now people are questioning where Mr. Right went?

via Dr. Helen: Mr. Right has left the building.....


Supreme Court Vindicates Political Speech, Pulverizes McCain-Feingold

In a landmark 5-to-4 ruling, the Supreme Court today in Citizens United v. FEC struck down major portions of the McCain-Feingold campaign-finance law. The Court left in place the disclosure requirement for corporations and the disclaimer requirement that identifies whether an ad is not paid for by the campaign. But little else remains. The Court overruled the highly controversial 1990 decision in Austin v. Michigan Chamber of Commerce, which upheld restrictions on corporate spending to support or oppose political candidates.

...

This is a vindication of the First Amendment and a victory for the protection of political speech, which is at the heart of our political system. It will certainly increase the amount of speech. Even the New York Times recognizes this (well, sort of) ...

Thank goodness. McCain-Feingold was horrifying. Via Commentary » Blog Archive » Supreme Court Vindicates Political Speech, Pulverizes McCain-Feingold.


Solar Models vs. Zend Framework Models

Today, Michelangelo van Dam posted this narrative relating his experience with Zend Framework models:

http://www.dragonbe.com/2010/01/zend-framework-data-models.html

I read the article, and wondered how hard it would be to replicate his narrative using the Solar Framework model system. Turns out it's pretty easy: there's a lot of work that Solar does for you.

  1. Download a Solar system, move it to your localhost directory and make sure that the tmp and sqlite directories are accessible to the web server.

    $ wget http://svn.solarphp.com/system/download/solar-system-1.0.0beta2.tgz
    $ tar -zxf solar-system-1.0.0beta2.tgz
    $ cp -r solar/* /var/www/htdocs # or your localhost directory
    $ cd /var/www/htdocs         # or your localhost directory
    $ chmod -R 777 tmp sqlite
    
  2. Create tables and data in sqlite/example.sq3. There are two changes from Michelangelo's code: the table names are plural, and rename the column type_id to address_type_id. (These are easy enough to change in the model class definitions, but I'd like to minimize the amount of customization for this example.)

    CREATE TABLE "users" (
        "id" integer primary key autoincrement,
        "username" varchar(255) not null,
        "password" varchar(255) not null
    );
    
    
    CREATE TABLE "contacts" (
        "id" integer primary key autoincrement,
        "user_id" integer not null,
        "email" varchar(255) not null,
        "phone" varchar(255) null,
        "fax" varchar(255) null
    );
    
    
    CREATE TABLE "addresses" (
        "id" integer primary key autoincrement,
        "address_type_id" integer not null default 1,
        "user_id" integer not null,
        "address1" varchar(255) not null,
        "address2" varchar(255) null,
        "city" varchar(255) not null,
        "state" varchar(255) null,
        "zip" varchar(255) not null,
        "country" varchar(255) not null
    );
    
    
    CREATE TABLE "address_types" (
        "id" integer primary key autoincrement,
        "type" varchar(255) not null
    );
    
    
    -- Data for users table --
    INSERT INTO "users"
        VALUES (1, 'testuser1', 'test123');
    INSERT INTO "users"
        VALUES (2, 'testuser2', 'test234');
    
    
    -- Data for contacts table --
    INSERT INTO "contacts"
        VALUES (1, 1, 'test1@example.com', '1-800-555-1234', '1-800-555-1230');
    INSERT INTO "contacts"
        VALUES (2, 2, 'test2@example.com', '1-800-555-2234', '1-800-555-2230');
    
    
    -- Data for addresses table --
    INSERT INTO "addresses"
        VALUES (1, 1, 1, '1 Test Home', '', 'Testtown', 'ZF', '1234', 'PHP');
    INSERT INTO "addresses"
        VALUES (2, 1, 2, '2 Test Home', '', 'Testtown', 'ZF', '1234', 'PHP');
    INSERT INTO "addresses"
        VALUES (3, 2, 2, 'Test Corp, LTD', '4 Test Ave', 'Testtown', 'ZF', '1234', 'PHP');
    
    
    -- Data for address_types table --
    INSERT INTO "address_types"
        VALUES (1, 'Home address');
    INSERT INTO "address_types"
        VALUES (2, 'Billing address');
    
  3. Make sure the SQLite database is accessible to the web server.

    $ chmod 777 sqlite/example.sq3
    
  4. Make a vendor space for the controllers, models, suppory libraries, etc. For this example the vendor will be named Example.

    $ ./script/solar make-vendor Example
    
  5. Edit the system configuration in config.php. Change the front-controller class prefixes and model catalog class prefixes, and tell the SQLite adapter which file name to use.

    // front controller
    $config['Solar_Controller_Front'] = array(
        'classes' = array('Example_App'),
        // ... the rest of the front-controller array ...
    );
    
    
    // model catalog
    $config['Solar_Sql_Model_Catalog']['classes'] = 'Example_Model';
    
    
    // add sqlite config
    $config['Solar_Sql_Adapter_Sqlite'] = array(
        'name' => "$system/sqlite/example.sq3",
    );
    
  6. Make the model classes. Note that this avoids a ton of effort that Zend Framework requires: Michelangelo had to hand-create table, model, and mapper classes for each of the following single-line commands.

    $ ./script/solar make-model Example_Model_Users
    $ ./script/solar make-model Example_Model_Contacts
    $ ./script/solar make-model Example_Model_Addresses
    $ ./script/solar make-model Example_Model_AddressTypes
    
  7. Edit the model classes to express what the related models are:

    /** source/example/Example/Model/Users.php */
    protected function _setup()
    {
        // chain to parent
        parent::_setup();
    
    
        // relateds
        $this->_hasOne('contact');
        $this->_hasMany('addresses');
    }
    
    
    /** source/example/Example/Model/Contacts.php */
    protected function _setup()
    {
        // chain to parent
        parent::_setup();
    
    
        // relateds
        $this->_belongsTo('user');
    }
    
    
    /** source/example/Example/Model/AddressTypes.php */
    protected function _setup()
    {
        // chain to parent
        parent::_setup();
    
    
        // relateds
        $this->_hasMany('addresses');
    }
    
    
    /** source/example/Example/Model/Addresses.php */
    protected function _setup()
    {
        // chain to parent
        parent::_setup();
    
    
        // relateds
        $this->_belongsTo('address_type');
        $this->_belongsTo('user');
    }
    
    
  8. Make a skeleton app (i.e., a controller with its associated actions and views):

    $ ./script/solar make-app Example_App_Accounts
    
  9. Edit the controller action to fetch user account data:

    /** source/example/Example/App/Accounts.php */
    public $list;
    public function actionIndex()
    {
        // get a model catalog
        $model = Solar_Registry::get('model_catalog');
    
    
        // populate $this->list with all users.
        // eager-fetch the contact record and addresses collection.
        $this->list = $model->users->fetchAll(array(
            'eager' => array(
                'contact',
                'addresses',
            ),
        ));
    }
    
  10. Edit the view for the index action. This could be a view and a partial, but let's keep it straightforward for now.

    /** source/example/Example/App/Accounts/View/index.php */
    <table>
        <tr>
            <th>Username</th>
            <th>E-Mail</th>
            <th>Phone</th>
            <th>Fax</th>
            <th># addresses</th>
        </tr>
    
    
        <?php foreach ($this->list as $user): ?>
    
    
        <tr>
            <td><?php echo $this->escape($user->username); ?></td>
            <td><?php echo $this->escape($user->contact->email); ?></td>
            <td><?php echo $this->escape($user->contact->phone); ?></td>
            <td><?php echo $this->escape($user->contact->fax); ?></td>
            <td><?php echo count($user->addresses); ?></td>
        </tr>
    
    
        <?php endforeach; ?>
    
    
    </table>
    
    

You're done. Browse to http://localhost/index.php/accounts/index to see the results of your handiwork.

Total elapsed time from when I read Michelangelo's article to come up with the Solar conversion and write this article: under two hours.

Solar makes model creation and interaction very easy and very powerful. Maybe your next project should use Solar instead of Zend Framework?