Monday, June 22, 2009

Pioneer Trek

This past week I participated in a church activity known as a Pioneer Trek. It is where we gather the youth, dress in pioneer clothes, and pull handcarts on the Wyoming prairie. It gives our youth (and those adults who go along) a chance to get in touch with the early members of our church and some of the things they went through.

It was great! I had a lot of fun.

Here is a picture of me with my Pioneer gear on complete with a mid-nineteenth century beard (yes, it is real and yes it is natural).



We take the youth and divide them into families. Each family has a Ma and a Pa and 6-7 children. My wife and I were a Ma and Pa (I was a Pa...).



The family was issued a handcart and we pulled it on trails with our belongings in it. Our job was to help the kids get the most out of the whole experience and make sure they were where they needed to be.



My wife and I enjoy working with the youth. I don't know if it makes me feel young or they are just a ton of fun. Once again, I was impressed at just how amazing these kids are. I realize they were on their best behavior, but they were all helpful and happy. Everyone pitched in to get things done and I think we all had a good time.

Thursday, June 11, 2009

InstallShield and MsiGetProperty

For a long time I have had a problem with MsiGetProperty in that sometimes it would work and sometimes it wouldn't. I posted about it on the InstallShield forums and got this great piece of information:

MSI properties set during the pre-file transfer events (OnBegin, OnFirstUIBefore, etc.) or set during immediate custom actions will lose their values in post-file transfer events (OnFirstUIAfter, OnEnd, etc.). This is an unintended side-effect due to how InstallScript MSI projects are implemented.

The basic reason for this is the InstallScript engine acts as an external UI handler for the MSI package being installed. In order to interact with Windows Installer, the InstallScript engine opens an installation session through the MsiOpenPackage API. All properties set during pre-file transfer events are backed by this installer session. Just before file-transfer is started, this installer session needs to be closed, otherwise, Windows Installer would be unable to read the MSI package and the install would fail. A consequence of closing the session is any properties set during that session are essentially lost. Properties that are Directory table entries, such as INSTALLDIR, are reinitialized after file-transfer by running the Windows Installer costing actions.

If you need to maintain property values between pre and post file transfer events in InstallScript, global variables should be used in addition to or instead of MSI properties. Properties set during custom actions in the execute sequence would need to be written to a file or registry entries on the machine as there is no way to pass global variables from InstallScript custom actions to InstallScript events.
__________________
Josh Stechnij - Software Engineer - Acresso Software: InstallShield Team

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.

Tuesday, January 20, 2009

Auditioning in Band

Last night I auditioned on a tenor saxophone for the "grown up" band. In the New Horizons band, there are several bands. There are different levels and to be able to play with the higher level bands, you must audition for the conductor. I was auditioning for the Symphonic Band, which is the highest level of the concert bands.

I hate auditioning. I get very nervous. I can play in the band, even in a concert, and be very calm. But if I need to stand out (e.g. solo part or audition one-on-one), I go to pieces. The request is to play something prepared, some scales, and sight-reading (playing a piece of music you have never seen before). I KNEW I would be a wreck. So I did practice my prepared piece and tried to polish it. However, since my life has other things going on, it probably wasn't as well prepared as it could have been, but it was prepared.

For practice, I performed my piece the night before for my family and parents. I fell apart. I found where I had problems in the piece when I wasn't thinking straight and worked hard on those spots that night and before the audition.

Due to other things I wanted to do that night, I took my youngest with me to the audition. This didn't play a major role in the audition, but just as we got started, she popped up above a divider right in my field of view. I explained that she couldn't do that. She disappeared and I continued.

I found that musical theory requires thought. Even after years of training and use, it still requires thought. I found that when I am at the height of anxiety, thinking becomes very difficult. "Are you able to transpose from concert key" "Yes, with a little thought" "Good, what is concert F?" "Uhhhh...." (note the quick well-articulated answer. This is very basic knowledge.) "It's G. Will you please play a G major scale for me?" "Uhhh G? Oh right." I played a G major scale (very easy. very basic) "Play an A-flat major scale for me" "Uhhh..." Blank. A-flat sounded hard. BTW, I had a sheet with all the scales in front of me. This wasn't expected to be all from memory. My eyes were working only a shade better than my brain. "Ok. Now, play an A-minor with a harmonic 7th" "What?" <-- not a well-portrayed level of knowledge with such a statement. He explained. He basically named the notes. I still messed it up. "Ok. Now play your piece for me." I played. It wasn't perfect. However, it was good. The trouble spots flowed. The sound was good. I was expressive. It was a good tempo. A couple of flubs due to nerves. Like having a repeat and going to the wrong place. Once again, neither eyes nor brain were working. However, I sounded like a mature player. Then came sight reading. I knew this would be a problem without eyes or brain. So, I scanned the music a little while asking questions about things I couldn't immediately see like expected tempo. The rhythm was very tricky. I played sloppy, but I kept going. It was ok. I got most of it and it really was not a simple rhythm. "You sight-read well, don't you?" "Yes" I refrained from saying that is a skill you pick up when you don't like to practice :). "Good. Are you available Thursday nights for rehearsals?" "Yes!"

Somehow, he saw through the flubs. Or maybe he needs my part in the band.

It's G! Concert F is G!!!! I know that!

How could I not know that?