The Latest

DevX - Software Development Resource

Obtaining and Using an Object of the Type Class

The java.lang package defines a class called Class. The Class class is different from the class (with a small ‘c’) keyword used to declare Java classes. The Class class is

DevX - Software Development Resource

Two-Dimensional Arrays in JavaScript

Technically, JavaScript doesn’t support multi-dimensional arrays, but you can simulate a two-dimensional array by creating an array of arrays. This can be particularly useful if you want to create a

DevX - Software Development Resource

Inheriting From the Object Class

The Object class in Java is a superclass for all other classes defined in Java’s class libraries, as well as for user-defined Java classes. In object-oriented terms, an object is

DevX - Software Development Resource

Detecting Your Machine’s Endian

The term endian refers to the way a computer architecture stores the bytes of a multi-byte number in memory. If bytes at lower addresses have lower significance (Intel microprocessors, for

DevX - Software Development Resource

Initializing a Union

It is possible to initialize a union. Yet, unlike struct initialization, the initialization list of a union must contain a single initializer that refers to the first member in the

DevX - Software Development Resource

Collision Detection in DHTML

Collision detection is a fundamental part of game programming. It is also useful for many other aspects of user interface design. Being able to tell if one screen object has

DevX - Software Development Resource

Spawning New Processes From a Java Program

The Java Runtime Environment (JRE) shields Java developers from the system level burdens of starting and stopping processes. A Java application runs inside the JVM, while a Java applet runs

DevX - Software Development Resource

Detecting the Browser Window Size With DHTML

Some users always maximize their browser window, while others like to keep it small. Not knowing the size of the client window can cause formatting problems for HTML pages; tables

DevX - Software Development Resource

Octal Numerals

A literal integer preceded by 0 (zero) is an octal numeral. When using octal numbers, you should beware of the following common pitfall: const int warning = 10;const int error

DevX - Software Development Resource

Private Inheritance

When a derived class inherits from a private base, the is-a relation between a derived object and its private base does not exist. For example: class Mem_Manager {/*..*/};class List: private

DevX - Software Development Resource

CreateProcess in Windows NT

Question: I am using CreateProcess to run applications in Windows NT. I cannot start any applications that are located in the directory Program Files. The user properties are set the

DevX - Software Development Resource

Using Proxy Classes in Java

The Proxy is one of the most common design patterns in circulation. Gamma et. al. define the intent of the Proxy as: “Provide a surrogate or a placeholder for another

DevX - Software Development Resource

Weaving Threads

Java provides two ways to create and run a thread. You can implement the Runnable interface or extend the Thread class. The Runnable interface defines a single method run(). Consider

DevX - Software Development Resource

Zero as a Universal Initializer

The literal 0 is an int. However, it can be used as a universal initializer for every data type, since it is automatically cast to the appropriate type. In this

DevX - Software Development Resource

The Copy Algorithm

The Standard Library provides a generic copy function, which can be used to copy a sequence of objects to a specified target. The first and the second arguments of copy()

DevX - Software Development Resource

Prefer Function Objects to Function Pointers

Passing a function pointer is a common practice in event-driven systems, whereby a callback routine is invoked through a pointer. C++, however, offers a better alternative to function pointers: function

DevX - Software Development Resource

Taking a Form in Front of Another Form

When building a floating toolbar, you might need to keep it in front of the main form of your application. This took time to do in VB3 and VB4, because

DevX - Software Development Resource

Yeah, But Which Common Controls?

This fragment of code from the VB standard module shows the GetComCtlVersion function that retrieves the major and minor version numbers of the Comctl32.dll installed on the local system. Use

DevX - Software Development Resource

Custom Menu Accelerators

To set the shortcut key of a menu item to something other than what the VB menu editor displays, use this code in the Form_Load event of a form: Private

DevX - Software Development Resource

Disable Easily

You can easily give your check-box control a Locked property without making your own custom control. First, create a frame large enough to contain your check boxes. Clear the caption

DevX - Software Development Resource

Rotate an Object About a Point

You can rotate any object about a center using polar coordinates. Simply define your center Xo and Yo, which in this case is the center of a form. The amount

DevX - Software Development Resource

Determine List Item by Coordinates

I wanted users to be able to get a definition for each item in a list box by right-clicking on the item. Unfortunately, right-clicking doesn’t automatically select the item, so

DevX - Software Development Resource

Menu Properties Shortcut

You can set the properties of any menu item by selecting the menu item in the Properties window drop-down list. This is often faster than selecting the Menu Editor menu

DevX - Software Development Resource

Redirecting to a Frame Set

Question: How can you tell whether a Web page that a user loads is in a frame or not? If the page is not in a frame, I want to

DevX - Software Development Resource

Permission Error When Submitting a Form

Question: I have created a simple form, but when I try to submit it, a message appears saying that it doesn’t have permission. The CGI file is on my hard

DevX - Software Development Resource

Reference Assignment vs. Cloning

In Java, the reference to an existing reference obtained by assignment is just a duplicate reference to the object (and not to a copy of the object). The reference that

DevX - Software Development Resource

The Purpose of the Marker Interface

One of the “clean” features of the Java programming language is that it mandates a separation between interfaces (pure behavior) and classes (state and behavior). Interfaces are used in Java