January 29, 2009

Vista Remote Desktop and monitor power saving

For some reason when you use remote desktop to access a Vista machine, it seems to turn off the power saving features. Normally my monitor shuts off after 10 minutes, but if I remote desktop into the machine, the monitor never seems to turn off, until I log in locally. Once I log back out, the monitor shuts off after the normal time. I've seen a few posts about this, but no one seems to have an answer or solution. Please chime in if someone knows how to fix this.

VMware and Avira

I was trying to get VMware Server running on my Windows Vista 64 machine, and every time I tried to power up a new VM, it would get stuck at 95%. I finally stumbled on a post that indicates that VMware may not play nice with Avira Antivirus. It says you have to uninstall Avira for it to work. I was hoping to get by with just turning off Avira and even shutting down the service, still no luck. It seems odd that this is still an issue, but I haven't seen any newer posts about this. I guess I may have to switch Antivirus software to get VMWare to work?

January 28, 2009

NHibernate

Lately I've been working on a new data access layer. The new project is for some C# code that I work on, so we decided to use NHibernate. I've been doing some research and playing with NHibernate. First thing is that the actual NHibernate site is not the best place to go for up to date documentation. I'm using NHibernate 2.0, but most of the documentation is specific to 1.0, and doesn't always work in 2.0. After some searching (more than was necessary, since I would expect something like this to be easy to find), I found another site: NHibernate Forge. It has content that is more updated, especially the main reference documenation.

So far everything seems to work pretty well. A few little things I have stumbled on:

NHibernate has great logging, but it can be overkill as times. I decided to limit the log4net appenders, so that the NHibernate logs didn't overwhelm the rest of the logging. Since I use multiple different apps that all use the same configuration for log4net, I setup the logging programatically, instead of trying to maintain identical logging config files for each. This can make it a little harder to set up loggers, but I stumbled on how to do this as well.

I was also trying to look into NHibernate transactions, and the possibility of nested transactions using savepoints. I use these in some of my other code to deal with certain error cases where some things need to be rolled back, but not an entire transaction. It seems that this doesn't really work well with NHibernate. Because of the tight coupling between the data objects in memory and the database, rolling back part of a transaction could leave the in memory objects in an inconsistent state. Fortunately in most cases this will be OK, but it is nice to be able to use the savepoints in some cases.

I think I've worked out most of the details for what I need, I'm just trying to create some lightweight wrappers around NHibernate, to give me an abstraction layer between NHibernate and my code. Hopefully everything will be smooth sailing from here on out.