February 21, 2008

Moving

Yes ... this blog has been discontinued. The new version is located here: http://www.hadianto.net/destinationv2

Posted by vhadiant at 09:47 AM | Comments (0)

January 22, 2008

vhshost.exe Mystery

Have you been wondering what the vshost.exe file is for? You'll notice this when you start working with Visual Studio 2005. Basically this is the file that is used by VS 2005 to optimise the debugging performance and should not be deployed in production environment.

dtemp has a good outline here:

http://blogs.msdn.com/dtemp/archive/2004/08/17/215764.aspx

Posted by vhadiant at 09:22 PM | Comments (0)

August 02, 2007

Essential SQL Server Date Function

This is really useful:

Essential SQL Server Date, Time and DateTime Functions

I've always find out strange to work with date and time in SQL Server, it just feel so ... unnatural. The aforementioned link list the important date & time function in SQL Sever. Goodness :)

Posted by vhadiant at 08:57 PM | Comments (0)

May 16, 2007

The "Wow" Ended Yesterday

That's it, after putting up with Vista just over a month I've reformatted my laptop back to Windows XP. Vista may look pretty, and don't get me wrong, my beefed-up DELL XPS M1710 (2gb RAM, Intel Core 2 Duo T 7400) has enough juice to run Vista ... for home user that is.

Unfortunately, I'm not a typical home computer or business laptop user. I'm a developer and use my laptop for home development etc. Running Vista is putting extra strain that I don't need. I've put up with it for a while before deciding it ain't worth it. On top of that I have a few more grief with Vista:

- It's too damn chatty. Dialog boxes keep popping out asking me to do something. It's annoying. There's gotta be a way to turn this off.

- Windows Media Player (WMP) stutters near the end of the song. Something that I can't figure out how to fix yet, at the last few seconds of a song, WMP seems to have problem playing back and it introduces a couple of second of "WMP remix".

- WMP takes aaaages to move from one track to another if you force it to move.

- Heavy disk access. Vista seems to keep reading/writing the disk all the time. I've turned off indexing and disk IO is still noticeably (much) higher than XP.

- No nVidia driver for Vista just yet. nVidia hasn't released the GeForce Go 7800/7900 driver for Vista.

- It tries too hard (to be smart that is). There should be a "I know what I'm doing" option that will automatically set everything to "Advanced" mode. For example, not allowing you to do "select all" in read-only and protected folders is probably a life safer for some, but totally annoying for me.

Is it all doom for Vista then? I don't think so. For a start it's very good looking bordering MAC OS X' sexiness. Compare Vista to XP side-by-side you'll notice the big jump in UI.

Also most of my grief above can be attributed to my type of user (developer). A typical home user who use the computer for simple internet/email, games, simple Word & Excel will probably benefit for Vista's new features and the rather harsh safety options. I for one will wait until I absolutely have to upgrade to Vista.

Posted by vhadiant at 08:10 PM | Comments (1)

April 12, 2007

Fixing AVG after Vista upgrade

After the upgrade of my Dell's XPS M1710 to Windows Vista, AVG stopped working. It keeps complaining that my key is not valid, which is strange since it's a free product.

Initially I thought this was a simple problem, simply uninstall then re-install. Well I was wrong, it turned out to be quite serious and common problems. Despite following suggestions from AVG forums which other people seemed to be quite successful, I can't uninstall AVG. Downloading a new executable, run as Admin, uninstall doesn't work. Installing it over the existing install also doesn't work too well.

Simply put, I should have uninstalled AVG before upgrading to Vista. Anyway I thought I was screwed and need to reinstall Vista from scratch, kinda a drastic method. I'd rather not.

Well the solution turned out to be quite simple. Suddenly I realised what if I supplied AVG with a new and valid license? So if you double click AVG's installation, just before the install starts it'll show you the license (generated I presume) for you. So copy that license into a notepad. Reboot Vista, AVG will complain about the license thingy. Paste the license that you took down earlier and voila, it's all good.

Posted by vhadiant at 07:55 PM | Comments (0)

February 05, 2007

Battling VSTO's SerializationException: Type is not resolved for ...

I've just won half a day battle with VSTO's SerializationException. The actual error turned out to be a red-herring, that was what giving me such a grief (not to mention that this is my first day of cutting down my daily coffee intake)

This is the background of the problem as I posted in MSDN forum earlier today:


I'm currently at loss with this current problem. This is the scenario: I have several c# libraries (all strongly named) in my solution. This solution processes data and serialised the result into a MS SQL Server database.

From my VSTO project (using VB.NET) I tried to access the database and deserialise the result back into my object. Everything works until the moment of deserialisation where I get the SerializationException: Type is not resolved for member ...

I have a test project that accesses the database and deserialise my object and it is working perfectly fine, so I'm certain that the serialisation/deserialisation code is working, but just not within VSTO framework.

Now this error is suspiciously related to way VSTO is run by Excel. I spent ages trying to figure out what went wrong since all the assemblies are available and loaded properly. I even tried strong naming all the assemblies.

I almost gave up before fortunately helped arrived from this thread. Basically it gave me the idea of hooking to AppDomain's AssemblyResolve event to find out if there is a problem. Yes there was, but in a completely different assembly than the one that was in the exception message!

Apparently this is a common problem when .NET is hosted by an external application. Often the virtual machine has difficulties loading assemblies. For example your project requires assembly A and A requires assembly B, normally you only need to add reference to A and the virtual machine will be able to load assembly B automatically, but not with VSTO. The solution is to strong reference (add the reference from Visual Studio's add reference dialog box) the assemblies, and voila, everything works ... half a day later.

Posted by vhadiant at 08:53 PM | Comments (0)

November 07, 2006

Using command line to install Windows Service

This usefull command is not the most intuitive command. The sc command allows you to install/delete Windows Services. I have used this nifty command quite often in the past project to remove erroneous Windows Service. Microsoft has a good KB article.

Things to watch out is the escaping of the binPath. If there are spaces in your binPath you must escape it using the " character which must be escaped again using the \ character.

For example:

c:\sc create MyService binPath= "\"c:\program files\my service\service.exe\""

Posted by vhadiant at 08:57 PM | Comments (1)