August 21, 1998

VB Version IsDate Differences

Under VB3, IsDate returns True only if the string corresponds to the date format indicated by the “Regional” or “International” settings in the Control Panel. Under VB4 and VB5, however, IsDate returns True if the date is a valid date in any format (mm/dd/yy or dd/mm/yy). There are two morals

Assert() is Dangerous

The standard assert() macro tests its argument. If the result evaluates to 0, the standard abort() routine is called. Back in C heyday, it was a very useful debugging tool but it’s less so in C++. However, if you are using it in C++ code, please mind the following: 1.

How to Avoid Code Bloat When Using Templates

If you are using templates in your code, you are probably aware of their invaluable advantages. However, templates can cause a code bloat: The compiler reduplicates the template’s body for each distinct type being used. In the following example, three distinct copies of the min template will be automatically generated

Explicit Template Instantiation

In large projects, where hundreds of source files have to be compiled on every build, the long compilation time can be reduced significantly if templates are explicitly instantiated all at once. This is because when the compiler has to instantiate a template, its thread of execution is interrupted by the

The Type of a Class Template

A template name is not a type. When you need a template functioning as a full type (for example: to serve as a base class or as a function argument), you have to specify its arguments: size_t n = sizeof(vector); //compile time error; template argument list is requiredsize_t n =

Template Specialization

Templates are generic due to their type unawareness. However, there are cases where you need a special behavior for a specific type. C++ supports these cases by means of template specialization. A specialized template is defined explicitly for handling a certain type. This feature is useful when you want to

Dynamically Create a Web Page From an FTP Directory Listing

It’s possible to dynamically create a Web page from an FTP directory listing of files with a particular extension. While there are sophisticated components (.DLLs) that you could add, you could also use the FileSystemObject and do a little filtering in the ASP script. Here’s one approach that builds on

JavaScript Switch Statement

The latest version of JavaScript used by both Netscape Navigator 4.x and Microsoft Internet Explorer 4.x includes a C-like switch statement that closely mirrors the SELECT CASE statement available in Visual Basic and VBScript. However, because earlier browsers do not support this statement, any code that uses it will cause

Create Horizontal and Vertical Lines Using DHTML

It’s possible to dynamically create horizontal and vertical lines and rectangles using Internet Explorer 4.0 Dynamic HTML to alter the width and/or height of a single pixel image. Using this method and lots of code it could even be possible to create a rudimentary bar graph. The following code shows

No more posts to show