
Since 1998, DevX has helped people start businesses, build websites, and provide enterprise technology to people globally. Interviewing the likes of Microsoft’s co-founder, Steve Ballmer, the publication brings comprehensive, reliable, and accessible insights to the Internet.
Many scientific/trigonometric/mathematical applications need the values of ‘pi’ and ‘e’ (the basis of natural logarithms) for calculations. The math class in the java.lang package has two static double constants that
Have you ever wanted to have 1:1 relation between tables (i.e. a table in which two columns act like primary key not combined but separately)?DB only supports a single column,
Declaring a virtual member function private may be useful when you wish to limit the number of derived classes that can override the given function. In such a case, you
Oftentimes, an application is packaged as a jar file. Ususally, you have to use a command line option to execute it. It would be easier to double click on the
If an application’s behavior is dependent on the amount of available memory, then this code fragment can be used to determine what action an application should take. For example, a
Sometimes, it is essential to know the fields and methods that are declared in a particular class. This is all the more important when there is no access to the
In ASP, Request object has five collections: QueryString, Form, Cookies, ClientCertificate, and ServerVariables. When you want to access information in one of these collections, you have the choice of writing
It’s very easy to create cross-tab queries in SQL. In the SELECT statement of a query, most databases allow you to use an expression with an aggregate function, not only
You can pack the XML Parser along with the Java Application you are shipping. The following steps show how to do this. I used the Apache’s Xerces and Xalan parsers
The following trick isn’t portable. Furthermore, even implementations that currently support it do not guarantee to support it in their future releases. Still, it can teach you a few things
Certain compiler and code analyzers can detect a missing enumerator in a switch statement. Consider: enum Seasons{ Winter, Spring, Summer, Fall};switch (s){case Winter: wearCoat(); break;case Spring: pruneGarden(); break;case Summer: goSwimming();
If you need to concatenate variables of different types to form a string, use a stringstream object. The header contains the declarations of the stringstream family of classes. Using its
There are two methods of reading a string from the standard input. The first one uses getline(), as in the following example: std::string name;getline(cin, name); // option #1 The second
The function std::set_new_handler() installs a function to be called when the global operator new or the global operator new[] fail. By default, operator new throws an exception of type std::bad_alloc
C++ defines three floating points datatypes: float, double and long double. Some existing implementations support only two (and in some cases only one) of these three. On such implementations, double
You can use a Shell Light Weight API to generate a relative path by using this code: Private Declare Function PathRelativePathToW _Lib “shlwapi.dll” (ByVal pszPath As Long, _ByVal pszFrom As
This function will determine whether or not a thread is running in the user context of the local Administrator account. You need to examine the access token associated with that
No native VB function returns a fractional part of a decimal number. However, by subtracting the whole portion, obtained with Fix, from the original value, you can derive the fractional
When you have to display a long file path in a limited amount of space, you can use a Shell Light Weight API to do the job for you.Create a
Control arrays are odd beasts in that they can have missing elements. The simplest way to iterate a control array uses this method: Dim i As IntegerFor i = Text1.LBound
In VB.NET, you can use the System.Array class to create an array with non-zero lower bounds. To do this, use the System.Array.CreateInstance method: Array.CreateInstance(Type, Lengths(), LowerBounds( ) ).If the array
In VB.NET, you can instantiate a new instance of an object inline, making your code more compact. This example shows both versions: Imports SystemPublic Class Author Private fName As String
hat block size did you choose for your database? How many chunks have been allocated for your table? How large is each chunk and what will the size of the
ne of the questions I hear asked most frequently is: Is JavaScript a true object-oriented language? There’s no easy answer for the question. It certainly helps beginning JavaScript programmers to
t’s now been more thantwo years since I wrote the article “18 CommonProgramming Traps in MTS.” The article wasgreat fun to write, and I received, and in fact am still
Unlike VB6, VB.NET requires that you specify the default value of any Optional argument. In general you should use a value that is invalid under normal circumstances, so that the
The version of the Shell function included in VB.NET expands on the original version and supports an additional argument that enables you to specify whether to wait until the shelled
The Visual Studio debugger offers complete control on what happens when an application throws an exception, or calls a .NET method that throws an exception. You set all the relevant
Unlike VB6, in VB.NET the ParamArray keyword defines a true array object, which you can process using any of the methods of the Array class. For example, here’ s a
The Visual Basic .NET Err.Raise method and the Throw command are (partially) compatible. For example, you can use a Try…End Try block to catch an error raised with the Err.Raise











