Saturday, December 16, 2006


Remote 60 for Symbian Series 60 devices

Remote S60 is a great tool if you, like me, write applications for Symbian devices or show demos of mobile portals. There are special stands that uses a video camera to record and show what happens on the device but they cost more, and it is yet another gadget to drag around. Remote S60 on the other hand, costs $25 and does not require any additional hardware. It uses Bluetooth, IrDA, TCP/IP or the data cable to remote control the phone and display what is on the phone screen on the PC.

The following screen shot was taken from my phone with the demo version:

You can even control the phone using the keyboard on the PC which makes demos faster and easier. It also lets you you take screen shots and record the action to an AVI movie.

Thanks for the tip Alessandro.

Friday, December 15, 2006


An honest politician in the Italian parliament???

What, is it possible???
Honest politicians don't exist by definition, especially Italian ones, but Di Pietro seems to be an exception. There has been a lot of discussions this year regarding the new budget plan and it has caught the attention of everybody. Nobody noticed that the communist majority government managed to sneak in a new law where they eliminate financial crimes committed by the Court of Auditors. Apart from Di Pietro that is, which made it pretty clear that the law must be removed or he leaves the majority government (which practically makes it a vote of confidence):

(AGI) - Rome, Dec. 15 - “... we are not here to have our leg pulled by those who use legal means for immoral ends“. Di Pietro's anger is against "the sly action of something within the majority, and maybe also of the government, which inserted a measure within the amendments that is disastrous for the credibility of the Unione coalition, regarding the elimination of financial crimes committed by the Court of Auditors." 

I rarely post about Italian current affairs or politics as I don't have the right to vote (even though I have lived here for more than a decade) but this really caught my attention. Finally a politician who is not interested in rubbing the backs of other politicians (or keeping his position in government if he continues like this :-)

Wednesday, December 13, 2006


Create MSDN like documentation with Microsoft Sandcastle

Documentation is usually the weak point of most software development projects. Maintaining separate documentation from the code just does not work. Microsoft has released a Community Technology Preview of Sandcastle which is used internally in Microsoft to build the .NET framework documentation. Sandcastle produces accurate, MSDN style, comprehensive documentation by reflecting over the source assemblies and optionally integrating XML Documentation Comments.

Other Sandcastle resources:


An Open future for iTunes and the iPod

Thanks to DVD Jon we can look forward to iTunes compatible music players from other companies than Apple, and using other music stores like Napster with the iPod. From the article on Yahoo:

"He imitated Apple's system; he didn't remove any copyright protections," said Monique Farantzos, whose DoubleTwist Ventures plans to license the code to businesses. "He made a system that behaves in a similar way."

Jon Lech Johansen has essentially created software that in a way tricks iTunes into thinking a competing device with the DoubleTwist code is an iPod, said Farantzos who predicted it could be available to consumers as soon as the beginning of 2007.

"What this means in practice is that competing (download) stores would be able to make their encrypted content compatible with the iPod, she said. "Hardware devices that have this code embedded could play iTunes content."


She also declined to go into specifics about how the hacker known as DVD Jon -- who now works at DoubleTwist -- cracked Apple's code. But Farantzos sees no legal complication arising from the technology she said does not remove any copyright protection.

More importantly, Apple would also find it difficult to update its software to block DoubleTwist as the company did when RealNetworks Inc. (Nasdaq:RNWK - news) offered songs for download that worked with iPods, she added.

"We followed a different strategy than RealNetworks. We don't believe it is practical for Apple to block this."

Way to go Jon!


A richer Internet Archive

The Internet Archive contains more than two petabytes (growing at a rate of 20 terabytes a month) of contents ranging from, movies, texts, audio and now also software.

After winning the latest lawsuits there are several exemptions to the Digital Millennium Copyright Act. It is great news for all of us, not only the internet archive:

  • you can copy old computer games (if the original machine, format or technology is obsolete)

  • users of mobile phones can circumvent the technology which makes the phone only work with one network.

  • you can copy "dongle protected" software when the dongle has been damaged and a replacement is no longer available.

  • educational establishments can "break" digital rights management (DRM) technology for audiovisual works to be used by media studies or film classes

  • you can bypass DRM on CDs in order to test and fix DRM technology which might damage your computer

The Register has the details of the lawsuits.

Wednesday, November 29, 2006


Java is finally free

Sun has released Java to the open source community under the GPL version 2 license.

The following components of the JDK has been open sourced so far, more elements of the JDK are on the way:

  • javac, the Java programming language compiler

  • Java HotSpot Virtual Machine

  • JavaHelp 2.0 extensible help system

Sun is also establishing the OpenJDK Community:

The OpenJDK Community is where developers will gather to collaborate on the open-source JDK code base and related projects. The OpenJDK project in which the open-source code base will ÒliveÓ is part of this community. Through the OpenJDK project, developers will be able to directly influence the future of the JDK implementation, participate with their peers in an open community and help take Java technology where it hasn't been before. Sun is evolving the existing JDK Community, where developers have been working on the source code over the past two years, into a site where Sun and non-Sun developers alike can collaborate together on the implementation.

More information at the Java OpenSource FAQ

Tuesday, November 28, 2006


XML Notepad 2007

Microsoft has released XML Notepad 2007. The design of the previous version, XML Notepad 2006, is explained in detail on MSDN.

Handy features include:

  • Tree View synchronized with Node Text View for quick editing of node names and values.

  • Incremental search (Ctrl+I) in both tree and text views, so as you type it navigates to matching nodes.

  • Cut/copy/paste with full namespace support.

  • Drag/drop support for easy manipulation of the tree, even across different instances of XML Notepad and from the file system.

  • Infinite undo/redo for all edit operations.

  • In place popup multi-line editing of large text node values.

  • Configurable fonts and colors via the options dialog.

  • Full find/replace dialog with support for regex and XPath.

  • Good performance on large XML documents, loading a 3mb document in about one second.

  • Instant XML schema validation while you edit with errors and warnings shown in the task list window.

  • Intellisense based on expected elements and attributes and enumerated simple type values.

  • Support for custom editors for date, dateTime and time datatypes and other types like color.

  • Handy nudge tool bar buttons for quick movement of nodes up and down the tree.

  • Inplace HTML viewer for processing xml-stylesheet processing instructions.

  • Built-in XML Diff tool.

The source code should be on CodePlex but I have not been able to find it yet...

Thursday, November 16, 2006


Windows PowerShell v1.0

Windows PowerShell v 1.0 ex Monad has been released. It is available for Windows Vista, Windows XP and Windows Server 2003 in English and localized version. The Scripting with Windows PowerShell site has more documentation and webcasts.

Main features:

  • More than 130 command-line tools (called "cmdlets") for performing common system administration tasks, such as managing services, processes, event logs, certificates, the registry, and using Windows Management Instrumentation (WMI).

  • Command-line tools are designed to be easy to learn and easy to use with standard naming conventions and common parameters, and simple tools for sorting, filtering, and formatting data and objects.

  • Support for existing scripting languages and existing command-line tools, and multiple versions of Windows, including Windows XP, Windows Server 2003, Windows Vista™, and Windows Server code name “Longhorn".

  • Features that enable users to navigate data stores, like the registry and certificate stores, as if they were a file system.

  • Standard utilities for managing Windows data in different stores and formats, including Active Directory Service Interfaces (ADSI), Windows Management Instrumentation (WMI), Component Object Model (COM) objects, ActiveX Data Objects (ADO), HTML, and XML.

  • Sophisticated expression parsing and .NET Framework object manipulation at the command line, including pipelining of objects help IT professionals to work more efficiently and effectively.

  • An extensible interface that enables independent software vendors and enterprise developers to build custom cmdlets to meet unique application and system administration requirements.

Tuesday, November 14, 2006


poSecrets 2.0

I have just uploaded poSecrets 2.0 in the downloads section.

Main changes from version 1.5:

  • Added new field, URL

  • Added "Go to site" command. It launches the default internet browser on the PC or the Pocket PC with the URL of the selected item.

  • Changed form display location

  • Fixed column sort bug on notes field

Note: poSecrets 2.0 is able to open files created with older versions of poSecrets. It automatically updates the file format when you save so you must update to poSecrets 2.0 on both the PC and the Pocket PC.

Enjoy, and let me know if you find any bugs or have any suggested improvements.

Tuesday, October 17, 2006


Microsoft Italy Innovation Tour

Microsoft Italy is hitting the road this winter with the Starting Innovation Tour:

  • Tuesday: dedicated to partners

  • Wednesday: dedicate to developers, IT professionals, OEMs/System builders

  • Thursday: dedicated to companies, professionals,  schools and public offices.

Each day is split in multiple tracks. The developer day, for example, has three parallel tracks:

  • TechNet track for IT professionals

  • MSDN track for developers

  • OEM/System Builder track

The show hits Milano in late November and I will attend the MSDN developer track. See you there?


Free automatic contact dialer for the Pocket PC

I have just made the poDialer available in the download section.

poDialer is a very simple application that I wrote for some colleagues a while back. It lets you call many contacts after another. It integrates with the contacts in Pocket Outlook using the POOM .NET CF library to display the list of contacts with at least one phone number:

The POOM library makes it a snap to get the contacts:

const int LOAD_STEPS = 10;  // Number of updates/steps on the progress bar            
// Log in to Pocket Outlook
_pocketOutlook = new PocketOutlook.Application();

PocketOutlook.Contact contact;
PocketOutlook.ItemCollection allContacts = _pocketOutlook.GetDefaultFolder(
(int) FolderType.olFolderContacts).Items;
// Show progress bar
// Setting the progress for each contact is expensive if we have many contacts
so we only show LOAD_STEPS steps on the entire progressbar
progressLoad.Visible = true;
progressLoad.Minimum = 0;
progressLoad.Maximum = LOAD_STEPS ;
int loadFactor = allContacts.Count / LOAD_STEPS;
_contacts = new Contact[allContacts.Count];
int contactsWithNumber = 0;
for (int i = 0; i < allContacts.Count; i++)
    if (i % loadFactor == (LOAD_STEPS -1 )) progressLoad.Value++;               
    contact = (PocketOutlook.Contact) allContacts.Item(i + 1);    // 1 based
    // We add contacts with at least one phone number
    if (contact.BusinessTelephoneNumber.Length > 0 ||
        contact.MobileTelephoneNumber.Length > 0)
        _contacts[contactsWithNumber++] = contact;
// Log off from Pocket Outlook

The details of each contact is displayed and it lets you choose the number to dial (business or mobile).

Very basic with big buttons. It may be ugly but it is handy as you can control it with a finger instead of having to use a stylus. No need to install; just copy the .EXE and .DLL to the device or a SD Card.



poDialer is a very simple application that I wrote for some colleagues a while back. It lets you call many contacts after another. It integrates with the contacts in Pocket Outlook using the POOM .NET CF library to display the list of contacts with at least one phone number:

The POOM library makes it a snap to get the contacts:

const int LOAD_STEPS = 10;  // Number of updates/steps on the progress bar            
// Log in to Pocket Outlook
_pocketOutlook = new PocketOutlook.Application();

PocketOutlook.Contact contact;
PocketOutlook.ItemCollection allContacts = _pocketOutlook.GetDefaultFolder((int) FolderType.olFolderContacts).Items;
// Show progress bar
// Setting the progress for each contact is expensive if we have many contacts so we only show
// LOAD_STEPS steps on the entire progressbar
progressLoad.Visible = true;
progressLoad.Minimum = 0;
progressLoad.Maximum = LOAD_STEPS ;
int loadFactor = allContacts.Count / LOAD_STEPS;
_contacts = new Contact[allContacts.Count];
int contactsWithNumber = 0;
for (int i = 0; i < allContacts.Count; i++)
    if (i % loadFactor == (LOAD_STEPS -1 )) progressLoad.Value++;               
    contact = (PocketOutlook.Contact) allContacts.Item(i + 1);    // 1 based
    // We add contacts with at least one phone number
    if (contact.BusinessTelephoneNumber.Length > 0 ||
        contact.MobileTelephoneNumber.Length > 0)
        _contacts[contactsWithNumber++] = contact;
// Log off from Pocket Outlook

The details of each contact is displayed and it lets you choose the number to dial (business or mobile).

Very basic with big buttons. It may be ugly but it is handy as you can control it with a finger instead of having to use a stylus. No need to install; just copy the .EXE and .DLL to the device or a SD Card.

Monday, October 16, 2006


Everyone wants our code

I have lost of how many sites wants to host our code;

Looks like the next battleground will be code search.

Google is catching up with others like Koders and CodeKeep that have been around for a while. But once again Google does what it does best; Google Code Search delivers relevant search results fast. Krugle, on the other hand, has a lot richer interface for viewing the code. Great if you are looking for information on how to use a particular API in context but I still prefer the speed and accuracy of Google. The results page are a bit spartan as you can only see a three lines of code which is pretty useless when you results like this;

// System.Net.CookieCollection

I found the result above while searching "CookieCollection" on the various code search engines as I am looking for Cookie and CookieCollection implementations for .NET Compact Framework. I have considered implementing a Gmail notifier for the Pocket PC  for a while but the lack of cookie support by .NET CF makes it a pain. I know, cookies are only HTTP headers, but the Gmail API makes heavy uses of the cookies so I have to make significant changes to the API. I tried the usual resources like which has come to the rescue several times in the past. But, but this time, the winner is Google Code Search as it found the Mono source code for System.Net.Cookie in the Gentoo distribution.

I also found the documentation I need on MSDN for writing Today Screens plugins in .NET CF so now the only thing I need is time.
Please let me know if you have any to sell :-)


Free event: workshop on Microsoft SQL Server 27/10 in Milano

Microsoft organizes a free workshop 27/10 on SQL Server in Milano that covers;

  • The Storage Engine

  • Index design

  • Stored procedures

  • Data modeling and DB design

Thanks for the tip Michele

See you there?

Monday, October 2, 2006


How to implement a JavaScript eval function in c#

I recently needed a javascript like eval() function for a .NET project. I didn't feel like porting JPLite so I googled a bit until I found this gem that saved my day: An Eval Function for C# using JScript.NET (JavaScript)

It shows how to use the out of the box .NET libraries to implement a eval() function using JScript.NET. The code works but it is not thread safe. With some minor adjustments you get this neat boolean evaluator function (comments and error management removed to save space):

using System;
using System.CodeDom.Compiler;
using System.Reflection;
using Microsoft.JScript;
namespace  JavaScript
{    public class Evaluator
        private static Type _evaluatorType = null;
        private static readonly string _jscriptSource = 
            @"package Evaluator
                    class Evaluator
                        public function Eval(expr : String) : String 
                            return eval(expr); 
        static Evaluator()
            ICodeCompiler compiler;
            compiler = new JScriptCodeProvider().CreateCompiler();
            CompilerParameters parameters;
            parameters = new CompilerParameters();
            parameters.GenerateInMemory = true;
            CompilerResults results;
            results = compiler.CompileAssemblyFromSource(parameters, 
            Assembly assembly = results.CompiledAssembly;
            _evaluatorType = assembly.GetType("Evaluator.Evaluator");
        // ...
        public static bool EvalToBoolean(string statement)
            string s = EvalToString(statement);
            return bool.Parse(s);
        public static string EvalToString(string statement)
            object o = EvalToObject(statement);
            return o.ToString();
        public static object EvalToObject(string statement)
            object evaluator = Activator.CreateInstance(_evaluatorType);
            return _evaluatorType.InvokeMember("Eval", 
                    BindingFlags.InvokeMethod, null, evaluator, new object[] 
                                                          { statement } );                

Example usage:

System.Console.Out.WriteLine("1==1 : {0}", 
System.Console.Out.WriteLine("'abcd'.indexOf('c') : {0}", 


1==1 : True
'abcd'.indexOf('c') : 2

I spend most of my time working with Java these days and I keep banging my head against the wall regarding the a lack of decent multi-threading features. It is true that there are a lot of open source libraries out there that helps but why re-invent the wheel or go crazy integrating 3rd party libraries when you get all the features you need out of the box? Don't get me wrong; I have a lot of fun with Java but once in a while I miss my C#...

(Edited for layout issues on small screens)

Friday, September 29, 2006


Is teaching kids, developers and dogs the same thing?

After a loooong pause this summer due to work I started taking lessons with Sydney again. What I really appreciate about the training is that the instructor does not train Sydney, but me. The instructor never gives a command to Sydney. All commands, and the way Sydney behaves, are explained to me and I do my best to teach Sydney. Instead of coming back with a programmed robot I get trained to understand what Sydney wants, needs and why he behaves the way he does.

I try to take a similar approach with the developers I work with but it is not simple; it is a lot faster to just fix the problem than take the time to explain and teach the developer what is wrong and then guide the developer to fix the problem. I failed at it yesterday evening when I fixed a problem in two minutes in front of the developer instead of couching the developer to fix it. I blame it on the late hour but I shouldn't have as I know better. I really do believe that MS Dos device driver project. Even worse; I fixed the problem with someone else present. A big no-no as it may make the person look "bad" in front of others and reduce self esteem. Sorry...

Back to the training with Sydney; I was a bit disappointed this summer as Sydney was great at home but was difficult to control in a parks with many dogs. The instructor explained the reason earlier this week; staying at home with no dogs around is very different from having another dog around, which is very different from having a female dog around which is completely different from having 10 dogs running around in a park. The only way is to take small steps at a time; don't expect miracles but encourage good behavior and ignore wrong behavior when possible.

(BTW: all the “lessons“ applies to raising kids; just replace "developer" or “Sydney“ with "kid" above…)

Thursday, September 28, 2006


Visual Lego & Microsoft Robotics Studio September CTP

I have been too busy lately to play as much with my Lego Mindstorms NXT as I had hoped. I constructed the TriBot and got it to do the basic tricks; wait for the ball to be dropped, drive forward, pick it up, turn around an drive back until it crossed the line etc. But the Lego NXT kit has a lot more to offer and the latest September CTP of Microsoft Robotics Studio shows some of the things you can do with it and other robot kits. The "Tutorial for Using MSN Live Messenger to Control a Robot" looks particularly neat:

You can download the September CTP here.

Visual Lego, on the other hand, takes a different approach. Instead of providing a "virtualization layer" for a lot of different bot hardware it is targeted squarely at the LegoNXT. It keeps the API as well as the operations a lot simpler. No need to run a .NET "host" program on the Lego brick, just turn on the NXT and run.


Thursday, September 21, 2006


Windows 95 Hero


I spend most of my time working at the site of clients so I am almost never in the office. Yesterday I was in the office for an internal project and I found the "Hero Award" and some other items from last millennium when I worked for Microsoft;

(Signed by David Cole and Brad Silverberg)

You can say what you want about Windows 95, but I have really fond memories of my time in Microsoft. I worked my ass off the last few months before shipping Windows 95 but I learned a lot and met a lot of wonderful, and interesting, people.

Tuesday, September 19, 2006


All good programmers are lazy

It is official, all good programmers are lazy

Lazy, because only lazy programmers will want to write the kind of tools that might replace them in the end. Lazy, because only a lazy programmer will avoid writing monotonous, repetitive code - thus avoiding redundancy, the enemy of software maintenance and flexible refactoring. Mostly, the tools and processes that come out of this endeavor fired by laziness will speed up the production.

The article goes on to claim that all good programmers must be stupid:

Why? Because if he's smart, and he knows he is smart, he will:
a) stop learning
b) stop being critical towards his own work
But there's a more crucial point why a good programmer must be dumb. That's because for him to find the best solutions to problems, he must keep a fresh mindset and manage to think out of the box (or rather, know its actual shape). In a way, this leads to the mindset of a child; incredibly creative because he never heard "no" for an answer.

I could not agree more. I have learned two very important lessons in life (both from my mother):

  1. Nothing is impossible.

  2. You can if you want

They both amount to the same thing; you can accomplish some incredible things if you put your mind to it (it has also made both of us incredibly stubborn but that is another story :-)

The article goes on to discuss another very important aspect of being a great programmer; troubleshooting

I know from my work that a good programmer, ..., will adopt this mindset of being dumb; he will start asking the most simple, child-like questions. Because he doesn't accept the parameters suggested to him that someone thinks make up the problem.

KISS people as Occam's razor strikes again. I only copied and commented on what I think are the key points in the article. Read it and let me know what you think.

Friday, September 15, 2006


The Borland Turbo products are back

The Borland Turbo products are back, but with a twist; this time they are free. I used the Turbo products a lot for my first consulting jobs and when I studied. They were far superior to anything else on the market. But then I hit a nasty bug in the Turbo C++ compiler (wrong offset in a class v-table) and I had to "port" everything to Microsoft C++ 6.0. The Microsoft compiler was a lot slower and used an old & ugly DOS user interface but at least generated the correct code.

I have never tried Borland Delphi but I will give it a try now. Many developers claim it's the best thing there is for developing Win32 apps and I am curious to see how much it has evolved from Turbo Pascal 4.2. Talk about memories; I thought myself programming from the Turbo Pascal help files and examples. Try that with .NET and MSDN!

The Borland Turbo Explorer products are pretty much like the Microsoft Visual Studio Express products but with a more severe limitation; you can only install one Turbo Explorer product per machine. You can download the Turbo products on the Borland site.

Thanks for the tip Valerio!

Monday, August 28, 2006


Programmer's Bill of Rights

Jeff Atwood for president! I completely agree with his Programmer's Bill of Rights and I wish I worked in a place they were respected. Let's see how "compliant" I am:

  • Every programmer shall have two monitors: I wish! Then again; I cannot complain as I am one of the lucky few with a 17 inch monitor on my laptop.

  • Every programmer shall have a fast PC. It was fast 2 years ago… Having a fast PC is a must though. Waiting wastes the clients time and causes frustration (especially if you're not lucky enough to have a permanent place to make your home so you have toys to play with. Hm... If it was safe to leave anything more valuable than a chewing gum on the desk I could do some Lego NXT coding during lunch :-).

  • Every programmer shall have their choice of mouse and keyboard. Compliant! (I buy my own...)

  • Every programmer shall have a comfortable chair. Very important in the long run. I seriously hurt my back in the past because of a lousy chair combined with tons of overtime andlittle exercise. A double disk hernia is not fun at all. It took me years of pain & practice to get back in shape.

  • Every programmer shall have a fast internet connection: Sharing a 2Mbit line with 60 other people isn't what I would call fast.

  • Every programmer shall have quiet working conditions: Impossible with the people I share my office with :-)

One thing is missing from my point of view; Each developer should have access to a whiteboard. Discussing architectures/code/problems on a large whiteboard where persons can erase/add pieces is a lot more productive than scribbling on a piece of paper.


Visual Studio 2005 Team System for Database Professionals CTP

Finally a tool from Microsoft that gives better control over database development. Visual Studio 2005 Team Edition for Database Professionals addresses common problems with database development today:

    • The new Visual Studio Database Project allows you to import your database schema and place it under source control. When the time comes to deploy schema changes the new project system allows you to quickly build update scripts and then provides a mechanism to deploy them to the database of your choice

    • Rename Refactoring allows you to easily rename any object in your database and be assured that all references to that object will be renamed to correspond to the change

    • A New T-SQL editor allows you to be more productive when writing T-SQL code from within Visual Studio including support for parallel execution of queries and viewing of execution plans

    • SchemaCompare allows you to quickly compare the schema of two databases (or your source controlled project and a database) and script updates to bring the database schemas into sync

    • DataCompare allows you to quickly compare two databases and script updates to bring the data in these databases into sync

    • The Database Unit Testing infrastructure allows you to create database unit tests using T-SQL or managed code

    • DataGenerator lets you create data generation plans that produce repeatable sets of meaningful data based upon your existing production databases that can be deployed to a database prior to running unit tests thus ensuring consistent test results

Finally! I have seen too many cases at clients where stored procedures have names like usp_whatever_1, usp_whatever_2 and usp_whatever_new because they have no idea what the change may break or a way to roll back to an older version.  I have written several ad-hoc data synchronization tools in the past so I look forwared to having a tool that not only synchronizes data but schemas as well. All of it integrated in Team Systems. What more can you ask for?

Thursday, August 24, 2006



Time flies. It has been two years since the first post on /egilh; Selecting a random record from SQL

I have not always been able to make a post a day but the statistics are not bad:

  • 1002 posts


  • 6791 comments caught by the comment spam filter

The development posts get the majority of the comments and requests for help;

Keep the comments coming and let me know if you have any tips, suggestions or questions.

P.S. There are "only" 248 posts on /egilh, the other posts are on Cool Or What?, Crap And Crapability and Coolissimo!

Tuesday, August 22, 2006


Christmas arrived early this year

It looks like the postman just came back from vacation as I got no less than 3 packages today :-)

  1. I cannot wait to see what I can make the Lego Mindstorms NXT do with Microsoft Robotics Studio

  2. Books from (I'm reading a couple of development books but I need a break once in a while :-) Harlan Coben: Gone for Good, Harlan Coben: The Final Detail, David Baldacci: Split Second, David Baldacci: Last Man Standing 

  3. I bought some of the things I will sell in the Coolissimo store on cafepress as I wanted to check the quality and get some "Don't break balls" mouse pads for my colleagues.

Monday, August 21, 2006


A DIY bicycle kit for a large dog

Sydney is getting bigger and stronger each. He's more than 70 cm to the shoulder blades and getting close to 40 kg. No fat, all muscles and energy. Plenty of energy.

I used to bike holding his chain in my hand on the handlebar but that was getting impossible.  He is still (one big) puppy so he has zero impulse control. When he sees something he likes he stops dead in his tracks and you can image how that feels when he his attached to the handlebars of a bike. An accident waiting to happen in other words.

I found the Springer on the internet and I have been looking for local animal shops that carry it, or something similar, but I didn't have any luck. Until I went to Norway on vacation this summer. Stopping for a lunch break I found the Walky Dog in a shopping centre. I was ready to buy it when I noticed that it was made in Italy. The car was already more than full so I decided to buy it when I came back to Italy. Or so I thought…

Coming back to work in Milano in August is great. The city is practically empty and there is -no- traffic. A paradise in other words, unless you want to buy something. The Walky Dog web site would accept orders but they, like the rest of Italy, were closed so I would get it in September sometime.

In the end I did the only thing I could think of; I went to a local hardware store and bought the necesarry ingredients to build my own:

  • 1 m piece of round wood: 3 euro
  • 2 pack of  collars for 1 inch tubes: 2.20 euro
  • 4 pack of eye screws: 1.75 euro
  • 2 meter elastic cord: 3.10 euro
    (+ one old old hook for the colar…)

Enough material to build several DIY Springers. Which was just as good as it took me several attempts to get it right.

I should have known better; never use a Version 1.0 product. It basically broke the moment Sydney started pulling for real (after 10 meters). The thin collar and screw never stood a chance. Back to the hardware store to buy a heavy duty version of the tube collar. But Service Pack 1 met a tragic end as well. I had used 60 cm of the wood which was way too long. It broke the first time I hit the brakes:

Service Pack 2 introduced several changes:

  • Shorter stick (from 60 cm to 25cm)
  • Strengthened the critical area of the stick with iron wire

It lasted a lot longer. Until we met the first dog when the thick screw was bent. It looks better than the first screw but it was clear it wouldn't last many trips:

Service Pack 3 strengthened the screw. I cut it as short as possible but it was still a bit too long as it bent under stress.

The final XP Version:

  • Improved security (I strengthened the screw with a couple of nuts)
  • Improved the user interface by hiding the ugly metal wire with some blue tape :-)

Here is Sydney inspecting the final version:

I am sure the "professional" devices are better but the DIY version works for me. The rope fits over the seat of the bike and I can easily take it off and unscrew the stick to take Sydney for a walk. I had fun building it and even more fun biking with Sydney as it is a lot safer:

  • Keeping Sydney's chain on my hand the bike would move when he slowed down or sped up. The stick is attached to the frame of the bike so he ends up pulling me instead of throwing me off the bike if he runs or stops.
  • Sydney would try to run in front of the bike if he saw something interesting on the wrong side of the road. With the stick he cannot. The rope is so short that he can only get even, but not in front of, the front wheel.
  • I can keep my eyes on traffic instead of trying to watch traffic, sydney and things that could distract Sydney at the same time

Saturday, August 19, 2006


How to prevent files from being opened automatically in Internet Explorer

A reader asked me how to force Internet Explorer to display the file download dialog. The how to force the download dialog box to appear post explains how to do it on the server side but the reader wanted to change the behavior of Internet Explorer.

Adobe Acrobat is one program that opens its files inside Internet Explorer by default and I don't like it either. It is a frequent cause of crashes in Internet Explorer and the PDFs ends up in the temp directory. Some programs, like Adobe Acrobat, turn on this behavior by default, other times the user clicks the "Always ask before opening this type of file" check box by mistake.

These are the steps to change the behavior of Internet Explorer so it always opens the File download dialog (on Windows 2003):

  • Double-click My Computer.

  • On the Tools menu, click Folder Options.

  • On the File Types tab, click the appropriate file type in the Registered File Types box.  (PDF for example)

  • Click Advanced.

  • Click to select the Confirm Open After Download check box. 

  • Click OK, and then click Close.

More details and instructions for other versions of Windows in this Knowledge Base article

Friday, August 18, 2006


Free Microsoft XNA Game Studio Express

Microsoft has announced XNA Game Studio Express. A free set of tools based on the XNA platform to enable anyone to easily create games for both Windows and the Xbox 360 console. The free Express version lets you create commercial games for the Windows platform but you have to wait for the Professional edition next spring to create commercial titles for the Xbox 360.

It is not entirely free to develop for the Xbox 360 though. You must buy a XNA Creator's Club subscription ($99 for a year, $49 for 4 months) on Xbox Live Marketplace to develop, debug and/or play games developed for the Xbox 360.

The XNA FAQ has more information on which features are available in the upcoming beta.

Friday, August 11, 2006


Spending the summer in Milano with your kids?

The city of Milano has created a rich program for kids that spend August/September in town. There are activities every day and my kids had a ball when they went earlier this week to some activities organized at Castello Sforzesco

More information on the E…state con noi site (Italian only).

Thursday, August 10, 2006


Microsoft buys Winternals and SysInternals. Mark and Bryce join Microsoft.

Microsoft bought Winternals and SysInternals and hired both Mark Russinovich and Bryce Cogswell while I was on vacation. It is good news for the future of Windows as Mark will be working on the core of the Windows platform:

I’m joining Microsoft as a technical fellow in the Platform and Services Division, which is the division that includes the Core Operating Systems Division, Windows Client and Windows Live, and Windows Server and Tools. I’ll therefore be working on challenging projects that span the entire Windows product line and directly influence subsequent generations of the most important operating system on the planet. From security to virtualization to performance to a more manageable application model, there’s no end of interesting areas to explore and innovate.

I was worried about the future of the fantastic SysInternals tools but it looks like they can continue to work on them:

I’m pleased to report that Microsoft’s number one priority is not only keeping the tools freely available, but preserving the Sysinternals community including the newsletter, the forums, and my blog. While we’re still brainstorming how to make this successful in the long term, I’m pleased to announce the first step in the transition, which is the introduction of a new Sysinternals EULA, that I believe is even more permissive than the EULA in place before the Microsoft acquisition, since it allows for wider use of Sysinternals utilities within a company.

Good luck to Mark and Bryce on their adventure in Microsoft.

Wednesday, August 9, 2006


Summer vacation 2006

The only bad thing about it; it is over :-(

I came back this weekend after 3 weeks camping around Europe. Total relax and "back to basics" with no work, blogs, e-mail, TV, mobile coverage or electricity. Had lovely weather until the end of the vacation which is great. Coming back to a "fresh" Milano is just fantastic as it can be boiling at this time of year sometimes.

Most of the first week was spent camping on the way up through Europe on the way to Røros. The first major stop was Euro Disney. It was a  fairytale like most Disney cartoons. Very well kept and organized. We also stopped in Hunderfossen to spend a day with my cousin which has kids that are the same age as mine. It has a Norwegian theme and it is a smaller than Euro Disney but we had plenty of fun anyway.

Most of the vacation was spent in the Røros area and in my mums cabin in Hessdalen. Røros is a nice small town and was the scene for (at least) one of the Pippi movies. The cabin in Hessdalen is a typical Norwegian cabin and left a lasting impression on the kids:

  • it is in the middle of nowhere:

    • in summer you have 15 min walking uphill to get there

    • in winter you have 5 km by cross country skis to get there

  • no water, electricity or plumbing. You wash yourself and brush the teeth in the stream running close by.

  • they got fishing rods for their birthdays and both of them got fishes (small trouts) on their first fishing trip...

On the way down to Italy we stopped in one of the many great campings in Denmark; Billund FDM camping. It is just fantastic for kids and highly recommended. It is the only camping I have ever seen with a family toilet; a large shower that lets you have a shower with the kids, toilets for grownups and kids, sinks for grownups and kids. Legoland itself was even better. Smaller than Euro Disney but more suited for families with kids;

  • each attraction with potential queues has a play area with Lego. The kids play while the parents stay in the queue. When it's their turn they can take a shortcut to join the parents.

  • there are dedicated pic-nic areas

I came THIS close to buying the Lego NXT for playing with Microsoft Robotics but in the end I did not buy it. The store in Legoland sold it for Danish retail price of 2.499DK (~330 euro) but the suggested retail price for Italy is ~250 euro so I decided to wait a bit more.

Sorry, but I did not manage to blog anything in July due to my work on mobile services for the Football world cup and my vacation. Things will be hectic for another few days but my blog activity should increase again during the autumn. I have a couple of cool tools (with source) in the pipeline that I will release soon.

Friday, June 23, 2006


Microsoft Robotics Studio

Microsoft Robotics Studio is the excuse I have been waiting for to buy a robotics kit. I am particularly tempted by the Lego NXT as I have the added excuse of playing Lego with the kids :-) It is too warm in Milano these days to stay inside and work have fun with robotics but I am looking forward to having some fun this autumn.

The Community Technical Preview comes with with samples and tutorials and can be used to develop applications on different hardware. The Microsoft Robotics Studio Simulation Engine lets you play around without having a physical robot. Microsoft Robotics Studio offers:

  1. A scalable, extensible runtime architecture that can span a wide variety of hardware and devices. The programming interface can be used to address robots using 8-bit or 16-bit processors as well as 32-bit systems with multi-core processors and devices from simple touch sensors to laser distance finding devices.

  2. A set of useful tools that make programming and debugging robot applications scenarios easier. These include a high quality visual simulation environment that uses the Ageia Technologies™ PhysX™ engine.

  3. A set of useful technology libraries services samples to help developers get started with writing robot applications.

Thanks for the tip Michele

Thursday, June 22, 2006


Microsoft Certified Architect

I am not a fan of Microsoft Certifications but the new Microsoft Certified Architect program looks promising:

The Microsoft Certified Architect Program will validate top industry experts in Information Technology Architecture. These professionals will likely have 10 or more years of experience in Information Technology with at least three years of experience as a practicing architect, and will possess strong technical and leadership skills and form a distinguished community. Unlike other Information Technology certifications, this credential will be granted by industry architects, as candidates will be required to present to and be approved through a rigorous review board process overseen by previously certified architects.

A longer and more expensive process but hopefully the certification process will give more accurate results:

  1. The candidate applies for the program by completing the program application and paying the application fee.

  2. The candidate's application is assessed relative to the established criteria, such as years and type of experience, architectural knowledge, and complexity of technical solutions to determine whether the candidate will advance in the application process. If he or she does advance, the next step is a telephone screening with an MCA who will determine whether the candidate is accepted into the program.

  3. Upon acceptance into the program, the candidate will work with mentors to prepare for his or her review board interview. Additionally, the candidate will continue to work on his or her documentation. The documentation consists of a dossier that includes a work history, an architectural solution case study, and a document specifying instances in which the candidate has displayed the program competencies.

  4. As soon as a mentor determines that the candidate is ready, the candidate submits his or her final documentation and schedules the review board interview. For more information about the review board interview, see Review Board Interview.

  5. At the conclusion of the interview and a positive vote from the review board, the candidate is awarded the MCA credential. For information about the composition of the review board, see Review Board Composition.

Friday, June 9, 2006


How to fix "java.lang.OutOfMemoryError: unable to create new native thread"

I recently came across this exception on a couple of java systems that use many threads  java.lang.OutOfMemoryError: unable to create new native thread. The strange thing was that the JVM had been assigned a lot of memory (1.5GB) and that it had at least half the memory available. Michele found this article that points out that the more memory you give to the JVM the more likely you are to get java.lang.OutOfMemoryError: unable to create new native thread exceptions when you have many threads.

Which makes perfect sense when you think about it. Each 32 bit process on Windows has 2GB "available" memory as 2GB is reserved to Windows. In my case the JVM grabbed 1.5 GB leaving 500MB. Part of the 500MB was used to map system dlls etc in memory so less than 400 MB was left. Now to the crucial point: When you create a thread in java it creates a Thread object in the JVM memory but it also creates a operating system thread. The operating system creates the thread with a thread stack in the 400MB that is left, not in the 1.5 GB allocated in the JVM. Java 1.4 uses a default stack size of 256kb but Java 1.5 uses a 1MB stack per thread. So, in the 400MB left to process I could only generate ~400 threads. Absurd but true: to create more threads you have to reduce the memory allocated to the JVM. Another option is to host the JVM in your own process using JNI.

This formula gives a decent estimate for the number of threads you can create: 
(MaxProcessMemory - JVMMemory - ReservedOsMemory) / (ThreadStackSize) = Number of threads

For Java 1.5 I get the following results assuming that the OS reserves about 120MB:
1.5GB allocated to JVM: (2GB-1.5Gb-120MB)/(1MB) = ~380 threads
1.0GB allocated to JVM: (2GB-1.0Gb-120MB)/(1MB) = ~880 threads

Java 1.4 uses 256kb for the thread stack which lets you create a lot more threads:
1.5GB allocated to JVM: ~1520 threads
1.0GB allocated to JVM: ~3520 threads

I have not tried the 3GB switch but it should in theory let you create more threads.

Thursday, June 8, 2006


Full Source Code for the Built-in ASP.NET 2.0 Providers

The full source code for the following built-in ASP.NET 2.0 providers are available for download:

  • Membership

  • Role Management

  • Site Navigation

  • Session State

  • Profile

  • Web Events

  • Web Part Personalization

The source code comes with VS 2005 projects for building the code.

More info on ScottGu's Blog


Expression - Community Technology Preview releases

Microsoft delivers alternatives to several Adobe products with the Community Technology Preview release of the Expression family:

The Microsoft Expression blog has more details.

Tuesday, June 6, 2006


I am full: no more NDR spam please

I have had enough of NDR mail spam. I just came back from Mugello and I was met by this inbox:

(1 legitimate e-mailif you can spot it)

SPF does not seem to fix the problem so I am left with the following options:

  1. Quietly drop on message in my e-mail client (a major pain when I download mail with a pocket pc)

  2. Remove the wildcard routing on This means the NDR will bounce back to the postmaster sending me the NDR (a pain for the innocent 3rd party but I save bandwith and -a lot of time- hunting down spammers)

Suggestions anyone?

Thursday, June 1, 2006


Going to Mugello

I'm going to Mugello. Time to forget about work and spammers that drive me crazy and have some fun! No PC, no blog an no stress until next week :-)

(Picture from Google Earth)

The weather forecast is not the best but I am sure I will enjoy it anyway. The MotoGP race last was fantastic and this year I will have the opportunity to see all of it: free practice, qualifying as well as the races in the 125, 250 and MotoGP categories.

Tuesday, May 30, 2006


How to display number of records, data and index space in Microsoft SQL Server

I got the great query below from Michele today. It shows all the information you ever wanted to know about the tables in your SQL Server, in particular; the number of rows as well as the size of the data and index.

DECLARE @Tab sysname




from sysobjects

WHERE xType='u'


OPEN tables_Cursor


      FETCH NEXT FROM tables_Cursor INTO @tab




      select @tab
      -- Show space used by table

      exec ('sp_mstablespace ''' + @tab + '''')

      -- Show generic table info

      exec ('sp_help ''' + @tab + '''')

      FETCH NEXT FROM tables_Cursor INTO @tab



CLOSE tables_Cursor

DEALLOCATE tables_Cursor

Sunday, May 28, 2006


Hit hard by mail spam

Until May I received very little mail spam as I use a different email alias for each subscription, forum, etc. When a company sells my address to a spammer I know who the they are, who to complain to and I just delete all mails to the spammed alias.

But, the spammers just started doing something that makes my life a lot more difficult. They send a lot of fake mail that looks like they come from In many cases the targeted account does not exist so I get a Non-delivery report (NDR) message back. Below is one example:

We're sorry. There's a problem with the e-mail address(es) you're trying to send to. Please verify the address(es) and try again. If you continue to have problems, please contact Customer Support at (480) …..

The e-mail message could not be delivered because there are no users here by that name.

--- Below this line is a copy of the message.

Return-Path: <>
Received: (qmail 18739 invoked from network); 18 May 2006 12:16:13 -0000
Received: ([64.202….])
        (envelope-sender <>)
        by (qmail-ldap-1.03) with SMTP
        for <>; 18 May 2006 12:16:13 -0000
Received: (qmail 12824 invoked from network); 18 May 2006 12:16:13 -0000
Received: from unknown (HELO ([88.226….])
        (envelope-sender <>)
        by (qmail-ldap-1.03) with SMTP
        for <>; 18 May 2006 12:16:06 -0000
Received: from [88.226….] (helo=dlxf)
by with smtp (Exim 4.43)
id 1FghUk-0004QU-Uj; Thu, 18 May 2006 15:20:46 +0300
Message-ID: <001301c67a74$d0130457$677be258@dlxf>
From: "Paula Fry" <>
To: <>
Subject: Democrat

In the past I have always complained to the ISP of the spammers but in this case I am fighting a loosing battle as the mails are sent by different IP addresses all over the world. One of the worst Internet Service Providers in my experience is I have lost count of the mails I have sent to their "abuse" alias without any reply or sign of improvement:-(

A lot of the mails bounce back to me as a Non-delivery report which is bad, but some of the mails hit a real mail account which is even worse. Does anybody out there have any suggestions regarding what to do in these cases?

  • Does SPF actually work? I have only seen a couple of mails with SPF headers.
  • Someone suggested forwarding the spam to, and adding a the reference to Federal Can Spam Act, 2003.
  • Bounce the NDR back to the sender. That is not really fair as postmasters all over the world will get NDRs from my domain (at the moment I silently drop the NDRs for accounts that do not exist on my domain). NDRs seem to be a popular way of spreading spam as Jeff Atwood has a related problem.

Suggestions anyone?

Updated: fixed broken link to SPF

Tuesday, May 23, 2006


Italian Java Conference 2006 with James Gosling

The Italian Java conference 2006 will be held in Roma 26/6 and in Milano 27/6-28/6

James Gosling, the man behind Java, will attend the Italian event for the first time ever. Gosling is Vice President, Fellow and Chief Technology Officer of the Developer Products Group of Sun and is working in the Real-Time Specification for Java.

Web 2.0 will be he main theme of the Java Conference 2006 with the changes the "Participation Age" implies; Software as a Service, Open Source, Service Oriented Architecture and Ajax.

Friday, May 19, 2006


About egilh

I worked for Microsoft on DOS 6.2, Excel 6 and Windows 95 before I moved to Italy. I made my living as Software Architect/Lead Developer working for Iris (which has joined the Reply group) for more than a decade on Java and .NET projects in the Italian telecommunications and media industry.

My programming experience ranges from office automation to device drivers in assembler in a wide range of languages; C#, Java, VB.NET, VB, Perl, C, C++, PowerBuilder, VBA and Assembler as well as DB design. Most of my work is done on Windows but I have also worked on Solaris and mainframe solutions. I have a long experience designing large online systems in Java and .NET with strict SLAs regarding uptime and response times, but I also enjoy the challenge of mobile devices due to the form factor and limited capabilities.

At the moment I work in Milan, Italy, for 10100.

**This is my personal blog. The views expressed on these pages are mine alone and not those of my employer.**

You can get the latest version of my free tools in the downloads area.

Tuesday, May 16, 2006


Solving Sudoku puzzles with T-SQL

Now this is a creative use of Microsoft SQL Server stored procedures: solving Sudoku puzzles:

To make it even more fun for myself, I embarked on an exercise to write a program that solves Sudoku puzzles. And to make it even more challenging I decided not to write the program in the popular object-oriented fashion (Java, C++, C#, etc.) or in any of the old-fashioned procedural programming languages (Pascal, C, Basic etc); but in Transact SQL, within SQL Server 2000. Basically, I wanted to see how the features of T-SQL can be used to develop something like a Sudoku puzzle solution. I have learnt some useful things from the exercise, which I’m eager to pass on to my fellow programmers.

SQL Server 2005 makes even simpler as it is possible to write stored procedures with .NET

Thanks for the tip Marco

Monday, May 8, 2006


FileSystemWatcher does not work with DFS on Win2k3

The ASP.NET cache can be used from any .NET program, but for several reasons I had to make my own caching system of a configuration file. In theory it works; my cached object will automatically be removed when the file has been changes. There are multiple worker processes and each of them use a FileSystemWatcher to notice if there are any changes to the configuration file:

private static System.IO.FileSystemWatcher _watcher = null;
_watcher = new System.IO.FileSystemWatcher(HttpContext.Current.Server.MapPath("."), MY_CONFIG_FILE);                       
_watcher.Changed += new FileSystemEventHandler(callbackConfigChanged);
_watcher.EnableRaisingEvents = true;

I developed the code on the same OS as the production environment (Win2k3) but I still came across an unexpected problem during testing in a pre-production environment. The server farm use DFS to synchronize the web site as well as my configuration file.  The FileSystemWatcher works perfectly on the machine where I modify the configuration file but the other machines in the server farm using FileSystemWatcher do not-get notified of changes in DFS.

It is possible to work around the problem by checking a time stamp but for now we do a manual file save operation on each machine until the problem gets fixed


ASP.NET error: Maximum request length exceeded

If you post large data to a web service or a aspx file using a form you may get this error message:

System.Web.HttpException: Maximum request length exceeded.
   at System.Web.HttpRequest.GetEntireRawContent()
   at System.Web.HttpRequest.get_InputStream()
   at com...ProcessRequest(HttpContext context)

The problem is that .NET limits the maximum data sent in each request to 4MB by default. The size can be changed to any value you want in machine.config or in web.config by configuring the httpRuntime maxRequestLength:

httpRuntime Attributes:
    maxRequestLength="[KBytes]" - KBytes size of maximum request length to accept

Friday, May 5, 2006


Call me Darth Vader

You can call me Darth Vader after the sounds I made last night…

A month or so ago, I started experiencing some of the symptoms of hay fever / pollen allergy: sneezing, itching nose and eyes, runny nose (occasionally nosebleeds) and impaired smell. I have been taking a non prescription medicine every other day lately which has helped a lot. Until I got creative yesterday and stopped taking it as I felt a lot better. I wish I had not, as I can now add another symptom to the list: wheezing:

During an asthma episode, inflamed airways react to environmental triggers such as smoke, dust, or pollen. The airways narrow and produce excess mucus, making it difficult to breathe.

It was a scary experience that makes me feel sorry for people with serious Asthma problems. The doc gave me some pills that should keep the allergy at bay and an inhalator that should help me breath if I start wheezing again.

A learning by doing lesson I whish I had skipped.

Thursday, April 27, 2006


How to fix ASP.NET HTTP 400 error Bad Request errors

I was working on a system that proxied external contents when I got 400 Bad Request errors for file names with a double period; file..jpg. IIS handled the requests just fine as /dir/file..jpg worked but ASP.NET bombed when I requested /dir/proxy.aspx/file..jpg :

HTTP/1.1 400 Bad Request
Connection: close
Server: Microsoft-IIS/6.0
Content-Type: text/html

<html><body>Bad Request</body></html>

Microsoft Knowledge Base article 826437 explains how to fix it:

  • Install .NET 1.1 Service Pack 1

  • Set the following DWORD registry value: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET VerificationCompatibility = 1

You also get a 400 Bad Request error if the url contains other reserved characters like colon http://server/folder/file.aspx/

The syntax /dir/file.apx/something/else/here/123 is useful in many cases. Browsers do not see the url as "dynamic" as it does not contain a question mark so they are more likely to cache the output. The url can also be made shorter, which is important for mobile devices, as it does not have to urlencode all special characters.