Goals are for Losers (and other wisdom)

March 20th, 2014

Scott Adams of Dilbert fame has another book out – “How to Fail at Almost Everything and Still Win Big”. As the owner of four of his previous books (that is to say four of his more-than-cartoons books), this one did not disappoint. Thanks to Alex Sirota and NewPath Consulting for sending the book my way.

You could be forgiven for thinking that The Dilbert Principle was more lampoon than sociology, however much like its progenitor The Peter Principle by Laurence J. Peter, the book actually makes a lot of sense about hierarchical organizations and their behaviour.

Similarly, this book provides compelling arguments to help you guide yourself through life and the workplace while giving you a chuckle.

In the introduction, we are teased with a list of topics, the first of which is “1. Goals are for losers”. Other topics include maximizing your personal energy, conquering shyness, and managing your luck.

The book is written in Adams’ usual fun and persuasive style, so it is a great read.

Of course, don’t take your advice from this middle-aged nerd, go figure it out for yourself.


Reliability: The Rarest Quality

February 18th, 2014

Of all the qualities that make someone a good employee, friend, partner, or teammate, the most elusive is reliability.

A reliable person:

  • arrives on time.
  • calls if they are going to be late, BEFORE the appointed time if possible.
  • does what they said they would do.
  • pays what they owe, on time, in full, nothing less
  • holds their end of a bargain or agreement.
  • keeps promises.
  • makes good on broken promises, WITHOUT being asked.

It all comes down to respect. A reliable person shows respect to others and earns it in return. All relationships, personal and business, stand or fall on reliability. Lapses in reliability can be tolerated if respect is shown and understanding sought, but unreliability without apology or explanation is unacceptable.

This post is the result of months of personal and business interactions, precious few of which were marked by any acceptable level of reliability.


Using Regular Expressions with SQLite

November 27th, 2013

SQLite is a great database tool that is available almost anywhere and is quick and easy to use.

I am currently using it for work I am doing for a client. I am writing a rules-based data validator in for a tab-delimited file using Perl on Windows. With SQLite, it’s simple to slurp the whole file into a database table and then query it multiple times to see whether columns conform to rules.

SQLite doesn’t quite come with a built-in REGEXP operator. I say not quite because it does alias REGEXP to a call to a function called regexp(re,str), however the function does not exist unless you provide it.

You can provide it by compiling a dynamic library extension (.so in Linux, .dll in Windows, .dylib on Mac), but my experience with that route was frustrating and bothersome. It’s only really necessary if you need to use SQLite with regular expressions from the commandline tool or a program outside your control.

Today I found out that if you are using SQLite in a program, you can provide the function in your own language!

Here is a simple example in PHP (it’s just as easy in Ruby or Perl or Python or whatever). Save this to dbtest.php and run it from the command prompt with ‘php dbtest.php’:


if(! file_exists('test.db')){
        $db = new SQLite3('test.db');
        $db->exec("create table users (name varchar(10))");
        $db->exec("insert into users values ('Robert')");
        $db->exec("insert into users values ('Egbert')");
        $db->exec("insert into users values ('Dilbert')");
        $db->exec("insert into users values ('Ratbert')");
        $db->exec("insert into users values ('Dogbert')");
        $db->exec("insert into users values ('Umberto')");

$db = new SQLite3('test.db');

// add the REGEXP magic to the db
function regexp($r,$s){return (preg_match("/$r/",$s)===1);}
$db->createFunction('regexp', 'regexp', 2);

// find names that start with a capital, two lowercase, then bert
$sql = "SELECT * FROM users WHERE name REGEXP '^[A-Z][a-z]{2}bert'";
$result = $db->query($sql);
while ($row = $result->fetchArray()) {
  echo $row['name'] . "\n";

/p?easy/ !

I would have thought it would be really slow, but I can run a REGEXP comparison against thousands of records and it’s plenty quick enough for my needs.


I just added a CAPTURE function to SQLite that returns the first captured section of a string when you supply a regular expression with parentheses.

Here it is in Perl:

$dbh->func('capture',2,sub { my($regex,$string) = @_; my($capture) = $string =~ /$regex/; return $capture; }, 'create_function'); # get month from YYYY/MM/DD format where month or day could be one or two digits my $row = $dbh->selectrow_arrayref( "SELECT CAPTURE('\\d{4}/(\\d{1,2})/\\d{1,2}', date_created) FROM invoices" );


Looking for a house in Brampton?

October 22nd, 2013

I recommend my house at 60 Foxtail Road. We’ve been in it almost 15 years and it’s nicely finished and well appointed. I’d keep it if I could take it with us.

60 Foxtail Road


Complete coverage, good service, peace of mind.

October 10th, 2013

In the same week that the US Government has shut down ostensibly in a squabble about improving the lot of health care to Americans, I’ve had a couple of painful shutdowns of part of my renal system with a large kidney stone intermittently blocking my left ureter.

I thought I would tell you about my experience this week as a patient in the Canadian health care system, in this case at one of Ontario’s busiest emergency rooms, Brampton Civic Hospital. A lot of effort has been spent in the US vilifying the Canadian healthcare system, so I thought a real-world story might be beneficial to counter some of the misinformation.

I am a 52-year old white male, 6 feet tall, 225 pounds, type II diabetic. I am covered by the Province of Ontario’s health plan. My key to all services is my health card, a photo card I show at every visit to any doctor, lab or hospital. You show the card and they serve you, no questions, no stopping to determine whether or how much you’re covered, no payment ever exchanging hands, no bills forthcoming (there are exceptions but this is true for close to everything).

The total amount I had to pay out of my pocket for this care was zero. It was completely covered by the taxes I pay and the contributions I make. There was no expense for co-pay. There was no expense for needles, tongue depressors, lab work, nothing. The sum total of expenses for the entire week for me was a $15 parking charge.

I chose this hospital because it is close to my home. I would have received the same care at any hospital. I did not have to choose one that belonged to some particular plan. At all stages I was treated professionally and promptly (with consideration to other patients whose urgency exceeded mine).

Here is a breakdown of the care I received. It was all provided via the government plan, with no need for extra insurance coverage.

If there were to be a bill, these might be some of the line items:

    Emergency room visits: 2
    Specialist visit: 1
    Family Doctor visit: 1

    Bloodwork: 2
    Urine: 2
    Ultrasound: 1
    XRay: 2
    CT: 1

    Morphine injection: 1
    Morphine IV: 1
    Saline Solution IV: 1
    Gravol: 1
    IV for nausea: 1

The drugs administered at the hospital were all covered. The prescriptions I got were paid for separately and partially covered (80%) by my private drug and dental plan.

Initial Emergency room visit. At 1am, I had some discomfort in the left of my abdomen and blood in my urine. I was triaged through to Ambulatory Care in about 15 minutes, and was in the waiting room there for about 45 minutes until I was moved to an examination room. Was seen about 25 minutes after that, blood and urine were taken, then 1 hour to wait for results. During the hour my pain increased, becoming unbearable and as soon as they were aware, I was given two Percocets, a Gravol and a shot of Morphine in the arm. Once the results came back I was scheduled for a CT scan at 1pm and sent home with prescriptions for Flomax, Naproxen and Percocet, which I filled at the local 24-hour pharmacy, and a referral to my Urologist. Total time from start to finish, 5 hours.

By noon I had talked to my Urologist and had an appointment for 7 days later.

At 1pm I had my CT scan. For the Doctor to see it, I had to be triaged through a now very busy emergency room, and wait for a while at Ambulatory Care. Diagnosis, two 2-3mm stones on the right, one 2mm on the left and one 9mm on the left, 1/3 of the way down the ureter towards the bladder. Total time, 4 hours, mostly waiting comfortably while others were seen who were in distress.

The next Monday I got an appointment with my family doctor to get an extension on the pain medication prescription. He gave me a once-over and grilled me on some details.

The day before I was to go to my specialist, the pain was excessive despite the Percocet, so concerned that some damage might be happening, I went back to emergency. Within an hour I was taken in, blood was taken and I was and seen by the Doctor. I was given an IV of saline and a morphine pack, and later a pack of something for nausea. They took me for an ultrasound and the doctor saw me about 20 minutes later saying it was not clear enough so they were sending me for Xray, which I went to immediately and was seen in short order. The Xray showed it still in the ureter, if a little bit further along. As the symptoms had by that time subsided, the doctor and I decided together that we wouldn’t involve the on-call Urologist but that I would go to my own as scheduled the next day. Total time, less than 4 hours

When I arrived at the Urologist, they tried to get the XRay from the online hospital system, but there were connection problems, so they sent me upstairs to their local lab for another XRay. I was back in 35 minutes with the CD containing the XRay and the Dr gave me my consultation. We decided that due to the invasiveness of the surgical procedure (full anaesthetic, scope up the urethra and ureter, blasting, extraction) I would continue with painkillers and Flomax and if not passed in three weeks reconsider. Total time: 2 hours

Summary to date:

I was seen quickly and efficiently at one of Canada’s busiest emergency rooms three times in one week.

Imaging – I received a CT scan appointment within 10 hours, ultrasound immediately, XRay immediately (twice).

My specialist saw me within a week.

I could have chosen intervention if I cared to at this time. It will be available to me any time should my condition escalate.

At no time did I have to consider the financial implications of this care as there are none.

I understand that the taxes Americans pay for health care (which goes to medicare, government plans including Congress, generally not back to all who pay it) equal or exceed those that we Canadians pay for the care that we all actually receive.

It’s really a mystery why America remains as the only nation who doesn’t get it.


One device, one user – for now.

January 13th, 2013

I really love my Android devices – my Nexus4 phone and my Nexus7 tablet.

With the phone, it’s natural to have one user associated with the device, logged into email, facebook, twitter, linkedin, instagram… need I go on? It’s a one user device.

On the tablet, Android JellyBean has started to give you the ability to have multiple users. I can leave my Nexus7 around the house, and as long as I have set up users for my wife and daughter, they can use it too. I have also created a guest account, however it’s pretty useless without a Google account associated with it, so you might as well not bother.

When the tablet is idle – that is to say sort of “logged off”, which means at the login screen, email (and FB, etc) notifications for the primary user appear in the notification bar. The notification alert sounds when email arrives for the primary user. The sender and subject appear for a short time.

The “password” I currently use is a swipe pattern. Anyone can see me use it and remember it. It is the only thing protecting me from their ability to get into my email etc and mess up my entire online life. Great if you trust them, not so much if you don’t.

I’m not even certain that the multitasking features of Android partition the users from each other.

In short, there is a long way to go before this is really worthy of multiple user operation in practice.

As for Apple/iOS? I no longer use them but as far as I know, they’re even further behind in this respect.


RIP @michaelocc

October 14th, 2012

I first noticed a disturbance in the force at the start of the month.

Not a full-on twitterite, I follow less than 100 @handles, however by the aggregation of mentions, retweets and metatweets it makes for a fairly steady stream of commentary. I can watch the flow like one would watch a busy streetcorner from a window above, every so often a face or snippet of conversation registering to my eye or ear as the crowd passes.

Sometimes I would gaze through my twitter window hoping specifically to catch a certain character or other on their way past my vantage point. Happily I could reach out and rewind and fast-forward the stream, scanning it for insights or sometimes just for the assurance that my daughter or a friend was simply still there, still ranting or enthusing.

Just as you might smile and wave at the barber on your way to the office, I made it a habit this summer to check every day to see how my friend @michaelocc was getting on. Stricken with cancer, bedridden and often silenced by medications and procedures, he carried on a daily conversation with his family, friends, and the rest of the twitterverse. Occasionally I would say hello, more often I would quietly observe the heartwarming and uplifting banter he would trade with all comers.

When his feed fell silent last week, I feared the worst, and today I hear from many grieving friends and colleagues that indeed, Michael died last night. He was a giant of an imp of a man and I shared many a hearty laugh with him. We started our blogs one day apart from each other back in 2001 (his was first) and crossed paths many times. I shall miss him greatly.

As I watch the flow of my feed, the grieving and the fond memories of Michael rise above the hubbub. I know that these will become fewer and that they will fade into the daily hustle and bustle. Until then, I will cherish the opportunity I have to rewind the stream just one more time.


Open Textbooks in California

September 29th, 2012

My friend and colleague Tim Aiello sends me news that California has passed groundbreaking textbook legislation.

A crucial component of the California legislation is that the textbooks developed will be made available under the Creative Commons Attribution license (CC BY):

The textbooks and other materials are placed under a creative commons attribution license that allows others to use, distribute, and create derivative works based upon the digital material while still allowing the authors or creators to receive credit for their efforts.

The CC BY license allows teachers to tailor textbook content to students’ needs, permits commercial companies to take the resources and build new products with it (such as video tutorials), and opens the doors for collaboration and improvement of the materials.

In related news, Katherine Tyrrell commented on my blog recently about the Higher Education Act of 2008 in the USA:

This REQUIRES all educational establishments to define and COST all text books required for a course whether in print or online so as to allow a student to estimate the real cost of taking a course.

“The act mandates that textbook costs be available as part of any schedule of classes, whether online or in print. The intent of this act is to allow students to shop for the best price on textbooks and thus lower their costs. “


It seems that excessive prices of textbooks is something that has also been a major issue in the USA and that this has been addressed in part via this Act.

These are both really good things. I would like to know if there are similar plans underway in Canada.