Scott Hanselman

Googling by Filetype!

February 14, '04 Comments [0] Posted in XML
Sponsored By

Well this will just change my life...I can Google by FileType...Here's a search for all PowerPoints with the word Zen in them:

http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&safe=off&q=%22Zen%22+filetype%3Appt&btnG=Google+Search

Just by putting "Zen" filetype:ppt in the Google search box. Yum.

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

Sheesh, ScottGu, just buy this company already...

February 14, '04 Comments [3] Posted in ASP.NET | Javascript | Internationalization | Bugs | Tools
Sponsored By

I briefly mentioned this 3rd party tool once before, but as I'm using it daily and for the last 4 months, I wanted to post more on it.  (Note: I'm just doing this 'cause I dig it.  I'm not meaning to sound like a shill, but you know me, if it's cool, I tell you.  If it sucks, I say it loud.)

Every once in a while you come upon some cool controls for ASP.NET that you just have to spread the word.  Andy Smith's stuff is like that, you know, and now he works with Robert McLaws at Interscape. Just clever, simple, elegant and few moving parts.  When I find a set of controls that give me elegant and powerful functionality I typically RIP them apart to find out how they did it and how I can learn from them. 

So the fellow I want to talk about is Peter Blum, and the ASP.NET Toolkit is the Validation and More package.

Validation Sucks

We write banking sites and one of the things that is the most time consuming and irritating is the client side validation code.  Banking sites typically have VERY complex business rules that need to be represented in the browser...things like "If this index in this drop down is selected, make sure this checkbox can be checked and require this text in this text box, else show an alert box."  It's the kind of code that you COULD write in custom JavaScript, but getting it to work on every browser is a hassle.  Also, you might write a bunch of code that shows the error messages in an alert box, but then the client says, "this is great, but put it in a table at the end of the page" or "put a dot by each text box that needs to be validated" or "turn each control red when there's an error" or worse, "all of the above."

Microsoft ships 5 validation controls with ASP.NET and they are OK, and produce some pretty basic JavaScript.  Rather than working from these meager beginnings, Peter starts from scratchNow, seriously, pause and drink that in.  The VAM (Validation and More) controls are NOT "more ASP.NET Validation Controls" - they are a complete and total framework in and of themselves.  It's a whole new way of thinking about validation in ASP.NET.  He's basically written a Validation/Action engine in cross-browser Javascript. 

Each of the VAM controls (there's 22) can be manipulated in the ASP.NET Design Mode surface with property pages.  So, for example, you can drop a MultiConditionValidator on the page, add a TextRequiredValidator and a RegularExpressionValidator and associate them with one or more controls like TextBoxes, or Combos.  Then here's the magic: On the client-side an array of actions is generated.  When the form is about to be submitted client-side, VAM uses the powerful eval()-uation features of JavaScript to dynamically validate the page. 

Then, the actions are abstracted from the formatters.  Basically the fact an error occured is SEPARATE from how that error's message will express itself.  So, you might have a string "Please enter a valid Social Security Number" but that can be presented as an Alert Box, a  DHTML layer, a tiny gif with an ALT tag tooltip, a colored textbox, or a flashing graphic (or whatever you want).  Separating activities from presentation from storage... it's "3 tiered" design within a replacement validation framework.  It's so crazy it just might work. :) 

It's generated JavaScript supports IE, IE/MAC, Netscape 6+, Mozilla and Opera.  It also supports isomorphic SERVER-SIDE validation, so if your use bypasses your client-side code, you'll catch them on the server side.  Pretty sweet.

Localization (So few people care...but everyone should)

There's a LOT (most?) of ASP.NET controls out there that just assume that everyone in the world speaks English (or cares to).  I've picked up a few Calendar controls from random places that literally crashed when told to display a different culture.

We have banks live in such out of the way places as Greece, Thailand, and Malaysia.  We need our systems and ASP.NET controls to be fully "culture smart." (PLUG: Come see my Internationalizing ASP.NET Sites at VSLive!)  The VAM validation controls support using ResourceID strings for complete localization of Error Messages.  This culture awareness is throughout the framework, and it's appreciated as I work on banks en español.

JavaScript you DON'T have to write (and ought not be writing)

One cool extra is a concept called a FieldStateController.  From the site:

"The FieldStateController controls can monitor edits and clicks on any type of field on the page. They can use the same Conditions used by validators to determine if a certain condition is met before taking their action. For example, the checkbox must be checked, the textbox must contain some text, or the listbox must have a selection."

You can use any attribute supported in the DOM or in DHTML so changes in the state of one or more fields can change the attributes in an other objects on the page.  This translates to less custom JavaScript that I have to write.

Extensibility

There's a great (and incredibly long) Developer's Guide that explains how you can extend the framework.  For example, I wanted to support entering dates like this "YYYYMMDD" as well as the standard culture-specific "MM/DD/YYYY".   So, I derived from the existing PeterBlum.DateTypeConverter my own CustomScottDateTypeConverter.  It's one class that handles both server and client side validation/conversion.  I added code to handle my new "DataType" and delegated the rest to the base class.  No need to reinvent the wheel.

Freebees

There's also a bunch of freebee features that aren't neccessarily validation related, but are useful to your application. 

  • There's a "TrueBrowser" object model that lets you sniff browser capabilities more easily than the standard BrowserCaps stuff. 
  • There's a FilteredTextBox to limit keystrokes to just decimals, currency or integers.
  • LocalizedLabels - smart string lookup labels for multi-lingual sites.I know

Documentation (When it's good, OH it's good.)

His documentation is obscene.  Like, it's embarassing.  No single developer should write this much documentation.  You'd think there's a separate documentation department.  Probably he's locked his mom in the garage and got her making PDFs.  I mean that in the best way.  Except, he's put me in a bad spot...if I ever start my own company, I need to have doc at least this good...and I'm not sure I want the bar set that high.

Support

We had to call support with a CRAZY threading bug in our 1.02 version of the VAM that happened if two people with the identical browser hit the site within a few milliseconds of each other if that browser has never hit the site before and the site is under exteme load.  (This happened twice in a week, so you get the idea that it's was obscure and not a big deal.)  Anyway, I explained it to Peter and he had already found and fixed it for the next minor version! 

Conclusion

He's got two pricing levels of VAM, and Level 2 (the one that includes all the good stuff) is only $100 and even the Redist or Source Code License is reasonable.  That's insane.  Anyway, check it out.  It's SO rich and SO powerful that it may freak you out as it's overwhelming. Seriously, take a day and spend time with it.  Read the instructions, and read them again. 

The real value for me is that we are using it's extensibility points to extend it WELL beyond it's standard features and firmly into the Financial Vertical I work in.  We've extended and added to the point where it's now the Corillian Validation Framework, and that's just great for us...our job isn't to write validation code, it's to make powerful banking sites.  And that suits me just fine.  Microsoft should buy this guy and integrated the whole thing into ASP.NET 2.x.

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

Happy Birthday INETA - 2 Years

February 13, '04 Comments [2] Posted in INETA
Sponsored By

Happy Birthday to INETA...two years old this month. 

When we launched INETA in February of 2002, .NET was fairly new and we came to the scene with about 40 user groups in our association. Today, we have close to 500 user groups and more than 170,000 members from all over the world that are part of INETA! Our growth is more than anyone ever imagined and outstanding as it is, it is also one of the most difficult things in managing INETA. More growth means more speakers, more support and more volunteers needed. “

Congratulations to Bill Evjen and everyone who makes INETA great, the speakers, the groups, the excitement!

Two years later and my picture still isn't up.  Hm...I wonder if I have wedding picture around...maybe with me in a tux? ;)

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

Debug vs. Release - The Best of Both Worlds

February 13, '04 Comments [4] Posted in ASP.NET | Bugs
Sponsored By

Mark Pearce posted in the comments about my Debug vs. Release post some valuable tips that deserved being shared in a formal post.   Mark reminds us of the little-known little-used [.NET Framework Debugging Control] section of a {gasp} .INI file.  These help guide and control the JIT.  From MSDN:

This JIT configuration has two aspects:

  • You can request the JIT-compiler to generate tracking information. This makes it possible for the debugger to match up a chain of MSIL with its machine code counterpart, and to track where local variables and function arguments are stored.
  • You can request the JIT-compiler to not optimize the resulting machine code.

So Mark suggested this (emphasis mine):

You can have the best of both worlds with a rather neat trick. The major differences between the default debug build and default release build are that when doing a default release build, optimization is turned on and debug symbols are not emitted. So:

Step 1: Change your release config to emit debug symbols. This has virtually no effect on the performance of your app, and is very useful if (when?) you need to debug a release build of your app.

Step 2: Compile using your new release build config, i.e. *with* debug symbols and *with* optimization. Note that 99% of code optimization is done by the JIT compiler, not the language compiler, so read on...

Step 3: Create a text file in your app's folder called xxxx.ini (or dll or whatever), where xxxx is the name of your executable. This text file should initially look like:

[.NET Framework Debugging Control]
GenerateTrackingInfo=0
AllowOptimize=1

Step 4: With these settings, your app runs at full speed. When you want to debug your app by turning on debug tracking and possibly turning off (CIL) code optimization, just use the following settings:

[.NET Framework Debugging Control]
GenerateTrackingInfo=1
AllowOptimize=0

Great stuff Mark!  I'm going to go see how this would work with ASP.NET (do I use an ASPNET_WP.EXE.ini(?) and I'll probably have to recycle the ASP.NET worker process.) 

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

A busy day indeed...let's start with the burning flesh...

February 13, '04 Comments [7] Posted in Musings
Sponsored By

This was an eventful day indeed.  Yesterday I had worn glasses for over 23 years and had vision of -9.25 diopters (roughtly 20/1600 for me).  Basically I couldn't see there was an big "E" on the eye chart until I was about 9 inches from it.  So, after 10 years of research and 5 years of waiting for the right kinds of technology I had LASIK on both eyes over lunch yesterday.

Pretty damned good.  I'm at LEAST 20/25 in both eyes only 19 hours later.  They measured me as ~20/25 this morning.  I think I'm 20/20 in the right eye and 20/25 in the left, but there's still healing to be had.  I was zapped in Oregon by Dr. Teplick who is just about the coolest guy ever.  Seriously, I did a crapload of research into this (considering I'm diabetic, and diabetics have eye problems) and I didn't want to screw around with any beginners.  As far as I'm concerned, he's the only guy to talk to.  If you are thinking about it, check them out and tell them I sent you.

Right now I'm writing this without my glasses, which is a miracle.  I figure I'll be 90% by the end of the week and 100% in a month.  But, considering it was done yesterday over lunch and I worked a full day today is pretty cool. 

Software:

As a computer-type, I have to comment on a few technical things that were interesting to me.

The WaveFront LASIK Eye mapper takes a topographical map of the eye (3-D) to deal with things like astigmatism and odd curvetures and such better than previous technologies.  I had 3 of these by two different doctors, both at Teplick and at my own Eye Doctor's.  Interestingly enough, while it looked like a clever and impressive piece of hardware, something about the title bars smacked wrong with me.  I looked closer (and dinked with it when noone was looking) and dammit if the thing wasn't running Windows 98.  Good thing Microsoft extended support past the time I had my surgery! ;)  A closer look at some other machines by my [also Lasik'ed] boss, Chris Brooks, showed that it was running OS/2.  Seems to me there's some work and sales to be made in the Windows XP Embedded space, no?

Burning:

You know what Lasik's dirty little secret is?  While the operation doesn't hurt at all (eye drops dull the pain) about 3 hours after the operation is hurts like a bastard.  Someone described it as like hot sand poured in your eyes.  I wouldn't disagree.  It was a migraine, a stick in your eye and a sinus headache all at the same time.  Now, mind you I'm not a fan of drugs, so to their credit they DID give me a prescription for Percocet.  I wanted to avoid using any narcotics if possible.  Long story short, it's not possible. :)

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.