Monthly Archives: October 2006

Mapping Office 2003 commands to Office 2007

A great quote from Scott Hanselman’s blog: “Who moved my cheese?”

He lists some great Flash tools. Pick a feature from the 2003 menus, it’ll show you how to do it in 2007. I can only assume this will prove invaluable at keeping the Tylenol in the bottle.

And I really hate that it resizes your browser window too. Now is there one for Windows Explorer in Vista and Internet Explorer 7?


PostScript is so elegant

Ok, most people don’t code in PostScript. Granted, like SQL, it’s one of those languages that’s usually coded by a program written in another language. But it’s so incredibly elegant!

PostScript is like coding in reverse polish. Put as many parameters as are needed on the stack, then run the function. The answer is on the stack, ready to be the parameter in the next function. Need to move stuff out of the way? ‘exch’-ange arguments.

A google board post led me to the most elegant auto-paging and auto-line-wrap function. The auto-paging is easy: when you’re moving to the next line, if you’ll go off the page, do the show page and new page routines first. The line wrap a bit more complex though. It splits by spaces, compares the length of the first word it got back against the right margin minus the current point, and decides if it needs to line wrap before printing this word. Then it displays the space. The elegant part? Argument 2 of the split function’s return value is “the rest”. Called in a loop, it cycles through all the words on a page, line-breaking as needed.

I posted the gory details here:

% Is the word too long for the space on the line?
/toofar? {dup stringwidth pop currentpoint pop add RM gt} bind def
% Show a word, line wrap if needed
/showword {toofar? {L} if show} def
% Show text, line wrap if needed
% in a loop, break by spaces, and print each word.
% If there isn’t a space left, be done.
/S { {( ) search exch showword not {exit} if show} loop} def

(L is the “go to next line” function, RM is the right margin var.)

On Windows, I ran it though Ghostscript on huge documents with no difference. On Unix though, it dogged the Ghostscript engine to death. (My awk script ran like a dream though.)


Subversion Rocks!

I’ve long been a fan of CVS. I’ve used CVSNT and TortoiseCVS for ages. It’s a great (and free) way to keep my source code in check. I’ve scripted it on Unix with automated build and deploy scenarios. I’ve saved my bacon more than once with it in Windows when I got down a coded road that just didn’t work out. CVS is cool.

I’ve always wanted to test out Subversion — see how green the grass was on the other side of the fence. Eric Sink’s presentation to the Arizona .NET User’s Group was just the push. In passing, while discussing something else, he mentioned that anyone still using CVS should get onto SVN. Ok, time to make the move.

First step, I signed up to co-present Intro to Subversion at the Desert Code Camp — something about buring the ships in the harbor. It was by far the best move I could’ve chosen.

Next up, I fired up VMware, and created a “subversion sandbox”. I installed Subversion, the Windows Service wrapper, and TortoiseSVN. It was a natural fit from using CVSNT and TortoiseCVS. Ok, versioning folders was a bit weird at first. But TortoiseSVN even played nicely with TortoiseCVS’s hog of the available Windows Icon overlays. (see here.)

Next, I sat with the red book. I think my wife was not overly thrilled when I brought it to bed. It was great reading though. Ok, armed with knowledge from front to back, I was ready to tackle the conversion.

I installed CVSNT, TortoiseCVS, copied my repository onto the VMware session, and made sure it was good.

Next, a few more downloads: cvs2svn, python, the subversion python bindings, WinMerge, the kitchen sink, and some boots. (Actually the cvs2svn docs were great. Though the recipie was long, it was detailed, and effective.) I noted that since I was using CVSNT, I was in “uncharted territory”. I used the –use-cvs option. I also put svn, python, and cvs2svn in my PATH.

Since I work with various clients and various projects, and I didn’t want to flood the repository version number for unrelated content, I decided one repository per project. Splitting it out this way was actually quite easy. I just pointed cvs2svn to the project folder, and pushed go.

The conversion froze at various points with very undescriptive details about what I thought it wasn’t doing. Just when I was to give up, it’d pick right back up with the next step. I lost a few fingernails, but the data was gorgeous.

Once converted, I did some litmus tests: check the files out, are they the same as the ones I’m using for live development? Just about without fail, the crystal reports .rpt files imported as text files, and thus had inconsistant line endings. Off to Google University. A helpful post I’ve since lost pointed me to ‘svn propdel svn:eol-style’. All is now well.

Once WinMerge says the files are good, I copied the subversion repository into the main code production mechanism, copied the checked-out projects into the Visual Studio directories (to get the .svn directories spread everywhere), and it’s running. Ok, I had installed Subversion, TortoiseSVN, and the Windows Service in code production by now.

Quite honestly, the conversion was no big deal. It was more stress and careful planning than anything.

Ok, I’ve got svnserve running via the windows service. I’m working on authentication and authorization. I’ve got the svnserve.conf, passwd, and authz files set just so. I’m not overly thrilled that my password is in plain text in passwd, but I’m on a LAN, and the server is protected. Fine.

Back to the Code Camp presentation. Wendy, the co-presenter is awesome. My zeal for Subversion combined with my presentation experience, and her deep knowledge of the inner-workings of everything combined with her history of open-source and infinite contact network, and we’re a team to be reconded with. During our presentation practice, I start moaning about how I really enjoyed CVSNT’s Windows Authentication mode. She says use Apache to host Subversion, then use some mod_auth_something_or_other. Um, duh. In an instant, the 2×4 between the forehead, the synapses connect, and it makes sense.

Back to the VMware session. I spend Friday night. I start at 8 or so, end at 2 or 3 am. I get Apache installed, configured to port 81, get installed and fired up, modify passwd, authz, and httpd.conf about 800 times, and it’s golden. In hind-sight, I’m sure the magic settings were probably within a character or two the whole time.

But now I’m shouting from the roof tops. I’m dancing a jig. (yeah, at 3 am.) I’ve got Subversion behind Apache, Windows Authentication, TortoiseSVN as a client, a batch file for creating and initializing repositories, and a presentation that just rocks. (Code Camp also went very well, by the way. I only called TortoiseSVN by my formerly well-known TortoiseCVS once.)

Ok, now that I’ve got Subversion up and running, the world opens up: CruiseControl.NET, TRAC, all those SourceForge and Tigris projects I wanted to wander through, but didn’t want to burdeon my bread-and-butter machine, life is gorgeous. Subversion is the bomb.

A few parting thoughts: I told Subversion never to check in these files (Global Ignore Pattern in the first screen of TortoiseSVN’s preferences): */bin */obj .cvsignore *.user *.suo */Debug */Release Other than that, everything is pretty much running out of the box.

I agree with Wendy that a better place to put these is in each repository’s ignore list. But since I’ll likely jump between repositories as often as the clients do, having one global setting — in spite of it being client-side — is nice. Some day, I’ll figure a way to script it into my automated repository creation script…

Some day I may also be brave enough to install Ankh, though I’d really rather see VisualSVN on my machine. Ankh just feels really heavy. If VisualSVN can get overlay icons in the solution window, I’m sold. They track renames and moves in the solution window, but they’re not great at catching the related .designer.cs files. For now, TortoiseSVN is doing just fine.


Desert Code Camp parting thoughts

Desert Code Camp truely rocked. It offered a pot-po-ri of skills, tallents, and contacts. I only wish I could’ve attended more sessions. I came away with a huge laundry list of things I want to investigate, and things I need to do.

As a presenter, I noticed I needed to put my slides online _before_ the sessions, not after. The other thing I noticed: my blog is very empty. I make no promises, but hopefully, more brain seepage will make it’s way here.


Subversion at Desert Code Camp

Desert Code Camp was October 28, 2006. It rocked! Among other things, I co-taught ‘Intro to Subversion’ with Wendy Smoak. It was incredible. I felt somewhat selfish in that I think I learned the most.

For those of you who missed it, it was a great adventure. The main thesis of the presentation was that source control isn’t hard, and you can get Subversion running now.

Wendy has made a really nice online article of screen shots and slides. Check it out here. A PDF of the powerpoint slides is also available here.


Generics at Desert Code Camp

Desert Code Camp was October 28, 2006. It rocked! Among other things, I taught ‘Generics’. In hind-sight, it would’ve been helpful to specify this was .NET Generics. I had quite a few questions on how this applied to Java. Sadly, I haven’t a clue (yet).

For those of you who missed it, it was a great adventure. The main thesis of the presentation included the following points: Generics give you type-safe collections & nullable value types. Using these types gives you compile-time type checking, and performance benefits. Incorporating Generics into new and existing projects is not difficult, and it may just help you get rid of a bunch of ugly code.

Download the slides here. The code we produced was pretty horrid, as far as production code is concerned.


Intro to CSS at Desert Code Camp

Desert Code Camp was October 28, 2006. It rocked! Among other things, I taught ‘Begining CSS’. In hind-sight, I wish I had taught the ‘Advanced CSS’ class too. The class went very well, and many said they learned a lot.

For those of you who missed it, it was a great adventure. The main thesis of the presentation was you can get into CSS at any level you’d like, exploit it’s strengths, and leave the rest. Hopefully, once you’ve got a feel for it, and it becomes a valuable tool, you’ll see more value in incorporating more.

Download the slides and code we created (yes, still has the ugly purple background and green outline) here.

Didn’t get to see the presentation? I’m leading a much more in-depth discussion on CSS — from novice to expert — at the December Arizona .NET Users Group. Check it out on December’s calendar here (when it gets posted).