Hi there,

I just read a small article on slashdot.org about Intel being on the verge to release 80 and 120Gb Flash drives (solid state drives). Beside this being a quite astonishing news, because we use to think Intel is making only processors and chipsets, one gas got me thinkinh of the current state of computing within the PC area.

I got now a rig with 4Gb Ram, and a SATA2 WD400Gb hardrive and still I don’t feel like my computer is flying or running extremly fast, although there are improvements. But this has a very solid reason – the harddrive. This is the slowest component in a system. The ram supports nowadays around 6400Mb/sec when using 800Mhz memory or 4267Mb/sec when using 533Mhz memory and the internal bus of a modern chipset can handle that easily; and dual core / quad core processor can process most available data on the bus. But all this hit a wall when communicating with the harddrive. Although the SATA2 interface can handle a theoretical 3000Mb/sec, and the best deliver around 2000Mb/sec, because of the physical constraints and how the drives are build, a typical read/write operation is around 1000Mb/sec and that is in ideal conditions.

So what can be done to improve this state of matters. You really have few options and all of them are expensive.

  • Buy a 10.000 rpm drive. This is a simple sollution, but an expensive one as a 32Gb drive has the same price tag as a 500Gb 7.200Rpm drive.
  • Get 2 smaller drives, let’s say 2x120Gb 7200rpm drives and put them in Raid 1 if your motherboard supports that. This can theoretically deliver around twice the bandwidth of a single drive both in writing and reading. This I think is the cheapest sollution at the moment because they can deliver more than a 10.000rpm drive in terms of bandwidth at a price twice as low.
  • Get a SCSI harddrive. Well I am no expert in this but I know you get more performance when using it right but yes, it’s expensive. You have to have SCSI harddrives and also a SCSI controller which are not over the top in pricing but it will set you back quite some.
  • Use solid state drives. Ugh, this is still a dream for the average user. SSD can deliver 0.1ms seek time and top models can sustain continuous 1000Mb/sec read operations while a normal mechanical drive has fluctuations of this value. Reading small files scattered around the disk is also faster that mechanical drives. Also there is small power consumption, better resistance to physical shocks, etc. Still there are downsides at the moment:
    • write operations are below the rate of a mechanical drive
    • price tag is simply prohibitive; a good SSD with 64Gb will set you back with 800-1000USD.
    • technology is still in it’s infancy. Many things can change and if manufacturers keep their promise, in two months you may realize your top of the line product is now rated middle segment.
  • In very specific scenario the HDD replacement may be an overkill because there are better suited sollutions. In my case, a web developer, I saw cases where I could increase productivity a lot even if I could manage to move 1Gb of data from HDD to a more faster storage device. For example in RAM. Yes, why not? A good development machine has 4Gb of Ram. Windows, even Vista stays below the 1.5Gb mark so you have 2.5Gb of Ram that can be put to good use. So you can emulate a partition in Ram. There are tools for that and Microsoft even delivers a free one. Just move your projects there and set the database tempdb to be stored on that partition and voila, you have them on a 300 times faster drive.

So, there is a problem and there are sollutions. The choice depends really on the person, scenario and budget. At this point I would recoment 2 drives in Raid1 if you need extra performance but that’s just my pick, you have to find yours.

If you have better ideas, let us know …

Update

I just found a news on TomsHardware (here) about OCZ anouncing a SSD with SATA2 capable of sustained 120Mbps reads and 100Mbps writes which is almost twice as fast as the old SSD generation and it’s available already in the UK with prices starting around 700USD for the 32Gb model and 1300USD for the 64Gb model.

Comments No Comments »

There are quite a lot of us who have a lot of papers on their desks with notes, tasks, observations. And there are those who use notepad alot to store usefull information on the project. Still it’s not easy to do this organization tasks when programming as it makes you either leave the development IDE or take your hands of the mouse and keyboard.

Why don’t we have a way to make quick notes within Visual Studio 2005. Well we actually do, although I have not seen any using it. Just go to the View menu and select Task List. A dockable window will come in front and you can dock it somewhere, I dock it in a group of windows below the code, so that it is easy accessible. How do you use it, well, just double click on the first available row in the list and enter your comments/tasks there.

For example, you have a task which is actually containing 7 inner tasks/functionalities. At some point you have to hardcode a variable so that you can go faster to another task and at some point you have to get back and correct this. This happens. No, no, don’t shake your head! you did it at some point. The problem is that you will likely forget this. Well, add a task like “Correct the hardcoding on file myfile.cs line 44″. At some point you will check that list and you can see what you still need to do and well … do it. Then just mark the task as completed (checkbox on the same line left side), or delete it.

No more yellow stickers and endless blocknotes :)

Cheers

Comments No Comments »

Well, URL Redirect, which is mostly used in PHP for making user friendly urls is supported by IIS but with a twist, at least in IIS7.

I banged my head for a couple of hours and for some reason I could not make it work. Lastly I decided to google for url rewrite AND IIS7. To my surprise there is an additional step to be done when registering your HttpModule (the one that will handle the url rewriting). You not only need to add it to the modules tag of the web.config, but also to the <system.webServer> modules tag. See example below (of course this is a stripped down code, you have to intertwine it with your existing web.config)

<system.web>
    <httpModules>
        <add name=UrlRewriter type=Rewrite, UrlRewriter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null />
    </httpModules>

</system.web>
<system.webServer>
    <validation validateIntegratedModeConfiguration=false />
    <modules>
        <add name=Rewriter type=UrlRewriter.Rewrite preCondition=managedHandler />

    </modules>
</system.webServer>

Lots of thanks to Scott Guthrie for his article on url rewriting in asp.net: http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

and also to Denis van der Stelt for his observations on IIS7 and url rewriting: http://bloggingabout.net/blogs/dennis/archive/2006/11/29/IIS7-and-Url-Rewriting.aspx 

07-03-2008
Yesterday I had to upload to a hoster a website using the above technique and it would not work. The hosting was using IIS6, so the ASP.Net would look at <system.web><httpModules> for additional modules, whereas IIS7 would not take into account that, but the settings in <system.webServer>. So what was wrong? The application complained that it could not load the type Rewrite. So I had a closer look and … I wrote the declaration wrong :( . Below you will find the correct add declaration to be added in httpModules:

<add name=UrlRewriter type=UrlRewriter.Rewrite, UrlRewriter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null />

Comments 2 Comments »

I’m sick and tired of people bashing Vista. What’s wrong with you people?!

I use Vista for over a year now. I am a proffesional .Net Developer and I do all my work on Vista.

Problems? Where?

Slowness? Where? When?

Incompatibilities? For god’s sake … where? The only incompatibility I have is with my tv-tuner and that only in Media Center which does not yet support my Leadtek.

Gaming issues? Nope … and I played over 15 titles last year.

And let me point out another thing. Recently at work I had to work with XP (until the new licences come) and you cannot imagine the horror … It’s slow, buggy, unreliable and after 6 hours of work I have to restart it in order to make sure I can work further (and the machine it’s a beast in terms of raw performance). I can’t wait to put a Vista on that machine …

I confess, I always update my machine and I started using SP since the first beta came out and that makes a difference, but the OS is good and more reliable that XP was even after SP2.

The only anoying things with Vista are the new file dialogs and UAC, but UAC can be turned off and the file dialogs have a tendency to learn how you use them so after two days of working everything is ok.

Don’t forget that the new SP (which is now available on MSDN) also brings the kernel of Windows Server 2008 which makes it more stable and faster. Take your time and install it, you won’t regret it.

Ding, dong …

Comments No Comments »

Hi guys,

It’s been a while since I wrote a post here and that’s not because of a lack of good ideas but from a lack of time :)

What I want to talk about today is about an issues with MS.Ajax and IFrame’s. To be more precise, UpdateProgress and IFrames.

When a page contains an IFrame and both the page and the IFrame contain an UpdateProgress control, when an Ajax callback occurs, the Ajax engine tries to link the UpdateProgress control to the panel that contains the progress image.The problem is that you have two UpdateProgress controls and on the second one you would get an error in the  MicrosoftAjax.js file, more exactly in this function:

Sys.UI.Control = function Sys$UI$Control(element)
{
   /// <param name=”element” domElement=”true”></param>
   var e = Function._validateParams(arguments, [{name: "element", domElement: true}]);
   if (e) throw e;
   if (typeof(element.control) != ‘undefined’)

       throw Error.invalidOperation(Sys.Res.controlAlreadyDefined);
  
Sys.UI.Control.initializeBase(this);
   this._element = element;
   element.control = this;
   this._oldDisplayMode = this._element.style.display;
   if (!this._oldDisplayMode || (this._oldDisplayMode == ‘none’))
  {
      this._oldDisplayMode = ”;
   }
}

The red code is where it crashes. So what is the sollution for this ? : use a single update progress, maybe in the masterpage if you have such thing.

 Cheers

Comments No Comments »

There are quite some articles on this small issue but what I would like to post here is a more special situation.

This error occured while building a website in Visual Studio 2005 (the website was actually a port from an older Visual Studio 2005 WebSite Project). I could simply not find out why this error occured. It seemed that the compiler was building an object having a method or member with the same name as the class representing the page. In the codebehind file one could not pinpoint the problem, and then a coleague pointed out: “The form id has the same name as the class!”.

There you have it: in a ASP.Net 2.0 Website do not give the form object of a page the same id as the name of the page! otherwise you’ll get an error.

Comments No Comments »

I was busy these days optimizing code for speed. What I found is no less than mind boggling. Using the right constructs one can speed up pieces of code tremendeously (read this like: a code that runs 10 minutes can be optimized sometimes to run in 10 seconds).

Tips:

Try to get data from the database in a single run. This is an old one but it seems people tend to forget this.

Carefull with the binding. With the advent of persistance frameworks, getting data from the database and binding it to controls became easy. Unfortunately due to design sometimes this gets in our way. For example, we have a business object called Person and which has a property homeadress of type Adress. In normal frameworks, the homeadress object is loaded only when it’s needed. So, we get a list of persons and bind this to a grid. And we say that one of the columns is actually a property of adress (person.homeadress.streetname). During binding, for each person, a call is made to the database to load the homeadress object and retrieve it’s streetname property. Thus for a 10 persons list we have 11 calls to the database (1 for retrieving the list of persons and 1 for each person to get the adress object). Try to avoid this !!! Use simple ADO objects of modified business objects instead.

Avoid find using predicates on lists. Searching using predicates is very nice and somehow natural but for large lists (1000+), the search time is high. Try using dictionaries for fast retrieval of elements.

Avoid List<T> and use Dictionary<T,Y> when making caches. This is an odd one, i did not digg deep into this problem but it seems that when creating a cache (parse a list, add the items) and afterwards accessing elements, for the same amount of data and the same logic, a dictionary was 10 times faster.

Use explicit casting when possible. The most common scenario is when we have a DataReader and we try to read data from it. If we know the first column is a string we could do it like datareader[0].toString() or (string)datareader[0]. And now the milion dolar question, what’s faster … take a wild guess :) . Also, don’t do int.Parse(datareader[0].toString()) if you know there’s an int, use (int)datareader[0].

… more to come here

Comments 4 Comments »

I have Vista installed for … 6 months now. Normally around this period XP would have been a rotten corpse because of the heavy usage and frequent software installs/uninstalls. I cannot say that Vista was braver. I encountered until now two situations that were so hairy that I was at a feet from reinstalling the beast. Still I remembered on NICE feature of Vista: System Restore.

How it works?

Everytime you install a piece of software or unninstall one, or important changes are made to the system, Vista makes a backup of important system files (notable here are registry and other important files). This backup is stored and given a time stamp and relevant information about the reason for it’s creation. Unfortunately this consumes space (about 300mb per backup) but if you are carefull, you can select only relevant ones and delete the ones not deemed worthy. And of course one can create a restore point at any given time nomatter the status or reason.

Ok, ok, how does this help me?! Obviously, you will find yourself in the devious situation where the OS is behaving like a madman. What do you do? If you are a masterfull sorcerror and knowleadge-able in the inner workings of Windows you can repair it, using the dark arts and a lot of googling :)

Or, you can restore the system to a previous state, which you know it works. Yes, you might lose some stuff, but only information from the system state, all your data is still there.

There it is, now you can rest a little bit more easy, Vista gives you the tools needed for its survival and for keeping your hair from going gray…

Cheers

Comments 1 Comment »

Yesterday I managed to get hold of a copy of Windows Vista Service Pack 1 and although it is a beta, I could not stop myself installing it.

After an hour or so of installing and repeated restarts (about 6 restarts) I managed to get to the login screen and boy I was in for a surprise. I was actually pleased, although it was already too late to thoroughly test it.

The first impression was of … quietness. Yes, it was quiet, my hard-drive was not spinning maddly as before and the OS seemed to be in a meditation state. The application started smoothly and the responsiveness of the start menu surprised me.

What didn’t work at first was the IIS websites but this was because the “World Wide Web Publishing Service” was stopped by the SP1 install.

I cannot contain myself and tell something: the error messages from Vista are actually helping you. I have to get used to read the errror messages because so far they were thorough and accurate and they offer sollutions as well (I cannot say this about XP).

I will dig a little deeper today into the SP1 and come back with some thoughts. Till then …

Cheers.

Comments 3 Comments »

Some users which embraced the new OS by Microsoft have encountered a new issue. It seems that whenever multimedia is played, the network performance is slightly decreased.

The scenario: play some mp3′s in your favorite player and in meantime download something from a computer in the local network or if you have a high bandwith connection, download something from the internet. If one watches the download speed, one would notice that the download speed increases by about 10% if the player is stopped (not paused). This suggests that somewhere there is a connection betwen network and sound. Strange isn’t it?!

Well Microsoft has responed to this issue and apparently both network and sound drivers are running with very high priviledges within Vista. The sound driver still gets a higher priority in order to avoid sound jutter and thus the network driver has less processor time thus decreasing it’s total processing power.

I totally agree with the design but my question is: how in the nine hells can you encounter this scenario? I mean in order for the drivers to lose processing time is for the processor to have high occupancy, i.e. having it at around 80% and in this case I fully expect some of the subsystems to have degraded performance. And yeah, losing 10% of network speed isn’t that much of an issue, only maybe when you are acting as a server for some network enabled application, but in this case why would you play mp3′s on that computer?! it’s a server!

You can see a more detailed explanation from Microsoft here.

Ohh, and don’t forget in September Windows Vista SP1 beta gets released. Hopefully this will improve the performance and compatibility of the OS.

Cheers!

Update: A friend of mine sent me this link where Mark Russinovich is dissecting this “by design issue”

Comments No Comments »