Scott Hanselman

Quote of the Day

June 19, '03 Comments [0] Posted in Musings
Sponsored By

Everyone once in a while someone says something that makes me fall off my chair...today:

"Yeah, I heard this new rapper, he says he's the white Eminem."

And dammit if this kid doesn't ACTUALLY EXIST. It's takes some serious grapes to call yourself the White Eminem.  Anyway.

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

Understanding why your updated images don't immediately get served to Browser Clients

June 17, '03 Comments [2] Posted in Web Services | XML | Tools
Sponsored By

This is a complex topic, but here's a cursory explanation:

 

The Web Server, in this case IIS, sets Content Expiration info and information about then things are modified in the HTTP Headers.  If you ask for something from the Web Server, but you say "only if modified since..." they will pass back “Not-Modified” HTTP Headers to the Browser. You can see this even when hitting F5 to refresh the browser if you use a tool like ieHTTPHeaders (http://www.blunck.info/iehttpheaders.html) .  Look at IE Content Expiration in the Properties. 

Most folks like to have a “/images” folder that has SEPARATE Content Expiration settings and static content, or many levels of image volatility.

 

You have a few possible solutions:

 

·         Have volatile (often changing) images stored in one folder and set to expire immediately or on your specific schedule. 

·         Have the Browser user press CTRL-F5 to “blow through the cache”…F5 in IE will NOT fetch updated images until they expire. Pressing CTRL-F5 will keep the browser from including “If-Not-Modified” – which is equivalent to saying “get it anyway.”

·         Check the GET requests of your images in the HTTP Headers to see when they will expire...then wait. ;)

·         If you are generating the images yourself (dynamically generated on the server side) then you control the headers, so you can force updates by writing the appropriate headers yourself.

A picture named image001.jpg

Notice in this screen shot that even though I pressed F5, the Web Server responded “This image hasn’t been modified!”

A picture named image002.jpg

Even more, this request from the browser specified “Only give me this image if it’s been modified since a certain date.”

A picture named image003.jpg

The moral of this story is, you'll never know the WHY of the behavior of your system unless you know both the HOW of the HTTP Spec and the QUIRKY HOW of the browser whose behavior you're examining.

 

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

Schema Versioning

June 17, '03 Comments [2] Posted in Web Services
Sponsored By

Schema Versioning: Changing a namespace is not versioning, it is new type creation. [meta-douglasp]

Ok...I can see that point of view...then does versioning (as we hope to know it) simply not exist in the world of Schema?

Updated Thought: Certainly COM ProgIds like Word.Application.8 isn't "versioning," but rather new Type/Interface creation with versioning by allusion.

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

Where's Juval Lowy?

June 16, '03 Comments [5] Posted in Web Services | TechEd | Speaking
Sponsored By

One of my heros (not cuz he can code, but boy, can he drink!) is Stephen Forte...he stole one of the Flat Juval Lowy Software Legends standups at TechEd (I was going to help, but I wimped out) and proceeded to take it on a whirlwind trip around Texas, including some of the nicer bathrooms...anyway, Stephen's put the pictures up, enjoy.

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

Getting the Line Number and File Name from C#

June 12, '03 Comments [5] Posted in Web Services
Sponsored By

Someone wanted to know what the equivalent "preprocessor macros" in C# are for __FILE__ and __LINE__.  They watned to log the current file name and line number.  Note that the "1" as the first parameter to the StackFrame constructor tells it to skip ONE frame up the stack, while the true tells it to capture the file and line info.

[STAThread]
static void Main(string[] args)
{
     ReportError("Yay!");
}

static private void ReportError(string Message)
{
     StackFrame CallStack =
new StackFrame(1, true);
     Console.Write("Error: " + Message + ", File: " + CallStack.GetFileName() + ", Line: " + CallStack.GetFileLineNumber());
}

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.