May 2003 - Posts - Jon Galloway

May 2003 - Posts

More VS.NET wishes

Here are some of my wishes for VS.NET:

(disclaimer - I'm stuck in 1.0 - some of these wishes may have been preemptively granted)

WebConfig editor - If there's one program on planet earth that should know WebConfig (and AppConfig, MachineConfig, etc.) files, it's VS.NET, right? When I edit a config file, I'd like a nice designer or interface that helps me set the configuration settings.

Open in existing window - Opening an XML, HTML, or ASP file (anything that's not part of a project) is always a surprise. Will it use the existing instance of VS, or open in a new one? I'd like it to be consistent, and maybe add a command shell option to open in a new window. I know I'd prefer to have one instance of the environment open at a time. (Note: Roy Osherove has written a little registry helper for this -

XML editor - The XML editor is okay, but it's got a while to go to get anywhere near XML Spy for usability. I'd like to collapse nodes (like I can with a #region, or even when I view XML in IE), and the DataView often can't display for valid XML. The XSL editor currently does little more than color code - the XML Spy integration between XSL and XML shows how far this can go - if you associate XML with XSL, you can render it to an output window on the fly. Since XML is so central to .NET (and Web Services, which .NET exists to create ), VS.NET needs to be a whiz with XML.

Webform User Controls - User Controls need to render (especially since they do in WebMatrix), and double-clicking should take me to the ascx for that control.

Webform DataGrids in Design View - If you use any controls in a datagrid, you can't select them in the designer. Clicking anywhere on the datagrid selects the datagrid. That means I can't (easily) use the property editor for these controls, and I usually end up creating them outside the datagrid and then moving them in the HTML view.

Members Dropdown Sorting - In Code View, the Members dropdown should be sorted in alpha order, or this should at least be an option.

RESX Reduction - ASPX files don't all need .resx files, do they? Many websites have hundreds of pages - a site I help maintain has over 5000 ASP pages (yes, it needs some rearchitecting). If this was .NET, we'd have 15000+ (including the CS and RESX files). An extra, usually unused file per page adds to the source control workload. What about only creating these when necessary?

Paste as HTML - Nice feature, but it would be nice if it guessed what I wanted (if I'm in HTML mode on an HTML file, I probably want to paste as HTML). If not, how about a key shortcut? I know I can set up a key binding, but this should be better out of the box.

Event Stubs - Creating the event stub code for a control event takes some monkey business - go to properties, click on the lightning bolt, select the event, double click. Event stubs would be nice to add to the right click context menu for controls - add an "Events >" menu item, which expands to the available events. This is one area that VB handled nicely (although in a different way).

SQL Editor / Ad-Hoc Querying - I appreciate the SQL integration right off the Server Explorer. I hope this gets more like the Query Analyzer than the Enterprise Manager. Three features I'd like here: (1) Ability to run queries against a server without creating a new stored procedure file (2) Auto-complete (3 - dreaming here) a "SQL Scratchpad". Almost all applications modify data, so unit testing requires checking the data, running ad-hoc queries, etc. It'd be great to do this in my _Integrated_ Development Environment without having to open up Query Analyzer. How great would it be if the scratchpad(s) got saved to temp files that would be persistent across reboots, etc? If not in VS, then how about in QA? Anyone else want this? Just me? Okay.

Bug Fix - AutoHide windows won't come back out - I've had this happen with my Properties window several times and have to delete my suo file to get it back. I'm still running 1.0 - has this been fixed in 1.1? (Note - Phil Weber pointed me to;EN-US;q313899 - this is a know bug and has been fixed in VS 2003. There are workarounds for VS 1.0).

My wish-list for the next Visual Studio.NET release

I'm now working for a week or so with VS.NET 2003 and it has some neat features that version 2002 didn't have which are, well, neat to have, but also started me thinking why they are implemented the way they are and why there is so much ground left untouched. Below I've formulated some wishes for the next version of Visual Studio.NET (2004?), and as with every wish-list, I hope the wishes come true, or better: what's wished for is a bad example of a short sighted vision of how reality should be and the next version of VS.NET (2004?) will prove that


Posted by Jon Galloway | with no comments
Filed under:

And if you have one of those, you may need one of these...

Cigarette Lighter

"Need a light?? Here you go. You'll only find this item here at! Basically, this is a car cigarette lighter kit which has been adapted to be used in a PC's 5 1/4 bay. " - saw the link on, which has started back up after a two year hiatus.

Pocket PC keeps tabs on smoke

A device that allows people to monitor the damage passive smoking is doing to them could add fuel to the debate over whether smoking should be banned in public places.

Posted by Jon Galloway | with no comments

Tip - Find / Replace with RegEx Capture Groups

Find / replace with regular expression capture groups can be very powerful.

I needed to do a find replace that reused a portion of the find string in the replace - more clear in the following example:
<A target="_blank" HREF="(any link)">
Replace with:
<A target="_blank" HREF="(link found above)"><input type="checkbox" value="(link found above)" name="LinkList">

This isn't a simple find replace scenario, since I needed to reference the link twice in the replacement string. I wrote a macro to do this, but there were hundreds of occurrences and the macro was very slow. It turns out that the regex find / replace in VS.NET is perfect for this

Find criteria:
Replace string:
HREF=\1\>\<input type=checkbox value=\1 name=killList\>

The curly braces around the :q tells it to take the quoted string (:q) and put it in a variable. Then you can refer to that variable in the find or replace string as \1. If you use more than one {} group, it will go into \2, \3, etc.

[Listening to: La fredda lama del coltello - Ennio Morricone ]

Posted by Jon Galloway | 3 comment(s)
Filed under:

More votes for CodeSmith

I'd like to second this - CodeSmith is shaping up to be a huge timesaver in the group I work in. The code templates are pretty intuitive once you realize that they're basically just like inline ASPX code, so if you've hacked inline ASP for years you'll be right at home.
We took our favorite collection class code from an existing application and changed it into two templates - a CS template that generates the class and the collection class in one file, and a second template that does the basic SQL SP's. The result is production quality code (providing your object maps pretty close to a table) that is standard throughout the group. This is the easy way to get standards going - when a CodeGen cranks out code that already meets standards, it's pretty easy to keep with them throughout the project. I gave the new templates a test run on a new admin app, and it felt like I was extending an existing application rather than starting from scratch. I just had to hook the datagrid up to the collection and add in validation.
This is an amazing product. It paid back our time investment quickly, and with huge dividends.

With the new version of CodeSmith being released I thought I would explain why it is that we chose to use CodeSmith over the many other code generators available.

When we decided to use a code generation tool to automate some of the more redundant sections of our project we took a look at all of the various code generation tools out there. One problem that I have always had with other code generators is that they force you to use their architecture. For every code generator that I looked at I did not like what I saw in the way of architecture, none of the generators I looked at accommodated for using custom business entities instead of using datasets or passing a reader around. CodeSmith was the only generator I found that really allowed me to completely customize how the code was generated. It took alot more effort to create the templates, but in the end it was the only generator that met all of our requirements, and so far has worked out perfectly.  


[Listening to: Harmony - Blonde Redhead ]

Posted by Jon Galloway | 1 comment(s)
Filed under:

SQL Buddy - Query Analyzer with Intellisense

C# Open source version of SQL Query Analyzer with code completion - If you type in a table name and hit ctrl-space, it has a dropdown with the columns, etc. It's version .68a so they're still adding features, but it's pretty solid.
The guys that are developing this said they welcome criticism and suggestions, so fire away if you have any. My dream feature - save all open query windows to a temp file. I hate rebooting with 12 open windows in QA... Seems like they could be easily dumped into a temp XML file with the connection and SQL text.
Hopefully Yukon will give us this kind of fun built into VS.
Posted by Jon Galloway | with no comments
Filed under:
More Posts