Monday, November 27, 2006

Trouble with the Large Object Heap

I have always had trouble understanding why at times .NET will allow you to allocate a block of memory and then a couple of minutes later it will refuse to do so, even though there is enough free memory available. In my case I know its because of .NET not compacting the large object heap. And this article explains it very well with a code example and also typical work arounds - good read!

Wednesday, November 22, 2006

Creating an object just from its name in .NET

Recently one of my co-workers was looking for a method of creating an instance of an object just from its name. The Activator class has methods to do just that, but those methods need a full name. So to create an object just from its name (excluding version number, public key and assembly name), I came up with the following steps. Type type = Type.GetType("name of object"); //where name of object is System.String or namespace.object Object theObj = Activator.CreateInstance(type); Thats it!

Tuesday, November 21, 2006

Disabling the CTRL + TAB functionality in Visual Studio 2005

Hated the new way in which Ctrl + Tab worked within the new Visual Studio 2005 IDE. From day 1, I have been trying to disable it and make it work in the old way. Finally I found the answer. The simple answer : one can use CTRL + F6, to tab through the windows as one would do in previous versions of VS. But I prefer reassigning the shortcuts, so that I can use the good old CTRL+TAB (CTRL+F6, somehow doesnt cut it for me and is harder for single hand access!) So here is how you do that: Goto Tools->Customize. Click on Keyboard... This will bring up the Options dialog with the tree item Keyboard under Environment open. Type in the "Show commands containing" text box the following "Window.NextD". This should bring up two commands Window.NextDocumentWindow and Window.NextDocumentWindowNav. If you look, CTRL+Tab has been assigned to Window.NextDocumentWindowNav and CTRL+F6 to Window.NextDocumentWindow. Just reassign the shortcuts and you are in business.

What is ReadyBoost?

A new feature in the Windows Vista operating system is where it can automatically take advantage of a USB flash drive to improve system performance. Read more about this cool new feature at : Here is the main excerpt from that page : "Windows ReadyBoost isn’t really using that memory to increase the main system RAM in your computer. Instead, ReadyBoost uses the flash drive to store information that is being used by the memory manager. If you are running a lot of applications on a system that has limited memory, Windows ReadyBoost will use the flash drive to create a copy of virtual memory that is not quite as fast as RAM, but a whole lot faster than going to the hard disk. What is very cool here is that there is nothing stored on this flash disk that isn’t also on the hard disk, so if you remove the flash drive, the memory manager sees the change and automatically goes to the hard disk. While the performance gain from ReadyBoost is gone, you don’t lose any data and there is no interruption. And because the Windows Readyboost cache on the flash drive is encrypted using AES-128, you don’t need to worry about exposing sensitive data if the flash drive is stolen or lost. Also, the memory manager compresses the pages before writing them into the cache on the flash disk, which means you’ll get more mileage from each MB. "So, if you just want your PC to run faster with Windows Vista -- it's pretty simple -- connect your flash drive through any USB 2.0 socket or PCI interface and when the autoplay interface comes up, choose 'Speed up my system using ReadyBoost.' "

Generalization of a Simple Genetic Algorithm (GA)

Taking a simple genetic algorithm and constructing a framework to allow easy creation of similar algorithms.