Sunday, October 21, 2012

The text is wonkier than the word

For years I've wondered how to get students to reliably submit something I think of as standard text.  Not html or mime documents that will display differently according to what I view them with, but the modest expression of concepts using the 128 characters (mostly upper- and lower-case Latin alphabet, puncuation, digits, and special symbols) of the ascii format.

This becomes particularly maddening when all I want is a few dozen characters --- say the URL of a website.  How can I make sure that the URL isn't hidden deep inside the html formatting of somebody's favourite email app?

Something that works 95% of the time is to ask for the URL to be in the Subject: line of the email.  This line is forced to be in plain text by the mail software.  Sure, a few students will still ignore the instruction about the Subject: line, but most submissions will be in plain text.

My next challenge: how to communicate that the useful URL for a blogging site is the public address, not the address that the blog author uses to modify the site.

Saturday, September 22, 2012

Programming parenthetically

Part of a course I'm teaching on the Why and How of Computing (not the High and Wow of Computing as I sometimes imagine) is a gentle introduction to programming.  The idea is that to fully grasp the culture of we geeks, you must grasp our obsession with problem-solving.  We usually write our solutions down as algorithms, often in formal programming languages.

This semester I've been using a particularly user-friendly environment called DrRacket that lets the user choose from a tower of languages from beginner to expert.  The idea is to have level-specific capabilities and error messages.  I was skeptical until I noticed that common mistakes seem to get meaningful error messages.  For example, if I try to define a function with parameters (place-holders) that are literal numerical values, the error is

define: expected a variable, but found a number

... considerably more informative than the generic invalid syntax I find in another language used by beginners.

This, and other features of the DrRacket environment made me hopeful that my students would find it approachable.  I was still worried about my discipline's tendency to work from manuals and texts (even when these are online), whereas techniques as diverse as biochemistry and banjo picking are taught via video tutorials.  I decided to make a few introductory videos (very labour intensive, it turns out) available to get my students started.

Something must have worked.  My first quiz was meant to enforce the related tutorial exercise: work the exercise and you'll ace the quiz.  I left a generous amount of time for the first quiz, and asked them to evaluate a variety of expressions involving images, arithmetic, strings, and true/false.  I hoped most would get perfect, but assumed that there would be a combination of late-comers and some assuming that the work of the course hadn't started yet, and that they would contribute a significant portion of 0/2 or 1/2 scores.  What happened was that the quizzes were returned in record time (2 minutes, roughly) and are overwhelmingly correct.

It's always strangely surprising when something works out.

Full binary chocolate trees

Something weird happened on the way out of lecture.

I had presented two problems in complete induction, a proof technique. The first was about full binary trees --- trees in the graph-theory sense with nodes that have either 0 or two children. The second was about how to break up chocolate bars.

 I should have suspected there would be a connection when I remarked, a couple of times, that "non-empty full binary trees" was quite a mouthful: the result to be proved did not apply to a full binary tree with zero nodes (an empty full binary tree, so to speak). Except for the zero case, full binary trees have an odd number of nodes, and we prove it using the fact that subtrees are also full binary trees.

 The chocolate result is that you can break up a rectangular array of n chocolate squares into individual squares with n-1 "breaks." Breaks have to cleave right across, either lengthwise or widthwise, and although the result applies to a somewhat wider class than rectangular arrays, you can find counterexamples if you allow weird cases of three chocolate bars pasted together precariously on their edges.

 I'm working my way through a line of students after class who have questions or comments. One is staring into space, so I ask what's up. "I'm thinking about graph theory." The student draws a tree with the original chocolate bar labeling the root and as you break it into two, you label the two children with the resulting bars. And so on, until you have individual squares.

 The resulting tree is a full binary tree. A non-empty one, since who would go about breaking up zero chocolate squares? Applying the chocolate result to trees we see immediately that a non-empty full binary trees have one more leaf than internal node.

 The most wonderful part of the encounter was that my student assumed that I was leading the class toward this connection when I presented the two topics together. I hadn't, but I was flattered by the assumption.

Tuesday, April 17, 2012

Moving pictures ... and code!

I decided to put some of my exposition in racket into video form. Of course, I expected to spend twenty times as long editing, re-taking, tweaking, and then starting over again, as there were seconds of video. And, of course, I should have expected fifty times as long.

It's probably worth it to reach a segment of the population who are impervious to the standard narrative of a lecture, or a typed page. Having watched my own kids browse through movies until they know the narrative and dialogue backwards, forwards, and sideways, I figure that's how some people will want to attack explanations of programming.

So, we'll see how it goes.

Saturday, December 31, 2011

Ukrainian for gymnastics purporses
the power of working-class song

Years later when I was a chemist for the purposes of immigration, I began to understand that your being really is determined by your doing.

Laura, with Jewish and Finnish ancestors, was as Ukrainian as my sister Suki (Scottish, German, Irish, etc.) and I were. She took us to the Ukrainian Hall for gymnastics: long rolls, handsprings, and precise landings. Line up, run to the mat for your move, then line up again. Other gymnast kids had French Canadian or Russian ancestors, and there were almost certainly some Ukrainians. Our joint Ukrainian heritage was the joy of challenging our muscles and learning to do something that we were proud of.

After an hour and a half we had trained enough. For the rest of Saturday morning we had a choice of learning mandolin or working-class songs. I picked the latter, since it seemed easy: I already knew a bunch of working-class songs from home. Sure enough we sang Die Gedanken sind frei and Kevin Barry. Our Ukrainian souls channeled German free thinking:
Foundations will crumble, and structures will tumble

... or the Easter Uprising:
Turn informer and we'll free you, proudly Barry answered: no!

Multiculturalism hadn't been contrived yet, and this version of Ukraine seemed more authentic than the alternative: pogroms and xenophobia. The Cold War was on, so just by singing and doing gymnastics at the Labour Temple at 300 Bathurst, we chose our side. Saturday morning Ukraine was internationalist, as Ukrainian as Africa, Germany, Ireland, or Vietnam. The other Ukraine was visible on the repaired masonry on the south wall, where a nail-studded bomb had exploded years before.

So, as a young teenager, I was enormously impatient when Grigory wouldn't choose a side in Quiet Flows the Don: first Red, then White, then not White anymore... Sure, revolution was frustrating and ugly. In one passage, soldiers chant "Red Army: at the service of the working class!" Given the ebb-and-flow of the novel, given the disappointments, defeats and betrayals of subsequent decades, it would be natural to snicker. But yet...

My dad, and mum, were recently in a desperate conflict with the retirement home that acted as both their landlord and care provider. Members of our extended family, and friends, slept on the floor of my parents' room for 25 days, to prevent them from being informally evicted as unprofitable residents. Each morning staff were surprised to find a new family member sleeping just inside the door. My sister Eleanor explained the situation to a staff member, and was met by the response: "defend your father, he's a working man!" Eleanor wanted to know how the staffer knew dad was a working man, since it had been several decades since he had worked in a factory, and his manner didn't seem particularly blue-collar. "I heard him singing labour songs," the staffer replied.

So, those working-class songs can come in handy. Slogans too. Sure, there have been cutbacks and heartbreaks, disappointments and betrayals, Thatcherism, Reaganism, bank boondoggles and layoffs. The working class sure could use an army at its service, but it doesn't have one just now. Maybe there's just us. Maybe, on my very best days, I can tell myself: "Dannny Heap, at the service of the working class!" My Ukrainian gymnast heart sings.

Dogs get stuck

In hindsight, I can't blame my dad for being confused. Nipper had on not only Kotex pads, but a weird system of elasticized belts. She had been kept inside each time she went into "heat" previously, and had reached the ripe age of 11 (77 in dog years) without having a litter. My dad thought that our dog was tangled in the elasticized belts.

I knew better. Dog ownership was much more cavalier in those days. I didn't pick up after our dog had a dump in the park or by the roadside, but neither did anybody else, so far as I could tell. I had seen our dog, Puck (of Pook's Hill), mount female dogs. I had seen the two dogs stuck afterwards, facing in opposite directions for a quarter hour, looking distinctly embarrassed and uncomfortable. Lots of people would crowd around, proposing throwing on hot or cold water. I asked them to wait while I called the Human Agency and got advice. The Human Society explained that male dogs got a lump in their penis that took a while to shrink, about 15 or 20 minutes.

Litters were astonishingly large --- 12 puppies in Nipper's case. Sure, the owners of the male dog might suggest some homes for the puppies, but the burden fell disproportionately on the owners of the female. I can't really blame Nipper's owners for keeping her in for 11 years, but I'm not surprised that she escaped.

So, I explained the facts of life to my dad: it's not elasticized belts; dogs just get stuck.

Monday, December 26, 2011

Careful with cops

I had mixed feelings about Lucky (Fortunato) Rao announcing over the bullhorn that "they've arrested a baby!" At fifteen, I certainly didn't feel like a baby, but the result of Lucky's announcement was that the squad car was surrounded by strikers, and strike supporters, and then rocked to within an inch of what the shocks could absorb. The officer in the front seat radioed frantically for reinforcements.

Gidon Industries produced mufflers in the far reaches of Rexdale, quite a trek for my sister Suki and I from downtown Toronto. Gidon had hired Driver Pool to recruit strike-breakers and drive them at high speed across a picket line that striking Gidon's employees had set up. Strike-breakers huddled inside Driver Pool cars, while the drivers knocked over strikers as they roared through the line. Suki and I were among strike supporters helping the small Steel Workers' local at Gidon exercise their right to bargain without intimidation. Part of bargaining meant communicating with would-be strike-breakers to convince them not to cross the line, which required the crowd to hold each car in place for a few moments of intense conversation. Since the Driver Pool drivers were trying to ram through the picketers, holding a car in place involved some vigorous rocking. Some parts of some cars' trim didn't make it through, presumably part of why Gidon paid Driver Pool the big bucks.

Just after one such scrum, I was collared and pushed into the back seat of a police car, along with a striker who didn't look much older than me. Several minutes of the crowd rocking the squad car ended when police reinforcements arrived and made a path out. I ended up in a west-end cop shop with two police, one being the officer in charge of juveniles (like me). The juvenile officer gave me stern lectures on how much damage I had allegedly caused to the Driver Pool vehicle. The other officer made friendly digressions into how enlightened labour disputes were in Australia. I didn't really know how to respond to either, so I didn't.

The officers wouldn't release me into the custody of my sister, even though she was an adult. They insisted on summoning my mum, who arrived very late for work, and very annoyed. She had a note passed in to me: "Danny, don't say anything to the police, since they will try to get you to say things that can be used against strikers who are old enough to be tried as adults."

She had nailed the situation exactly, almost as if she had watched the Good Cop/Bad Cop routine the two officers had used over the last few hours. I remain in awe of her judgement.

My situation was sorted out in Juvenile Court some weeks later. The law at that time involved determining whether one was, or was not, a Juvenile Delinquent. This meant considering your family situation, your school situation, and (most notably) no real evidence of any crimes committed or otherwise. Coming into police custody was enough to bring you before the court. I was terrified of the tales I had heard of the treatment newcomers got at Bowmanville, so I was very relieved to get a suspended sentence. The judge did ask me what I was doing at 6 am in front of Gidon Industries, so I told her. After I left I realized that I hadn't asked her what the vehicle I had supposedly vandalized (some company different from either Gidon or Driver Pool was named owner) was doing there.