# Friday, June 01, 2007
Found this in a comment on ScottGu's blog:

We use the web setup project to deploy our web applications. To automate additional installation tasks like setting the .NET version and encrypting the web.config files we use a custom installer along with the web setup project (see relevant code below). However we recently ran into a problem when deploying an application on a server where there are several web sites. The site we wanted to install on was not the default site. Therefore our code to set the .NET version and assign the newly created application pool did not work since "W3SVC/1/ROOT/" was not the correct path to the website. Is there a property similar to [TARGETDIR] which we can pass to our custom installer to account for this. We know hard-coding "W3SVC/1/ROOT/" was not the best option but we also knew it would be correct 90% of the time. Thanks as always for your time.

Best Regards,

Stephen

info = New ProcessStartInfo()

info.FileName = "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe"

info.Arguments = String.Format("-s W3SVC/1/ROOT/" & strVDir)

info.CreateNoWindow = True

info.UseShellExecute = False

Process.Start(info)

info = Nothing

Dim myApp As New DirectoryEntry("IIS://localhost/W3SVC/1/ROOT/" & strVDir)

myApp.Properties("AppPoolId").Item(0) = strMyAppPoolName

myApp.CommitChanges()

myApp = Nothing

# re: Using IIS with VS 2005 and the new Web Project system

Friday, January 12, 2007 2:00 AM by ScottGu

Hi Stephen,

You can pass in the targetsite and targetvdir path as context parameters to your custom action by passing this:

/targetdir="[TARGETDIR]\" /targetvdir="[TARGETVDIR]" /targetsite="[TARGETSITE]"

Friday, June 01, 2007 10:11:13 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
I upgraded a web service application from .NET 1.1 and was getting the following error:

Parser error global.asax could not load type

I found this was caused because the installer for the application was creating an IIS web application set to use .NET 1.1.

Friday, June 01, 2007 9:46:32 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 

Warning, this is a bit of a rant…

Today I was trying to add a new unit test project to one of our solutions through the Visual Studio VSS plugin.  Everything seemed fine until I realized I had named the project folder incorrectly.  I thought “no big deal” I’ll just rename the project folder, but of course there is no way to do this through Visual Studio, you have to remove the project, rename the folder through Explorer, then re-add the project.  But since this was already checked in I would need to go through the VSS client and rename the project folder.  That’s why I hate source control integration with Visual Studio, it doesn’t support all scenarios (especially renaming things correctly to preserve history) and it tends to add an extra layer of complexity.  In addition to renaming the folder I needed to edit the solution to point to the correct location.  The one problem was that I forgot to change the stupid source control bindings so when you went to open the solution it wouldn’t find the project.  Apparently I needed to “rebind” the project – at this point I just hand edited the sln file to rebind it to the proper location.  After that everything seemed to be OK.

Just to make sure, I decided to open up my SourceOffsite client (SourceOffsite is basically a 3rd party client/server product to allow access to SS over TCP/IP) to verify things would look OK to the remote devs; but where’s the stuff I just checked in?  After some searching through the SOS forums I found out I needed to “Refresh Project Tree.”  That showed me the new files, but now I noticed the versions were incorrect.  I then had to get latest and overwrite local changes (even though I already had the latest) to update SOS on my client.  So now I have three possible points of contact with the source control database, and they seem to all have their own view of what’s going on.  This just scares the hell out of me, and makes integration painful.  Integration should be easy!  After all, we want everyone to integrate their changes as quickly as possible.

As per our current team rules, I then needed to send an email to everyone with a list of my changes.  Of course SS doesn’t have change lists so I have no way to know what the hell I just checked in.  We also don’t have a CC.NET server yet, so I couldn’t check there either.  Argh!

What a bunch of crap.  Something that should have taken me 10 minutes took me over an hour.  I think its time to setup an internal Subversion server to show everyone the way towards the light.

Friday, June 01, 2007 7:09:22 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Thursday, May 24, 2007
I had forgotten how much I hate dealing with web projects in Visual Studio 2003, until today.  I went to open up one of our companies VS 2003 web projects and didn't have a virtual directory configured before hand, so when it tried to open it complained it couldn't find the path to the csproj file.  OK, no big deal, open up inetmgr and create a virtual directory.  Well that was a good though, except I entered the incorrect path for the virtual directory.  Try again, change the virtual directory to the correct path and try an open the project again.  No good, I get this error now, "Unable to get the project file from the web server."  What the?

The fix: delete *.* from c:\documents and settings\sneal\VSWebCache.

Thursday, May 24, 2007 6:01:56 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [1]  | 
# Friday, May 18, 2007
I moved my little demo application (aka FoodBankTracker) that I use for demoing tech over to Visual Studio 2007 / .NET 3.5 today without much hassle.  The only real hassle I had was with log4net version/strong key mismatches between MonoRail RC2 and NHibernate 1.2 GA, but that's entirely another story.  The main reason I wanted to move it over to the new platform was to really try out the new language integrated queries (LINQ).  I ended up using the LINQ -> NHibernate criteria adapter being maintained by Ayende for several reasons:
  1. My NHibernate mapping files are complete.
  2. I like the unit of work NHibernate provides.
  3. Its always good to have some abstraction between the domain and the database layer.
  4. I'm familiar with NHibernate and already have infrastructure in place for it.
I grabbed the latest code from subversion for the LINQ -> NHibernate adapter and was up and running in no time.  The only change I had to make was to upgrade the NHibernate version from 1.2 beta3 to 1.2GA.  The hardest part was figuring out that I needed to add an assembly reference to System.Core for .NET 3.5 in my project.  Anyway, here's the one test I have working with LINQ and for comparison I'm also showing the original test without LINQ which does the same thing.

Friday, May 18, 2007 6:56:17 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Thursday, May 17, 2007
My little demo/test application that I monkey around with from time to time got a major revamp today.  Nothing fun or exciting, just a lot of infrastructure cleanup that I've been needing to do for some time.  I was hoping this would only take me an hour, but in reality it took me 3 times longer than that.  All I needed to do was:
  1. Upgrade NHibernate from 1.2 beta3 to NHibernate 1.2 GA.
  2. Separate out my shared core library into a separate folder/solution structure.
  3. Stop using GAC'd Castle and NUnit assemblies and use a local libs folder to facilitate building on a clean box.
Nothing fancy, but I ran into some serious issues with log4net.  You would think that because most open source projects use log4net, integration of multiple open source products that use log4net would be a breeze right?  Well, Castle RC2 uses log4net 1.2.9.0 while the latest NHibernate release uses log4net 1.2.10.0.  That seems fine, just add an assembly binding redirect to have castle using the newer log4net version right?  Well that's fine until you realize that the log4net team unexplicablly changed their signed key between those releases, which means you can't use a binding redirect.  Oops, I doubt the log4net team intended that to happen.

To get around this version mismatch I ended having to grab the latest code from the Castle subversion repository which included log4net 1.2.10.0 and build my own assemblies that would play nicely with  NHibernate.

The moral of this story is don't change your keys between versions if they're binary compatiable/incremental updates.  Especially for something so commonly shared as log4net.

.NET | WTF
Thursday, May 17, 2007 10:22:46 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, May 15, 2007
Anyone who's programmed in VB for a while will find this article interesting: http://www.codinghorror.com/blog/archives/000860.html

I didn't realize (or maybe truly understand) VB.NET had a background compiler in Visual Studio 2005 like Eclipse does for Java.  When I was programming in Java/Eclipse the background compiler literally saved me 20 minutes or more a day, its hard to believe C# doesn't have this even in Visual Studio "Orcas". 

The one thing I really from miss from VB is the with statement.  The with statement is very fluent and readable. In C# we could have something like the using statement:

Person user = new Person();
with (user)
{
   .FirstName = "John",
   .LastName = "Doe",
   .Age = 18,
   .PhoneNumber = 5555555,
}

The one thing we will have in .NET 3.5 is property initializers which are pretty close to the with statement, but the one difference is that the with statement would work anywhere.  Property initializers only work on construction of the object and really only save you from having to declare a bunch of overridden constructors.  Property initializers look like this:

Person user = new Person()
{
   FirstName = "John",
   LastName = "Doe",
   Age = 18,
   PhoneNumber = 5555555
}

Now what happens if I need to reuse an instance and assign different values?  Well, hopefully you won't need to, and in likely hood its very unlikely you would.  When I was programming in VB I generally only used the with statement to initialize an object.  What do you think?

Tuesday, May 15, 2007 5:11:50 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Friday, May 04, 2007

I was reading this post by Jeremy Miller and came across this golden nugget of wisdom that seems to be very applicable:

"Oh, and the people out there swearing up and down that giving the business end users a screen to configure a business rules engine themselves will save the day?  BS.  Drawing workflow's with pictures is coding -- with every bit of the risk and danger that coding brings.  Only now you're making noncoders code in the production system.  Think about that last sentence. "

Bingo!  Allow me to elaborate on this:

  • There are no unit tests surrounding the changes, which imply legacy “code”.
  • No verification step.  QA is completely out of the loop, I doubt they would appreciate that.
  • Engineers will need to be brought in to fix problems when something unexpected happens.  This is a reactionary situation which causes people to work over time and under stress, both of which I know I like to avoid.
  • There is no formal change control surrounding the process.  This sounds bad, breaking the law kind of bad.
  • Who wants to code through Visio or some one off custom UI anyway?  Last I checked Visio didn’t have a debugger, and if Visio doesn’t have a debugger certainly your one off custom UI won’t.  Good luck tracking a problem down without full disclosure to the system code and infrastructure.

These issues are not just merely applicable to business rules engines; they are also applicable to highly customizable applications with lots of admin screens.  Do you really want end users to be able to go in and add/remove workflows, user accounts, test points?  Do they really need these features?  Probably not, and this could potentially open up all kinds of data integrity issues.  Who really wants to restore a database from tape because some user made a change they didn’t truly understand?  This is why it’s important to have someone own the change process, like a development team or business rules expert.  Someone needs to be accountable for the integrity of the system.

On top of all this we need to take into account all of the extra work that will need to be done just to create the hellish user interface to the back end of the system.  Add documentation, testing, and training to the mix and you just doubled or tripled your system cost, and what have we gained?  We gained: lots of extra work, bugs, and data integrity issues.

Having the system be highly end user configurable makes the business feel more comfortable because they believe they’ll have ultimate control and flexibility.  Probably a far better solution (and more cost effective) would be to work on your trust issues with the business.  Put them at ease about the system by making them feel like they are part of a cooperative team rather than just a customer.  When release 1 hits they need to know the development will still be there to add additional features and fix any issues that crop up in a timely and predictable fashion.

Friday, May 04, 2007 4:45:32 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Thursday, May 03, 2007

In manufacturing wastes are well documented and generally understood, however in software development waste is acknowledged but usually misunderstood, especially by Microsoft Project Project Managers.  In many circumstances (especially in waterfall shops) the common root of all software waste is deemed to come from not planning enough, or not documenting enough.  Basically, all this effort is expended up front trying to ensure that the cardinal sin is not committed.  What is this sin?  Throwing code away. 

In reality we want to throw away code, as much code as possible.  I'm not saying we should generate code just to throw it away, but we should always be looking for opportunities to trim back the code base.  Less code is easier to maintain and test. 

Developers often think through tough business problems and technical problems by coding.  Coding is not just a statement of some requirement, coding is a mental exercise performed by programmers to better understand the problem domain.  It’s through coding we arrive at greater understanding and insight.  Coding allows us to make logical connections between entities, rules, and requirements.  During this research phase should the code be thrown away?  Not necessarily, but in all likelihood all this code will be thrown away as understanding of the problem domain changes over time.

If what I say is true, then throwing away code is not a waste, in fact throwing away code is quite productive.  Waste in software development comes from other areas.  Mary and Tom Poppendieck make the case that waste in software comes from the same areas as manufacturing, however with a slightly different software twist:


Manufacturing                             Software Development


In-Process Inventory          Partially Done Work
Over Production               Extra Features
Extra Processing              Relearning
Transportation                Hand Offs
Motion                        Task Switching
Waiting                       Delays
Defects                       Defects


Thursday, May 03, 2007 5:06:10 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
An entertaining quote from the book I'm reading, "It is better for developers to be surfing than writing code that won't be needed."

They aren't referring to technical spikes or learning opportunities, they are talking about features to a real product.  In other words do option 1*, its cheaper.  Adding unneeded features to your code base will cost you more money over the lifetime of the product than paying the developer to do nothing at all.  Each feature you add complicates the code base making each additional change more costly.

* There are always 3 options to any decision, and option 1 is always "do nothing."

Thursday, May 03, 2007 4:33:33 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Wednesday, May 02, 2007
Right now I'm reading Implementing Lean Software Development by Mary and Tom Poppendieck, and something about the Toyota Production System caught my eye.

"Both Toyodas had brilliantly perceived that the game to be played was not economies of scale, but conquering complexity."

I translate this to mean, RAD code generated goo from Visual Studio versus elegant loosely coupled code based solutions (the kind most often found in OSS).

Wednesday, May 02, 2007 9:49:24 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
Thank you Google for providing with all kinds of useless, but entertaining, information.  From the Urban Dictionary...


A sneal is not quite a snack, nor is it quite a meal. A sneal lies somewhere in between the two, and snealing is most commonly practiced by college students. When confronted with the question of what the healthiest methods of eating are, it has been said that regular "snealing" is more beneficial to the individual than regular "mealing." A sneal, in most cases, is equivalent to 2/3 of a meal (This also means that 2 sneals equals roughly 1 1/3 meals).
To date, the most common snealing plan involves a regular breakfast, a regular lunch, and two sneals in the evening (one typically at 5 p.m., the other typically at 8 p.m.). Though the average "snealer" eats two sneals a day, it is quite possible, and perhaps more beneficial, to eat three in a single day to support the growing minds of college students.
Another part of the sneal involves 2 - 8 oz. glasses of the choice beverage. Though milk is encouraged to be at least one of these drinks, it is not absolutely necessary for a healthy sneal.

If we sneal now at 5:30, we will still have time for another one before the cafeteria closes.


Wednesday, May 02, 2007 5:40:56 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
HTML textarea controls do not support the maxlength attribute like the text input control.  Doh!  The nice easy way around this is to add an ASP.NET regular expression validator with the following regex: ^[\s\S]{0,25}$

The only slight problem with this approach is that it is possible to input more than X number of characters, but the validator will display an error and disallow the page to be submitted.

Wednesday, May 02, 2007 5:33:01 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  |