Thursday, July 04, 2002

I bought myself a birthday present last week, it arrived this week: 2 new books.  First, The Little SchemerPatrick Logan's presentation at the last DevCon inspired me to look into Scheme, so I'm trying to learn a little.  It's an interesting format, just a set of questions and answers.  You don't always know the answers, so you learn by reading the answer and reviewing the question.  Slow going though, they start at a very basic level.

The 2nd book is How To Solve It: Modern Heuristics.  I saw a reference to this on Jason Bock's weblog and it looked interesting.  I don't know if I'll plow through it or just graze, this seems like the kind of book for occaisional reading.  We'll see...

3:57:23 PM  permalink Click here to send an email to the editor of this weblog. 

John Lam had a couple articles on getting build numbers into NAnt driven builds.  I was out on vacation when these pieces went up and missed them, I wish I hadn't because I had to roll my own solution when I got back.  I came up with something different than John, a semi-clever trick using Source Safe and labels. 

First of all, our build system is driven by batch files, not NAnt.  This is evil, for reasons I've already gone into, but that's going to change Real Soon Now.  What I came up with is a mix of Perl and command line source safe.

The problem I've always had with version info is persisting the last version.  Typically, people use a static file that gets checked into version control, but somehow this has always seemed the ugly way to do it.  It occured to me that if the labels in Source Safe were used as version markers, I wouldn't have to maintain a separate file, just ask SS for the last label, parse out the version, increment the build number, and go.  This has the additional advantage that you can ask SS to get a project by label, so it makes it pretty easy to get a specific version of a project.  So I came up with the following command line ($/Project is the name of the project in source safe):

ss.exe History $/Project -L -#1 | 
perl.exe buildstamp.pl | 
ss.exe Label $/Project 

What this does is get the history for the project, asking for labels only, and only the last label, then feeds that output to perl, which parses out the version information from the history output, increments the build number, and prints it to stdout, then that feeds back into SS, which re-labels the source with the new label.  buildstamp.pl looks like this (no snickering, all you perl hackers!):

while (<>) {
    if (/(d+).(d+).(d+).(d+)/) {
        printf("%d.%d.%d.0\n\n",$1,$2,$3+1);
        exit 0;
    }
}
print "1.0.0.0\n\n";

You can see that it reads lines until it finds something that looks like a version label, then prints that out with the build number incremented and the revision fixed at 0.  If it never finds a match, then it prints 1.0.0.0. 

So far, this has worked pretty well.  One additonal step that I added is to check out the AssemblyInfo.cs files and write the new build number into the AssemblyVersion attribute, so that when I compile, the version is set properly on the assembly.  Checking out individual files across the project tree is a pain do do with SS in a batch file, you can't just say "checkout AssemblyInfo.cs recursively".  Basically what I found was that the easiest thing to do was to check out the entire project and call a perl script that searches recursively for AssemblyInfo.cs and fixes up the version in all of them.  This works because you can set SS to simply ignore checkins with no changes, effectively doing an undo if the file's not modified, but this is really sloppy and slow on big project trees.  This will probably be easier to do cleanly in NAnt, but I need to research that.

This system has worked well so far; I save having to check in a text file with the version and I get to leverage the label facility if I need to go back and build a previous version.  Probably the main change is that the revision number needs to be set using one of the techniqes John outlined.  I plan on rewriting this build in NAnt, when I do, I'll look into John's version task and see how I like it.

3:21:56 PM  permalink Click here to send an email to the editor of this weblog. 

Meltdowns at Enron and WorldCom. Yesterday a board revolt at Vivendi, a media company, and the CEO is toast. What happens when one of the owners of one of the major TV networks becomes the target of a business scandal. Viacom, Disney, GE, AOL. Who will be first to go down? But will the reporters go there? Heh. [Scripting News]

I think that Dave might be asking a bit much here.  There were people raising red flags on many of these recent scandals way before they became public, but they want to be paid for doing it.  There's various newsletters out there that you can subscribe to.  Certain writers at realmoney.com have been on the ball.  Now I know a lot of people dislike James Cramer, but Herb Greenberg, Arne Aslin, Bill Fleckenstein, et. al. have been all over this.  I remember Arne Aslin going off on Tyco months ago.  It's hard work figuring out when things like this are going on, but some people can do it.  Basically, you have to know how to read a balance sheet and know where accountants like to hide things.  There's a relatively small group of people who can do this well, and they want to be paid well.  Not unreasonable, considering that it is money at stake.  It would be pretty disingenuous of me to ask for people to give me this information for free and then turn around and trade off of it.

Ironically, I cancelled my subscription to Real Money today.  I just can't justify $200 a year for it.  Back when I used to trade more (when even an idiot like me could make money at it), it was worth it.  The one thing that Real Money taught me is that it takes a certain set of skills and interests to be good at financial analysis.  That's not where my strengths are. 

But this brings up another point: who do you turn to for this kind of advice?  Right now, I manage my own investments.  I've picked a few mutual funds based upon the managers of the funds (you buy a mutual fund because of who's managing it, not because it had a spectacular year 4 years ago).  But you have to hold whoever's managing accountable for this to work.  I saw an article in the Denver Post a couple Sundays ago where this guy who runs a mutual fund and sits on the board of a public company as well.  He claimed that he gets a dozen letters a year from that company's shareholders, but never received a single letter from his fund's shareholders.  No wonder this crisis has happened; the biggest shareholders' aren't being held accountable.  Why should they hold the corporate boards accountable? 

10:26:23 AM  permalink Click here to send an email to the editor of this weblog. 


Stories
DateTitle
1/23/2003 Why XML?
8/13/2002 Resolution for IE and Windows problems
8/10/2002 Supporting VS.NET and NAnt
5/11/2002 When do you stop unit testing?
Contact
jabber: weakliem
YM: gweakliem
MSN: gweakliem@pcisys.net
email: Click here to send an email to the editor of this weblog.
Subscribe to "Gordon Weakliem's Weblog" in Radio UserLand.
Click to see the XML version of this web page.