Friday, January 2, 2009

Building a complex .NET application

To start the new year off with a bang as well as initiate my new blogging home with something significant I'm going to post a series of articles on building a complex .NET application from scratch. The goal is to capture a set of techniques for an end-to-end solution. There are of course many different approaches and opinions on the proper way to build an application. I will attempt to provide a pragmatic solution with some alternative techniques.
This post will serve as the main placeholder and table of contents - the links here will be updated with each post.
  1. Introduction
  2. Data Layer
    1. Part 1
    2. Part 2
    3. Part 3
  3. Entity Layer
    1. Part 1
    2. Part 2
  4. Service Layer
  5. UI Layer
  6. Smart Client
  7. Web Client
Here is a list of all the products we'll be using during this "adventure":
Visual Studio 2008 Express Edition Free .NET IDE - if you've got the disk space, install the All-in-One DVD from the download page. At a minimum, you should install the Visual C#, Visual Web Developer, and SQL Server 2008 Express editions.
AdventureWorksLT A sample database schema based upon the Adventure Works Cycles scenario. ** NOTE: To install this you need to enable Full Text search and FileStream support when installing SQL 2008 Express.
Enterprise Library 4.1 A collection of reusable software components (application blocks)
NUnit 2.4.8 .NET unit-testing framework
NAnt 0.85 .NET build tool
FxCop 1.36 A rules-based application for analyzing .NET assemblies and reporting information.

Wednesday, December 31, 2008

Windows 7 HomeGroup and social norms

A great post landed today from the Windows 7 Engineering team that made me stop my usual "partial-brain" scanning of daily information sources and actually read it slowly: At Home with HomeGroup in Windows 7. Not only was it well written and informative, but it shows the openness which blogging has brought about - insight into the team's thinking and processes. Their approach to looking at the technology problem from a social engineering perspective is great - I need to do more of this. How many times have we (ok, maybe just me) looked at a problem with thoughts of design patterns, technology approach, and which tools to use?

The year in review

Personally, I started off the year as an employee for a software company working on a complete rewrite of an old product line using Java and IBM's tools - WebSphere, WID (Eclipse-based IDE), WPS (BPM server), and DB2. By the summer I had enough and resigned, took the month of August off then began contracting independently.

In January I also bought my first real server - a Dell PowerEdge - after going years with low-end equipment and do-it-yourself machines. With Dell's aggressive pricing I was able to get a lower-end server for about the same price as a good quality consumer tower. With dual-quad Xeons, room for up to 10 drives as well as up to 48 GB of RAM, it's got plenty of horsepower and room for growth - one of the best computer-related purchases I've made. Initially I loaded up Windows Server 2003 with Virtual Server 2005 and this fall I upgraded it to Windows Server 2008 with Hyper-V. Next on the agenda is to upgrade SBS 2003 to 2008.

From a technology perspective, I've moved my .NET development over to VS 2008 and SQL 2008, worked on a WinCE project, begun developing with AJAX, installed SubText to host my own blog, dabbled once again in COM-land (ugh!) and begun focusing more heavily on SharePoint and Small Business Server.

What's in for me:

  1. Live Writer - it's dead simple and it works.
  2. Delicious - simple interface, built around tagging instead of folder-based, works.
  3. Vista x64 - rock solid. In fact, my daily work laptop, home development machine and spare laptop are all Vista x64 while my server is Windows Server 2008 64-bit edition (supports Hyper-V). My SBS 2003 box is still 32-bit but will soon be 64-bit when it's upgraded to SBS 2008.
  4. SharePoint - I've dabbled with it off and on but this is the year for me to jump in with both feet - there's so much to offer.
  5. VS 2008 - Feature rich, simple to use yet it grows with you.

What's out for me:

  1. Yahoo - mail still works but it's a commodity and nothing special, bookmarks were a plus but delicious has it right and Y!'s toolbar just plain sucks - bookmarks were the only reason I used it and it's constantly broken (cache doesn't work, outdated, keeps getting reset). Given the shoddy work and the botched public debacle with Microsoft and later Carl Icahn. Y! deserves to sink to the bottom of the technology sea and melt in with the rest of the ooze.
  2. Linux - it's getting better but still years away from "dead simple". I like to dig in and play but on my terms and my time, not as a requirement to get things working to the point where I'm productive.
  3. Java-land - while it works, I'm still amazed that tools and the "stack" are still so fragile and difficult to use after all these years. I'm an on-again, off-again friend and right now we're "off".
  4. DotNetNuke - a few years ago there was promise and there is a cottage industry around it but I've waited patiently while they squabbled and morphed and its sub-projects dragged along at a snail's pace. It's getting better and it's free but most of the work over the past years has been under the covers and hasn't really improved or added real *business* value. For example, after 5+ years you still don't have an effective, working, bug-free event module!
  5. Eclipse - while it's nice and gets better, the experience is jarring and fragmented. Which plugins are needed? Where to get them? Which ones work? Compared to Visual Studio it's like a do-it-yourself hobbyist car kit versus a production model Ferrari.

Monday, December 29, 2008

Manually installing Live Writer plugins on Vista

Frank La Vigne's Technorati plugin for Live Writer is simple and effective. Written in Sept. 2006, it does not have a full MSI installer but rather consists of a DLL which you must manually copy to the Live Writer plugins folder. Attempting to do so on Vista may result in an error depending on whether you have UAC enabled.

Remembering that Vista has hardened various aspects of the OS I went looking for the workaround that I had read about. Of course, Mark Russinovich's article Inside Windows Vista User Account Control has all the gory details one could want.

The bottom line is you should, instead, copy the DLL to %USERPROFILE%\AppData\Local\VirtualStore\Program Files (x86)\Windows Live\Writer\Plugins.

Typically on a default installation of Vista %USERPROFILE% will resolve to C:\Users\{your-user-name}. Vista uses \VirtualStore folder under there to store files when "older" programs attempt to write into their own installation folder. This was a common practice which made some sense - programs would keep all their information together where they were installed. It was also easier for lazy programmers because they could write dead simple code to store things like settings and preferences. It would take more work to be polished and store these things in individual computer users' private folders not to mention the extra coding to remove all these different locations when uninstalling. The virtual store is Vista's way of accommodating this behavior - it can lock down program installation folders (preventing write access) so malware can't alter them and inject trojan files while still allowing "older" programs to function.

On the machine I'm currently using there are three folders under \VirtualStore -- \Program Files (x86), \ProgramData and \Windows. In \Program Files (x86) there already is a \Windows Live folder that contains a \Messenger folder - presumably Windows Live Messenger is one of those "older" programs still writing things into it's installation folder.  I simply recreated the necessary paths for Live Writer (\Writer\Plugins) under the existing \Windows Live folder there and then copied the DLL to it. Done.

Thursday, October 16, 2008

Health Insurance for Self-Employed

I noticed this post on the GWB main feed regarding one person's complaints with health insurance in Arizona. I'm facing similar issues and I'm going to name the culprits.
For several years (2000-2007) I was co-owner of a small, regional consulting firm which at our peak had 10 full-time and 1 part-time employees on the payroll. We peaked out paying over 10K per month for health through Anthem BCBS in NH for a PPO plan and dental through Northeast Delta Dental, also in NH. A family health plan cost around $850/month for each employee. I used to call that the "hidden" extra employee - that's how much it cost in benefits annually. Over the last few years we operated, that cost rose to over $1000/month. Towards the end before we dissolved the company I was paying $1300/month from my own pocket for our family plan. This was a "middle of the road" plan - not the best and not the worst.
When the company was rolled into a larger software company we all went on Anthem BCBS/CA and began paying the employee-portion which was just under $500/month. I stuck it out the year that I said I would and when I left this summer the cost of COBRA for health, dental, and the VSP vision plan was up to $1700/month. That's just over 20K for a family plan insurance per year.
Figuring that it must be really high in California, I went shopping for health insurance in NH and for a comparable health plan (health only) it was nearly the same as the full package. For the time being, I'm just paying the COBRA and hating it.
In addition to the doubling of costs is the reduction in benefits. We can't go to any type of doctor visit or treatment where it's "just covered" - the billing costs are always high and we end up paying the difference out of pocket. Thank God we're all in good health with no issues - I can see a family going bankrupt if something bad happens.
The real kicker is that HEALTH INSURANCE COSTS MORE EACH MONTH THAN THE MORTGAGE ON A 4 BEDROOM HOME WITH 3+ ACRES OF LAND!!!

Expanding SQL Server 2005 to support MOSS 2007

After setting up my Dell PowerEdge 2900 with Windows Server 2008 x64 and Hyper-V, I began the steps of creating virtual environments for things I work on. I already had a virtual SQL Server 2005 which was underutilized - 768 MB allocated RAM and one processor for my various development projects.
I wanted to set up Microsoft Office SharePoint Server (MOSS) as a "mostly" single server install with the exception that I wanted to use the existing SQL Server 2005 installation instead of the embedded SQL Express Edition. To prepare for this, I added a second named instance to the SQL machine so that all MOSS traffic would be isolated and separately configurable.
The steps I took were to use Hyper-V manager to add a second processor and bump the allocated RAM up to 1 GB. After rebooting the VM, I went into Add/Remove Programs, selected the existing "Microsoft SQL Server 2005" entry and clicked "Change". On the "Microsoft SQL Server 2005 Maintenance" dialog, click the blue hyperlink above the list box for "To install a new component, click here". Browse for the install media and work your way through to the SQL database engine and choose it to add another one. Give this one a name (e.g. SQLMOSS) and continue through. When finished, be sure to use the Surface Area Configuration Tool to enable remote TCP/IP connections.
In my case, I decided to partition out the virtual as follows:
  • 1/2 the memory (512 MB) maximum allocated to the SQLMOSS instance
  • 1/2 of remainder (256 MB) for the development/play default instance
  • other 1/2 of remainder left for the OS (Windows 2003 R2)

Here's a screen-shot of task manager running inside the Hyper-V remote console window:


Note that this was taken after configuration but before installing MOSS 2007.
The beauty of this virtualized approach is that I can add (or remove) processors and RAM depending on usage patterns and bottlenecks.

Tuesday, October 14, 2008

Quick 'n Dirty way to move Subversion to another machine

If you have an existing Subversion tree on disk somewhere and you wish to move it to another machine, here's a quick 'n dirty way to do it. I'm pretty sure I read this before somewhere but couldn't find it however I decided to try it anyway. Basically, you install the same version of Subversion onto the new server, create an identically named repository ("svnadmin create foo" - assuming "foo" is the name of the new repo), replace the contents of the "foo" directory from the original machine and voila.
Of course, this is no doubt unsupported - the proper way to move a repository to another location is documented here.