Nikon D80

Sep 26, 2007 by:   Tim Stanley

In early 2007, I decided to get a digital SLR. This is a summary of the research and reasoning that led me to purchase the Nikon D80 and the Nikon 18-135mm lens and various accessories as well as my feedback and review of the products.

Why Nikon?

I was looking for a medium level SLR. I narrowed my selection to the two top SLR Manufacturers, Canon and Nikon. Out of the offerings from those manufactures, I considered the following SLR's.

Camera Resolution Sep 2007 Prices
Nikon D40 Digital SLR 6.1 mp $499.95 w/ 18-55mm lens now $479.95
Canon EOS Digital Rebel XT 8.0 mp $449.95 now $409.95
Canon Digital Rebel XTi SLR 10.1 mp $595.95 now $517.00
Nikon D40x Digital SLR 10.2 mp $635.99 refurbished at $449.95
Nikon D80 Digital SLR 10.2 mp $874.95 now $729.95
Canon EOS 30D Digital SLR 8.2 mp $999.95 now $799.95
Canon EOS 40D Digital SLR 10.1 mp $1299.95 pre-order now $939.95
Nikon D200 Digital SLR 10.2 mp $1499.95 now $1259.95
Nikon D300 Digital SLR 12.3 mp $1799.95 now $1799.95

The jump from 6 mega pixels to 10 mega pixels was $135.  The jump from 8 mega pixels to 10 mega pixels was $145. The difference was justified to me at this point so I knew I wanted a minimum 10 mega pixel camera. For my considerations this eliminated the D40 and the Rebel XT.

After handling the Canon Digital Rebel XTi, it just didn't feel right to me. I already owned the Canon Rebel Ti, and I got it because it was lighter than the Nikon N55, but it's always felt awkward in my hands but my wife loved it because of it's lighter weight and smaller size. The popular reviews made it a tough choice to eliminate, but I removed the Canon XTi from my list of choices because it just didn't feel right in my hands.

This left the selection of currently available equipment to the Nikon D40x, D80, D200 and the non EOS 30D. I had both some Canon 35mm film equipment and access to quite a bit older Nikon 35mm film equipment (circa 1972). I decided to eliminate the Canon 30D and narrow the selection to the three Nikons.

Nikon D40x, D80, D200 Comparison

Most of the features are very similar between the Nikon D40x, D80, and D200. The price difference of $600 to $1500 is a pretty big spread.  What made the features so much better on the D80 and D200 to justify the cost?  I had to gleam most of this information from the Nikon specifications, but the article Nikon D80 vs D200 was also helpful.  I included an importance factor to evaluate these.  There are some features that I have weighted more heavily after use than when I initially evaluated them.  These turned out to be more important than I thought.

Feature Importance D40x D80 D200
Viewfinder 1 .8x .95x .94x
Aperture Dial 1 No* Yes Yes
Shutter Dial 1 Yes Yes Yes
ISO Button 1 No* Yes Yes
White Balance Button 1 No* Yes Yes
Weight 1 495g
1lb 1oz
1lb 5oz
1lb 13oz
Wired remote 2 None MC-DC1 MC-30 or MC-36
Frame Rate 3 2.5 / sec 3 / sec 5 / sec
Weather sealed 3 No No Yes
ISO in finder 3 No No* Yes
Pre-AI Lens 3 Yes No No
AI Metering 3 No No Yes
AF Lens (Body driven) 4 No Yes Yes
Auto Focus Points 4 3 11 11
Metering Sensor 4 420 segment 420 segment 1,005 segment
Lens mount 4 plastic metal metal
Bracketing 5 None 2-3 steps 2-9 steps
Width 5 5.0" 5.2" 5.8"
Height 5 3.7" 4.1" 4.4"
Depth 5 3" 3.0" 2.9"
Wireless remote 5 ML-L3 ML-L3 ML-3 or WT-3
Qual Button 5 No* Yes Yes
Memory Card Type 5 SD SD CF
Battery 5 EN-EL9 EN-EL3e EN-EL3e
Timelapse 5 No No Yes
ISO 5 100 - 3200 100 - 3200 100 - 3200
Intervalometer 5 No No Yes
Shutter Exp Delay 5 ? Yes 400ms Yes

The D40 has a minimum ISO of 200 and shoots 2.5 frames / sec.  All other specifications on the D40 are similar to the D40x.

The viewfinder was noticeably different between the D40x and D80 and I'm much more in favor of the D80/D200 size and view.

The lack of two dials to control both the aperture and the shutter speed were very important for me.  With the Canon Rebel Ti, which has one dial, this made manual mode very annoying.  I was used to using a Nikon F with full manual mode and this turned out to be the single most important factor for me in evaluating the three camera bodies.  I found that having to use the menus to set the Aperture / Shutter speed / ISO was very distracting for me.  I much preferred the ability to controls these directly on the D80 and D200.

The weight doesn't look that different on paper but in actual use my perception was very different.  For my personal preference, the D40x is light, the D80 moderate, but the D200 is moderately heavy.  There have been some discussions on this fact so don't disregard it lightly.  The feedback is it's either sturdy or heavy depending on your point of view.  The only way to tell is to hold it with a lens attached.

Having the ability to set the ISO and White Balance with a button and dial instead of using the menus as on the D40/D40x is a convenience.  I found I did not like ISO Auto and instead preferred more manual control.  Therefore the ability to set the ISO became something that was more important to me over time.

The D40/D40x does not show having a wired remote ability.  If you want to take exposures longer than the 30 seconds on Bulb, you'll be limited to holding the button on the camera down and if you're like me, you'll shake the camera.

For the frame rate, 2.5 or 3 frames per second sounds like a lot on paper.  After shooting a few soccer games, my feeling is it's slow.  Not so slow as to be aggravating, but it's come up about once per game that I'd like faster frames / second.  Not enough that I'd be willing to pay the price increase for a D200 or D300.

The D80 does have the ability to show the ISO in the view finder, but the FUNC button has to be configured to show this.  Again, this isn't something I thought was important, but in using Auto ISO, or changing the ISO manually it does become more important.

Supporting a Pre-AI lens was important to me since I had access to my Father's circa 1974 set of Nikon lenses.  It turns out these are pre-AI lenses and although they were Nikon F mount, the aperture ring conflicts with a minimum aperture sensor on both the D80 and D200 bodies.  The Pre-AI lenses could be modified to fit the AI required mount for the D80 and D200.

Reading all the reviews on the D40x, D80, and D200 led me to believe there was not any significant difference in image performance between these bodies.

I could spend $250 more than the D40x and get the D80 which gave me the important two command dials and external buttons, and the wired remote feature.  Below is a picture of the front and back dials on the D80 that show the features (1 dial, 4 buttons) that are present on the D80 that are not on the D40x.


Nikon D80 Front

The front of the D80 has one button and one dial that are not present on the D40x. The D80 button can be configured to be used for several different features. I have mine configured to display the ISO setting in the viewfinder.


Nikon D80 Back

The back of the D80 has three buttons that are not present on the D40x. These are for White balance, ISO, and Quality settings. When presed in combination with the command dial in the upper right, these allow direct setting of these values without having to use the full screen LCD menu.

I could spend $850 more than the D40x or $600 than the D80 and get the D200 which gave me better metering, a faster frame rate, and the ability to meter on AI manual lenses. 

In the end, I purchased the Nikon D80 as the most appropriate feature for cost value for my situation and I've never regretted it.

Equipment Bought

This is equipment I've actually bought and used. It's not just a wish list. I am happy with all of this equipment.

Description 2007 Cost Reviews
Nikon D80 Digital SLR $874.95 Ken Rockwell
DP Review
Thom Hogan
Nikon 18mm - 135mm f/3.5-5.6G ED-IF AF-S DX $299.95 Ken Rockwell
Thom Hogan
Nikon MC-DC1 Remote Release Cord for D80 $24.95  
Nikon ML-L3 IR Remote Control Transmitter for D-80 $16.95  
Lowepro Topload Zoom Mini, Holster Style Camera Case, Red. $19.95  
Nikon BM-7 LCD Monitor Cover D80 $9.95  
SanDisk 2 GB, Ultra II Secure Digital (SD) Memory Card $34.95  
Giottos Rocket Air Blaster $9.95  
Op/Tech 18" Rainsleeve $5.99  

I had a 28-90mm zoom and a 43-86mm Nikkor zoom. I knew I wanted a zoom lens and not a fixed focus length lens.

What I really wanted was the 18-200mm Nikon zoom. For most of 2007 this lens has been on back order and I couldn't see waiting three months to get a lens that has problems with the zoom barrel slipping. I had this problem on the 43-86mm and while for some it may be just a nuisance, I can't see spending that kind of money with something that has that kind of a problem.

I went with the Nikon 18-135mm zoom lens. The Nikon 18-135 is a great lens for me. There are reports that this lens has some quality problems and I have found on two occasions when shooting with the camera rotated 90 degrees, that the motor made an unusual grating sound. I repositioned the camera back to horizontal and the problem went away. Others have reported this problem as well.  I don't know if this is going to be a problem in the future or not. 

Other than this one problem, I love this lens. In discussion, a lot of professional photographers mock this lens since it's not "professional" quality. The lens takes better pictures than I have skill for at this point in time so I really have no complaints.  I've read the MTF and spec charts on the lens compared to "professional" lenses and I've come to the conclusion that it's just as good a lens, but has only one drawback when compared to those lenses, it has a plastic mount.  It has a manual focus ring which can be overridden without flipping a switch.  I do find myself with a lot of shots taken at 135mm so that's got me wanting a little more focal length.  135mm is fine for about 50 yards or less on the soccer field, but beyond that shots require cropping.

The MC-DC1 is a must buy.  I've used it several times for lunar eclipses and some slower landscape shots with the shutter delay on.  I I should have bought this when I bought the camera. 

The BM-7 LCD cover is my second one.  I have no idea where I lost the original, but I'm glad their not expensive.

The Lowepro Topload Zoom Mini case holds the Nikon and the 18-135 but just barely so.  I had this case previously with a Canon so I just continued to use it with the Nikon.  If I get another, it's going to be something with a little more room at the end of the zoom.

Equipment To Buy

Description 2007 Cost Reviews My Notes
Nikon 50mm f/1.8D AF Standard Auto Focus Nikkor Lens $109.95 Ken Rockwell
SLR Gear
52mm filter
Nikon 70-300mm f/4.5 - 5.6G ED-IF AF-S VR $479.00 Ken Rockwell
SLR Gear
Nikon Imaging
62mm filter
Lowepro Rezo TLZ-20 Holster-style Bag $34.95    

The selection of these two lenses is based off feedback from discussions and users in other groups.  Everyone seems very happy with the 70-300mm VR and the only complaint is that it's not 2.8.  For $400 compared to the 80-200mm f2.8 or $1200 compared to the 70-200mm f2.8 VR, I'll stick with this one.  In addition, it's a perfect match to the 62mm filter size to correspond with the 18-135mm lens.

The 50mm f1.8 has gotten rave reviews and I want to try the fixed lens and it's not a big cost.  I had the 50mm f1.4 Nikkor-S and the faster lens does make a significant difference in some circumstances.

Description 2007 Cost Reviews My Notes
Nikon 55mm - 200mm f/4-5.6G ED-IF AF-S DX VR $229.95 Ken Rockwell
SLR Gear
MF Ring hard to use, outside.
DX Only
Nikon 18mm - 200mm f/3.5-5.6G ED IF AF-S DX VR $769.95 Ken Rockwell
SLR Gear
Thom Hogan
Zoom slips
Very very popular.
Nikon 80-200mm f/2.8D ED AF $884.95 Ken Rockwell
Ken Rockwell (afs)
SLR Gear
Nikon Imaging
Very popular.
Nikon 70-200mm f/2.8G AF-S VR $1624.95 Ken Rockwell
SLR Gear
Very popular.
Nikon 105mm f/2.8G ED-IF AF-S VR Micro-Nikkor $759.95 SLR Gear  
Nikon 85mm f/1.8D AF $399.95 Ken Rockwell
SLR Gear
62 mm filter
F stop range 1.8-16
Nikon 85mm f/1.4D IF AF $1024.95 Ken Rockwell
SLR Gear
Nikon 50mm f1.4D AF $284.95 Ken Rockwell
SLR Gear
F stop range 1.4 - 16
52mm filter

After reading about all the plethora of lenses available both older F mounts with AF and the newer lenses, this is the list that I've put together.  When folks are asked what equipment they have and they recommend, these lenses keep popping up in the lists.  I looked at these, and most of them are a bit more expensive than I'm willing to invest in what is mostly a hobby or would duplicate what I already own.  If I made income doing photography, the price of these would be easier to justify.

The one exception in cost is the Nikon 55-200 mm.  This is a very compelling lens in quality and range.  It fills the gap beyond the 135mm lens I have without having to spend a lot of money.  All the tech specs look good for the cost.  When I tried it out, it just didn't seem to feel right for me.  I don't have a good way to explain it, I much preferred the 70-300mm VR with the manual focus ring and the feel for the lens and that's why it's on the list to buy instead of this one.   There is not really enough difference in 200mm versus 300mm to really worry about, but the 70-300mm VR is just more appealing to me.

I've listed these here for my benefit.  People seem fond of the lenses in this list and I like to refer back to them from time to time.  Who know,s maybe I'll hit the lottery and the $1600 for the 70-200 VR will seem worth it to me at some point.



  1. Nov 12, 2007 - Added intervalometer and shutter delay options.
  2. May 30, 2008 - Updated prices on equipment.

As of May 2008, it's been over a year since I bought the Nikon.  I've purchased the 50mm f1.4 and I really love the camera and the lens.  There are some circumstances where the 18-135mm lens just doesn't grab enough light (indoor band concerts and indoor basketball courts) but the 50mm f1.4 really helps.  The 135mm lens does not have quite enough reach beyond 50 yards on a football or soccer field.  200mm or 300mm is much better. I've tried the non VR 70-300mm lens and I'd definitely recommend the VR.  It's kind of difficult for me to get a sharp focus at 300mm even in a bright sunny day on a soccer field without VR.  The 18mm lens also gives a good wide angle when needed.  I still find a lot of my shots are beyond 100mm.

There are several folks who have had problems with the 18-135mm lens from what appear to be a loose connection.  I've experienced problems on three occasions with a strange noise trying to focus when the camera is turned on it's side.  Straightening the camera out made the noise quit.

I've also found I can use some of the old equipment with a few tricks.  A 50mm macro lens can be fit to the D80 with adapter rings, and a Vivitar 283 can be made to fire from the onboard flash.

Related Items

How Do Google Gadgets Work

Aug 03, 2007 by:   Tim Stanley

iGoogle allows you to customize your Google home page by adding gadgets which take content from other sites. These can be categorized with tabs and you can even customize your own web pages by adding gadgets developed by others.

I was curious how this worked and how to take advantage of it and this is a summary of what I found.

The following gadget is a photo of the minute gadget using Flickr photos.


The following is the script code that was provided from Google Webmasters.

<script type="text/javascript" src=";up_refresh=5&amp;up_displayDetails=1&amp;synd=open&amp;w=320&amp;h=320&amp;title=Photo+of+the+minute&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>

From what I can tell, this is what the Google gadget appears to do.

  1. It runs a script at Goggle gmodules using the URL:
  2. That URL loads another script from
  3. The Google script builds an IFRAME for the output content for the gadget.
  4. The content of the CDATA section is placed in an the IFRAME

If you notice the code in the script, you see a section on that embeds Google Analytics information. This isn't really a security risk, but you are being tracked as a user of the Gadget.

Content Combination Techniques

Showing a web page with content from multiple locations is what 99% of what the Internet and intra-net is about. There are a handful of techniques, but multiple technologies that support the different techniques.

Frames: The Goggle gadget (and others similar to this) use a frame. A frame basically takes content from another web page, but allows it to be displayed as if it were part of the current page.

Pre Rendered Content: Content is combined prior to output of the page. This often involves templates some type of code logic to combine the templates and data. Data is obtained from databases, XML files, static CSV files, or other web services. IIS and Apache servers use technologies including ASP, ASP.NET, and PHP to name a few.

Post Rendered Content: Content is combined in the client browser after the initial page is loaded. This requires a browser client that supports some level of scripting and at the lowest level HTTP requests. This technique takes XML or HTML after the page loads and parses it to update or output the content to local page. XMLHTTP, AJAX, ATLAS, and JavaScript are all technologies uses to make post rendered content sites work. Netflix was one of the sites to make post rendered content a feature to imitate.

Another interesting way to combine information and to allow filtering and sorting was published at MIT called Exhibit. An interesting example is the list of San Francisco Bay Restaurants

The iframe

The Google gadget really isn't anything new for the web. It's just an iFrame which is a section of the HTML document that contains another HTML document. This is useful when trying to merge content from multiple sources into a single page.

Frames are generally considered bad by designers for web design and navigation. They cause page sections to load irregularly and in an uncontrolled order and if there are errors loading the page section, then the page looks terrible from a design perspective (the user sees 404 file not found errors).

Instead of frames, designers like to use CSS on <div></div> sections to control positioning and layout.

Gadgets Pros and Cons

  • Pro: You don't have to develop the code.
  • Pro: You get to leverage other peoples code (almost as good as leveraging other peoples money)
  • Pro: Gadgets use client bandwidth, not server bandwidth (at least not the original hosting page server)
  • Pro and Con: If the gadget changes, you don't know about it
  • Con: The gadgets can and often do embed tracking information
  • Con: The gadgets can contain advertisements
  • Con: Google knows the page that requested it


  • I prefer not to use JavaScript if possible.  Because JavaScript is runtime checked, not compile time checked, it's impossible to remove all the errors.  There are pages everywhere on the web with JavaScript errors and every programmer makes them. If I use them, I prefer debugged and tested scripts that have been tested in multiple browsers.
  • I do prefer pre rendered server side solutions (my preference is ASP.Net) with compiled code (VB.Net is my preference).
  • If I use post rendered techniques, I like the use of XMLHTTP with simple DIV replacement techniques.
  • Leverage other peoples debugged code instead of writing new code.
  • Use the technique you can most likely make work most cost effectively.
  • Be aware of the fact that Google gadgets are not necessarily doing things in your web sites best interest.


Related Items

HTML Horizontal And Vertical Bar Charts

Apr 12, 2007 by:   Tim Stanley

Displaying tabular information in a graphical form is helpful for a visual representation of the data. I've summarized a few simple techniques for displaying information in an HTML page in both horizontal and vertical form.

There are a few techniques I've used to make this simple.

  1. A table is used for the data
  2. An image is used for the horizontal data
  3. The values shown are the width of the image (or proportional)
  4. An image is used for the vertical data
  5. The values shown are the height of the image (or proportional)

Horizontal Bar Chart Sample

Pages Completed Per Month









Sample Horizontal Table Data

<div class="BarTable">
        <caption>Pages Completed Per Month</caption>
            <td><div class="BarLabel"">Jan</div></td>
            <td class="BarFull">
                <img src="hk.png" height="12" alt="320" width="320" />
            <td><div class="BarLabel"">Feb</div></td>
            <td class="BarFull">
                <img src="hp.png" height="12" alt="420" width="420" />
            <td><div class="BarLabel"">Mar</div></td>
            <td class="BarFull">
                <img src="hh.png" height="12" alt="467" width="467" />
            <td><div class="BarLabel"">Apr</div></td>
            <td class="BarFull">
                <img src="hx.png" height="12" alt="510" width="510" />

Vertical Bar Chart Sample

Pages Completed Per Month
320 220 267 310






Sample Vertical Table Data

<div class="BarTableVertical">
        <caption>Pages Completed Per Month</caption>
        <tr class="BarVertical">
            <td><img src="vh.png" height="120" alt="320" width="12" /></td>
            <td><img src="vk.png" height="220" alt="420" width="12" /></td>
            <td><img src="vp.png" height="267" alt="467" width="12" /></td>
            <td><img src="vu.png" height="310" alt="510" width="12" /></td>
            <td><div class="BarLabel"">Jan</div></td>
            <td><div class="BarLabel"">Feb</div></td>
            <td><div class="BarLabel"">Mar</div></td>
            <td><div class="BarLabel"">Apr</div></td>

CSS Styles

    font-size: .9em;
    font-style: italic;
    margin: 0;
    padding: 4px;
    border: solid 1px #000000;
    padding: 0px;
    margin: 0px 4em 0px 4em;
    width: 80%;
    border: solid 1px #000000;
    padding: 0px;
    margin: 0px 4em 0px 4em;
.BarTable tr, .BarTableVertical tr
    vertical-align: top;
    padding: 0px;
    margin: 0px;
    background-color: #00CC66;
.BarTableVertical tr td
    background-color: #CCFFFF;
.BarTable tr p, .BarTableVertical tr p
    position: relative;
    display: inline;
    font-size: .8em;
    padding: 0px;
    margin: 0px;
    z-index: +1;
    background-image: url(gridline58.gif);
    background-repeat: repeat-x;
    background-position: left top;
    width: 100%;
    background-color: #CCFFFF;
.BarFull p
    margin: 0px 4px 4px 4px;
    background-color: #FFFF99;
    color: #000000;
    height: 100%;
    background-color: #CCFFFF;
    vertical-align: bottom;
    text-align: center;
.BarVertical p
    margin: 0px 4px 4px 4px;
    background-color: #FFFF99;
    color: #000000;
    text-align: center;
    padding: 0px 4px 0px 4px;
    width: 2.5em;
    font-size: .9em;


  1. HTML Bar Charts
  2. HTML Horizontal Bar Chart
  3. HTML Horizontal Bar Chart
  4. Digits to Charts
  5. XML Bar Chart
  6. An accessible bar chart
  7. CSS For Bar Graphs
  8. Bar Graph Eric Meyer
  9. Vertical Bar Graphs
  10. 10 Free CSS Graph Resources

Related Items

How To Install a Web Application for a Site with a Specific Port

Apr 10, 2007 by:   Tim Stanley

MSI installation projects created in Visual Studio 2003 allowed the setting of a PORT value. This port value would be used to search the IIS sites and install the web application by default on the first site that corresponded to the specific port.

Users migrating from Visual Studio 2003 to Visual Studio 2005 have found that support for the PORT property has been removed and there are few technical options available to solve this problem.

This article outlines how using Visual Studio 2005 SP1 and a command line and MSI custom actions to install a web application on a site configured for a specific port.

After an update to VS 2008, I see no options that resolves this in VS 2008 either.

Visual Studio 2003 Background

In IIS, on Windows Server 2003, multiple sites with multiple ports are used in most deployments. For example, if two sites are configured, one with port 80, the other with port 8080, they would appear as follows in the IIS administration tool.



In IIS admin, the port value and the host header value can also be set under the advanced settings.

If one wanted an MSI package to install a Web Application by default on the site that used port 8080, and the virtual directory to "TestWeb", Visual Studio 2003 made this easy.

  1. Select the File System view of the Web Setup project for the web application
  2. Select the properties view of the Web Application Folder
  3. Set the Port property to 8080
  4. Set the VirtualDirectory Property to "TestWeb"

If one wanted to pass this as a command line parameters the MSI these MSI properties could also be set.

   TARGETDIR="C:\Program Files\..."

The property TARGETDIR can also be used to specify the physical path where the application should be installed.

Command Line Options for TARGETSITE

Msiexec /I "Websetup1.msi" TARGETSITE="/LM/W3SVC/1"

The problem with this approach is that the site will not be the same number on every server. We can use this approach to know what site number is used based on the port number assigned to that site. We can use the algorithm noted below in a VB script to find the server number and use the update the TARGETSITE on the command line.

  • serverNumber = FindServerNumber( 9115)
  • tgtSite = "/LM/W3SVC/" & serverNumber
  • shell.Run "msiexec /passive /I """ & argInstallerName & """ TARGETSITE=" & tgtSite

Function FindServerNum(strPort) 
    Dim MD_SERVER_STATE_STARTED, MachineName, IISObjectPath, IISObjects
    Dim ChildObject, ChildObjectName
    'Dim Servers 
    Dim ServerNum, i, strBindings, strSvrPort, BindArray, binding
    Dim svrCount, arrCount, Servers(10), site
    svrCount = 0 
    arrCount = 0 
    i = 0 
    MachineName = "localhost" 
    IISObjectPath = "IIS://" & MachineName & "/W3SVC" 
    Set IISObject = GetObject(IISObjectPath) 
    'Find all the server numbers pu into an array 
    for each ChildObject in IISObject 
        ChildObjectName = ChildObject.AdsPath 
        ChildObjectName = Right(ChildObjectName, Len(ChildObjectName)- InStrRev(ChildObjectName, "/")) 
    on error resume next 
        ServerNum = Clng(ChildObjectName) 
        If (Err = 0) Then 
            Servers(arrCount) = ServerNum 
            arrCount = arrCount + 1 
        End If 
    'Get the port number and compare with the passed port number. If match, return the server number 
    while i <= arrCount 
        set site = IISObject.GetObject("IIsWebServer", Servers(i)) 
        ' Gets the Port Number of the current IISObject. 
        BindArray = site.ServerBindings 
    on error resume next 
        strBindings = BindArray(0) 
        If Err = 0 Then 
            'remove the : char from begining and end of the port number 
            strSvrPort = Left(strBindings, InStrRev(strBindings, ":") - 1) 
            strSvrPort = Right(strSvrPort, Len(strSvrPort) - InStr(strSvrPort, ":"))    
    on error resume next 
            If cint(strPort) = cint(strSvrPort) Then 
                If Err = 0 Then 
                    If IISObject.ServerState = MD_SERVER_STATE_STARTED Then 
                    ' Determines if this is our server. IIS can only have one 
                    ' active port, so if the port is active it is the port where 
                    ' the application is installed.                    
                    FindServerNum = Servers(i) 
                    svrCount = svrCount + 1                    
                    exit function 
                End If 
            End If 
        End If
        i = i + 1 
    If svrCount = 0 Then 
    ' Err.Raise 9999, "FindServerNum", "No Active Servers with the requested port were found. Port=" & strPort &  ". " 
    End If 
End Function 

A copy of the script can be downloaded

Getting the TARGETSITE in a Custom Action

If you follow the basic line of logic from the article at Walkthrough: Passing Data to a Custom Action then getting the TARGESITE value is fairly simple.

  1. Create an Installer Class (Add new item, Installer class)
  2. Put the code in the installer class to process the parameters
    Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary) 
        ' Gets the parameter passed across in the CustomActionData. 
        Dim strSite As String = Nothing 
        strSite = Me.Context.Parameters.Item("SITE").ToString 
        MsgBox("SITE=" & strSite, MsgBoxStyle.Information, "Custom Install")     
        Me.Context.LogMessage("JS Action Before SITE=" & strSite) 
    End Sub 
  3. Add the output from the installer class to the web installation (View File System, Add project output, select primary output from the project with the installer class)
  4. Create the custom action (View custom actions, add custom action, select Web Application Folder, select Primary output from the project with the installer class)
  5. 5. Set the CustomActionData property for the custom action as follows:

If you run the following command, you should see a message box that appears showing the SITE value.

msiexec.exe /qf /norestart /Liwearucmopvx! MSIInstall.log /i WebSetupald.msi

Setting the TARGETSITE in the Custom Action

So now we have read it, we should be able to set it.

Me.Context.Parameters.Item("SITE") = "/LM/W3SVC/1"

Actually, this is misleading, you can’t set the TARGETSITE. Ok, you can, but by the time you set it, the TARGETSITE has already been established and so setting it is a moot point.

If you actually run this, you will see there are two problems with this approach. First, the component that executes the custom action actually gets installed in the TARGETSITE and TARGETVDIR. Second, since the TARGETSITE has already been set in the User Dialog or Acquisition or User Dialog phase of gathering the data to set the properties for the installation.

The Windows Installer goes through a series of sequences for the MSI package: Initialization; User Dialog; Finalization or Rollback. A full explanation of these phases is best explain in the article Installation Phases and In-Script Execution Options for Custom Actions in Windows Installer.

Essentially, this is a chicken and egg problem. One can’t set the property in the custom action because by the time the custom action is invoked, the property for TARGETSITE is already set.

Phil Wilson also explains the same sequencing problem in his article Visual Studio Setup - projects and custom actions.


Essentially if you have to solve the problem of installing an application on a site with a specific port, there are two options. Set the TARGETSITE property and pass this as a parameter prior to invoking msi install, or moving to another tool like Windows Installation Studio 7 by Wise (aka Altiris) or InstallShield from Marco Vision. These products allow the creation of dialog windows which can be customized with further custom actions and logic far beyond what the Visual Studio 2003 or 2005 products allow.


Related Items

2007 Keystone Colorado Trip

Feb 28, 2007 by:   Tim Stanley

I recently had the opportunity to travel to Keystone, Colorado.  This is a summary of the wonderful experiences I had on the trip, including a sleigh ride, snowmobiling, and dinner atop a ski lodge.

The camera and lens used in all pictures is a Nikon D80 with the Nikon 18-135 mm lens available at Adorama.

Sleigh Ride Dinner

The activity for the first evening was a horse drawn sleigh ride and dinner. This started at about 4:30 pm in a national park just outside of Keystone, Colorado. The scenery was absolutely beautiful. It was dark when we came back, but the moon was out and the stars were extremely bright. If you are visiting with friends or family, I would highly recommend a sleigh ride, but I recommend it during the daylight hours. When the sun goes down, it gets cold quickly in the Colorado mountains.


Sleigh Ride

Nikon D80 18-135 mm lens @ 70 mm F5.6 1/60 sec ISO-100.


Dinner at the ranch

Nikon D80 18-135 mm lens @ 70 mm F5.6 1/400 sec ISO-100.

Mountain Sunrise

I stayed at the Lakeside Village at Keystone Lake. My body was still on east coast time and I woke up early the next morning so I went for a walk around the lake and I caught a glimpse of the sunrise cascading over the mountain tops.


Sunrise on the mountains

Nikon D80 18-135 mm lens @ 135 mm F5.6 1/200 sec ISO-100.


Sunrise complete

Nikon D80 18-135 mm lens @ 120 mm F5.6 1/320 sec ISO-100.

Snowmobile Trip

Later the second day I went on a Snowmobile trip. That was a lot of fun. It's like a waverunner on the snow.


Snowmobile trip

Nikon D80 18-135 mm lens @ 20 mm F10 1/400 sec ISO-100.


Snowmobilers in waiting

Nikon D80 18-135 mm lens @ 18 mm F8 1/250 sec ISO-100. 


The view from the top

Nikon D80 18-135 mm lens @ 85 mm F6.3 1/640 sec ISO-100.

Fondue Lodge Dinner

On the evening of the second day, there was a Fondue dinner at Der Fondue Chessel. Most of the pictures inside the restaurant were quite dark so I've not posted them.

The Camera and Lens

The camera and lens used in all pictures is a Nikon D80 with the Nikon 18-135 mm lens available at Adorama.

All images and content are Copyright © 2007 Tim Stanley, All Rights Reserved.

Some of the images of the sunrise in the mountains exhibit the falloff or darkened corners that Ken Rockwell mentions in his Nikon 18-135 mm lens review. It gives either a nice effect or not depending on ones preference.

Related Items

How To Get The Optimal Web Page Layout

Feb 14, 2007 by:   Tim Stanley

If you are creating a web site with a consistent layout, there are a few very critical decisions that you must make now. If you don't make them correctly, and you want to change the layout in the future, you'll likely have to modify the design on all the pages on your web site.

Experience teaches you which decisions you have to make now that matter and which decisions you can postpone. This article shares some of the experiences I've learned and hopefully how to avoid some of the headaches of having to change the design for all pages on a site.


If you just want the solution and not the reason why I recommend this approach, jump straight to Three Rows: Top, Middle, Bottom.

If you want to see what it looks like before reading all the detail, you can visit the sample layout page.

This article is not about how to utilize a CSS hack for IE 6, IE7, Firefox or other browsers, but how to create a html layout that has some longevity and that a designer can decide how best to utilize CSS hacks or not. After reading numerous posts, hacks, fixes, and running many experiments and tests in different browsers, this is my opinion on how to avoid a lot of the headaches and aggravation.

Writing is probably the most important tool for human advancement.[8] Word processors allow us to easily create documents and format the fonts into headings and paragraphs. You can e-mail those documents to friends and family and if they have the same word processor viewer, the documents show up basically if not 100% the same as when you created them.

In 2007, even with all the "features" of today's tools, If you want to create simple layouts for web pages, we are stuck in the same state word processor users were in the 1970's.

The layout of a web page or site is an extremely important aspect of the information that is presented. If the layout or font looks unprofessional, people trust the content less. The layout also affects how well people retain the information on a web page.[10]

People who spend their full time jobs creating web sites can't get it right all of the time and when they do get it right, it often breaks when the next version of Internet Explorer or Firefox or another browser is released. Most people in the web design profession know that all browsers don't support the W3C CSS box model[7] the same. Yet, almost in the same breath, they rant when all browsers don't support CSS positioning the same [11].

These layouts break because people expect CSS to solve the positioning and layout problems for them and when it doesn't, the "professionals" result to various workarounds and bugs. These vary from one browser to another and then when the bugs are fixed or altered they cause re-work. Save yourself, and your the companies you help a lot of time, effort, and aggravation and don't use these hacks, quirks, or bugs.

All browsers interpret CSS differently and will therefore behave differently. No one can afford to test all content in all browsers. Settle for the lowest common denominator. If you want to have that level of explicit control over how an item is going to appear when presented to the user, in my opinion, use a Microsoft Word document, and Adobe PDF file or an image.

Simple Layouts

The approach I have taken is to be CSS hack free if possible. Ironically, this might be considered a hack that div sections are used to control the layout. If I choose to utilize a CSS hack or not, I need to have the foundation in place in the HTML content in order to do so. This solution I believe allows flexibility down the road for layout irrespective of which (if any) CSS tricks or hacks are used.

This approach also lends itself to template based solutions (i.e. #includes, ASPX, PHP, etc.). I do recommend that an external style sheet be use for CSS.

The concept utilized is very similar to Russian stacking dolls. All sections exist within another.

Simple layout guidelines.

  1. Use a container for all the sections.
  2. Use Three rows for content: Top, Middle, Bottom
  3. Make each row 100% of the width of the container
  4. Use a Middle row with an inner and outer section 
  5. Use Three columns for the middle row inner section: Left, Center, Right
  6. Make the sum of the widths of the columns 100% of the width of the container

In some sites or applications, not all rows or columns are visible. Even if the left and right sections are not going to be visible, I like to plan on the ability to add the future content in without having to redesign the content of the page and I believe this lays down a good foundation.

Three Rows: Top Middle, Bottom

Most professional web site developers seem to agree that the use of tables to build a layout is a bad idea at this point in time with the current tools and technology. It's a lot of work, and if you want to change something, it's a lot of rework.

The premise of my approach is that a container is created and within it three rows are used. The main container in some respects is redundant for the body element. I've included it because some hacks want a larger container to manipulate the CSS.

Each row can be subdivided into further rows if needed. A layout of what this looks like on a web page is shown on the left.

The content for the rows is created in three simple div sections all within a section. Each section appears on each page in the order listed.

  • PanelContainer - The outer wrapper for the entire contents
  • PanelTop - The top most section. This may be divided into further rows (i.e. PanelBanner, PanelTop).
  • PanelMiddle
  • PanelFooter - The bottom most section. This may be divided into further rows.

The XHTML for the Container three rows is shown below.

<div class="PanelContainer">
   <div class="PanelTop">
   <div class="PanelMiddle">
   <div class="PanelFooter">

Three Columns: Left, Middle, Right

3 Row Layout


Within the PanelMiddleOuter section, another PanelMiddleInner section and then within that, three columns are created in div sections similar to the rows created earlier. The PanelMiddleInner section is to allow some hacks which utilize an inner section within a section to resolve the IE min-width problem [13].

The key concept in this example is that these three columns are all within the center (PanelMiddleOuter row. If this looks remarkably like a table, your right and that's part of what forces the browser to display it correctly.

These three sections have two key attributes. First they have the float: right CSS property. Second they are set with the width property so that each of the three sections are divided so that they utilize 100% of the width.

If you have looked at the layout, you'll notice that the columns are not all equal length. If you want them all equal length, you have two choices. Use a CSS hack [3][5], or use a javascript. My experience is that the java script is likely going to stand the test of time better than the CSS hack, but in general, I don't like java scripts because of the dreaded unknown java script error (80% of sites I see have them, they just don't seem to know it). Turn on display notification about every script error to see them.

  • PanelMiddleInner - An additional full width container inside the PanelMiddle section
  • PanelLeftRail - The left section usually for menus or news
  • PanelCenterRail
  • PanelRightRail - The right section usually for advertisements, or news

The XHTML for the list of the layout now looks like the following. The indentation is added for clarity.

<div class="PanelContainer">
   <div class="PanelTop">
   <div class="PanelMiddle">
       <div class="PanelMiddleInner">
          <div class="PanelLeftRail">
          <div class="PanelCenterRail">
          <div class="PanelRightRail">
   <div class="PanelFooter">

Layout Styles and Recommendations

3 Column Layout

Given the above "content" layout, one can then style the page as desired. I use the following guides.

Disclaimer: Everyone that knows and has experience with CSS is going to have an opinion on this approach. Most people invest so much time into this it's usually a strong emotional opinion. I don't intend to sway anyone from their current position. I do hope that I can save some folks a lot of time and aggravation by giving an example that is simple and will allow future "tweaking" as they may see fit.

I use a fixed width centered layout. Most studies show a flow layout is preferred by most users so they can adjust their layout to the width desired. However, due to Internet Explorer bugs, IE doesn't support a minimum width CSS value properly without applying some CSS hacks. Therefore, when the flow layout is used and it is collapsed sufficiently small enough width wise, the page collapses on itself in a horrible an unreadable manner. Good designers have workarounds or hacks. Good designers spend a lot of time on this problem in all the different browsers. Every designer rants when the next browser breaks their hacks. This is the whole point of this article. Don't use the hacks.

I've decided to simplify my pages and just go with a fixed width layout. There is only one line of difference in the body section in my simple layout between a flow layout and a fixed width layout.

Fixed Width width: 760px;
Flow Layout width: 100%;
  1. I use center text with a fixed width of 600px. Studies I have seen prefer Flow layout, then fixed centered, then least of all left centered.
  2. I use a font-family as follows: Calibri, Verdana, Arial, Sans-Serif. Studies I have seen show that these fonts are viewed as "most" professional.
  3. I use a font-size in ems, not px.; The use of an em font size allows the viewer to resize the page if they need a larger font.
  4. I use a min-width: 500px; and a width: 600px on the body.
  5. I use width: 100% on the main three rows (or all rows if there are more).
  6. I use a width of 60% on the PanelCenterRail and 20% on the PanelLeftRail and PanelRightRail.


Related Items

How To Restore A SQL User After a SQL Database Restore

Jul 12, 2006 by:   Tim Stanley

You backed up your Microsoft SQL Database and restored it on another system, but the user id's you've used before can not access the database.  This article is a summary of how to quickly configure the SQL Server database so that your previous user id's can access the database properly.

Why Does This Happen?

When transferring a database to a new server using backup and restore or when detaching and re-attaching the database, the links for the database users are broken. The SQL User information stored in the "master" database in the original server is usually not moved. This information lives in the "syslogins" table in the master database.

Find The Missing Users

Unless you already know the all the user id's, you'll need to find which ones are missing.

EXEC sp_change_users_login 'Report'

Create The User Account

To automatically create and restore the SQL User Account:

EXEC sp_change_users_login 'Auto_Fix', 'UserName', NULL, 'password' 

To create the SQL User Account (you'll need to restore the SQL user in the next step):


Restore The SQL User

To restore the SQL User Account:

EXEC sp_change_users_login 'Update_One', 'UserName', 'NewUserName' 


Related Items