Showing results for August 2014 - Page 2 of 3 - The Old New Thing

Aug 18, 2014
0
0

News flash: Big houses cost more to maintain

Raymond Chen
Raymond Chen

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 journal The Wall Street Journal recently released a paper concluding that big houses cost more to maintain.

Non-ComputerNews flash
Aug 18, 2014
0
0

Deleting elements from an JavaScript array and closing up the gaps

Raymond Chen
Raymond Chen

Today's Little Program is an exercise that solves the following problem: Given a JavaScript array and an unsorted array (possibly containing duplicates), calculate the result of deleting all of the elements from the original array as specified by the indices. For example, suppose and . The indices specify that elements 2 (charles), 4 (eve...

Code
Aug 15, 2014
0
0

The scope of the C# checked/unchecked keyword is static, not dynamic

Raymond Chen
Raymond Chen

C# has operators and to control the behavior of the language in the face of integer overflow. There are also and statements which apply the behavior to blocks of statements rather than single expressions. Why, then, doesn't this code below raise an overflow exception? (Mini-exercise: Why couldn't I have just written ?) The answer is th...

Code
Aug 14, 2014
0
0

Customers not getting the widgets they paid for if they click too fast -or- In C#, the += operator is not merely not guaranteed to be atomic, it is guaranteed not to be atomic

Raymond Chen
Raymond Chen

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 property declaration is internally converted to the equivalent of Accessing a property is similarly transformed. Note that the only operations you c...

Code
Aug 13, 2014
0
0

Keep your eye on the code page: C# edition (the mysterious third code page)

Raymond Chen
Raymond Chen

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. Observe that this program is unable to read the Å and ö characters. They come back as garbage. Although there are three code pages that have spec...

Code
Aug 12, 2014
0
0

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

Raymond Chen
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
0
0

Revival of the Daleks: Act One, Scene One

Raymond Chen
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 8, 2014
0
0

The case of the orphaned LpdrLoaderLock critical section

Raymond Chen
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
0
0

The latest technologies in plaintext editing: NotepadConf

Raymond Chen
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