Size of generated HTML pages in web applications

Something I have forgotten for some time but increasingly started to spend more time analysing is the raw traffic for a website. Locally transfer speeds are basically nothing and a website might appear as user friendly and performing well.
Is it really for the end user?
I have to consider that the web applications I am making are used in South Africa and the server is in the Netherlands. Latency is high and throughput as a modem. A large page might be 200kb, imagine the transfer time at 5kb/s.
What I have found really useful lately is to use a tool like Fiddler. You can really learn a lot of studying what is actually sent to and from a web application. This way you also find what is redundant. HTML is mostly redundant!
How to avoid large pages? Use XML and XSL transformation to just send a minimum of information and transform it to a HTML user interface on the client.

Who should optimize, compiler or the developer?

Should the compiler detect and optimize slow code constructions?
This question origins from a discussion from the MSDN forums.
I think it is more important to educate the developer that certain constructions just are bad practice. Like doing multiple memory/object allocations inside a loop.
That is exactly the difference between String and StringBuilder class in .NET. This was also the example the guy on Franklins.NET podcast asked about. String class compared to the StringBuilder concatenation results in String class doing a lot of more memory allocations.
I am at the moment playing with comparing the String to my own immutable string. It seems as most operations can be optimized to reuse the buffer of another string.

Distributing the .NET framework with your application or static link

Recently I stumbled upon Thinstall that links the used parts of .NET framework and your application into a single distributable file. Many people finds this great as they do not have to distribute the .NET framework. Is there any downside?
What about users that use multiple applications based on the same framework version? That is easily solved by the application distributor by offereing a pure .NET version and a statically linked version. Imagine your app is 1MB, linked with .NET it is 9MB, the framework is 20MB. You saved 12MB but if the user gets a couple of other .NET applications of similar size they will have downloaded 27MB where maybe 23MB would have been enough.
How about security updates to the .NET framework. Usually these are pushed by Microsoft Windows Update and vendors of .NET application usually does not have to worry about updating their software to make use of any security updates, or other bug fixes to the framework. With a statically linked application you will need to get the new version from the vendor. Probably not a big hassle as long as you only use a single one .NET application. If you have the framework and a statically linked application you need to retrieve two updates.
You will reduce distribution size for users without the .NET framework, but in the long run I see no benefits of this linking/distribution model for end users.
  • There will be no benefits if the end users want to run multiple .NET applications as parts will be distributed multiple times.
  • There will be more code running for supporting a .NET application resulting in more possibilities for bugs.
  • More code running does not improve performance.
  • Updates to the framework will not be used if a linked application is used.

This kind of distribution will not stop hackers or dis-assembly as claimed by Thinstall. It might make it a but harder but never stop it. Software that runs on my computer can always be changed by me.

Parsing written number to numeric

I saw a question on the MSDN forums on how to parse a number written out to a numeric value. This got me thinking on how it could be done and I made a sample on how to do it. It is dynamic and can be extended to support other languages by changing the dictionaries.
Here is a class I came up with that handles it. It does not validate the number so there is some work left to be done to fully handle it. The same logic can be reversed to write out a numeric as text.

TextToNumber.cs (5.45 kb)

Homework and MSDN forums

I participate in the MSDN forums and now and then there are posts like a post today, where a user wants help with his/hers homework.
I actually did help in another thread but it seems as this particular users does not care about that but just want that solution served on a silver platter. I help where I can on these forums and if the questioners are too lazy to even do the basic research and try to learn from the responses I don’t care anymore.
I gladly help anyone I can but if they want cut & paste code for their homework I lose interest. This behaviour decreases the value of the people that really know everything they get credited and diplomas for. This is one of the reasons why I put little value in software development diplomas. It does not tell me how good you are at developing, just that you are good in taking tests.
I do not want to give the impression that there are no value in education, just that todays courses in programming languages say very little about how good the student is as a developer.

Value and reference types

I was involved in a interesting thread on the msdn forums ( It is about value types in .NET and how it relates to the ValueType class and its base class Object.
I  started with BASIC programming and had no idea what a pointer was to later learn assembly language where I knew if a memory location hold a value (value type) or a address to another memory location where the value was (reference type).
It has really helped me alot to have this computer assembly language knowledge in the base to understand higher level languages and how expensive ceratain operations are. Imagine allocating and discarding memory inside a loop compared to resusing a buffer.

Taxes is not that bad

I just did my taxes and this year I had sent it a pincode to the belastingdienst. This made it possible for me to download the 2005 taxreporting software over the internet and it helped me through asking questions and I filled in the values it asked for. It was really easy and I was impressed. I still had to pay extra but at least not the €4000 I calculated myself… phew. Their slogan is that they do not make it more fun but at least more easy. So true.

How to follow the swedish icehockey team in the olympics from the Netherlands

At first I thought I could only follow it over internet via the radio but I later found out that dutch television is actually broadcasting 6 channels live over the internet. So now I surf into and go to the live broadcast from the olympics and tune in to Radiosporten at to get swedish commentary. The downside? The live video feed is about 5-30 seconds before the radio. 🙂
Why do MSN need to choose language from my browser settings? At least let me change it while browsing without changing my browser settings.