In-Depth
.NET Toolbox Picks
Five utilities and widgets distributed by Microsoft for .NET programmers.
Experienced programmers recognize the importance of supplementing the development environment with useful utilities that provide extra support as well as broaden our capabilities.
They have various uses -- some are generic, while others are more specialized -- but they all tend to be small and either free or inexpensive. Acquiring them can significantly enhance developers' ability to create great applications by boosting productivity and empowering us to better deliver solutions that integrate with .NET and other Microsoft technologies.
We came across 12 such utilities, which all have the potential to serve as valuable additions to your current toolbox (most of the utilities are free, but some of them do cost a nominal amount). In our first installment, we look at five tools distributed by Microsoft. Next issue, we'll look at tools from third parties. The ones we examine in this first installment are XML Notepad 2007, Open XML File Format Code Snippets for Visual Studio 2005, Internet Explorer Developer Toolbar, Windows PowerShell and Process Explorer.
XML Notepad 2007
It's hard to work with .NET and not deal with XML in one form or another, yet the Visual Studio-integrated XML text editor lacks the features developers expect and need for doing serious XML development. You can shell out big bucks for third-party solutions, or you can check out XML Notepad instead.
Using XML Notepad, you treat XML in its native hierarchical fashion. You're not concerned with syntax and special characters like you are when using a flat text editor, and you can instead focus on the structure and content of your elements, nested elements, attributes and inner text through the synchronized Tree and Node Text views. XML Notepad has the professional features you're already accustomed to in Visual Studio -- such as infinite undo/redo, configurable fonts and colors, drag/drop and search/replace -- but provides an environment tailored specifically toward building structured XML content. It also features HTML via XSLT, an XML Difftool and search/replace using incremental, RegEx and XPath methods. IntelliSense, validation and custom data-type editor features are enabled if you associate your XML document with an XSD schema (see Figure 1).
Open XML File Format Code
Snippets for Visual Studio 2005
If you're customizing Excel, PowerPoint or Word, these snippets are ideal for generating the code needed to automate tasks in those Office applications using the Open XML file format newly introduced with Office 2007.
Developers must add the snippets folder for your language (both VB.NET and C# versions are provided), installed beneath My Documents, before you can start using them. Choose "Code Snippets Manager" from the Tools menu (if missing, right-click the menu bar, choose "Customize," click the "Commands" tab, select the "Tools" category and drag Code Snippets Manager to the Tools menu). Click "Add," navigate to My Documents, Visual Studio 2005, Code Snippets, either Visual Basic or C#, and choose "Open XML File Format."
You'll then get instantaneous access to helpful Office automation code snippets right inside the VS code editor. Just right-click and choose "Insert Snippet," "Open XML File Format," and select from the 41 provided Office tasks. To list just a few, developers can delete sheets, export charts, get cell values and insert headers and footers in Excel; remove comments, retrieve the TOC and set the print orientation in Word; and in PowerPoint, delete and reorder slides, get the slide count and modify the title.
Internet Explorer
Developer Toolbar
Anyone who's ever worked with parsing HTML or traversing the browser document object model (DOM) will appreciate this utility for Internet Explorer. After you download and install the .MSI file, you'll need to close any open browser windows in order to start using the toolbar, which delivers a full-fledged Web page analysis tool.
With it, you can quickly discover the structure of the HTML behind every page rendered in the browser. Navigate all the elements and attributes; display all the link paths; view object class names and IDs. Outline various elements in the rendered output, such as table cells and images. An extremely simple yet useful feature for Web developers will immediately resize the browser window for various common resolutions (800x600, 1024x768, etc.). Other handy features include clearing the browser cache, a design ruler for accurate alignment and measurement of objects on the page, link validation and source viewers with HTML/CSS formatting, color coding and expandable/collapsible DOM nodes.
Windows PowerShell
This tool is perfect when you need to script batch files for administration and automation tasks. Windows PowerShell gives you an enhanced command-prompt console, extended with more than 130 "cmdlets" for managing services, processes, event logs, certificates and the registry.
Many of these commands provide functionality similar to that of Windows front-ends, such as the Service Control Manager. For example, "get-service" (or its alias "gsv") retrieves the list of installed services, and you can start, suspend, resume and stop services with the appropriate commands as well. Others allow you to collect and manipulate subsystem settings exposed through Windows Management Instrumentation (WMI) so you can work with printers, perform networking tasks, install or uninstall applications, shut down or reboot, create desktop shortcuts and more.
PowerShell has its own file system, based on what it calls PowerShell Drives. Several of these are created automatically and wrap obvious entities such as your physically installed drives. You also get registry drives (such as HKCU: for HKEY_CURRENT_USER) and a certificate drive (CERT:), which allow you to manipulate these data stores the same way you manage your native file system.
You're not limited to the provided cmdlets. You can also script processes that instantiate COM and .NET objects, storing them in variables and invoking methods on them.
Process Explorer
Process Explorer provides detailed information about the running system, including processes, memory, CPU, I/O, loaded DLLs and file handles. It picks up where Task Manager leaves off, and you can actually use this advanced process-management utility as an alternative to Task Manager by choosing "Replace Task Manager" from the Options menu.
The main window displays the list of running processes in the top panel. You can toggle the contents of the bottom panel to display either the loaded DLLs or open handles associated with the process selected in the top panel. You can also search for processes that have a specific resource allocated, such as a file, directory or registry key. Mini-graphs with a real-time display of CPU, memory and I/O activity appear in the toolbar at the top of the window.
Additional features allow you to set process affinity and priority, as well as suspend, resume, kill or restart selected processes. You can also customize its colors, fonts, opacity, columns, highlighting and more.
About the Author
Leonard Lobel is a principal consultant and Brian Schmitt is VP of software developent at twentysix New York, a Microsoft Gold Certified Partner. Lobel is a software developer who specializes in .NET ; Schmitt has been writing software professionally since 1993.