15 August 2006

There's a word for that

(Ed. note: More stuff written long ago but never posted...)

A brief piece in the Economist last year decried the fate of a word of which that periodical is particularly fond. In Europe, it has become a slur for the right wing; in America it's an even more pejorative label for the left.

The Economist's own political viewpoint is probably best described as center-right. It couples the leftist idea that government exists for the greater good of all people (not strictly to preserve individual rights) with the right wing's abiding suspicion of centralized government power and its conviction that the way to pursue social justice is to reduce regulation and let free markets work. “There's a word for that,” the essay asserts (echoing a Bush campaign speech), “and we want it back.” The much-abused word is liberalism.

Alas, this impassioned little essay is available only to Economist online or print subscribers. If that's you, read on.

Wiretaps, redux

This is hardly relevant anymore, but I figured I'd post it for the record.

A few times over the last year, JJ and I discussed the warrantless wiretap program. He's all for it. I have never come away from a conversation with him less convinced of his point of view.

I'm clearly missing something fundamental. Here's Power Line Blog arguing back in December 2005 that the program is clearly legal, citing court decisions affirming the President's authority to gather foreign intelligence without having to bother with warrants. Here's the Wall Street Journal doing the same thing.

(Now to begin with, I'm more suspicious of executive power than those courts—I'm even suspicious of the FISC, if it comes to that—but let's set that aside.)

My question is, is this executive power completely without limits? Do American citizens have no rights during wartime? Of course not. There's a line somewhere; the question is where. The pro-snooping blogosphere seems to miss this entirely. Certainly they ignore the Times's allegation that some of the snoopees are American citizens.

The entire Journal op-ed focuses on foreign surveillance. It even goes so far as to attempt this reductio ad absurdum:

The leakers of this sensitive national security activity and their Capitol Hill supporters seem determined to guarantee al Qaeda a secure communications channel into this country so long as they remember to include one sympathetic permanent resident alien not previously identified by NSA or the FBI as a foreign agent on their distribution list.

This simply isn't relevant to the surveillance activity actually described in the original Times article, in which names of American citizens (among others) are put on a list of people whose phone conversations and e-mails are secretly monitored. In other words, American citizens were the target of warrantless snooping.

I've noticed that it's really hard to even talk about this with someone. I think that might be because the question has so many logically incompatible lines of scrimmage.

  • The program is either Constitutional or not;
  • It's either foreign intelligence gathering or it's domestic;
  • It's either legal under FISA or not, or FISA doesn't apply;
  • FISA generally either makes sense, or it ties the President's hands in a potentially disastrous way;
  • Regardless of the particular legal question, the President generally either should or shouldn't exercise absolute power to conduct a war;

...and so on. Now, if you think the program flunks the first test, as I do, then most of the other questions just don't matter—in your nice, little, internally consistent political universe. It's really easy to end up arguing at cross purposes, though. And if you should manage to carry one point, the other guy always thinks he has three or four fallback positions.

I suspect that all of these questions but one are decidable, by any reasonable reading of the law; the sticking point is whether Congress has the authority to constrain the President's ability to conduct war as he sees fit.

But generally I didn't think much of the arguments I was hearing on any level. The President has the authority to take extreme measures in time of war, I'm told: look at the Japanese internment camps in World War II. (But isn't that a strong argument against such unlimited executive power? Is "there have been worse abuses in the past" really the President's best argument?) The three-days retroactive warrant provision in FISA is insufficient because it takes longer than three days to file a case. (I have no idea if this is true or not, but it's awfully hard to see the NSA program as a good-faith response to this difficulty.) The program was not actually secret, because some members of Congress was briefed. (And yet there should be an investigation into who leaked the program, and charges brought? Either it was secret or it wasn't.) As a practical matter, a war can only be fought by a dictator. (Really?)

In any case, it's water under the bridge now.

I blog parts of speech

There's a part of speech in English that I didn't know about before about a week ago. It's called the determiner. Some examples (quoting Wikipedia):

  • Articles: a, an, the
  • Demonstratives: this, that, these, those...
  • Possessive determiners: her, his, its, my, our, their, your
  • Quantifiers: all, few, many, several, some, every...
  • Numbers: one, two, fifty...
  • Ordinals: first, second, last, next...

I always figured they were just adjectives. But in English, determiners appear at the very start of a noun phrase, before any adjectives. Here's a quote; some noun phrases are in bold. The words in red are the determiners.

What are man and woman if not members of two very different and warring tribes? Yet decade after decade, century after century, they attempt in marriage to reconcile and forge a union. Why? I don't know. Biological imperative? Divine law? Or just a desire to connect to that mysterious other? In any case, it's always struck me as a hopeful thing.

Diane Frolov and Andrew Schneider, writing for the TV show Northern Exposure

This has implications for programming languages, but I'll skip it. Olivia and I are rewatching Northern Exposure show by show, courtesy of Netflix. Great stuff.

09 August 2006

Tables need space to roam (horizontally)

One thing in particular that doesn't fit on half my screen is tables. Most tables need quite a lot of horizontal space. Otherwise you get horizontal scrolling, a nuisance. Examples:

  • A database query screen, like the one in SQL Server Management Studio, wouldn't work in two columns with code on the left and query results on the right. The code would fit nicely, but the results are tabular data. The people who made Management Studio apparently realized this; the app has two wide panels (code in the top half, results in the bottom half) and you can't change it.

  • The Inform 7 language has this ill-conceived feature where you can put tabular data in your program by literally typing in a tab-delimited table. As in:

    Table of Conversation
    topic reply quip
    "dream/dreams/nightmare/nightmares/sleep" "'Sleep well?' you ask solicitously.
    
    'Not really,' she replies, edging away from you. So much for that angle." "'Ghastly nightmares,' she remarks. You nod politely."
    "marriage/love/wedding/boyfriend/beau/lover" "'So,' you say. 'This is a little weird since we just met, but, um. Would you like to get married?'
    
    She looks at you nervously. 'Do I have to? I mean, I'd rather not.'
    
    Well, this could get prickly fast." "'I, er,' she says. 'I hope I'm not supposed to marry you or something.' Uh oh."
    ...
    

    That makes perfect sense, right? Well, I guess having line breaks within table cells makes it a little harder to read. And tabs look too much like spaces. But if you solve those problems, you're still left with this:

    Table of Conversation
    topic reply quip

    "dream/dreams/ nightmare/nightmares/ sleep"

    "'Sleep well?' you ask solicitously.

    'Not really,' she replies, edging away from you. So much for that angle."

    "'Ghastly nightmares,' she remarks. You nod politely."

    "marriage/love/ wedding/boyfriend/ beau/lover"

    "'So,' you say. 'This is a little weird since we just met, but, um. Would you like to get married?'

    She looks at you nervously. 'Do I have to? I mean, I'd rather not.'

    Well, this could get prickly fast."

    "'I, er,' she says. 'I hope I'm not supposed to marry you or something.' Uh oh."

    A table with three columns, two of which can hold large chunks of text, is going to have trouble fitting on half the screen at any reasonable font size.

  • You can force tabular data into non-tabular form. For example, the default view for Windows Explorer isn't tabular. (Or rather, it wasn't in XP. The Mac Finder is the same way.) But geeks tend to set the view to "Details", which is tabular, and leave it that way. We often need to be able to look at the largest files in a directory, or see which ones have changed recently, or select only the .cpp files; and in Details mode we can do those things by clicking on column headers, if not just by looking at the screen. It's a trade-off: determining the size or date-last-modified for a particular file requires a bit of care, because it's not immediately obvious how the rows line up. (Clicking on a file only highlights the filename, not the whole row, so that doesn't help.)

    A compromise UI would show things in a narrow format with the details initially shown in small print. It would be like Explorer's "Tiles" view, but arranging the tiles vertically, not in a grid. Ctrl+Scroll would zoom in and out, showing more or less detail. You could right-click on the small print and say "Break out Date Modified as a separate column". As a pleasant side effect, this UI would fit on half my screen. There's probably a reason I've never seen this, but speaking from innocence, it sounds nice.

07 August 2006

My computer shines

Another endearing feature of the HP Pavilion is the flashing blue power button.

I have no idea how this design ever got manufactured. The power button is about one inch, square, blue, abnormally bright, and blinks when the computer is in power-save mode. Here's how bright it is: before I covered it with duct tape, we had to close our bedroom door before going to bed, because the button blinking in the next room was bright enough to keep us awake. Even with the duct tape, if it's blinking, I can stand with my back to it, facing the opposite wall, and see the blue glow going on, off, on, off.

The blue button by itself is a jaw-dropping example of stupid design. No control with such a drastic effect needs to be made especially inviting to toddlers. But the blinking... I am just floored. It is a masterstroke, a work of sheer, staggering, insane genius. Did no one at HP realize that these things go in people's bedrooms? Did no one understand that blinking per se is considered so annoying that it's no longer used even to convey important information, much less to indicate the default mode in which any home computer will spend most of its life?

(speechless)

Hardware knowhow bleg

I recently added an Ethernet card to my PC at home.* Now whenever my computer hibernates, it doesn't wake up properly.** If I take out the Ethernet card, the power management starts working again. On the other hand, the computer has no reason to exist. Oh, the irony.

The card doesn't appear to have any jumpers on it. My next guess is, buy another Ethernet card (they're cheap) and see if it fixes it. Any other suggestions? Ask your friends. :)

Footnotes:

* Long story—Yes, it came with an Ethernet port, but stopped working at some point, and as it's an on-board Ethernet port, I figured there was no hope of fixing it without obliterating my computer. Besides, I don't have a multimeter anymore. Anyway, since then I've been using my USB port instead, but my new router will have none of that nonsense. And honestly, who can blame it.

** I hit a key, and I know it knows it's supposed to wake up, because the fan turns on; but it never gets to the point of actually displaying anything on the screen.

P.S. The computer is an HP Pavilion, if anyone wants to avoid buying one at all costs.

02 August 2006

On the importance of being the right width

This shambolic post is about the width of things, specifically C++ code, Python code, and GUI windows.

I ran a script on some C++ code today, looking at line width. This probably raises more questions than it answers, but here are the results:

    2-5: #############
   6-10: ###########################
  11-15: ########################################
  16-20: ##################################################
  21-25: #########################################
  26-30: #####################################
  31-35: ###############################
  36-40: ###########################
  41-45: ########################
  46-50: #####################
  51-55: ################
  56-60: ###############
  61-65: ############
  66-70: ##########
  71-75: #########
  76-80: ########
  81-85: #########
  86-90: ###
  91-95: ##
 96-100: ##
101-105: #
106-110: #
111-115: #
116-120: #
121-125: #
126-130: #
131-135: 
136-140: #

This graph shows how many lines are 2-5 characters wide, how many are 6-10 characters wide, and so on. The script ignores indentation and comment lines, and lines that are blank or just have one character (usually }).

So you can see that, for example, about 75% of nontrivial code lines are 50 characters wide or less.

The trailing end of the curve actually goes all the way out to 500 characters, but almost all of these extreme cases involve very long strings.

Looking at some C++ code I personally wrote, the curve is similar, but for me about 75% are 40 or fewer characters wide, and the curve dies out entirely at 115 characters. I habitually break up long lines. Of the longish lines (40+ characters), most are not all that complex. They're long because the things involved have really long names:

  bool ImageGenerator::isImageObjTypeReloadable(uint64_t uObjectType)

  initCustomBasket(pOldBasket->getLocalResourceNameObject());

  Boa::WebBoaSubnetStartAttributes networkAttributes = wbNetwork.getDefaultStartAttributes();

(Disclaimer: Identifiers have been changed to protect the innocent. I'm just talking about line length and complexity, and in these respects the examples are genuine.)

Okay. Now, same script, totally different code sample:

    1-5: #################
   6-10: ######################
  11-15: ###########################################
  16-20: ##################################################
  21-25: #############################################
  26-30: ########################################
  31-35: ##################################
  36-40: ############################
  41-45: ######################
  46-50: ###################
  51-55: #################
  56-60: ################
  61-65: ###############
  66-70: ########
  71-75: ###
  76-80: #
  86-90: 

This graph describes the idlelib directory of Python 2.4. This is Python code, not C++. It's a similar curve, though.

Python and C++ are very different languages, but they (and all modern languages) have this in common: they'll let you write arbitrarily complex code lines. The compiler will accept a 3000-character line without batting an eye.

The teams that wrote these two code samples are undoubtedly very different, but they have this in common: they tend to break complex thoughts into two or more lines.

Part of this is just that it's easier to understand several simple, independent lines than one complicated one. I think part of it is visual, too. But the why doesn't matter; IDEs should take advantage of programmers' tendency to work in lines of a certain size.

Microsoft Visual Studio is an excellent example of an IDE that completely fails to do this. The current MSVS is all about the myriad gadgets and capabilities it offers—in ten trillion fiddly docking panels, none of which shows any tendency to make itself the right size or shape for the information displayed. Least of all the central code window, which initially gapes some 200 characters wide, but spinelessly cedes screen area to each new gadget you open until practically nothing is left.

By contrast, the Inform 7 GUI shows source on the left half of the screen and uses the right half for documentation and play-testing.

I can't rave enough about this arrangement. It works extremely well, at least partly because each half is a comfortable width.

It's possible to mimic this layout in Visual Studio: put Solution Explorer in a narrow strip on the left, code in the center, and a wide tabbed panel for everything else on the right. I'll try it out.

One last note. I have a program called HalfMax in my Startup folder. It runs in the background, and when I hit Windows+1 or Windows+2, it moves the current window to fill the left or right half of the screen, respectively. It so happens that a lot of the programs I use are almost ideal when filling half of my screen (given my font sizes, screen resolution, and so on). Right now I have the following applications open: Microsoft Outlook, an Outlook e-mail message, Perforce, some Command Prompts, SysInternals DebugView, some Notepads, some file Explorers, Microsoft SQL Server Query Analyzer, the Windows Services control panel, TestTrack, a Python shell, Emacs, Araxis Merge, Adobe Reader, Word, Visual Studio, and Internet Explorer. (I think this is just about all the applications I ever use. :) Most of these are either simple browser-like apps, Notepad-like editors, or shells: the kind of app that is significantly better half-maxed than maximized. The rest—Visual Studio, Windows Explorer, TestTrack—use that horizontal space for stuff like docking panels or table-view UIs.