| Goddamit |
[Jul. 10th, 2009|07:21 pm] |
I spent all day today clambering around I-beams and steel cables and winches and pulleys in order to help replace some chain motors at the theater. I think this had an adverse affect on my muscular capabilities, because I went in to train tonight and my deadlifts were positively weak. Seriously, they were bad. I was hungry and tired and just couldn't lift sh*t. I lifted quite a bit less today than I did a week ago.
This is discouraging because next Saturday is the comp and I take the preceding week off of training.
Rest, recover, and recuperate. These Rs apply not only to my mission physically, but also mentally. Get my head into the game, drop a couple pounds, and go into the meet strong. Once there, win it. All.
--B. |
|
|
| If dynamic DLL dependencies were tracked, they'd be all backwards |
[Jul. 10th, 2009|02:00 pm] |
|
http://blogs.msdn.com/oldnewthing/archive/2009/07/10/9827869.aspx
Whenever the issue of DLL dependencies arises,
I can count on somebody arguing that
these dynamic dependencies should be tracked,
even if doing so cannot be proven to be reliable.
Even if one could walk the call stack reliably,
you would still get it wrong.
The example I gave originally was the common helper library,
where A.DLL loads B.DLL via an
intermediate function in MIDDLE.DLL.
You want the dependency to be that A.DLL depends
on B.DLL, but instead the dependency gets assigned to
MIDDLE.DLL.
"But so what?
Instead of a direct dependency from A.DLL to
B.DLL, we just have two dependencies,
one from A.DLL to MIDDLE.DLL,
and another from MIDDLE.DLL to B.DLL.
It all comes out to the same thing in the end."
Actually, it doesn't. It comes out much worse.
After all, MIDDLE.DLL is your common helper library.
All of the DLLs in your project depend on it.
Therefore, the dependency diagram in reality looks like this:
A.DLL |
→ |
B.DLL |
|
↘ |
↓ |
|
MIDDLE.DLL |
A.DLL depends on B.DLL,
and both DLLs depend on MIDDLE.DLL.
That common DLL really should be called BOTTOM.DLL
since everybody depends on it.
Now you can see why the dependency chain
A.DLL → MIDDLE.DLL → B.DLL is horribly wrong.
Under the incorrect dependency chain,
the DLLs would be uninitialized in the order A.DLL,
MIDDLE.DLL,
B.DLL,
even though B.DLL depends on MIDDLE.DLL.
That's because your "invented" dependency
introduces a cycle in the dependency chain,
and a bogus one at that.
Once you have cycles in the dependency chain, everything falls apart.
You took something that might have worked into something
that explodes upon impact.
This situation appears much more often than you think.
In fact it happens all the time.
Because in real life, the loader is implemented in the internal library
NTDLL.DLL,
and KERNEL32.DLL is just a wrapper function around
the real DLL loader.
In other words, if your A.DLL
calls LoadLibrary("B.DLL"),
you are already using a middle DLL;
its name is KERNEL32.DLL.
If this "dynamic dependency generation" were followed,
then KERNEL32.DLL would be listed as dependent
on everything.
When it came time to uninitialize, KERNEL32.DLL
would uninitialized before all dynamically-loaded DLLs,
because it was the one who loaded them,
and then all the dynamically-loaded DLLs would find themselves
in an interesting world where KERNEL32.DLL no
longer existed.
Besides, the original problem arises when A.DLL
calls a function in B.DLL during its
DLL_PROCESS_DETACH handler,
going against the rule that you shouldn't call anything
outside your DLL from your DllMain function
(except perhaps a little bit of KERNEL32
but even then, it's still not the best idea).
It's one thing to make accommodations so that existing
bad programs continue to run,
but it's another to build an entire infrastructure built on
unreliable heuristics
in order to
encourage people to do something they shouldn't be doing in the first place,
and whose guesses end up taking a working situation and breaking it.
You can't even write programs to take advantage of this new behavior
because walking the stack is itself unreliable.
You recompile your program with different optimizations,
and all of a sudden the stack walking stops working
because you enabled tail call elimination.
If somebody told you,
"Hey, we added this feature that isn't reliable,"
I suspect your reaction would not be "Awesome, let me start depending on it!"
 |
|
|
| Film students and The Bicycle Thief |
[Jul. 9th, 2009|02:00 pm] |
|
http://blogs.msdn.com/oldnewthing/archive/2009/07/09/9825127.aspx
The current generation of young people grew up in a very different
world from us older folks.
There has always been an Internet.
Everybody is accessible by mobile phone.
Cars have always had power windows.
(Which reminds me of a story of a friend of mine who has an older-model
car and was giving a ride to an eight-year-old relative.
The youngster pointed at the window crank and asked, "What's this?"
Upon learning its purpose, the young passenger spent the remainder
of the trip opening and closing the window,
giggling with glee.
"You know, most people pay extra so they don't have to do that.")
But
it's not just
elementary school children whose views of the world are different.
Some time ago, I was at a dinner where another guest was a
film professor at the local university.
In one class, they were discussing the classic movie
Ladri di Biciclette
(The Bicycle Thief in the United States),
the story of a poor man in post-war Italy searching for his
stolen bicycle, the bicycle he needs for his job.
One student asked, "Why doesn't he just buy another bicycle?"
 |
|
|
| MS-DOS also allowed spaces in file names, although vanishingly few programs knew how to access them |
[Jul. 9th, 2009|02:00 pm] |
|
http://blogs.msdn.com/oldnewthing/archive/2009/07/09/9825126.aspx
A little-known fact about MS-DOS is that it allowed spaces in file names.
Sure, you were limited to 8.3, but a file called "LOOK AT.ME"
was legal in MS-DOS, and you could indeed create such a file.
Good luck finding programs that didn't treat you as insane
when you asked for that file, though.
Although the file system supported files with spaces,
practically no programs supported them.
Command line tools saw the space as the end of the file name.
You couldn't quote the file name because no command line tool
supported quotation marks to protect spaces.
After all, if you believed that spaces were illegal characters
in file names, you wouldn't write extra code to allow people
to specify a file name with spaces in them!
The only program in common use that I remember supporting
spaces in file names was GW-BASIC.
If you were naive enough to create a file in GW-BASIC
with a space in its name,
you found yourself in a pretty nasty world of hurt
once you escaped GW-BASIC back to the real world.
The easiest way to delete such a file was to go back into
GW-BASIC and delete it from there.
 |
|
|
| More powerlifting jibba-jabba |
[Jul. 8th, 2009|04:36 pm] |
I'm currently filling out my registration card for the NASA World Cup in August. Hot on the heels of the RAW Southwest Regionals, this meet is going to test my endurance. That said, I've some questions to put to my loyal audience.
Beginning at this meet, NASA will be maintaining unequipped world records. This means that so far as I perform well and win each event, everything I do will be a new record. On the other hand, these are new records -- not established, known records. On yet the other hand, I'm pretty strong and records I set are likely to last a little bit.
Here's the rub. The full powerlifting meet comprises the squat, bench press, deadlift and the resultant sum of the three for four total numbers (and records). NASA is also using this meet as a power sports meet, which encompasses the strict curl, bench press, and deadlift and the total thereof. This would mean one more lift (the curl, one that I don't generally consider a powerlifting event) but potentially four more records (power sports and powerlifting records are generally kept separately).
Further stratifying my choice is the fact that powerlifting records are classified by age group. In NASA I am eligible for the Open (any age) and 24-29 categories. The Open group is generally more prestigious and is often used as a catch group for athletes in the prime ages of 24-34. In total I could enter up to four divisions (Open and 24-29 in both powerlifting and power sports). Each division carries with it four categories in which I could hang my numbers as records (or at least compete) for a potential total of 16 categories. Prima facie, 16 theoretical records is pretty attractive, eh?
Here, however, is the rub. A single-division entry fee is $60 and each subsequent division $35. The powerlifting (squat + bench + deadlift) meet is the most important to me but it'd be fun to do everything I possibly could (the next competition after this one is mid-October). On the other hand, entering every division and paying for flights would almost totally bust my budget and leave me with very little spending room for the RAW World Championships in Las Vegas. Then again, 16 categories. . .!
So: Halp!
Poll #1427084 In which events should I smash records?
Open to: All, detailed results viewable to: AllIn which events and divisions should I enter?
I would definitely appreciate input.
Also, here's a fun fact: I hold the overall NASA record in unequipped men's deadlift -- including not only in my weight class (242) but also the 275, 308, and Superheavyweight (unlimited) classes. Neato! Let's push this forward, eh?
--B. |
|
|
| Attack of the rogue feature: Oh no, where did my Explorer icon labels go? |
[Jul. 8th, 2009|02:00 pm] |
|
http://blogs.msdn.com/oldnewthing/archive/2009/07/08/9823258.aspx
A customer reported that on Windows Vista,
if you hold down the shift key and repeatedly click the
View button in the command bar of an Explorer window,
you will eventually reach a state where all the labels under
the icons have disappeared!
Where did they go, and how do I get them back?
Congratulations, you stumbled across a
rogue feature.
One of the developers who worked on Windows XP
decided to add a cute shortcut:
Holding down the shift key when switching to Thumbnail mode
will cause the labels to disappear.
(At least, that was the intent of the rogue feature, but it so
happens that as a side effect, the hold the shift key to remove
labels shortcut also takes effect during certain other operations,
because the shift key test was made in a shared worker function.)
Great, now that they're gone, how do you get them back?
The way to restore item labels in
Windows XP was to repeat the operation and
hold the shift key when switching into Thumbnail mode.
But wait, Windows Vista
doesn't have an explicit Thumbnail mode any more.
Since the hold the shift key to hide the labels feature
was a rogue feature, nobody knew that the Thumbnail
menu item was secretly being overloaded as an escape hatch!
Okay, here's how you get the labels back:
Right-click
in the background of the
folder and select Customize This folder.
From the customization dialog, change the template to
Pictures and Videos, then OK.
Now go back to the Explorer folder window
and
right-click in the background of the folder a second time,
then go to the View submenu.
(Alternatively, type Alt+V.)
There will be a new Hide File Names option:
Uncheck it.
(If it's already unchecked, then check it, and then uncheck it again.)
If you want, you can go back and uncustomize the folder
so it has the All files template again.
The customer support people are probably relieved to learn that
this rogue feature no longer exists in Windows 7.
 |
|
|
| More musings on the peculiar linguistic status of languages acquired in childhood |
[Jul. 7th, 2009|02:00 pm] |
|
http://blogs.msdn.com/oldnewthing/archive/2009/07/07/9820997.aspx
As I noted yesterday, languages which I acquired as a child occupy
a different part of my brain from languages I acquired as an adult.
If you speak to me in a childhood-acquired language,
the information goes directly into my brain via some sort of
low-level connection,
and I barely even recognize what language it is you're speaking.
On the other hand, if you speak to me in a language I acquired as
an adult, it requires a conscious effort to process the information.
(I don't have to translate what you speak before I can
understand it, but the act of understanding requires a bit more effort.)
I got to experience this phenomenon with my Chinese-speaking nieces.
If you spent time in their home, you'll hear three languages spoken.
The adults speak to each other in their local Chinese dialect,
they speak with the children in the regional Chinese dialect,
and of course there's English.
(The adults also speak Mandarin Chinese but you don't hear it often
in the house.)
Since none of the Chinese dialects I know overlap with the dialects
spoken by the children,
my conversations with the nieces are in English.
Over time, I started learning the regional dialect,
and whenever possible,
I would use it when speaking with the children.
(I.e., when what I wanted to say had nonzero intersection with what
I knew how to say.)
But even when I spoke with the nieces in Chinese,
they always responded in English.
One day, I asked one of the nieces a simple question in Chinese,
something like "Do you want to drink some water?"
She looked at me and said,
"大姑丈講中文!"
I give her sentence in the original Chinese because it is ambiguous.
I interpreted it to mean,
"Uncle, speak Chinese!"
And I was confused, because, well, I was speaking Chinese.
It was later explained to me that my niece meant the other interpretation
of the sentence, which is
"Uncle is speaking Chinese!"
In other words, she was expressing surprise that I was speaking Chinese.
I'd been doing this for months, but this was the first time she
noticed.
 |
|
|
| Command line parsers look at what you typed, not what what you typed looks like |
[Jul. 7th, 2009|02:00 pm] |
|
http://blogs.msdn.com/oldnewthing/archive/2009/07/07/9820996.aspx
Command line parsers are stricter than human beings.
The computer cares about what you typed.
If you type something else that superficially resembles what you want,
but is not actually what you want,
then you won't get what you want,
even though it sure looks like what you want.
I covered a special case of this topic earlier when I described
smart quotes as
the hidden scourge of text meant for computer consumption.
You think you typed a quotation mark, but the editor
secretly "improves" it from U+0022 to U+201C.
Then you paste the text into a command line and you get strange
output because the command line parser uses U+0022 as the
quotation mark, not characters like U+201C which physically resemble
U+0022 but aren't.
A human being would say, "Yeah, that's a quotation mark,
we'll let it slide."
A command line parser knows what it wants and accepts no substitutes.
Even though my original examples are for command line use,
the principle applies elsewhere,
and I'm going to use CSS selectors as my example,
because the command line programs used in my original examples
are internal Microsoft tools,
and explaining their command line syntax would distract from the message.
On the other hand, everybody can look up CSS selector syntax.
(There is an opportunity for a snarky comment here, but I'm going
to withhold the pre-emptive snarky comment in the hopes that my
readers are mature enough to not go for the cheap drive-by insult.
I am almost always disappointed by the result, but I try again
every so often to see if the environment has changed.)
Here is an imaginary question/answer session inspired by
actual events:
From: Xxxx Xxxxx
How do I make a CSS rule apply only to elements with a specific
tag and a specific class?
Specifically, I want a rule to apply only to elements of the form
<SPAN CLASS="Name">.
From: Yyyyy Yyyyyy
You use SPAN.Name.
From: Xxxx Xxxxx
I tried that, but it doesn't work.
SPAN. Name { color: red; }
This person became one of
those people who are not interested in why something works
but are only interested in the magic phrase they need to type.
Whether or not you believe that the
"just tell me what to type" mindset is acceptable,
you have to concede that if you choose to adopt that mindset,
you need to actually type what people tell you to type.
In this case, the person decided that the punctuation rules for CSS
are the same as the punctuation rules for English,
and since English allows (and even encourages) a space after a period,
then CSS should also allow it.
"I mean, it looks so much
better on the screen with a space after the period."
(I bet these are the same people who
move cities around on a map in order to produce a more
visually-pleasing arrangement.)
Or maybe the person decided that the punctuation rules for CSS were
the same as C++. C++ allows spaces on either side of the field selector
operator.
If C++ allows it, then so too should CSS.
Of course, neither case is true.
CSS has its own rules for parsing,
and in CSS, spaces are significant.
What I found even more mind-boggling was another question/answer
session.
I'm going to use the same question and answer for illustrative purposes,
but in reality, the question was different.
From: Wwww Wwwww
How do I make a CSS rule apply only to elements with a specific
tag and a specific class?
Specifically, I want a rule to apply only to elements of the form
<SPAN CLASS="Name">.
From: Yyyyy Yyyyyy
You use SPAN.Name.
From: Wwww Wwwww
I tried that, but it doesn't work.
.Name SPAN { color: red; }
I don't know what possessed this second person to take the instructions
and then scramble the pieces on the assumption that, hey,
the order of the pieces of the selector aren't important, as long as
they're all there, right?
 |
|
|
| Clothing Policy Violations |
[Jul. 7th, 2009|11:01 am] |
Eeek! My coworkers weren't kidding when we discussed the dress code last summer--student workers do often come to work showing a lot more skin than the staff! I think we might need to reiterate the clothing policy to ours... |
|
|
| A view from the ground |
[Jul. 6th, 2009|09:34 pm] |
Terri and I went to our local Wal-Mart to do some grocery shopping tonight.
After picking up some items, we rounded the corner into the soda/drinks aisle. In front of us stood a remarkably overweight woman wearing a grey tee-shirt and elastic pants. She was standing on the seat of an electric "courtesy scooter." In her left hand she held a two-liter bottle of Dr. Pepper. She was soundlessly but furiously bashing this bottle over and over end-on into the other bottles of soda in the wall caddy. Later we saw her ambulating with a normal shopping cart carrying a half-dozen or more two-liter bottles of Dr. Pepper.
Your challenge, Dear Reader, is to explain this to me.
--B. |
|
|
| If somebody speaks a language I'm not expecting, sometimes I don't understand it, even though I shou |
[Jul. 6th, 2009|02:00 pm] |
|
http://blogs.msdn.com/oldnewthing/archive/2009/07/06/9818300.aspx
During my visit to Göteborg, I booked a city tour on a tour bus.
As I noted earlier,
the tour is trilingual.
Each point of interest is described by the tour guide three times,
first in Swedish, then in English, and then in German.
(Even the jokes are the same.
You can tell which people on the bus speak which language
by checking when they laugh at the jokes.)
I didn't know this when I got on the tour bus.
I was simply expecting that the tour would be conducted in Swedish.
After all, I'm in Sweden.
They speak Swedish here.
The tour started, and the tour guide started by speaking in Swedish,
which I sort of understood.
Not great, but I got the basic idea.
And then she repeated herself in English.
That was a pleasant surprise.
Now I could fill in the parts that I missed
from the Swedish narration.
Next, she spoke in German,
but remember, I didn't know that the tour was trilingual.
I just assumed she was returning to Swedish for the next part of
the narration,
so I thought to myself,
"Wow, my Swedish suddenly sucks! I was doing so well and then boom,
it's all gone!"
And then I realized,
"Oh wait, that's not Swedish. That's German.
I can understand this after all."
This is one of those weird language things I've noticed.
The languages I learned as a child are kept in one part of
my brain, and the languages I acquired as an adult go into
another part.
When people speak to me in a language I acquired as an adult,
I don't even understand them until I first figure out what language
they're using.
On the other hand, the languages I acquired as a child
I can understand immediately.
(You can even
switch languages in the middle of a sentence
and I might not even notice.)
 |
|
|
| A 32-bit application can allocate more than 4GB of memory, and you don't need 64-bit Windows to do i |
[Jul. 6th, 2009|02:00 pm] |
|
http://blogs.msdn.com/oldnewthing/archive/2009/07/06/9818299.aspx
Commenter Herb wondered
how a 32-bit program running on 64-bit Windows scan allocate more than 4GB
of memory.
Easy: The same way it allocates more than 4GB of memory on 32-bit Windows!
Over a year before Herb asked the question,
I had already answered it in the tediously boring
two-week series on the myths surrounding the /3GB switch.
Here's a page that shows
how you can allocate more than 2GB of memory
by using shared memory
(which Win32 confusingly calls file mappings).
That code fragment allocated 4GB of memory at one go,
and then accessed it in pieces (because a 32-bit program can't map
an entire 4GB memory block at one go).
To allocate more, either make the number bigger in the call to
CreateFileMapping or just call
CreateFileMapping multiple times.
The following week,
I talked about how you can
use AWE to allocate physical pages.
Again, you can allocate as much memory as you like,
but if you allocate enormous amounts of memory,
you will probably not be able to map them all in at once.
The claims of the program are true,
but 64-bit Windows wasn't necessary
for the program to accomplish what it claims.
It's like
Dumbo
and the magic feather.
"Dumbo can fly with the magic feather in his trunk."
Well, yeah, but he didn't actually need the feather.
(On the other hand,
64-bit Windows certainly makes it more convenient to use
more than 4GB of memory, since you can map the memory
into your address space all at once and use normal pointers to access it.)
 |
|
|
| navigation |
| [ |
viewing |
| |
most recent entries |
] |
| [ |
go |
| |
earlier |
] |
| |
|
|