Is it real or is it

Everything here is my opinion. I do not speak for your employer.
January 2004
March 2004

2004-02-02 »

Digital Cameras

I've finally half-joined the ranks of the "elite" who seem to all not only have cameras, but also now have digital cameras that cost twice as much. I say "half-joined" because I actually saved myself about 33% of the overall cost by skipping the "normal" camera phase entirely, buying only the overpriced digital kind.

dcoombs is doing a fine job of posting lots of culture-inducing photos in his NitLog, so I won't do that. I just bring it up because I finally figured out, after being pressured into buying one, what's so great about digital cameras: instant gratification. Perversely, it's the same reason people still buy books and CDs at stores instead of online: because you can get your book or CD now instead of waiting for it to arrive. Similarly, with a digital camera, you can have your photo now instead of waiting for it to be developed.

Moreover, you can learn a lot faster. In normal photography, you would have to try a lot of experiments at once, go get them developed, learn where you screwed up, try again, develop them again, and so on, usually with (at least!) a day's lapse in between. It's like Rapid Prototyping for wannabe photographers!

Cole Slaw and One-size-fits-all

The little-known-outside-Quebec-yet-popular chicken roasting chain St-Hubert (now with Business Class!) is the only restaurant I've ever been to that offers both creamy-based and vinegary-based cole slaw. The problem with cole slaw is that there are these two kinds, and for each kind, something approaching 50% of people like that kind and detest the other. (Actually, there's a third kind, KFC radioactive-green-based, but nobody at all seems to like that kind.)

Anyway, most restaurants serve only one kind of cole slaw or the other - people are so sure that their preferred kind of cole slaw is the best that they only serve that one kind, and they don't even label on the menu which kind that is. And yet, half the restaurants in the world still serve the other kind, so you'd think they'd notice. As it is, you have to ask the waiter before ordering coleslaw, "Is it the creamy kind?" and order or not order based on that... or, like most people, simply don't order it at all.

At St-Hubert, unlimited cole slaw is included in every meal for free - and they offer both kinds, and people like it and eat it. The only way to have people eat cole slaw was to offer both options.

In this sentence, I was going to tie all that into software development and one-size-fits-all user interfaces and explain how sometimes taking away an option that's "the same for everyone anyway" might be a bad thing, but I think you can probably see where I was going, so I guess there's no need to insult your intelligence. If you have any.

2004-02-13 »

Curses Sucks, and there's No Excuse!

Okay, so I finally did it. As part of a project I was working on at work for the last few days, I decided to ignore curses entirely (for various reasons, most of them bad; leave me alone), and in the process, the library I wrote solved two problems:

  • regardless of your TERM setting, it displays correctly (and I mean perfectly, modulo the lack of colour in win9x telnet) in the Linux console, xterm, rxvt, putty, minicom, Win2k telnet.exe, and - yes, really! - in Win9x telnet.exe.

  • regardless of your TERM setting, in all of the above programs, my HOME, END, PGUP, PGDN, and INSERT keys work as they should (except for programs which happy refuse to send those codes at all - notably the Win2k/Win9x telnet programs).

How did I do it? I did what curses and ncurses never did. I followed the first and most important law of successful communication, attributed to Jon Postel: Be liberal in what you accept, and conservative in what you send.

My program sends only the most basic VT100 codes: gotoxy, change colours, change-to-wacko-line-drawing-font. We could be fancier, but then my output wouldn't work everywhere. Be conservative!

On the other hand, it accepts any of several possible codes for HOME, END, etc. Every stupid bloody terminal does it differently, and I don't care; I'll take them all. Nobody who says ESC[7~ doesn't mean HOME, even if not everybody who means HOME says ESC[7~. Be liberal!

Of course, I don't support non-basically-vt100-compatible terminals. Now first of all, I don't care, because (hello, join the 1980's!) there aren't any. Secondly, nothing stops curses from doing my basic-vt100 thing by default, and different things if you do set your TERM specifically. You're the weirdo, you go suffer. Unfortunately, curses stupidly tries to do something optimal by default. Well, this is to cut down on wasted output, you'll say. Remember 2400 baud users, you'll say. I want my email reader app to be legible in this crappy terminal emulator without spending three hours trying to guess which of the 5 million 'xterm-*' terminfo settings is the right one! ARGH!, I'll say. This isn't so hard. Be conservative by default, and if I'm a weirdo with a 2400 baud modem, I can set TERM to something more efficient. Easy. The "output conservativeness" problem is only a fault of the people who write terminfo databases, so technically we won't blame curses for that.

Unfortunately, for input, curses made a fatal mistake: the terminfo format itself has a one-to-one mapping between escape sequences and input codes. There cannot be more than one HOME. That means, basically, there is no way to "be liberal in what you accept". This is a fundamental design flaw in the terminfo file format, and AFAIK you can't fix it in a backwards-compatible way. But you can still fix ncurses. I'd be more than happy if someone would just finally do so.

There are two flaws, however, that I haven't solved: the ridiculous "ESC is a key and also an automatic sequence", bug, that means pressing ESC to cancel a dialog is essentially never going to work right. And there's the ridiculous "nobody knows what code backspace is" bug, that originally (ie. in a VT10x/VT220) was never a problem, but eventually someone (I think it was the X Consortium) mangled completely by sending ASCII 127 for the keypad DEL key. There's no saving people with that keyboard mapping (backspace->8, DEL->127), and unfortunately there are a lot of those people. But I can save everyone else, because CTRL-H is backspace (shut up, emacs users), 127 is backspace, and several things like ESC[3~ are DEL.

There. I'm glad I got that off my chest. (I think I followed pphaneuf's rules for flaming because I went and implemented something better before I flamed the crappy library we poor losers have been suffering with for decades.)

2004-02-17 »

RSS-to-NNRP

So, rather than doing real work, I was talking to pphaneuf at work about RSS and NNTP the other day after reading Simon Law's comments. pphaneuf convinced me that Simon was essentially correct; RSS is nothing new, and most RSS "aggregators" are pretty sucky, and usenet newsreader technology is mature, established, and generally pretty good, so why not just make an RSS-to-news gateway and read your newsfeeds that way? Great!

So I did. Well, that was easy. Add noffle, 52 lines of perl (yes, I did do serious XML "parsing" in there using some really dumb regexes - what's it to you?), 15 lines of shell, and a few automated wgets, and there we have it - instant RSS-to-news gateway. (Anyone wanting my crappy script is welcome to it - just email me.)

The next step is to go track down one of those mature, excellent, efficient, user-friendly newsreaders and enter RSS heaven. Right? Right? But wait! I forgot! Newsreaders suck too! In the last hour or so, I've tried knode, gnus, mozilla-mailnews, pan, slrn, a horrible mutt-nntp hack, Outlook Express, and manually telnetting to the NNRP port. I have to say, the telnet is looking pretty good right now.

The all-time winner for worst newsreader UI ever is of course gnus, but mozilla-mailnews comes a close second. At least the others make some attempt at making sense; mozilla just kept on trying to connect to a host named 'news', which I didn't configure anywhere. slrn actually worked like I wanted, except it couldn't display html (which all blogs are written in, of course). Outlook Express, while annoying, was the sanest one of all, and it even has a cool "offline" mode that I don't need. Could someone just go and clone Outlook Express News for Unix, please? Hint: when I go to news://hostname, why not pop up a list of that server's newsgroups, and stop asking stupid questions about my "identity"?

Anyway, I think this finally explains to me the massive growth of so-called "RSS aggregator" apps compared to newsreaders lately. It's very simple: all newsreaders, like all RSS aggregators, are horrendous, and therefore people keep rewriting them. Maybe someday they'll get it right.

For my next adventure, perhaps I'll try an RSS-to-IMAP gateway. At least I know some reasonable mail clients exist.

More Curses

I realized that my ESC-is-a-key-and-a-sequence problem can be solved simply by making my own ESC key send something other than ASCII 27; after all, if I'm doing the "liberal" thing with input, I can have both ASCII 27 and my new ESC be treated as KEY_ESC. The 27 has the stupid delay, and my new key won't. Essentially no apps other than curses ones use the ESC key as input anyway, so this wouldn't be so bad.

As for people with their DEL key mapped to 127, well, they can just suffer with having their DEL key act like backspace. They probably won't notice anyway.

January 2004
March 2004

I'm CEO at Tailscale, where we make network problems disappear.

Why would you follow me on twitter? Use RSS.

apenwarr on gmail.com