Friday, May 15, 2009

My Model Railroad

I have decided to separate my model railroad blogs into a separate blog called Doorland & Western Railway. This is a big project and I want it self contained and uninterrupted by my other ramblings.

When I started this blog I figured I could just ramble about work, family, and play. However, I see the folly in that. Some folks only want to see specific topics and the posts here are too eclectic. I will probably separate the work stuff as well.

Monday, May 11, 2009

DCC for My Model Railroad

A couple of weeks ago (maybe 3) I got my DCC system. It's made by NCE and is their base radio system (PH Pro 5 Radio). I got it barely used and got a great deal on it. I also got an additional throttle.

First off, it's great. It has so much potential.

I got off to an interesting start. The problem with DCC is that you can't really run a train on it unless the locomotive has a decoder board installed. My locos did not have them. I knew about this, so the day before I was to receive my system, I took my locos to the train store to get decoders for them. The week before I had even ordered a decoder (with sound!). Two of my locos are old. 12 years or so. Back then DCC was out but not so common. There was a possibility that my locos would pull too much current for a decoder. So, I needed them tested and checked out before they got installed. The folks at the store took my three locos after I described what I wanted for each and then found out that they wouldn't be ready for at least a week. Ouch.

The next day, my wonderful new DCC system arrived. I got it all plugged in and ready to go. Wow, it looked cool. And that was it. That was all I could do. I could just look at it. I read through the manual. I guessed how awesome it would be and I waited.

As it turns out, decoder installation isn't completely easy. The guy installing ran into difficulties. At the sight of my obvious disappointment (which involved some whining), he offered to loan me some of his locos in the interim. So I borrowed two.
They were a pair of Atlas Master series locos. One had sound and one didn't. The sound was very cool. I played with that for a bit. The locomotive seemed to have hardly been used.

I would like to take a moment to point out that it ran very smooth. This was my first hands-on experience with a not cheap locomotive. It ran so quietly! I am not going to settle for less any more. When I got my locos back, it just drove that point home. The cheaper locos grind and they take a bit of throttle just to get started.

So, now I have it. A full 5-amp DCC system with two locos and a medium-sized oval... Total overkill, but I hope to remedy that in the not-to-distant future.

BTW, one loco is still in the shop. An old Atlas switcher. Probably the best loco I own (which has never really been used since I got it. Long story for later). However, it doesn't fit an HO decoder and so we need to find an N decoder that can handle HO current.

Saturday, April 11, 2009

Happy Easter

Here it is, Easter Eve, and I am on the computer...

All the festivities are over with and everyone is in bed. We had fun with our eggs, and I thought I would show what I can accomplish with a total lack of artistic ability (but with plenty of enthusiasm).


This is the Santa Fe Super Chief modeled in Egg... I am not sure the scale. But notice the accurate War Bonnet paint scheme and authentic looking Vista Dome car.


I thought the F7A #31A was particularly well done.

There you have it. I really pushed my skills to limit this time. And yes, I have had trains on my mind a lot lately. Everyone around me is about sick of it, so I had to enlarge my audience.

Happy Easter!

Train Spotting

The BNSF Railroad goes through town here. I have watched as locomotives have changed colors and names. Lately, I have thought I should take pictures to preserve this current time. Also, I have become aware of the fact that I seem to see a particular kind of train more than others. Coal. Long coal trains stop beside the highway. I believe they are waiting to unload at the power plant. I always regret not having a camera with me because it would be easy to just snap some nice pictures as the trains sit there.
Today I planned to do just that. Just drive down the highway and take some gorgeous shots of a long coal train just sitting there in all its splendor.
There were certain flaws in my plan... First, the weather was not lovely. Then, when we got down there, the tracks were a bit... trainless. After we had turned around to head back, a train approached, and I finally got my pictures. Here they are:







So... the pictures are terrible. When taking pictures of trains, there are some things that are important. You want to capture the type of car or engine. You want to see the numbers. And you want to see what color scheme they are painted with. My pictures amazingly captured none of that.

I laughed at just how horrible they were. It seemed that I had put a bit of effort into a complete waste. However, I have learned some things.

1. If it's raining, leave the camera at home.
2. Have the camera in your lap ready to take pictures in case the train is moving.
3. When you are in a car on the highway and the train is traveling in the opposite direction and not slowing down, it's probably more important to work on turning the car around.
4. Make sure the camera is set to normal color mode before you start taking pictures.

Anyway, I hope someone else sees the humor in all this.

Thursday, April 9, 2009

Model Railroading and the 0-Budget Layout

I have been meaning to post about this for a while, but just haven't. The context is this: Last year my family moved into a new home. The home included a large unfinished basement (a big selling point for me). My wife and I struck a deal. She could have the upstairs office and I could have the basement.
So, as we were getting ready to close on the house, it occurred to me that I would finally have a place to build a real model train layout.
Since then, I have been somewhat obsessed with trains. Sometimes more than others. In the early time (before we even moved in) certain realities were very clear. Even though I had space, I had no extra cash. All the money was going into the new house. However, I also had some materials left over from fixing up the old house. I also had some old track and some old trains and car. I decided to "make do" and my 0-Budget Layout was born!
I am not going to go into details now, but I have pictures that I would like to post later.
I made some discoveries along the way. The first is that a budget of $0 has not been achieved, but it is still pretty low. Also, I found that my brain did allow me the purchase of some new trains (mostly cars with a new loco for my birthday). That sort of snowballed into buying things to fix up my old stuff. So, I have spent more than I should, but technically, it wasn't on the layout. ;) (rationalization, I know)
I do continue on my quest to build a layout on recycled materials. However, soon I am going to allow myself 1 exception. I am going to purchase a new power system. For those who know, power is expensive and hard to make do with. Plus, I am changing the type of power I am going to use from DC to DCC. This is a big change and an expensive one. It is also what I will be using on the new layout. Plus it has some pretty good gadget value. So, I am going to upgrade power now which totally blows my 0 budget. But there are still many areas to explore and I hope more on this will follow in future posts.

InstallShield Merging Web Sites (Correction)

I found that the redirection in the command line wasn't working correctly. So, I created a DOC batch file to wrap the command line. The InstallScript changes to this:


//---------------------------------------------------------------------------
// GetNextWebSiteNumber
//
// This function returns the next available web site number based on entries
// for current web sites in IIS. The admin script adsutil.vbs is used the
// query current web sites.
// If there is an error, the function returns -1.
//---------------------------------------------------------------------------
function GetNextWebSiteNumber()
NUMBER nResult;
NUMBER nvTempWebSiteNumber;
NUMBER nWebSiteNumber;
NUMBER nvFileHandle;
NUMBER nNumPos;
STRING szProgName;
STRING szProgParams;
STRING szFileDir;
STRING szFileName;
STRING svLine;
STRING svSiteNum;
STRING svNumStr;
begin
nvTempWebSiteNumber = -1;
nWebSiteNumber = nvTempWebSiteNumber;
szFileDir = SUPPORTDIR;
szFileName = "websiteenum.txt";

//
// Run the adsutil.vbs script and get all the web sites. Put the
// output into a file. NOTE - InstallShield doesn't pass the
// redirect through correctly, so the adsutil needs to be called
// from a batch file so the output can be captured.
//
szProgName = WINDIR^"system32\\cmd.exe";
szProgParams = " /c " + SUPPORTDIR^"CmdOutToFile.bat \"" + WINDIR^"system32\\cscript.exe C:\\inetpub\\AdminScripts\\adsutil.vbs ENUM /p W3SVC\" \"" + szFileDir^szFileName + "\"";
StatusBox("Running " + szProgName + szProgParams, DEBUG);
if (LaunchAppAndWait(szProgName, szProgParams, WAIT) >= 0) then
//
// Open the file with the web sites and find the number
// of the last one.
//
OpenFileMode(FILE_MODE_NORMAL);
nResult = OpenFile (nvFileHandle, szFileDir, szFileName);
if (nResult = 0) then
while GetLine (nvFileHandle, svLine) = 0
if (svLine % "W3SVC/") then
StrSub(svSiteNum, svLine, 8, StrLengthChars(svLine) - 9);
StrToNum(nvTempWebSiteNumber, svSiteNum);
if (nvTempWebSiteNumber > nWebSiteNumber) then
nWebSiteNumber = nvTempWebSiteNumber;
endif;
endif;
endwhile;
CloseFile(nvFileHandle);
nWebSiteNumber = nWebSiteNumber + 1;
else
NumToStr(svNumStr, nResult);
StatusBox("Could not open the web site enumeration file " + szFileDir + szFileName + " (Result = " + svNumStr + ")", DEBUG);
endif;
endif;
return (nWebSiteNumber);
end;


Here is the DOS Batch file:

::@echo off
::----------------------------------------------------------------------------
:: CmdOutToFile.bat
::
:: Wrap a command that redirects output to a file. This is to allow the
:: output to be captured when run from a program that doesn't allow this, such
:: as InstallShield.
::
:: Parameters:
:: Parameter 1 = The command to run.
:: Parameter 2 = The file to redirect output to.
::
::----------------------------------------------------------------------------

:: Get the command line
set cmdLine=%1
set outputFile=%2

:: Remove quotes
set cmdLine=%cmdLine:"=%
set outputFile=%outputFile:"=%

:: Run the command
%cmdLine% > %outputFile%


BTW, I noticed that the blogger doesn't scroll horizontally or widen. However, the text is there, so you can copy and paste it into notepad to see it all. I prefer showing it this way as the whitespace is preserved. If I let HTML format it, it strips all that and makes it unpleasant. I will work on finding alternatives.

Tuesday, March 24, 2009

InstallShield Merging Web Sites

I had this problem with my InstallShield project where it was merging my web site into the default web site instead of creating a new web site. This was happening if I was installing the site using port 80 which was also being used by the default web site.

After some research (and help) I found that the problem was caused by the web site number (a value in the IIS config settings in the project). I had set this value to 0 thinking InstallShield would just use the next available web site number. However, this is not so. I don't know why, but if the port was used by another site, it used that site's number. If the port wasn't in use, it would used the next number. As far as I know, there isn't a mechanism to use the next available. So, I wrote a function in InstallScript that calls out the the IIS admin script absutil.vbs to get the numbers in use and return the next one.

Here is the function:

//---------------------------------------------------------------------------
// GetNextWebSiteNumber
//
// Author: Yevi
//
// Description: This function returns the next available web site number based
// on entries for current web sites in IIS. The admin script adsutil.vbs is
// used the query current web sites.
// If there is an error, the function returns -1.
//---------------------------------------------------------------------------
function GetNextWebSiteNumber()
NUMBER nResult;
NUMBER nvTempWebSiteNumber;
NUMBER nWebSiteNumber;
NUMBER nvFileHandle;
NUMBER nNumPos;
STRING szProgName;
STRING szProgParams;
STRING szFileDir;
STRING szFileName;
STRING svLine;
STRING svSiteNum;
begin
nvTempWebSiteNumber = -1;
nWebSiteNumber = nvTempWebSiteNumber;
szFileDir = SUPPORTDIR;
szFileName = "websiteenum.txt";

// Run the adsutil.vbs script and get all the web sites. Put the
// output into a file.
szProgName = WINDIR^"system32\\cscript.exe";
szProgParams = " C:\\inetpub\\AdminScripts\adsutil.vbs ENUM /p W3SVC > " + szFileDir^szFileName;
if (LaunchAppAndWait(szProgName, szProgParams, WAIT) >= 0) then

// Open the file with the web sites and find the number
// of the last one.
OpenFileMode(FILE_MODE_NORMAL);
if (!OpenFile (nvFileHandle, szFileDir, szFileName) < 0) then
while GetLine (nvFileHandle, svLine) = 0
if (svLine % "W3SVC/") then
nNumPos = StrFind(svLine, "/");
StrSub(svSiteNum, svLine, nNumPos, 10);
StrToNum(nvTempWebSiteNumber, svSiteNum);
if (nvTempWebSiteNumber > nWebSiteNumber) then
nWebSiteNumber = nvTempWebSiteNumber;
endif;
endif;
endwhile;
CloseFile(nvFileHandle);
nWebSiteNumber = nWebSiteNumber + 1;
endif;
endif;
return (nWebSiteNumber);
end;


Hopefully this will save you time and pain.

*EDIT* This doesn't quite work. Look for the posted correction.