Scott Hanselman

TechEd Video #4 - It's all about Community. And Ice Cream. And Baby Carrots.

April 13, '05 Comments [10] Posted in ASP.NET | TechEd | Web Services | Javascript | Speaking
Sponsored By

In the fourth and final installment of our "Those are some really weird TechEd Videos Collection (coming soon in DVD, not)" Rory and I learn the meaning of community as we sleep through the TechEd Keynote Address.

Please spread it around and Trackback/Pingback it. If you can't view it below, you can download it here.

Remember, if you're blogging TechEd this year, make sure to register your blog at TechEd Bloggers.NET and get your content aggregated!


play video stop video indicatorhandleamount downloaded toggle sound launch in external player
Launch the streaming media file

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

TopDesk: Expose Clone for Windows (and capturing video from DirectX)

April 12, '05 Comments [32] Posted in Bugs
Sponsored By

An animated GIF of TopDesk in action.Finally, my search for a decent Windows Task Switcher is over. Sure, there's TaskSwitchXP, which kicks the Windows Power Toy Task Switcher's booty.

But, no, I'm not talking about an Alt-Tab replacement. I'm talking about the pure sex that is Mac OS X Expose, but on Windows, and written in DirectX. It's TopDesk, and it's the bomb. And it's US$9.95? Sold. He sure ain't doing it for the money.

It has been around a bit, but it used OpenGL and it was pretty buggy. The author recently rewrote the whole thing in DirectX, adding a bunch of new features, including floating buttons for TabletPC support and corner hotspots.

Oh, and it supports multi-monitor, too? Awesome.

I set it up with the very corners of my monitors as "hotspots" to start the taskswitcher. Since I'm a developer, I also changed the default hotkey from the Mac default of F9 to a more reasonable Alt-F9.

Here's a Windows Media 9 encoded video of it in action on my machine. I used Fraps (another awesome util) to do the DirectX capture to AVI, FYI. Then I used RiverPast Video Cleaner to make an Animated GIF from that AVI. Then I used GifWorks.com's Online Animated GIF Editor to make it loop.

I sure love utils.

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

Psuedo Internationalization and your ASP.NET Application

April 9, '05 Comments [1] Posted in ASP.NET | Internationalization | Nant | ViewState | Bugs
Sponsored By

John Robbins has a great MSDN BugSlayer Article from April of 2004 on Psuedo Internationalization. When you're creating localization-ready applications, but you don't want to go to all the hassle of localizing your ever-changing resources to a specific language, you can create psuedo-internaFile Attachment: Psuedoizer.zip (11 KB)tionalized resources.

These are resources using not only funky characters (to cover more of the character spectrum), but they may be longer (simulating more 'verbose' languages like German).

For example, here's an English language snippet from one of our resource files:

<data name="Accounts.Download.Title">
  <value>Transaction Download</value>
</data>
<data name="Accounts.Statements.Action.ViewStatement">
  <value>View Statement</value>
</data>
<data name="Accounts.Statements.Instructions">
  <value>Select an account below to view or download your available online statements.</value>
</data>

Here's the same snippet Psuedo-internationalized:

  <data name="Accounts.Download.Title">
    <value>[Ŧřäʼnşäčŧįőʼn Đőŵʼnľőäđ !!! !!!]</value>
  </data>
  <data name="Accounts.Statements.Action.ViewStatement">
    <value>[Vįęŵ Ŝŧäŧęmęʼnŧ !!! !!!]</value>
  </data>
  <data name="Accounts.Statements.Instructions">
    <value>[Ŝęľęčŧ äʼn äččőūʼnŧ þęľőŵ ŧő vįęŵ őř đőŵʼnľőäđ yőūř äväįľäþľę őʼnľįʼnę şŧäŧęmęʼnŧş. !!! !!! !!! !!! !!!]</value>
  </data> 

It can still be read as near-English, which means you can localize your ASP.NET application to this funky almost-language and see:

  • Which strings in your application you missed pulling into resources
  • What you application looks like with longer strings
  • If you correctly handle the higher-order character sets

John's article includes a nice WinForms application to "psuedoize" resources. However his code doesn't take into consideration:

  • Resources that include markup like <a href={0}>. It will actually psuedoize the "a href" which will actually break your application. I've changed it to watch for the entering and exiting of < >'s and { }'s.
  • There's no command-line version.

I wanted a version to solve both these problems because I want to automatically psuedoize our applications during the Continuous Integration NAnt build. That means, Joe Developer adds a string, and the build will automatically generate psuedo-resources that include them all.

Here's my enhanced I18n Psuedoizer with much respect to John Robbin's original. Psuedoizer.zip (11.03 KB)

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

Alphabetizing your .NET Resource (RESX) files

April 9, '05 Comments [1] Posted in ASP.NET | Corillian | PDC | XML | Tools
Sponsored By

We internationalize all our ASP.NET Web Applications, and usually end up with hundreds, if not thousands of strings in our RESX files. The names are all very hierarchical, like "AccountSummary.DataGrid.Columns.AvailableBalance" so you can see why it's important to keep them alphabetized. Additionally, there are usually a dozen or more of these RESX files in multiple levels of directories.

So, a little snazzy batch file action:

for /f "Tokens=*" %%i in ('dir /b /s *.resx') do nxslt "%%i"  alpharesx.xslt -o temp.xml & copy temp.xml "%%i" /y

The "dir /b /s" is "Directory BARE FORMAT FULL PATH all SUBDIRECTORIES" which provides the iterator for the FOR DO batch file loop. I had to use a temp.xml file because the nxslt tool didn't allow me to use the same filename for the input and output.

"nxslt" is a fantastic command-line .NET XSLT front end by Oleg Tkachenko. There are many command-line XSLT tools out there, but Oleg's is by far the most powerful and flexible.

The alpharesx.xslt is this XSLT stylesheet. It copies (xsl:copy-of) the RESX header stuff, then sorts the data nodes by name. There's no doubt even 'terser' XSLT-y ways to do this, but this is a start. Thanks to Travis Illig for the idea and starting chunk of XSLT

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsl:template match="/" xml:space="preserve">
        <root>
            <xsl:copy-of select="root/xsd:schema"/>
            <xsl:copy-of select="root/resheader"/>
            <xsl:apply-templates select="root/data">
                <xsl:sort select="@name" />
            </xsl:apply-templates>
        </root>
    </xsl:template>
   
    <xsl:template match="data" xml:space="preserve">
        <data><xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute>
            <value><xsl:value-of select="value" /></value>
        </data>
    </xsl:template>
</xsl:stylesheet>

I'm also sure there's all sorts of SED-style ways to accomplish this, but this solution seem to be the simplest solution for this, short of writing a little custom C# program. It also was a faster-to-write solution than a new program.

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

Overheard - Friday, April 8, 2005

April 8, '05 Comments [3] Posted in Javascript | Bugs
Sponsored By

Overheard while debugging some client-side JavaScript today at work...

"How come your body is bigger than your documentElement?"

"That's what she said!"

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.