December 19, 1998

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 large amount of bits has to be stored in a vector , this specialization is very efficient in terms of

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 of 1000 milliseconds. Because it’s also faster and more accurate than Timer(), which clocks at 100 microseconds and provides 55

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 or a method call. Another not so obvious characteristic of anonymous classes is that they are subclasses of the class

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 .AutoSize = True .BorderStyle = 0 .Visible = False End WithEnd SubPrivate Sub Form_Paint() Dim i As Long, j As

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: Public Sub AddPathToTree(Tree As TreeView, Path As String) Dim PathItem As String Dim NewItem As String Dim PathLen As Integer