devxlogo

Tip Bank

Speed Swing Setup

In Swing 0.7, and probably later versions as well, the DefaultListModel class notifies its ListDataListeners every time a new element is added to the list model. For very large lists

iostream vs. printf()

C-style I/O is still supported in C++. However, the iostream objects offer 2 advantages over the printf() family: type safety and support for user-defined types. Consider the following example: void

JavaScript Multi-Dimensional Arrays?

Multi-dimensional arrays can be represented by arrays of arrays. For example, suppose that you want to create a 3×3 matrix, called Brady, and fill it with the strings shown in

Many Unhappy I/O Returns

The class java.io.PushbackInputStream in JDK 1.1.3 returns the wrong value from its available() method. If you look at the source code, it returns pos + super.available(); when it should really

Stomping the Windows File Bug

This bug workaround identifies Windows operating systems and adds an identifier to the absolute root directory path to avert file problems. File root;String tmp;tmp = System.getProperty(“user.dir”);root = new File(tmp);while((tmp =

delete vs. delete[]

Objects created using new [] must be released using delete [] as in this example. It