Showing archive results for 2014

Aug 12, 2014
Post comments count0
Post likes count0

Keep your eye on the code page: C# edition (warning about DllImport)

Raymond Chen

Often, we receive problem reports from customers who failed to keep their eye on the code page. Does the function support files with non-ASCII characters in their names? We find that the function either fails outright or returns question marks when asked to provide information for files with non-ASCII characters in their name. If we ask for...

Code
Aug 11, 2014
Post comments count0
Post likes count0

Revival of the Daleks: Act One, Scene One

Raymond Chen

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 30,000-year-old-virus.)

Non-Computer
Aug 11, 2014
Post comments count0
Post likes count1

If you want to set a thread's apartment model via Thread.CurrentThread.ApartmentState, you need to act quickly

Raymond Chen

Welcome to CLR Week 2014. Don't worry, it'll be over in a few days. A customer wanted to know why their was displaying the infamous Current thread must be set to single thread apartment (STA) mode before OLE calls can be made error. "Even though we set the to , the apartment state is still . Curiously, if we put the above code in a standalo...

Code
Aug 8, 2014
Post comments count0
Post likes count1

The case of the orphaned LpdrLoaderLock critical section

Raymond Chen

A customer found that under heavy load, their application would occasionally hang. Debugging the hang shows that everybody was waiting for the critical section. The catch was that the critical section was reported as locked, but the owner thread did not exist. How can a critical section be owned by thread that no longer exists? There are two...

Code
Aug 7, 2014
Post comments count0
Post likes count1

The latest technologies in plaintext editing: NotepadConf

Raymond Chen

On November 13, 2014 November 14, 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 whom Microsoft will send to the conference, but maybe that person could give a talk on how you can use Notepad to take down the ent...

Other
Aug 7, 2014
Post comments count0
Post likes count1

Since clean-up functions can't fail, you have to soldier on

Raymond Chen

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: And some like to put it inside a cute flow control macro like or even Whatever floats your boat. But you have to be careful if using this p...

Code
Aug 6, 2014
Post comments count0
Post likes count1

Why does Explorer say "File too large" for my custom file system, when the problem has nothing to do with the file being too large (heck it's not even a file)

Raymond Chen

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 .) So it guesses. If the file system name is or , then Explorer assumes that the maximum file size is 4GB − 1. Also, if a file operation fails with the error , and Explorer ca...

Code
Aug 5, 2014
Post comments count0
Post likes count1

Microspeak: 1 – 1 is not zero

Raymond Chen

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 meeting, a common business practice wherein two people, typically a manager and a direct report, have a face-to-face meeting with no one else prese...

OtherMicrospeak
Aug 4, 2014
Post comments count0
Post likes count1

Enumerating the ways of choosing teams in a group of players

Raymond Chen

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. Formally, let's say that you have a collection of size nm, and you want to enumerate the ways of partitioning the collection into m subsets, each sub...

Code
Aug 1, 2014
Post comments count0
Post likes count1

Before claiming that a function doesn't work, you should check what you're passing to it and what it returns

Raymond Chen

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. The function does not appear to support directories with Unicode characters in their names. The correct directory name is obtained if it contain...

Code