Mar 31, 2014
Post comments count0
Post likes count1
Here's a programming challenge:
Evaluate the following recurrence relation efficiently
for a given array
[x0, ..., xn-1]
and integer
k.
Hint: Use dynamic programming.
In words:
If the array has only two elements, then the result is the average
of the two elements.
If the array has more than two elements, then
then t...
Mar 28, 2014
Post comments count0
Post likes count1
A customer wanted to check that their idea for solving a re-entrancy
problem doesn't have any hidden gotchas.
We have a window which processes incoming work.
One of our work items enters a modal loop,
and if new work gets posted to the window while the modal loop is
running, our work manager gets re-entered,
and Bad Things happen.
Our propose...
Mar 27, 2014
Post comments count0
Post likes count1
For reasons I don't quite understand,
the only functions in GDI and USER which create GDI regions
are the functions with in their name,
like
or
.
All the other functions which return a region require you
to pass an existing region to use as the output.
I can see this being useful for
,
because you can set your output region to be equal
to one ...
Mar 26, 2014
Post comments count0
Post likes count2
A customer asked whether the function can ever return . Their code uses for special purposes, and it would be bad if that was ever returned as the GUID for an object. "Can we assume that never returns ? Or should we test the return value against , and if it is equal, then call and try again?"
Some people started running a bunch of times and o...
Mar 25, 2014
Post comments count0
Post likes count1
Back in 2010, the so-called God Mode was the hit discovery of the Internet, at least until the next cute cat video made the rounds. If you had stopped by the Microsoft Visitor Center during that meme's brief moment in the sun, and wandered into the gift shop, you could have picked up a t-shirt that said on the front. Of course, if you actually...
Mar 24, 2014
Post comments count0
Post likes count1
Just for fun,
today's Little Program is going to
generate set partitions.
(Why?
Because back in 2005,
somebody asked about it on an informal mailing list, suggesting it
would be an interesting puzzle,
and now I finally got around to solving it.)
The person who asked the question said,
Below we show the partitions of [4].
The periods separate ...
Mar 21, 2014
Post comments count0
Post likes count1
A friend of mine had a business meeting near London, and he decided to extend it to a tour of Scotland and England once the meetings were over. (This is the same friend who took me on the emergency vacation many years ago.) His plan was to rent a car early one morning and drive from the meeting location all the way up to Aberdeen at one go, then s...
Mar 21, 2014
Post comments count0
Post likes count1
You can, but the function needs to be linked in.
Mar 20, 2014
Post comments count0
Post likes count1
A friend of mine who is from Lebanon (but now lives in Seattle) invited his grandmother to come visit for the summer. When she arrived, he asked her, "Grandma, is there anywhere in particular you would like to visit?"
His grandmother replied, "I'd like go to to Washington, DC."
"Okay, Grandma. Let me buy some plane tickets."
"No, let's drive."
...
Mar 20, 2014
Post comments count0
Post likes count1
A customer wanted to know whether
had a problem with Unicode.
A problem with it?
Quite the contrary.
loves Unicode!
In fact, if you call the ANSI version, it converts the
strings to Unicode and then finishes the work in Unicode.
Okay, here's the customer's problem.
We have a custom application written in managed code.
When we launch the p...