Gotcha: Connection Property on ADO.Net Transaction

In a recent project, the application utilized a custom Data Access Layer that provided an API for managing connectivity to the database. The API had an abstract definition that business logic would call into in order to define the explicit Unit of Work boundaries that were being performed. This forced the business logic to create an abstract transaction object to begin, create or rollback the unit of work. The concrete implementation had connectors for both MSSQL and Oracle that manipulated the respective ADO.Net libraries.

The Transaction class for ADO.Net has a property for a connection reference. When an abstract transaction was started, the concrete implemalentation would create a new OracleConnection or SQLConnection and then grab a transaction from that. Once, the transaction had ended the connection property would be checked if still available, and if it was – it was closed.

At a client site, we started noticing connection leak messages were appearing in the application. When checking the open sessions for the user, it was found that the connections would quickly reach the default maximum of 100. I managed to narrow it down to the fact that the concrete implementation of the transactions was the cause. Upon further investigation, I found that when an ADO.Net transaction is committed, it will lose its reference to the connection, and since the connection was not being garbage collected fast enough within this tight loop, the pool limit would be hit. Once this was resolved by holding an explicit reference to the connection, the open connections went down drammatically and all was right in the world.


Vista Media Center – QAM

In my last post, I was unable to get QAM working with Vista Media Center. The reason seemed to be due to the fact that Vista Media Center did not support QAM out of the box. Although Hauppauge does have a plug in for media center that has been able to provide QAM support to some people – this was not working for me. So instead of trying to figure out what the problem was, I went for the Vista Media Center TV Pack update.

Once the update was installed and I rebooted, I ran through the TV Signal setup. Everything seemed to be going good – as in my system was corrupted – but Media Center had detected my tuner as analog. This would just not do.

I have a Hauppauge HVR-1250 hybrid analog/digital tuner, and noticed on forums that the updated Media Center will only detect it as analog. I really hoped that this wasn’t still true, so I decided to keep digging around and was rewarded. Apparently there are some registry keys that can be set to custom tune the TV Pack. I added the registry key for AllowQAM_PowerToy as mentioned in this post, and after a reboot was able to manually configure a digital tuner for Cablevision. Note: The forum post contains registry keys for Huappauge tuners that may cause different results depending on your configuration, so make sure you have backed up your system before changing your registry.

One my tuner was configured, Media Center ran through a channel scan, which seemed to go on forever, and I was finally able to pull the digital channels for the basic networks. Hooray. So my now my Media Center PVR is temporarily complete, until I can think of something more to add.

Creating a Vista Media Center HD PVR

This fall season for network television has brought about an interesting phenomenon: Monday night seems to be overloaded with some of the best shows! Now, this isn’t really a problem for pvr geeks – more of a challenge waiting to be overcome.
My cable DVR that I am forced to rent due to cablecard “issues” (I’m slightly bitter here) just can not handle the notion of wanting to record more than two shows at a time, what to do?
I thought about just using the awesome streaming service Hulu, but I really wanted a seamless viewing experience in the living room – and I want to watch it on my flat panel TV. So… I decided that a fun thing to do would be to put my Vista Ultimate box to work, and dive into Media Center. After a playing around with it, I am pleasantly suprised – and am in almost disbelief that this is an Out Of The Box Microsoft solution.

Here was my trip:

  • Purchased a Tuner: I was thinking about going with the HDHomeRun (the network attached dual tuner from SiliconDust), but I decided to start out slow, and build out my Media PC a brick at a time. Starting out slow for me, meant going with the Hauppauge1250 PCIe card. It is a digital/analog hybrid tuner that came with a non standard Media Center remote- and I figured I would add more as I need them. (Currently only have 3 shows that I want to record during the same time slot – as this grows, I’ll add more tuners. Note: Media center only supports 2 of each type of tuner. IE: 2 analog or 2 digital)
  • A non Media Center Remote in Media Center: I had read on some forums, that using the Hauppauge remote would not work within Media Center, and at first it seemed that was the case. After making sure the IR received was fully inserted into the tuner card, I installed the IR Remote utility that comes with the Hauppauge WinTV software. Once installed, and after a reboot, I was able to hit the power button on the remote, and start Media Center! All the buttons were working, and it even had a home button which mapped to the Media Center Green Button.
  • Tried to get QAM going, got OTA instead: So I have Cablevision/Optimum where I am located and thought I could pull QAM through. The first snag is that QAM is not supported in Vista Media Center, which sucks, but it is coming with the currenlty-only-oem-release TV Pack. Luckily Hauppauge does have a Media Center plugin for QAM support. I have not been able to get this working. I’m thinking that it may be due to the signal strength of the cable input – but as an interesting side effect, I managed to get over the air ATSC signal by accidently touching the CAT9 cable to my metal desk. Woohoo, a poor mans HD atenna…
  • Tested recording and playback: With my accidental OTA signal, I decided to schedule a recording of a show- while having Media Center closed, and Vista in sleep mode. When I woke up the next morning to check the recordings, I was pleasantly surprised to see that the HD recording was flawless, and that the recording service had awoken the PC to do its thing.
  • Purchased a DVI to HDMI cable: Now that the recording test passed, I decided to head over to MonoPrice and pick up a cheap/awesome DVI to HDMI cable. For those who don’t know, MonoPrice is carries some of the best equipment with the best prices bar none – as long as you arn’t looking for instant satisification. So, after a couple of days of anxiously waiting, my cable arrived and I was finally able to connect my Media Center PC to my Panasonic Plasma TV. After changing the resolution to 1920X1280 – I was watching my HD recording and very, very happy.

The final verdict, is that I have had the cable-provided-DVR-solution-blindfold removed from my eyes, and am now able to see what competition can give the consumer – a compelling user experience, that just works (seems like a good slogan, maybe I’ll trade mark it).

TFS Upgrade: 2005 to 2008 SP1

Today marked the officially move of our TFS 2005 server to TFS 2008, including SP1. This time the results were more favorable, as TFS is actually running, and people are checking in and out. (The previous attempt I ran into a time crunch, and couldn’t afford the down time for the upgrade and -more importantly- the testing).

Our new TFS server is running Windows Server 2008 – which looks awesome – and SQL Server 2008 – which is great because TFS2008 couldn’t run against it before. We also have a build machine running Windows Server 2003.

The upgrade was pretty painless thanks to a few forum pointers, this post, and having run through the drill of trying to upgrade our TFS databases on a test domain.

Our process was as follows:

  • Disconnect the TFS 2005 server from the network
  • Install SQL Server 2008, including Reporting Services on top of new Windows Server 2008.
  • Run the TFS 2008 install using the SP1 Slipstream trick documented in the updated install guide and Etienne’s post. Note: I had to run the install from the ATIntegerated folder instead of rebuilding the ISO, as for some reason running it from the updated ISO would run the previous install.
  • Chose to update my TFS 2005 databases.
  • Start the install again after an error from Sharepoint, and installing the Sharppoint Web Services.
  • Got past an error where Reporting Services couldn’t initialize. Had to create a new database in Report Services configuration that connecting with the TFSSetup users’ creds.
  • Installed!
  • Uninstalled TFS 2005 Build from the Build Machine
  • Installed TFS 2008 Build on to the Build Machine
  • Checked out, checked in, and built successfully.

The install went pretty smoothly, and the developers are able to do their thing just as before. Sign of a good install.

Entity Framework – POCO style

The entity framework, Microsoft’s current effort to bring object-relation mapping to the non open source world, is currently in version 1 release.  However, one of the short comings is the lack of POCO support. 

POCO, being Plain Old CLR Object, is the thought that your domain objects should not have any knowledge of persitence or infrastructure. Your domain objects, should just be worried about what they know best: interaction with your domain logic. Make sense, right? Unfortunately the Entity Framework does require some infrasture logic within your domain logic by requiring inheritance from some of the base classes.

Anyway, this limitation that is planned to be included in later releases, has some silver lining as a POCO adapter has been created for the Entity Framework, which can be found here.

The Mobile Platform

So here’s where I think the current state of mobile technology is. The mass market has finally realized that the computer can be small enough to be a phone, and more importantly the phone can do things that a computer can do – and beyond!

I think that the mainstream thought is that a computer is a large thing. This large thing has evolved from being a few rooms of blips and lights, to a 2 foot box (of blips and lights), to an airplane carry-on, and now to the “fits in your pocket”. Sure, BlackBerry gave business users the idea that they could leave the office whenever they wanted, but never actualy leave work, and yea- Windows Mobile actually gave the Windows PDA user the ability to send/receive a call – but the IPhone has finally given the consumer market,- well, an actual market.

You have to admire the Apple brand. No really, you have to – TV  tells me so (TV now refers to a brand’s identity that is built by the user base of loyalty to the product). Not only have they redfined how you should be interacting(“touch”ng) your periphereals, but how your periphereals should be touching you. This will lead to the “next big thing”. Microsoft is saying cloud computing is where it’s at, and its true, but where is their support for it. Sure the enterprise has the toolset at their finger tips, but what about the consumer. Apple is giving the consumer the baby steps needed by giving them location aware call-home services, and I would guess cloud computing is what is going to fit right in.

The moral of this disconnected post, is that although inovation can come from anyone, not anyone can be innvotive (yes, this a  Ratatouille refernce). However, the best thing that could happen to the mobile platform is that we see more IPhone clones that allow for a little more user meddling than before. Here’s hoping that the cell providers become nothing more than data pipes, and mobile applications/services from third parties become the standard.

Installing Vista: Toshiba m200

So I decided that it would be a  good idea to update my Toshiba m200 Tablet laptop to Vista. Little did I know what was in store. Apparently, the m200 is not actually supported with Vista, which kinda blows. As a dotNet developer I really enjoy Vista/Visual Studio 2008, and have even gotten used to the dreaded UAC prompts (Honestly it hasn’t bothered me, and reminds me a lot of Ubuntu). Anyway, after reading some key posts on the subject, I decided I would give it a try.

My current enviornment is Windows XP Tablet Edition, and have Visual Studio 2005/2008 and SQL Server installed. I really enjoy using my tablet as a lightwight/use-it-mostly environment for development as portability is a huge asset for me. You just can’t beat using your HTC Windows Mobile smartphone as a modem and fixing a few bugs while riding into/from work on the train.

My goal was this: Install Vista, have Aero, Accelomerter support, Bluetooth support, and rock out.

Step one was booting the Vista install from a DVD-ROM. Since the m200 does not have an internal drive, I used my external and was horrified at the how the drive was crawlin along – which is also chronolized here. So, after switching to using TFTP32 (and realizing that I actual had to reflect the DHCP/DNS/Gateway info that was on my work domain) and kicking of the Vista install, I was in business – Vista Business to be exact. Ba dum, tsh.

After installing, I updated to Vista SP1 and then continued to install a whole bunch of Toshiba specific drivers that have been uncovered through some unofficial channels. I installed the following using these helpful blogs.

  • TOSHIBA SD Utilities 1.6
  • TOSHIBA Tablet Access Code Logon Utility V2.00.03
  • TOSHIBA Tablet PC Extension V1.0.0.1
  • TOSHIBA Value Added Package V1.0.11
  • ADI AC97 Audio Driver
  • TOSHIBA ConfigFree 7.00.23
  • NVIDIA GeForceFX Go 5200 Display Driver

After running those, I didn’t have Aero, so after following the advice here, I run the 9759 drivers and managed to get Aero while also disabling transparency.

All was good, except for my Wireless. I installed the driver for Intel 2100 on Vista, but for some reason it frequently disconnects (not a Vista problem, as this happened in WinXP as well). My co-worker happened to have a Toshiba laptop that was available for parts, so we ripped out its Intel 2200 chip and swapped it out with mine. After that, my wireless was working like a charm.

Last but least, was Bluetooth. I have the Bluetooth SD card. Using the drivers I was able to get the Bluetooth manager to run, but not actually able to connect to any Bluetooh devices. Still investigating this issue, let me know if you come across something similar.

All in all, the upgrade to Vista was a succes. The Tablet support is quite exellent, and Vista Business performs surprising great. As others who have dared to upgrade their unsupported m200 Tablets, I have found the experience and result worth it.


Online ClickOnce and Forms Authentication

A co-worker of mine and I had to bash our brains together to come up with a solution in order to save a multi million dollar deal from collapsing. The culprit of this fixit-fixit-fixit power session was ClickOnce being unable to handle Windows Authentication to an internet site from the browser. Usually this occurs with a XBAP hosted in IIS, in our case it was a XBAP hosted in ISA.

See the following codeproject article for details, if you dare…

Who? What? Where? How?

Decided to expand my presence on the web. My plan is to discuss what interests me, so this will most likely contain technical articles on WPF, WCF, and development on a MS platform.