|Ned Batchelder : Blog | Code | Text | Site|
» Home : Blog
Two quick links via 0xDECAFBAD related to gay marriage:
A time-honored principle: You Aren't Going to Need It. It basically says to only build things when you really need them. Too often engineers over-design, adding things to the code (or even the product) on the theory that eventually they will need them. And more often than not, You Aren't Going to Need It.
I just removed the last vestiges of one of these ill-considered appendages. I had to touch 24 files to get rid of the empty maybe-we'll-need-it-someday interface, all the places we handed one around, all the places we provided NULL for the argument, and all the places where we ignored the argument passed in.
Speaking of clever techniques using unorthodox channels of information: When I was in college, my best friend from high school came up with a novel way to identify his print-out in the computer lab. It was a large room full of terminals, with a DECwriter dot matrix printer at one end. Students could print to the printer, but there was no good notification system that the print-out was done. You had to wander over after a while and hope that it was ready.
The dot matrix printer made a buzzing sound from the wires in the print head striking the paper. So my friend ended his files with patterns of increasingly tightly spaced vertical bars:
| | | | | | | | | | |
When the file was printed, the typical buzz of the printer would be interrupted by a distinctive rising tone caused by printing the bars. It could be heard across the room, announcing that the file was ready.
Port Knocking is a clever technique to secure a machine. No ports are open, but failures on ports are monitored for a specific sequence of port attempts. If the correct ports are attempted in the correct sequence, then a port is opened, and the external machine can get in. The technique adds a meta-level to normal security measures, and turns failures into interesting information.
Now Bush wants a constitutional amendment defining marriage (or he says he does, more on this below).
E7L3 (Eberhard Lutz) maintains a list of Classical Computer Science Texts (should be Classic, but I quibble). There are some really interesting papers here, including Iverson first trying to explain APL, and Codd first explaining relational databases. E7L3 also has pointers to online books of interest.
Running Windows Update today, I learned of a critical update: Update 833407 removes "unacceptable" symbols from the Bookshelf Symbol 7 font. As soon as I read that description, I figured swastikas were involved. As it turns out, there is more to it.
Three symbols are removed from the font: two swastikas, and one star of David. Here's the affected section of the Bookshelf Symbol 7 font before the update:
Now I understand that many people are sensitive about swastikas, and that despite their thousand-year history they have come to be universally associated with great evil. You can agree or disagree with needing to remove them, but no one is surprised to see them go.
But who needed the star of David removed? And who agreed to remove it?
The Microsoft Visual C++ compiler will warn you about all sorts of harmless things. Today I ran across a harmful thing it would not warn me about, and I am really surprised.
Everyone's linking to why's (poignant) guide to ruby, and everyone seems to love it. Maybe I'm just an old fart, but it struck me as the work of a precocious and irritatingly cute tween-ager. I'd love to have more about Ruby and less about the author. Somebody get this guy an editor.
On the subject of the original Macintosh team: Susan Kare was the graphic designer responsible for all the visual aspects of the Mac, from the icons and fonts to the user interface elements to the graphics for the demos. She's long since left Apple, and is now an independent designer. She designs fonts, and one of them is called Ned. To top it off, the quote illustrating the font is by Paul Rand, some of whose books I own.
Not only is error-handling code hard to write, it is hard to test. One technique is to intentionally introduce errors into your system. I did this again recently, and called it the Gremlin.
The story of the Macintosh has long held mythic status in the history of personal computers, and rightly so. Folklore.org collects dozens of stories about the origins of the Macintosh. Interesting reading.
We watched Sleeper the other night, Woody Allen's 1973 comedy about a man who wakes up 200 years in the future. I enjoyed its goofy humor, of course, but also noticed two new things about it.
One: the Domesticon robot in Sleeper bore a striking resemblance to C3PO from Star Wars, made four years later:
Both have the same mincing shuffle, the same mild British-inflected voice, the same arms-at-the-ready stance. Was George Lucas influenced by the earlier movie, or are both parodying some earlier source?
Two: In the scene where Allen is explaining the ancient artifacts from his time, he's given a Playboy centerfold, and says, "I'll take this for further study and give you a complete report later". You see only a brief glimpse of the model's head, but it is unmistakably Lenna, the woman made famous as a standard test image for computer scientists:
For more on Lenna's history, see Complete Story of Lenna.
Out of the blue during a long car ride, our kindergartener asked if we knew the story of Rosa Parks. We said we wanted to hear it. He said,
So close, yet so tragically far.
One of the most powerful features of C++ is that stack objects are guaranteed to be destroyed as functions are exited, regardless of why they were exited (normal return, or an exception being thrown). This is one of those clever techniques that is easy to know about, but then easy to overlook anyway (as I recently did). I've written an article about it: Destructors instead of catches.
I've volunteered to go talk to my son's sixth grade class about writing software. I spoke with their computer teacher about what I do, including professional work, this site, and little projects I've done with and for my boys, notably simple game programs. The teacher had them think up questions ahead of time and mail them to me. The first was:
I've never made a wrestling game. Where to begin?
...it's really hard to get even a small piece of software right without a QA team to point out where you screwed up. I posted Cog on Tuesday, but as Simon Steele gently pointed out, it wouldn't install. (Is there some reason distutils defaults to not including the scripts you've declared?) Darach Ennis directed my attention to a crucial typo in the code example. Both problems have been fixed. Thanks, guys!
Challenging the conventional wisdom that Google has solved all the search problems, the librarians at the University at Albany (SUNY) have compiled an extensive table showing How to Choose a Search Engine or Directory. There really are quite a few other engines out there, many of them aggregators from the more established sites, but with plenty of interesting features to exploit. Well worth taking a look around.
Stephen Wolfram's magnum opus is now available in its entirety on the web: A New Kind of Science Online. If nothing else, it is a gorgeous book, masterfully produced, and the web site keeps up that feel. The beautiful images are all there, but with the text of the book available as text as well. There's a bit too much focus on the actual pages of the book, rather than re-imagining the content for the web, but they've done a lot of work to respect the pages while making them useful online.
I've written before about Wolfram's unfortunate ego. The new content on the web site is also true to the book in this aspect. For example, in the reference section, you'll find Books in Stephen Wolfram's Library Relevant to NKS. Reading this page, it seems the more interesting thing about any particular book is that Wolfram owns it, rather than its relevance to the text.
Cory has a potentially useful geek-friendly algorithm for improving any piece of writing:
Cog is a code generation tool I wrote to solve some problems at work. It's based on embedding Python in source files to generate code (we use it to generate C++, for example).
I'm really happy with the way Cog turned out. Some would say that Cog isn't a code generation tool at all, but just a file munger that can be used for code generation. They would be right, Cog does much less than most "code generators". But it was written to munge files in just the way you need to when generating code. Cog only does one thing, and it does it well: it executes chunks of Python it finds in text files, capturing the output and writing it into the file alongside the original code.
Download it, try it out, and let me know what you think.
For more about code generation in general, try:
This message was forwarded to me by a friend. Cindy Ariel and Robert Naseef are looking for essays by those affected by autism. I thought I would pass it along:
Rands writes about what's really going on in meetings: Agenda Detection. This is a very cynical view of the nature of meetings, but I don't think it is wrong. It's a little stark as a way of viewing people you actually have to deal with every day, but a useful dimension to explore when trying to understand what's going on when half a dozen people sequester themselves around a table.
I've been doing a lot of swimming at the pool with my boys, and I've discovered something fundamental: If you have a child who is uncertain in the water, buy them goggles.
I always assumed that breathing was the thing that put them off, but that's the easy part. They don't like not being able to see, and the goggles are a cool toy that are only really fun if you are underwater. I have two boys who needed help finding their confidence in the pool, and goggles worked for both of them.
It's been a real pleasure seeing my guys become the type of kids that just throw themselves into the pool, flailing and gasping and loving every minute of it.
I've been playing with Orkut, and much of what others have said is true: it's like collecting baseball cards, it's simplistic, it's too binary, it's got no business model, it's too dating-service-like, and so on.
On the other hand, I like the fact that it makes tangible something that is not usually in the forefront of my thought. Exploring the connections is interesting, even if it isn't insightful in some deep way. The Am-I-Hot-Or-Not feel is crass, but the geographic dimension (find friends of friends within 10 miles) is cool.
And it starts interesting conversations about "what is a friend?" One friend (!) defined it as someone for whom you would do a favor. Another defined it as someone to whom you would tell confidential information. Another defined it as someone you would look forward to having lunch with. Clearly these criteria define different sets of people. Connecting with people is important. I think anything that can help us focus on those connections has got to be more good than bad.
If I haven't sent you an invite, and you think I should, drop me a line.
I like Perforce a lot. It's lean and clean. I've always liked their approach of making the command line fully functional and then building on it as a way of providing multiple interfaces and platforms. But here's a twist on that idea that I just discovered: every command can take a -G switch which makes the output be marshalled Python objects, to aid in scripting.
While we're on the topic of Internet assistance for nerdy word games, try the Internet Anagram Server. It helpfully told me that "Ned Batchelder" could be anagrammed to:
(and thousands of others...)
I don't know whether to be entertained, informed, impressed, awestruck, or aghast. Australian Ian Fieggen's Shoelace Site covers every possible detail about lacing shoes. He describes 11 different ways to lace your shoes and 6 different ways to tie the laces, culminating with the Ian Knot, "The World's Fastest Shoelace Knot".
A co-worker had a mysterious C++ compile error: a symbol was undefined, but it was clearly present in the header file. We figured there was an ifdef affecting it, but how to find the culprit in the 11,000-line header file?
I bought a copy of Flash 5 for my son on eBay, and got him a book about making games with Flash. The book uses Flash MX. I always knew that eventually we'd run across something in the book that needed MX and wouldn't work with 5.
We ran across it. The something is:
_root.onEnterFrame = myfunc
How do I do this in Flash 5? Please tell me it's possible.