Scott Hanselman

My GrokTalk - Ten Tools in Ten Minutes

June 9, '05 Comments [8] Posted in TechEd | ASP.NET | Speaking | NUnit | CodeRush | Bugs | Tools
Sponsored By

They are still editing my TechEd GrokTalk which was called "10 Tools in 10 Minutes." It was a quick list of the tools I use to be productive (I'm still working on an updated Ultimate Tools List - possibly done this weekend).

Here's details and links to the tools I used in random order. I'll update this post and include the actual video as soon as it's edited.

These are just 10 great tools that I picked from my list. There are a hundred more, so I'm sorry if your favorite isn't here.

  • Notepad2 (Scite also uses the codebase) - A great text editor. First class CR/LF support, ANSI to Unicode switching, whitespace and line ending graphics and Mouse Wheel Zooming. A must. Here's how to completely replace notepad.exe. Personally I renamed Notepad2.exe to "n.exe" which saves me a few dozen "otepad"s a day. Here's how to have Notepad2 be your View Source Editor. Here's how to add Notepad2 to the Explorer context menu.
  • Cropper - A fabulous screen capture applet. I usually pick simple tools that do their job elegantly. Cropper does just that and it's written in .NET.
  • Lutz's Reflector and it's AddIns - The tool that changed the world and the way we learn about .NET. Download it, select and interesting method and hit the space bar. Take the time to install the Add-Ins and check out the amazing static analysis you can do with things like the Diff and Graph.
  • SlickRun - A free floating dynamic "command prompt" with alias support that continues to amaze. My tips for effective use: read the instructions, edit the slickrun.ini file and bind it to Window-R. Also set ChaseCursor so when you hit Win-R, you'll have a floating transparent command line anywhere your mouse is. I recommend you also use larger fonts! :
  • Windows Desktop Search - The betas were rough and tended to lock up, but the free final edition is tight. I can finally bring up a file almost as fast as I can think about it. One important note that sets it apart from Google Desktop Search is that the items appearing in the result window are first-class Explorer Items. Right click on them and you'll not only have all your context menu extensions, but also Open Containing Folder.
  • TaskSwitchXP and TopDesk - Two better ways to ALT-Tab and Task Switch in Windows. Don't confuse TaskSwitchXP with the old PowerToy. This one is fast and powerful. If you envy the Mac's Expose, then use TopDesk. Personally, I use both and set a cursor hotspot in the lower-right corner to tile my windows. Be sure to have DirectX9 installed.
  • Magnifixer - My ZoomIn tool du jour. Be sure that you have SOME kind of ZoomIn tool installed. I like this one because it automatically follows your cursor and your typing and saves settings without asking. It also has a nice eye-dropper for the RGB in you. Learn how to use this tool if you present at all.
  • CodeRush and Refactor! (and DxCore) - Apparently my enthusiasm for CodeRush has been noticed by a few. It just keeps getting better. However, the best kept secret about CodeRush isn't all the shiny stuff, it's the free Extensibility Engine called DxCore that brings VS.NET plugins to the masses. Don't miss out on free add-ins like CR_Documentor and ElectricEditing.
  • SysInternals - I showed specifically ProcExp and AutoRuns, but anything these guys do is pure gold. ProcExp is a great Taskman replacement and includes the invaluable "Find DLL" feature. It can also highlight any .NET proceses. AutoRuns is an amazing aggregated view of any and all things that run at startup on your box.
  • TestDriven.NET - The perfect integration of Unit Testing with Visual Studio.NET. Right click and "Run Test." The output window says "Build" then switches to "Test." The best part, though, is "Test With...Debugger" as a right click that automatically starts up an external process runner, loads and starts your test. Compatible with NUnit, MBUnit and Team System.

 

 

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Tsunami Auction #2 - TechEd 2005

June 8, '05 Comments [3] Posted in TechEd | Speaking
Sponsored By

The Tsunami victims may not be in the news much, but they still need our help. There's a TechEd Auction to benefit the victims in Banda Aceh. You can bid on my time, or any of 25 TechEd speakers and smarties.

This is a great opportunity to get some .NET consulting time and to help out folks in need. The last auction generated nearly $10,000 if I remember correctly. Check us out on Ebay.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

ARC305 - My TechEd 2005 Session is being repeated

June 8, '05 Comments [0] Posted in Corillian | TechEd
Sponsored By

Turns out that the standing room only crowd (yay!) in my talk today has inspired Harry to create a repeat session.

The repeat session is:

ARC305 - Code Generation - Architecting a New Kind of Reuse
Weds June 8th, 5:30PM-6:45PM
Room S220E

Be there if you missed the first!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Keynote thought

June 7, '05 Comments [4] Posted in
Sponsored By

Microsoft needs to hire me as a consultant to tech executives to make their font sizes bigger in VS.NET. How anyone thinks Courier New 12 is an appropriate font for a 4,000 person keynote is beyond me.

I know I've been a Lucida Console person, but I'm digging a new Longhorn font called Consolas. Its brilliant. Watch for it soon. Its better than Lucida, hinted for LCD and high-res displays and has dec specific features like ProFont. I love it, and I'll be using it in my talk at 10:45am today.
Scott Hanselman - Corillian Corp
scott@corillian.com
--------------------------
Sent from my BlackBerry Wireless Handheld

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Update on the dasBlog Turkish-I bug and a reminder to me on Globalization

June 5, '05 Comments [5] Posted in ASP.NET | DasBlog | Internationalization | Bugs
Sponsored By

I had blogged earlier about a bug in dasBlog that affected Turkish users. When a Turkish browser reported an HTTP Accept-Language header indicating Turkish as the preferred language, no blog posts would show up.  As fix, I suggested that users change their blog templates, but I knew that wasn't an appropriate fix.

For background, here's what an Accept-Language header looks like. This user would prefer Turkish, but would take English as their second choice.

GET /DasBlog/default.aspx HTTP/1.1
Accept-Language: tr,en-us;q=0.5
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Tablet PC 1.7; .NET CLR 2.0.50215)

Why would the browser affect the underlying engine you say? Here's some background before I show you how I fixed the bug. Typically globalized ASP.NET applications set the current thread's Culture and UICulture to a specific culture based on the user's preferences. 

For example:

CultureInfo Turkey = CultureInfo.CreateSpecificCulture("tr");
Thread.CurrentThread.CurrentCulture = Turkey;
           
Thread.CurrentThread.CurrentUICulture = Turkey;

Why two properties? From the MSDN Documentation:

The CurrentCulture property's default value is the system's User Locale, which is set in the Regional Options control panel. The CurrentUICulture property's default value is the system's UI Language, which is the language of your system UI. On Windows 2000 and Windows XP MultiLanguage Edition, the CurrentUICulture defaults to the current user UI language settings.

The CurrentUICulture is used by the ResourceManager to look up resources like strings at run time. The CurrentCulture is set per-thread also, but is used for formatting dates, times, currencies and string manipulation methods.

Earlier I blogged that I suspected a problem with the Reflection method we were using to invoke Macros in dasBlog. We were passed in "items" from a dasBlog tempate and were looking for a property called "Items." We used a reflection method like this:

MemberInfo[] members = subexObject.GetType().FindMembers(

    MemberTypes.Field|MemberTypes.Method|MemberTypes.Property,

    BindingFlags.IgnoreCase|BindingFlags.Instance|BindingFlags.Public,

    new MemberFilter(this.IsMemberEligibleForMacroCall), subex.Trim() );

if ( members.Length == 0 )

{

    throw new MissingMemberException(subexObject.GetType().FullName,subex.Trim());

}

Notice that we're indicating via the BindingFlags.IgnoreCase flag that we want the FindMembers() method to handle the case-insensitivity issue for us. My initial thought was that they must be doing something wrong inside. I mentioned this to Michael Kaplan, but he said there was a big push to fix "Turkish-I" bugs in the 1.1 timeframe. However, he said he'd look at the problem and see if it would need to be fixed if I had a simple repro to prove it was still a problem in 2.0. At this point, I started thinking that it's probably NOT Microsoft, but as I started writing a small repro as a separate project, I was thinking, we (dasBlog) MUST be doing something wrong, otherwise how have the Turks been doing reflection all this time? They'd have run into this before. I googled and couldn't find any Turks suffering the slings and arrows of reflection.

I went back and looked at the code again with fresh eyes. Then I noticed (brain fart here):

MemberInfo[] members = subexObject.GetType().FindMembers(

    MemberTypes.Field|MemberTypes.Method|MemberTypes.Property,

    BindingFlags.IgnoreCase|BindingFlags.Instance|BindingFlags.Public,

    new MemberFilter(this.IsMemberEligibleForMacroCall), subex.Trim() );

if ( members.Length == 0 )

{

    throw new MissingMemberException(

        subexObject.GetType().FullName,subex.Trim());

}

I had been glossing over that. We are/were passing in a delegate for filtering. That method looked like this:

private bool IsMemberEligibleForMacroCall(MemberInfo m, object filterCriteria )

{

    return String.Compare(m.Name,(string)filterCriteria,true)==0;

}

Doh! That's a culture-sensitive string compare. We were comparing the MemberInfo that we got back from the reflection call with the string we knew we needed. Even though the Reflection call to FindMembers succeeded, we were filtering out our method with a bad compare.

Here's where the lesson comes in (and this had bitten me before, so I was kicking myself).

Scott's Rule Number 0x5F: Think about your string compares and their context. Make sure you've expressed your true intent correctly.

Here is the fixed method. It'll be in the next dasBlog point release and won't require anyone to change their templates.

private bool IsMemberEligibleForMacroCall(MemberInfo m, object filterCriteria )

{

    //This has to be case-insensitive and culture-invariant or

    // "Item" and "item" won't match if the current culture is Turk

    return String.Compare(m.Name,(string)filterCriteria, true, System.Globalization.CultureInfo.InvariantCulture) == 0;

}

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.