Finding the shortest path to the ground while avoiding obstacles
Today's Little Program solves the following problem: Consider a two-dimensional board, tall and narrow. Into the board are nailed a number of horizontal obstacles. Place a water faucet at the top of...
View ArticleDid the Windows 95 interface have a code name?
Commenter kinokijuf wonders whether the Windows 95 interface had a code name. Nope. We called it "the new shell" while it was under preliminary development, and when it got enabled in the builds, we...
View ArticleIf you want to be notified when your app is uninstalled, you can do that from...
A customer had a rather strange request. "Is there a way to be notified when the user uninstalls any program from Programs and Features (formerly known as Add and Remove Programs)?" They didn't...
View ArticleWhat is the strange garbage-looking string in the "command" value of a static...
A customer from a major software vendor asked, "What is the significance of the command value that can be found under HKCR\〈progid〉\shell\open\command. It appears to be a copy of the default value,...
View ArticleBefore claiming that a function doesn't work, you should check what you're...
Before claiming that a function doesn't work, you should check what you're passing to it and what it returns, because it may be that the function is behaving just fine and the problem is elsewhere....
View ArticleEnumerating the ways of choosing teams in a group of players
Suppose you have a bunch of people, and you want to break them up into m teams of size n. (Therefore you have a total of nm people.) Today's Little Program will enumerate the ways this can be done....
View ArticleMicrospeak: 1 – 1 is not zero
In his reddit AMA, Joe Belfiore wrote i have regular 1-1 meetings with my counterparts in Office, Skype, Xbox. The little bit of jargon there is 1-1 meeting. This is an abbreviation for one-on-one...
View ArticleWhy does Explorer say "File too large" for my custom file system, when the...
When Explorer copies files around, it doesn't really know what the maximum file size supported by any file system happens to be. (That information is not reported by GetVolumeInformation.) So it...
View ArticleSince clean-up functions can't fail, you have to soldier on
Clean-up functions can't fail, so what do you do if you encounter a failure in your clean-up function? You have to keep cleaning up. Some people like to follow this pattern for error checking: HRESULT...
View ArticleThe latest technologies in plaintext editing: NotepadConf
On November 13, 2014, Saint Paul, Minnesota will be the home to NotepadConf, which bills itself as "the premier technology conference for Notepad.exe users and text enthusiasts." I'm still not sure...
View ArticleThe case of the orphaned LpdrLoaderLock critical section
A customer found that under heavy load, their application would occasionally hang. Debugging the hang shows that everybody was waiting for the LpdrLoaderLock critical section. The catch was that the...
View ArticleIf you want to set a thread's apartment model via...
Welcome to CLR Week 2014. Don't worry, it'll be over in a few days. A customer wanted to know why their FolderBrowserDialog was displaying the infamous Current thread must be set to single thread...
View ArticleRevival of the Daleks: Act One, Scene One
In 2009, a group of volunteers on a routine cleanup of a pond in Hampshire, England discovered a Dalek. (Later in the episode, the story may introduce a scientist who is thawing out a...
View ArticleKeep your eye on the code page: C# edition (warning about DllImport)
Often, we receive problem reports from customers who failed to keep their eye on the code page. Does the SHGetFileInfo function support files with non-ASCII characters in their names? We find that...
View ArticleKeep your eye on the code page: C# edition (the mysterious third code page)
A customer was having trouble manipulating the console from a C# program: We found that C# can read only ASCII data from the console. If we try to read non-ASCII data, we get garbage. using System;...
View ArticleCustomers not getting the widgets they paid for if they click too fast -or-...
In the C# language, operation/assignment such as += are explicitly not atomic. But you already knew this, at least for properties. Recall that properties are syntactic sugar for method calls. A...
View ArticleThe scope of the C# checked/unchecked keyword is static, not dynamic
C# has operators checked and unchecked to control the behavior of the language in the face of integer overflow. There are also checked and unchecked statements which apply the behavior to blocks of...
View ArticleDeleting elements from an JavaScript array and closing up the gaps
Today's Little Program is an exercise that solves the following problem: Given a JavaScript array a and an unsorted array indices (possibly containing duplicates), calculate the result of deleting all...
View ArticleNews flash: Big houses cost more to maintain
In 2005, we learned that big houses cost more to heat. In 2006, we learned that big houses cost more to cool. But then the research into big houses seems to have stalled. No worries. The research...
View ArticleMy friend and his buddy invented the online shopping cart back in 1994
Back in 1994 or so, my friend helped out his buddy who worked as the IT department for a local Seattle company known as Sub Pop Records. Here's what their Web site looked like back then. Oh, and in...
View Article