August 2009

Volume 24 Number 08

Toolbox - Data Snapshots, Subversion, Source Code Organization and More

By Scott Mitchell | August 2009

All prices confirmed at press time and are subject to change. The opinions expressed in this column are solely those of the author and do not necessarily reflect the opinions at Microsoft.


Save, Organize, and Annotate Snapshots of Your Data
Blogs of Note
The Easy Way to Install and Configure Subversion
Automatically Organize Your Source Code

Save, Organize, and Annotate Snapshots of Your Data

Virtually all computer programs allow users to serialize their current working state to a portable, self-contained file, which can then be opened from another computer that has the same software installed. In less formal terms, most programs have a Save option that lets you persist your work to a file. Wouldn't it be nice if such functionality were possible with database queries? Imagine if you could run one or more SELECT statements and then save the resultsets to a file. Such files could be used to store and review historical data, to serve as a "before" snapshot of data before performing a bulk modification, and to allow testers, analysts, and other stakeholders the ability to view a precise set of data without needing access to the database.

SQL Sets version 1.5 is an ingenious piece of software that brings such functionality to the database world. SQL Sets has three primary use cases: storing the results of one or more queries into a portable data document file, or "set"; viewing, organizing, and annotating the data stored in a set; and comparing the data between two sets. A set is stored on disk as a self-contained, static, read-only snapshot of data at a specific point in time. It stores the raw data and has no dependency on the database. This means that sets can be moved to other computers, viewed, and shared among team members without having to grant anyone access to the database.

Creating a set file is a breeze. Launch the SQL Sets application, connect to the database that contains the data of interest, and specify the query (or queries) whose data you want to capture. You can write these queries yourself or have SQL Sets build them for you by selecting one or more tables from the Connection Explorer window. Once the queries have been specified, click the Save icon to save the data returned from the queries to a set file.

When you view a set, its data is displayed in a grid that supports sorting, filtering, and grouping by column. Rows can be bookmarked for quick access and annotated to include notes or other information about the row. All of these features are available through pointing and clicking. Also, the person viewing the set does not need to be familiar with SQL syntax. What's more, with the click of a button you can export the set's data to Microsoft Excel or to HTML. There's also an Export to ADO.NET DataSet option, which translates the set's schema and data into an XML serialized ADO.NET DataSet that you can use in a .NET application.

SQL Sets also allows you to compare two sets. Start by selecting the two set files to compare, then indicate whether to show only rows that are the same in both, rows that are different, rows that are in one set but not the other, or any combination thereof. SQL Sets then loads the data and clearly highlights those rows with differences.

SQL Sets makes it remarkably easy to take snapshots of database data and to allow team members to review, sort, filter, group, bookmark, and annotate the snapshot data. These snapshots can also serve as archived data or as "before" and "after" snapshots when performing a bulk modification.

Price: $149


SQL Sets

Blogs of Note

At MIX09, Microsoft released ASP.NET MVC version 1.0, a framework for creating ASP.NET Web applications using a Model-View-Controller pattern. ASP.NET MVC offers developers precise control over the markup emitted from Web pages; a much cleaner separation of presentation and business logic concerns; better testability; and human-readable, terse, SEO-friendly URLs. Moving from the ASP.NET Web Forms model to ASP.NET MVC requires a shift in thinking and problem solving. Web Forms allow ASP.NET developers to almost forget about the client/server nature of the Web and to think of HTML, JavaScript, and CSS as low-level details that are abstracted away. ASP.NET MVC puts the distinction between the client and the server into sharp focus and requires a working knowledge of HTML and client-side script.

Developers who are interested in learning or are currently using ASP.NET MVC should check out the tips, tutorials, and sample chapters available on Stephen Walther's Blog. There you'll find more than 50 tips on ASP.NET MVC. Each tip shows how to perform a very specific task and provides step-by-step instructions with detailed code snippets and screen shots. For example, Tip #41 is titled, "Create Cascading Drop-Down Lists with Ajax," and walks through three different ways to create such lists in an ASP.NET MVC application.

Stephen's blog also includes a number of end-to-end tutorials that illustrate how to create a particular type of application using ASP.NET MVC. For instance, there's a six-part tutorial on building an online message board application and a five-part tutorial on creating a family video Web site. The blog is also home to the rough drafts of chapters from Stephen's book, ASP.NET MVC Framework Unleashed, forthcoming from Sams.

In addition to maintaining his blog, Stephen also writes many of the tutorials and How-To videos for ASP.NET MVC on the official ASP.NET Web site,

Price: Free


Stephen Walther’s Blog

The Easy Way to Install and Configure Subversion

Regardless of how many developers are employed, every company that creates software should be using source control. Over the years, I've helped a number of independent consultants and small companies set up and configure source control systems. The first step is selecting which source control system to use. There are a variety of free and commercial source control systems available; Wikipedia lists more than 50 offerings in its "List of revision control software" entry. One of the more popular source control systems is Subversion, a free, open-source option that was first released in 2000. Subversion has a strong online community and is the source control system of choice for many open-source projects. It is also a popular source control system within the enterprise.

Although installing, configuring, and managing Subversion is not rocket science, these processes are not the most intuitive or user-friendly, either. For instance, in order to access Subversion through HTTP, you need to also install and configure the Apache Web server. Creating user accounts involves editing a particular text file. And because Subversion lacks a graphical user interface, much of the configuration and maintenance must be done from the command line. The good news is that installing, configuring, and managing Subversion is a breeze with VisualSVN Server version 1.7.1, a free product from the same company that makes VisualSVN, a Visual Studio plug-in that integrates source control through Subversion into the Visual Studio IDE. (VisualSVN was reviewed in the 2008 Launch issue.)

With VisualSVN Server, there's no need to download and install Subversion and Apache, or to interface with Subversion through the command line or to tinker with its configuration files. Installing VisualSVN Server automatically installs the latest versions of Subversion and Apache for you. During the installation process, you are prompted for key Subversion and Apache settings, such as the location where Subversion should store its repositories, what port it should use, whether to support secure HTTPS connections, and whether authentication should be handled by Subversion or Windows. VisualSVN Server then applies these settings to the Subversion and Apache configurations on your behalf.

Once it is installed, use the VisualSVN Server Manager to view and manage repositories, users, and groups. With a few clicks of the mouse, you can create new repositories, manage users, specify permissions and other security settings, and manage the files in a repository. Without VisualSVN Server, these tasks would have to be done from the command line or by modifying configuration files. VisualSVN Server also offers a graphical interface for specifying hooks, which are programs that run in response to certain source control events, such as check-in and check-out. And because VisualSVN Server installs and configures Apache, you can view the contents of repositories from your Web browser and access the repository and check in items over the Internet.

If you plan to install Subversion in a Windows environment, there's no reason not to use VisualSVN. It greatly simplifies installing and managing Subversion and is available for free.

Price: Free


VisualSVN Server

Automatically Organize Your Source Code

Code refactoring, or "cleaning up" code, can greatly improve the readability and understandability of the source code, thereby making the application more maintainable and updatable. Some changes, such as renaming a variable to a more fitting name or moving a block of code into a new function, make the code easier to understand. Other changes, such as adding white space or rearranging the methods in a file so that they are in alphabetical order, make the code easier to read.

Manually refactoring code can be a tedious process. Fortunately, there are tools to help automate many common refactoring tasks. For instance, Visual Studio has a Refactor menu that offers one-click access to common refactoring tasks. Another useful tool is NArrange (version 0.2.7), which automatically organizes C# and Visual Basic source code into a more readable format. NArrange can be run from the command line or from within Visual Studio to arrange a single file, all code files in a specified directory, or all code files in a Visual Studio Project or Solution. When invoked, NArrange begins by saving a backup of the files that will be modified. Next, it parses each of the specified files, rearranges their contents based on the configuration options, and then writes the rearranged source code back to disk.

By default, NArrange groups constructors, fields, properties, methods, and events into regions and alphabetizes the members within each region. Consecutive blank lines are removed, tabs are converted into spaces, and the using or Import directives within a class file are consolidated and sorted. However, NArrange's formatting and parsing rules can be customized. For example, you can instruct NArrange to not use regions and to not delete consecutive blank lines.

NArrange provides a fast and easy way to organize source code into a much more readable format. Use it to beautify your code or to reformat legacy code you've inherited to make it more readable. NArrange can also be used to ensure a consistent formatting style among developers in a team setting.

Price: Free, open source

Send your questions and comments for Scott to

Scott Mitchell, author of numerous books and founder of, is an MVP who has been working with Microsoft Web technologies since 1998. Scott is an independent consultant, trainer, and writer. Reach him at or via his blog at ScottOnWriting.NET.