The Advisory Boar

By Abhijit Menon-Sen <ams@toroid.org>

Leave copyright notices alone!

2010-04-07

Near the beginning of every new year, there is a flurry of activity in open source projects as their developers perform the ritual update of copyright dates in the source code. Here's one example of many, from PostgreSQL:

commit 07c05fef8794be091fd2f271f3a500a152f1712c
Author: Bruce Momjian <bruce@mmmmmmm.nn>
Date:   Sat Jan 2 16:58:17 2010 +0000

    Update copyright for the year 2010.

 COPYRIGHT                                          |    2 +-
 configure                                          |    4 ++--
 configure.in                                       |    2 +-
 contrib/adminpack/adminpack.c                      |    2 +-
 …
 1053 files changed, 1061 insertions(+), 1061 deletions(-)

Everyone does it, because everyone's always done it. Too bad it's a complete waste of time.

There are good reasons to include a copyright notice somewhere in your source code, even though they are no longer mandatory under the Berne convention. A dated notice makes it clear to anyone who sees the code that it is under copyright, and who the owner is; and it provides an indication of how long the copyright protection will persist.

The date in copyright notices is supposed to be the date of first publication. Copyright protection for the work begins at that time and extends for a fixed period. The continued existence or republication of the work in subsequent years obviously has no effect on the copyright term. It makes sense to change the date only if you are publishing a new work that will receive copyright protection independently from the work it was derived from. Minor incremental changes to the original do not qualify.

A major new version with many changes may qualify (whether it does or not is a matter of fact, not law), but even so, it makes sense only to update the copyright notice at the time of release, not every January; and the new notice should mention only the current year, not add it to a list of years gone by. It makes no sense whatsoever to include a range of dates:

-Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
+Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group

A related problem is that people like to spread copyright notices and other boilerplate nonsense all over their code. There are always parts of every source tree that are only ever touched by the ritual annual copyright update.

(Yes, I've spoken to more than one lawyer about this.)

Perforce did not suck

2010-03-27

I've noticed that a lot of people in the open source world have a negative opinion of Perforce, whether they've used it or not. Here is one recent example:

There's also Perforce, which I don't know much about, but I gather it's a crappy proprietary centralised VCS which is worse than Subversion in pretty much every way.

This kind of offhand dismissal by people who are not familiar with Perforce is very common. When we were switching from Perforce to git for the Perl 5 source code, a lot of people assumed we wanted to do it because Perforce wasn't good enough (but it was really because the open source licensing procedure was non-trivial, and the lack of anonymous repository access was seen as inhibiting contributors; there were also objections to depending on a free-but-not-Free program).

There are other people who have used Perforce and not liked something about it. Their opinions range from reasoned critiques to poisonous rants:

[Dear Perforce… ] Fuck you, you miserable, untrustworthy, misleading, overpriced bastard. I hope your office goes up in flames along with all your off-site backups. I pray that some open source product that actually works is embraced by all the major companies and drives you out of business. I hope that no other company is duped by your salespeople into thinking you have something even remotely close in quality to the ancient and craptastic product known as CVS. Never before have I experienced so much pain in the most simplistic of version control tasks as I have since starting to work at a company that made the mistake of considering you.

I used Perforce exclusively for many years, both for large projects with many other users and small personal projects, and my experience with it was very different. I loved Perforce. I found it refreshingly simple to learn, it worked fast and unsurprisingly and well, and it had excellent support and documentation (of the kind that few open source programs of any kind have, even now). I encountered only two or three minor bugs in it after several years of use, and I never once had to fix the repository (a welcome change from CVS).

There are, of course, many valid criticisms of Perforce, and my intention is not to defend it against those. I've suffered from some of its problems myself: its (mostly justifiable) dependence on the network was at odds with my very slow dialup link, p4p (the proxy) didn't work very well for me, some administrators I know had problems configuring their server the way they wanted, and so on. I switched to git myself a few years ago, and later helped other projects (Perl, Archiveopteryx) I cared about to move away from Perforce too. I haven't regretted the change.

But Perforce certainly did not suck, and there are some things I still miss about it. As non-distributed VCSes go, I think Perforce is vastly better than the (many) other programs I've used.

An experiment in writing faster

2010-03-17

I've always enjoyed writing, but it's only in the past year or so that I've forced myself to write regularly. The practice is paying off, the principal difference being that I consistently write much faster than I could before. I've also been able to identify and correct a number of problems with my writing that may have otherwise gone unnoticed.

Thanks to some bad habits I've developed, however, there's still plenty of room for improvement. For example, I tend to rewrite things to make the right margin of the paragraph line up "nicely", which is an absurd waste of time. Sometimes, I get stuck at a particular sentence or paragraph and tweak it endlessly rather than moving onwards.

Years ago, I read about a program whose minimal interface was modelled on a typewriter. It presented a blank screen, with nothing to distract from the process of writing; and it had minimal editing capabilities, to avoid the temptation of rearranging text. I can't remember what that program was called, but there is more than one like it (e.g., Writeroom and OmniWriter for OS X, and a few clones). Most of them have more features than I can remember reading about.

I spent an hour or so writing a similar Qt program. It was surprisingly easy (thanks to some advice from my Qt hacker friends Arnt and Brad): I created a QWidget, called showFullScreen() on it, gave it a QPlainTextEdit child displayed in the centre of the screen, and wrote a few lines of code to load and save files. The QPlainTextEdit class provides minimal editing capabilities, which suits me fine. I named the program wry, and I've been using it for some months now. (The source is at github.com/amenonsen/wry for the incurably curious.)

Digression: I'm very pleased that Unicode text "just works" in wry. I can display Markus Kuhn's UTF-8 demo with none of the ugly problems I've had with xterm in the past. For Unicode text input, I set up ~/.Xcompose so that I can compose any character I want, but I miss vim's :digraphs command, which would show me the available options.

Using wry was slightly frustrating at first, but once I got used to it, it worked very well. The enforced lack of distractions helped me to put down more text more quickly; and it was easier and faster to edit things later when I was looking at several paragraphs rather than one sentence. Since wry uses a proportional font and rewraps text as it likes, I could no longer waste time trying to align the right margin.

Someday, perhaps I'll be cured enough that I can write properly in vim without succumbing to the temptation of editing, but until then, wry is the perfect set of training wheels.

Temporal modifiers in Delhi

2010-03-06

I've noticed a strange quirk of Delhi English—people say "until" when they really mean "while", and are oblivious to the inverted meaning of the resulting sentence. It sounds so wrong that I find it hard to think of an example:

We can't go out until it is raining.

There's a related (and perhaps slightly more common) but even more bizarre-sounding variant that has an extra negative:

We can't go out until it doesn't stop raining.

(In neither case does the speaker want to go out into the rain.)

I guess the root of this confusion lies in the translation of the Hindi phrase "जब तक" to "until" when it is often used to mean "so long as" (especially in conjunction with an extra negative; see below). Substituting the latter translation usually fixes problematic sentences. We can't go out so long as it doesn't stop raining sounds tortured, but the logic is sound.

Unfortunately, my grasp of Hindi grammar is not nearly subtle enough to judge which of the translations is more correct, and when. Taken in isolation, it seems to make perfect sense to translate "जब तक" as "until", but that's not how the phrase seems to be used. If I want to say We can't go out until it stops raining in Hindi, I have to add a negative and say “… जब तक बारिश नही रुकती ” ("… जब तक it doesn't stop raining"), which implies that "so long as" is the better translation. If I leave out that negative and say “… जब तक बारिश रुकती है ” ("… जब तक it stops raining"), my sentence feels incomplete and the "जब तक" seems to mean "by the time" more than anything else.

Is it ever correct to translate "जब तक" as "until"? I don't know whom to ask.

Oh well, so long as next time!

Update (2010-04-10): I asked a number of people who speak better Hindi than I do, and none of them were able to think of an example where "until" is the appropriate translation.

Do Supreme Court judges live in an alternate universe?

2010-02-26

Today, the front page of The Hindu features an article about the Supreme Court allowing the state of Madhya Pradesh to continue with the construction of the Indira Sagar and Omkareshwar dam projects, overriding a prior restraining order by the state High Court. About halfway in, the article quotes the Chief Justice K. G. Balakrishnan:

At one stage the CJI asked Ms. Medha Patkar not to have a cynical approach towards large irrigation projects as the projects will benefit thousands of farmers and agriculturists.

I find it difficult to imagine how a supreme court judge can sound so oblivious to the horrendous track record of large irrigation projects across the country, and the profound social and environmental damage they have caused over the past fifty-odd years, and continue to cause to this day. Where exactly does he see cause for optimism?

Justice Balakrishnan has, in recent times, expressed a few bizarre opinions. Perhaps the most unpopular was his insistence that his office was not subject to the provisions of the RTI act because the CJI is a "constitutional authority" and not a "public servant". This position drew widespread criticism, including gentle but unequivocal disagreement from eminent former SC jurist Mr. V. R. Krishna Iyer; and the Delhi High Court also held otherwise, in a remarkably cogent ruling last month.

(Strangely, today's paper also features a surreal op-ed piece by Mr. Iyer, who dreams of peace between India and Pakistan beginning with a resolution that all Indians and Pakistanis believe in the worship of all versions of god in deep devotion and culminating in the formation of an Indo-Pakistan federation with a joint parliament and supreme court, a common defence force, and a single cricket team! But the man is ninety-four years old, so perhaps he's entitled to a few unsettling dreams. That defence does not, however, apply to Justice Balakrishnan, who is a relatively sprightly sixty-five.)

Last week, the full bench of the Supreme Court unanimously rejected (for the fifth time) the Law Commission's suggestion that four regional benches of the SC be set up in addition to the existing bench in Delhi. This long-standing popular demand in the south would benefit thousands of people who could not otherwise bear the cost of approaching the highest court so far away from their home. The vigilant Mr. Iyer has also written about the importance of judicial accessibility—If democracy is for the people, the Supreme Court should function where the litigants need it most, not where the British for their imperial reasons chose to locate it.

But the CJI had commented last month that we should maintain the integrity of the Supreme Court, and the twenty-six other judges apparently agreed that it would negatively affect the country's unitary character.

Sometimes I wonder if there's an alternate universe in which India was created in order to serve its Supreme Court.

Not feeling cold

2010-01-03

For as long as I can remember, I have resisted being bundled up in woollens during winter. When I was little, I could be bullied into wearing warm clothes, but ever since I was old enough to refuse, my answer to Aren't you feeling cold? has generally been No. Every winter, however, the subject comes up again, and people, often complete strangers, see fit to speculate on or lecture me about low temperatures and my physiology.

“But I Thought You Didn't Feel Cold”

In high school, I could understand people who thought I was faking it to impress my shivering schoolmates, but over a decade later, suspicion is still the most common response.

Every now and then, I'll say something like Hmm… it's colder tonight than it was yesterday, and someone will say But I Thought You Didn't Feel Cold (with audible capital letters and a look of triumph at having caught me out at last). But that's not how it works. I am aware of the cold—in fact, I'm quite sensitive to changes in temperature—it's just that lower temperatures don't make me uncomfortable.

Read more…

Ulnar neuropathy

2009-12-28

For the past several months, I have suffered from a damaged ulnar nerve in my left arm. I'm recovering slowly as the nerve regenerates, but it's been long enough that I am no longer impaired by the injury.

My best guess about how the nerve was damaged in the first place is that it happened when I twisted my elbow because my mother's well-meaning but dim-witted Golden Retriever puppy jumped on me while I was doing pushups back in June. I woke up one morning (a few days afterwards) with a mild tingling in my little finger. The tingling intensified rapidly, and the finger became numb the next day. The pattern of numbness in the little finger, outer half of the ring finger, and outside of my palm made it obvious that the ulnar nerve was affected. When the numbness turned into stiffness a day later, I sought medical advice.

I don't get along very well with doctors, so "medical advice" meant speaking to my physiotherapist friend Gautam, who happened to be in town at the time; but even he advised me to see a doctor. I went to a general physician, who had me take a blood sugar test to eliminate diabetes as a possible cause (which it did), and asked me to see a neurologist soon. I reluctantly went to see one at the nearest hospital a day or two later.

Nerve conduction study

After much poking and prodding, he said more or less what Gautam had already told me: I had "cubital tunnel syndrome", where the ulnar nerve was compressed at the elbow. There was nothing for me to do but wait and rest my arm to avoid making things worse. He also asked me to undergo a study to measure the nerve conduction velocity in the affected nerve.

Read more…

I still miss Bertie

2009-10-27

I was driving home the other night, and I noticed that a car ahead of me at a traffic stop had a small white head sticking out of the passenger window, with round black eyes and a nose peering through a fringe of frizzy fur. A newspaper boy walked past the car, smiling broadly at the friendly little Lhasa Apso who sniffed at the evening paper, neck outstretched and front paws braced on the window-frame.

In the eighty-one seconds that remained on the red light, I remembered the terror that Bertie used to inspire at traffic stops, even behind a closed window. People selling newspapers or cellphone chargers and kids begging for change would all go out of their way to squeeze past other cars so that they wouldn't have to pass mine. I would see them in the rear-view mirror, standing at a respectful distance but daring each other to go closer. Once in a while, a particularly brave or foolish one would succumb to peer pressure and tap on Bertie's window.

Usually, all he had to do was turn his head, and they would beat a hasty retreat. If not, all I had to do was roll the window down. Bertie rarely needed to expend any further effort. (Sometimes, though, he would take a strong dislike to someone and snarl at them, perhaps even bark if he was particularly annoyed. Nobody ever stayed around long enough to find out if he would really have bitten them.)

But Bertie used to get smiles too, at least when the car was safely in motion. A friend who once followed our car home once told us about all the people who turned to see his big head sticking out of the window, tongue hanging out and ears blown back by the breeze. Once, a shepherd in Garhwal ran alongside the car, yelling happily, It's a Lion! It's a Lion! Bertie must have approved of this sentiment (which was expressed by many people), because he would always be at his calm and dignified best at these times.

Sometimes, on the rare occasions when I wasn't driving, Bertie would wedge himself between the front seats, balance precariously with his paws on my leg, then hop over into my lap, all forty-five kilograms of him. He would drape himself over me as best he could, and I would hold on tight, my face full of fur, squeezed between the seat and his bulk. Every few minutes, he would slobber over my face, or rearrange himself by trampling on delicate parts of my anatomy. He often sat in the front seat by himself when I was driving (but he usually preferred the back). I even put the seat belt on him a few times, but he didn't like it much.

Once, on a particularly foggy morning, someone pulled up beside the car (on the passenger's side) and asked him for directions. Bertie turned his head a little, but remained still. I replied without leaning over to the passenger's side or even moving my head much, and the man nodded his thanks and drove away.

It's been two years since Bertie died. It feels like yesterday.

Creepy Camping Companions

2009-09-27

We just returned from a very quick camping trip to the Kumaon hills. The weather was persistently cloudy, and visibility so low that I was never close to the view of the snow peaks that I had hoped for. My camera stayed in its bag, the birds stayed hidden in the forest, and my attention strayed to the other creatures lurking around us.

Annelids

We camped on the crest of a ridge that separates two valleys, carrying supplies up the hillside. In this season—so soon after the monsoon—the thick, moist undergrowth was home to many friendly leeches. Friendly, hungry leeches. Ammu saw a thin, thread-like one somersaulting up the rock she was sitting on, and didn't know what it was; but I knew, and started checking my socks obsessively.

I became quite attached to three or four leeches over the next couple of days. Two of them drank their fill and disappeared without my ever being aware of them, but I caught one that had dropped off to digest its meal in my sleeping bag, and disturbed one that was drinking messily through my thin cotton sock. The second one was larger, perhaps 4–5cm long and shaped like a flower-vase with a long, thin, mobile neck and a bulging, rounded bottom. It must not have fed enough—when I nudged it with my sock, it immediately stood up straight, waving to and fro, trying to reattach to whatever mammal it probably assumed had touched it.

I sprinkled salt on both, feeling vaguely guilty when they exploded in a spectacular gush of (my) blood.

Plants

Leeches were not the only new friends we made in the undergrowth. I also found a plant with pretty green catkins… covered with fine, translucent, almost invisible thorns. When I brushed a slender branch out of my way, I discovered the thorns, and that any contact with skin was sufficient to cause an intense burning that took a long time to fade. Scratching, I learned, was a very bad idea. The profusion of these plants along a trail I wanted to follow soon convinced me to turn back, even though my hands were the only skin that I was exposing to them.

On a previous visit to approximately the same area, I discovered another interesting plant which has thorns sticking straight up from the surface of the larger leaves in addition to the thorns on its stem and branches. It had small spherical fruits—the ripe ones a bright lemon yellow, and others mottled light and dark green in an attractive pattern somewhat like a watermelon. I renewed my acquaintance with this plant too—but not, thankfully, by sitting on it as I had done last year.

I also saw—from a respectful distance this time—a nice Thistle-shaped plant covered everywhere with sharp and surprisingly stiff (I couldn't resist checking) thorns, even its perfectly round seed-head.

I can't reliably identify these plants. The first must be related to the Stinging Nettles Urtica sp., even though its leaves (palmate with a serrated edge) didn't quite match textbook descriptions. But Stinging Nettles are well-known in Kumaon, where they are called the Scorpion herb (shrub?), and their boiled leaves are eaten as a vegetable.

Arthropods

Fittingly, however, arthropods comprised the most numerous and varied of the creatures at and around camp. There were mosquitoes, of course, but not so many as to be a real problem. There were small black-and-yellow striped midges and big metallic-green flies (which distinguished themselves mostly by not sucking my blood).

After the camping trip, we went to a KMVN tourist rest house to shower and relax before heading home. It was off-season time, and nobody had stayed in the cottages for a while. We could tell, because they were crawling with spiders.

Uttarakhand hotels seem to vie with each other in providing the largest possible spider for the price of a room. Shikhar Hotel in Almora has six storeys (descending down the hillside from road level, so you have to go up to the reception from your room, not down) with increasing prices, and I could swear that the more expensive rooms have bigger spiders as well as better TVs.

This cottage won the contest hands down. There were spiders everywhere. Large and small, alive and dead, at floor level, on the walls, on the ceiling, scuttling crazily around or sitting still, out in the open or behind the mirror, inside the cupboard, in the curtains… everywhere. They were all the same kind, but I don't know which species that is. The largest were perhaps 13cm across, with prominent pedipalps, very spindly black legs and body, and indistinct stripes on the abdomen.

Our adventures with the Arthropoda did not end there, however. When we reached home, we found a 13cm centipede in the bathroom sink(!).

Halving a slice of pie

2009-08-26

A few days ago, I bought a slice of Date and Apple Pie from Eatopia.

(Eatopia is a food court at the India Habitat Centre in New Delhi. It is noisy and crowded, but used to have a pretty good bakery. I haven't been there for some years, but Hassath and I happened to be in its vicinity, so we stopped in to pick up a sandwich, a croissant, and a slice of the pie that was once a particular favourite of my father's and mine.)

Hassath was going to eat the sandwich; the croissant was mine. The sandwich was larger, so I finished my croissant first, and was reaching for the pie when a thought struck me: where exactly should I bite it to get no more or less than my fair share?

The slice was too wide to fit in my mouth sideways, so I couldn't try to bite it in half lengthwise (precious crumbs!). I would have to approach this resource-sharing problem pointy-end first, and bite very carefully.

Thinking quickly, I simplified the pie slice to a circular section (assuming that it had uniform thickness, and giving up on the crusty outer edge). It was an eighth of the pie, so its area was πr²/8, and the angle at the vertex was π/4 radians. My fair share (ignoring, in the interests of simplicity, the fact that I clearly deserve a larger piece for forgoing the crust) would thus be an isosceles triangle with half that area; and its height is what I needed to determine.

The area of an isosceles triangle with height l and base d is l×d/2. We know that is equal to half of πr²/8; and we can also express d as 2l×tan(π/8), π/8 being half of the central angle. Thus 2l²×tan(π/8) equals πr²/8, and so l is the square root of πr²/(16×tan(π/8)); in other words, l is r times some constant, which suits us fine.

tan(π/8) gave me a bit of pause, before I remembered that π/4 was a more tractable angle, and tan(θ) equals sin(2θ)/1+cos(2θ). sin(π/4) and cos(π/4) are both equal to 1/√2, so the required tangent is √2−1 ≅ 0.4142. Losing patience, I simplified progressively: 0.4 times 16 is 6.4, which is about twice π, so l ≅ r/√2 ≅ 0.7r. I stuffed the pie into my mouth and bit off a piece that looked about right.

So much for applied math. The pie was awful.

(After I'd finished eating, I realised—looking at the remaining piece—that I had incorrectly assumed that my bite mark would be a straight line. If, instead, I had incorrectly assumed that it would be a section of a circle concentric to the outer edge, I could have saved myself some trigonometry and the answer would have been exactly r/√2. But the pie wouldn't have tasted any better for it.)