I have a dream

slaniel | Uncategorized | Tuesday, October 31st, 2006

 . . . that one day I will produce a block of Perl code that is entirely line noise. For now I give you this function, to take a list of numbers and return a list that prepends single-digit numbers with zeros:

sub padDigits(@) { return map { (($_ >= 0) && ($_ <=9) && (!m{^0})) ? "0$” : $ } @_; } 

Your daily dose of Eddie

slaniel | Uncategorized | Tuesday, October 31st, 2006

Reading Eddie Izzard’s take on Paul’s letter to the Corinthians is making me double over with laughter, though perhaps you have to have seen Eddie’s Definite Article to appreciate it. If you’ve not seen Definite Article or Dress to Kill, your life contains a hole where your life should be.

The meaning of life

slaniel | Uncategorized | Tuesday, October 31st, 2006

I have discovered the meaning of life. Here it is: not looking like an ass in front of people who know what they’re talking about.

I think that if we all adhere to this premise, life will be much better for everyone.

Coffee in Newburyport

slaniel | Uncategorized | Monday, October 30th, 2006

One thing I’m noticing is that it’s hard to get good food recommendations from Google; PageRank seems to push good web pages to the top of the results list, but not necessarily good web pages about food. Maybe it’s because food websites are so diffuse, whereas if you want to google for books, you’re likely to get an Amazon link at the top. Hence it’s probably more likely that you’ll get good answers back if you google for best “differential geometry” textbook than if you hunt for newburyport espresso. It’s a quick hypothesis, anyway, and it suggests that what the net needs is a more centralized place for restaurant reviews that everyone trusts. Maybe the absence of such a site is a sign of the esteem in which food reviewers are held more generally. I don’t see Zagat’s coming in at the top of very many search results.

With all that to the side, I’ll put in my two cents here. Adam Rosi-Kessel, having long noted the absence of good espresso in downtown Boston[*], very helpfully noted his discovery of good local coffee in Boston, so I’ll do the same for Newburyport.

As far as I can tell, the only game in Newburyport is Plum Island Coffee Roasters. It’s somewhat away from downtown, near the water and currently (October 30) blocked in by a few enormous boats that have been set on land for the winter. You’d never guess there was a coffeeshop there. To get to it, you have to walk around the boats and over a rutted parking lot, to someplace that looks like a converted warehouse. But once you’re in, the atmosphere is really inviting; windows face out on the water, and there always seem to be lots of people inside. Maybe they all know that it has the best coffee in town. That’s not necessarily a great compliment, given that the competitors seem to be 1) Starbucks; 2) a kitchen-equipment store that also sells weak coffee; and 3) Caffe di Siena, which would be nice if it weren’t apparently run by teenaged girls who couldn’t care less about the quality of their product.

Plum Island, though, does care, and they’ve thus far batted 1.000 on the Making Steve A Cappuccino metric. The foam is always thick, and the espresso is rich without becoming bitter.

While I’m at it, I should give a hat tip to two places in my own neighborhood that I love: Murky Coffee, of course, which makes the best coffee I’ve ever had, anywhere (on a recent morning, I went 45 minutes or so out of my way to get a Classic Cappuccino at Murky — the best cappuccino you will find anywhere — before going to work); and Sparky’s Espresso Café, which is an eight-minute walk from my house and is directly on my path to work. I probably shouldn’t be spending money on espresso on an arbitrary morning, but I kind of can’t avoid it: the coffee is consistently great, the employees are consistently friendly, and it’s right on the walk to work. What do you think I am, superhuman?

I hope I’ve now contributed a tiny bit to the amount of food/coffee information on the tubes. (“The Tubes” is the new “internets.”)

Jane Jacobs’s explanation for this, or so I imagine, would go like so: downtown Boston, like so many downtowns, is highly active during the day and positively dead at night. Only so many businesses will bother putting down roots in the downtown under these circumstances; if rent is high enough — as it surely is in downtown Boston — only those companies that can afford to have lots of daytime business and no nighttime business will be able to afford the space. This is particularly the case when the downtown contains lots of new buildings and few old buildings, since new buildings will necessarily cost more to rent. Since Starbucks can probably afford to pay city rents, and distribute their costs over its stores in low-rent areas, whereas small coffee shops cannot, we’d expect to see a) few coffeeshops, and b) relatively more Starbucks in downtown areas. There would be more local coffeeshops in areas with lower rent, which means in particular that neighborhoods with lots of old buildings would be more likely to produce indigenous cafés.

José Saramago, Blindness

slaniel | Uncategorized | Sunday, October 29th, 2006

A friend is reading the above-named, and describes it as “1984, had it been written by Italo Calvino.”

Needless to say, I think I have no choice but to read it.

Perl: forcing earlier symbol resolution

slaniel | Uncategorized | Thursday, October 26th, 2006

Perl doesn’t seem to resolve all symbols (I think that’s the technical term I’m looking for) before it begins running a script. The consequence of this is that a script will be running along happily for a bit, and then Perl will complain that, say,

Undefined subroutine &main::someFunc called at /home/slaniel/bin/scriptName.pl line 110. 

I’d prefer if it told me this right away. Presumably there are at least a couple reasons why it waits to tell me this:

  1. It’s a time savings if someFunc() is on a branch that the script wouldn’t hit during this run.
  2. It may be impossible in some circumstances for Perl to resolve someFunc() before runtime; I assume this is one benefit of a dynamically scoped language.

Yet I’d think that in many cases, someFunc() can be resolved at compile time, and that I should be able to pay the time expense from objection 1. if I want.

Any idea how to force this?

Einstein on little bits of life

slaniel | Uncategorized | Thursday, October 26th, 2006

Einstein’s description of Princeton, New Jersey — “A quaint, ceremonious village of puny demigods on stilts” — is applicable in so many places.

I’m just saying.

Shelby Foote: worth reading?

slaniel | Uncategorized | Wednesday, October 25th, 2006

Ever since Ken Burns’s Civil War miniseries, I’ve been intrigued and vaguely intimidated by Shelby Foote’s 3-volume narrative of the war. Has anyone actually read it? And is it worthwhile? I mean, it’s 2,936 pages, whereas the book I’m reading now — about the first 500 or 600 years of Christianity, and maybe the 150 years of Judaism before the birth of Christ — is only 1,000. In more than one way this reminds me of Clemenceau’s quip about Woodrow Wilson’s Fourteen Points: “the good Lord himself had only ten.”

A divided society and the 50-50 split

slaniel | Uncategorized | Wednesday, October 25th, 2006

If you take a look at Andy Tanenbaum’s vote projections, you’ll see that whatever we end up with, it’s going to be a very close split. This was obvious anyway, given the current breakdown of the Congress. We’re a country that’s mostly moderate. No one party has a permanent lock on power in this country. Yet you get people like George Will insisting that this is a conservative country.

It’s probably been said before much more intelligently, but this 50/50 division is probably the exact reason why we seem so polarized now. With votes this close, groups of strong partisans matter a lot more than they would if any one party had a permanent lock on power. If Republicans consistently won 80% of the vote, they’d presumably spend much less time focusing on the 3% or 4% of their voters who comprise the conservative-Christian “base.” So paradoxically, the moderation of our society is probably what makes it seem so extreme.

David Potter adds another angle to this in The Impending Crisis. The presence of the Electoral College has always made this society’s politics what they are. Third parties don’t survive, because the Electoral College is winner-take-all. When Potter wrote his book, in 1977, it was already the case that people knew all about the “Ralph Nader effect,” where any third-party presidential candidate immediately got tagged with the “throwing your vote away” label. Before the Civil War, the existence of the Know-Nothing Party threw off the two-party equilibrium: the Know-Nothings took a lot of the anti-slavery voters away from the Democratic Party, leaving it more under the influence of its pro-slavery faction; hence the Democrats’ policies tipped more in the pro-slavery direction, leading to more anti-slavery defections, and so on. Eventually the Democrats were entirely the party of the South, and the last-minute appearance of the Republican Party couldn’t save the union: by that point we had no truly national parties, only a couple of factional parties. The Democrats ruled the South, Republicans the North, and never the twain met.

I worry about something similar happening now. It’s occurred to me before that the Democrats ought to just ditch the South as a lost cause (so to speak), and the suggestion appeared in much more public places than this blog. But the more I think about it, and the more I read, the more I realize: we tried that, it didn’t work, and the absence of a national party is a very bad idea.

I want to think about it more, but I wonder if we’re at an unstable equilibrium now, where the intervention of a third party that appeals to the swing voters could throw our whole political situation off. Getting rid of the Electoral College has probably always been a good idea; I wonder if it would be an especially good idea now.

The Bible, New Revised Standard Version with Apocrypha

slaniel | Uncategorized | Sunday, October 22nd, 2006

Cover of the NRSV Bible -- blue-toned background with a picture of a Greek column I can’t really compare it to other Bibles, having had negligible experience with such things, but the New Revised Standard Version with Apocrypha is quite beautiful. I guess book designers have had a while to perfect the presentation of Bibles. The binding on this one lays flat, which is a bonus; the pages feel great; the type is super-easy to read; and even down to details, like the dropcaps (they’re numbers, though, so not caps  . . .  “dropnumbers”?), the thing is beautiful. It’s just a pleasure to look at.

As for the content, I can’t say much about that yet. My experience with the Bible is limited to a few stories like Job. They’re quite beautiful as literature, but I don’t have the experience to talk about them as historical documents or theological ones. Not yet, anyway.

Portable “which”

slaniel | Uncategorized | Saturday, October 21st, 2006

Under various Unices, you can type

which progName 

to see which version of progName would run if you were to type progName at the command line. Under Windows, the same thing holds: if a program is in the user’s %PATH%, you can just type (for instance) winword.exe either at the command line or in the Start Menu → Run, and Microsoft Word will run; you don’t need to type the C:\Program Files\Microsoft Office\winword.exe or whatever to make it run.

I’m writing some Perl now that I need to be portable across OS X, Windows, and UNIX, and one thing I need is something like which ssh-copy-id. More specifically, I need some way of figuring out whether anything will happen if the user types commandName at the command prompt. Does anyone know of a way to do this portably?

P.S.: Lameness. I thought one could rely on which to return a nonzero value to the shell if it didn’t find any matching programs, and return 0 if it did. Sadly, it doesn’t seem to do this under OS X. So shelling out to which isn’t even portable among Unices, much less if you include Windows.

Maybe the best thing to do is just run, say, ssh-copy-id using system(), and check the return value from that call. system() returns whatever wait() says the exit status of the program is, and wait() returns -1 if the system never even managed to start a child process. So maybe this is the way to go.

P.P.S.: Well, one approach is just to carry ssh-copy-id around with me everywhere I go — e.g., put it in the same directory as the script that I’m writing. For now, my script will be running under Cygwin rather than under “raw” Windows, so I can afford to carry shell scripts like ssh-copy-id around. If I had to run this script under raw Windows, I’d have to write my own hacked Windows version of ssh-copy-id that would use PuTTY or plink or somesuch to copy the file over to the destination, then ssh to the destination and cat the file into authorized_keys.

I guess the moral is just that doing this stuff right, and portably, is hard.

Scripting printing from GNOME apps

slaniel | Uncategorized | Friday, October 20th, 2006

I have a very large document to print at work, so I’d like to schedule it for a time when no one will be in the office — say, 2 a.m. I’d like to print from Evince, because it renders documents nicely. It’d be cool if I could just do

evince --print --printerName LaserJet5180 --page-start 1 --page-end 200 documentName.pdf 

or do

evince --print --printerName LaserJet5180 documentName.pdf 

to print all the pages in the document. Then put that command in an at(1) job.

Anyone know if this is possible?

W.H.C. Frend, The Rise of Christianity

slaniel | Uncategorized | Thursday, October 19th, 2006

On Jason Smith’s advice, I picked up W.H.C. Frend’s The Rise of Christianity, which on first glance seems to deal with the history of Christianity from Jewish preliminaries (150 B.C. or so?) through the East/West split in the Roman Empire. This is an era — along with, say, everything from the beginning of time to 1300, and then most everything from 1500 to 1776 outside of the United States — about which I know nothing. I’m excited to start understanding the teensiest bit of Christianity. At some point I’ll be able to tackle The Social Teaching of the Christian Churches, which the great Peter Stearns and Jason have recommended. Before then, I need to understand the Reformation and probably much besides; for the Reformation, a copy of Diarmaid MacCulloch’s history is on its way to me, or will be once Amazon’s Super-Saver Shipping kicks in. (The great secret to Super-Saver Shipping, I’ve discovered, is that they take their sweet time delivering it. I suspect the whole point of S-SS is that they put the package in a lower-priority queue. I wonder how they decide how long to take to ship it out.)

Simplicity, disorganized complexity and organized complexity

slaniel | The Death and Life of Great American Cities | Thursday, October 19th, 2006

In the final chapter of The Death and Life of American Cities — which would be a better book if it ended 50 pages sooner, but is certainly still a good read at the end — Jane Jacobs lays out her belief that city planning has been fundamentally misunderstood. She quotes at length from Warren Weaver’s essay on science and complexity from the 1958 Annual Report of the Rockfeller Foundation, which lays out his belief that science progresses through three stages: approaching problems that are mere simple phenomena (changing one variable explains most of the variability in another variable); through problems of disorganized complexity (e.g., thermodynamics), where we can get traction on the problem by studying it statistically as the interaction of many fungible units; through those of organized complexity, where the units aren’t fungible and in which statistical knowledge isn’t sufficient. Jacobs counts urban design as a good example of this last category: changing the dimensions or positioning of a park changes the area around it in a way that’s highly dependent on many other variables.

I’m not sure whether this map of the history of science is accurate. I’m not even sure if there’s a good empirical way to categorize problems by which of the three modeling approaches will work for them; maybe the only way to categorize them is to try out each modeling approach and see whether it fails. Jacobs’s point is that the first two approaches have manifestly failed to model urban development, but that planners don’t realize its failure. Instead, they continue (or at least continued, as of 1961) to use the same failed approaches, believing that the problem they’re trying to solve is just fundamentally mysterious, rather than that their own approach is the problem.

Again, I’m not sure whether any of this is true, but Jacobs makes a good case that it is true for urban planning. And in any case, the piece by Weaver is worth reading; you can read it using Amazon’s Search-Inside-The-Book feature, which is a seriously handy tool. Search within the book for ‘organized complexity.’

The canon

slaniel | Uncategorized | Tuesday, October 17th, 2006

I’ve recently realized that, while decently well-read, I’m seriously deficient in a few large areas that need remedying. For instance, it occurred to me recently that I simply cannot be considered a well-educated member of Western Civilization if I’ve not read the Bible.

So: what’s in the canon? Which concepts must I understand, and which authors must I have read, before I can be considered well-educated? Specific suggestions about good entrypoints into difficult concepts (e.g., my friend Jason Smith suggested Brian Davies’ book The Thought of Thomas Aquinas as an entrée) are most appreciated.

As time goes on, I’ll add to this list, but it’s a start:

  • Aquinas
  • Aristotle
  • Catholic thought
  • Cicero
  • Freud/psychoanalysis
  • Greek tragedians
  • Marx/Marxism
  • Plato
  • Reformation

P.S. (18 October 2006): Comments from a reader via email have encouraged me to clarify at least a couple points. This blog post was even more of a careless tossoff than most, so I ended up expressing things less clearly than I should have.

First, it’s not really the case that my ignorance of the Bible itself makes me an uninformed member of Western Civilization — as my commentator wrote, this is no more true than the claim that you’re ignorant of calculus if you’ve not read Newton, Leibniz and Cauchy. Ideas are important, not necessarily texts.

Second, the canon is a subjective thing, and has changed substantially over time; the current canon does not cover the extent of writers who were at one time or another valuable. So if the point is broader cultural understanding, the current canon is a strange basis. I should have emphasized The Canon (a specific body of texts acknowledged today as classics) less, and emphasized my actual point (namely, to be a literate member of Western Civilization) more. The latter goal probably suggests reading a superset of the canon.

Jane Jacobs, The Death and Life of Great American Cities

slaniel | The Death and Life of Great American Cities | Tuesday, October 17th, 2006

The great joy in Jacobs’s book is that it’s rabidly empirical, which makes it empowering. Naïve change-the-world types like me tend to get stuck on the size of the world they want to change. For instance: thinking about the problems Jacobs is addressing, I’m likely to go like so: “We need to reduce the number of cars in cities. So let’s tax people who drive into cities, like London does, and boost mass-transit spending. But that would cost a lot, and we don’t have the political strength for that. Man, city problems are hard.”

Jacobs is altogether more productive. Her approach is: let’s look at sidewalks. What purpose to they serve? How do we make sidewalks better? Then let’s look at parks. What constitutes a good park? Why do some parks thrive and others turn into weedy, abandoned messes? Then let’s look at streets. Then at slums. Then at districts. Then finally look at cities. At each level, let’s ask some really specific questions, and look at which approaches work for different cities to solve each of those problems.

This makes her a) empirical, b) productive, c) encouraging and d) a good engineer. We need more of her. I can quibble with some of her specific details, but her program and her ideologial orientation are so spot on that I can only recommend you go out and read her book. It’ll make you appreciate the particular problems of cities (they are not just larger suburbs, and much of urban planning, according to her, stems from the belief that they are), will make you understand the mistakes that urban planners have made, and will get you inspired to be a local activist.

Perl: Fixing a little hole in the documentation

slaniel | Uncategorized | Tuesday, October 17th, 2006

If you’re trying to write Unicode-supported regular expressions in Perl, and you’re trying to remember how to match an uppercase character without using the non-Unicode /code>, you’d think the perlre “manpage” would contain what you want. Not so. What you want is perlreref. Which is not clear. But there you go. The “POSIX character classes and their Unicode and Perl equivalents” are as follows:

alnum IsAlnum Alphanumeric alpha IsAlpha Alphabetic ascii IsASCII Any ASCII char blank IsSpace Horizontal whitespace (GNU extension) cntrl IsCntrl Control characters digit IsDigit \d Digits graph IsGraph Alphanumeric and punctuation lower IsLower Lowercase chars (locale and Unicode aware) print IsPrint Alphanumeric, punct, and space punct IsPunct Punctuation space IsSpace Whitespace IsSpacePerl \s Perl's whitespace definition upper IsUpper Uppercase chars (locale and Unicode aware) word IsWord \w Alphanumeric plus _ (Perl extension) xdigit IsXDigit Hexadecimal digit 

Search Keys

slaniel | Uncategorized | Monday, October 16th, 2006

In the extremely unlikely event that you’re not subscribed to Adam Rosi-Kessel’s blog (Michael Medved declared it “good for our nation’s morals, or ethics, or whatever”; Richard Stallman aimlessly twirled his hair and smeared pizza all over his face, which observers took to be an endorsement), I’d like to second his assertion that you can’t live without the Search Keys plugin.

Dapper

slaniel | Uncategorized | Friday, October 13th, 2006

Ubuntu Dapper is by far the best version of Ubuntu yet. After months of frustration at Gentoo’s rabid suckiness, including my inability ever to get postfix (i.e., email) or CUPS (i.e., printing) working properly, I finally blew away Gentoo today and had Ubuntu up and running within half an hour. It runs faster than Gentoo ever did; printing and email work great; and in fact printing works the way you’d expect it to: you point it to a given IP address where you know a printer is, and it autodetects the printer’s make and model. I suspect it also can do Rendezvous-style polling of the network around it, but I’ve not tried.

The installation is really slick. They combined the Live CD (i.e., boot from the CD and run a full-featured Linux off of it) and the straightahead installer, so that now you boot into a Live CD and double-click an install icon on the desktop if you decide you want to install to disk. If you don’t, you can keep plugging away from the Live CD. The upshot is that the install is totally graphical, which is a big user-interface bonus.

I submit that the Ubuntu install is quite a bit easier than the Windows one. Far fewer things to click. Those who need a server environment know enough to use apt-get once the system boots; those who need a desktop environment get one with minimal prompting.

This is very exciting stuff. Linux has been ready for the desktop for years, but now it’s beyond question.

P.S.: If you want Microsoft’s Georgia and Verdana fonts, they and many others are included in the msttcorefonts package. (It’s available legally because Microsoft’s earlier license for those fonts didn’t say that it was Microsoft’s decision which license governed them. So the msttcorefonts package now gets distributed under the old license. Some license trickery like that, anyway.) If you’re wondering where msttcorefonts is under Dapper, you have to add multiverse to your list of apt repositories. That is, edit /etc/apt/sources.list so that it includes

deb http://archive.ubuntu.com/ubuntu/ dapper multiverse 

then do sudo apt-get update followed by sudo apt-get install msttcorefonts. The graphical way to do this is to go up to the Applications menu and down to “Add/Remove . . . ”.

Electoral map 2006

slaniel | Uncategorized | Thursday, October 12th, 2006

Andy Tanenbaum, who gave us a projected map of electoral-vote counts in the 2004 presidential election, now has done the same for the midterm elections. (Note the clever use of TCP ports.)

Tanenbaum’s ‘04 map, however, didn’t end up predicting the true outcome of the race. So  . . .  take this all with a grain of salt, I guess.

Next Page »

Bad Behavior has blocked 845 access attempts in the last 7 days.