Thursday, 25 October 2007

Driver, test pilot, vague guiding lights?

The Linux Driver Project is taking off a bit, with several hundred people signed up to help. And we have a few companies dipping their toes in. Getting involved in Linux kernel development has accreted some barriers to entry these last few years. It's difficult to find a worthwhile place to start contributing, and the review-and-resubmit process is drawn-out when no-one knows and trusts your judgement and good taste in coding yet. (Your good taste in most other aspects of life is naturally a given, despite occasional innuendos in heated discussions.)

OutOfTreeDrivers and DriversNeeded now collects things to do (and places to go?). Most places I've worked, I eventually end up adding out-of-tree, or even binary-only, drivers to support something someone needs done - which is a big maintenance pain. Collecting them here might inspire a brave soul to start the mainlining, lobby-for-opening, or reverse-engineering (where legal, like here) process.

Do help out. I'm doing my part.

Thursday, 11 October 2007

Ink, read while it's fresh

Just out: Halting State by Charles Stross. Extrapolates from today to 2018, and will certainly be outdated before then. Technothriller. Quirky sarcastic eloquence.

Recommended reader qualifications: MMO gamer w/computer science degree.

Enjoy. I did.

Monday, 8 October 2007

The Beast Remade: Niceties, wrapping up

Text::Reform took care of the rest of the pretty-printing I needed. The Perl builtin "format" command was more familiar, but the listings would not come out right. I have a sneaking suspicion that it does not like UTF-8 STDOUT much. Text::Reform was easier to get right:

$menu_form = "<< "
."<<<<<<<<<<<<<<<<<<<<<<<<< "
."<<<<<<<<<<<<<<<<<<<<<<<<< "
."<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<";

print form $menu_form, $index, $from, $to, $subject;

Some manual command-line parsing were needed, in order to do labor-saving speedups like "rm 1-7,17". I expect everyone reinvents that sort of thing at need.

Wrapping up

All this was wrapped up in a two-day hack that saves some time and much aggravation.

I would like to see someone do a similar command-line stunt for interacting with an AJAX web application. Consider this a dare, fellow hacker. I'll owe you a beverage of your choice next time we meet.

Wednesday, 3 October 2007

The Beast Remade: Use your head

Now that "cat" and "rm" works, the quick hack is somewhat useful for its intended purpose. But a short practical test reveals issues. A "cat" dumps the whole mail to the console - while that works as intended, it also scrolls the top of the mail and headers far outside the scrollback buffer, if the mail is large. A "head" command soon looks desirable.

First try is the naive "print first n lines". That approach is quickly thrown out the window. Grumbling ensues about the evils of HTML email. Spam promptly materializes containing roughly fourteen long paragraphs about random body part enlargement, without a line break anywhere in sight.

I found a rather easy solution, after some thought - we run this on Linux, after all, so why not use the traditional Unix utilities:

$spam = grabmsg($mailnum);
open HEAD, "| fold | head -24";
print HEAD $spam;

No sense in reimplementing everything in Perl if you can think of something else that does the job already. There probably are twenty-five ways of doing this in pure Perl that would be more elegant, if you know of and remember them. I had two days to build this, so I grabbed the first approach I could think of that worked.