September 14, 2006

Use the std::tr1::function Class to Generalize Callbacks

or a C++ programmer, the term “a callback function” means at least three different things: a pointer to a freestanding function (i.e., a C function), a pointer to a member function, or a function object. However, in high level programming, these technical minutiae just get in the way. What you

Decorate Your Code with Astonishing Attributes

hen I first saw attributes in Visual Studio .NET, I thought they were some sort of oddity Microsoft had dragged in from Java, C++, or perhaps the Delta Quadrant. They clearly aren’t Visual Basic code. To someone who uses angle brackets only for comparing two numbers, this Property statement, Public

Read the First Line of a Text File

This code shows you how to use the instance methods from the FileReader and BufferedReader classes with a Xalan 2 processor to read the first line from a text file. … Note: This tip was tested on Xalan, version 2.7.0.

Retrieve Totals from a Dataset Without Looping

Have you ever looped through the entire dataset to get the totals you need to put in the footer? The DataTable.Compute method eliminates this hassle by retrieving commonly performed arithemetic operations like sum, avg,, etc. For example: int iTotal = table.Compute(“Sum(amount)”, String.Empty); The preceding code computes the sum of the

Removing an Unused Window Service

Removing an unused Window service involves removing your registry key. Go to Start?>Run?>regedit. Find the key: HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services Locate the service name you want to remove. Press key to remove the entire folder. Restart the machine. Check Start?>Run?≫services.msc. The unused service name will not be there. Note: Modifying your registry can

Retaining Multiple Sets of User Settings

sers want their forms to be in the same position the next time they open their application. While Visual Studio 2005 out of the box provides a way to store one set of named settings, there is a way to store more. Many Windows applications allow the user to define