Archive for the ‘Uncategorized’ Category

WCF: Null Parameter on Service Call

Was receiving a null parameter on a service call. After looking through KnownTypes, Asynchronous vs synchronous, etc. more a while, turns out:

The parameter on the asynchronous OperationContract was named request, whereas the parameter on the synchronous OperationContract was named command.

Wow.

"If your WCF service is receiving null values instead of the parameters you are expecting, check that the parameter names on your methods on the client version of the contract match those on the server version of the contract. And on the client side, be sure to check both the synchronous and asynchronous definitions of your methods."

Thanks to the above quote from http://blog.functionalfun.net/2009/09/if-your-wcf-service-is-unexpectedly.html

Advertisements

Distributed WPF Application

I’ve been going over some ideas (not my own ideas of course) that have been focused around distributed loose-coupled message driven systems, WPF XBAP portals, enterprise architecture, and domain driven design. I’m hoping to post the outline of the ideas as a means to aggregate the ideas in one place, which will hopefully help my and others understanding.

My additional requirements of to be aware of the common symptoms found in system design. From Principles, Patterns, and Practices [Martin],
The symptoms are:

  • Rigidity: The design is difficult to change.
  • Fragility: The design is easy to break.
  • Immobility: The design is difficult to reuse.
  • Viscosity: It is difficult to do the right thing.
  • Needless complexity: Overdesign.
  • Needless repetition: Mouse abuse. [copy/paste programming]
  • Opacity: Disorganized expression.

In addition, I was looking to follow the SOLID principles of programming.
As detailed in Principles, Patterns, and Practices [Martin],

  • Single-Responsibility Principle (SRP): A class should have only one reason to change.
  • Open/Closed Principle (OCP): Software entities (classes, modules, functions, etc.) should be open for extension but closed for modification.
  • Liskov Substitution Principle: Subtypes must be substitutable for their base types.
  • Interface Segregation Principle: Clients should not be forced to depend on methods they do not use.
  • Dependency-Inversion (DI) Principle: High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend upon details. Details should depend upon abstractions.

See Unlce Bob’s Principles of Object Oriented Programming Article for more detail (or his PPP book).

Debugging is a code smell

Production can be a real pain in the ass. This seems to get amplified if the software being run in production doesn’t do its job of telling you what’s wrong. Something I’ve noticed during my tenure at a software company I worked for, is that the product regularly required a developer to be involved in order to determine configuration issues.

Usually the developer needed to hop on a webex and walk through the problem with the Client’s support staff. This was no small feat, as the support staff required programmers, DBAs, and the client Project Managers to be involved – not the kind of situation that instills confidence for your client.

If the problem could not be determined, a copy of the production database (that was usually 10-50 gigs) would need to be scrubbed, and transported so that development could debug the situation locally in order to find out what’s wrong. This seemed ridiculous, and was actually indicative of a larger problem: There was no visibility into what the code was actually doing.

How do you combat such a horrible problem? Slowly.
Unfortunately, there is No Silver Bullet. Buy in needs to be available to fund the necessary steps to identify critical areas of the application that are continually bad performers and address them.

How to address them?
Unit testing comes to mind. Identify areas of your system with high coupling and attack. Focus on what’s best for the BUSINESS. Create a wish list that would help the BUSINESS if more transparency were available.

All in all, its all been said before. I would recommend looking at: The PPP, Clean Code and Refactoring.

SSL VPN: Windows7 + XP Virtual Mode + TFS

My company uses a version of the CheckPoint SSL VPN for all its remoting needs. Basically, you open Internet Explorer and browse to the VPN address. The first time this loads up, an ActiveX is installed that checks for virus scanning software, and then you log in. Once logged in, it installs a Service which does some virtual networking through SSL.

Unfortunately, this seems to barely work with Vista and I haven’t gotten it to work with Windows 7. Instead of the hours it most likely would have taken to try to get it working on Win7, I decided to take an alternate approach, and use the XP mode to connect. After enabling virtualization under the OS Security in my BIOS, XP mode was installed and ready to go. I browsed to the SSL VPN address, installed it, and was able to remote into my work desktop. Hooray.

Next, I wanted to use the more seamless integration of XP mode, so I created a folder in the Start Menu for my virtual user, and created a IE Shortcut. Once XP hibernated, I was able to launch the XP IE directly from Win7 and VPN in.

The current bug-a-boo is that the VPN connectivity is local from my virtual XP machine, and I want to develop on my Win7 desktop while connecting to TFS at work. I’m thinking I’m going to install a TFS proxy on the XP virtual machine, and connect to that from my home machines. That way I can kick up the SSL VPN seamlessly from Win7, and then route my development activity through the XP Machine using the TFS Proxy. Fun, fun.

MSBuild: Conditions and Transforms

Just a quick post about something neat discovered with MSBuild.

I have a task that is building an ItemGroup which contains a whole bunch of paths that point to different kinds of projects to build. These files contain dotNet sln and VB6 vbproj files. I want to build the sln files with MSBuild and use a MSBuild extension task that wraps the VB6 IDe to build the vbproj files. To do this, I set a condition on each build task that checks the extension like so:

<MSBuild Condition=”@(FilesToBuild->’FilePattern%(Extension)’) = ‘FilePattern.sln'” …/>
<VB6 Condition=”@(FilesToBuild->’FilePattern%(Extension)’) = ‘FilePattern.vbproj'” …/>

And Voila! When the build script runs, VB6 projects are built using the VB6 task, and dotNet projects are built using the MSBuild task.

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.

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.

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 5.12.01.5410
  • TOSHIBA ConfigFree 7.00.23
  • NVIDIA GeForceFX Go 5200 Display Driver 7.15.10.9752

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…