Welcome to ExplosiveDog.Com Sign in | Join | Help

ExplosiveDog.Com

My Explosive Blog



Final Blog Entry

This will be my final blog entry on ExplosiveDog.com as I have decided to move my blog to PageBrooks.com

I hope you will join me at my new site! See you there!

Website: http://pagebrooks.com
RSS Feed: http://feeds.pagebrooks.com/pagebrooks

.NET Framework BCL Source Code to be Released!

If you haven't already heard, Microsoft announced today that it will be releasing the source code to many parts of the .NET Framework!  This is awesome news!  With VS 2008, you will be able to browse the .NET Framework symbols on demand and step through them using the debugger.  According to Scott, even source code comments will be intact.  My wife and I were just talking about how transparent Microsoft has become over the years and then I come home and read this!  Awesome!

Silverlight Samples updated for 1.1 (September) Alpha Refresh

The 1.1 (September) Alpha refresh broke my Silverlight Samples.  Fortunately, it was easy to fix the code thanks to this blog post.  I didn't bother recompiling the samples since they appear to work correctly after making a few changes to the javascript files.

http://explosivedog.com/silverlight/binaryclock/
http://explosivedog.com/silverlight/discolights/
http://www.explosivedog.com/silverlight/formsaver/

Registration Open for SC Code Camp 3.0!

Date:  
Saturday, October 13, 2007

Time:  
8:00 AM ET - 5:30 PM ET

Location:
Blackbaud, Inc.
2000 Daniel Island Drive
Charleston, SC 29492-7541

For more information about the SC Code Camp visit:
www.sccodecamp.com

To register, please visit:
southcarolinacodecamp.eventbrite.com

Beware the Content Advisor!

I recently encountered a troublesome issue with a site using ASP.NET Forms Authentication.  A few users would complain of being logged out immediately after logging in.  The only useful evidence I had collected was that the issue only occured in Internet Explorer 6 and 7, this helped some, but it didn't narrow the issue down enough to figure out the problem.   Obviously, the authentication cookie was being deleted immediately after logging in, but why?  Was it some piece of software, maybe, but the issue would still manifest itself when all security software and browser add-ons were disabled.  Then, I discovered that the Content Advisor was enabled on one of the machines that exihibited the problem.  It was time to do some low-level HTTP request debugging with Fiddler!


What I found was interesting:

With content advisor disabled:

-- First Request to login.aspx
/site/log_in.aspx
-- First page after login + sub-requests
/site/default.aspx
/site/css/style.css
/site/js/script.js
...
...

With content advisor enabled:

-- First Request to login.aspx
/site/log_in.aspx
// First page after login + sub-requests
/site/default.aspx
-- Hmmmm, that's strange...extra requests.
/
/site/log_in.aspx

/site/css/style.css
/site/js/script.js
...
...

So, the content advisor makes an extra request?  But why?  It turns out that the content advisor makes extra requests to the root of the site to find the PICS (Platform for Internet Content Selection) ratings for the site.  But why would that cause the user to be logged out?  It turns out that the log_in.aspx page was clearing the user's authentication cookie on non-postback calls.  This wasn't a mistake, it's a good idea to make sure the user has no session if they are about to log in.  So, the bug was easy to fix, but a nightmare to diagnose.

The moral of the story is, be very careful when making assumptions about how requests will be made by browsers!

DiffMerge, Free!?

I was just browsing through Scott Hanselman's updated Ultimate Developer List for 2007 and I noticed that SourceGear DiffMerge is available as a free download now!  Anyone that uses Vault should know about this tool.  It's important to have a diff tool that works well for you.  After all, it should be one of your most frequently used tools.  You do use a diff tool, don't you?! 

Anyway, this is one of the best Diff tools that I have ever used and it's free!

South Carolina Code Camp Date Announced!



The South Carolina Code Camp for 2007 will be held October 13th, 2007 at Blackbaud, Inc. in Charleston, SC.

www.SCCodeCamp.com

Fixing VS 2005 Intellisense

There have been times when my intellisense in Visual Studio has just completely failed.  I tried repairing the install with no luck.  Then I tried completely reinstalling Visual Studio, and to no avail, intellisense was still not working.  So, I started searching around for ways to fix it, and I found a blog that explains how to fix intellisense after installing LINQ in VS 2005.  I hadn't previously installed LINQ but I figured it would still be worth a try.  To my surprise, it worked!  If your intellisense fails in the future, just try following these steps before resorting to a complete reinstall.

What is the Maximum Length of a String?

The theoretical maximum length for a string is Int32.MaxValue since string objects expose the length property which is an Int32.  However, your mileage may vary because you are very likely to run out of memory well before reaching this limit.  Testing this on a fairly new home computer yields a string consisting of 268,435,456 characters, which is well shy of the theoretical max (1,879,048,191 characters shy to be exact). 

So, why is this important?  This is important because you should not treat the string data type as a boundless container for your data.  When you assign that data to a string, it has to go somewhere.  You cannot read enormous files into a string and expect it to work for every case, especially when computers have such diverse hardware.  This may seem obvious to you, but I've seen actual production code in a past experience that attempts to load an entire 300 MB file into one string variable for processing.  The application was terribly slow and guess what the answer was when the application started throwing Out of Memory Exceptions?  

"You need to add more RAM, 4GB just isn't enough."

The next time you are working and this runs across your mind, think about it for a minute.  If you are approaching the limits of your data type, you probably need to figure out a different approach the problem at hand, and adding hardware is not the answer.

Silverlight Isolated Storage

Silverlight has a special version of Isolated Storage which opens up some interesting scenarios when it comes to persistence.  One interesting scenario would be to allow a user to save a draft of a form so they could come back later and fill out the rest of the form.  The cool thing is that once you persist the data, it doesn't matter which browser you use when you come back to the form at a later point in time.  In other words, you could fill out a form using Internet Explorer and then open Firefox at a later point in time and continue with your work (as long as the same machine is used).  The following snippet demonstrates how easy it is to save data to Isolated Storage:

using (IsolatedStorageFile isoFile = IsolatedStorageFile.GetUserStoreForApplication()) { using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream(m_fileName, FileMode.Create, isoFile)) { using (StreamWriter sw = new StreamWriter(isoStream)) { sw.Write(SerializeElements()); } } }


Retrieving the data is just as easy:

using (IsolatedStorageFile isoFile = IsolatedStorageFile.GetUserStoreForApplication()) { using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream(m_fileName, FileMode.OpenOrCreate, isoFile)) { using (StreamReader sr = new StreamReader(isoStream)) { data = sr.ReadToEnd(); } } }


I've created a simple form saver demonstration application to illustrate the concept.

View Live Demo

Download Source Code




Silverlight Disco

My next Silverlight demo is a disco dance floor.  The floor spins while the squares change colors randomly. The execution is very smooth and fast, I'm sure the performance of the client-side runtime will only improve as future releases arrive.  I'll post the code for this demo and the binary clock very soon.  I need a chance to refactor  the code a bit.

Again, you will need to download the browser plugin to correctly view the demo.






Something almost as annoying as the BLINK tag.

Want a great way to annoy your users and ensure that they avoid your site in the future?  Just do what Weather.com does and allow your advertisements to attach silly little glyphs to your mouse cursor.  What is that thing anyway?!?  I'm switching back to NOAA.

Figure 1.0 (The Cursor Gnome)

The Cursor Gnome

Silverlight Binary Clock

I just finished up my first Silverlight application.  This application is a simple Binary Clock inspired by the clock that sits on my desk at work.  It's quite useless, but it did help me get some practice with Silverlight.  So far, my experience with Silverlight has been fun, the debugging experience is rather painful at this stage.  I am hoping that this will improve.  I'm also guessing the Timer class has not been included in this release of Silverlight.  I had to hack together a timer by repeatedly playing a 1 sec. storyboard.  It seems to work, but it's ugly!  If anyone knows of a better way to implement a timer, please let me know!  I'll probably post the code sometime later this week.

Keep in mind that you will need to download the browser plugin to correctly view the binary clock demo.

Various Silverlight Resources

I've got a growing list of Silverlight resources.  I thought I would post a few that I've found to be useful:

Microsoft Silverlight Web Site
Silverlight Reference Poster
Silverlight Airlines Live Demo
Lutz Roeder's C# Silverlight Demos

Orcas Beta 1 Download
Orcas Beta 1 Team Suite Download (Virtual PC Version)
Downloadable Mix07 Sessions

Silverlight and .NET - This is HUGE!

Incase you've missed the announcement, Silverlight (previously known as wpf/e) is a new technology that will empower developers to create rich Internet applications.  These applications will run on various platforms (Windows, Mac) from a web browser (IE, Firefox, Safari) using an easy-to-install browser plug-in.  You may ask yourself, how is that any different from Flash?  Well, the difference is enormous.  Let me outline why:

  1. The applications can utilize a subset of the .NET framework using the developer's managed language of choice (C#, VB.NET, etc...).  Let me re-iterate that.  You can now take advantage of managed code on the CLIENT SIDE on platforms that do not have the .NET Framework installed!
  2. The managed code can interop with the HTML elements on the page.
  3. JavaScript can interop with the managed code on the client side.
  4. Communication with Web Services and WCF services is possible.
  5. XAML can be used to provide the UI.  Telerik is already working on a set of controls for Silverlight.
  6. Isolated Storage is available to applications (up to 1MB)


There are more features to Silverlight that I will not mention at this time.  But the above list outlines why this is such an important announcement.  Visit the Silverlight web site for more information on getting started.

More Posts Next page »