Scott Hanselman

And the site launching continues...Microsoft eLearning

April 19, '05 Comments [2] Posted in Learning .NET | Javascript | XML
Sponsored By

ElearningYou know, you'd think Microsoft was really serious about this whole MSDN thing, eh?  :)

I've been really impressed with the vast (and useful) amount of content that's been produced on MSDN over the last several weeks.

There's a new Developer eLearning site on MSDN. The contest ain't too shabby, either. A 50" Plasma WEGA HDTV. Yes, please.

I liked their style as well:

"Our contest grabs your attention - Our content will keep you coming back"

They've got some slick new JavaScript-based (IE-only) courseware, like this one on Windows 64-bit. Apparently there's a number of new classes on Windows Server 2003 coming soon.

All this, and an RSS Feed? Subscribed.

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

Coding4Fun is LIVE! - A new syndicated MSDN Column

April 18, '05 Comments [13] Posted in Coding4Fun | XML | Gaming
Sponsored By

I can finally tell my little secret. I'm a part of the new Coding4Fun site that was launched as a part of Beta2 today.

Coding4Fun is a new .NET 2.0-focused hobbyist site with a number of great syndicated columns including ones on creating games, web development, XML and my new column on interfacing with hardware called Some Assembly Required. (It's a triple play on words if you think for a sec)

My first article is on interfacing a CrystalFontz USB LCD Display to Windows Media Player or iTunes using .NET 2.0.

There's a lot of great code up there now, and lots more coming. I'm pretty impressed with the 'Express' SKUs for Visual Studio, and I hope they will inspire more hobbyist developers to jump in and enjoy.

Updated: Here's an RSS Feed.

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

Converting from a String Representation of a Unicode Character back into a char

April 18, '05 Comments [4] Posted in Internationalization
Sponsored By

Hopefully Michael Kaplan will step in here and explain some edge case or just a general comment like "that's totally wrong, Scott" - but until he does:

A fellow emailed me this question:

I want to convert a string representation of a Unicode character back into a 'char' in .NET C#.  Can you help?
 
i.e."U+0041" which is Hexidecimal for 65 which is ASCII for "A"
 
There's got to be a built in function(s) for this, and I just can't seem to find them?
 
To give you an idea, the pseudocode would be something like:
 
string s = "U+0041";
char c = new ?Unicode.Decoder.Decode?(s);
textBox1.Text = c.ToString();

Now, I have no idea why this gentleman would want to do this, but it's interesting enough. Here's what I came up with. I'm sure there's a better way.

//Just a reminder that you can use \u to escape Unicode in C#
char c = '\u0063';
Console.WriteLine(c.ToString());

//Here's how you'd go from a string to stuff like
// U+0053 U+0063 U+006f
string scott = "Scott and the letter c";
foreach(char s in scott)
{
	Console.Write("U+{0:x4} ",(int)s);
}
		
//Here's how converted a string (assuming it starts with U+)
// containing the representation of a char
// back to a char
// Is there a built in, or cleaner way? Would this work in Chinese?
string maybeC = "U+0063";
int p = int.Parse(maybeC.Substring(2), System.Globalization.NumberStyles.HexNumber);
Console.WriteLine((char)p);

Now playing: Craig Armstrong - Ray's Theme

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

Date.ParseExact and the subtle goo that is DateTime Format Strings

April 15, '05 Comments [5] Posted in Internationalization
Sponsored By

We recently needed to parse this evil. 

string poop = "2005-12-14T14:35:32.1700000-07:00";
DateTime poo = DateTime.ParseExact(poop,"yyyy-MM-ddTHH:mm:ss.fffffffzzz", System.Globalization.CultureInfo.InvariantCulture);

Important Notes:

  • HH means 24 hour time, hh means 12 hour time.
    • Don't do all your testing in the morning of a one digit month on a one digit day. 11:59pm on New Years Eve is an important test case.
    • If I'd have tested with 01:01:01 then using lower case h's would have worked, but would have broken this afternoon.
  • zzz means TimeZone offset like -07:00
  • When doing a ParseExact and then round-tripping with a ToString using the same format string will NOT result in the same string.
    • That means that:
      DateTime foo = DateTime.ParseExact(poo,"yyyy-MM-ddTHH:mm:ss.fffffffzzz", System.Globalization.CultureInfo.InvariantCulture);
      foo.ToString("yyyy-MM-ddTHH:mm:ss.fffffffzzz") == "2005-12-14T13:35:32.1700000-08:00"
      However, the semantics of the DateTime is the same.
  • fffffff means 7 digits of fractional seconds
  • T (in this context) has no specific meaning (it’s not reserved) so it is treated as a literal.
  • System.Globalization.CultureInfo.InvariantCulture is almost always necessary when you’re working in a non-UI context.
    • Don't get screwed when your application doesn't work when installed on an international version of Windows. 

 

 

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

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

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.