November 23, 2006

Optimize C++ Code with Member Initializers

Calling constructors for the data members of the object of a class results in an overhead process which calls the constructor in the main function. You can reduce this overhead by using member initializers in classes. For example: Class A{public:A(int i,int w){a=i;b=w;}private:int a,b;};//INSTEAD WE CAN USE MEMBER INTIALISERS EXAMPLE FOLLOWS

Changing User Privileges for an Application

If you’ve ever loged out and back into Windows XP to run a program under other user’s privileges, you don’t have to anymore. You can run the program as a different user without logging out and then in again. Simply right-click on the icon of the program , and select

Evaluate XQuery Expressions with Java and SAXON 8

The following tip shows you how to combine Java and SAXON 8 in order to evaluate XQuery expressions. This application presumes that the XQuery expression is in an external file, called Q.xquery, and the XML file used for interrogation is called XML.xml: //Javaimport;import;import;import;import java.util.Properties;import javax.xml.transform.OutputKeys;import javax.xml.transform.sax.SAXSource;import

Replace All Occurences of Numbers in the Input String

This function replaces all occurences of numbers in the input string with ‘#‘ and returns the replaced string. It recognizes integers, floating point, and negative numbers. It will not replace digits that are actually part of a word (eg: ‘var5‘ or ‘level9code‘). Special care is taken for numbers in formats

Drill-down on Three Major New Modules in Python 2.5 Standard Library

his article is the second part in a three-part series about Python 2.5. The first part discussed the major changes and enhancements to the Python language itself. This part introduces the main modules that were added to the Python standard library. The third part will discuss a whole bag of