Snow 2004

For the first time in two years, we here in the Deep South awoke to a blanket of snow on the ground. This was a fast moving storm that came through, dumping 1.5 inches of snow at our house between 0200 and 0500 this morning. Before 0200 it was cold, but completely dry. We went out and played some early on and had a great time. Photos are posted in my photo gallery. We’ll go out again later, I’m sure. It’s quite beautiful if a bit hard because it was a very wet snow which then re-froze. Snowballs made from this snow to the cheek actually hurt!

Latest Screenings

I’ve watched a few things lately and here are my mini-reviews.

50 First Dates
It’s about a man who meets the girl of his dreams only to discover that she has no short term memory and forgets everything from the day before at night while she sleeps. Thus the title. This was a really cute film that made me laugh out loud several times. It’s quite touching at times as well. The only problem is that they went way overboard with one particular plot line, early on, that almost ruined it. They mostly recovered though, and it was an enjoyable film. Rob Schneider steals every scene he’s in. Drew Barrymore is adorable as the forgetful Lucy and Adam Sandler is the intrepid wooer. Four stars. It would have been five but for the aforementioned plot-overdoage…

Underworld
This film is sort of like The Matrix meets vampires and werewolves. It’s about the age-old war between vampires and werewolves with the lovely Kate Becksinsale as Selene, a vampire “Death Dealer” whose job it is to hunt the werewolves into extinction. She is the narrator and protagonist and runs around in a tight black leather cat suit the whole time, usually with this flowing black leather trench coat. Very chic. To be honest, if Selene ever attacked me and wanted to turn me into a vampire… Well, let’s just say she would meet with fabulous success… But I digress… This movie didn’t fare very well with the critics, but I really enjoyed it. It’s a good action film, not a horror picture, which may have turned some horror fans off. I don’t watch horror films any more so I was pleased. There’s some amount of wire stunts, though that technique was used sparingly and thus didn’t make the whole movie about the wire work. Good sound-track too. Four stars.

Lost In Translation
I was up until 0200 this morning watching this movie. It is a wonderful film. Touching, funny, poignant, engrossing. Bill Murray is a has-been actor who is in Japan filming whiskey commercials. Scarlett Johansson is Charlotte, a young married girl in Japan with her photographer husband who is to busy to spend any time with her. She and Bob (Murray) meet up in the hotel lounge one night and end up spending several nights running around Tokyo enjoying each other’s company. Bob has been married for 25 years, but his marriage is not so great any more. Charlotte has been married for 2 years and it is already going downhill. While her husband seems to love her, he has no time for her. She and Bob connect in that hotel lounge and have a great time together in Tokyo. Of course eventually Bob has to leave… This movie was deeply touching and vexing at the same time. On the one hand, they are two married people who should not be hanging out together like they do. But on the other hand, both are miserable and for a few brief nights they share companionship, fun, excitement and a love that can’t be expressed. There are similar themes to one of my other favorite films, Her Majesty, Mrs. Brown where two people are madly in love with each other, but know that they can never express that love. I was conflicted in that I wanted them to express their love for each other, yet I also wanted them to stay true to their vows. It was a strange feeling. Lost in Translation is a definite Five Stars.

Sex and the City: Series Finale
Yes, I admit it, SatC is one of my favorite shows. I paused Lost in Translation last night to watch the series finale and it was worth it. I will miss the show, but I like how they tied everything up. I’m not going to spoil it for anyone who hasn’t seen it, but I was very satisfied with all the endings. I’m sure it will be on many more times this week.

Operator Overloading Stupidity

I’m back in .NET land after living, pretty much exclusively, for the last two years in Java-and-Ruby land and while I generally like C#, I ran across something today that is really stupid. It involves operator overloading. While I actually like operator overloading and think it can be a powerful thing, the implementation of one facet of it in C# is just wrong. The problem is that they force you to override certain operators in pairs instead of defining them in terms of each other or in terms of a single method. In other words, if I define == to check equality then I also have to define != to check inequality! Why in the world should I have to do that since inequality is the opposite of equality and can be defined in terms of the equality operator? The same holds true for < & > and <= & >=. What you end up with is something like this:

   1  public class Foo   2  {   3      private int val;   4   5      public Foo(int val)   6      {   7          this.val = val;   8      }   9  10      public static bool operator==(Foo lhs, Foo rhs)  11      {  12          return lhs.val == rhs.val;  13      }  14  15      public static bool operator!=(Foo lhs, Foo rhs)  16      {  17          return ! (lhs == rhs);  18      }  19  }  

where the != operator just negates a call to ==. You would repeat this process for the other two pairs if you wanted to provide them. (And yes, I know if you provide your own == then you have to also provide a GetHashCode method.) There is no reason that the developer should have to do anything more than provide a comparison operator and then let the system define the other methods in terms of that comparison…

And that’s exactly what Ruby does. If you include the module called “Comparable” in your class, and provide a comparison method called (called the “spaceship method” because that’s what it looks like) then you get ==, !=, <, and >= for free! That’s right, by defining one method you get six defined in terms of it automatically. Now that’s how it should be done! Which results in code like this:

   1  class Foo   2      include Comparable  # Here's where the majic starts   3   4      attr_accessor :val   5   6      def initialize(val)   7          self.val = val   8      end   9  10      # comparison method; all others defined in terms of this  11      def (other)  12          val  other.val  13      end  14  end  

Obviously these are both trivial classes but I think you get the point. There is no reason why you should have to define more than one method to get all the normal comparisons that you would expect in a language.

Word Annoys Me

I spent quit a bit of time today updating my resume, in Microsoft Word. What an absolute pain in the keester! I spent so much time just trying to make the stupid bullet points line up it wasn’t even remotely funny. I swear I could have done it in far less time in LaTeX except for the fact that I needed to give it to people who only have Word. For public consumption I just may convert it to LaTeX and be done with it. Does anyone know of a free program to convert a .dvi file into a Word document? That would be sweet. I can do PDF with the built in DVI converters, but not Word, as far as I know.

New “Reading Room” Blosxom Plugin

I’ve just released a new plugin for Blosxom called Reading_Room. It is what I used to produce the “Reading Room” box at the bottom of the page on the left.

The idea was to automate the creation of these boxes so I could do it for books, records, films, etc. without having to write HTML each time. What I ended up with is a data file + template setup where you put the important information in a data file that you associate with a template. At page load time the data are read from the file, replacing the appropriate bits in the template for each record, and the output shows up where you specify on your page. This is an example data file called reading.dat:

  reading  Author|Title|ISBN|Rank  J.R.R. Tolkien|The Lord of the Rings|0618260587|5  Fred Rogers|The World According to Mr. Rogers|1401301061|4  Richard Condon|The Manchurain Candidate|1568582706|2  Michael Crichton|Prey|0061015725|4  Andrew Burgess|A Clockwork Orange|0393312836|-1  

The first line is the name of the template to use (it will have .tpl appended to its name). The second line lists the columns that will make up the following lines, in this case separated by a pipe. Each additional line is one book, giving the author, title, the ISBN and a ranking, which will be converted to stars. A 0 ranking will be replaced with “Stinks!” and a -1 will be replaced with “Rating Pending.” Both of these are configurable, as is the graphic to use for the stars.

The template file, called reading.tpl, looks like this:

  
$reading_room::Author
$reading_room::Title
$reading_room::Rank

And you can see that in the template each column’s name shows up, spelled and capitalized exactly as it is in the data file.

A variable with the same name as the data file, without the .dat extension, will be created in the $reading_room package, so to get our “reading” list, we would add $reading_room::reading somewhere in our blosxom flavour files, probably in head.html. Similarly if we had a data file called “movies”, then this HTML would be in the $reading_room::movies variable.

I don’t know if anyone other than me will find this useful or amusing, but if you are game to give it a go, you can download it here. The archive comes with the plugin itself, reading.dat and reading.tpl as examples, and star.gif to get you started. Please let me know if you find it useful and, more importantly, if you find bugs or have problems with it.

Update: I’ve now packaged the distro up as a zip file for those of you who may be having problems with the tarball. Get it here.