The Latest

DevX

Why qsort is Still Useful in C++

C++ defines a set of generic algorithms such as sort and find. However, the corresponding C algorithms, qsort and bsearch, are still useful in C++ programs for at least three

DevX

Live Action Captions

When building a TextBox or Label UserControl, the Caption or Text property sometimes doesn’t work well with the standard controls, as the control’s appearance doesn’t change when you type the

DevX

Add a New Number Format

A client needed the numbers to show up in certain data files in the “x100” format to accommodate interchanging data with a legacy system. That is, if the number is

DevX

Is Missing Behavior Changed in VB5

In VB5, you can assign a default value to a typed optional argument. But you must then use the IsMissing function carefully, because when the optional argument is typed, IsMissing

DevX

DHTML Window Redraw

Question: Is there any way to control the redrawing/repainting of the open window/document? Specifically, I have to change page elements (labels, cursor style) before calling some time intensive task. I

DevX

Create Page Breaks in an HTML Document

Question: Is there any way (using an HTML tag or a script) to force a page break at a certain point in an HTML document when it is being printed?

DevX

Arrays are Cheaper and Safer than Vectors

In Java, you can use either a Vector or a one-dimensional array to store an ordered collection of objects. The difference between the two types of storage is that the

DevX

Redirecting Based on User’s Browser

Redirecting based on browser type is easy. If you use a JavaScript function to check navigator.userAgent for the string Related Posts A Flurry of DevOps, Agile Software Development AnnouncementsBlack Duck

DevX

Quick Class Tests

When testing properties and methods of an object that you’re writing, you don’t have to run a test project or form to test it. Instead, open the Immediate window and

DevX

A Quicker “Next/Previous Weekday”

In the latest tips supplement [“101 Tech Tips for VB Developers,” Supplement to the February 1998 issue of VBPJ], I noticed a tip titled “Determine Next/Previous Weekday.” This code is

DevX

Make Buttons Appear

VB doesn’t display the Min and Max buttons in a form’s caption area when you specify BorderStyle Fixed Dialog. If you set the MinButton and MaxButton properties on the form

DevX

Zap Expired Docs

This VBA Microsoft Word routine purges a document when it’s opened after a predefined expiration date. I’ve only tested this macro with Word 97: Sub Purge() Dim ExpirationDate As Date

DevX

Remove Min/Max Buttons From MDI Form

Unlike other forms, MDI forms don’t have MinButton and MaxButton properties to enable or disable the form’s Minimize and Maximize buttons. If you add this code to an MDI parent

DevX

Java’s Alternative to Function Pointers

Although Java borrows a lot of concepts and syntax from C++, it also leaves out some of C++’s main features to meet its goal of simplicity. For example, Java excluded

DevX

The Lifetime of a Bound Temporary Object

You can safely bind a reference to a temporary object. The temporary object to which you bind the reference persists for the lifetime of the reference. class C { int

DevX

Adding Tooltips in Microsoft Internet Explorer

Although you can’t add tooltips to links in Netscape Navigator, you can easily add them in Microsoft Internet Explorer. All you have to do is add a TITLE attribute to

DevX

A Standard Bit Vector

The Standard Template Library provides the specialization vector. The specialization is implemented in a way that squeezes each element into a single bit, rather than a bool variable. When a

DevX

Replacement for Now() and Timer()

The simple BetterNow() function, shown here, replaces the built-in Now() function. It’s faster (10 microseconds vs. 180 microseconds on a Pentium 166MMX) and more accurate, potentially supplying one-millisecond resolution, instead

DevX

Subclassing Anonymously

Anonymous classes in Java are defined inside another class (i.e., they are inner classes), do not have a name, and are defined inside a Java expression such as an assignment

DevX

Tile an Image Onto a Form

Adding this code to a form causes it to tile the image stored in Picture1 across the entire form whenever the form requires a refresh: Private Sub Form_Load() With Picture1

DevX

Adding Full Paths to a TreeView

Have you ever wanted to add nodes to a TreeView control using a full path instead of adding a node at a time? You can do it with this code:

DevX

Checking a Vector’s Capacity

The member function capacity() returns the total number of elements that a vector can hold without requiring reallocation: #include #include using namespace std;void main() { vector vi; vi.reserve(10); //make room

DevX

Detecting Alphanumeric Characters in a String

Java provides a convenient function for detecting whether a character is alphanumeric (1-26 and 0-9) or not. This function is available in the class Character. Some of the other related

DevX

What Happens When a Container Re-Allocates Itself?

When a container has exhausted its free storage and additional elements have to be inserted to it, the container re-allocates itself. First, a new memory buffer large enough to store

DevX

Send Mail From VB5

If Microsoft Outlook is installed, you have an easy way to send e-mail from VB5. To use this technique with VB3, remove the With construct and fully qualify each object

DevX

What is an Object’s Hash Code?

Objects in Java have hash codes associated with them. An object’s hash code is a signed number that identifies the object (for example, an instance of the parent class). An

DevX

Avoid the Flickering

Developers often need to load forms with information, which is time-consuming. The form is often a list box filled from an outside source, and this causes the list-box contents to

DevX

Comparing Dates

Question: How do I compare dates to determine if one comes after or before another? Answer: You can just use the normal IF statement: IF ld_date1 < ld_date2 THEN ...

DevX

SQL Server Errors

Question: When rebuiling indexes I receive an error. Error 1501:[SQL Server] Sort Failure What is happening, and what do I need to do to fix this problem? Answer: I was