« | » Main « | »

Halloween pumpkins

Sunday 31 October 2004

This year we made two Halloween pumpkins, one designed by my six-year-old, and one designed by my twelve-year-old:

UFO pumpkin MetTool pumpkin

On the left: A UFO, which had already been nibbled by squirrels by the time I got a picture. On the right: A mettool, which is a character from Megaman who looks like this as a sprite:

Megaman Mettool sprite


Thursday 28 October 2004

Can a typeface save your life? Well, maybe not. But improved legibility on highways is a good thing, and ClearviewHwy is a new typeface designed with just that in mind. It's good looking, and could bring more mixed-case signs, which will give the roads a slightly friendlier feel. Maybe it will reduce road-rage, you never know!

Two good email signatures

Tuesday 26 October 2004

One thing I've enjoyed about the SQLite mailing list is the quality of the email signatures.

Keith Herold's:

Things I've learned about multithreaded programming:

    123...   PPArrvooottieedcc ttm  ueelvvteeirrtyyhtt
rhheiianndgge  dwi hnpi rctohhg eri aslm omscitanalgt
 iowcbh,je engceltvo ebwrah lip,co hso srci abonlt ehb
.ee^Nr waicscee snsoetd  'aotb jtehcet -slaomcea lt'il
m^Ne from two or more threads

Gerhard Haering's:

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

First tuesday after the first monday

Monday 25 October 2004

Many people incorrectly believe that Election Day in the U.S. is the first Tuesday in November. It isn't, it's the first Tuesday after the the first Monday. This year's election (November 2nd) is as early as it can be.

Why is that? The Federal Election Commission's FAQ's page has the answer:

Q: Why are federal elections held on the Tuesday after the first Monday in November?

A: The Tuesday after the first Monday in November was initially established in 1845 (3 U.S.C. 1) for the appointment of Presidential electors in every fourth year. 2 U.S.C. 7, established this date for electing Representatives in every even numbered year in 1875. Finally, 2 U.S.C. 1 established this date as the time for electing U.S. Senators in 1914.

Why early November? For much of our history, America was a predominantly agrarian society. Law makers therefore took into account that November was perhaps the most convenient month for farmers and rural workers to be able to travel to the polls. The fall harvest was over, (remember that spring was planting time and summer was taken up with working the fields and tending the crops) but in the majority of the nation the weather was still mild enough to permit travel over unimproved roads.

Why Tuesday? Since most residents of rural America had to travel a significant distance to the county seat in order to vote, Monday was not considered reasonable since many people would need to begin travel on Sunday. This would, of course, have conflicted with Church services and Sunday worship.

Why the first Tuesday after the first Monday? Lawmakers wanted to prevent election day from falling on the first of November for two reasons. First, November 1st is All Saints Day, a Holy Day of Obligation for Roman Catholics. Second, most merchants were in the habit of doing their books from the preceding month on the 1st. Apparently, Congress was worried that the economic success or failure of the previous month might prove an undue influence on the vote!

Atlas of Presidential Elections

Sunday 24 October 2004

Dave Leip runs the Atlas of Presidential Elections. This site is impressively detailed, with maps of every U.S. presidential election, broken down by state, and within states, by counties. Perusing the older elections, it is clear that ragged outcomes are more the norm than we've come to expect. And there are plenty of interesting factoids to dig up. For example, how many electoral votes did Ronald Reagan get in 1976? (No, that's not a typo).

Dave also maintains a blog on the site where he chases down electoral details (will Maine finally split its electoral votes?, how would past elections have turned out if we all had used Colorado's proposed electoral split method?). Fascinating stuff.


Sunday 24 October 2004

Tweakomatic is like the scripting version of TweakUI: it lets you fiddle with all sorts of Windows registry settings, but with templated scripts rather than a GUI. I haven't tried it, but I read the documentation, which is great:

You want to know the sordid truth about the TweakUI team? Well, actually, we don’t know anything at all about the TweakUI team (although we sure hope they have a sense of humor). So in order to make our point, we’ll make something up instead.

The truth is, the TweakUI team has the cushiest job on the planet. These guys spend all their time at the baccarat tables in Monte Carlo. Every couple years or so, Microsoft releases a new version of Windows, and these guys drain the last of their martinis, stumble out of the casino, hammer out a new version of TweakUI, and then head back to the gaming tables.

Hallmarks of a great developer

Friday 22 October 2004

The Braidy Tester lists his Hallmarks of a Great Developer. This is a good list to aspire to. There's not a whole lot of detail here, but the criteria are hard hard to argue with.

The one that really resonated with me is "Approaches debugging scientifically". I've always felt that developing follows the mathematical method (start with a few primitives, and build up from there), while debugging followed the scientific method (observe, hypothesize, experiment, and analyze).

NYT: For Families of Autistic, the Fight for Ordinary

Friday 22 October 2004

This article in the New York Times hits the nail right on the head: For Families of Autistic, the Fight for Ordinary. In a nutshell, it's about families' efforts just to do ordinary things with their autistic kids. This story could be about my family: the well-rehearsed ceremonies, the haircut adventure, the mixed results with sports (stick with the solo events, skip the teams!), the cheat sheets posted around the house, and the meltdowns. Just this week, my son had a tantrum about getting on his school bus, because on that gray rainy day the street lights were still on, and they're supposed to be off before he gets on the bus.

I especially like the final words of the story:

For three weeks, we got to be a normal family. We got to pretend.

My wife Susan wrote a personal piece a year ago with a very similar theme (and a focus on religious celebration as the Times piece starts with): The Rite Stuff.

Ode to the Red Sox Nation

Friday 22 October 2004

I'm not a real baseball fan, but my cousin-in-law Benjamin Lloyd is. Here's his poem about the epic Red Sox victory:

Ode to the Red Sox Nation: October 21st, 2004

The Red Sox and Yankees collided
The ALCS to be decided
The fans were on fire
But predictions were dire
When Schilling was spanked and raw-hided.

In Boston they picked up their fight
There was a massacre Saturday night
Arroyo was chased
The offense was spaced
The Red Sox were done, but not quite:

Three outs away from the hearse
And a triumph again for the Curse
Roberts stole second
Home plate beckoned
And Bill Mueller made the Curse disperse.

So cold it felt like a freeze
The faithful in prayer saying: Please
God answered the call
By sending a ball
Over the wall from the bat of Ortiz.

On to game five we careened
Hoping we wouldn't get reamed
This game never ended
And our guts were offended
By the hours of tension we'd seen.

What is it that makes a man super?
Good looks like Mancini or Cooper?
No — a hero is when
You do it again
Like Oritz did with the game winning blooper.

So back into hell we did go
With the Empire State all aglow
Our hope was all spilling
Into the hands of Curt Schilling
Who's tendons were part yes and part no.

Curt fired off a game for the ages
Cutting down Yankees in stages
And Bellhorn came back
With a fourth inning jack
But Schilling redefined courageous.

In history it'd never been done
Win a series down three games to none
But D Lowe came through
And Damon came too
And the Bambino is still on the run.

Has the Curse finally been defeated?
Will 1918 be repeated?
All I can say
On this glorious day
Is the Sox are victorious
Exaltus in glorious!
And Steinbrenner's team
I guess they can dream
And suck on my expletive deleted.

          — Benjamin Lloyd


Tuesday 19 October 2004

MapReduce is a distributed computation tool at Google. It uses a constrained programming model (map and reduce, common functional programming techniques) to let users describe their computations in a way that make automated fault-tolerant distribution possible. It sounds like a great example of diamond cutting: finding the right compromise between what you want and what your users want, so that everyone wins.

Line of succession

Tuesday 19 October 2004

We watched The Lost Prince the other night. It's about a Prince of England with epilepsy and apparently autism. He was hidden away for his short life to avoid embarrassing the Royal family. It's a good story, highlighting the screwed up ways families respond to their disabled members. We're not royalty, but I see glimmers of reactions I've experienced myself.

Wanting to read more about the story, I perused Wikipedia, and ended up at the bizarre Line of Succession to the British Throne, which calmly lists the 161 people in line for the throne. I can understand needing to know who the next handful of people are, or maybe a dozen, but after twenty, we're just talking snobbery and trivia. Of course, more fanatical pages can outdo the Wikipedia's conservative efforts: Persons eligible to succeed to the British Throne as of 1 Jan 2001 lists more than 4500 people in order of their claim to lead the British Empire. For all I know, one of them is my next-door neighbor.

Which brings me to The Bed-Sitting Room, a very strange movie I happened to catch on TV once when I was much younger (and they showed such fare in the wee hours of the morning). It's an absurdist comedy about a post-apocalypse England. The one thing that sticks in my mind about it was that they went to the trouble of figuring out who among the hundred or so survivors was next in line to the throne. The mild and unsuspecting housewife was duly coronated as best they could manage.


Tuesday 19 October 2004

I honestly don't know how much of this is a joke, and how much is serious: Guantanamo is a tool that deletes all lines of code that are untested, as determined by code coverage tools. Two questions from the FAQ aptly demonstrate the philosphy:

Q: What about good code without tests? Will it be taken away and sent to Guantanamo too?
A: Yes. We follow our own rules here. Your code has to prove its innocence through coverage. We don't have to prove that the code has bugs, we just assume it has. And therefore it must be taken away. It is for your own security.

Q: If good code is removed, doesn't this question the validity of Guantanamo itself?
A: You can't prove that untested code is good. Things that cannot be proven good must go.

This may take Deleting code too far...

Where XML goes astray

Monday 18 October 2004

Derek (no last name) is a lead developer at Microsoft on their XML libraries (first MSXML and now System.Xml). He's just started a blog, and he seems to know what he's talking about. His post Where XML Goes Astray correctly hits some of the dark corners of XML. He especially gets right the difference between documents and data, and understands that XML was fundamentally aimed at documents, which is what makes data difficult sometimes.

The problem with XML is the M. The X and the L are just fine. Remember, the M stands for Markup, which means adding meta-information (tags) in and around a body of text.

$50 Encyclopædia Britannica

Sunday 17 October 2004

Every year around now, the Brookline Public Library has a book sale run by the Friends of the Public Library of Brookline. Every year, I go in to look around. Sometimes I buy something, sometimes I don't.

This time, they had four boxes full of a complete 1984 Encyclopædia Britannica, plus a three-volume Webster's dictionary, plus a dozen or so volumes of the Annals of America. The price: $50.

As a kid, we had a 1969 edition of the Britannica within easy reach. I often perused the encyclopedia the way people today surf the web: start at random, and follow references and threads until sated. I learned from my mother the habit of looking up more information on whatever topic is currently at hand (these days, the itch is more often gratified with IMDB, Google, and Wikipedia). I couldn't let a good Britannica molder in the Library's basement.

The $50 price was too good to pass up, especially after checking eBay and seeing similar items for three times the price. So I bought it and lugged it home. Now I just need to find the 49.5 inches of space to get the books out of the boxes and onto a shelf.

BTW: the Britannica site has this review of what sounds like a pretty good book: The Know It All: One Man's Humble Attempt to Become the Smartest Person in the World, written by a guy who read the whole encyclopedia!

Say no by default

Sunday 17 October 2004

Derek Sivers has written a short piece called Say NO by default about the need to keep things simple, and not pile on features just because you can. It's a good reminder, especially because as simple as the message is, it's really easy to forget.

One thing that caught my eye about the piece is that Derek is guy behind CD Baby, a hip online indepedent music store. I bought a CD from them recently (The Weepies if you must know), and was entertained by their refreshingly light-hearted e-commerce verbiage. The confirmation email I got included this:

Your CD has been gently taken from our CD Baby shelves with sterilized contamination-free gloves and placed onto a satin pillow.

A team of 50 employees inspected your CD and polished it to make sure it was in the best possible condition before mailing.

Our packing specialist from Japan lit a candle and a hush fell over the crowd as he put your CD into the finest gold-lined box that money can buy.

We all had a wonderful celebration afterwards and the whole party marched down the street to the post office where the entire town of Portland waved 'Bon Voyage!' to your package, on its way to you, in our private CD Baby jet on this day, Friday, September 24th.

I hope you had a wonderful time shopping at CD Baby. We sure did. Your picture is on our wall as 'Customer of the Year'. We're all exhausted but can't wait for you to come back to CDBABY.COM!!

Of course, the CD did not arrive in the finest gold-lined box that money can buy, but I was quite satisfied with the service and the CD, which arrived in the finest mailing envelope that money can buy.

Color synthAxis

Friday 15 October 2004

Color synthAxis is one of those interactive color choosing tools you see every once in while on the web. But this one is cooler than most, providing a powerful range of tools to manipulate colors in different ways. I'd call it a color processor, the way Photoshop is an image processor.

You have a large palette full of swatches. Each one can be clicked to expose a set of tiny tools around it, which you use to combine, split, mix, and match with other swatches.

I'm not a color person (can't you tell from my design for this site?), but even I was mesmerized by the different shades I could create with this thing.

voet cranf ∞ color synthAxis

PHP/SWF Charts

Friday 15 October 2004

PHP/SWF Charts is a slick PHP package for dynamically generating charts as Flash files. The results are good looking and full-featured. I especially liked the idea that everything is defaultable. As the tutorial shows, this code:


//include charts.php in your script
include "charts.php";

//draw a chart using the default values
DrawChart ();


will draw a bar chart with bogus defaulted data. Of course, the resulting chart is useless, but it makes it extremely easy to get off the ground with the package.

Structured procrastination

Friday 15 October 2004

John Perry wrote an essay about how to use procrastination to become a super-productive person:

The procrastinator can be motivated to do difficult, timely and important tasks, as long as these tasks are a way of not doing something more important. Structured procrastination means shaping the structure of the tasks one has to do in a way that exploits this fact. ... With this sort of appropriate task structure, the procrastinator becomes a useful citizen. Indeed, the procrastinator can even acquire, as I have, a reputation for getting a lot done.

He wrote it nearly ten years ago. What does it mean that I'm only now getting around to reading it?

Ned's Prescriptive Prefix Pushing Ploy

Thursday 14 October 2004

Most generated parsers don't let you select the target production at run time: they are always looking for the same syntax. But what if you want to call your parser in different ways, for example sometimes expecting a statement, and sometimes just an expression? Here's a trick I came up with to use any parser as a switchable-start parser.

» read more of: Ned's Prescriptive Prefix Pushing Ploy... (8 paragraphs)

Software maniacs

Wednesday 13 October 2004

In my plea over the weekend for help with HTML, I said I would write a glowing review for whoever helped me, and I am a man of my word.

"Maniac" of Software Maniacs provided swift, accurate, and persistent help. His (or her) site is in Russian, which I cannot read, but provides a few Windows utilities. Based on my experience with Maniac, I am sure they are high quality.

At the top of the page is this motto:

Есть Два Цвета: Черный И Белый, А Есть Оттенки, Которых Больше.

which Babelfish translates as:

There are Two Colors: Black I is white, But There are The nuances, Which It is more.

I'll take it as, "Between black and white there are many shades". I'll refrain from drawing a political analogy.


Tuesday 12 October 2004

SimpleSQL is another contender in the field of open source implementations of SQL relational databases. It's distributed under a GPL license. Interestingly, they seem to be writing in Java, then automatically converting the source to C++ so that they can support C++ clients!

How to use XSLT from .NET

Tuesday 12 October 2004

Yesterday I was trying to write some C# code that uses the .NET XML classes to perform an XSLT transform. I was a bit hampered by not knowing C#, but not much. The tricky thing was working through all of the pertinent classes in the .NET framework.

I needed to transform an XML string (sDataXml) with an XSLT string (sXslt) and get the HTML string that results (sHtml). Further, I needed to pass a parameter to the transform. Here's what I ended up with:

XsltArgumentList vArgs = new XsltArgumentList();
vArgs.AddParam("myParamName", "", "myValue");
XPathDocument xml = new XPathDocument(new StringReader(sDataXml));
XmlUrlResolver resolver = new XmlUrlResolver();
XslTransform xsl = new XslTransform();
Type t = typeof(Kubi.UI.IssuePreviewCtrl);
XmlTextReader xslReader = new XmlTextReader(new StringReader(sXslt))
xsl.Load(xslReader, resolver, Assembly.GetCallingAssembly().Evidence);
StringWriter sw = new StringWriter();
xsl.Transform(xml, vArgs, sw, resolver);
string sHtml = sw.ToString();

In retrospect, the result is not as complicated as it seemed when I was in the middle of it. I understand the value of finely-diced APIs that provide many objects, each with a small job to do. The .NET framework has clearly taken this approach. Being able to pass an explicit URL resolver is a very powerful way to use XSLT in a larger system.

But sometimes you'd like some defaults to help you along. For example, the Evidence passed to xsl.Load: wouldn't that make a wonderful default? And when a XmlUrlResolver is required, a new one constructed with no arguments sounds like a good default.

How do you make this in HTML?

Saturday 9 October 2004

I'll try not to get off on a CSS vs. tables rant here, tempting though it is. Just by coincidence, two different projects now need very similar HTML designs, and I don't know what my options are for accomplishing it. Ideas are most welcome.

I need a page split horizontally in two parts. The top part should expand and shrink to display however much content it needs to. The bottom part should fill the rest of the browser window, and get a vertical scroll bar to see all of the stuff in it. The effect should be like an email message window: the top half stays fixed in place to show the message headers, and the bottom half scrolls to read the body of the message.

I've tried divs, I've tried tables, I've tried iframes, and my head is spinning with all the combinations I've tried that didn't quite work. Please help! I'll write a glowing review about you and your work!

Struct ComputerContractor

Thursday 7 October 2004

One of the Python parsing tools is PyGgy by Tim Newsham. Linked from his home page was this concise definition of a contractor:

/* from ali rahimi */
struct ComputerContractor
    double    salary;
    long      lunches;
    float     jobs;
    char      unstable;
    void      work;
    int       hiring_him_again;
    const     pain_in_the_arse;
    unsigned  agreement;
    short     fuse;
    volatile  personality;
    static    progress;
};  /* and there are no unions in sight */


Laszlo open sourced

Tuesday 5 October 2004

Laszlo Systems has shifted from selling closed-source software (their Laszlo Presentation Server), to selling services around open-source software (their newly-opened Laszlo Presentation Server). I always wondered how they would manage to compete with Macromedia's Flex platform, which occupied a very similar niche (rich web-based applications).

Now they're hoping to succeed with open-source mojo, and more power to them. I haven't used either Laszlo or Flex, but they seem very powerful and eye-opening in terms of the types of applications they can build. I hope it works for them.

Oliver Steele is an insider with more details. He's also a fellow Brookline resident, though I haven't (yet) met him.

I've never worked on a large open-source project, but I've wondered: do you write the code differently when you know it will be viewable by the world? Does working in a glass house change your code? As a coder, I like poking around in other source packs, and I'll be downloading Laszlo to see what the code looks like (though it's a lot: the .tar.gz file is 107M!)

__FILE__ and __LINE__ in Python

Sunday 3 October 2004

In C++, if you want your code to talk about itself, you often use the predefined magic macros __FILE__ and __LINE__ to get the filename and line number of the current line:

// Use this macro if you can't write the code yet.
#define NOTYET()    NoCodeYet(__FILE__, __LINE__);

void NoCodeYet(const char * pszFile, int nLine)
    fprintf(stderr, "No code yet at %s(%d)\n", pszFile, nLine);


void ComplicatedFunctionFromTheFuture()
    NOTYET()       // I'll get to this later.

This provides a convenient way to leave breadcrumbs that will direct you to the spot in the code later.

How to do it in Python? With help from the Python Cookbook, I created this. It uses scary functions from sys (_getframe has a leading underscore and is described as "for internal and specialized uses only"):

def _functionId(nFramesUp):
    """ Create a string naming the function n frames up on the stack.
    co = sys._getframe(nFramesUp+1).f_code
    return "%s (%s @ %d)" % (co.co_name, co.co_filename, co.co_firstlineno)

def notYetImplemented():
    """ Call this function to indicate that a method isn't implemented yet.
    raise Exception("Not yet implemented: %s" % _functionId(1))


def complicatedFunctionFromTheFuture():

This goes one further than the C++ technique, by providing the function name as well as the file and line.

Smart playlists

Sunday 3 October 2004

I use iTunes on Windows to play music at work, and I have a lot of songs (> 4000). Songs I really like I rate five-stars, and I use Party Shuffle with "play higher rated songs more often" turned on. But still, I hear a lot of one-star songs. And looking at the number of times each song has been played, it turns out there are over a thousand songs that have not been played at all, while many have been played over ten times, even though I haven't rated them highly.

So I made a smart playlist with live updating called "Least recently played", limited to 2500 songs selected by least recently played. Then I run Party Shuffle off of that playlist. Now it feels like I'm listening to a whole new library of music. I had also tried a list called "Not one star" which selected based on the rating not being one star. That was to permanently exclude songs that I had marked with one star. Next time I fiddle with the playlists, maybe I'll try combining them.

For lots more ideas of how to use smart playlists, take a look at SmartPlaylists.com. The people who post their ideas there have a whole lot more energy than me for making their music libraries dance.

Two election statistics sites

Friday 1 October 2004

Two sites that do a good job showing statistics about the campaign:

  • Electoral Vote Predictor collates data from polls across the country to predict the outcome of the electoral vote. The maps are clear and informative, showing which states are near-balance, and which are clearly on one side or the other.
  • Fundrace.org collects campaign contribution data into a searchable database so you can find out who is giving what to whom. Search by address or name. Very cool.

« | » Main « | »