Scott Hanselman

Hanselminutes Podcast 76 - F# with Robert Pickering

August 10, '07 Comments [6] Posted in Learning .NET | Podcast | Programming
Sponsored By

My seventy-sixth podcast is up. In this show, I chat with Robert Pickering, author of the very fine Foundations of F#. We ask the question 'Why F#?' and talk about functional languages and some of the features of F# that make it a great introduction to FP for .NET programmers.

NOTE: If you can, while listening to this show, be sure to visit this explanatory post on Robert's blog. It includes the code samples and syntax techniques that he talks about in this interview. Reading the code while listening will help you enjoy this particular show that much more.

Additional Production Note: Check out this post on Sound Quality at Carl Franklin's blog for short before and after samples of Robert's audio track and an explanation of one of the many ways that Carl and his team at Pwop makes the sound quality of this podcast so nice.

If you have trouble downloading, or your download is slow, do try the torrent with Āµtorrent or another BitTorrent Downloader.

Links from the Show

Examples - Robert Pickering's Blog Post on the F# Show on Hanselminutes (rr0)
F# - Microsoft Research (rr2)
Robert Pickering's F# Blog (rr4)
Book: Foundations of F# - Robert Pickering (rr1)
Robert Pickering's F# Resources (rr3)
MSDN Video on F# (rr5)

Do also remember the complete archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

Telerik is our sponsor for this show.

Check out their UI Suite of controls for ASP.NET. It's very hardcore stuff. One of the things I appreciate about Telerik is their commitment to completeness. For example, they have a page about their Right-to-Left support while some vendors have zero support, or don't bother testing. They also are committed to XHTML compliance and publish their roadmap. It's nice when your controls vendor is very transparent.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

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

Changes in the .NET BCL between 2.0 and 3.5

August 10, '07 Comments [8] Posted in Learning .NET | Programming
Sponsored By

(Actually between the BCL Version 2.0.50727.42 and 2.0 (Version 2.0.50727.1378)

API Changes from org2.0 to 2.0 - Windows Internet ExplorerI was thinking that while folks are blogging about all the new stuff in .NET 3.5 and VS2008 (or VS3.508 as I think to think of it) there must be other fixes here and there in the Base Class Library itself.

I googled around and couldn't find a list of what's changed in the BCL. I'm sure it's out there somewhere and I've missed it and the second I post this someone will post a better list in the comments, but anyway...

First, I look in C:\windows\assembly with Explorer. Remember that this is a "lie" - what you're seeing is a namespace extension's representation of the Global Assembly Cache, although a very useful one. Here's the new 3.5 stuff, sorting by version. This stuff is near all new. New assemblies, etc.

assembly

Nothing in here appears to have "rev'ed" like moving from 2.0 to 3.5 and kept the old version. One might expect to see System.Web 2.0 and then System.Web 3.5, but that's not the case from what I can see.

There is, however, a large amount of new (what I would call) BCL stuff in the new System.Core assembly. Remember that namespaces can exist across assemblies, so releasing a new assembly is a pretty decent way to get sweeping additive changes across a few dozen namespaces in a very compatible way.

Reflector says that System.Core includes new things in System.Threading, System.IO, System.Security, System.Diagnostics, and more. I would encourage you (as I do everyone who will listen) to download Reflector and do this:

  • Run Reflector
  • Hit the Home key on your keyboard
  • Hold down Delete until Reflector's window is clear
  • Press Ctrl-L, then Enter

...and you'll get this dialog. Reflector is smart enough to prompt you to fill up your empty assembly list, and the defaults are so useful that I usually just delete everything and pick one of these.

Start Default Assembly List

As you move around in Reflector, notice the "Location:" arrea at the bottom that tells you where the assembly is (although there are copies in the GAC).

image

Look at all the assemblies in the .NET 3.5 list and you'll see which ones live in the 2.0 directory, the 3.0 directory and the 3.5 directory.

While 3.5 is huge conceptually, on disk it's very small, consisting of the new compilers and basically these three assemblies:

  • System.Core
  • System.Data.Linq
  • System.Xml.Linq

There are other assemblies for MSBUILD improvements and such, but it's still very compact, from a "redistributable" point of view.

I would personally recommend that anyone who hasn't moved their 1.1 shop over to 2005, or who is starting out with .NET to just start with 2008/3.5. The multi-targeting stuff is very slick (I'll do a dissection soon, more detailed that ScottGu's post)

Has Anything Changed?

I wanted to find out what's changed between a standard Windows XP SP2 machine - totally fresh - with just the 2.0 runtime distributable installed, and my Vista machine with 3.5 on it.

There's a really great, but largely unknown, tool called Libcheck that you can download for free, that'll compare two versions of an assembly and show you the differences in a report. It'll look only at the public (inter)face of the assembly. In this case, that's exactly what I want.

It doesn't look to have been changed since 2005, so first I need to download and compiled it and hope it works. Fortunately it comes with source code and rather than spending time converting it to 2008, I just run the included nmake.bat that builds the three supporting libraries it needs and spits out libcheck.exe. Nice and easy (and lazy). There's a couple of obsolete warnings, but they're obsolete, not dead.

First, I brought up my 2.0 XP SP2 VM (again, fresh) and ran the .NET 2.0 Redistributable Package on it. This would be version 2.0.50727.42.

I went to the Libcheck folder and ran this command:

libcheck -store all org2.0

...and libcheck created a database of all the schmutz in 2.0.

Then I ran the same thing on my Vista machine with 3.5 - remembering that it's just going to look at the 2.0 Framework stuff on my system. This version of 2.0 was 2.0.50727.1378.

libcheck -store all 2.0

Notice that one was "org2.0" and the other '"2.0." I then copied all the org2.0 folder off my VM and onto my main machine, then ran:

libcheck -compare org2.0 2.0

The Report appeared in a folder called org2.0to2.0. Then I copied the report up to my blog, and it's available here.

Note: You can modify the text files in /RefFiles and use LibCheck on your own framework internal to your company. That's what we did at Corillian. There is apparently a much better version of this tool (this one is 3 years old) internal to Microsoft. I'll see what I can do to free it.

The percentage of churn was in the single digit percentages. Personally I find the report a fascinating read. You can see what was breaking, what was just added. You can see where new enums appeared and where overrides became virtuals and all sorts of things. Check it out, it's not that scary.

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

Vista Pre-SP1 Performance and Reliability Fixes

August 8, '07 Comments [10] Posted in Bugs
Sponsored By

2723_Windows_Vista_logo Everyone knows that Vista SP1 is due out soon, but if you're having any trouble now (I'm not anymore), you might take a look at these two updates:

  • Performance Update - KB938979 - This one has some networking related fixes as well as fixes for some hibernation weirdness, as well as a possible fix for the now-legendary Explorer "estimated time remaining" issue.
  • Compatibility Update - KB938194 - This one contains mostly video driver related fixes.

You don't need to install these now unless you're having some trouble. These should be rolled up into the SP1 when it comes out, so you'll get them automatically later anyway.

If you do download, make sure you get the appropriate 32-bit or 64-bit version.

It doesn't say in the release notes, but I personally recommend that you install 1, reboot, install 2, reboot to avoid problems. Just a good practice, IMHO.

Technorati Tags: , , , ,

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

Additional Automatic Printer Driver Installation with Vista 64 as a Print Server

August 8, '07 Comments [8] Posted in Tools
Sponsored By

Now that I'm running Vista 64, while most everything is running very smoothly, there's an occasional reminder here and there that I'm living in an alternate universe.

I'm still running a Canon Pixma MP500 Multifunction Inkjet and the fact that Vista 64 drivers were available for download confirmed that this Printer was a great decision.

However, when I tried to connect from one of my XP VMs or from my Wife's Vista32 machine, I was told that Drivers weren't available. I'm used to connecting to a printer in Windows "just working." I just visit the machine, like \\QUADPOWER, hit the Printers folder and double click the Printer. In this case, my system had only the 64-bit drivers I had already installed.

Here's how to tell your 64-bit system that it has 32-bit drivers it can serve to the family (or the reverse):

  1. From your server, go to the Printers folder and right click to get your Printer's Properties. Click the Sharing Tab and click Additional Drivers. You'll see this dialog or something like it.
    Additional Drivers

    Here you can see that the only driver available is x64 on my system. Click the x86 checkbox and click OK. You'll be prompted for an INF file - the new printer driver. Now you need to find the Printer Driver...
  2. Go get the 32-bit Driver for your printer. In my case the 32-bit Vista Driver was packaged in a WinZip EXE and it refused to run on this 64-bit system.

    Trick: Because it's a WinZip Self-Extracting Archive, I renamed it from .EXE to a .ZIP file and unzipped it into a folder using the standard Windows unzip facilities..

    Next I pointed the Open File Dialog from before at the folder with the 32-bit Printer's INF files. In my case it was called Drivers so it was obvious. Sometimes you'll have to dig, but the are in there. You'll know you found it when the Additional Drivers dialog looks like this:
    Additional Drivers (2)

Now I can point my XP or Vista machine at the Vista 64 \\QUADPOWER machine and it'll automatically install the correct drivers for the client machine.

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

Bug Migrating Web.config with a browserCaps section to IIS7

August 7, '07 Comments [0] Posted in ASP.NET | Bugs
Sponsored By

When running the "appcmd.exe" tool to migrate an existing Web Application to IIS7, make sure you have a backup of your web.config.

99.999% of the time the changes made are additive, but there is an obscure issue that I bumped into.

Here's some info on the long-ago-deprecated browserCaps section of the web.config:

Using the browserCaps element in the Web.config file to define browsers is deprecated in the .NET Framework 2.0, but it is still supported. The data in this element is merged with the information from the browser definition files (.browser) that is located in the machine-level %SystemRoot%\Microsoft.NET\Framework\version\CONFIG\Browsers folder and any existing application-level App_Browser folders. For more information, see Browser Definition File Schema (browsers Element).

This section was and is used to tell ASP.NET about the capabilities of various browsers, usually mobile ones. The original idea was that it'd be updated a lot by a company called Cyscape but Cyscape has hijacked their own URL and turned it into an upsell for their BrowserHawk product. The community tried to step up, but the workload is huge. There's some good browserCaps sections out there, one from SlingFive a few years back, a valiant attempt to energize the CodeProject community around this issue by Chris Maunder.

As I said, this section is deprecated but supported. The preferred - and easier - way is to use BROWSER files, which are more portable and can be installed with ASPNET_REGBROWSERS.

Back to the migration bug. The format of the old browerCaps section was funky from an XML perspective:

<configuration> 
   <browserCaps>
      <result type="System.Web.HttpBrowserCapabilities, System.Web"/>
        <use var="HTTP_USER_AGENT"/>
              browser=Unknown
              version=0.0
              majorversion=0
              minorversion=0
              frames=false
              tables=false
              cookies=false
              backgroundsounds=false ...etc...

It's totally valid XML, but it's very uncommon to see "mixed nodes" in XML, with an Element, then some text, then an element. In this example the browser=Unknown and all that is just 'tunnelled' in a text node that most folks writing XML processing code would ignore, or not see coming.

It appears that the migration portion of this IIS7 tool...

%systemroot%\system32\inetsrv\APPCMD.EXE migrate config "Default Web Site/DasBlog2"

...toasts these text nodes so that the resulting file is just flat out missing them. This is a common mistake when processing XML that I'm likely guilty of as well.

The Moral and Workaround - Backup your web.config and add this section back after migrating. Of course, this only applies if you're using this kind of obscure section. In our case, DasBlog uses it for Mobile Support.

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.