<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Fabulous Adventures In Coding : Metablogging</title><link>http://blogs.msdn.com/ericlippert/archive/tags/Metablogging/default.aspx</link><description>Tags: Metablogging</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Sorry about the CAPTCHA</title><link>http://blogs.msdn.com/ericlippert/archive/2009/09/10/sorry-about-the-captcha.aspx</link><pubDate>Thu, 10 Sep 2009 16:28:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9893152</guid><dc:creator>Eric Lippert</dc:creator><slash:comments>18</slash:comments><comments>http://blogs.msdn.com/ericlippert/comments/9893152.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ericlippert/commentrss.aspx?PostID=9893152</wfw:commentRss><description>&lt;DIV class=mine&gt;
&lt;P&gt;A quick metablogging note. Those of you who comment on this blog (6700+ comments and counting, thank you all) have probably noticed that it now has a CAPTCHA, that little "please prove you're a human" test before the comment is posted.&lt;/P&gt;
&lt;P&gt;I understand why. The MSDN and TechNet blog sites are high-value targets for unwanted commercial advertisers, for attackers who wish to attempt to influence search engines to drive traffic to their sites, and for&amp;nbsp;vandals. The people who run security for this site have their hands full; we've experienced some pretty serious denials of service based on ham-fisted spammer attacks. Adding a CAPTCHA to regulate comments massively slows down the rate of successful comment spam. &lt;/P&gt;
&lt;P&gt;That said, I'm not thrilled about this.&amp;nbsp;I find&amp;nbsp;CAPTCHA-style solutions distasteful for several reasons:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The benign commenter -- precisely the kind of person we want to encourage -- is forced to do additional work. This is a small but nonzero disincentive to writing comments. &lt;/LI&gt;
&lt;LI&gt;Sometimes mistakes will be made; providing new ways that computers can tell us on a daily basis that we are failures seems irksome. &lt;/LI&gt;
&lt;LI&gt;The assumption of innocence is changed to an assumption of guilt; the benign commenter must prove their innocence. Every time I have to fill out a CAPTCHA I feel a small but real insult; I'm a trustworthy person, so trust me already. As &lt;A class="" href="http://www.joelonsoftware.com/articles/BuildingCommunitieswithSo.html" mce_href="http://www.joelonsoftware.com/articles/BuildingCommunitieswithSo.html"&gt;Joel Spolsky once pointed out&lt;/A&gt;, it's like walking into a&amp;nbsp;train station&amp;nbsp;and the first thing you see is the NO SKATEBOARDING NO PANHANDLING NO THIS NO THAT NO THE OTHER THING sign. Its unwelcoming. It makes you feel attacked and guilty and reminds you that there is evil in the world.&lt;/LI&gt;
&lt;LI&gt;There are accessibility concerns. Not everyone who uses computers&amp;nbsp;has decent vision but that doesn't make them evil robots. They deserve as much as a chance as everyone else to contribute and have to overcome plenty of&amp;nbsp;obstacles already; let's not throw more in their way.&lt;/LI&gt;
&lt;LI&gt;And so on&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;So, sorry about that, commenters. I don't like it any more than you do, but there's not much I can do about it; I don't run the blog servers. The only thing I can control is how purple the text is.&lt;/P&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9893152" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ericlippert/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.msdn.com/ericlippert/archive/tags/Metablogging/default.aspx">Metablogging</category><category domain="http://blogs.msdn.com/ericlippert/archive/tags/CAPTCHA/default.aspx">CAPTCHA</category></item><item><title>Fabulous Adventures In Russian</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/05/fabulous-adventures-in-russian.aspx</link><pubDate>Fri, 05 Jun 2009 17:18:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9700283</guid><dc:creator>Eric Lippert</dc:creator><slash:comments>11</slash:comments><comments>http://blogs.msdn.com/ericlippert/comments/9700283.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ericlippert/commentrss.aspx?PostID=9700283</wfw:commentRss><description>&lt;DIV class=mine&gt;
&lt;P&gt;&lt;A title="Peter the Fabulous?" href="http://en.wikipedia.org/wiki/Russia"&gt;&lt;IMG title="Peter the Fabulous?" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; DISPLAY: inline; MARGIN: 0px 10px 0px 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=244 alt="Peter the Fabulous?" src="http://blogs.msdn.com/blogfiles/ericlippert/WindowsLiveWriter/FabulousAdventuresInRussian_C971/Peter_der-Grosse_1838_3.jpg" width=188 align=left border=0&gt;&lt;/A&gt; I am pleased to announce that a bunch of our Russian MVPs who (1) are awesome people and (2) apparently have some free time on their hands, have started translating this blog into Russian, of all things. So if you want some Фантастичные приключения на русском, check it out! &lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/ruericlippert/default.aspx" mce_href="http://blogs.msdn.com/ruericlippert/default.aspx"&gt;http://blogs.msdn.com/ruericlippert/default.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Thanks to all the Russian MVPs and particularly to developer evangelist Gaidar Magdanurov for organizing and overseeing this effort.&lt;/P&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9700283" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ericlippert/archive/tags/Metablogging/default.aspx">Metablogging</category><category domain="http://blogs.msdn.com/ericlippert/archive/tags/translation/default.aspx">translation</category><category domain="http://blogs.msdn.com/ericlippert/archive/tags/Russian/default.aspx">Russian</category></item><item><title>When Five Hundred Posts You Reach</title><link>http://blogs.msdn.com/ericlippert/archive/2009/05/28/when-five-hundred-posts-you-reach.aspx</link><pubDate>Thu, 28 May 2009 16:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9603231</guid><dc:creator>Eric Lippert</dc:creator><slash:comments>16</slash:comments><comments>http://blogs.msdn.com/ericlippert/comments/9603231.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ericlippert/commentrss.aspx?PostID=9603231</wfw:commentRss><description>&lt;DIV class=mine&gt;
&lt;P&gt;… look this good you will not. But man, I tell you, the memory goes.&lt;/P&gt;
&lt;P&gt;In the July 1985 issue of &lt;EM&gt;Fantasy and Science Fiction&lt;/EM&gt;, Isaac Asimov wrote:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT color=#000080&gt;Yesterday I sat down to write my 321st essay for &lt;EM&gt;Fantasy and Science Fiction&lt;/EM&gt;. […] It went swimmingly. I was pleased at the ease with which I worked out its construction. It practically wrote itself and I scarcely had to look anything up. I whistled while I worked. And then, when I reached the last page and launched into my climactic paragraphs, I thought to myself: Why does this suddenly sound familiar to me? […] Hoping earnestly that my memory had misfired, I looked it up. It turned out to be essay #182, first published in the December 1973 issue. There it was. That earlier essay was essentially what I had just written.&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The other day I wrote a blog post. It went great. It was strongly opinionated and about an interesting topic. I did a web search to make sure that I had a particular fact straight and… I found my own previous article on the subject. Apparently the late Dr. Asimov and I have at least one thing in common. (I also have something in common with writer &lt;A class="" href="http://journal.neilgaiman.com/" mce_href="http://journal.neilgaiman.com/"&gt;Neil Gaiman&lt;/A&gt;, but that’s another story.)&lt;/P&gt;
&lt;P&gt;It seemed to me looking back that I started off with a huge backlog of old emails answering real user questions which I could use for blog articles, and indeed, when I got started there, I was posting a couple a day. And then over the years I both got busy with other things (writing and editing books, for example) and ran out of canned emails to turn into blog posts, so my rate of writing dropped off. And then lately it seems like I’ve gotten more of a groove back and am doing a couple a week.&lt;/P&gt;
&lt;P&gt;I decided to see whether my memory was correct by computing the &lt;STRONG&gt;twenty-post moving average of number of days between successive posts&lt;/STRONG&gt;: (Yes, I am a geek, but you already knew that.)&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/ericlippert/WindowsLiveWriter/WhenFiveHundredPostsYouReach_7890/blogchart_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/ericlippert/WindowsLiveWriter/WhenFiveHundredPostsYouReach_7890/blogchart_2.jpg"&gt;&lt;IMG title=blogchart style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; DISPLAY: block; FLOAT: none; MARGIN-LEFT: auto; BORDER-LEFT: 0px; MARGIN-RIGHT: auto; BORDER-BOTTOM: 0px" height=276 alt=blogchart src="http://blogs.msdn.com/blogfiles/ericlippert/WindowsLiveWriter/WhenFiveHundredPostsYouReach_7890/blogchart_thumb.jpg" width=642 border=0 mce_src="http://blogs.msdn.com/blogfiles/ericlippert/WindowsLiveWriter/WhenFiveHundredPostsYouReach_7890/blogchart_thumb.jpg"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Yep, I think in this case my memory was correct.&lt;/P&gt;
&lt;P&gt;Five hundred posts from me and six thousand comments from you all in less than six years seems like rather a lot. &lt;STRONG&gt;I want to take this opportunity to say thanks to everyone who has given me great feedback, interesting questions and technical and moral support over the years. You rock.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Enough chit-chat. On to more fabulous adventures!&lt;/P&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9603231" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ericlippert/archive/tags/Metablogging/default.aspx">Metablogging</category></item><item><title>Events and Races</title><link>http://blogs.msdn.com/ericlippert/archive/2009/04/29/events-and-races.aspx</link><pubDate>Wed, 29 Apr 2009 15:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9571319</guid><dc:creator>Eric Lippert</dc:creator><slash:comments>22</slash:comments><comments>http://blogs.msdn.com/ericlippert/comments/9571319.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ericlippert/commentrss.aspx?PostID=9571319</wfw:commentRss><description>&lt;DIV class=mine&gt;
&lt;P&gt;Here’s a question &lt;A href="http://stackoverflow.com/questions/786383/c-events-and-thread-safety" mce_href="http://stackoverflow.com/questions/786383/c-events-and-thread-safety"&gt;similar&lt;/A&gt; to one I saw on &lt;A href="http://www.stackoverflow.com/" mce_href="http://www.stackoverflow.com"&gt;stackoverflow&lt;/A&gt; the other day. Suppose you have an event:&lt;/P&gt;&lt;SPAN class=code&gt;
&lt;P&gt;public event Action Foo; &lt;/SPAN&gt;
&lt;P&gt;The standard pattern for firing this event is: &lt;SPAN class=code&gt;
&lt;P&gt;Action temp = Foo;&lt;BR&gt;if (temp != null)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; temp();&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;What the heck is up with that? Why not just call “&lt;SPAN class=code&gt;Foo()&lt;/SPAN&gt;” ? &lt;/P&gt;
&lt;P&gt;First off, this pattern ensures that the thing that is invoked is not the null delegate reference, which would cause a null reference exception to be thrown. But if that’s what we want, then surely we could have skipped the temporary variable – just “&lt;SPAN class=code&gt;if (Foo != null) Foo();&lt;/SPAN&gt;” would do. Why the temp?&lt;/P&gt;
&lt;P&gt;The temporary variable ensures that this is “thread safe”. If the event’s handlers are being modified on another thread it is possible for Foo to be non-null at the point of the check, then set to null on a different thread, and then the invocation throws.&lt;/P&gt;
&lt;P&gt;Using the temporary variable effectively makes a copy of the current set of event handlers. Remember, &lt;STRONG&gt;multi-cast delegates are immutable&lt;/STRONG&gt;; when you add or remove a handler, you &lt;EM&gt;replace&lt;/EM&gt; the existing multi-cast delegate object with a &lt;EM&gt;different&lt;/EM&gt; delegate object that has different behaviour. You do not modify an existing &lt;EM&gt;object&lt;/EM&gt;, you modify the &lt;EM&gt;variable&lt;/EM&gt; that stores the event handler. Therefore, stashing away the current reference stored in that variable into a temporary variable effectively makes a copy of the current state.&lt;/P&gt;
&lt;P&gt;Is that clear? Make sure it is, because now things start to get really confusing.&lt;/P&gt;
&lt;P&gt;A common criticism of this pattern is that it trades one race condition for another. Let’s consider that scenario again more carefully:&lt;/P&gt;
&lt;P&gt;The event handler contains a single handler, H. Thread Alpha makes a copy of the delegate to H in temp and determines that it is not null. Thread Beta decides that H must no longer be called when the event is fired, so it sets the handler to null. Thread Beta then assumes that H will never be called, and destroys a bunch of state that H needs to execute successfully. Thread Alpha then regains control and executes H, which behaves crazily since its necessary state has been destroyed. Thread Beta’s attempt to ensure that H is not called has been defeated by the race condition.&lt;/P&gt;
&lt;P&gt;A frequently-stated principle of good software design is that code which calls attention to bugs by throwing exceptions is better than code which hides bugs by muddling on through and doing the wrong thing. This code has a race condition that results in incorrect behaviour. Perhaps an application of that principle is to stop using a temporary and instead crash if it races. That is to say, this code has a failure mode; surely it is better to highlight that failure with a crisp exception than to turn it into crazy wrong behaviour.&lt;/P&gt;
&lt;P&gt;That seems plausibly argued, I agree, but the conclusion is wrong. &lt;/P&gt;
&lt;P&gt;Suppose we remove the temporary variable but keep the null check. Does that &lt;EM&gt;solve&lt;/EM&gt; the problem? No! We still have the same race conditions. Suppose the event handler delegate contains a reference to H. Thread Alpha checks to see whether it is null; it is not. Thread Alpha pushes the object to invoke on the runtime stack. &lt;EM&gt;Between the push of the delegate value and the call to invoke it, thread Beta sets the event handler to null.&lt;/EM&gt; And once again, H will be invoked after thread Beta has removed the handler.&lt;/P&gt;
&lt;P&gt;Suppose we remove the temporary &lt;EM&gt;and&lt;/EM&gt; the null check and just invoke the delegate directly. Does that help? No, we &lt;EM&gt;still&lt;/EM&gt; have the same race condition. The contents of the event handling variable can still be changed between the push of the delegate object onto the stack and the invocation of the delegate.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Removing the code around the call site does not decrease the number of race conditions in the code, and it does increase the number of crashes. Worse, doing so makes the race condition harder to detect by shrinking the window in which the race can occur without eliminating it. &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Removing the null check and/or the temporary is a bad idea; the already-bad situation is only made worse.&lt;/P&gt;
&lt;P&gt;Essentially there are two problems here that are being conflated. The two problems are:&lt;/P&gt;
&lt;P&gt;1) The event handler delegate can be null at any time.&lt;BR&gt;2) A “stale” handler can be invoked even after it has been removed.&lt;/P&gt;
&lt;P&gt;These two problems are actually orthogonal and have different solutions. The onus for solving the first problem is laid upon the &lt;EM&gt;code which does the invocation&lt;/EM&gt;; it is required to ensure that it does not dereference null. The store-in-temporary-and-test pattern ensures that null is never dereferenced. (There are other ways to solve this problem; for example, initializing the handler to have an empty action that is never removed. But doing a null check is the standard pattern.)&lt;/P&gt;
&lt;P&gt;The onus for solving the second problem is laid upon &lt;EM&gt;the code being invoked&lt;/EM&gt;; &lt;STRONG&gt;event handlers are required to be robust in the face of being called even after the event has been unsubscribed.&lt;/STRONG&gt; In the scenario I described, &lt;STRONG&gt;the bug is actually in H&lt;/STRONG&gt;. It needs to be robust enough to check to see whether the state it needs is still there, and bail out cleanly if it is not. (Or, alternatively,&amp;nbsp;some additional locking mechanism needs to be implemented which ensures that the&amp;nbsp;code which fires the event cooperates with the code that changes the event handlers to ensure&amp;nbsp;the desired behaviour.)&lt;/P&gt;
&lt;P&gt;The point though is that the "null ref problem" and the "stale handler problem"&amp;nbsp;are two&amp;nbsp;separate problems that are easily confused because the symptoms of both arise at the exact same call site code. You've got to solve &lt;EM&gt;both&lt;/EM&gt; problems if you want to do threadsafe events. How you do so is up to you; just don't confuse the solution of one problem&amp;nbsp;for a solution of&amp;nbsp;the other.&lt;/P&gt;
&lt;P&gt;(Thanks to Microsofties Levi Broderick, Chris Burrows, Curt Hagenlocher and Wolf Logan; this article is based on a conversation about their analysis of this pattern.)&lt;/P&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9571319" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ericlippert/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/ericlippert/archive/tags/Code+Quality/default.aspx">Code Quality</category><category domain="http://blogs.msdn.com/ericlippert/archive/tags/Threading/default.aspx">Threading</category><category domain="http://blogs.msdn.com/ericlippert/archive/tags/Immutability/default.aspx">Immutability</category><category domain="http://blogs.msdn.com/ericlippert/archive/tags/Metablogging/default.aspx">Metablogging</category></item><item><title>Boring Metablogging, Part Two</title><link>http://blogs.msdn.com/ericlippert/archive/2008/10/07/boring-metablogging-part-two.aspx</link><pubDate>Tue, 07 Oct 2008 18:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8978069</guid><dc:creator>Eric Lippert</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/ericlippert/comments/8978069.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ericlippert/commentrss.aspx?PostID=8978069</wfw:commentRss><description>&lt;DIV class=mine&gt;
&lt;P&gt;I try to not blog about blogging. &lt;A class="" href="http://blogs.msdn.com/ericlippert/archive/2004/07/23/193305.aspx" mce_href="http://blogs.msdn.com/ericlippert/archive/2004/07/23/193305.aspx"&gt;Metablogging is boring&lt;/A&gt;. The last time I blogged about blogging was on the subject of &lt;STRONG&gt;"Can I take your blog post and republish it?"&lt;/STRONG&gt; My answer then was "yes... but". That is, yes, but please tell me, please do not maliciously quote me out of context, please link back to the original, and please don't expect me to correct errors in your copy.&lt;/P&gt;
&lt;P&gt;In the world we live in now, a world with &lt;A class="" href="http://blogs.msdn.com/oldnewthing/archive/2008/02/18/7761978.aspx" mce_href="http://blogs.msdn.com/oldnewthing/archive/2008/02/18/7761978.aspx"&gt;various ways of poisoning search engines&lt;/A&gt;, that seems a bit naive. Of course, there's little I can do to stop anyone from copying everything I write onto their own servers and then tricking search engines into sending clicks their way, so saying "please don't" is unlikely to help.&lt;/P&gt;
&lt;P&gt;My&amp;nbsp;position on blog post republishing is thus basically the same, though I would add one more caveat to that list.&lt;/P&gt;
&lt;P&gt;Everything I write at work is copyright Microsoft Corporation. I am not a lawyer of any stripe, certainly not a copyright lawyer, and though I certainly am a Voice Of Microsoft on the subject of the C# compiler, I am definitely not the Voice Of Microsoft on the subject of copyright law.&lt;/P&gt;
&lt;P&gt;I write this blog so that the information in it can be disseminated as efficiently as possible to those people whom it helps in their jobs; I appreciate that the whole point of syndicated content is that it can be picked up, aggregated, and republished, and I certainly do not want to work against that or discourage the &lt;EM&gt;benign&lt;/EM&gt; use of such services. But I also do not want to create additional work for myself or liabilities for others. So, please &lt;EM&gt;use good judgment and be willing to take responsibility&lt;/EM&gt; when you disseminate someone else's copyrighted content.&lt;/P&gt;
&lt;P&gt;I'd also like to&amp;nbsp;contrast republishing of blog posts with &lt;STRONG&gt;publishing of private emails&lt;/STRONG&gt;. This comes up because I recently dashed off an email to a customer in which I made some brief, off-the-cuff comments about some proposed C# language features that had been mentioned on a third-party newsgroup. The customer asked if he could post my emailed comments onto said newsgroup.&lt;/P&gt;
&lt;P&gt;I said "please do not", and here's why.&lt;/P&gt;
&lt;P&gt;First off,&amp;nbsp;my comments were&amp;nbsp;brief and&amp;nbsp;off-the-cuff.&amp;nbsp;I take a fair amount of time with blog postings to make sure that the prose is polished, the content is complete and accurate, the order in which topics are presented is sensible, that the whole piece flows well. I don't always succeed, but I try. In short, I apply a lower standard to brief emails than I do to public, archived, in-the-world-forever postings.&lt;/P&gt;
&lt;P&gt;Second, by allowing the reader to post on my behalf, I would be encouraging him to indulge in hearsay. I have seen my fair share of internet newgroup flame wars, and believe me "Oh yeah, how do I know this is &lt;EM&gt;really&lt;/EM&gt; from a guy at Microsoft?" is an argument you don't want to get into.&lt;/P&gt;
&lt;P&gt;Third, all the copyright issues which I mentioned above&amp;nbsp;come up again, even worse. The various third-party discussion sites all have their own policies about who owns the content posted on them and that is just a mess that I do not want to get into or encourage anyone else to get into.&lt;/P&gt;
&lt;P&gt;Fourth, by posting my comments in a forum that I don't have posting access to, I have no ability to respond there to further questions, criticisms or follow-ups. I have no ability to correct mistakes in my posting or to add explanatory details should something prove confusing. I have no ability to engage in conversation. I likely have no way of even being informed when a response is made. This sounds suspiciously like its making &lt;EM&gt;more work&lt;/EM&gt; for me in return for &lt;EM&gt;less value&lt;/EM&gt;. It sounds like a good deed once more failing to go unpunished.&lt;/P&gt;
&lt;P&gt;So: if you've gotten an email from me&amp;nbsp;and you think that it might make a good newsgroup posting, here is what I encourage you to do:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Send me an email&amp;nbsp;suggesting that I write the email up as a blog post.&lt;/LI&gt;
&lt;LI&gt;After I do so, publish a &lt;EM&gt;link&lt;/EM&gt; to that post in whatever newsgroup you like.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;If that's the way it goes then all the objections disappear. I am publishing Microsoft-owned content written by me&amp;nbsp;on a Microsoft-owned site, so there's no copyright issue or hearsay issue. I can make corrections, additions, updates, at will. I can be as prolix as I want to be on my own schedule. I can get reader comments and (time permitting!) respond to some of them. (I have gotten over five thousand comments on this blog; I cannot possibly respond to them all.)&lt;/P&gt;
&lt;P&gt;OK, that's enough metablogging for the next four years or so. Back to some fabulous adventures!&lt;/P&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8978069" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ericlippert/archive/tags/Metablogging/default.aspx">Metablogging</category></item><item><title>Aargh! Part Eight, plus Boring Metablogging</title><link>http://blogs.msdn.com/ericlippert/archive/2004/07/23/aargh-part-eight-plus-boring-metablogging.aspx</link><pubDate>Fri, 23 Jul 2004 21:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:193305</guid><dc:creator>Eric Lippert</dc:creator><slash:comments>9</slash:comments><comments>http://blogs.msdn.com/ericlippert/comments/193305.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ericlippert/commentrss.aspx?PostID=193305</wfw:commentRss><description>&lt;DIV class=mine&gt;
&lt;P&gt;Q: What's a pirate's &lt;STRONG&gt;second favourite&lt;/STRONG&gt; mode of transportation?&lt;/P&gt;
&lt;P&gt;A: A caaaaargh! Preferably a Jaguaaaaargh, but&amp;nbsp;an early Oldsmobile Cutlass will do.&lt;/P&gt;
&lt;P&gt;Q: Very amusing --&amp;nbsp;but what's a pirate's &lt;STRONG&gt;favourite&lt;/STRONG&gt; mode of transportation?&lt;/P&gt;
&lt;P&gt;A: A pirate ship, silly.&lt;/P&gt;
&lt;P&gt;Gripe #10: Don't use _alloca&lt;/P&gt;
&lt;P&gt;_alloca allocates memory off the stack instead of the heap. It's very convenient to use when you need a temporary buffer and don't want to worry about freeing it, but I try to avoid it whenever possible for two reasons: &lt;/P&gt;
&lt;P&gt;(1) it wrecks the ability for the compiler to make optimizations based on how much stack a function uses, and &lt;/P&gt;
&lt;P&gt;(2) when combined with the previous point, it leads to terrible, terrible crashes. If the user asks the machine for lots and lots of heap then the program churns away trying to allocate lots of memory before finally throwing an exception or returning null. The worst that can happen is not too bad. The worst that can happen if the stack is overallocated is that the stack guard page is hit for the second time and the process is terminated. (The exact behaviour of the win32 stack under low-stack conditions is interesting, and I will blog about it at some point; the script engines do some fancy footwork in this department to keep the stack from blowing.)&lt;/P&gt;
&lt;P&gt;Here's the thing -- if you have an upper bound on the amount of stack you're going to use, you might as well just ask for it. If you don't have an upper bound -- if the upper bound is determined by something at runtime and it could be arbitrarily big -- then use the heap, because really big stack allocations are too risky. &lt;/P&gt;
&lt;P&gt;For example, I'll often see code where _alloca is used to hold a temporary copy of a string when it is being converted from eight bit ASCII to UTF-16. Bad idea, particularly if the string can come from an untrusted internet script. The string could be a million bytes long, and blow the stack! Aaargh! It's drivin' me nuts!&lt;/P&gt;
&lt;P&gt;The thing is, stack allocation is incredibly fast, and in many situations the &lt;EM&gt;common&lt;/EM&gt; scenario is for the allocation to be small even if that's not guaranteed. Therefore I often use a "best of both worlds" strategy if I have data that is usually small but might be huge. First, I declare a stack buffer twice the size I expect to use. Then detect if more than that is required and allocate it off the heap if it is. (Of course, you have to remember to clean up the heap buffer if you do that.)&lt;/P&gt;
&lt;P&gt;*********************************&lt;/P&gt;
&lt;P&gt;You'll note how few new hit television series are called "Extreme Television Editing", or "New Issues In Satellite Uplink Futures Contract Law" -- though come to think of it, either of those would be more likely to catch my interest than the vast majority of the inaptly named "reality" television. Therefore I try to avoid talking about the blog in the blog -- I personally find blogs about blogging boring. I'll keep this short then.&lt;/P&gt;A number of people have asked me questions like "can I quote your blog in my blog?", "can I post your article in my wiki?", "can I use this information in my MSDN Magazine article?" etc. 
&lt;P&gt;I'm putting this information on the web because I want it to reach the people who can use it, so by all means, disseminate the information widely. I ask only four things: &lt;/P&gt;
&lt;P&gt;1) Please give me a heads-up before you do. &lt;BR&gt;2) Please attribute the source, preferably with a link back to the original. &lt;BR&gt;3) Please don't quote me out of context. &lt;BR&gt;4) Please understand that by doing so, you remove my ability to correct mistakes in your copy. &lt;/P&gt;
&lt;P&gt;UPDATE:&lt;A class="" href="http://blogs.msdn.com/ericlippert/archive/2008/10/07/boring-metablogging-part-two.aspx" mce_href="http://blogs.msdn.com/ericlippert/archive/2008/10/07/boring-metablogging-part-two.aspx"&gt; I have posted a follow-up to these guidelines.&lt;/A&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=193305" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ericlippert/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.msdn.com/ericlippert/archive/tags/COM+Programming/default.aspx">COM Programming</category><category domain="http://blogs.msdn.com/ericlippert/archive/tags/Performance/default.aspx">Performance</category><category domain="http://blogs.msdn.com/ericlippert/archive/tags/Aargh_2100_/default.aspx">Aargh!</category><category domain="http://blogs.msdn.com/ericlippert/archive/tags/Metablogging/default.aspx">Metablogging</category><category domain="http://blogs.msdn.com/ericlippert/archive/tags/bad+jokes/default.aspx">bad jokes</category></item><item><title>Once More Into The Breach</title><link>http://blogs.msdn.com/ericlippert/archive/2003/12/11/once-more-into-the-breach.aspx</link><pubDate>Thu, 11 Dec 2003 22:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:42921</guid><dc:creator>Eric Lippert</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/ericlippert/comments/42921.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ericlippert/commentrss.aspx?PostID=42921</wfw:commentRss><description>&lt;P&gt;&lt;FONT face="Lucida Sans Unicode" color=purple&gt;&lt;SPAN&gt;This is the new home of Eric Lippert's Fabulous Adventures In Coding. Eventually the content from &lt;A href="http://blogs.gotdotnet.com/ericli"&gt;http://blogs.gotdotnet.com/ericli&lt;/A&gt; will be moved over here&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=42921" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ericlippert/archive/tags/Introduction/default.aspx">Introduction</category><category domain="http://blogs.msdn.com/ericlippert/archive/tags/Metablogging/default.aspx">Metablogging</category></item><item><title>Heads up: Fabulous Adventures will be moving</title><link>http://blogs.msdn.com/ericlippert/archive/2003/12/05/heads-up-fabulous-adventures-will-be-moving.aspx</link><pubDate>Fri, 05 Dec 2003 21:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:53453</guid><dc:creator>Eric Lippert</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ericlippert/comments/53453.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ericlippert/commentrss.aspx?PostID=53453</wfw:commentRss><description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;
    &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;
        &lt;span style="FONT-SIZE: 10pt; COLOR: purple; FONT-FAMILY: 'Lucida Sans Unicode'; mso-bidi-font-family: 'Times New Roman'"&gt;A
        number of people have pointed out to me over the last few months that this blog server
        is a little flaky.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;There are occasionally
        "out of memory" errors and other failures reported, sometimes my posts fail to actually
        propagate to the server properly, and so on.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;&lt;?xml:namespace prefix = o ns = 
"urn:schemas-microsoft-com:office:office" /&gt;
        &lt;o:p&gt;&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: purple; FONT-FAMILY: 'Lucida Sans Unicode'; mso-bidi-font-family: 'Times New Roman'"&gt;
        &lt;o:p&gt;&amp;#160;&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: purple; FONT-FAMILY: 'Lucida Sans Unicode'; mso-bidi-font-family: 'Times New Roman'"&gt;FYI,
        some time over the next month I'll be moving my blog over to &lt;a href="http://weblogs.asp.net/"&gt;http://weblogs.asp.net/&lt;/a&gt; --
        that site has the appropriate human and technical resources to handle the considerable
        (and unexpected!) response that have been overwhelming the blogs.gotdotnet beta site.&lt;o:p&gt;&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: purple; FONT-FAMILY: 'Lucida Sans Unicode'; mso-bidi-font-family: 'Times New Roman'"&gt;
        &lt;o:p&gt;&amp;#160;&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: purple; FONT-FAMILY: 'Lucida Sans Unicode'; mso-bidi-font-family: 'Times New Roman'"&gt;I
        apologize in advance for the inconvenience.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;I'll
        see what I can do about moving existing entries over, putting in the appropriate redirects,
        etc.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;
        &lt;o:p&gt;&lt;/o:p&gt;
        &lt;/span&gt;
    &lt;/p&gt;
&lt;/body&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=53453" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ericlippert/archive/tags/Metablogging/default.aspx">Metablogging</category></item></channel></rss>