Scott Hanselman

Longhorn Indigo Samples

December 5, '03 Comments [1] Posted in Longhorn | ASP.NET
Sponsored By

Thanks to everyone who attended my Longhorn Talk at PADNUG yesterday.  It turned out to be a very Avalon-y/WinFS-y night, so we didn't talk a lot about Indigo.  But, thanks to Yasser, I know now that you can download ALL the Sample Code for Indigo at the Longhorn MSDN SDK.

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

How to mount ISO CDROM files as Virtual Drives - Virtual CD ISO Image Mounter

December 5, '03 Comments [3] Posted in XML | Tools
Sponsored By

I get a LOT of email about the missing link in my Ultimate Tools list wondering how to Mount ISO files.  Apparently, now it's distributable, and you can get it from Microsoft: Virtual CD-ROM Control Panel for Windows XP.  Damned useful, especially when you have 200+ Gigs of ISO files. :)

The following tool for Windows XP allows image files to be mounted virtually as CD-ROM devices. This tool is provided here for your convenience, and is unsupported by Microsoft Product Support Services.

(Via Mike Gunderloy on win_tech_off_topic - this tool is pointed to on the MSDN subscriptions FAQ page - click on "What are ISO image files and how do I use them?" and the link is near the bottom of that section.)
[Via Adrian Bateman (VisionTech)]

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

PacMan written entirely in Excel...

December 5, '03 Comments [0] Posted in Gaming
Sponsored By

When you can write nearly perfect versions of PacMan and Space Invaders in your favorite productivity application, you know it's crossed the boundary. Of course, treating cells like pixels and implementing the game by changing the background colors probably wasn't what the Excel developers had in mind, but frankly, that's not much different than what the guys writing the original games had to deal with. Wow. [SellsBrothers]

This proves my point that 80% of the world's business logic runs in Excel.  Perhaps most of the Video Games also do...and we just never noticed?  Splinter ExCell anyone?

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

XmlSerializer Madness: The Guts and the Conclusion

December 5, '03 Comments [1] Posted in XmlSerializer
Sponsored By

Looks like a little bit of wisdom from Kevin Dente has solved the mystery.

He sez:

A little Reflectoring into the XMLSerializer source shows that in .NET 1.1 it caches the temp assembly using both the type and default namespace as the key. However, 1.0 cached only on the type, and if you specified a namespace it ignored the cache. And it looks like even in 1.1 the other constructor overloads ignore the cache. Good to know.

And the reflectoring shows just that: (Note the Monitor.Enter [lock()] around their cache)

public XmlSerializer(Type type, string defaultNamespace){ 
  XmlReflectionImporter importer1;
  TempAssemblyCache cache1;
  this.events = 0;
  base..ctor();
  this.events.sender = this;
  this.tempAssembly = XmlSerializer.cache[defaultNamespace, type];
  if (this.tempAssembly == null){
    cache1 = XmlSerializer.cache;
    Monitor.Enter(XmlSerializer.cache);
    try{
       this.tempAssembly = XmlSerializer.cache[defaultNamespace, type];
       if (this.tempAssembly == null){
          importer1 = new XmlReflectionImporter(defaultNamespace);
          this.tempAssembly = XmlSerializer.GenerateTempAssembly(importer1.ImportTypeMapping(type));
          XmlSerializer.cache.Add(defaultNamespace, type, this.tempAssembly);
     }
}
finally{  Monitor.Exit(cache1); } } }

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

XmlSerializers Part II: Am I Insane?

December 5, '03 Comments [2] Posted in XmlSerializer | Web Services
Sponsored By

Simon Fell's comment regarding my XmlSerializer quandry got me thinking.  He said the obvious:

Only creating the first instance for a particular type is expensive after the first instance there is no overhead.

However, I SWEAR I saw different performance under 1.0.  Has something changed in 1.1?  Time to pull out a copy of .NET 1.0 and run my tests again.

Running with .NET runtime version 1.1.4322.573.
Took 00:00:00.4531163 ms to create 10000 serializers without pre-initializing.
Took 00:00:00.2499952 ms to create the first serializer.
Took 00:00:00.0312494 ms to create 10000 serializers after pre-initializing the first one.

So, perhaps my whole caching XmlSerializerFactory was sillyness, and I was trying to work around some odd behavior that existed in 1.0.  OR, some behavior that existed purely as an artifact of my previous app.

BUT: Joseph Cooney says:

The XmlSerializer has a number of constructors. If you use any of the constructors other than the one that takes a type (for example specify a type and a default namespace) then a new temporary assembly is created EVERY TIME you create a serializer, rather than only once. I can post some code to demonstrate this if you like.

Maybe that's it, and it would make sense.  The basic constructors would allow the generated type & assembly to hang out.  The others would mean that namespace passed in could come from anywhere (it could be highly variable, while the type wouldn't be)...so, they'd just punt and make a new assembly each time.

Either way, this GOOF goes to show - measure.  Don't assume like I did.  I'm off to figure this out...

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.