December 8, 1998

Risks of Using Reflection

Reflection plays an essential role in adding dynamism to Java. Using reflection, an application can dynamically (i.e., at run time) determine the state and behavior of any class. Reflection allows the developer to create objects that can construct new class instances and new arrays, access and modify fields of objects

Capturing a type_info Object

The operator typeid returns a const type_info object associated with its argument. However, the returned object is a temporary one, so if you have to call several member functions from it, you will have to use the typeid expression repeatedly–a tedious and costly operation: cout

Applying too Much Style can Hurt Readability

Cascading Style Sheets (CSS) provide a good way to apply a style sheet to a section of text. With CSS, you can redefine how HTML tags work, for example making all paragraph tags () use Arial 12 point type, or you can define named styles which only apply to a

Testing Web Pages on Multiple Versions of Internet Explorer

For some reason, Microsoft Internet Explorer installs over any previous or later versions of itself, so it is difficult to test your page on Internet Explorer 3, 4, and 5 in quick succession. There are several ways to work around this limitation that don’t require one machine per version of

How to Generate a Sequence of Random Numbers

Standard C provides two functions for the purpose of random number generation–rand and srand. The function rand generates a sequence of pseudo-random numbers. The term pseudo-random implies that the generated sequence is not really random: no matter how many times you execute the program, the same sequence of numbers will

Adjust Combo Box Drop-down Width

Due to limited space on a form, you sometimes must keep the width of combo boxes small. Because a combo box lacks a horizontal scrollbar, some text might remain hidden. Use these functions to retrieve the current size of a drop-down and to resize the drop-down portion of the combo

Ragged Arrays

Who said arrays in VB can’t change all dimensions while preserving data? I call this the “variable dimensions array,” and I use it when applications need data arrays with more flexible sizes in all dimensions. This variable prevents your apps from having empty elements in arrays (even if the Variant