![]() | Ned Batchelder : Blog | Code | Text | Site December 2002 » Home : Blog |
« November 2002 | » Main « | January 2003 » Despair.com has been spoofing those smarmy corporate cheerleading motivational posters for years now. Every once in a while, they come back to my attention, and I always have a good laugh. They hit their target dead on, with the inspirational photos and the grandiose typography, they capture precisely the right tone. The title is from their new 2003 line. If you are designing an API, and you have callbacks in it, please: do us all a favor and let your caller provide a context for the callback. In other words, wherever the callback function is registered, take an another opaque data argument as well, and pass that data to the callback. For example, in C, here's a function that could be used to register a malloc-like memory allocation callback: void SetMallocCallback( This works fine, as long as I want to implement a truly global malloc. Far better is this: void SetMallocCallback( Now I can do more interesting things in my callback: I could create a local allocation pool, and pass it through the void * to a sub-allocating malloc, for example. Of course, if I want to write a simple global malloc, I still can, I just ignore the context data. I apologize for the ugly C mess in these examples, but I hope you see what I'm getting at.
tagged:
architecture» react No pause on Goldmember?Monday 30 December 2002 I saw Austin Powers in Goldmember last night, and was irritated to find that the pause and rewind (reverse?) buttons wouldn't work on my DVD player. I had heard that each DVD can change the meanings of the buttons, and had heard of discs that contained unskippable ads at the beginning. But why on earth would New Line Cinema want to prevent me from pausing the movie? Or backing up? I can only suspect that some weasly Hollywood exec thought that somehow they were protecting their intellectual property by restricting what I could do. Remember the scene from A Clockwork Orange where Alex is strapped into a chair, and his eyes propped open to ensure he watched the violence-aversion movie? We've just taken one step closer... I find it amazing that after all these years, PC video resolutions are still expressed with meaningless acronyms rather than simply specifying the resolution in pixels. If the screen can display 1600×1200 pixels, just say so. Perhaps more remarkable is the difficulty of finding a definition for these acronyms. The most straighforward I found was a small note on this page about video accessories. George Hernandez has a great deal of information, but confusingly lists a number of resolutions for each acronym (and doesn't always agree with other sources!). Wilde's WWW Online Glossary finally proved to be the simplest reference. Here's what I ended up with:
Cool RulerSaturday 28 December 2002 Another nifty piece of software to recommend: Cool Ruler. It's very simple: it's an on-screen ruler, in pixels, inches, whatever. It can be horizontal or vertical, it lets you mark things on it, and it's free! Two recent attention-getting projects are using Python, and thankfully, that's not the part that's getting the attention.
It's good to see two such ambitious projects undertaken by such seasoned professionals choosing Python as an implementation detail. Too many Python projects are about Python rather than about something else. As I've mentioned elsewhere, Python needs to be more in the background for it to make the next leap in popularity. These projects are good signs of things to come. Click MazesTuesday 24 December 2002 Click Mazes is an amazing site jam-packed with puzzles in applet form. These are interactive mazes that are suprisingly challenging: a first look tricks you with the simplicity of the layout into believing that solving the maze will also be simple. Wrong! There's tons of interesting puzzles here, a quick visit won't be enough. PS: This is one of those pots of gold at the end of the rainbow; in this case the rainbow was this chain of surfed pages: Kevin Altis' Radio Weblog to the PythonCard Life sample to Alan Hensel's Life pages to Dean Hickerson's Life pages to Click Mazes' Maze of Life. Whew! Happy belated FestivusTuesday 24 December 2002 Yesterday was Festivus, and I forgot to mention it. Happy Festivus, everyone! » react Deleting codeSunday 22 December 2002 There's only one thing that comes close to the pleasure of writing a new chunk of code that does useful things, and that's deleting an old chunk of code that doesn't. I guess not everyone feels that way. I find I often have to push co-workers to go ahead and delete code we don't need any more. I've dealt with it enough that I went ahead and wrote an article about it: Deleting code. Best of recent Boing Boing: Hollywood wants to outlaw crowbars. Perfect. More cluelessness from Hollywood. Their arguments are getting weaker and weaker, and their own analogies are undercutting them. Invisible actors guessing game. I'm astounded by this game, which involves stills from movies with the people removed. How does one wield Photoshop with such skill? And they've done hundreds of them!
tagged:
games,
law
/
via:
Boing Boing» react ComedianSaturday 21 December 2002 I just saw Comedian, the documentary about Jerry Seinfeld starting from scratch with his stand-up routine. It's very good, but not for the reasons I thought. I was expecting it to be funny: Jerry Seinfeld doing standup. Of course, it is funny, but rather than mostly being comedy, it is mostly about comedy, and about achievement, personal goals, and fulfillment. I found it very thought-provoking. For example, in one scene, Seinfeld is talking to Garry Shandling about being on the Tonight Show, and whether Johnny Carson "called them over" (after a comedian did his stand up act, sometimes Johnny would invite them to sit down in the guest chair and chat a bit, and sometimes he wouldn't). You'd think that for a stand up comedian, the pinnacle of success would be to appear on the Tonight Show. But of course, it turns out that even after reaching that pinnacle, there are more ways to torture yourself about whether you are truly successful or not. PS: it also has one of the funniest trailers around, although it has nothing to do with the movie. And Comedian Shrine has more trailers (as well as an obsessive amount of other material). My wife wrote a commentary piece in today's Boston Sunday Globe called My disabled son deserves a diploma.
tagged:
autism» 2 reactions Froogle and ZeitgeistFriday 13 December 2002 Just in time for the giving season, Google gives two gifts of its own. Froogle is a specialized front to the Google engine for finding products. So far, it looks great. How is it different from just searching pages for products? It shows you a pic of the product, and it promotes price to a first-class metadata citizen, highlighted in the search results, and usable as a criterion of the search. The 2002 Google Zeitgeist is a yearly wrap-up of the popularity of searchs at Google as an expression of the global zeitgeist (fancy words for, "what's on people's minds"). Liberty vs. safetyThursday 12 December 2002 The current administration is proposing to fight terror by collecting huge amounts of information on all aspects of civilians' lives through the Orwellian-named Total Information Awareness System. This system would include information from sales slips, public library borrowings, veterinarians (?), and so on and so on. Meanwhile, a congressional panel points out that there were nine missed clues to the 9/11 attacks, including FBI refusal to look deeper into Moussaoui after his arrest, and FBI refusal to study Middle Eastern students at flight schools after an agent's report urged it to. So given that we weren't able to follow up on reports by FBI agents, how do we expect to sift through billions of sales transactions? And what exactly did the hijackers buy that would have tipped us off? I fear we are in the grip of two classic trends: First, that technology is somehow magic, and can either create great evil (think about Hollywood's current obsession with digital piracy), or solve insoluble problems. When I hear these plans for doing the impossible with an ordinary database of extraordinary size, I think of movies from the sixties with a room-sized computer covered in blinking lights, and a bunch of guys in white lab coats asking questions through a microphone, with the answer printed on a punched card popping out the side. It doesn't work that way. The second classic trend is something that Hitler and his bunch understood all too well: a government can control its people by claiming they are in danger and that giving over control is the only way to remain safe. Ben Franklin understood it as well. He warned,
tagged:
politics» 1 reaction STL iterators can be char*Tuesday 10 December 2002 Here's a handy fact about the C++ Standard Template Library that I didn't know: a char* (or any other pointer) is a valid iterator. This is because it is all templates, and iterators are anything that supports increment (++), and indirection (*); and whose elements support things like equality (==) and assignment (=). For example, to search one chunk of memory for another chunk: #include <algorithm> Just be careful: if the data isn't found, search returns pBufEnd, not NULL! Found this in the C++ forum at Experts Exchange. Lego as currency?Monday 9 December 2002 Defective Yeti says we should use Legos for currency. It's hard to argue with his logic.
tagged:
lego
/
via:
Follow Me Here» react The ACLU and the EFFMonday 9 December 2002 I'm scared/angry/outraged at a lot of the changes either implemented or proposed by the Bush/Cheney/Ashcroft/Poindexter gang. I hope you are too. If you are, join an organization that is fighting them. Recent entries from Boing Boing highlight two good ones:
tagged:
politics
/
via:
Boing Boing» react Log message style guideMonday 9 December 2002 One of the fit-and-finish issues all systems developers need to address is the text of log messages. My latest article is a Log message style guide. Futurama is still on?Sunday 8 December 2002 I found out today by accident that Futurama is still on. Who knew? Fox seems to push all of its shows with annoying insistence, and I watch The Simpsons regularly, but I can't remember the last time I heard about Futurama. It wasn't a great show, but it had a touch of the matchless humor from the Simpsons, which made it better than average TV. And, it won the Emmy award for Outstanding Animated Program, beating both The Simpsons and King Of The Hill. While it pushes its usual roster of junk, why wouldn't Fox let us know even a little about Futurama? And why not put it on during prime time? Cedric and Cameron are having a micro-debate about the root cause of lousy software. Cedric says:
In response, Cameron says:
Now Cameron is a smart guy, so I hope he mispoke and meant "increase the number of identified defects". The software is what it is. Increased testing cannot in and of itself increase the number of bugs in a piece of software. I think these guys are actually in agreement. Cameron goes on to say that developers should do more testing themselves. Whatever. The more testing that gets done, the more is known about the software. The first step to making good software is to understand the software. Testing is not a perfect way to know what software does, but it's the best way we've got. KnotPlotWednesday 4 December 2002 KnotPlot is two things: a comprehensive application for exploring knots, and a comprehensive web site for exploring knots. We're talking knots here as in mathematical knot theory, which (I think) is the study of the abstract properties of knots and knot-like things.
The software is not easy to use (it's classic ivory-tower-ware, full of sophisticated baffling controls), but is amazing to play with. I have no idea what knot theory is really about, but I like the pictures. Huffman compression in NotesWednesday 4 December 2002 A recent email correspondent asked:
The answer is: you can't. The Notes C API provides no facility to do this, and Lotus (or IBM or Iris, or whatever they should be called now) has never documented the compression algorithm. The only way to decompress these attachments is to use the C API functions NSFNoteExtractFile or NSFNoteExtractFileExt. Both of these functions take a filename, and the decompressed data is written to the file. Of course, this is really stupid. For one thing, when writing high-throughput software, the last thing you want to do is write more data to disk. If I need to process the data in a file attachment, I want a way to read the data into memory, and writing it to a temp file just to read it back in so I can do whatever to it, is just wasteful. Of course, IBM (or Lotus or Iris, or whatever) has functions to do the decompression, they just haven't been exposed as part of the C API. I used to work at Iris (or Lotus, or whatever), but I don't know how the compression works, or what the functions are to do the decompression. I'd like to have access to them as well, but I'm in the same boat as everyone else.
tagged:
lotus» 1 reaction No more anorexic anchorsTuesday 3 December 2002 Following tantek's lead, I've made a small change to avoid empty anchor tags. No big deal, but it makes me feel virtuous to do the little things right.
tagged:
web
/
via:
Holovaty.com» react Validating credit cardsTuesday 3 December 2002 I was doing some online shopping, and had to enter a credit card number. I entered my credit card number (using virtual card numbers, of course). I hit submit, and was prompted to enter a valid credit card number. Of course, what had happened was that I had entered my number with spaces between every four digits, as any normal person would do, and the stupid site would only accept the number with no spaces in it. Why is this so hard? How many people a day get that idiotic message box? Looking at the source for the page, I found these snippets of JavaScript: var cardPattern = /\d{16}/; Why not do this: var cardPattern = /\d{16}|\d{4} \d{4} \d{4} \d{4}/ and let me be? Why after all these years are average users still expected to pick up the slack for lazy programmers? And don't tell me, "the back end wouldn't accept the string with spaces, so the front end is right to reject it"! Why can't the back end deal with the spaces?
tagged:
coding,
javascript» react « November 2002 | » Main « | January 2003 » | |||||||||||||||