« January 2006 | Main | April 2006 »

February 27, 2006

Removing PromptChar on Infragistics' cell based editing

If you are using Infragistics' UltraWinGrid and trying to fiddle with the cell based editor, you'll quickly find out that you can't remove the annoying default PromptChar ('_'). I don't know what the standard is in the US but here in Australia we never use that '_'.

So if you're thinking to use UltraMaskedEdit and remove the PromptChar you'll be sorely disappointed because it doesn't work. The trick is to set both the UltraMaskedEdit's PromptChar and the grid's column's PromptChar to '_'. Thanks to Infragistic's tech support, I probably wouldn't have found this solution myself.

For example:



ultraGrid1.DisplayLayout.Bands[0].Columns[0].PromptChar=' ';


and



            this.ultraMaskedEdit1.Name = "ultraMaskedEdit1";


            this.ultraMaskedEdit1.PromptChar = ' ';



Posted by vhadiant at 08:04 AM | Comments (0) | TrackBack

February 06, 2006

CodeStriker with Visual Source Safe

I'm checking out the latest version of CodeStriker to see if it's suitable for my current project. It's a really good, no frills, but working really well code review tool. I've used it extensively before, David - CodeStriker's author - and I used to work at the same company. Of course, CodeStriker back then was vastly different with the current incarnation.

Setting it up in my Dell 610 work laptop is painless. I already have IIS and MS SQL Server setup, Perl was the only missing component. The default Perl package from Active State is missing 2 mandatory packages that CodeStriker wants. PPM pretty much solved this problem.

CodeStriker's documentation is good, although you have to at least know what you're doing to be able to get CodeStriker up and running. I guess that's fair enough, I don't think CodeStriker is geared toward the "for dummies" crowd.

The user interface has changed a lot since the early days of CodeStriker and it uses [gasp]database[/gasp] to store its topic. I remember back then David was adamant that he's not going to add DB support :) Enough user requests must have changed his stand on this.

CodeStriker was never meant to be used with Source Safe, so to create the "topic" (the code review) you have to use the ssdiff.pl script. This script is working good enough but there's one problem.

ssdiff.pl wants you to supply the VSS project name. That's fair enough, but most of our developers don't work across area of the system. In fact most of us work in our little components deep inside the source trunk. For example, the project that we are working is $/MyProject. This project has really deep tree structure, many directories from the top project tree. To run ssdiff.pl from the top directory will take too long. I want to be able to cd to my directory and run ssdiff.pl from that directory. Unfortunately I have to modify the parameter to ssdiff.pl to reflect the project that I'm currently on.

This sucks, so I modified ssdiff.pl to supply a "working directory" (a Source Safe concept) and automatically parse the current directory and append it to the working directory to create the project.

For example: the top project is "$/MyProject" and the "working directory" of this project is in C:\Company\Current\Code. Thus when I cd to the directory "C:\Company\Current\Code\DataAccess\Component1\Code", it will automatically parse this and create a string "$/MyProject/DataAccess/Component1/Code" as the VSS project. This modification is very simple even for me who don't know anything about perl.

Add this in the configuration section:
my $working_dir = 'C:/Company/Code';
my $base_vss = '$';

Add this after the "use strict"; line
use Cwd;

my $dir = getcwd;
my $clean_vss_project = substr($dir, length($working_dir));
my $vss_project = $base_vss . $clean_vss_project;

$ss_project = $vss_project;

And that's it. When you cd to "C:\Company\Current\Code\DataAccess\Component1\Code" and run ssdiff.pl > topic txt it will actually run
ssdiff.pl "$/MyProject/DataAccess/Component1/Code" > topic.txt

One caveat: If you are installing codestriker in Windows 2003 and you found out that you can't run your Perl script, you must enable the "Web Service Extension" for Perl CGI scripts. Open IIS control panel to do this. By default Windows will prohibit the execution.

Posted by vhadiant at 07:34 PM | Comments (0) | TrackBack