Saturday, April 11, 2009

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?

Friday, November 14, 2008

Slow Load for Visual Studio

This week my Visual Studio started loading my solutions very slowly. It would take 10 minutes or more just to get everything up and ready. I suspected something network related since there was no real CPU or disk usage occurring.

After some digging, I found this interesting tidbit.

From: Never doubt thy debugger

It was handy finding out where the recent file list was. Mine didn't have network shares, but it did have some projects that had been moved to other directories. I deleted all the entries.

BTW, Visual Studio has to be shut down before the list is cleared. If not, it gets recreated with the in-memory copy when Visual Studio exits.

This helped some projects but not all. I still had one solution that was slow. After a bit, I noticed that a file on a network share was being checked for searches. While working I had dragged a file from a network share into my Visual Studio and didn't close it (I tend to keep a lot of files open at once). Once I closed all my files, things got better.

Monday, November 3, 2008

The Perfect Halloween

No jokes or sarcasm. Last Friday was a perfect Halloween. It was the perfect convergence of elements.

Here in Colorado Springs, Halloween has a weather reputation. It's usually bad. It is often cold and/or windy and if it isn't wet, it probably because it is snowing. I have been out with my daughters in all kinds of inclement weather. (My oldest is a die-hard)

So, the weather was perfect. It was 55-60 degrees, no wind and clear.

However, let's not forget that it was a Friday. No school the next day meant no homework and no strict bed time. The kids could trick-or-treat to their hearts content. And they did.

We had some friends come over. Each of my daughters had trick-or-treat buddies. Therefore there were no fights about taking a little sister.

My kids are in 3 of the 4 trick-or-treater groups. My oldest is a teenager. She wants to go fast and get as many doors as possible while being with friends. No adults, please. My second is in the sweet-spot. As a pre-teen, she went with friends and got a lot of candy. She also got a bonus, a friend she was able stay over for a sleep-over. The youngest got to go till she was tired and her bag was too heavy. She loved the decorations at houses as long as they weren't too scary. Halloween is magic at that age. The fourth group are the little kids that are carried or pushed in strollers. I don't have any of those any more, but I know that that age is all about being cute.

Last week was parent-teacher conferences. The kids were out of school Thursday and Friday. It was like an actual holiday. The kids had time to do all these fun things like decorate the yard and carve a big pumpkin.

My wife dressed up like Palin. She's a natural for it and looked good. She got a lot of comments on her costume. And there were lots of viewers because with the warm weather, everyone was out. She was very happy showing off as she handed out our candy.

After the rounds were all made by the kids they came home for the great trading session. Wall-street at home. This year, everything was sorted into tradeable and not-tradeable. The bartering began and then ended. There were no fights.

And for me? Well, I got chocolate.

Isn't that what truly makes a good holiday? Everyone was happy!