Categories
Geek

"Programming Pearls" online

Joe Mahoney, on his blog Cheerschopper, points to Jon Bentley’s site for his classic book on good programming practices, Programming Pearls. Distilled from his columns from the magazine Communications of the ACM in the 1980s, the advice Bentley gives is still good today. I’m glad to see that he’s included samples from the book to peruse.

Here’s a good one on debugging:

The expert debugger never forgets that there has to be a logical explanation, no matter how mysterious the system’s behavior may seem when first observed.

That attitude is illustrated in an anecdote from IBM’s Yorktown Heights Research Center. A programmer had recently installed a new workstation. All was fine when he was sitting down, but he couldn’t log in to the system when he was standing up. That behavior was one hundred percent repeatable: he could always log in when sitting and never when standing.

Most of us just sit back and marvel at such a story. How could that workstation know whether the poor guy was sitting or standing? Good debuggers, though, know that there has to be a reason. Electrical theories are the easiest to hypothesize. Was there a loose wire under the carpet, or problems with static electricity? But electrical problems are rarely one-hundred-percent consistent. An alert colleague finally asked the right question: how did the programmer log in when he was sitting and when he was standing? Hold your hands out and try it yourself.

The problem was in the keyboard: the tops of two keys were switched. When the programmer was seated he was a touch typist and the problem went unnoticed, but when he stood he was led astray by hunting and pecking. With this hint and a convenient screwdriver, the expert debugger swapped the two wandering keytops and all was well.

A banking system built in Chicago had worked correctly for many months, but unexpectedly quit the first time it was used on international data. Programmers spent days scouring the code, but they couldn’t find any stray command that would quit the program. When they observed the behavior more closely, they found that the program quit as they entered data for the country of Ecuador. Closer inspection showed that when the user typed the name of the capital city (Quito), the program interpreted that as a request to quit the run!

Bob Martin once watched a system “work once twice”. It handled the first transaction correctly, then exhibited a minor flaw in all later transactions. When the system was rebooted, it once again correctly processed the first transaction, and failed on all subsequent transactions. When Martin characterized the behavior as having “worked once twice”, the developers immediately knew to look for a variable that was initialized correctly when the program was loaded, but was not reset properly after the first transaction.

In all cases the right questions guided wise programmers to nasty bugs in short order: “What do you do differently sitting and standing? May I watch you logging in each way?” “Precisely what did you type before the program quit?” “Did the program ever work correctly before it started failing? How many times?”

Categories
Uncategorized

Deenster’s sister Lisa on what happened in Jerusalem

In her blog entry for today, my friend Deenster reprints an email from her sister Lisa, who’s living in Israel:

Abu Mazen condemned the bombing in classical Arabic, and sent his sympathy to the bereaved families. The Islamic Jihad claimed reponsibility, and a Hamas spokesperson told an Israeli TV reporter that as far as he was concerned the ceasefire -to which the Islamic Jihad was not a partner – was still on.

Then it turned out that the bomber, a 29 year-old father of two, was a Hamas member.

And now his wife is a widow, his children orphans. And the Israeli army will once again seal off the West Bank, meaning that other fathers with children to feed will be unable to get to work, and lots of people will suffer.

Who plans these things? And why? What in the world do they want to accomplish?

It’s summer and the beaches are packed, I go to parties every weekend, the outdoor cafes are always full (am I the only person in TA who works full-time?), the streets are full of beautiful, tanned people wearing very little clothing, the city is buzzing with sexual energy and life seems pretty good. So you really, really want the ceasefire to be real, and the Road Map to be meaningful, because peace is good and war is bad.

Right?

Lisa also notes the difference between news outlets’ coverage: Israeli news didn’t even cover the bombing in Baghdad, CNN led with the Jerusalem bombing and BBC World led with the Iraq bombing:

The BBC’s coverage of the Jerusalem bombing was typically outrageous: they spent about 2 minutes reporting on the actual event, then moved on to extensive talking head analysis of how this would affect the ceasefire and Road Map – with much tongue-clucking over how much the Palestinians were sure to suffer from Israel’s predicted revenge for the bombing.

Categories
Geek

"Achewood" imitates life

In the last Achewood comic strip, Roast Beef not only looks like me, he’s doing the sort of reading I’m doing.

But really, Beef, white briefs? Not boxers with pictures of polar bears on ’em?

Categories
Uncategorized

Kickass Karaoke tonight!

At the Bovine Sex Club. Good fun, cheap booze, great music, friendly crowd.

Categories
Uncategorized

Little Dee

Chris Baldwin, the author and illustrator of the terribly poignant, often deep and extremely adult Bruno, has created a new comic strip called Little Dee, which replaces Bruno until September 1st. Here’s the start of the Little Dee run.

The only similarity between the two strips is that Dee looks like a little version of Bruno. Aside from that, it’s completely different: Little Dee is about a girl who gets lost in the woods and ends up being cared for by a friendly bear, a vulture and a dog who’s broken free from the domesticated life. Where Bruno is all angst and Weltschmerz (and hey, ain’t nuthin’ wrong with that), Little Dee is light and cute.

And hey, I’m a sucker for friendly cartoon bears.

Categories
Uncategorized

Even in the darkness, the accordion shines through

From Saturday’s Globe and Mail:

Forced by the blackout to move away from the TV, everyone then had a chance to express their disdain for it. This is another common theory tonight. At a dimmed bar called the Village Idiot, a woman named Judith Coombe is listening to a man on an accordion sing an AC/DC song that includes the lyric, And I’ve got the biggest balls of them all. She likes the new darkness. “It’s so amazing. So quiet. It’s nice that people don’t have to watch TV or the Internet. It’s nice to force them to interact.” You also can’t get money, and you can’t spend money much of anywhere, except in a bar.

Thanks to this (unfortunately anonymous — hint, hint, powers that be at Blogware) commenter for pointing it out to me!

Categories
Uncategorized

"The Best Of…"

I’m going to have a “Best Of…” set of links in one of these sidebars sometime soon, but after having received a couple of email requests over the past few days, I’m going to post a few right now.

In reverse chronological order…

Worst Date Ever

A multi-part story that I haven’t finished telling. The story takes place in 1999; I’m telling it because I promised I would if I were nomianted for a Bloggie.

What’s been told so far:

1. Begin near the end. In which your humble accordion-playing author violates the laws of the space-time continuum and starts the story after the fireworks are pretty much over. Most of them, anyway:

If life were a cartoon — and it often is — there would be two miniature versions of me sitting on my shoulders. One would be dressed in white with wings and a halo saying “Do you think this is such a good idea, Mr. deVilla?” while the other would be dressed in red with horns and a pitchfork, doing pelvic thrusts and saying “British Invasion! FWOOOOOAAAAARRRR!”

2. A little background. How I met The Waitress during the Worst Year Ever, while attempting some sort of detente with the Then-Worst Girlfriend Ever:

Hers was a dysfunctional family, and the fact that my family was close — we are Filipino, after all — she alternately saw as a sign of immaturity, a sick dependency or a threat. As revenge against her parents, she one day (and remember, this is after our breakup), decided to give me power of attorney.

A year earlier, she’s decided to switch to a sort of made-up religion: a muddle-headed mishmash of wicca, crystals, aromatherapy and eye-for-eye karmic point-scoring (from the way she carried herself, she seemed to be exempt from karma accounting). Naturally, anything Christian — the religion of her parents — was by definition bad. She was doing a lot of flying that year, and like any superstition-prone fool with less rational scientific thinking skill than a bed of kelp, she was sure that she was going to die in a fiery plane crash. She told me that she had faith that I would honour her burial wishes because I was nice to her even when she was “being a total bitch.”

All that did was fuel dark power of attorney fantasies. I imagined a funeral theme that could only be described as “Maximum Jesus”. I wrote a script in which I would visit a hospital immediately after an accident. It went something like this:

Doctor: Mr. deVilla, she…she’s…

Me: Tell it to me straight, doc. No sugar coating. I can take it.

Doctor: She’s scraped her knee.

Me: I HAVE POWER OF ATTORNEY! I KNOW HER WISHES! NO HEROIC MEASURES! D.N.R.! PULL THE PLUG! PULL THE PLUG!

I remember saying to my sister: “I don’t even have the luxury of wishing she was dead, because I’d be stuck with all the paperwork.”

3a. Meet The Artiste. I introduce the waitress’ boyfriend, a sculptor who doesn’t sculpt:

I call him The Artiste with the extra “e” not out of any disdain for artists, but he was more a graduate of art school using his artist status for street cred rather than someone who say, actually created any art. He had the image — the perma-stubble, the drab clothing, the Elvis Costello glasses and especially the 16th-century personal hygiene. Although he sometimes talked about his works in progress, we never saw any sketches nor did he tell us where we could see his works. He ran around with the small “shock value for shock value’s sake” clique from Ontario College of Art and Design, a group who counted among their number post-post-post-postmodernist Jubal Brown — the prat who vomited on paintings as a some kind of performance-art/artistic-statement/cry for help sort of thing.

3b. Meet Crabs. C’mon, you can’t resist a story that has this line near the beginning:

“And it dawns on me, while I’m doing it,” continued Crabs, “I think to myself: ‘This guy has offered to give me a ride home and I’m peeing on his face.'”

4. Date #1: My fault. I accept full responsibility for the way this one fell apart. Mind you, Date #3, which hasn’t yet be chronicled, is totally her fault. This one’s got it all — cheesy foreign accents, adult situations, violence, butterscotch schnapps and ABBA! Besides, how many dating stories have gripping narrative like this:

I pressed my hand on his Adam’s Apple with more force. I wanted him to remember this. I wanted to him to wake up in the middle of the night from Joey-induced night terrors for the next week in a vile puddle of his own sweat and urine.

Bring it on. Why I take crap in stride.

The Girl Who Cried Webmaster (a.k.a. The new Girl Story)

Accordion boy meets New Girl. Accordion boy gushes about New Girl on weblog. Accordion boy gets contacted by Whistleblower, who tells him that the New Girl is not who she claims to be. The strangest story ever posted on this blog, complete with drama, detective work, a child-abandoning drug-abusing mom posing as a webmaster, the kindness of strangers, inspiration by Columbo and Encyclopedia Brown and computational complexity theory. This entry put this blog in the number one spot on Blogdex, Popdex and Daypop, and is now the holder of the record for most — and nicest — comments.

Last Night

Striking out, thwarting a pickpocket, coping with bad poetry, dealing with the Gap ninjas and other minor diappointments. At least when things suck for me, they suck in novel and interesting ways.

Mandatory “Cheese Sandwich” Entries

Part one and part two of a two-part story chronicling one particularly good day.

A very good Wednesday, indeed

Successful job interviews, helping out on the set of a film, chatting with cute girls, and sticking it to a telemarketer. I’m the King of Rock.

Naked News throws a party

…and I got invited!

The best Christmas present ever

A tale of friendship, crab lice and the true meaning of Christmas. Not likely to be turned into a TV Christmas special any time soon.

The big three-five

Happy birthday to me! 120 of my closest friends get together to celebrate.

Not-so-smart mob

Conversations and observations from the 2002 Reclaim the Streets party in Toronto. Their hearts are in the right place, but their heads might need a little work:

Bible-thumper: Please, take one (proffers a pocket Bible).

Man: (looking at Bible and recoiling, as if he were being handed a severed human head) Yiiiii!

Me: It’s not toxic. (To Bible-thumper) I’ll take one, I lost mine (I take it and put it in my pocket).

Really, I can’t find my copy. Some fundie friends of my parents gave them a gold-leaf trimmed copy of the King James version (“the only true version”, they said), which my folks then gave to me. It usually sits on my bookshelf beside the Bhagavad-Gita and for extra-flaky contrast, the Urantia Book. Did I lend it out to someone? I can’t recall.

Man: Not my scene. I’m a Buddhist.

Me: That doesn’t rule out reading the Bible. Buddhists consider the teachings of many other religions valid. They consider Christ to have been enlightened.

Man: No shit?

Me: Ever read Living Buddha, Living Christ?

Man: Um…never even heard of it.

Of course not. I decided to adminsiter the “Are you really a Buddhist, or are you doing the religion-as-fashion-statement thing” test.

Me: You know the Four Noble Truths, right?

Man: Uh…I’m still new at it…life is suffering, um…

Me: There’s the one with desire…

Man: That it! Desire sucks…then the eight paths…

I can see Siddhartha himself saying, “Yo! Desire sucks, dawg!”

Read the story, see the photos and check out the discussion that ensued on BoingBoing.