Monthly Archives: April 2012

by

Sunday morning revolution

No comments yet

Categories: musings

This morning I read that police in Michigan are extracting data from phones without a warrant, even for routine traffic stops. The Department of Homeland Security has ordered half a billion bullets.  Supreme Court Justices are squinting at careful penmanship.

Sitting in my hotel room, I stop thinking about the eggs Benedict at the cafe across the street. My eyes linger on things close to me: the Doric shaft of the lamp on the table, its patina of spatterings. A label on the base says: 120V 60Hz 5 Amps Max. The auxiliary electrical outlet is upside-down, perhaps to confuse me into reading the accompanying text.

I force my eyes to walk around the room, and they wander through the bedroom doorway. The jerking shadow of a tree branch on the white curtains still drawn startles me. I cannot hear the wind moving.

by

Cats and coding

No comments yet

Categories: tech, Tags: , , ,

This is why I love reading good coding books: the colorful examples that trick you into understanding the material without thinking too hard about it. Check out this section from Modern Perl I just got to today:

Second, a method call always involves a dispatch strategy, where the object system selects the appropriate method. Given the simplicity of Cat, the dispatch strategy is obvious, but much of the power of OO comes from this idea. Inside a method, its first argument is the invocant. Idiomatic Perl 5 uses $self as its name. Suppose a Cat can meow():

package Cat
{
    sub meow
    {
        my $self = shift;
        say 'Meow!';
    }
}

Now all Cat instances can wake you up in the morning because they haven’t eaten yet:

my $fuzzy_alarm = Cat->new();
$fuzzy_alarm->meow() for 1 .. 3;

Cats are something I understand. Now if only I could so easily reprogram my own fuzzy alarm….