<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Eron Wright - All Killer No Filler</title>
        <link>http://geekswithblogs.net/ewright/Default.aspx</link>
        <description>blog</description>
        <language>en-US</language>
        <copyright>Eron Wright</copyright>
        <managingEditor>ewright@point2.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <image>
            <title>Eron Wright - All Killer No Filler</title>
            <url>http://geekswithblogs.net/images/RSS2Image.gif</url>
            <link>http://geekswithblogs.net/ewright/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>New Blog</title>
            <link>http://geekswithblogs.net/ewright/archive/2006/03/21/72966.aspx</link>
            <description>&lt;P&gt;Join me at &lt;A href="http://spaces.msn.com/ewright/"&gt;my new blog&lt;/A&gt; at MSN Spaces.&amp;nbsp; Thanks geekswithblogs for the solid hosting; I plan to leave these posts up here until Spaces can import them in some magical future.&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=72966"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=72966" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/72966.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2006/03/21/72966.aspx</guid>
            <pubDate>Wed, 22 Mar 2006 03:19:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/72966.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2006/03/21/72966.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/72966.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/72966.aspx</trackback:ping>
        </item>
        <item>
            <title>C#: Properties versus getter methods</title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2004/05/02/4537.aspx</link>
            <description>&lt;P&gt;You might be wondering why some classes in the .NET Framework have properties, other classes have&amp;nbsp;GetXXX&amp;nbsp;methods, and some have a combination of the two.&amp;nbsp;&amp;nbsp;The reason is that the semantic, or meaning,&amp;nbsp;is quite different.&lt;/P&gt;
&lt;P&gt;Consider this class:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;public class Customer&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;public int CustomerID;&lt;BR&gt;&amp;nbsp;public string FirstName;&lt;BR&gt;&amp;nbsp;public string LastName;&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;public Order[] GetOrders()&lt;BR&gt;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;// do database work&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;The&amp;nbsp;CustomerID, FirstName, and LastName represent the customer state.&amp;nbsp; The orders&amp;nbsp;are&amp;nbsp;&lt;EM&gt;derived from&lt;/EM&gt;&amp;nbsp;the customer state using GetOrders().&amp;nbsp; In fact I do not support having method like this because it presumes that a canonical representation of Order exists.&amp;nbsp; That's another topic.&amp;nbsp; &lt;/P&gt;
&lt;P dir=ltr&gt;A great rule-of-thumb regarding properties is to consider that the Visual Studio debugger executes the getter method when watching an object.&amp;nbsp; That is, property accessors are executed at unpredictable times and should&amp;nbsp;thus not cause any discernable side-effects.&amp;nbsp; Abusing properties can lead to &lt;A href="http://en.wikipedia.org/wiki/Heisenbug"&gt;heisenbugs&lt;/A&gt;.&lt;/P&gt;
&lt;P dir=ltr&gt;Another reason to use a method is that order retrieval is likely to be parameterized.&lt;/P&gt;
&lt;P dir=ltr&gt;Finally, a good practice is for property access to be computationally&amp;nbsp;cheap; client code should not be forced to place the property value into a local variable - it's premature optimization.&amp;nbsp; Expensive code should be placed in methods - client code is sure to store and reuse the result.&amp;nbsp; The exception is if the property getter method caches the result in a private field, which can be a challenge as the class instance is mutated.&lt;/P&gt;
&lt;P dir=ltr&gt;The property syntax in .NET languages is not syntactic sugar.&amp;nbsp; It adds considerable richness to classes.&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=4537"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=4537" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/4537.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2004/05/02/4537.aspx</guid>
            <pubDate>Sun, 02 May 2004 13:18:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/4537.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2004/05/02/4537.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/4537.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/4537.aspx</trackback:ping>
        </item>
        <item>
            <title>Working with Query Analyzer and FOR XML</title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2004/09/15/11230.aspx</link>
            <description>&lt;P&gt;If you work with SQL Server 2000 and FOR XML functionality, you curse Query Analyzer probably as often as I do.&amp;nbsp; Here are some tips for improving the output:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;In QA, set &amp;#8220;Maximum Characters per Column&amp;#8221; setting to 2033&lt;/LI&gt;
&lt;LI&gt;Execute DBCC TRACEON(257) to pretty-print the XML output&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;A href="http://www.winnetmag.com/SQLServer/Article/ArticleID/20698/20698.html"&gt;http://www.winnetmag.com/SQLServer/Article/ArticleID/20698/20698.html&lt;/A&gt;&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=11230"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=11230" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/11230.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2004/09/15/11230.aspx</guid>
            <pubDate>Wed, 15 Sep 2004 19:40:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/11230.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2004/09/15/11230.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/11230.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/11230.aspx</trackback:ping>
        </item>
        <item>
            <title>UTC datetime values in SQL Server 2000</title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2004/09/14/11180.aspx</link>
            <description>&lt;P&gt;You can convert local datetime values to UTC datetime values, and vice-versa, using the built-in GETUTCDATE() function:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;DECLARE @LocalDate DATETIME&lt;BR&gt;SET @LocalDate = GETDATE()&lt;/P&gt;
&lt;P&gt;-- convert local date to utc date&lt;BR&gt;DECLARE @UTCDate DATETIME&lt;BR&gt;SET @UTCDate = DATEADD(Hour, DATEDIFF(Hour, GETUTCDATE(), GETDATE()), @LocalDate)&lt;/P&gt;
&lt;P&gt;-- convert utc date to local date&lt;BR&gt;DECLARE @LocalDate2 DATETIME&lt;BR&gt;SET @LocalDate2 = DATEADD(Hour, DATEDIFF(Hour, GETDATE(), GETUTCDATE()), @UTCDate)&lt;/P&gt;
&lt;P&gt;SELECT @LocalDate, @UTCDate, @LocalDate2&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Note that GETUTCDATE() returns the current datetime in UTC.&amp;nbsp; By comparing the value with GETDATE() we can determine the time zone, which can then be used to adjust any date.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;I tried to bake these expressions into a set of user-defined functions, but SQL Server complained because user-defined functions cannot call non-deterministic functions (in this case GETDATE()/GETUTCDATE()).&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=11180"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=11180" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/11180.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2004/09/14/11180.aspx</guid>
            <pubDate>Wed, 15 Sep 2004 04:35:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/11180.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2004/09/14/11180.aspx#feedback</comments>
            <slash:comments>13</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/11180.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/11180.aspx</trackback:ping>
        </item>
        <item>
            <title>Use C# comment styles to your advantage</title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2004/05/27/5455.aspx</link>
            <description>&lt;P&gt;Comments within a C# method body tend to A) make a problem statement then B) document the steps to solve the problem.&amp;nbsp; The problem statements tend to be multi-line; the details of the solution tend to be single-line.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;I want the problem statements to stand out.&amp;nbsp; Traditionally I use #region blocks to group the problems.&amp;nbsp; Unfortunately, regions are single-line.&amp;nbsp; They are also slightly more laborous to construct.&lt;/P&gt;
&lt;P&gt;Lately I have been using a triple-slash comment block at the top of the method body to state the problem:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;/// &amp;lt;summary&amp;gt;&lt;BR&gt;/// Occurs when the page loads.&lt;BR&gt;/// &amp;lt;/summary&amp;gt;&lt;BR&gt;private void Page_Load(object sender, System.EventArgs e)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// Configure the http response to return a correct set of &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// cache headers. Validation headers must also be returned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // set the etag&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.Response.Cache.SetETag("055aba934a3c21:380");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // set the cache policy&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.Response.Cache.SetCacheability(HttpCacheability.Public);&lt;BR&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Another reason to use the triple-slash comment block within&amp;nbsp;a method body, as opposed to the &amp;lt;remarks&amp;gt; block, &amp;nbsp;is that it does not form a part of the API documentation.&amp;nbsp;&amp;nbsp;That is, the client-supplier relationship plays a role here.&amp;nbsp;&amp;nbsp;It is desirable to separate &lt;EM&gt;interface&lt;/EM&gt; documentation from &lt;EM&gt;implementation&lt;/EM&gt; documentation - they are intended for&amp;nbsp;two different audiences. For a given method the external documentation should be placed in a &amp;lt;remarks&amp;gt; block above the method declaration; the internal documentation should be placed in triple-comment blocks at the top of the method body.&amp;nbsp; It will naturally stand out from the implementation specifics.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;This approach works better than using /* */-style comments blocks because such comments cannot be nested.&lt;/P&gt;
&lt;P&gt;Incidentally, VS.NET has a handy button on the&amp;nbsp;Text Editor toolbar to comment out the selected lines.&amp;nbsp; It adds double-slash comments at the extreme left side.&amp;nbsp; A complementary button exists that will&amp;nbsp;uncomment the&amp;nbsp;selected lines. &amp;nbsp;It seems&amp;nbsp;that&amp;nbsp;left-justified comments&amp;nbsp;are reserved for commenting-out &lt;EM&gt;code&lt;/EM&gt;, not documentation.&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=5455"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=5455" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/5455.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2004/05/27/5455.aspx</guid>
            <pubDate>Thu, 27 May 2004 11:46:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/5455.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2004/05/27/5455.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/5455.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/5455.aspx</trackback:ping>
        </item>
        <item>
            <title>HTTP GET Idempotence and ASP.NET</title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2004/05/26/5414.aspx</link>
            <description>&lt;P&gt;I am struck by the consequences of the experience Craig relates in this post:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://staff.develop.com/candera/weblog2/CommentView.aspx?guid=54fd1ed8-ea12-4555-9ee3-4f9e3d57907e"&gt;http://staff.develop.com/candera/weblog2/CommentView.aspx?guid=54fd1ed8-ea12-4555-9ee3-4f9e3d57907e&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;He is discussing a Wiki site that mysteriously had its page content rolled back to a previous version.&amp;nbsp; Wiki pages generally contain a link to do this, and it is assumed that a human would follow it with caution.&amp;nbsp; Turns out that GoogleBot crawled the site and what-do-you-know the content rolled back.&amp;nbsp; The underlying problem was that a GET request caused a significant side effect, in this case altering the content of the linking page.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;The HTTP specification recommends that GET requests are idempotent, which means that a given action is performed once even if it invoked numerous times.&amp;nbsp; The intent is that GETs are &amp;#8220;safe and repeatable&amp;#8221;.&amp;nbsp; That is, it should be safe for a crawler to invoke any GET request (subject to authorization of course).&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This bears on the question of how to best use ASP.NET controls, notably the data controls where you might attempt to optimize ViewState by eliminating postbacks and changing buttons to hyperlinks.&amp;nbsp; Note that the LinkButton is safe because it causes a postback.&amp;nbsp; You can also probably get away with using a form with method=GET because a spider is unlikely to submit a form (even one based on GET), but I don't recommend it.&lt;/P&gt;
&lt;P&gt;I traditionally replace postbacks with links to optimize ViewState, as opposed to &amp;#8220;simply&amp;#8221; disabling ViewState, because a race condition exists&amp;nbsp;if you do not have a DataKeys collection that is consistent before and after the postback.&amp;nbsp; The race is that the resultset might have changed in the meantime, and the action would thus be carried out on the wrong data key.&amp;nbsp; That is, you would be operating purely by ordinal.&amp;nbsp; So, with this idempotence revelation I am back to square one with optimizing DataGrids.&amp;nbsp; &lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=5414"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=5414" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/5414.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2004/05/26/5414.aspx</guid>
            <pubDate>Wed, 26 May 2004 17:40:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/5414.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2004/05/26/5414.aspx#feedback</comments>
            <slash:comments>6</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/5414.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/5414.aspx</trackback:ping>
        </item>
        <item>
            <title>C#: try..catch Usage </title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2004/04/16/3985.aspx</link>
            <description>&lt;P&gt;When catching an exception in C# you need not declare a variable for the exception instance if you do not need&amp;nbsp;it.&amp;nbsp; This will avoid the &amp;#8220;unused variable&amp;#8221; warning.&amp;nbsp; &lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;PRE&gt;try { /* ... */ }
catch(Exception) // catches without assigning to a variable
{
    // ...
}
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Here is how to rethrow an exception without affecting the stack trace: 
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;PRE&gt;try { /* ... */ }
catch(System.Data.SqlClient.SqlException ex)
{
    if(ex.Number==2627) { /* special case for primary key violation */ }
    else throw;   // rethrows without affecting the stack trace
    // else throw ex; // rethrows with the stack trace reset to this line
}
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=3985"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=3985" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/3985.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2004/04/16/3985.aspx</guid>
            <pubDate>Fri, 16 Apr 2004 14:41:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/3985.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2004/04/16/3985.aspx#feedback</comments>
            <slash:comments>17</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/3985.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/3985.aspx</trackback:ping>
        </item>
        <item>
            <title>Shell Extensions with .NET</title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2004/04/10/3773.aspx</link>
            <description>&lt;P&gt;Edamno has released a&amp;nbsp;VB.NET library for creating various shell extensions&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Browser Helper Objects&lt;/LI&gt;
&lt;LI&gt;Context Menu Handlers&lt;/LI&gt;
&lt;LI&gt;IE Menu Buttons&lt;/LI&gt;
&lt;LI&gt;InfoTips&lt;/LI&gt;
&lt;LI&gt;Property Sheets&lt;/LI&gt;
&lt;LI&gt;Thumbnails&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A href="http://www.mvps.org/emorcillo/dotnet/shell/shellextensions.shtml"&gt;http://www.mvps.org/emorcillo/dotnet/shell/shellextensions.shtml&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;He also has a library for working with Windows Task Scheduler, and, most importantly, a library for working with OLE Structured Storage.&amp;nbsp; Now you can read and write the author and comments associated with a file!&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=3773"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=3773" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/3773.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2004/04/10/3773.aspx</guid>
            <pubDate>Sat, 10 Apr 2004 13:52:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/3773.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2004/04/10/3773.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/3773.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/3773.aspx</trackback:ping>
        </item>
        <item>
            <title>Matching Parenthesis Pairs Using Regular Expressions</title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2004/03/29/3499.aspx</link>
            <description>&lt;P&gt;It is a known hard problem to match nested parenthesis pairs using regular expressions.&amp;nbsp;&amp;nbsp;Put another way,&amp;nbsp;regular expressions&amp;nbsp;to not typically support counting occurrences.&amp;nbsp; .NET has a little-known RegEx construct for doing just that called the &amp;#8220;balancing group definition&amp;#8220;:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;Balancing group definition. Deletes the definition of the previously defined group &lt;I&gt;name2&lt;/I&gt; and stores in group &lt;I&gt;name1 &lt;/I&gt;the interval between the previously defined &lt;I&gt;name2&lt;/I&gt; group and the current group. If no group &lt;I&gt;name2&lt;/I&gt; is defined, the match backtracks. Because deleting the last definition of &lt;I&gt;name2&lt;/I&gt; reveals the previous definition of &lt;I&gt;name2,&lt;/I&gt; this construct allows the stack of captures for group &lt;I&gt;name2 &lt;/I&gt;to be used as a counter for keeping track of nested constructs such as parentheses. In this construct, &lt;I&gt;name1 &lt;/I&gt;is optional. You can use single quotes instead of angle brackets; for example, &lt;CODE class=ce&gt;(?'name1-name2')&lt;/CODE&gt;.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I found great information on using the balancing group definition here:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.oreilly.com/catalog/regex2/chapter/index.html"&gt;http://www.oreilly.com/catalog/regex2/chapter/index.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpcongroupingconstructs.asp?frame=true"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpcongroupingconstructs.asp?frame=true&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;In my opinion this construct&amp;nbsp;greatly enhances the utility of regular expressions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=3499"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=3499" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/3499.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2004/03/29/3499.aspx</guid>
            <pubDate>Mon, 29 Mar 2004 17:01:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/3499.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2004/03/29/3499.aspx#feedback</comments>
            <slash:comments>7</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/3499.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/3499.aspx</trackback:ping>
        </item>
        <item>
            <title>ASP.NET - files handles are kept open for each directory in Request.PhysicalPath</title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2004/03/02/2488.aspx</link>
            <description>&lt;P&gt;If you are using IHttpHandlers to serve dynamic content, or generating a large directory structure to be served statically, here is some information you should know.&lt;/P&gt;
&lt;P&gt;We use a custom&amp;nbsp;IHttpHandler to dynamically serve (and cache) images from our database.&amp;nbsp; For simplicity, the handler uses Request.PhysicalPath as the ultimate cache location.&amp;nbsp; That is, a url&amp;nbsp;&amp;#8220;~/cache/123/1-Large.image&amp;#8220; is mapped to &amp;#8220;&amp;lt;path to application root&amp;gt;\cache\123\1-Large.jpg&amp;#8220; by the handler.&amp;nbsp; If the file exists, it is served, otherwise it is read from the database, cached to the local file, then served. The '123' directory is created on-demand.&lt;/P&gt;
&lt;P&gt;The main advantage of using Request.PhysicalPath is that no&amp;nbsp;configuration parameter is needed&amp;nbsp;to indicate the cache base path.&amp;nbsp; Also it is highly performant on a cache hit.&lt;/P&gt;
&lt;P&gt;Recently we ran a utility program called &lt;EM&gt;&lt;A href="http://www.sysinternals.com/ntw2k/freeware/handle.shtml"&gt;Handle&lt;/A&gt;&lt;/EM&gt; against our production web servers.&amp;nbsp; &lt;EM&gt;Handle&lt;/EM&gt; emits a list&amp;nbsp;of open file/directory handles.&amp;nbsp; We noticed that each directory involved in&amp;nbsp;a request to the image handler had an open file handle!&amp;nbsp; That is, '&amp;#8220;&amp;lt;path to application root&amp;gt;\cache\123' is open.&lt;/P&gt;
&lt;P&gt;The reason is that ASP.NET sets up a FileMonitor for each directory, to monitor for web.config files should one be created.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;We simply stopped using Request.PhysicalPath and turned to mapping the request path to a private cache directory.&amp;nbsp; Since the monitor is only set up for existing directories, so it is safe to use a handler in this way, so long as the underlying 'natural' directory structure is not created.&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=2488"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=2488" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/2488.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2004/03/02/2488.aspx</guid>
            <pubDate>Tue, 02 Mar 2004 10:42:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/2488.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2004/03/02/2488.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/2488.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/2488.aspx</trackback:ping>
        </item>
        <item>
            <title>Indigo - use of HttpContext.Current.Server.MapPath</title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2004/02/29/2445.aspx</link>
            <description>&lt;P&gt;I have heard Don Box speak about the caviats of using the Indigo service model.&amp;nbsp; He states that service classes should not use transport-specific API - notably the use of HttpContext.&amp;nbsp; The logic is obvious.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;The problem is that my ASMX web services must often use XSD files that are in the same directory as the ASMX file. HttpContext.Current.Server.MapPath is used to resolve to a local path.&amp;nbsp; What is the recommended API for doing such resolution without HttpContext?&amp;nbsp; Don, your comments would be appreciated.&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=2445"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=2445" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/2445.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2004/02/29/2445.aspx</guid>
            <pubDate>Sun, 29 Feb 2004 12:00:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/2445.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2004/02/29/2445.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/2445.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/2445.aspx</trackback:ping>
        </item>
        <item>
            <title>Code Generation for .NET - Enhance the output of XSD.EXE and WSDL.EXE</title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2004/02/29/2443.aspx</link>
            <description>&lt;P&gt;Have you wondered how the XSD tool and the WSDL tool in the .NET Framework can target numerous managed languages?&amp;nbsp; Internally, it uses a great technology called CodeDOM. CodeDOM is a set of classes in the .NET Framework that facilitate code generation. Here is a sample of CodeDOM in action, generating an Order class.&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;using System;&lt;BR&gt;using System.CodeDom;&lt;BR&gt;using System.Reflection;&lt;BR&gt;public class CodeGenerator {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void GenerateOrderType() {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // declare an "Order" type&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CodeTypeDeclaration decl = new CodeTypeDeclaration("Order");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // implement ICloneable&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; decl.BaseTypes.Add(typeof(ICloneable));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // add a field&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; decl.Members.Add(new CodeMemberField(typeof(int), "OrderID"));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The XSD tool builds up a CodeDOM compile unit describing the classes to be generated, then instantiates a CodeDOM provider to generate source code in a specific language. Providers exist for many .NET Framework languages. The tool supports a command-line switch to specify the desired CodeDOM provider. &lt;/P&gt;
&lt;P&gt;By writing a custom CodeDOM provider, we can augment the generated classes with great features -&amp;nbsp;replace fields with&amp;nbsp;properties, replace arrays with strong collections, implement IClonable, generate IComparer instances, and more!&amp;nbsp; &lt;/P&gt;
&lt;P&gt;At Point2 I wrote an extensive library to do just that.&amp;nbsp; We recently shared-sourced it here: &lt;A href="http://www.gotdotnet.com/Community/Workspaces/Workspace.aspx?id=80258a8c-bb4c-48e6-948b-05f6da568f55"&gt;http://www.gotdotnet.com/Community/Workspaces/Workspace.aspx?id=80258a8c-bb4c-48e6-948b-05f6da568f55&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Enjoy!&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=2443"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=2443" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/2443.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2004/02/29/2443.aspx</guid>
            <pubDate>Sun, 29 Feb 2004 11:24:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/2443.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2004/02/29/2443.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/2443.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/2443.aspx</trackback:ping>
        </item>
        <item>
            <title>Anti-pattern: incorrect try..finally usage</title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2004/01/03/1093.aspx</link>
            <description>&lt;P&gt;I am so sick of seeing this incorrect usage of try..finally:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;PRE&gt;Stream s = null;
try { 
    s = new FileStream(...);
    ...
}
finally {
    if(s!=null) s.Close();
}&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is WRONG. The work done in the finally block need only be done if the stream is opened.&amp;nbsp; Until the assignment of 's' completes, the finally block is not to be executed.&amp;nbsp; The 'if' statement is basically checking that fact.&amp;nbsp; The correct usage is:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;PRE&gt;Stream s = new FileStream(...);
try {     
    ...
}
finally {
    s.Close();
}&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No excuses!&amp;nbsp;&amp;nbsp;Programmers are lucky that the 'if' check can even be done -&amp;nbsp;the anti-pattern doesn't work in general.&amp;nbsp; Consider this scenario involving thread synchronization:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;PRE&gt;Monitor.Enter();
try {     
    ...
}
finally {
    Monitor.Exit();
}&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;To write the above using the anti-pattern, one would need to be able to check that the monitor was entered, which may or may not be possible. Without a check, the anti-pattern might exit a monitor that was not entered.&lt;/P&gt;
&lt;P&gt;With respect to exception handling, to catch an exception for Enter through to Exit the correct pattern is:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;PRE&gt;try {
    Monitor.Enter();
    try {     
        ...
    }
    finally {
        Monitor.Exit();
    }
} catch(Exception ex) { ... }&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;To handle an exception on Enter separately from the rest, use: 
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;PRE&gt;try {
    Monitor.Enter();
}
catch(Exception ex) { ... }
try {     
    ...
}
catch(Exception ex) { ... }
finally {
    Monitor.Exit();
}
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Microsoft programmers use this anti-pattern all the time.&amp;nbsp; Stop it!&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=1093"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=1093" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/1093.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2004/01/03/1093.aspx</guid>
            <pubDate>Sat, 03 Jan 2004 17:32:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/1093.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2004/01/03/1093.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/1093.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/1093.aspx</trackback:ping>
        </item>
        <item>
            <title>Whidbey: Partial classes for Aspect-Oriented Programming?</title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2003/12/22/1053.aspx</link>
            <description>&lt;p&gt;I just realized that partial classes will encourage AOP.  A small example of this is with respect to import statements.  A class might have a dozen import statements.  Each import relates to specific functionality of the class.  If those functions are largely independent, you can now separate them into multiple partial classes, &lt;em&gt;even within the same source file&lt;/em&gt;.  Consequently, the import statements are closely associated with the implementation.&lt;/p&gt;
&lt;p&gt;For example, this code would appear within one file.  Obviously, only one class is being defined.&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;namespace Sample.Something&lt;br /&gt;{&lt;br /&gt; using System.Web;&lt;br /&gt; using System.Web.Services;&lt;br /&gt; [WebService]&lt;br /&gt; public partial class FooService : System.Web.Services.WebService&lt;br /&gt; {&lt;br /&gt;  [WebMethod] public Foo[] Search() { ... }  &lt;br /&gt; } &lt;br /&gt;}&lt;br /&gt;namespace Sample.Something&lt;br /&gt;{&lt;br /&gt; using System.Xml;&lt;br /&gt; using System.Xml.Serialization;&lt;br /&gt; public partial class FooService&lt;br /&gt; {&lt;br /&gt;  internal void SerializeToXml(XmlWriter writer) { ... }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;namespace Sample.Something&lt;br /&gt;{&lt;br /&gt; using System.IO;&lt;br /&gt; public partial class FooService&lt;br /&gt; {&lt;br /&gt;  internal void WriteLog(Stream s) { ... }&lt;br /&gt; }&lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=1053"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=1053" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/1053.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2003/12/22/1053.aspx</guid>
            <pubDate>Mon, 22 Dec 2003 19:17:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/1053.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2003/12/22/1053.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/1053.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/1053.aspx</trackback:ping>
        </item>
        <item>
            <title>Matrix Revolutions: Agent Smith is Deleted.</title>
            <category>World</category>
            <link>http://geekswithblogs.net/ewright/archive/2003/11/24/701.aspx</link>
            <description>&lt;p&gt;Since seeing MR I have been puzzled over the ending.  Last night, I realized something that has really helped.  &lt;strong&gt;Agent Smith is deleted.&lt;/strong&gt; It comes down to &lt;em&gt;purpose&lt;/em&gt;.  Agent Smith's purpose is to kill The One.  We are told many times that once a program's purpose is fulfilled it is deleted.  Neo sacrifices himself to fulfill Agent Smith's purpose, and thus make Smith elegible for deletion.  Upon absorbing Neo, Smith is confused and wonders aloud, “is it over?”.  Neo/Smith nods with a big grin.  The machines then issue the command and announce “it is done”.  This explains why only Neo and the machines together can kill Smith.&lt;/p&gt;
&lt;p&gt;Earlier, Smith philosophizes with Neo, saying “the purpose of life is to die”.  That is, the purpose in life is to identify and fullfill your purpose.  By doing so, you will die.&lt;/p&gt;
&lt;p&gt;Only at the end of MR is Neo truly The One.  Why?  To become The One you must free yourself from all systems of control.  In the end Neo simply refuses to die, to “have an end”.  Smith: “Why, why get up? Why keep fighting? [...] Is it freedom [...]?”  Neo: “Because I choose to“.  Neo has attained ultimate free will.  For that, the machines honor him by raising his body to the sky.  Morpheus (M1): “Free your mind“.  Note that Smith finally calls Neo by the name “Neo” (not “Mr. Anderson“) when he says “Everything that has a beginning has an end, Neo.”   Does this mean that the Oracle was dominating him at that moment, or does it mean that Smith has accepted that Neo is The One?  If the latter, then it explains why Neo must survive until that moment.  Smith immediately says “What did I just say?”.  That too can be taken either way.  Could mean that he didn't hear himself, or that he is reacting to his own word choice. &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=701"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=701" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/701.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2003/11/24/701.aspx</guid>
            <pubDate>Mon, 24 Nov 2003 16:39:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/701.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2003/11/24/701.aspx#feedback</comments>
            <slash:comments>49</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/701.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/701.aspx</trackback:ping>
        </item>
        <item>
            <title>HTML color picker</title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2003/11/13/527.aspx</link>
            <description>&lt;P&gt;Check out this color picker!&amp;nbsp; Selects the entire scheme for you.&amp;nbsp; Also, don't miss the &amp;#8220;Scheme&amp;#8221;&amp;nbsp;dropdown and the brightness/saturation sliders.&amp;nbsp; RAD!&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.pixy.cz/apps/barvy/index-en.html"&gt;http://www.pixy.cz/apps/barvy/index-en.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=527"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=527" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/527.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2003/11/13/527.aspx</guid>
            <pubDate>Thu, 13 Nov 2003 12:15:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/527.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2003/11/13/527.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/527.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/527.aspx</trackback:ping>
        </item>
        <item>
            <title>SQL: Use object owner for namespacing object name</title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2003/11/08/460.aspx</link>
            <description>&lt;P&gt;Hello, another thread compelled me to spell out what my supposed state-of-the-art thinking is on database object names.&lt;/P&gt;
&lt;P&gt;Sql Server has no concept of a namespace for object names.&amp;nbsp; That is, all names for tables and views (and more) must be unique.&amp;nbsp; Well, there is in fact a single namespacing concept - the owner!&amp;nbsp; &lt;/P&gt;
&lt;P&gt;We create owners for the logical namespaces in our product.&amp;nbsp; The views and (primarily) computed tables that belong to that namespace will be owned by the appropriate sql account.&amp;nbsp; In that way, intra-namespace calls between relations need not be qualified, but inter-namespace calls must be.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Also, the same relation name can be used by various subsystems, as they implement their views.&amp;nbsp; This avoids the ugly problem of assigning arbitrary suffixes to view names.&amp;nbsp;&amp;nbsp;For example,&amp;nbsp;consider&amp;nbsp;possible view names over some table "dbo.Equipment" - "dbo.EquipmentSummary", "dbo.EquipmentView", "dbo.EquipmentDetails".&amp;nbsp; OUCH.&amp;nbsp; I prefer &amp;#8220;[MyProduct.Admin].Equipment&amp;#8220;, &amp;#8220;[MyProduct.Search].Equipment&amp;#8220;.&lt;/P&gt;
&lt;P&gt;The application does not login to sql using these accounts - yet.&amp;nbsp; In time, we might do this and finally be able to take advantage of sql server's security mechanisms.&lt;/P&gt;
&lt;P&gt;It makes sense in a twisted way, hey?&amp;nbsp; The namespaces "own" the relations!&amp;nbsp; Of course, triggers and procedures are also treated in this way.&amp;nbsp; It's helpful when a certain base table has many orthogonal triggers that those triggers are owned by the subsystem&amp;nbsp;that requires them.&lt;/P&gt;
&lt;P&gt;Note that, within Enterprise Manager, you will sort by Owner, not Name, to get a nice subsystem-centric view of your db objects.&lt;/P&gt;
&lt;P&gt;We are early into the implementation of this approach.&amp;nbsp; Please give me your feedback/concerns, thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=460"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=460" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/460.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2003/11/08/460.aspx</guid>
            <pubDate>Sat, 08 Nov 2003 16:30:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/460.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2003/11/08/460.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/460.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/460.aspx</trackback:ping>
        </item>
        <item>
            <title>Indexed view techniques and Yukon cache invalidation callbacks.</title>
            <category>PDC</category>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2003/11/02/370.aspx</link>
            <description>&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"&gt;Regarding PDC, I had a blast!&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;I am pumped about &lt;?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /&gt;&lt;st1:place w:st="on"&gt;&lt;st1:City w:st="on"&gt;Whidbey&lt;/st1:City&gt;, &lt;st1:State w:st="on"&gt;Yukon&lt;/st1:State&gt;&lt;/st1:place&gt;, Longhorn&amp;#8230;everything.&amp;nbsp; Great to be back with my family, Tonya and Ava.&amp;nbsp; Oh and another in beta!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"&gt;The &lt;st1:State w:st="on"&gt;&lt;st1:place w:st="on"&gt;Yukon&lt;/st1:place&gt;&lt;/st1:State&gt; caching stuff demands a renewed search for &amp;#8220;indexed view&amp;#8221;-friendly queries.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;That is, to benefit from &lt;st1:State w:st="on"&gt;&lt;st1:place w:st="on"&gt;Yukon&lt;/st1:place&gt;&lt;/st1:State&gt;&amp;#8217;s cache invalidation stuff, you must follow the constraints of indexed views.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Until PDC it was a mystery to me as to how cache invalidation was implemented. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;In retrospect it is obvious that indexed views solve the essential invalidation problem.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;st1:State w:st="on"&gt;&lt;st1:place w:st="on"&gt;Yukon&lt;/st1:place&gt;&lt;/st1:State&gt; surfaces the invalidation event rather than updating an index.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I am presuming that indexed views are not recalculated from scratch when an underlying table changes.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"&gt;Yukon's mechanisms are not finalized.&amp;nbsp; Mike Pizzo says that they will enhance the technology, either by:&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"&gt;automatically simplifying complex queries to invalidation-friendly ones.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"&gt;accepting a set of secondary, invalidation-friendly,&amp;nbsp;queries&amp;nbsp;such that you can setup a more pessimistic invalidation.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"&gt;Either mechanism will introduce pessimism.&amp;nbsp; He says that additional features will impact whether the callback can actually return the inserted/deleted rows - a&amp;nbsp;deadly feature that is under evaluation.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;Back to the point, I want my queries to be compatible with invalidation and indexed views.&amp;nbsp; I want to enumerate ways to achieve this:&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;Use triggers to maintain precomputed tables.&amp;nbsp; Generate these tables to allow your queries to be friendly.&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;Similarly, denormalize to other database on a schedule&amp;nbsp; (wishful)&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"&gt;Please reply with ideas for effective use of indexed views.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;/bloghelper&gt;?&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=370"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=370" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/370.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2003/11/02/370.aspx</guid>
            <pubDate>Mon, 03 Nov 2003 01:27:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/370.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2003/11/02/370.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/370.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/370.aspx</trackback:ping>
        </item>
        <item>
            <title>PDC: Advanced ASP.NET Caching for 2.0</title>
            <category>PDC</category>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2003/10/28/296.aspx</link>
            <description>&lt;p&gt;Rob Howard presented the expanded support for caching in ASP.NET.  Two main features were presented:&lt;/p&gt;
&lt;p&gt;CacheDependency is now extensible.  By overriding a small set of virtual methods, you can implement any cache dependency scheme.  For example you can call a web service to check the validity of some data.  You can use your custom CacheDependency instance to control output caching of a page:&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;Dim myDependency As New MyCacheDependency(...)&lt;br /&gt;Response.AddCacheDependency(myDependency)&lt;/blockquote&gt;
&lt;p&gt;The other main feature is that Whidbey will support database cache dependencies.   There is a separate implementation for Sql Server 7/2000 and for Yukon.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Sql Server 7 &amp;amp; 2000 will support table-level dependency tracking.  That is, for a given query, you declare the set of tables to watch.  If data is changed in any of those tables, the cache entry will expire.  Obviously, this is extremely pessimistic and thus is only suitable for tables that change infrequently.  Also, a light-weight polling mechanism is used:  when data changes, a trigger writes to a table with one row per table that is being watched.   On a configurable interval, ASP.NET will poll the table and invalidate entries appropriately. 
&lt;/li&gt;&lt;li&gt;Yukon will support row-level dependency tracking.  It works in roughly the same way as indexed views.   Think about it - when a table changes, the corresponding indexed views are updated.  The same analysis that provides that functionality also provides the cache invalidation feature.  The consequence is that the query in question is subject to the same constraints as indexed views.  If a query is not supported, an invalidation notification is fired immediately.  Exciting!  Note that the client-side plumbing is handled by ADO.NET.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Database-driven cache invalidation is a real gift to the world!.  &lt;/p&gt;
&lt;p&gt;See my post, &lt;a href="http://geekswithblogs.net/ewright/posts/309.aspx"&gt;http://geekswithblogs.net/ewright/posts/309.aspx&lt;/a&gt;, for information on achieving table-level invalidation in ASP.NET 1.0!&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=296"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=296" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/296.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2003/10/28/296.aspx</guid>
            <pubDate>Tue, 28 Oct 2003 23:55:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/296.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2003/10/28/296.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/296.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/296.aspx</trackback:ping>
        </item>
        <item>
            <title>Database-driven cache invalidation in ASP.NET 1.0</title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2003/10/29/309.aspx</link>
            <description>Did you know that &lt;strong&gt;you can achieve table-level cache invalidation with ASP.NET today&lt;/strong&gt;?  Here's how: 
&lt;p&gt;The stock ASP.NET 1.0 CacheDependency class can monitor a local or network file.  As the file changes, the appropriate cache entries are evicted from the cache.  We can leverage this to achieve near-realtime cache invalidation as database data changes.  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Write a trigger for each table you want to monitor.  The trigger will touch a file on the database's filesystem.  The filename will correspond to the table name.  This can be achieved by invoking the FileSystemObject scripting object.&lt;/li&gt;&lt;/ul&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;&lt;font color="#0000ff" size="2"&gt;CREATE PROCEDURE &lt;/font&gt;&lt;font size="2"&gt;TouchFile(@FileName &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;varchar&lt;/font&gt;&lt;font size="2"&gt;(255)) &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;AS&lt;br /&gt;DECLARE &lt;/font&gt;&lt;font size="2"&gt;@FS &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt;, @OLEResult &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt;, @FileID &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;br /&gt;EXECUTE &lt;/font&gt;&lt;font size="2"&gt;@OLEResult = sp_OACreate 'Scripting.FileSystemObject', @FS OUT&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;IF &lt;/font&gt;&lt;font size="2"&gt;@OLEResult &amp;lt;&amp;gt; 0 &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;RAISERROR &lt;/font&gt;&lt;font size="2"&gt;('could not create FileSystemObject',16,1)&lt;br /&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;-- touch the file&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;execute &lt;/font&gt;&lt;font size="2"&gt;@OLEResult = sp_OAMethod @FS, 'OpenTextFile', @FileID OUT, @FileName, 2, 1&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;EXECUTE &lt;/font&gt;&lt;font size="2"&gt;@OLEResult = sp_OADestroy @FileID&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;EXECUTE &lt;/font&gt;&lt;font size="2"&gt;@OLEResult = sp_OADestroy @FS&lt;br /&gt;&lt;/font&gt;&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Share the relevant folder in the database's filesystem. 
&lt;/li&gt;&lt;li&gt;Setup CacheDependency instances to watch the appropriate files for changes.   Use methods on the Response object to interoperate with page-level output caching.  Use the raw caching API for arbitrary data caching.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;This technique offers a number of advantages over the proposed polling mechanism in Whidbey (see earlier post).&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The invalidation will occur more quickly than with a polling mechanism. 
&lt;/li&gt;&lt;li&gt;No polling is used - the caching API uses the FileSystemMonitor component, that in turn leverages a callback mechanism to detect filesystem changes.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Other notables about this approach:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Like the Whidbey mechanisms, it is web garden and web cluster friendly. 
&lt;/li&gt;&lt;li&gt;An extremely narrow race condition might exist.  It occurs when two or more triggers attempt to touch the same file.  One will succeed, others will fail.  Will this result in stale data?  Given the asynchronous nature of FileSystemMonitor, it is extremely unlikely.  Nonetheless, you might want to bat around the scenarios in your head.   
&lt;/li&gt;&lt;li&gt;If the file cannot be touched, the procedure will nonetheless complete.  That is, the race does not defeat the transaction and is safe.
&lt;/li&gt;&lt;li&gt;This is a hack.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=309"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=309" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/309.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2003/10/29/309.aspx</guid>
            <pubDate>Wed, 29 Oct 2003 19:05:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/309.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2003/10/29/309.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/309.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/309.aspx</trackback:ping>
        </item>
        <item>
            <title>PDC: SQLXML is here to stay</title>
            <category>PDC</category>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2003/10/28/288.aspx</link>
            <description>&lt;p&gt;I hammered the SQLXML guys at the PDC today.  I want to know whether SQLXML is regarded (rightly) as awesome progressive technology, or merely a step towards either ObjectSpaces or (worse) XML datatypes in Yukon.  Some points:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SQLXML is not deprecated.  &lt;/li&gt;
&lt;li&gt;It has been ported to fully managed code for Whidbey timeframe.&lt;/li&gt;
&lt;li&gt;In terms of the internal implementation, it will not depend on FOR XML syntax in the future, but rather on multiple active resultsets and client-side post-processing.   Seems ass-backwards to me - they need deeper integration with the relational engine to avoid any denormalization whatsoever.  &lt;/li&gt;
&lt;li&gt;In future releases you will not annotate your schema with SQLXML attributes.  Instead, you will write a separate mapping file.  BOO.  Well, OK, it's no big deal.  If you want to keep your annotations within the schema, use an XSL transformation to generate the mapping file.  I think of annotations like custom attributes in managed code.  It's a great innovation that they are inline, rather than in a separate file.&lt;/li&gt;
&lt;li&gt;ObjectSpaces and SQLXML use the same engine.  I might be misunderstanding - the statement was interleaved with another conversation.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;No matter what the implementation details are, the great thing about SQLXML is that from the client point of view, you get a normalized, heirarchical snapshot of your data in one round-trip to the server.  It eliminates ugly SQL code in your app - you know, the stuff that either executes a query to fetch the details for each master record (aaah!) or re-normalizes with conditional logic.   Plus, as the SQLXML implementation improves, you get wholesale speed improvements with no code or database changes!&lt;/p&gt;
&lt;p&gt;I think SQLXML is a first step in a revolution in database data interchange.  I like to compare it to the success of XML itself.  XML is nothing but a scheme for encoding structured data in a text file.  It has thoroughly replaced the Comma-Separated-Values (CSV) format because it can capture heirarchical data structures.  Well, the rowset is today the primary format (so to speak) for transferring structured data from a database to a client.  By replacing the rowset with an XML stream, we can enjoy the same benefits as with the  transition away from CSV to XML.  We can now transfer heirarchical (master-detail) data in its natural, normalized state.  There are also performance advantages associated with doing so, not the least of which is increased network efficiency and fewer round-trips.&lt;/p&gt;
&lt;p&gt;Don't even get me started on the righteousness of defining your DAO using XML Schema (XSD), which forms the center of the SQLXML approach.   You can use schema to generate classes, and thus achieve complete Object-Xml-Relational mapping.  Note that the Xml itself becomes an implementation detail.  That's right, SQLXML provides an excellent foundation for Object-Relational mapping.  That is the reason why we regard Microsoft's ObjectSpaces as a competitor to SQLXML.  My colleague is particularly concerned:&lt;/p&gt;
&lt;p&gt;&lt;u&gt;&lt;font color="#800080"&gt;&lt;a href="http://weblogs.asp.net/jcollins/posts/33991.aspx"&gt;http://weblogs.asp.net/jcollins/posts/33991.aspx&lt;/a&gt;&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;
&lt;p&gt;Let me mention the power and utility of XSLT.  If your data is in XML (in this case, a schema definition) you are in a great position.  They want a different vocabulary?  Fine - transform!  XSLT files are succinct, flexible, and resilient (that is, quite stable over time), and can emit non-XML output, like SQL statements.  Virtually every project I work on involving XML also involves XSLT.&lt;/p&gt;
&lt;p&gt;SQLXML is my favorite SQL Server technology.  You wanna talk about it?  I'd love to!  Mail or reply to this post.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=288"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=288" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/288.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2003/10/28/288.aspx</guid>
            <pubDate>Tue, 28 Oct 2003 05:04:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/288.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2003/10/28/288.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/288.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/288.aspx</trackback:ping>
        </item>
        <item>
            <title>Changing the IIS 5.1 (XP) Connection Limit</title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2003/10/26/254.aspx</link>
            <description>&lt;p&gt;Found an interesting paragraph in an iisanswers article.  Have not verified this information.  &lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.iisanswers.com/articles/IIS51.htm"&gt;http://www.iisanswers.com/articles/IIS51.htm&lt;/a&gt;&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;h1&gt;Connection Limits&lt;/h1&gt;
&lt;p class="BodyTextStandardChar"&gt;XP Pro allows 10 connections. This limit is installed by default in the metabase key MaxConnections for W3SVC, and there is no user interface method for modifying the setting. You can change this setting to any number less than 40 and it works, but that is not widely advertised.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p class="BodyTextStandardChar"&gt;The ability to increase the connection limit is interesting because you can now increase the max number of simultaneous connections used by IE, on your developer box.&lt;/p&gt;
&lt;p class="BodyTextStandardChar"&gt;&lt;a href="http://www.regxplor.com/tweak11.html"&gt;http://www.regxplor.com/tweak11.html&lt;/a&gt;&lt;/p&gt;
&lt;p class="BodyTextStandardChar"&gt; &lt;/p&gt;
&lt;p class="BodyTextStandardChar"&gt; &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=254"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=254" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/254.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2003/10/26/254.aspx</guid>
            <pubDate>Sun, 26 Oct 2003 19:35:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/254.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2003/10/26/254.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/254.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/254.aspx</trackback:ping>
        </item>
        <item>
            <title>ASP.NET Page Caching and IIS6 Kernel-Mode Caching</title>
            <category>Technology</category>
            <link>http://geekswithblogs.net/ewright/archive/2003/10/24/241.aspx</link>
            <description>&lt;p&gt;Wondering how ASP.NET page caching relates to IIS6 kernel-mode caching? &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;With output caching enabled for a Web Form,  the page will be served directly from the Windows Server 2003 kernel if VaryByParam=“None“ and no other Vary settings are specified.  The framework will not be called in any way - Application_BeginRequest will not fire.  
&lt;/li&gt;&lt;li&gt;If VaryByParam, VaryByControl, or VaryByCustom is used, then Application_BeginRequest and Application_EndRequest will fire and the kernel cache will not be used. 
&lt;/li&gt;&lt;li&gt;According to informal tests using ACT, the kernel cache doubles the performance of a cache hit.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Refer to &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconoutputcache.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconoutputcache.asp&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;How are POSTs handled?  These rules are independent of kernel caching.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The request params (whether query string or POST params) are &lt;em&gt;not&lt;/em&gt; part of the cache key.  That is, unless you use VaryByParam or VaryByControl, the same cache entry will be returned no matter what the query params are. 
&lt;/li&gt;&lt;li&gt;The cache key is the request path &lt;em&gt;and&lt;/em&gt; the http method.  That is, a postback button on the page will cause a cache miss on the first click, but not on subsequent clicks.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;It is typically desirable to suppress caching on a POST.  To do this, use this code in Application_BeginRequest or in Page_Load - Postbacks will be treated as cache misses.&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;font size="2"&gt;(HttpContext.Current.Request.HttpMethod=="POST") &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;font size="2"&gt;.Response.Cache.SetNoServerCaching();&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=241"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=241" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/241.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2003/10/24/241.aspx</guid>
            <pubDate>Fri, 24 Oct 2003 17:04:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/241.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2003/10/24/241.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/241.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/241.aspx</trackback:ping>
        </item>
        <item>
            <title>Into the Karmatron</title>
            <link>http://geekswithblogs.net/ewright/archive/2003/10/24/240.aspx</link>
            <description>&lt;p&gt;Alright!  I've been frozen for 30 years but now thawed and ready to blog!&lt;/p&gt;
&lt;p&gt;What is karmatron dynamics?  The very science of human destiny!&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=240"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=240" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ewright/aggbug/240.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eron Wright</dc:creator>
            <guid>http://geekswithblogs.net/ewright/archive/2003/10/24/240.aspx</guid>
            <pubDate>Fri, 24 Oct 2003 16:36:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ewright/comments/240.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ewright/archive/2003/10/24/240.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ewright/comments/commentRss/240.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ewright/services/trackbacks/240.aspx</trackback:ping>
        </item>
    </channel>
</rss>