Scott Hanselman

Quote of the Day

March 11, '04 Comments [0] Posted in ASP.NET
Sponsored By

Best quote from Windows vs. Linux Security Analysis:
"The scope of this analysis is to demonstrate that so far the subjects who expressed an opinion about the Linux/Windows level of security didn't have any idea of what they where talking about."

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

Internationalization/I18n: Char.IsDigit() matches more than just "0" through "9"

March 10, '04 Comments [5] Posted in ASP.NET | Javascript | Bugs
Sponsored By

Raymond Chen just gave me a "duh" moment, by pointing out the obvious-only-if-you-think-about-it.  Char.IsDigit() doesn't mean 'IsZeroToNineInEnglish', it means 'is in the decimal range of 0 to 9' and darnnit if there aren't other ways (other than 0,1,2,3,4,5,6,7,8,9) to express them! :)

So let's run an experiment.

class Program {
  public static void Main(string[] args) {
    System.Console.WriteLine(
      System.Text.RegularExpressions.Regex.Match(
        "\x0661\x0662\x0663", // "١٢٣"
        "^\\d+$").Success);
    System.Console.WriteLine(
      System.Char.IsDigit('\x0661'));
  }
}

The characters in the string are Arabic digits, but they are still digits, as evidenced by the program output:

True
True
Uh-oh. Do you have this bug in your parameter validation? (More examples..)
If you use a pattern like @"^\d$" to validate that you receive only digits, and then later use System.Int32.Parse() to parse it, then I can hand you some Arabic digits and sit back and watch the fireworks. The Arabic digits will pass your validation expression, but when you get around to using it, boom, you throw a System.FormatException and die.
[Raymond Chen]

Arabic speakers (مرحبًا, كيف حالك ؟ and forgive me, it's been college since I studied Arabic) how to you handle numeric validation in JavaScript AND guarantee that the JavaScript you use on the client-side is semantically equivalent to the server-side code?

Either way, my friends, read, grok, and be enlightened.  Muy interesante.

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

Reminder: Update your RSS Feed Url and check your Smoke Detector Batteries!

March 10, '04 Comments [4] Posted in XML
Sponsored By

Just a friendly reminder.  It applies to me, but it could also apply to other folks.  I shall declare this day "Check your OPML File and Subscriptions Day."

If you are goodly enough to have subscribed (thank you) to my Radio RSS feed (http://radio.weblogs.com/0106747/rss.xml) please update your subscription to point to the updated feed.  I haven't been at Radio for over 6 months.  However, I have continued to update my Radio RSS feed, so you wouldn't have an interrupted experience.

Again, to recap.  Here are my feeds, Coke: RSS 2.0 or, if you like Pepsi, here: Atom 0.2.

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

My TWO .NET Rocks shows are up on MSDN now

March 8, '04 Comments [1] Posted in ASP.NET
Sponsored By

I totally forgot that MSDN is hosting the .NET Rocks shows for download!

Not only can you listen to my second show from last month (thanks Rory and Carl!) but you can also checkout my first attempt from October 2003!

  • Show #2: Carl and Rory talk with Scott Hanselman about ASP.NET, declarative programming, client-side validation, caching, perf testing, blogging trends, and more. [MSDN]
  • Show #1: Scott and Carl chat about .NET, C#, Reflection, Regular Expressions, Freeware, Code Sharing, Config Files, Sockets, Multi-Threaded programming, and a laundry list of Scott's favorite utilities that you just have to check out. [MSDN]

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

More on My Lasik and the Windows 98 Machine that Zapped Me

March 8, '04 Comments [7] Posted in Musings
Sponsored By

My LASIK posts have been ridiculously popular, considering this is a .NET and Programming Blog.  That being said, there were a few blogs that mentioned my surgery and I thought it would be useful for me spend some time in Photoshop and explain to you EXACTLY what I saw, and EXACTLY what I see now.

Here's before, this is -9.25 diopters (roughly 20/1600 for me) and what I saw without glasses for ~20 years.  I adjusted this photo in Photoshop to show represent what I saw before as accurately as possible.

Here's after.  I'm now at LEAST 20/20 (I'll be officially measured this Friday, one month after my operation.  I suspect I'll be 20/15.  Just a hunch.

I adjusted this after picture to show you exactly what I see now.  Note the slight “motion” blur over the lights.  Note the darkness of the background and the bright contrast of the foreground.  

Not to bad for a Windows 98 machine.  One thing to note also.  While it's totally reasonable to worry about this operation, and most folks are concerned that they might never seen well again, I thought it was a reasonable risk.  It IS VERY possible to have side-effects that will result in a loss of best corrected vision.  There's about a 0.04 percent chance using my doctor's stats.  The problem with stats that compare success with failure is that someone has to fail.  I feel really bad for folks that are in that 0.04 percent bucket - having surgery is inherently dangerous. 

That said, I'm happy with the result - more every day - and I will enjoy the next 10 years of vision...before I have to get bi-focals!

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.