Sunday, February 20, 2005

Book meme

By way of jfleck:
  1. Grab the nearest book.
  2. Open the book to page 123.
  3. Find the fifth sentence.
  4. Post the text of the sentence in your journal along with these instructions.
  5. Don't search around and look for the "coolest" book you can find. Do what’s actually next to you.
So, let's see what dear old Dan has been reading:
This is sometimes referred to as the backslash plague, and it is one reason why regular expressions are easier in Perl than in Python.
Yeah, sorry gentle readers who may have been looking for something more titillating. It might be interesting simply in that most of my work is actually focussed on PHP at the moment. The quote comes from Dive into Python by Mark Pilgrim, actually a wonderful text if you want to learn Python (or many other tidbits of general programming interest).

Sunday, January 30, 2005

Peru...

I roasted Peruvian this morning, without any significant disasters occurring. I had committed a cardinal sin and used up the last of my coffee yesterday, so I was in the position of not having rested coffee on a Sunday morning. But it wasn't quite situation critical: m'lady had planned a trip for us to Earl Bales park for a change of pace for our Nordic skiing, and she wanted to go relatively early in the morning. That left no time for lollygagging over a morning coffee, but it did leave enough time for a quick roast.

The gods were smiling, as the roast came out nicely to a second crack. There was a bit of unevenness in the beans, but I've been pushing too many into the Hearthware in the interest of being able to get 3 press pots out of a roast. Hmm, let's call it a nice mix to express the full range of the bean, shall we?

So we got in a quick ski at Earl Bales park -- a park with a split personality in the north end of Toronto. Earl Bales Park encompasses a ravine tall and steep enough that they've built a ski lift to support a downhill facility. How cool is that? In the middle of the largest city in Canada, in southern Ontario's flat farmland heaven, residents can take a bus to learn to ski and snowboard.

Of course, we already know how to ski, and we're not there for the hills -- we're there for the snow, sun, and the slide on our cross-country skis. The top section of the park overlooks the ravine, and this being our first time, we had no idea how large the park was. It turns out the top part consists of a one-kilometre loop at best. It's a kilometre of fantastic views over Toronto, of course, but not quite as much as we would have liked, so we stretched it out on some of the open park sections. Two interesting sightings for the day:

  • We met a couple and their Golden Lab at the ravine look-out, who tipped us off to the lower section of the park -- the flats that lead on to a golf course. We weren't into checking it out today, but we will return to check it out.

  • Tuck woman. A Nordic skier in full gear: toque, gaiters, basket poles, very slowly skiing over the gentle swells of the park, then going into a full tuck down the five-foot average descent. For a person moving in such slow motion, she radiated intensity: the kind of vibe you get from a serious yoga fiend, or perhaps a cult fanatic.


The Peruvian, by the way, was wonderful.

Saturday, January 29, 2005

Corporate Social Responsibility, according to the Economist

So this week's issue of the Economist has an article called "A sceptical look at Corporate Social Responsibility", so I snatched it up (at $6.95 news stand price).

The article primarily appears to be a response to the hippies, WTO trade protesters, and B.C. law professor who had shockingly advanced the idea that perhaps corporations should be required to consider more than pure profit as a guiding principle.

The article's twelve-page response can be summed up as:

Corporations' singular purpose of profit-seeking motivation maximizes benefits to society in general.

How does it come to this conclusion?


  • Supply and demand will naturally curtail resource consumption when we actually begin to run out of a given resource. Or it will encourage discovery of more reserves, or develop new technologies to replace existing reserves (prime example: copper cable replaced by fiber optics).

  • Protests against "unfair" labour or trade in third-world countries that curtails an organization's practices hurts the development of those countries and "artificially" drives up prices of those goods in Western countries due to a smaller pool of labour, ergo higher wages.



Augh, more later when I'm less tired and less cranky. The article read like a 1950's response to communism (which it invoked as the failed alternative to capitalism) and held an almost religious sense of faith in the "natural" power of the market to right all of the wrongs of the world -- if only meddlesome people with their concerns about resources and the environment and living conditions in other countries wouldn't try to alter the beneficence of the almighty dollar.

Argh.

Sunday, January 23, 2005

Bolivian coffee and demonic daemons

Roasting: Bolivian coffee

Bolivian seems to go directly to an oily French roast, with smoke filling the room. At least that's my experience while trying to write some simple scripts to generate random data this morning. It's probably not the fault of the beans: I was trying to slay some daemons with an irrepressible thirst for life.

You see, I'm documenting the PHP Data Objects (PDO) interface for database access, and I'm running DB2 on my system. Gotta test this stuff against a real database, you know. So as I'm running phpize to test the latest version of the PDO code, I notice it's taking a l-o-n-g time to run -- like, a minute or two rather than the 5 or 10 seconds it would normally take. WTF?

Check top. Ah, many little db2fm commands. db2fm is the DB2 Fault Monitor, a really poor man's high-availabilty tool. It's a daemon that watches your DB2 instances and automatically restarts them if they die an unnatural death -- which is fine and dandy. I don't mind that they automatically add it to /etc/inittab with a respawn parameter. Except every once in a while it goes nuts and starts burning massive amounts of CPU. I shouldn't blame it, it is a daemon after all, but when you're trying to accomplish something useful on your little laptop and you're waiting for simple commands to finish executing, it's pretty annoying.

Now, db2fm does have a command-line interface. But it's pretty cryptic:

$> db2fm -h
Usage: db2fm
include
-t Unique text descriptor for a service
-i Defines the instance of the service
-m Specifies the location of the GCF module
-d Brings the service down
-D Brings the fault monitor daemon down
-k Kills the service
-K Kills the fault monitor daemon

What's a service versus the daemon? I dunno. I try db2fm -d, db2fm -D, db2fm -k, db2fm -K, and db2fm -d -D -k -K -- none of them actually work. I try killing the processes as root, and that's a bad idea -- they just respawn, taking more CPU slices to recover their state (ugh). Oh, duh, I comment out the /etc/inittab entry to prevent them from respawning and issue all the command variants again. No dice.

So I started roasting the Bolivian beans before this little problem-solving exercise, with the intention of having nice hot caffeine-laden coffee to help sharpen my brain to slash through layers of abstraction. Instead, at this point smoke is filling the kitchen and I realize my morning-fuzzy brain has let things get to the point that our smoke alarm might awaken the still-slumbering lady of the house. This would be bad. I kill the roaster, open the kitchen window to the -20 degree (Celsius, which everyone except denizens of a single backwards country would assume) cold, and pre-emptively silence our smoke alarm.

So now, instead of cozying up with a hot cup of coffee and my hotter wife in bed after cranking out genius code for the greater glory of PHP, I have written not a single line of code, I have oily French-roasted Bolivian beans that will produce hardly any caffeine, I've dropped the temperature of the house by five degrees, I've raised my frustration level several notches, and I've started a blog to capture this precious moment in time.


(Apologies for the quality of my first post. This ain't the original. I previewed the original, then decided to add some HTML formatting, so I switched to "Settings" where I supposedly would turn WYSIWYG on and off, and then switched back to "Posting"--where, to my horror, the post had not been saved. Twenty minutes of work gone. Sure, it's a noob move, but it never had to happen. If the text field is full of text, it's probably a REALLY good bet that your user wants to save the draft of their post. Augh. Crankiness over and out.)