/egilh

Learning by doing

June 2007 Entries

This sounds too good to be true: Code in .NET 2.0, Build for Java, Run on Linux with Grashopper 2.0 After more than 100 person years and $12 million of direct R&D investment, and the cross-compilation of 4.7 million lines of code from .NET to Java™, we’re celebrating the release of Grasshopper 2.0. This freely-available plug-in to the Visual Studio® 2005 IDE enables you to produce .NET Web and server applications that run on Tomcat under Linux® and other Java-enabled platforms, without having to rewrite your C# or Visual Basic code. Version 2.0 introduces support for Microsoft's® Visual Studio 2005 IDE, the .NET Framework 2.0, ASP.NET ...

I know, I know. .TEXT is old ancient but it is working. I have made a couple of changes to the code and it has served me faithfully for almost 3 years, which is why I got very surprised when I suddenly started getting this error on a daily basis: "Value cannot be null. Parameter name: value" K. Scott Allen found the solution a long time ago; It is a bug in .TEXT which you can work around by setting queueStats=”false” in the Tracking section of web.config. I just updated my blogs. Please give me a shout if you see this error again.

A friend asked how to remove accents from strings in .NET 2.0. I found the code below on Michael Kaplan's blog. The code uses String.Normalize() to get a normalized Unicode representation of the string where the base character and the accents are stored separately. It then loops on each character and ignores the accent mark characters so "àáåæéèøÜü" becomes "aaaæeeøUu". public static String RemoveDiacritics(String s) { String normalizedString = s.Normalize(NormalizationForm.FormD); StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < normalizedString.Length; i++) ...