Brian Schroer

Don't Call Me Mort!

  Home  |   Contact  |   Syndication    |   Login
  30 Posts | 0 Stories | 20 Comments | 10 Trackbacks

News

Tag Cloud


Archives

Post Categories

Links

Saturday, June 14, 2008 #

I wondered a while ago where the "Iron" names came from.

According to a NxtGenUG interview with Michael Foord, John Lam says that IRON can be reverse-engineered to stand for "It Runs On .Net", which is cool, but I finally found the real story in an interview on the "Port 25: The Open Source Community at Microsoft" site, in which IronPython creator Jim Hugunin says:

I'll give you the story, but I'll give you the short version 'cause it's not very good.

At the time, I had a consulting company called "Want of a Nail Software". "Want of a Nail" is based on a children's poem. It's about the importance of small things. I've always kind of believed in the importance of small things. Part of the story of IronPython's actual performance is it wasn't one big thing - Everybody wants to know "What was the one big thing?" There were some big things, but most of it was all the small things - paying attention to performance in every place.

So, that was the consulting company and "Iron" seemed to match.

There were some obvious names: Python.Net, Python#, nPython - All of those were taken. All of the URLs for those were registered.

I didn't want to reuse any of those names, so "Iron" was just kind of a name that appealed to me at a visceral level - I like the feeling of "IronPython".

There's a little bit of "Iron Chef" in it, although I'm always reluctant to admit that.

About the "Python" part: According to the Wikipedia article on Python:

An important goal of the Python developers is making Python fun to use. This is reflected in the origin of the name (based on the television series Monty Python's Flying Circus), in the common practice of using Monty Python references in example code, and in an occasionally playful approach to tutorials and reference materials. For example, the metasyntactic variables often used in Python literature are "spam" and "eggs", instead of the traditional "foo" and "bar".

...and Wikipedia says this about the name "Ruby":

"Ruby" was named as a gemstone because of a joke within Matsumoto's circle of friends alluding to the name of the Perl programming language.

...which led me to the Perl article, where I discovered that it was originally named "Pearl".

 

I think I'll stop now before I digress into a rant about how "C#" is a cool name but J# and X# were doomed to failure not for technical reasons, but for musical ones (unless Microsoft has a much larger piano keyboard than I do).


Thursday, June 12, 2008 #

Congratulations to Carl Franklin and Richard Campbell on the upcoming 350th episode of .NET Rocks!

 I can't tell you how many hours of education & enjoyment DNR has provided me over the years.

 ...Well, actually, I can...

 I discovered the show around episode 10 or so, quickly caught up with the previous shows, and haven't missed one since.

 I added up the show runtimes, and the total is approximately 423 hours, or almost 18 days!

 A lot of people listen to DNR on their commute, and there's enough DNR that you could listen to it the entire time on a 27,000 mile road trip from Vancouver BC to New London CT and back by way of San Diego, Miami, New York City, Bangor, Yakima, Reno, Vegas, and St. Louis.

(Here's the map, if anyone would like to make that trip - Good luck paying for the gas: http://shrinkster.com/z6h)

 


Sunday, June 08, 2008 #

I found Scott Dorman's "Tech·Ed For Novices" post very helpful when planning for Tech·Ed Developers, and wanted to add some tips of my own before I forget what I learned last week. I hope you find them useful if you're going to IT Pros week, or if you're googling next year about planning for Tech·Ed 2009:

Interactive Theater: Get There Early

Scott advised to get there early for Interactive Theater sessions because they fill up quickly. They fill up very quickly. I arrived at 1:30 for a 1:45 Ron Jacobs session to find that the room was already overflowing with people, and the session had already started (Hey, if the room's full, why not?).

The back walls of the theaters are glass, so I hope in the future they'll consider piping the sound to speakers outside the room, so those who couldn't get in can still hear.

Don't Expect To Lounge at the "Wireless Lounge"

...unless your idea of "lounging" is standing in front of a small round table. (It does have plenty of places to plug in, though). If you want to sit down and use your laptop after breakfast and before the sessions start and the Technical Learning Center (TLC) opens, your choices are: staying at the breakfast table, sitting on the floor, or the "Blogger's Lounge", which is not very "loungy" either, but at least it has chairs.

Breakfast & Lunch

The food was... OK. You can get it "to go" if you want to take it to a lunch session, but the "to-go boxes" weren't on all of the buffet tables. You may have to ask someone to help you find one.

Don't Be Afraid to Talk to the "Celebrities"

The Microsoft people and the speakers are there to help you. I asked some pretty stupid questions, and nobody told me to buzz off. I'm a pretty shy guy, but I talked to some big names: Carl Franklin, Richard Campbell, Mark Dunn (guess what's my favorite podcast), Ron Jacobs, Udi Dihan, Daniel Moth, Ron Jacobs, Scott Cate, Glenn Block... and nobody told me to buzz off.

Monday, May 12, 2008 #

Here are the links from my May 12, 2008 presentation at the St. Louis C# User Group:

1. VS 2008 Product Comparison http://shrinkster.com/XH1     VS2008
2. Change startup options http://shrinkster.com/XYD   VS2005 VS2008
3. Change home page http://shrinkster.com/XYD   VS2005 VS2008
4. LINQPad http://shrinkster.com/XGZ     VS2008
5. Importing/Exporting Settings http://shrinkster.com/XZJ VS2003 VS2005 VS2008
6. Consolas font on Windows XP http://shrinkster.com/XQ7 VS2003 VS2005 VS2008
7. Tab groups (code editor windows) http://shrinkster.com/XZK VS2003 VS2005 VS2008
8. line numbering http://shrinkster.com/XZK VS2003 VS2005 VS2008
9. Navigate forward (Ctrl-minus) and backward (Ctrl-plus) http://shrinkster.com/XM8 VS2003 VS2005 VS2008
10. Incremental Search: Ctrl-I http://shrinkster.com/XHC VS2003 VS2005 VS2008
11. Ctrl-Tab to select from open windows http://shrinkster.com/XPW VS2003 VS2005 VS2008
12. Type-ahead in Solution Explorer http://shrinkster.com/XQ4 VS2003 VS2005 VS2008
13. Flat Solution Explorer http://shrinkster.com/XWK   VS2005  
14. Sonic File Finder http://shrinkster.com/XR3   VS2005 VS2008
15. Source Code Outliner http://shrinkster.com/XWJ   VS2005 VS2008
16. Document Outline http://shrinkster.com/XR7   VS2005 VS2008
17. Hide Solution Folders http://shrinkster.com/XQ3   VS2005 VS2008
18. PowerCommands for Visual Studio 2008: Clear All Panes http://shrinkster.com/WI3     VS2008
19. PowerCommands for Visual Studio 2008: Show All Files http://shrinkster.com/WI3     VS2008
20. PowerCommands for Visual Studio 2008: Undo Close http://shrinkster.com/WI3     VS2008
21. PowerCommands for Visual Studio 2008: Open Containing Folder http://shrinkster.com/WI3     VS2008
22. Open in HTML view instead of designer: Tools | Options | HTML Designer | Start pages in… http://shrinkster.com/XZL VS2003 VS2005 VS2008
23. Editor Guidelines http://shrinkster.com/XH2 VS2003 VS2005 VS2008
24. Select Block Text: Alt-Drag http://shrinkster.com/XHB VS2003 VS2005 VS2008
25. Hide Selection: Edit | Advanced | Hide Selection or Ctrl-M, Ctrl-H http://shrinkster.com/XIK VS2003 VS2005 VS2008
26. Select Entire String literal: Double-click to left of opening quote http://shrinkster.com/XWZ VS2003 VS2005 VS2008
27. Ctrl-] - finds matching closing token: }, ), #endregion http://shrinkster.com/XX2 VS2003 VS2005 VS2008
28. Convert to upper (Ctrl-Shift-U) or lower (Ctrl-U) case http://shrinkster.com/XQ8 VS2003 VS2005 VS2008
29. Multi-line Search And Replace http://shrinkster.com/XZ8 VS2003 VS2005 VS2008
30. Transpose: Ctrl-T (character), Ctrl-Shift-T (word), Alt-Shift-T (line) http://shrinkster.com/XIM VS2003 VS2005 VS2008
31. VS2008 C# Keyboard Shortcuts poster http://shrinkster.com/XPQ     VS2008
32. Visual Studio 2008 Keyboard Shortcuts Reference http://shrinkster.com/XYC     VS2008
33. Keyboard Jedi http://shrinkster.com/XWL VS2003 VS2005 VS2008
34. Shift-F10 launches context menu (like right-click) http://shrinkster.com/XX3 VS2003 VS2005 VS2008
35. Toggle between Designer (Shift-F7) and code-behind (F7) http://shrinkster.com/XPV VS2003 VS2005 VS2008
36. Tab to next (F8) / previous (Shift-F8) error http://shrinkster.com/XPY VS2003 VS2005 VS2008
37. Ctrl-F4 closes current document http://shrinkster.com/XQ5 VS2003 VS2005 VS2008
38. Ctrl-. (dot) shows "smart tags" (e.g. add Using) http://shrinkster.com/XY9     VS2008
39. F12: Go to definition http://shrinkster.com/XYH VS2003 VS2005 VS2008
40. Shift-F12 = find all references http://shrinkster.com/XZL VS2003 VS2005 VS2008
41. Comment (Ctrl-K, Ctrl-C) / uncomment (Ctrl-K, Ctrl-U) http://shrinkster.com/XZK VS2003 VS2005 VS2008
42. Format document (Ctrl-K, Ctrl-D) or selection (Ctrl-K, Ctrl-F) http://shrinkster.com/XZK VS2003 VS2005 VS2008
43. Outlining: Collapse All (Ctrl-M, Ctrl-O) / Expand All (Ctrl-M, Ctrl-L) http://shrinkster.com/XZK VS2003 VS2005 VS2008
44. Ctrl-C, Ctrl-X, Ctrl-L, Shift-Delete without selection operate on the current line http://shrinkster.com/XWU VS2003 VS2005 VS2008
45. Drag/Drop code to Toolbox http://shrinkster.com/XH8 VS2003 VS2005 VS2008
46. Clipboard Ring - Ctrl-Shift-V http://shrinkster.com/XHA VS2003 VS2005 VS2008
47. SmartPaster http://shrinkster.com/XR4 VS2003 VS2005 VS2008
48. Code Snippets Manager http://shrinkster.com/XYW   VS2005 VS2008
49. Edit / Create snippets http://shrinkster.com/XYU   VS2005 VS2008
50. GotCodeSnippets.net http://shrinkster.com/XYV   VS2005 VS2008
51. "Export as Code Snippet" Add-In http://shrinkster.com/XYJ     VS2008
52. <code:keep> http://shrinkster.com/XZ4   VS2005 VS2008
53. T4 Code Generation Templates http://shrinkster.com/XR2   VS2005 VS2008
54. T4 Editor http://shrinkster.com/XYT   VS2005 VS2008
55. PowerCommands for Visual Studio 2008: Transform Templates http://shrinkster.com/WI3     VS2008
56. Step into framework code http://shrinkster.com/XYP     VS2008
57. DataTable visualizer http://shrinkster.com/Y0A   VS2005 VS2008
58. Mole http://shrinkster.com/WI7   VS2005 VS2008
59. GhostDoc http://shrinkster.com/XH6 VS2003 VS2005 VS2008
60. Sandcastle: msdn-style documentation builder http://shrinkster.com/XYZ   VS2005 VS2008
61. Sandcastle Help File Builder: nDoc-style GUI http://shrinkster.com/XZ1   VS2005 VS2008
62. Refactor! for ASP.NET: ASP.NET refactorings http://shrinkster.com/XM2   VS2005 VS2008
63. Refactor!: Extract Method http://shrinkster.com/XM2   VS2005 VS2008
64. Refactor!: Extract Property http://shrinkster.com/XM2   VS2005 VS2008
65. Refactor!: Introduce Constant http://shrinkster.com/XM2   VS2005 VS2008
66. Refactor!: Flatten Conditional http://shrinkster.com/XM2   VS2005 VS2008
67. Refactor!: Reverse Conditional http://shrinkster.com/XM2   VS2005 VS2008
68. Refactor!: Create Overload http://shrinkster.com/XM2   VS2005 VS2008
69. Refactor!: Reorder Parameters http://shrinkster.com/XM2   VS2005 VS2008
70. Refactor!: Encapsulate Field http://shrinkster.com/XM2   VS2005 VS2008
71. Ctrl-K, Ctrl-S = "surround with" http://shrinkster.com/XZL VS2003 VS2005 VS2008
72. PowerCommands for Visual Studio 2008: Remove and Sort Usings http://shrinkster.com/WI3     VS2008
73. PowerCommands for Visual Studio 2008: Format Document / Remove & Sort Usings on Save http://shrinkster.com/WI3     VS2008
74. PowerCommands for Visual Studio 2008: Copy / Paste Class http://shrinkster.com/WI3     VS2008
75. PowerCommands for Visual Studio 2008: Copy / Paste References http://shrinkster.com/WI3     VS2008
76. PowerCommands for Visual Studio 2008: Copy as Project Reference http://shrinkster.com/WI3     VS2008
77. Regionerate http://shrinkster.com/XQX   VS2005 VS2008
78. ClearRegions Macro http://shrinkster.com/XYX VS2003 VS2005 VS2008
79. Ctrl-Shift-R: Record Macro http://shrinkster.com/XZK VS2003 VS2005 VS2008
80. TestDriven.net http://shrinkster.com/XR1 VS2003 VS2005 VS2008
81. NUnit For VS http://shrinkster.com/XM3   VS2005 VS2008
82. Go to Reflector - via TestDriven.net add-in http://shrinkster.com/XR1 VS2003 VS2005 VS2008
83. Class Designer http://shrinkster.com/XYE   VS2005 VS2008
84. ModelingPowerToys: Layout toolbar enabled http://shrinkster.com/XYF     VS2008
85. ModelingPowerToys: Floating property grid http://shrinkster.com/XYF     VS2008
86. ModelingPowerToys: Ctrl-Alt-Drag http://shrinkster.com/XYF     VS2008
87. ModelingPowerToys: Export as Image or HTML http://shrinkster.com/XYF     VS2008
88. ModelingPowerToys: Filtering http://shrinkster.com/XYF     VS2008
89. ModelingPowerToys: Thumbnail view http://shrinkster.com/XYF     VS2008
90. StickyNotes http://shrinkster.com/XZB     VS2008
91. Microsoft Robotics Studio http://shrinkster.com/XZC   VS2005 VS2008
92. XNA Game Studio http://shrinkster.com/XZ7     VS2008
93. PowerCommands for Visual Studio 2008: Email Code Snippet http://shrinkster.com/WI3     VS2008
94. ComponentOne IntelliSpell Community Edition http://shrinkster.com/XZ5   VS2005 VS2008
95. OxyProject Metrics http://shrinkster.com/XZA   VS2005 VS2008
96. SlickEdit Gadgets http://shrinkster.com/XZ9   VS2005 VS2008
97. Visual Studio Hacks: The Book http://shrinkster.com/XZ2 VS2003 VS2005 VS2008
98. Visual Studio Hacks: The web site http://shrinkster.com/XZ3 VS2003 VS2005 VS2008
99. Sara Ford\'s Tip of the Day http://shrinkster.com/XPX VS2003 VS2005 VS2008
100. Visual Studio 2008 Developer\'s Center http://shrinkster.com/XYA     VS2008
101. Visual Studio Gallery http://shrinkster.com/XH5   VS2005 VS2008

Sunday, May 11, 2008 #

A while ago, Kyle Baley shared a Visual Studio macro to remove #regions.

I've very much enjoyed using it to clean up overly-regioned code, but it did have one problem: The macro macro used regular expressions to find and replace, and the next time you use the Visual Studio "Find" dialog after running the macro, the "use regular expressions" box is still checked, which can mess up some searches.

I made an update to save the search options, and restore them after the find/replace is complete so that doesn't happen:

' Get rid of regions (but not the enclosed code)
Sub ClearRegions()
    With DTE.Find
        Dim saveTarget As vsFindTarget = .Target
        Dim saveMatchCase As Boolean = .MatchCase
        Dim saveMatchWholeWord As Boolean = .MatchWholeWord
        Dim saveMatchInHiddenText As Boolean = .MatchInHiddenText
        Dim savePatternSyntax As vsFindPatternSyntax = .PatternSyntax

        .Action = vsFindAction.vsFindActionReplaceAll
        .FindWhat = "^:b*\#region.*\n"
        .ReplaceWith = ""
        .Target = vsFindTarget.vsFindTargetCurrentDocument
        .MatchCase = False
        .MatchWholeWord = False
        .MatchInHiddenText = True
        .PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxRegExpr
        .ResultsLocation = vsFindResultsLocation.vsFindResultsNone
        .Action = vsFindAction.vsFindActionReplaceAll

        .Execute()

        .FindWhat = "^:b*\#endregion.*\n"
        .ReplaceWith = ""
        .Target = vsFindTarget.vsFindTargetCurrentDocument
        .MatchCase = False
        .MatchWholeWord = False
        .MatchInHiddenText = True
        .PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxRegExpr
        .ResultsLocation = vsFindResultsLocation.vsFindResultsNone
        .Action = vsFindAction.vsFindActionReplaceAll

        .Execute()

        .Target = saveTarget
        .MatchCase = saveMatchCase
        .MatchWholeWord = saveMatchWholeWord
        .MatchInHiddenText = saveMatchInHiddenText
        .PatternSyntax = savePatternSyntax
    End With
End Sub


Saturday, May 10, 2008 #

Here's a tip that will save you about 7 milliseconds over the course of your programming career...

In Visual Studio, if you double-click to the left of the opening quote character (between the quote and the preceding character), the IDE will select the entire string, including the opening and closing quote characters.

Sunday, March 30, 2008 #

During Earth Hour last night, I turned off my lights and killed a tree!



I may be partially responsible though. They probably didn't mean for people to turn off their lights if they were driving a car at the time.

Tuesday, December 18, 2007 #

If you ran this code:

private enum FieldWidths
{
   CustomerNumber = 5,
   OrderNumber = 10,
   City = 30,
   State = 2,
   Zip = 11    
}
. . .
int[] vals = (int[])Enum.GetValues(typeof(FieldWidths));
string[] names = Enum.GetNames(typeof(FieldWidths));

...you might expect (I did, anyway) that the resulting arrays would look like this:

vals: 5, 10, 30, 2, 11

names: "CustomerNumber", "OrderNumber", "City", "State", "Zip"

What you would get, though, is:

vals: 2, 5, 10, 11, 30

names: "State", "CustomerNumber", "OrderNumber", "Zip", "City"

...because the arrays returned by Enum.GetValues and Enum.GetNames are sorted by the values in the enumeration.

I "reflectored" a bit, and there doesn't seem to be a way to get the values from an enum in the order that they were specified, so I'll stop trying to do that.


Monday, November 05, 2007 #

Inspired by Brian Button's presentation at the St. Louis .NET User Group and Scott Hanselman's dnrTV! episode, I'm starting to look into PowerShell.

Scott Dorman had a link to a free introductory PowerShell e-book a while ago.

I haven't actually read the e-book yet, but when I printed it, I noticed a nice PowerShell Cheat Sheet at the end of the book, which looks like it might be very useful.


Saturday, August 04, 2007 #

Since I first heard about IronPython, I've always wondered why it was called that. When I think about "dynamic" languages, "iron" is not the first thing that comes to mind. Now there's IronRuby also.

I've searched "the internets", and have found no explanation of the names (although I did find out that Python is named for Monty Python and not the snake, which I didn't know).

...Or maybe I'm reading the names wrong and they start with a lowercase "L", not an "I". "L Ron Python" could be a tribute to scientology ;-)


Tuesday, July 17, 2007 #

I'm currently supporting an ASP.NET project that has a lot of code like this using the System.Web.UI.Control.FindControl method to get data from child controls - in this example, from DataListItems belonging to a DataList control:

 
    foreach (DataListItem item in employeeDataList.Items)
    {
        if (item.ItemType == ListItemType.Item ||
            item.ItemType == ListItemType.AlternatingItem)
        {
            if (((HtmlInputCheckBox)item.FindControl("SelectionCheckBox")).Checked)
            {
                string positionId = ((Label)item.FindControl("PositionIdLabel")).Text;
                string personnelId = ((Label)item.FindControl("PersonnelIdLabel")).Text;
                ProcessPosition(positionId, personnelId);
            }
        }
    }

 

There's much room for improvement, but I started by adding a couple of FindControl overrides to the base class inherited by the project's pages.

The first calls the passed "parent" control's FindControl method, and throws an System.ArgumentOutOfRangeException if the specified ID is not found. This way, instead of just failing when later trying to use a null object, we know exactly which ID wasn't found in which "parent" control:

 

    protected Control FindControl(Control parentControl, string id)
    {
        Control control = parentControl.FindControl(id);

        if (control == null)
        {
            throw new ArgumentOutOfRangeException(
                string.Format("{0}.FindControl failed for ID \"{1}\"",
                parentControl.ID, id));
        }

        return control;
    }

 

The second uses generics to call the override shown above and cast the found Control to the specified Control type (the "where T : Control " constraint allows it to return only types that inherit from System.Web.UI.Control).

 

    protected T FindControl<T>(Control parentControl, string id) where T : Control
    {
        return (T)FindControl(parentControl, id);
    } 

 

Here's the code shown in the first example, modified to use the generic FindControl method. I think it's a little more readable than the original:

 

    foreach (DataListItem item in employeeDataList.Items)
    {
        if (item.ItemType == ListItemType.Item ||
            item.ItemType == ListItemType.AlternatingItem)
        {
            if (FindControl<HtmlInputCheckBox>(item, "SelectionCheckBox").Checked)
            {
                string positionId = FindControl<Label>(item, "PositionIdLabel").Text;
                string personnelId = FindControl<Label>(item, "PersonnelIdLabel").Text;
                ProcessPosition(positionId, personnelId);
            }
        }
    } 

Wednesday, July 04, 2007 #

On the anniversary of our nation's independence I call upon my U.S. citizens to throw off the shackles of our British oppressors and pronounce the word "agile" like true Americans:

  • The pretentious un-American "goofus" pronunciation: aj-ahyl
  • The right-thinking American "gallant" pronunciation: aj-uhl

Listening to the .NET Rocks Team System panel discussion from Tech Ed last week, I was dismayed to hear that only one of the six panelists pronounced "agile" like an American. I'm not sure which one it was, but it may have been the Canadian guy! (Yes, I realize that Canadians and everyone else from North, Central and South American are also American and it's arrogant to use that term only for people from the U.S., but I don't think that "United Statesian" will ever catch on. But enough aboot that, as they say in Canada.)

All of the dictionaries I've checked, including, ahem, the American Heritage dictionary, show "aj-uhl" as the preferred pronunciation.

According to the history of the agile manifesto at agilemanifesto.org, the only objection among the agile founding fathers to the term "agile" came from Martin Fowler, who said that most Americans don't know how to pronounce the word properly. I think that's why a lot of developers say "aj-ahyl" - they want to be like Martin. Being Fowleresque is a very admirable thing if you're designing software, but you don't have to talk like the guy if you're not British.

Am I making too big a deal of this? Perhaps, but it's a slippery slope, my friends. Start saying "aj-ahyl", and before you know it you'll be adding an extra syllable to "aluminum", driving on the wrong side of the road, and clamoring for the addition of a System.Drawing.Colour namespace. Think it can't happen here? Think again - One of the guys on the .NET Rocks show pronounced "process" with a long O, like Jean-Luc-Freaking Picard!

P.S.

Please don't respond with nasty comments - My sense of self-esteem is very fraj-ahyl.


When a free download of Refactor!™ for ASP.NET 2.2 was announced in May by Developer Express, I bookmarked it for future reference because I wasn't working on an ASP project at the time.

When I took another look, I realized that the download includes 19 C#/VB code refactorings that work in any project, ASP.NET or not. They work in Visual Studio 2003, VS2005, and "Orcas".

Included are Refactor! versions (with much nicer user interfaces) of four of the seven built-in VS2005 C# refactorings:

  • Rename
  • Extract Method
  • Encapsulate Field
  • Reorder Parameters

...plus:

  • Create Overload:
    Creates an overload to an existing method, with fewer parameters.
  • Extract Property:
    Creates a new property from the selected code block. The selection is replaced with appropriate code to reference the newly-declared property.
  • Flatten Conditional:
    Unindents the If or Else statement for a conditional and applies one of the following refactorings: Replace Nested Conditional with Guard Clause, Remove Redundant Else, or Reverse Conditional followed by Remove Redundant Else.
  • Inline Temp:
    Replaces all references to a local variable with its initial value.
  • Introduce Constant:
    Declares a new constant, initialized to the value of the selected string or number.
  • Introduce Local:
    Creates a new local variable initialized to the selected expression. Replaces the selection with the new variable.
  • Move Declaration Near Reference:
    Moves the declaration statement for a local variable near its first reference.
  • Move Initialization to Declaration:
    Combines a local variable's declaration with its first initialization.
  • Replace Temp with Query:
    Replaces each reference to the active local variable with a call to an extracted method, which returns the initial value assigned to the local.
  • Reverse Conditional:
    Inverts the logic in a conditional statement and swaps the If and Else blocks.
  • Safe Rename:
    Safely renames non-private methods and properties by creating a duplicate member to preserve the old signature, calling the renamed member from the old member. The old member is hidden from Intellisense and marked "Obsolete". References to the old member will generate compiler warnings directing developers to the new renamed member.
  • Simplify Expression:
    Resolves an expression to its simplest form.
  • Split Initialization from Declaration:
    Breaks an initialized declaration for a local variable into a declaration and a separate initialization statement.
  • Split Temporary Variable:
    Splits a local variable which has too many assignments, declaring a new local at the first new assignment following the first reference.

...and the 10 ASP.NET 2.0 refactorings:

  • Add Validator:
    Adds one or more selected Validators to the active input control.
  • Extract ContentPlaceHolder:
    Moves the selected content from a .master page to a new .aspx file, placing it inside <asp:content> tags, and inserts a new <asp:contentplaceholder> tag at the extraction point inside the master page.
  • Extract ContentPlaceHolder (and create master page):
    Moves the content that is *outside* of the selection (in the active .aspx page) to a new master page, inserting a <asp:contentplaceholder> tag to reference the extracted content, and then wraps the selection in the aspx page with <asp:content> tags and adds a MasterPageFile attribute to link to the new master page.
  • Extract Style (Class):
    Converts an inline style to a named class style.
  • Extract Style (id):
    Converts an inline style to a named id style.
  • Extract to UserControl:
    Creates a UserControl for the selected block including content and dependent code.
  • Move Style Attributes to CSS:
    Moves styling attributes from the active control to a new CSS class and applies the class to the control.
  • Move to Code-behind:
    Moves code located in <script> tags to the code-behind file.
  • Rename Style:
    Renames the active CSS style and updates all references to that style.
  • Surround with Update Panel:
    Surrounds a contiguous block of text in the source view with <asp:UpdatePanel …> and <ContentTemplate> tags.

Here's a link to a post by Mark Miller, mad genius of Developer Express, showing examples of all of the refactorings.


Sunday, March 04, 2007 #

Technorati tags: ,

While gathering information about Visual Studio add-ins for a potential local user group presentation, I came across Gaston Milano's "CoolCommands".

As far as I can tell, the latest version of the CoolCommands installer can be downloaded here:
http://download.deklarit.com/files/gmilano/coolcommands40.zip.

It adds a lot of useful tools to Visual Studio, but there's no help or "read-me" file documenting them, and I couldn't find a consolidated overview on Gaston's site, so here's my attempt to summarize the CoolCommands tools:

Collapse All Projects

Context menu item displayed when a solution name is right-clicked in the Solution Explorer - Simulates clicking the close (minus sign) icon for all expanded projects.

Open Container Folder

Context menu item displayed when a project or file name is right-clicked in the Solution Explorer - Displays the project folder in Windows Explorer (and automatically selects the right-clicked file if you launched the menu from a file name rather than the project name).

Visual Studio Prompt Here

Context menu item displayed when a project name is right-clicked in the Solution Explorer - Opens the Visual Studio Command Prompt window, initialized to point to the project's folder.

Demo Font

Context menu item displayed in response to a right-click in a text editor window - Quickly toggles between an 18-point font size and your preferred (Tools | Options | Environment | Fonts & Colors) font size.

Wheel Font Sizing

Context menu item displayed in response to a right-click in a text editor window - I don't have a wheel mouse on this PC, but it looks like this toggles the ability to change the text editor font size via the mouse wheel.

Send By Mail

Context menu item displayed in response to a right-click in a text editor window - Launches your email program's "new message" window with the selected code pasted into the body.

Open File

Context menu item displayed in response to a right-click in a text editor window - If you right-click on a string literal containing a file name, this option opens the file.

Copy File

Context menu item displayed in response to a right-click in the tab at the top of a text editor window (seems to me it should be in the Solution Explorer instead or at least also) - Displays a popup window asking where you want to save a copy of the selected file:

Copy File

Locate in Solution Explorer

Context menu item displayed in response to a right-click in the tab at the top of a text editor window - Highlights the file in the Solution Explorer (expands solution, project & folders if necessary and even shows the Solution Explorer window if it's not visible).

Copy Reference

Context menu item displayed in response to a right-click on a reference displayed in a project's References list in Solution Explorer - Used in conjunction with...

Paste Reference

Context menu item displayed in response to a right-click on or in project's References "folder" in Solution Explorer - Adds a reference copied from another project via the "Copy Reference" tool to the current project's References list. 

Resolve Project References

If you open a project and it has broken "project" references because you usually open the project as part of a solution, this context menu item displayed in response to a right-click on a project name in Solution Explorer automatically adds the referenced projects to the current solution.

Reference Manager

Reference Manager

Opened via a context menu item displayed in response to a right-click on a solution or project name in Solution Explorer.

If you enter part of an assembly name in the "Find Reference" box and press the Enter key, the Reference Manager will show you which projects contain a reference to that assembly.

You can use the "Remove" button to quickly remove a reference from multiple projects.

If you click the "Add Reference" button, you'll see the standard Visual Studio "Add Reference" dialog, but you can use the Reference Manager to quickly add references to multiple projects at once.

Add As String Resource

Context menu item displayed in response to a right-click in a text editor window - Pops up a dialog to allow you to easily specify a key and value (defaults to the selected text), and a dropdown list of resource files to which you can add the new string resource. 


There's some great stuff here (especially the reference tools), but it would be nice if CoolCommands were packaged a little better:

  • Version 3 had an .msi installer, but you have to run a .bat file to install version 4, and I'm not sure how to uninstall it.
  • Some documentation - even a readme.txt or a web page with a summary - would help a lot.
  • It would be really great if there were a configuration screen where you could select which tools should be visible - My right-click menus are almost long enough to require scrolling now.

If you have any questions or complaints about CoolCommands, please address them to Gaston, not to me.


Saturday, October 28, 2006 #

I'm old enough to remember the Cardinals winning the World Series in '82, but I don't remember where or with whom I watched it.

I don't think I'll ever forget where I was they won the '06 Series, though.

I was flying back to St. Louis from the Heartland Developer's Conference in Omaha, and was very disappointed that I wouldn't be able to watch what could be the championship-clinching game.

About half an hour before landing at the Dallas-Fort Worth airport (blast American for moving their hub out out of St. Louis so you can't get a direct flight to/from Omaha), I was able to pick up the Dallas ESPN Radio station on my radio and hear the game starting with the bottom of the first inning.

At the airport, there was a mini TGI Friday's bar/restaurant with TVs showing the game, and a group over 30 Cardinals fans gathered outside to watch.

We boarded the plane to St. Louis just as the top of the ninth started, and the flight attendant let us know when there there was one and then two outs. At the exact moment that the plane pulled away from the gate, he announced that the Cardinals were World Series champions, and the passengers let loose with a big cheer.

Cardinal fans got a little spoiled the past two seasons with 105 and 100 win seasons, and at the beginning of this season, the chances of the Cardinals winning the championship in the first year in their new ballpark looked pretty good.

The chances sure didn't look good as they limped to the end of a frustrating regular season, though. It seems like there's always some Cinderella team that catches fire in the post-season and, for once, that team was St. Louis. (It looked like the Tigers might be this year's Cinderella team, but their magical carriage turned back into a pumpkin as Halloween approached.) I've got no ill will against the Tigers or Jim Leyland - they should be a really good team the next few years, but I do enjoy the seeing "experts" like that sphincter Bob Nightengale of USA Today who picked "the Tigers in 3" and said "The Detroit Tigers' biggest obstacle to a championship will be keeping a straight face" eat crow.

Congratulations to Tony LaRussa for becoming only the second manager in history to win a World Series in both league, to the Cardinals, and to their fans who aren't old enough to remember '82 - I hope we don't have to wait another 24 years for another day as sweet as this.