<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">The Old New Thing</title><subtitle type="html">not actually &lt;A HREF="http://blogs.msdn.com/oldnewthing/archive/2008/07/17/8741112.aspx#8750046"&gt;to establish a blogging point where individuals can enrich their learns on facilitating and leveraging .NET-related activities most effectively&lt;/A&gt;</subtitle><id>http://blogs.msdn.com/oldnewthing/atom.xml</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/oldnewthing/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/oldnewthing/atom.xml" /><generator uri="http://communityserver.org" version="2.1.61025.2">Community Server</generator><updated>2009-10-26T07:00:01Z</updated><entry><title>Signs that the symbols in your stack trace are wrong</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/oldnewthing/archive/2009/11/06/9918390.aspx" /><id>http://blogs.msdn.com/oldnewthing/archive/2009/11/06/9918390.aspx</id><published>2009-11-06T15:00:00Z</published><updated>2009-11-06T15:00:00Z</updated><content type="html">&lt;P&gt;
One of the things programmers send to each other when they
are trying to collaborate on a debugging problem is stack traces.
Usually something along the lines of
"My program does X, then Y, then Z, and then it crashes.
Here is a stack trace.
Can you tell me what's wrong?"
&lt;/P&gt;
&lt;P&gt;
It helps if you at least glance at the stack trace before
you send it, because there are often signs that the stack
trace you're about to send is completely useless because
the symbols are wrong.
Here's an example:
&lt;/P&gt;
&lt;BLOCKQUOTE CLASS=q&gt;
&lt;P&gt;
We are testing our program and it gradually grinds to a halt.
When we connect a debugger, we find that all of our threads,
no matter what they are doing, eventually wind up
hung in &lt;CODE&gt;kernel32!EnumResourceLanguagesA&lt;/CODE&gt;.
Can someone explain why that function is hanging,
and why it seems all roads lead to it?
&lt;/P&gt;
&lt;PRE&gt;
   0  Id: 12a4.1468 Suspend: 1 Teb: 000006fb`fffdc000 Unfrozen
kernel32!EnumResourceLanguagesA+0xbea00
kernel32!EnumResourceLanguagesA+0x2b480
bogosoft!CObjMarker::RequestBlockForFetch+0xf0
...

   1  Id: 12a4.1370 Suspend: 1 Teb: 000006fb`fffda000 Unfrozen
kernel32!EnumResourceLanguagesA+0xbea00
kernel32!EnumResourceLanguagesA+0x2b480
bsnetlib!CSubsystem::CancelMain+0x90

   2  Id: 12a4.1230 Suspend: 1 Teb: 000006fb`fffd8000 Unfrozen
NETAPI32!I_NetGetDCList+0x117e0
kernel32!EnumResourceLanguagesA+0x393a0
ntdll!LdrResFindResource+0x58b20
...

   3  Id: 12a4.cc0 Suspend: 1 Teb: 000006fb`fffd6000 Unfrozen
kernel32!EnumResourceLanguagesA+0xa80
bsnetlib!BSFAsyncWait+0x190
...

  4  Id: 12a4.1208 Suspend: 1 Teb: 000006fb`fffd4000 Unfrozen
kernel32!EnumResourceLanguagesA+0xbea00
kernel32!EnumResourceLanguagesA+0x2b480
bogosoft!TObjList&amp;lt;DistObj&amp;gt;::Get+0xb0

  5  Id: 12a4.1538 Suspend: 1 Teb: 000006fb`fffae000 Unfrozen
kernel32!EnumResourceLanguagesA+0xbf3d0
kernel32!EnumResourceLanguagesA+0x2c800
bsnetlib!Tcp::ReadSync+0x340
...

   6  Id: 12a4.16e0 Suspend: 1 Teb: 000006fb`fffac000 Unfrozen
ntdll!LdrResFindResource+0x61808
ntdll!LdrResFindResource+0x1822a0
kernel32!EnumResourceLanguagesA+0x393a0
ntdll!LdrResFindResource+0x58b20 
...
&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;
This stack trace looks suspicious for a variety of reasons.
&lt;/P&gt;
&lt;P&gt;
First of all,
look at that offset
&lt;CODE&gt;EnumResourceLanguagesA+&lt;U&gt;0xbea00&lt;/U&gt;&lt;/CODE&gt;.
It's unlikely that the
&lt;CODE&gt;EnumResourceLanguagesA&lt;/CODE&gt;
function (or any other function)
is over 750KB in size, as this offset suggests.
&lt;/P&gt;
&lt;P&gt;
Second, it's unlikely that the &lt;CODE&gt;EnumResourceLanguagesA&lt;/CODE&gt;
function (or any other function, aside from obvious cases
like tree walking) is recursive.
And it's certainly unlikely that a huge function will also be
recursive.
&lt;/P&gt;
&lt;P&gt;
Third, it seems unlikely that the &lt;CODE&gt;EnumResourceLanguagesA&lt;/CODE&gt;
function would call,
&lt;CODE&gt;NETAPI32!I_NetGetDCList&lt;/CODE&gt;.
What does enumerating resource languages have to do with getting
a DC list?
&lt;/P&gt;
&lt;P&gt;
Fourth, look at those functions that are allegedly
callers of &lt;CODE&gt;EnumResourceLanguagesA&lt;/CODE&gt;:
&lt;CODE&gt;bogosoft!CObjMarker::RequestBlockForFetch&lt;/CODE&gt;,
&lt;CODE&gt;bsnetlib!CSubsystem::CancelMain&lt;/CODE&gt;,
&lt;CODE&gt;bsnetlib!Tcp::ReadSync&lt;/CODE&gt;.
Why would any of these functions want to enumerate resource
languages?
&lt;/P&gt;
&lt;P&gt;
These symbols are obvious wrong.
The huge offsets are present because the debugger has access only
to exported functions,
and it's merely showing you the name of the nearest symbol,
even though it has nothing to do with the actual function.
It's just using the nearest signpost it can come up with.
It's like if somebody gave you directions to the movie theater like this:
"Go to city hall downtown and then go north for 35 miles."
This doesn't mean that the movie theater is in the downtown district
or that the downtown district is 35 miles long.
It's just that the person who's giving you directions can't come
up with a better landmark than city hall.
&lt;/P&gt;
&lt;P&gt;
This is just another case of the principle that
&lt;A HREF="http://blogs.msdn.com/oldnewthing/archive/2006/07/10/661389.aspx"&gt;
you have to know what's right before you can see what's wrong&lt;/A&gt;.
If you have no experience with good stack traces,
you don't know how to recognize a bad one.
&lt;/P&gt;
&lt;P&gt;
Oh, and even though the functions in question are in
&lt;CODE&gt;kernel32&lt;/CODE&gt;,
you can still get symbols for that DLL
with the help of the
&lt;A HREF="http://support.microsoft.com/kb/311503"&gt;
Microsoft Symbol Server&lt;/A&gt;.
&lt;/P&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9918390" width="1" height="1"&gt;</content><author><name>oldnewthing</name><uri>http://blogs.msdn.com/members/oldnewthing.aspx</uri></author><category term="Code" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/Code/default.aspx" /></entry><entry><title>The day the coffee machine exploded</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/oldnewthing/archive/2009/11/05/9917671.aspx" /><id>http://blogs.msdn.com/oldnewthing/archive/2009/11/05/9917671.aspx</id><published>2009-11-05T15:00:00Z</published><updated>2009-11-05T15:00:00Z</updated><content type="html">&lt;P&gt;
Some time ago, Microsoft began installing
&lt;A HREF="http://blogs.msdn.com/oldnewthing/archive/2007/05/14/2611278.aspx"&gt;
Starbucks coffee makers&lt;/A&gt;
in the kitchens,
and caffeine addicts waited anxiously 
for the machines to reach their building.
Or at least that's what happened on the main Redmond campus.
But what about the satellite offices?
&lt;/P&gt;
&lt;P&gt;
I'm told that each satellite office qualified for an iCup machine
when the number of employees at the office reached some magic value.
One of my colleagues who works at the office in New York City told me
that they eagerly awaited the arrival of the machine when they
learned that they reached that threshold.
The long-anticipated day arrived:
The coffee machine was installed in the kitchen.
&lt;/P&gt;
&lt;P&gt;
And it exploded.
&lt;/P&gt;
&lt;P&gt;
Okay, it didn't really explode.
But the receptacle for holding the spent grounds overflowed and burst,
spilling its guts out onto the kitchen floor.
If you didn't know what happened, you'd have thought it had exploded.
&lt;/P&gt;
&lt;P&gt;
The reason it exploded was that, although the New York office
is rather small, it does have a very high number of visitors.
As you can imagine,
clients pay visits to the New York offices
for meetings, presentations, all that stuff that clients visit
offices for;
but the underlying algorithm for determining how many coffee machines
each office receives doesn't take into account
how many visitors each location receives.
&lt;/P&gt;
&lt;P&gt;
Oh, and happy Guy Fawkes Day.
Try not to blow up any coffee machines.
&lt;/P&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9917671" width="1" height="1"&gt;</content><author><name>oldnewthing</name><uri>http://blogs.msdn.com/members/oldnewthing.aspx</uri></author><category term="Non-Computer" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/Non-Computer/default.aspx" /></entry><entry><title>In the product end game, every change carries significant risk</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/oldnewthing/archive/2009/11/04/9917053.aspx" /><id>http://blogs.msdn.com/oldnewthing/archive/2009/11/04/9917053.aspx</id><published>2009-11-04T15:00:01Z</published><updated>2009-11-04T15:00:01Z</updated><content type="html">&lt;P&gt;
One of the things I mentioned in
&lt;A HREF="http://www.acm.uiuc.edu/conference/2009/speakers.html"&gt;
my talk the other week
comparing school with Microsoft&lt;/A&gt;
is that in school,
as the deadline approaches, the work becomes increasingly frantic.
On the other hand, in commercial software, as the deadline approaches,
the rate of change slows down,
because the risk of regression outweighs the benefit of the fix.
&lt;/P&gt;
&lt;P&gt;
A colleague of mine offered up this example from Windows&amp;nbsp;3.1:
To fix a bug in GDI, the developers made a very simple fix.
It consisted of setting a global flag when a condition was detected
and checking the flag in another place in the code and executing
a few lines of code if it was set.
The change was just a handful of lines, it was very tightly scoped,
and it did not affect the behavior of GDI if the flag was not set.
They tested the code, it fixed the problem, everything looked good.
What could possibly go wrong?
&lt;/P&gt;
&lt;P&gt;
A few days after the fix went in, the GDI team started seeing
weird crashes that made no sense in code completely unrelated
to the places where they made the change.
What is going on?
&lt;/P&gt;
&lt;P&gt;
After some investigation, they discovered a memory corruption bug.
In 16-bit Windows, the local heap came directly after the global variables,
and local heap memory was managed in the form of local handles.
A common error when working with the local heap was using a local
handle as a pointer rather than passing it to the &lt;CODE&gt;LocalLock&lt;/CODE&gt;
function to convert the handle to a pointer.
The developers found a place where the code forgot to perform
this conversion before using a local handle.
(In Windows&amp;nbsp;3.1, most of GDI was written in assembly language,
so you didn't have a compiler to do type checking and complain
that you're using a handle as a pointer.)
Using the handle as a pointer resulted in a global variable
being corrupted.
&lt;/P&gt;
&lt;P&gt;
Investigation of the code history revealed that this bug had
existed in the code since the day it was first written.
Why hadn't anybody encountered this bug before?
&lt;/P&gt;
&lt;P&gt;
The handle that was being used incorrectly
was allocated at boot time,
so its value was consistent from run to run.
The corruption took the form of writing a zero into memory
at the wrong location,
and it so happened that the variable that was accidentally being
set to zero was not used often, and at the time the corruption occurred,
it &lt;I&gt;happened to have the value zero already&lt;/I&gt;.
&lt;/P&gt;
&lt;P&gt;
Adding a new global variable
shifted the other global variables around in memory,
and now the accidental write of zero hit an important
variable whose value was usually &lt;I&gt;not&lt;/I&gt; zero.
&lt;/P&gt;
&lt;P&gt;
In the product end game, every change carries significant risk.
It's often a more prudent decision to live with the bug you understand
than to fix it and risk exposing an even worse bug
whose existence may not come to light until after you ship.
&lt;/P&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9917053" width="1" height="1"&gt;</content><author><name>oldnewthing</name><uri>http://blogs.msdn.com/members/oldnewthing.aspx</uri></author><category term="History" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/History/default.aspx" /></entry><entry><title>Good advice comes with a rationale so you can tell when it becomes bad advice</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/oldnewthing/archive/2009/11/04/9917052.aspx" /><id>http://blogs.msdn.com/oldnewthing/archive/2009/11/04/9917052.aspx</id><published>2009-11-04T15:00:00Z</published><updated>2009-11-04T15:00:00Z</updated><content type="html">&lt;P&gt;
A customer asked for guidance in software design:
&lt;/P&gt;
&lt;BLOCKQUOTE CLASS=q&gt;
Is there an issue with creating and using COM objects from a UI thread
which was initialized as STA?
I have heard that it is a best practice to create and use COM objects
on a background thread which is MTA.
I would like to have some more information as to why.
Any help?
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;
(I still have trouble with the phrase &lt;I&gt;best practice&lt;/I&gt;,
especially when it is combined with the indefinite article:
&lt;I&gt;a best practice&lt;/I&gt;.
It's like asking "Where is a tallest building?")
&lt;/P&gt;
&lt;P&gt;
Good advice comes with a rationale so you can tell when it becomes
bad advice.
If you don't understanding why something should be done,
then you've fallen into the trap of cargo cult programming,
and you'll keep doing it even when it's no longer necessary
or even becomes deleterious.
&lt;/P&gt;
&lt;P&gt;
In fact, you will find that if you try to follow this advice to the letter,
most shell objects will stop working,
because
&lt;A HREF="http://blogs.msdn.com/oldnewthing/archive/2008/04/24/8420242.aspx"&gt;
shell objects tend to require an STA&lt;/A&gt;.
But in the absence of a rationale document or any other context,
it's unclear what the scope of the original advice was.
Maybe it makes sense in context, but right now it's just a statement
with no discussion or rationale.
&lt;/P&gt;
&lt;P&gt;
When I asked the customer, "Can you provide the documents that
provided this recommendation?
Perhaps this 'best practice' makes sense in context.
Right now, it's just a bare recommendation with no discussion
or rationale."
&lt;/P&gt;
&lt;P&gt;
The customer never wrote back.
&lt;/P&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9917052" width="1" height="1"&gt;</content><author><name>oldnewthing</name><uri>http://blogs.msdn.com/members/oldnewthing.aspx</uri></author><category term="Other" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/Other/default.aspx" /></entry><entry><title>When asked to choose among multiple options, the politician will pick all of them</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/oldnewthing/archive/2009/11/03/9916444.aspx" /><id>http://blogs.msdn.com/oldnewthing/archive/2009/11/03/9916444.aspx</id><published>2009-11-03T15:00:01Z</published><updated>2009-11-03T15:00:01Z</updated><content type="html">&lt;P&gt;
During the run-up to a local election some time ago,
the newspaper posed the same set of questions to each of the
candidates and published the responses in a grid format so the
readers could easily compare them.
&lt;/P&gt;
&lt;P&gt;
The candidates agreed on some issues, had opposing positions on others,
but the question whose answers struck me was one of the form
"If budget cuts forced you to eliminate one of the following four
programs, which would you cut?"
&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Candidate 1: "I have no intention of letting our budget get into
    a situation in which this would become an issue.
    All of these programs are very important to our community,
    and under my leadership, they will continue to be funded."
&lt;LI&gt;Candidate 2: "I don't believe we need to eliminate any of these
    popular programs. If we review our financial situation,
    we will find that we can continue to provide for all of them."
&lt;LI&gt;Candidate 3: "Much as I personally enjoy Program&amp;nbsp;X,
    it ranks as a lower priority to me than the other options.
    Program&amp;nbsp;X was originally a community-run program,
    and I would encourage residents and
    the business community to step forward and keep alive this
    program which has greatly benefited our community
    over the years."
&lt;/UL&gt;
&lt;P&gt;
Notice that the first two candidates, when asked to make a tough
decision, opted to make no decision at all.
(Compare another election in which
&lt;A HREF="http://blogs.msdn.com/oldnewthing/archive/2007/09/03/4712713.aspx"&gt;
the mainstream candidates rated everything as high priority&lt;/A&gt;.)
The first candidate said, "This would never happen."
The second candidate said, "It's not happening."
The third candidate is the only one who sat down and made the call
to cut one of the programs.
The first two were playing politics, afraid to make a decision
for fear that it would alienate some portion of the electorate.
The third understood the situation and made the hard decision.
&lt;/P&gt;
&lt;P&gt;
I voted for the third candidate.
&lt;/P&gt;
&lt;P&gt;
Today is Election Day in the United States.
Don't forget to vote.
(Void where prohibited.)
&lt;/P&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9916444" width="1" height="1"&gt;</content><author><name>oldnewthing</name><uri>http://blogs.msdn.com/members/oldnewthing.aspx</uri></author><category term="Non-Computer" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/Non-Computer/default.aspx" /></entry><entry><title>Microspeak: Net out</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/oldnewthing/archive/2009/11/03/9916443.aspx" /><id>http://blogs.msdn.com/oldnewthing/archive/2009/11/03/9916443.aspx</id><published>2009-11-03T15:00:00Z</published><updated>2009-11-03T15:00:00Z</updated><content type="html">&lt;P&gt;
It started out in finance, but the term has crept into more
mainstream usage (at least within Microsoft)
and along the way picked up its own meaning:
&lt;/P&gt;
&lt;BLOCKQUOTE CLASS=m&gt;
Where did we &lt;U&gt;net out&lt;/U&gt; on this?
&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE CLASS=m&gt;
Customers want you to &lt;U&gt;net out&lt;/U&gt; the business value.
&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE CLASS=m&gt;
Note any significant changes to the forecast and explain the
reasons why.
&lt;U&gt;Net out&lt;/U&gt; changes to start conversation.
&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE CLASS=m&gt;
&lt;P&gt;
Include the following points in your presentation:
&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;...
&lt;LI&gt;&lt;U&gt;Net out&lt;/U&gt; action plan
    &lt;A HREF="http://blogs.msdn.com/oldnewthing/archive/2007/09/25/5108967.aspx"&gt;
    moving forward&lt;/A&gt;
&lt;/BLOCKQUOTE&gt;
&lt;/OL&gt;
&lt;P&gt;
The next citation is a bullet point from a PowerPoint slide:
&lt;/P&gt;
&lt;BLOCKQUOTE CLASS=m&gt;
&lt;P ALIGN=center&gt;&lt;FONT SIZE=+2&gt;&lt;B&gt;Agenda&lt;/B&gt;&lt;/FONT&gt;&lt;BR&gt;
&lt;FONT SIZE=+1&gt;&lt;B&gt;Each district/vertical will answer/report back on:&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;...
&lt;LI&gt;Net out top 3 business &lt;A HREF="http://blogs.msdn.com/oldnewthing/archive/2004/01/07/48304.aspx"&gt;asks&lt;/A&gt;
&lt;/UL&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;
(I also have some finance citations, but they aren't relevant to Microspeak,
so I've left them out.)
&lt;/P&gt;
&lt;P&gt;
In finance, to &lt;I&gt;net out&lt;/I&gt; is to cancel out positive
and negative amounts.
For example, you might &lt;I&gt;net out&lt;/I&gt; an account by cancelling amounts
owed against amounts due
in order to eliminate offsetting transactions.
When calculating tax liability,
you &lt;I&gt;net out&lt;/I&gt; your gains against your losses to determine
your net change for the tax period.
&lt;/P&gt;
&lt;P&gt;
In Microspeak, well, I'm not sure what it means.
In that first citation, it appears to be a synonym for
&lt;I&gt;come to a conclusion&lt;/I&gt;.
The question appears to be a rephrasing of
"What was our conclusion on this?"
or
"What did we finally decide on this?"
&lt;/P&gt;
&lt;P&gt;
In the second citation, it appears to be a synonym for
&lt;I&gt;summarize in terms of net benefit/loss&lt;/I&gt;.
"Customers want you to show the net benefit of the product."
&lt;/P&gt;
&lt;P&gt;
In the third citation, it appears to be used merely to mean
&lt;I&gt;summarize&lt;/I&gt;.
&lt;/P&gt;
&lt;P&gt;
And in the final two citations, it appears to be simply a verb
meaning &lt;I&gt;to produce&lt;/I&gt;.
&lt;/P&gt;
&lt;P&gt;
Note that &lt;I&gt;net out&lt;/I&gt; is unrelated to that other Microspeak
phrase &lt;I&gt;net net&lt;/I&gt;, discussed earlier.
&lt;/P&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9916443" width="1" height="1"&gt;</content><author><name>oldnewthing</name><uri>http://blogs.msdn.com/members/oldnewthing.aspx</uri></author><category term="Non-Computer" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/Non-Computer/default.aspx" /><category term="Microspeak" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/Microspeak/default.aspx" /></entry><entry><title>Hey, is there somebody around to accept this award?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/oldnewthing/archive/2009/11/02/9915989.aspx" /><id>http://blogs.msdn.com/oldnewthing/archive/2009/11/02/9915989.aspx</id><published>2009-11-02T15:00:00Z</published><updated>2009-11-02T15:00:00Z</updated><content type="html">&lt;P&gt;
Back in the late 1990s,
some large Internet association
conducted a survey
in order to bestow awards in categories like
&lt;I&gt;Best Web server&lt;/I&gt; and
&lt;I&gt;Best Web browser&lt;/I&gt;,
and one of the categories was
&lt;I&gt;Best Web authoring tool&lt;/I&gt;.
&lt;/P&gt;
&lt;P&gt;
We didn't find out about this until the organization contacted
the Windows team and said,
"Hi,
we would like to present Microsoft with the award for
Best Web authoring tool.
Please let us know who the author of Notepad is,
so that we can invite them to the award ceremony."
&lt;/P&gt;
&lt;P&gt;
Yup, Notepad won the award for Best Web authoring tool.
&lt;/P&gt;
&lt;P&gt;
The mail went out to the team.
"Hey, does anybody remember who wrote Notepad?"
&lt;/P&gt;
&lt;P&gt;
Even a decade ago, the original authorship of Notepad was lost
to the mists of time.
I think the person who ended up going was the original author
of the multi-line edit control,
since that's where the guts of Notepad lie.
&lt;/P&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9915989" width="1" height="1"&gt;</content><author><name>oldnewthing</name><uri>http://blogs.msdn.com/members/oldnewthing.aspx</uri></author><category term="History" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/History/default.aspx" /></entry><entry><title>Still working out the finer details of how this Hallowe'en thing works</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/oldnewthing/archive/2009/10/30/9915030.aspx" /><id>http://blogs.msdn.com/oldnewthing/archive/2009/10/30/9915030.aspx</id><published>2009-10-30T14:00:01Z</published><updated>2009-10-30T14:00:01Z</updated><content type="html">&lt;P&gt;
Here's an excerpt from a conversation on the subject of Hallowe'en
which I had with my niece some time ago.
Let's call her "Cathy".
(This is
&lt;A HREF="http://blogs.msdn.com/oldnewthing/archive/2006/10/31/910274.aspx"&gt;
a different Cathy from last time&lt;/A&gt;.)
&lt;/P&gt;
&lt;P&gt;
"Cathy, what do you do on Hallowe'en?"
&lt;/P&gt;
&lt;P&gt;
"You get all dressed up and people give you candy."
&lt;/P&gt;
&lt;P&gt;
"&lt;A HREF="http://en.wikipedia.org/wiki/Trick-or-treating"
&gt;What do you say when people come to the door&lt;/A&gt;?"
&lt;/P&gt;
&lt;P&gt;
"&lt;A HREF="http://www.chuckecheese.com/"&gt;Chuck-E-Cheese&lt;/A&gt;!"
&lt;/P&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9915030" width="1" height="1"&gt;</content><author><name>oldnewthing</name><uri>http://blogs.msdn.com/members/oldnewthing.aspx</uri></author><category term="Non-Computer" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/Non-Computer/default.aspx" /></entry><entry><title>What is the format for FirstInstallDateTime on Windows 95?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/oldnewthing/archive/2009/10/30/9915029.aspx" /><id>http://blogs.msdn.com/oldnewthing/archive/2009/10/30/9915029.aspx</id><published>2009-10-30T14:00:00Z</published><updated>2009-10-30T14:00:00Z</updated><content type="html">&lt;P&gt;
Public Service Announcement:
Daylight Saving Time ends in most parts of the United States
this weekend.
&lt;/P&gt;
&lt;P&gt;
Windows&amp;nbsp;98/98/Me recorded the date and time at which Setup was
run in the registry under
&lt;NOBR&gt;&lt;CODE&gt;HKEY_LOCAL_MACHINE\&lt;WBR&gt;Software\&lt;WBR
&gt;Microsoft\&lt;WBR&gt;Windows\&lt;WBR&gt;CurrentVersion&lt;/CODE&gt;&lt;/NOBR&gt;
as a binary value named &lt;CODE&gt;FirstInstallDateTime&lt;/CODE&gt;.
What is the format of this data?
&lt;/P&gt;
&lt;P&gt;
Take the binary value and treat it as a 32-bit little-endian value.
The format of the value is basically
&lt;A HREF="http://blogs.msdn.com/oldnewthing/archive/2003/09/05/54806.aspx"&gt;
DOS date/time format&lt;/A&gt;,
except that the seconds are always 0 or 1 (usually 1),
due to a programming error.
&lt;/P&gt;
&lt;P&gt;
Exercise: What error would result in the seconds always being 0 or 1
(usually 1)?
&lt;/P&gt;
&lt;P&gt;
[&lt;B&gt;Update&lt;/B&gt;:
&lt;A HREF="http://blogs.msdn.com/oldnewthing/archive/2009/10/30/9915029.aspx#9915323"&gt;
Falcon is the first to post the correct answer&lt;/A&gt;.]
&lt;/P&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9915029" width="1" height="1"&gt;</content><author><name>oldnewthing</name><uri>http://blogs.msdn.com/members/oldnewthing.aspx</uri></author><category term="History" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/History/default.aspx" /><category term="Time" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/Time/default.aspx" /></entry><entry><title>What this batch file needs is more escape characters</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/oldnewthing/archive/2009/10/29/9914426.aspx" /><id>http://blogs.msdn.com/oldnewthing/archive/2009/10/29/9914426.aspx</id><published>2009-10-29T14:00:00Z</published><updated>2009-10-29T14:00:00Z</updated><content type="html">&lt;P&gt;
(Employing the snowclone "What this X needs is more Y.")
&lt;/P&gt;
&lt;P&gt;
Each time you add a parsing pass to the batch processor,
you have to
&lt;A HREF="http://alcor.concordia.ca/~smw/home/telnet_song.html"&gt;
add another layer of escaping&lt;/A&gt;.
This is just a special case of the more general rule of thumb:
&lt;A HREF="http://c2.com/cgi/wiki?ButlerLampson"&gt;
any problem in quoting can be solved by adding another layer of escaping&lt;/A&gt;.
&lt;/P&gt;
&lt;P&gt;
(Okay, it's not actually true, nor is it a rule of thumb,
but it's still something to keep in mind.)
&lt;/P&gt;
&lt;P&gt;
When you enable delayed variable expansion, you add another parsing
pass to the batch processor.
It used to expand % variables at the time the line is ready,
but now you told it that, oh wait, just before executing the
command, expand it a second time (this time looking for ! variables.)
&lt;/P&gt;
Which means that
&lt;A HREF="http://blogs.msdn.com/oldnewthing/archive/2008/08/06/8835317.aspx#8838178"&gt;
if you want to echo an exclamation point&lt;/A&gt;,
you have to protect the exclamation point so the parser won't treat
it as a delayed expansion.
&lt;/P&gt;
&lt;PRE&gt;
echo Error^^!
&lt;/PRE&gt;
&lt;P&gt;
The &lt;CODE&gt;^^&lt;/CODE&gt; collapses to a &lt;CODE&gt;^&lt;/CODE&gt; during the first
parsing pass.
On the second parsing pass, the &lt;CODE&gt;^!&lt;/CODE&gt; turns into a &lt;CODE&gt;!&lt;/CODE&gt;
&lt;/P&gt;
&lt;P&gt;
Remember,
the batch language was not designed; it evolved.
I admire
&lt;A HREF="http://blogs.msdn.com/oldnewthing/archive/2008/08/06/8835317.aspx#8839065"&gt;
the approach taken by commenter Nick&lt;/A&gt;,
in a tip of the hat to Douglas Adams:
&lt;/P&gt;
&lt;BLOCKQUOTE CLASS=q&gt;
Much like the universe,
if anyone ever &lt;I&gt;does&lt;/I&gt; fully come to understand Batch
then the language will instantly be replaced by an
infinitely weirder and more complex version of itself.
This has obviously happened at least once before ;)
&lt;/BLOCKQUOTE&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9914426" width="1" height="1"&gt;</content><author><name>oldnewthing</name><uri>http://blogs.msdn.com/members/oldnewthing.aspx</uri></author><category term="Tips/Support" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/Tips_2F00_Support/default.aspx" /></entry><entry><title>Warning: Not much useful content inside</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/oldnewthing/archive/2009/10/28/9913810.aspx" /><id>http://blogs.msdn.com/oldnewthing/archive/2009/10/28/9913810.aspx</id><published>2009-10-28T14:00:01Z</published><updated>2009-10-28T14:00:01Z</updated><content type="html">&lt;P&gt;
Remember, this Web site is
&lt;A HREF="http://blogs.msdn.com/oldnewthing/archive/2007/08/10/4315707.aspx"&gt;
for entertainment purposes only&lt;/A&gt;.
Sometimes it takes people
&lt;A HREF="http://forums.microsoft.com/msdn/showpost.aspx?postid=2514213&amp;siteid=1#_ctl0_MainContent_PostFlatView__ctl0_PostRepeater__ctl4_Subject"&gt;
a little while before they realize this&lt;/A&gt;:
&lt;/P&gt;
&lt;BLOCKQUOTE CLASS=q&gt;
I apologize for posting the link to the "Old New Thing" blog. [...]
I have read a few articles in the "Old New Thing" blog
and so far I have not seen much that is useful there.
&lt;/BLOCKQUOTE&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9913810" width="1" height="1"&gt;</content><author><name>oldnewthing</name><uri>http://blogs.msdn.com/members/oldnewthing.aspx</uri></author><category term="Other" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/Other/default.aspx" /></entry><entry><title>Why does the Photo Gallery show all my photos with a colored tinge?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/oldnewthing/archive/2009/10/28/9913809.aspx" /><id>http://blogs.msdn.com/oldnewthing/archive/2009/10/28/9913809.aspx</id><published>2009-10-28T14:00:00Z</published><updated>2009-10-28T14:00:00Z</updated><content type="html">&lt;P&gt;
When you view your pictures with
the Photo Gallery program which comes with Windows Vista,
and which is also
&lt;A HREF="http://download.live.com/photogallery"&gt;
available for download from live.com&lt;/A&gt;,
you might see a colored tinge.
Where is the tinge coming from, and how do you get rid of it?
&lt;/P&gt;
&lt;P&gt;
Ironically,
what you're actually seeing is the absence of a tinge,
but you got so used to seeing the tinge, your eyes
established the tinge as the new baseline.
&lt;/P&gt;
&lt;P&gt;
Not all display devices show exactly the same color when you ask
them to display a particular RGB.
The &lt;I&gt;Windows Color System&lt;/I&gt;
takes into account the color characteristics of output devices
so that these variations can be
taken into account when rendering to those devices.
(Not that you could have figured this out from reading the
&lt;A HREf="http://www.microsoft.com/whdc/device/display/color/WCS.mspx"&gt;
official description&lt;/A&gt;,
which just rambles for two paragraphs of marketing nonsense
without actually saying &lt;I&gt;what it does&lt;/I&gt;.)
The goal is to make the color you see on the screen
match the color that comes out on the printer,
and have both match the color the person who created the image
intended you to see.
&lt;/P&gt;
&lt;P&gt;
If you don't want Windows to perform this color correction,
open your Start menu and run the &lt;I&gt;Color Management&lt;/I&gt; tool
by typing its name into the Search box, or by hunting for it
inside your Control Panel.
Once you manage to launch it (by whatever means),
go to your display device, check &lt;I&gt;Use my settings for this device&lt;/I&gt;
and then remove the color profile.
&lt;/P&gt;
&lt;P&gt;
That was the tip.
Now come da history.
&lt;/P&gt;
&lt;P&gt;
The feature now known as the Windows Color System was introduced
in Windows&amp;nbsp;95 under the name
&lt;I&gt;Independent Color Management&lt;/I&gt;.
This explains why the color profile files have the
&lt;CODE&gt;*.icm&lt;/CODE&gt; extension.
&lt;/P&gt;
&lt;P&gt;
But Independent Color Management was not the original name for
the feature.
The original name was &lt;I&gt;Device-Independent Color&lt;/I&gt;,
but the name was changed because the original name resulted in
an unfortunate acronym that was lost on nobody.
When Device-Independent Color was being written,
one of the programmers in the user interface group reviewed
the work in progress and sent an update to the rest
of the team.
She wrote,
"I just looked at David's DIC, and (since I know you're
all going to ask)... it looks good."
&lt;/P&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9913809" width="1" height="1"&gt;</content><author><name>oldnewthing</name><uri>http://blogs.msdn.com/members/oldnewthing.aspx</uri></author><category term="History" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/History/default.aspx" /><category term="Tips/Support" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/Tips_2F00_Support/default.aspx" /></entry><entry><title>If aluminum pull tab redemption is a rumor, what happens to all the tabs?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/oldnewthing/archive/2009/10/27/9913255.aspx" /><id>http://blogs.msdn.com/oldnewthing/archive/2009/10/27/9913255.aspx</id><published>2009-10-27T14:00:01Z</published><updated>2009-10-27T14:00:01Z</updated><content type="html">&lt;P&gt;
Everybody should know by now that
&lt;A HREF="http://www.snopes.com/business/redeem/pulltabs.asp"&gt;
it is not true that pull tabs from aluminum cans can be redeemed
for time on a dialysis machine&lt;/a&gt;.
Of course, not everybody actually knows this,
and then the next question is, well,
what happens to all those pull tabs collected by misinformed people?
&lt;/P&gt;
&lt;P&gt;
The
&lt;A HREF="http://www.snopes.com/business/redeem/pulltabs.asp"&gt;
Snopes article&lt;/A&gt;
explains that it depends on where you turn in the tabs.
They might get recycled at the going scrap rate and the proceeds donated to
the National Kidney Foundation or
the Ronald McDonald House.
But I was most fascinated by 
&lt;A HREF="http://groups.google.com/groups?selm=1uilu2$ndh@gaia.ucs.orst.edu"&gt;
this resourceful researcher who played the game of "follow the tabs"&lt;/A&gt;
from a State Police office
to a high school
to a hospital
to the Shriners
to a library
to a community college,
where the trail finally runs cold.
&lt;/P&gt;
&lt;P&gt;
I related this story to a friend of mine, who did a double-take.
"Wait a second.
That guy where the trail runs cold?
I know that guy.
I used to work for him!"
&lt;/P&gt;
&lt;P&gt;
That the trail runs cold was hardly surprising to my friend.
Apparently, my friend's former boss was the sort of person who would never
admit that he made a mistake,
no matter how obvious the error.
My friend speculated that when his boss discovered that nobody would
take the aluminum pull tabs,
he certainly wasn't going to admit,
"Oops, sorry everybody."
In order to keep up appearances, he had to keep collecting them,
even though he had nowhere to dispose of them.
And of course,
all the independent pull-tab collectors who couldn't find anybody to
give them to gradually learned about this guy who will take them,
which meant that more and more of them kept coming in.
My friend figured,
"He probably has an enormous pile of aluminum pull tabs just sitting
in his garage."
&lt;/P&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9913255" width="1" height="1"&gt;</content><author><name>oldnewthing</name><uri>http://blogs.msdn.com/members/oldnewthing.aspx</uri></author><category term="Non-Computer" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/Non-Computer/default.aspx" /></entry><entry><title>Freudian typo: The accidental emoticon</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/oldnewthing/archive/2009/10/27/9913254.aspx" /><id>http://blogs.msdn.com/oldnewthing/archive/2009/10/27/9913254.aspx</id><published>2009-10-27T14:00:00Z</published><updated>2009-10-27T14:00:00Z</updated><content type="html">&lt;P&gt;
Some time ago, I ran across the following Freudian typo
in a mail thread discussing plans for the project after
Milestone&amp;nbsp;3, commonly abbreviated M3.
&lt;/P&gt;
&lt;BLOCKQUOTE CLASS=m&gt;
I'd like to talk with you about your plans for this area after &amp;lt;3.
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;
On the US-English keyboard layout, the M and comma keys are adjacent,
and a shifted comma is a less-than sign.
A simple off-by-one-key typo resulted in M3 turning into
&lt;A HREF="http://www.boingboing.net/2007/11/21/evolution-of-the-hea.html"&gt;
an emoticon&lt;/a&gt;.
&lt;/P&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9913254" width="1" height="1"&gt;</content><author><name>oldnewthing</name><uri>http://blogs.msdn.com/members/oldnewthing.aspx</uri></author><category term="Non-Computer" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/Non-Computer/default.aspx" /></entry><entry><title>Why won't my computer go to sleep?  Where is the energy going?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/oldnewthing/archive/2009/10/26/9912711.aspx" /><id>http://blogs.msdn.com/oldnewthing/archive/2009/10/26/9912711.aspx</id><published>2009-10-26T14:00:01Z</published><updated>2009-10-26T14:00:01Z</updated><content type="html">&lt;P&gt;
The &lt;CODE&gt;powercfg&lt;/CODE&gt; utility
&lt;A HREF="http://blogs.msdn.com/oldnewthing/archive/2008/02/13/7658352.aspx"&gt;
has been around for a while&lt;/A&gt;,
but in Windows&amp;nbsp;7, it gained a little bit more awesome.
&lt;/P&gt;
&lt;P&gt;
&lt;A HREF="http://blogs.technet.com/jamesone/archive/2009/02/18/testing-windows-7-on-a-laptop-try-this.aspx"&gt;
&lt;CODE&gt;powercfg /energy&lt;/CODE&gt;&lt;/A&gt;
will analyze your computer's power consumption
and report on things like devices that prevent the computer from sleeping,
devices which won't suspend, and
processes which are increasing your battery drain.
&lt;/P&gt;
&lt;P&gt;
Another neat flag is
&lt;CODE&gt;powercfg /requests&lt;/CODE&gt;
which will report on why your computer can't go to sleep,
for example, because it has open files on the network,
or because the clown will eat it.
&lt;/P&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9912711" width="1" height="1"&gt;</content><author><name>oldnewthing</name><uri>http://blogs.msdn.com/members/oldnewthing.aspx</uri></author><category term="Tips/Support" scheme="http://blogs.msdn.com/oldnewthing/archive/tags/Tips_2F00_Support/default.aspx" /></entry></feed>