Wednesday, December 31, 2003
Happy New Year
Many of us will be trying to sing the song that nobody knows this evening, Auld Lang Syne.
Have a Happy New Year!
Such melancholy lyrics in the context of a party atmosphere. How did this song become so popular? Of course things could be worse, we could instead try to sing the post-apocalyptic lyrics of Prince's New Year's effortShould auld acquaintance be forgot and never brought to mind?
Should auld acquaintance be forgot and days of auld lang syne?
For auld lang syne, my dear, for auld lang syne,
we'll take a cup of kindness yet, for auld lang syne.
Have a Happy New Year!
FBI urges police to watch for people carrying almanacs
According to this article, the FBI is "warning police nationwide to be alert for people carrying almanacs, cautioning that the popular reference books covering everything from abbreviations to weather trends could be used for terrorist planning".
Further down in the article there's a quote from a senior editor for The World Almanac noting that his reference book includes "stuff that's widely available on the Internet". Exactly. A good Internet connection is probably more useful than an almanac. And wireless Internet access makes it easier to do from anywhere.
I blogged about Schott's Original Miscellany the other day which is a weird sort of almanac. I wonder if I should avoid taking it along on trips?
Note: I'm not against police or airport screeners noting suspicious items or behavior. But terrorists read the news too.
Further down in the article there's a quote from a senior editor for The World Almanac noting that his reference book includes "stuff that's widely available on the Internet". Exactly. A good Internet connection is probably more useful than an almanac. And wireless Internet access makes it easier to do from anywhere.
I blogged about Schott's Original Miscellany the other day which is a weird sort of almanac. I wonder if I should avoid taking it along on trips?
Note: I'm not against police or airport screeners noting suspicious items or behavior. But terrorists read the news too.
Tuesday, December 30, 2003
Sir Tim
Tim Berners-Lee, inventor of the world wide web, has been awarded a knighthood. Good for him. He seems to be a down-to-earth guy. Also he has good taste: the first incarnation of HTTP / HTML was done on a NeXT computer
The Triplets of Belleville
I saw The Triplets of Belleville this evening. It's an unconventional and beautiful piece of animation. The plot involves a grandmother trying to rescue her grandson, who is kidnapped during the Tour de France by the French Mafia. He's spirited away to Belleville which is a oddball take on New York City. I mentioned French caricature in American cartoons in a blog entry the other day. Here's American caricature in a French cartoon -- nearly all of the residents of Belleville are immensely overweight including a rotund Statue of Liberty.
Note: at the Kendall Square Cinema in Cambridge, Triplets is preceded by a showing of the animated short, Destino. Destino started as a collaboration between Walt Disney and Salvador Dali. The original project was started 50 years ago and abandoned when Disney's studio ran into financial difficulties. This short is based on the work that Dali had started. It's amazingly weird and inventive. There are a couple of clips from the short here.
Note: at the Kendall Square Cinema in Cambridge, Triplets is preceded by a showing of the animated short, Destino. Destino started as a collaboration between Walt Disney and Salvador Dali. The original project was started 50 years ago and abandoned when Disney's studio ran into financial difficulties. This short is based on the work that Dali had started. It's amazingly weird and inventive. There are a couple of clips from the short here.
Variable-length argument lists
The varargs mechanism in C/C++ is a useful but error prone approach for supporting variable-length argument lists. The main problem with varargs is that the called function needs to figure out, somehow, how many arguments were passed. Some functions such as printf do this by using a format string to determine the type and number of arguments passed in. Like many things in C/C++, this isn't type-safe and can cause problems if the caller doesn't pass the proper number or type of arguments as specified in the format string.
Java 1.4 and earlier don't support variable-length argument lists. The usual work-around is to define multiple methods that take an increasing number of arguments. For example:
C# allows variable argument lists via the params keyword. Java 1.5 will have support for the variable argument lists using the <type-name>... syntax. In both cases the variable length argument is effectively of a single type (e.g. String or Object). Not quite as flexible as varargs but this approach is typesafe and the called method can easily determine how many arguments were passed in.
Note: JSR 65: Concise Object-Array Literals had an interesting proposal for creating array literals by automatically boxing other literal types (e.g. int, double, ...). The proposal was withdrawn. Java 1.5 will support automatic box/unbox of primitive types. I wonder if automatic boxing of other literals in Object array literals will "just work" in Java 1.5?
Java 1.4 and earlier don't support variable-length argument lists. The usual work-around is to define multiple methods that take an increasing number of arguments. For example:
A couple of less-attractive alternatives are to use an array or Properties argument to collect the arguments.public void log(String arg);
public void log(String arg1, String arg2);
public void log(String arg1, String arg2, String arg3);
C# allows variable argument lists via the params keyword. Java 1.5 will have support for the variable argument lists using the <type-name>... syntax. In both cases the variable length argument is effectively of a single type (e.g. String or Object). Not quite as flexible as varargs but this approach is typesafe and the called method can easily determine how many arguments were passed in.
Note: JSR 65: Concise Object-Array Literals had an interesting proposal for creating array literals by automatically boxing other literal types (e.g. int, double, ...). The proposal was withdrawn. Java 1.5 will support automatic box/unbox of primitive types. I wonder if automatic boxing of other literals in Object array literals will "just work" in Java 1.5?
Monday, December 29, 2003
Top Ten Words of 2003
It's the end of the year so the endless lists of Top Ten Best, Worst, Most Popular, etc. are coming out. YourDictionary.com released its Top Ten Words of 2003. Look at what came in second.
Adult humor in kids cartoons
Adult humor in kids cartoons dates at least back to the Rocky and Bullwinkle show (by "adult" I mean jokes targeted at adult viewers, not vulgar). I was watching television with my older son the other day and saw a more recent example of stealth adult humor in a cartoon: a character in Fairly Odd Parents gains super powers. He kicks a soccer ball which then sails clear across the Atlantic Ocean. Cut to a Parisian scene, a caricatured French couple sip coffee at an outdoor cafe. The soccer ball strikes the man in the back. He immediately stands up, raises his hands in the air and shouts "I surrender!". Oddly enough, the pejorative term for the French that some Americans were using earlier this year (cheese-eating surrender money) came from another cartoon, The Simpsons. It was said by Groundskeeper Willie, the Scottish handyman at Bart's elementary school.
Note: I don't think this sort of national name calling really serves any useful purpose. I can imagine the sort of uproar if the media reported that French cartoons depicted Americans in a similar skewed and simplistic manner.
Note: I don't think this sort of national name calling really serves any useful purpose. I can imagine the sort of uproar if the media reported that French cartoons depicted Americans in a similar skewed and simplistic manner.
Balloon Molecules
Two German Chemistry PhDs and a chemistry student who is also a balloon sculptor have created a cool technique using balloons to build chemical molecules. They show and explain knot techniques used to build simple and complex models. Their balloon model gallery includes a collection of models from a simple tetrahedron all the way up to the DNA Helix.
Schott's Original Miscellany
As a child, I loved to read almanacs. I was just enamored with the endless collections of tables and facts. Schott's Original Miscellany is a terrific book about nothing and everything. It's a collection of trivia and random useless information, it contains great trivia such as "War Cries of Some Scottish Clans", "Ivy League Fight Songs", the words to the "The British Riot Act", a list of "Untimely Deaths of Musicians", etc. If you're looking for a trivia fix, take a look.
Saturday, December 27, 2003
My new toy
I got a Pentax Optio S4 digital camera for Christmas this year. It's incredibly small -- the height and width of a credit card and only 0.8 inches thick (it fits inside an Altoids box). Despite the small size it's a 4 megapixel camera with a 3x optical zoom, lots of bells and whistles -- and picture quality is outstanding. Fortunately it uses SecureDigital cards so I don't have to buy yet another card reader.
I'm a happy camper. Now I just need to get a good case and a second battery.
I'm a happy camper. Now I just need to get a good case and a second battery.
Wednesday, December 24, 2003
Buried in snow
Warmer than usual weather melted nearly all of our remaining snow. I found a missing Boston Globe on the front lawn this morning. It had been buried under the snow and was still perfectly preserved in its plastic bag. It was from December 6th, when we got two feet of snow. The headline read "Snow fears pile up".
Tuesday, December 23, 2003
Comma operator
The comma operator in C/C++ is an odd bird. It takes two operands (a, b), evaluates the first, discards its value, evaluates the second and returns it's value as the result of the expression. Comma separated operands can be chained together, evaluated in left-to-right sequence with the right-most value yielding the result of the expression. It's all very Lisp-like but seldom used in C/C++ code except in for statements and macros. Note: the commas used to separate the arguments in a method call, or the elements in an array are not comma operators.
Here's something I hadn't thought about before: Java does not support the comma operator. It allows comma separated initialization inside a for statement (e.g. (for i = 0, j = 0; i < foo.size(); i++) { ... } but doesn't consider the comma in this case to be an operator. Since I rarely used commas in C/C++, I didn't notice the lack of support in Java. It turns out that C# doesn't support the comma operator either. As with Java, the C# for statement supports comma separated intializers but doesn't consider the comma to be an operator.
Now you may ask why I was even thinking about an arcane language feature like the comma operator. Well, besides being a language geek I was thinking about multiple return values. Java, C# and most compiled languages don't support them and I think that's a shame. I have a blog entry in progress discussing this but it'll have to wait until another day.
Here's something I hadn't thought about before: Java does not support the comma operator. It allows comma separated initialization inside a for statement (e.g. (for i = 0, j = 0; i < foo.size(); i++) { ... } but doesn't consider the comma in this case to be an operator. Since I rarely used commas in C/C++, I didn't notice the lack of support in Java. It turns out that C# doesn't support the comma operator either. As with Java, the C# for statement supports comma separated intializers but doesn't consider the comma to be an operator.
Now you may ask why I was even thinking about an arcane language feature like the comma operator. Well, besides being a language geek I was thinking about multiple return values. Java, C# and most compiled languages don't support them and I think that's a shame. I have a blog entry in progress discussing this but it'll have to wait until another day.
Software Disasters
When software engineers talk about "software disasters" they usually mean projects gone bad. Schedule slippage, creeping featurism, second-system syndrome, software bloat, etc. These aren't disasters or failures in the same sense that other engineering disciplines discuss them. At least, that is, until the software has been installed or deployed by its intended customers.
The study of failure is an important part of engineering education. Engineers learn from failure. Designs improve as the result of past failures. Designs are constrained within the limits of what measurements and modeling can predict. (An excellent book on the role of failure in engineering design is Henry Petroski's book: To Engineer Is Human).
The most common engineering failure discussed is the collapse of the Tacoma Narrows Bridge which was caused by wind-induced negative damping of the structure. It doesn't require an engineering education to appreciate the spectacle of the bridge's failure.
As the author of this article points out, embedded systems engineers (and software engineers in general) can learn, need to learn, from failure as well. There are several excellent, and hopefully well known, examples described here.
The study of failure is an important part of engineering education. Engineers learn from failure. Designs improve as the result of past failures. Designs are constrained within the limits of what measurements and modeling can predict. (An excellent book on the role of failure in engineering design is Henry Petroski's book: To Engineer Is Human).
The most common engineering failure discussed is the collapse of the Tacoma Narrows Bridge which was caused by wind-induced negative damping of the structure. It doesn't require an engineering education to appreciate the spectacle of the bridge's failure.
As the author of this article points out, embedded systems engineers (and software engineers in general) can learn, need to learn, from failure as well. There are several excellent, and hopefully well known, examples described here.
Zipcode Visualizer
Ben Fry, one of the creators of Processing, has also written a cool little Java applet that helps you visualize Zipcodes in the continental United States. The zipcode data in use does not seem to be completely up-to-date but it's fun to play with nonetheless. (Via MetaFilter)
Monday, December 22, 2003
Michele Pennell
During the development of Domino R5, I was the technical lead for the Domino Web Server team. Michele Pennell was our product manager. She was famous, among other things, for her Lotusphere presentations. They were much more entertaining than the dry technical talks given by folks like me. She moved to Australia a few years ago. I noticed Ed Brill's blog in my referrer log and found this entry about Michele. A virtual Hello (or something more Aussie like G'day) to Michele. (Via Ed Brill)
From Your Blog Shall We Know Thee?
I read a newpaper article a few years ago where the reporter interviewed a letter carrier and asked him to profile some of the people on his delivery route based on the mail they received. The writer compared notes with the people the carrier had profiled. He was pretty accurate in many cases. We have limited control of what mail we receive. Much of it, especially junk mail, is based on our spending habits, or other profile information. Analyzing someone's trash or email or credit card bills would provide similar insights into their life.
Blogs are a little different. We control what we reveal. Some bloggers report all sorts of details of their private lives; others, like me, are more circumspect. Most of my entries are technical, not about my personal or work life. I'm not trying to hide anything, I'm just being careful about what I talk about in such a public setting. The thing is, only a few people visit my blog directly but many others will happen upon it via a Google search. It's pretty interesting to see which queries end up here. Often two or more totally unrelated blog entries cause a Google "hit" that ends up here.
Blogs are a little different. We control what we reveal. Some bloggers report all sorts of details of their private lives; others, like me, are more circumspect. Most of my entries are technical, not about my personal or work life. I'm not trying to hide anything, I'm just being careful about what I talk about in such a public setting. The thing is, only a few people visit my blog directly but many others will happen upon it via a Google search. It's pretty interesting to see which queries end up here. Often two or more totally unrelated blog entries cause a Google "hit" that ends up here.
Sunday, December 21, 2003
Coroutines and Iterators
The C# 2.0 specification introduces a number of language extensions including generics, anonymous methods, partial types and iterators. In this entry I want to focus on iterators.
Iterators were first introduced in the CLU Language. An iterator is a type of coroutine that yields the elements of a data object, to be used as the sequence of values in a for loop. Here's an example of an iterator in C# 2.0: an enumerable type, allowing instances of Stack to be used in a foreach statement (e.g. foreach (int i in stack) { ... }). The caller and enumerator maintain their own states independent of one another. The iterator returns a value to the foreach loop each time it calls yield. And the iterator's state can be arbitrarily complex. Imagine that the data that the iterator is traversing is a complex tree structure.
One way to visualize how this works is to imagine that the iterator running on a separate thread from the foreach loop. It could use a mutex to notify the foreach loop that another value is available. But threads aren't needed to implement iterators. Coroutines are cooperative. Yhe iterator does the following: start, find an item, yield to the foreach loop, restart, find next item, yield to the foreach loop. The iterator just needs a separate stack. This is too low-level to implement directly in C# but it has been implemented for .NET using Win32 fibers.
Iterators are a gee-whiz feature that you can usually code some other way but there are times when it certainly would be useful, especially if there's an efficient implementation. Personally, I'd love to see iterators in Java.
Iterators were first introduced in the CLU Language. An iterator is a type of coroutine that yields the elements of a data object, to be used as the sequence of values in a for loop. Here's an example of an iterator in C# 2.0:
The presence of the GetEnumerator method makes Stackusing System.Collections.Generic;
public class Stack: IEnumerable {
T[] items;
int count;
public void Push(T data) {...}
public T Pop() {...}
public IEnumeratorGetEnumerator() {
for (int i = count-1; i >= 0; --i) {
yield return items[i];
}
}
}
One way to visualize how this works is to imagine that the iterator running on a separate thread from the foreach loop. It could use a mutex to notify the foreach loop that another value is available. But threads aren't needed to implement iterators. Coroutines are cooperative. Yhe iterator does the following: start, find an item, yield to the foreach loop, restart, find next item, yield to the foreach loop. The iterator just needs a separate stack. This is too low-level to implement directly in C# but it has been implemented for .NET using Win32 fibers.
Iterators are a gee-whiz feature that you can usually code some other way but there are times when it certainly would be useful, especially if there's an efficient implementation. Personally, I'd love to see iterators in Java.
Upgrade of IRS Computers is Slow Going
According to an NPR interview with New York Times' tax reporter David Cay Johnston, the $8 billion project to replace the Internal Revenue Service's aging computer systems, which haven't been upgraded since the Kennedy administration, is now 40 percent over budget and more than two years behind schedule.
Some interesting tidbits from the interview: The current system has 13 terabytes of data and requires a sequential scan to find taxpayer records. It has 40 years of bug fixes and patches. Patches were mainly due to changes in the complex tax laws; often they were made under tight schedules without decent record keeping. The system is written in a mixture of COBOL and 1960's-era Assembler; skilled programmers in these languages are becoming harder and harder to find.
Some interesting tidbits from the interview: The current system has 13 terabytes of data and requires a sequential scan to find taxpayer records. It has 40 years of bug fixes and patches. Patches were mainly due to changes in the complex tax laws; often they were made under tight schedules without decent record keeping. The system is written in a mixture of COBOL and 1960's-era Assembler; skilled programmers in these languages are becoming harder and harder to find.
SD Takes the Lead in Memory Cards
According to this article on PalmInfoCenter, the SD flash card has passed CompactFlash in terms of market share. Not surprising since SD cards are more suitable for smaller devices -- an SD card is less than half the size of a CF card. I don't really care which format is dominant. I just hope that vendors can settle on one or a couple of card formats. At home we have devices with SmartMedia, SecureDigital and Sony Memory Sticks. I don't want to deal with any more formats.
The Politics of Eating
I heard a radio interview with organizers for the Dennis Kucinich presidential campaign. They were in Iowa and trying to get a vegan meal for their candidate. Kucinich is a vegan. I don't eat meat but I'm not a vegan. Even if I was, I wouldn't decide to vote for a candidate solely on one fact. I will admit, however, that Bob Dole's statement that he wanted to be "the first Bob president" was tempting.
Note: I'm not endorsing or disclaiming Kucinich. I just thought that this was an interesting factoid.
Note: I'm not endorsing or disclaiming Kucinich. I just thought that this was an interesting factoid.
Friday, December 19, 2003
RSS Item Titles
I fixed the item titles in my RSS feed. They used to be the first chunk of the entry content but since I always put titles on my entries I finally got around to passing the title to the RSS feed. Sorry for not doing this earlier.
Santa Catapult
Help two elves fling Santa with a catapult. Good thing he has all of that padding.
Thursday, December 18, 2003
MIT Hacks
Ned mentions that MIT hackers placed a replica of the Wright Brothers plane atop the Great Dome to celebrate the 100th anniversary of powered flight. (Here are some better pictures of the hack). Other buildings on the MIT campus get hacked as well. The Green Building was turned into a Sound meter during a July 4th Boston Pops' musical performance on the Esplanade.
While not a hack in the same sense, you can play Tetris on the Green Building. Use the arrow keys to shift and rotate pieces. It would be cool if you could do this on the Green Building itself.
While not a hack in the same sense, you can play Tetris on the Green Building. Use the arrow keys to shift and rotate pieces. It would be cool if you could do this on the Green Building itself.
Twentieth Anniversary of the Macintosh
The Macintosh will turn 20 next month. The original 128K Macintosh was released in January 1984 with much fanfare including the infamous 1984 commercial shown during the Super Bowl. Apple had released the Lisa a year earlier with many of the same features but the Lisa was substantially more expensive ($9995 in 1983 dollars!). Also, the Lisa relied on Apple Twiggy drives that used non-standard media.
I didn't get my hands on a Macintosh until a few months after it was released. The CFO of the startup where I worked bought one. I was able to spend a few hours with it late one night. Even though I was using Apollo workstations with more powerful hardware, I was blown away by this amazing machine. And it was something I could actually afford to buy. I waited a while and finally bought a "Fat Mac" (512k Macintosh) which I eventually upgraded to a Mac Plus. I bought an external hard drive (a 20 MB DataFrame drive). All of this cost about $3500 including $800 for the hard drive. But I was able to develop code with this machine. It was even capable of running Apple Smalltalk.
Note: Back in 1997 Apple released the Twentieth Anniversary Macintosh but that was to celebrate the 20th anniversary of Apple, not the Mac.
I didn't get my hands on a Macintosh until a few months after it was released. The CFO of the startup where I worked bought one. I was able to spend a few hours with it late one night. Even though I was using Apollo workstations with more powerful hardware, I was blown away by this amazing machine. And it was something I could actually afford to buy. I waited a while and finally bought a "Fat Mac" (512k Macintosh) which I eventually upgraded to a Mac Plus. I bought an external hard drive (a 20 MB DataFrame drive). All of this cost about $3500 including $800 for the hard drive. But I was able to develop code with this machine. It was even capable of running Apple Smalltalk.
Note: Back in 1997 Apple released the Twentieth Anniversary Macintosh but that was to celebrate the 20th anniversary of Apple, not the Mac.
Wednesday, December 17, 2003
Mfop2 (Moblogging for other people too)
Now this is what I've been looking for. Mfop2 allows you to blog from a mobile device. You can post new entries (with images) to your blog via email. This is perfect for my Treo 600. Mfop2 supports Moveable Type, Blogger and Gallery (?).
IKVM.NET
IKVM.NET is a Java VM that's under development for Mono and the Microsoft .NET framework. Jeroen Frijters' blog for this project has lots of interesting stuff about building a Java VM and issues with .NET CLR. They've made pretty good progress. In fact, here's a screenshot of Eclipse running in IKVM under Mono.
In an unrelated but cool blog entry, Jeroen hacked some code to read the accelerometer data from his IBM Thinkpad T41p (the T41p includes a sensor that's used to detect when to park the harddisk heads in the event of shocks or the laptop being dropped).
In an unrelated but cool blog entry, Jeroen hacked some code to read the accelerometer data from his IBM Thinkpad T41p (the T41p includes a sensor that's used to detect when to park the harddisk heads in the event of shocks or the laptop being dropped).
Exception To Every Rule
We've been building APIs using the interface / factory design pattern. No implementation classes are exposed. This is good in many respects especially in Java. Since we aren't exposing classes, we can easily reorganize our implementation or provide multiple implementations without disturbing callers. Also, Dynamic Proxies can be used to transparently insert behaviors before/after method calls such as tracing, logging, remoting, etc. The one remaining problem with this approach is what to do about exceptions. Exception are concrete classes. Also, exceptions that a method throws are part of the method signature so they can't be changed without changing the signature. Worse yet, an implementation of a method cannot extend the set of exceptions thrown as defined in the interface (although it can narrow the set).
So what to do? How do we avoid breaking callers? This is a brute force but workable answer: all methods that throw exceptions will declare the most generic exception possible. Ugly but prudent. The Javadoc for each method can list the exception subclasses that may be thrown but they aren't spelled out in the throws clause of the method.
By the way, I just noticed that this is exactly what the Java Language Bindings for the W3C DOM have done. Pure interface / factory approach and a single abstact exception class. In fact, they define this exception class (DOMException) as a subclass of RuntimeException. Methods do not even have to declare that throw exceptions subclassed from RuntimeException. Hmm, that's an interesting approach.
So what to do? How do we avoid breaking callers? This is a brute force but workable answer: all methods that throw exceptions will declare the most generic exception possible. Ugly but prudent. The Javadoc for each method can list the exception subclasses that may be thrown but they aren't spelled out in the throws clause of the method.
By the way, I just noticed that this is exactly what the Java Language Bindings for the W3C DOM have done. Pure interface / factory approach and a single abstact exception class. In fact, they define this exception class (DOMException) as a subclass of RuntimeException. Methods do not even have to declare that throw exceptions subclassed from RuntimeException. Hmm, that's an interesting approach.
Fortran
True confession: I wrote code in Fortran. It wasn't professionally -- just in high school and college but it was Fortran (Fortran 66 to be specific). I'm cursed with a good memory so despite years of writing in many other programming languages, I can still remember Fortran. It was crude in a BASIC sort of way. The branching and looping constructs were primitive. The lack of good constructs encouraged spaghetti code which could be a maintenance nightmare. So bad, in fact that Brian Kernighan wrote a preprocessor called Ratfor to allow C-like flow expressions to be used. Why bother with Fortran? Because it was highly portable. Just about every OS worth considering had a Fortran compiler. And Fortran compilers had existed for a long time and generated fast code.
I haven't looked at Fortran code in years. When I decided to write this entry I did a few Google searches and found some interesting stuff. Here's the first Fortran manual. It was for the IBM 704 and was written in 1956 (!). Here's a snippet of Fortran 95 code that implements Quicksort. Hmm, except for the lack of any user-defined types, that looks more like Ada than Fortran.
I haven't looked at Fortran code in years. When I decided to write this entry I did a few Google searches and found some interesting stuff. Here's the first Fortran manual. It was for the IBM 704 and was written in 1956 (!). Here's a snippet of Fortran 95 code that implements Quicksort. Hmm, except for the lack of any user-defined types, that looks more like Ada than Fortran.
Blogger
Blogger has been a bit flakey this week. Normally it's pretty reliable but this morning I couldn't reach blogger.com. I don't use Blogger for hosting but if I can't reach Blogger, I can't post. More impetus to use b2 or some other BlogWare.
How Christmas Works
We took the kids to Edaville last night to ride the trains and look at Christmas lights. It was a cold evening. Snow is on the ground. The air is dry and crisp. As we rode the train, I realized that I'd never spent Christmas anywhere warm. In fact, to me, Christmas has to be a cold, and hopefully snowy, holiday. Even people who live in warmer climates get the same message: songs and images of bearded men in heavy red wool suits, sleighs, snowflakes, snowmen, evergreen trees, etc. This is the commercial version of Christmas and not related to events in Bethlehem (where it clearly does not snow this time of year). But where did all of this cold, snowy Christmas stuff come from? How Christmas Works
Pepper Computer
Len Kawell, one of the founders of Iris Associates, has a new company: Pepper Computer. They're building instant sharing and collaboration software for consumers. They also seem to be building hardware, something called the Wi-Fi Pad. According to this article, Pepper is about to launch its first software product called Pepper Keeper that allows consumers to build journals, photo albums, etc. and share them. Pepper Keeper has an application development model as well. Third parties can build additional applications for Pepper Keeper. One aspect of Pepper's business model is unusual: the pages of the various applications you use are "consumables" That is, once you've filled the 100 "pages" of the photo album that you bought, you need to go back and by more "pages". Hmm. (Via Thomas Gumz)
Windows Really Good Edition
Some people hate Windows with a zealot's passion. Much frothing at the mouth and gnashing of teeth. It's like the bit that John Belushi did on Saturday Night Live as a commentator for Weekend Update. He'd get into an animated rant about some topic, usually punctuating his outrage with the phrase "But nooooo". Eventually he'd get so worked up, he'd fall out of his seat behind the desk. Zealots can be like that.
I'm not sure what motivated this demo of Windows RG (Really Good) Edition. It's a little crude but pretty funny. (Via Andrew)
I'm not sure what motivated this demo of Windows RG (Really Good) Edition. It's a little crude but pretty funny. (Via Andrew)
Tuesday, December 16, 2003
Google adds more features
Google now allows you to track UPS and Fedex packages by ID, look up US patents, etc. For example patent 6,368,227 will get you to the Method of swinging on a swing patent
Monday, December 15, 2003
Ouch
I was just trying out a new blogging tool. It didn't go well. It modified my Blogger template when loading the current set of entries and then promptly crashed taking my original Blogger template with it. Patience while I fix up the mess.
Update: everything is pretty much restored as it was. I need to remember to backup my Blogger template more frequently.
Update: everything is pretty much restored as it was. I need to remember to backup my Blogger template more frequently.
St. Joseph sells
According to a recent article in the Boston Globe homesellers are burying St. Joseph statues on their property to ensure that it sells. Quoting the article:
I wasn't aware of this folklore until we put our last house on the market in 1999. The housing market was pretty hot anyway but we figured "Hey, it can't hurt". Following advice, we buried a St. Joseph statue in the flower bed in front of our house inside a plastic bag. Funny thing is, a couple days later we found that it had been dug up by an animal (dog, skunk, squirrel?) who bit through the bag and left it discarded. We buried it again. We sold the house, not clear if the buried statue had any influence either way.According to Catholic folklore, a home where a St. Joseph statue is buried on the property will sell quickly and be blessed.
palmOne To Bring Java Applications to Treo and Tungsten Handhelds
According to an article on BargainPDA:, the IBM WebSphere Micro Environment Toolkit for Palm OS Developers has been released by palmOne that will allow developers to target the Java 2 Micro Edition platform. I'm still skeptical about the memory requirements for smaller devices (the Treo 600 has 16MB) but the opportunity for building "portable apps for portable devices" is appealing. As I've blogged before, the runtime bloat is the biggest issue. If I only need a one or two simple apps, J2ME is probably not the way to go. If, on the other hand, the J2ME runtime is in ROM, this becomes less of an issue. (Via MobileWhack)
Sunday, December 14, 2003
Wiki inventor goes to Microsoft
Ward Cunningham is the inventor of Wiki. He's joining Microsoft and in the Wiki way, he's set up a page for Tips For Ward At Microsoft. Some of the contributed content is pretty interesting. I especially liked this one: Beware of ArchitectsDontCode. (Via BoingBoing)
Java access specifiers
I don't like the way that access specifiers were defined in Java. Public, protected and private are fine. My beef is with "package" access. First there's no keyword to indicate package access. It's implicit. As a result, if you don't provide an access specifier, you get "package" access. What does this mean? All classes in a package have access to any member variables or methods of any other class in the package except those marked as private. This is a lousy idea. And it doesn't generalize for large projects. Why do the classes in a single package get special treatment? Why can't I have a set of related packages that share classes that cannot be used outside the set? Of course this would require some sort of explicit declaration which might be problematic. At what scope would it be defined and enforced?
My rule of thumb with Java access specifiers is to avoid package access for member variables and methods. My member variables are always marked as private (not protected). Defining a member variable as protected is fragile. You're better off defining setter/getters as protected if you don't want to allow access outside the class and its subclasses. (Note: protected also allows package access -- that was a bad decision in Java as well). My methods are always explicitly marked as public, protected or private. I suppose that package access is useful for "package private" classes but, as I said, this is often insufficient. I often use multiple packages for a subsystem so the package boundary feels artificial.
Note: access specifiers are no panacea. Perfectly good code could be written without using access specifiers Their main usage is to allow you to provide an explicit contract about how your code should be used: which portions are private to the implementation, which portions can be called publicly, which classes can be subclassed, etc. But they're still coarse-grained. Package access was defined as a simple way to allow a collection of classes to have special implicit access. Compare that to the friend concept in C++. It's explicit and pretty ugly. So the designers of Java side-stepped this with a simpler model. Not a bad compromise, I just wish they hadn't made package the default access mode.
My rule of thumb with Java access specifiers is to avoid package access for member variables and methods. My member variables are always marked as private (not protected). Defining a member variable as protected is fragile. You're better off defining setter/getters as protected if you don't want to allow access outside the class and its subclasses. (Note: protected also allows package access -- that was a bad decision in Java as well). My methods are always explicitly marked as public, protected or private. I suppose that package access is useful for "package private" classes but, as I said, this is often insufficient. I often use multiple packages for a subsystem so the package boundary feels artificial.
Note: access specifiers are no panacea. Perfectly good code could be written without using access specifiers Their main usage is to allow you to provide an explicit contract about how your code should be used: which portions are private to the implementation, which portions can be called publicly, which classes can be subclassed, etc. But they're still coarse-grained. Package access was defined as a simple way to allow a collection of classes to have special implicit access. Compare that to the friend concept in C++. It's explicit and pretty ugly. So the designers of Java side-stepped this with a simpler model. Not a bad compromise, I just wish they hadn't made package the default access mode.
C# switch statement
I've been meaning to write something about multi-way branching (aka switch statements) for a while. I don't have the time now to go into everything I want to say but I'll dip my toe into the waters by discussing the C# switch statement.
C# has a switch statement just like the one found in C/C++ and Java. But the C# switch has an important difference: it does not allow fall-through between cases. Unintentional fall-through is a common programming error so this was done to "protect" programmers from this error. Good idea but it turns out that C# does actually allow explicit fall-through by using a new form of goto statement. You can write something like this:
The C programming language is an excellent portable high-level assembly language. It was designed primarily as a system programming language. I've been writing C code for 20 years so I find C syntax to be comfortable. But do new languages have to swallow everything from C? Java doesn't have C-style pointers and doesn't allow any code to exist outside of classes. C# tries to improve the switch by disallowing fall-through and then adds this junk. I guess someone really wants to see an Obfuscated Programming Contest for C#.
C# has a switch statement just like the one found in C/C++ and Java. But the C# switch has an important difference: it does not allow fall-through between cases. Unintentional fall-through is a common programming error so this was done to "protect" programmers from this error. Good idea but it turns out that C# does actually allow explicit fall-through by using a new form of goto statement. You can write something like this:
Yuck! What a language wart. It reminds me of the Pascal goto statement whereby you have to declare the goto label in the prologue of the procedure to use it. (Apparently the label statement is intended as a badge of shame that you had sunk to using a goto statement). I don't encourage the use of gotos in any language but that's my point. If you want to disallow fall-through, just do it. Don't come up with some extended goto syntax to let someone rattle around inside the switch block. The designers would have been better off adding a do-not-break statement to note the fall-though.switch (i) {
case 0:
CaseZero();
goto case 1;
case 1:
CaseZeroOrOne();
goto default;
default:
CaseAny();
break;
}
The C programming language is an excellent portable high-level assembly language. It was designed primarily as a system programming language. I've been writing C code for 20 years so I find C syntax to be comfortable. But do new languages have to swallow everything from C? Java doesn't have C-style pointers and doesn't allow any code to exist outside of classes. C# tries to improve the switch by disallowing fall-through and then adds this junk. I guess someone really wants to see an Obfuscated Programming Contest for C#.