Prebuilt VMWare images

Whilst perusing the latest VMWare Workstation offering from their website, I noticed that not only does VMWare offer a free VMWare player (in other words, take a VMWare disk image created by somebody else and use it), but the VMWare site also has links to various pre-built VMWare disk images, including one for BEA's complete WebLogic 8.1 environment.... Whoever thought this idea up deserves to be knighted--what a great way to make it trivially simple for somebody to get started with a rather intimidating task (be that either installing a new O/S or a new app server).

THE book to read for 2006

If you read no other book this coming year, you must read "Blink", by Malcolm Gladwell, the same author who wrote "The Tipping Point" (which is about why certain trends seem to just "take off" with no prior warning--case in point, the incredible rise of certain fashion trends, such as "Hush Puppies").. I won't tell you what it's about except to quote the back cover; to do so would ruin the book's effect, to be blunt.

World's dumbest spammer

You make the call on this one… cut & pasted directly out of the email (after the horizonal rule): Subject: Better degree-better pay! You have 2 options here, Option 1 - You can put ANY text you want in here. Option 2 - We will fill it in with the text only portion of the html message if you put the macro UNIVERSITY DIPLOMAS   OBTAIN A PROSPEROUS FUTURE, MONEY-EARNING POWER, AND THE PRESTIGE THAT COMES WITH HAVING THE CAREER POSITION YOU’VE ALWAYS DREAMED OF.

The immutable string

Mark Michaelis posted a challenge: modify a string such that the following would print “Smile”: class Program { static void Main() { string text; // … // Place code here // … text = “S5280ft”; System.Console.WriteLine(text); } } His solution? class Program { static void Main() { string text; unsafe { fixed (char* pText = text) { pText[1] = ’m’; pText[2] = ‘i’; pText[3] = ‘l’; pText[4] = ‘e’; } } text = “S5280ft”; System.Console.WriteLine(text); } } My answer; note that I believe mine to be cleaner, more elegant, and far far more dangerous, since it never uses any sort of unsafe code: class Program { static void Main() { string text; <SPAN class=kwrd>string</SPAN> internedText = "S5280ft"; String.Intern(internedText); MethodInfo mi = typeof(<SPAN class=kwrd>string</SPAN>).GetMethod(<SPAN class=str>"InsertInPlace"</SPAN>, BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(Int32), typeof(<SPAN class=kwrd>string</SPAN>), typeof(Int32), typeof(Int32), typeof(Int32) }, <SPAN class=kwrd>null</SPAN>); mi.Invoke(internedText, new <SPAN class=kwrd>object</SPAN>[] {0, <SPAN class=str>"Smile"</SPAN>, 1, 7, 5}); text = <SPAN class=str>"S5280ft"</SPAN>; System.Console.WriteLine(text); } } The point?

Academic .NET radio show debuts

Matt Cassell is putting on an Academic .NET radio show (something in the vein of .NET Rocks! but aimed at students), and asked me to be the opening episode. It’s up online now, so have a listen and see if I managed to steer the kids straight….

Anonymous generic methods making things "just work"

A good friend of mine and I are looking at taking on a new project together, and as part of the discussion we were exploring some of the differences of taking a relational perspective against an object perspective, and one of the comments she made was that in a relational model, you can always "filter" the data you want based on some predicate. "Ha!", I said, "If that's what you want, I can give you that over objects, too!" What's more, thanks to generics, I can do this for any collection type in the system without having to introduce it on some kind of base class: static class SetUtils { public static List<T Project<T(List<T list, Predicate<T pred) { List<T results = new List<T(); foreach (T p in list) if (pred(p)) results.Add(p); return results; } // Not too hard to imagine the other relational operators here, too } // Usage: class Person { private string firstName; private string lastName; public Person(string fn, string ln, int age) { this.firstName = fn; this.lastName = ln; } public string FirstName { get { return firstName; } set { firstName = value; } } public string LastName { get { return lastName; } set { lastName = value; } } public override string ToString() { return "[Person [" + firstName + "]" + " " + "[" + lastName + "]" + "]"; } } class Program { static void Main(string[] args) { Person cg = new Person("Cathi", "Gero", 35); Person tn = new Person("Ted", "Neward", 35); Person sg = new Person("Stephanie", "Gero", 12); Person mn = new Person("Michael", "Neward", 12); List<Person list = new List<Person(); list.Add(cg); list.Add(tn); list.Add(sg); list.Add(mn); List<Person newards = SetUtils.Project<Person(list, delegate (Person p) { if (p.LastName == "Neward") return true; else return false; } ); foreach (Person p in newards) Console.WriteLine(p); } } Any more questions?

Nullable Type correction/bugfix

This is a bit of old news, but the discussion came up during the Seattle Code Camp, so I thought I'd go through the problem, and use it as an example of the issues that can come up when trying to map language concepts on top of a platform that doesn't support the idea natively. Hopefully, this will cause developers looking to build DSLs or other languages on top of the .NET (or JVM) platform to see some of the edge cases a bit more clearly and a bit sooner.

HTML is not statically typed... but so what?

Dion Almaer made an interesting point recently: A friend ... talked about how it is interesting that HTML is not statically typed, yet it has scaled pretty well. The internet architecture has made this happen. We are loosely coupled and modules (pages/site) are seperated out. Except that HTML itself really had nothing to do with the architecture of the Web, Dion--it is just a presentation format. We could have been "just" as successful in growing the Web (from a scalability perspective) had the presentation format been PDF, Flash, or you name it.

Porting legacy code

Matt Davey poses an interesting question: The problem: C++ Corba legacy codebase (5+ years old, 1 million lines) No unit tests Little test data Limited knowledge transfer from the original development team. A flake environment to run the application in. The requirement: Port the C++ result accumulation and session management code to Java Do you: Write C+ unit tests to understand the current system, then write Java equivalent code using TDD Write Java tests using TDD based on your understanding of the C++ code Hope you understand the C++ code, and JFDI in Java Give up and go home Get the original development team to do the work Ah, I love the smell of legacy code in the morning.

Concurrent languages

Ever since the Seattle Code Camp, where I hosted a discussion (hardly can call it a lecture–I didn’t do most of the talking this time, as it turned out) on language innovations, one of the topics that came up was the notion of concurrency, and of course Herb Sutter’s “No More Free Lunch” article from DDJ from some months ago. That put a bug in my ear: what sort of languages out there support concurrency in some form, baked into the language?