Thursday, June 14, 2007

4203.aspx

Grasshopper: code in Visual Studio, build Java and deploy on Linux

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 2.0 controls, role-based security, and C# generics.


Here you'll find articles, code samples, and forums that you can use to jump into Grasshopper 2.0. For deployments on enterprise-class Java EE servers and portal servers, as well as multiple-CPU deployments, check out Mainsoft's Enterprise and Portal editions.


To be honest, I need tools that work the other way around at the moment, letting me run Java code in a managed environment. The Microsoft Java Language Conversion Assistant 3.0 tries to convert Java to .NET but it is way behind as it only supports JDK 1.3.


For now I am forced to integrate Java in .NET using JNI or SOAP. Let me know if you find any other valid alternatives.

Wednesday, June 13, 2007

4200.aspx

"Value cannot be null. Parameter name: value" error in .TEXT

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.

4199.aspx

How to remove accents from strings in .NET

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++)


    {


        Char c = normalizedString[i];


        if (CharUnicodeInfo.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark)


            stringBuilder.Append(c);


    }


    return stringBuilder.ToString();


}

Thursday, May 24, 2007

4186.aspx

ASP/ASP.NET Response.AppendToLog() max size limit

Response.AppendToLog() is a great way to log short information with web requests in the IIS log in the "cs-uri-query" field. It makes traffic analysis and troubleshooting a lot simpler as it is possible to enrich the log with information that is not passed in the query string. You can for example log data from the users session:



Response.AppendToLog("&userid=" + Request.Session[userID])


Best of all:



  • The log is written automatically by IIS asynchronously

  • IIS takes care of rolling over the file by hour/day etc

  • The data is logged as part of the request in the IIS log exactly where you need it so you do not have to “join“ data from multiple logs

The documentation I found on the internet claimed that it is only possible to append 80 characters. This is no longer true in IIS 6 where it is possible to append data until the field is 4kb (4096 bytes)


The IIS log system has, in my opinion, one bug. If the total length of the cs-uri-query field exceeds 4kb, IIS drops all the data in the cs-uri-query field and only logs "…". I expect it to log 4093 bytes of data from the log plus a trailing "…"

4184.aspx

Community Days 2007 Milano: 21/6-22/6

Community Days 2007 Milano is an initiative by several Italian communities; ASPItalia.com, UGIdotNET.org, Visual Basic Tips&Tricks and WinFXItalia.com. The event is not free like it was last year, but the agenda looks interesting enough to be work the cost (120 euro for one day, 180 for both days).


Thursday 21 June


Web Track



  • ASP07-301 - IIS 7.0 vs. ASP.NET

  • ASP07-302 - Client-side AJAX in ASP.NET

  • ASP07-303 - ASP.NET: Advanced AJAX

  • ASP07-304 - ASP.NET: implementare ModelViewPresenter mediante la Microsoft Web Client Software Factory

  • ASP07-305 - Extending ASP.NET

Extreme track



  • EXT07-301 - Gestire la codebase con Team Foundation Server

  • EXT07-302 - Sviluppo e debug di UDF con SQLCLR e VS2005

  • EXT07-303 - BizTalk vs. servizi WCF

  • (to be announced)

  • EXT07-305 - XPS: usare XAML per creare documenti

Friday 22 June


Track WinFX



  • WFX07-301 - WPF: da Visual Studio a Expression Blend, e ritorno

  • WFX07-302 - Data binding con WPF

  • WFX07-303 - Windows Presentation Foundation 101

  • WFX07-304 - Windows Communication Foundation 101

  • WFX07-305 - Introduzione a CardSpace

Track Orcas



  • ORC07-301 - Introduzione a LINQ

  • ORC07-302 - .NET Compact Framework 3 (Orcas Edition)

  • ORC07-303 - LINQ vs. Nhibernate

  • ASP.NET 3 (Orcas Edition) Overview

  • ORC07-305 - Client-side web: Microsof Silverlight (a.k.a. WPF/E)

I learned several new things during the Community Days 2006 so I will probably go this year as well.

Wednesday, May 23, 2007

4181.aspx

poToday 2.0

My free Outlook tasks manager for the Pocket PC is available for download from the poToday home page.


Changes in .NET 2.0 version:



  • The menus have been changed to better take advantage of the application buttons in Windows Mobile 5.0.
  • Added menu for moving between days, sorting. One of the things I really like with the new menus is that it allows me to do everything with the menus and hardware buttons. No need to take out the stylus.
  • The application is a lot smaller as it no longer requires and external DLL for talking to Pocket Outlook. This MSDN article has a step by step guide for using COM objects with .NET CF 2.0.

This post explains how to work around a .NET CF 2.0 Pocket Outlook DueDate problem I found while implementing poToday 2.0


Note: adjusting the DueDate is only needed when setting the DueDate via code. Filtering on the DueDate works fine without adjusting it...

Thursday, April 5, 2007

3792.aspx

Free eBook: SQL Server Central vol 3

The free Best of SQL Server Central Vol. 3 PDF contains a lot of useful information:



64 of the highest rated technical articles published by SQL Server Central, covering every aspect of SQL Server development and administration: T-SQL programming, Disaster Recovery, BI, Reporting Services and ETL, Database Design, Performance, Security, XML and more.


220 pages of sharp, clear and code-tested solutions to SQL Server problems and challenges in easily printed PDF format. 52 of SQL Server Central's most incisive writers in one book!