September 6, 2000

Rotate Ads on WAP

Question: How do you integrate an ad-serving technology (such as one by Doubleclick that enables you to rotate ads on a regular Web page) onto a cell phone or PDA? Answer: You can do an ad rotator in ASP, and then just output the content to WML.

IIF Function Under SQL Server 7.0

Question: Is the IIF function valid under SQL server 7.0? It’s in the SQL Books Online as valid, but none of my stored procedures accept it. Answer: The IIF function you refer to in Books Online isn’t part of the T-SQL syntax that your stored procedures expect. Instead it is

Don’t forget that String may cause overhead for your app

String in Java is a constant object, which means by default it can becreated and read but not modified. Usually developers use the Stringextensively but forget the overhead it may cause for the application.Every time you connect two string objects, JVM creates a new StringObject for that and frees the

Container of Pointers

Many programmers believe that by storing pointers instead of objects in a container, they improve performance. However, they forget that the pointers still refer to existing objects that must be stored somewhere. Worse yet, these objects are often allocated dynamically. Dynamic allocation is an expensive operation. Remember also that you

Understanding Stack Overflow

The stack is a region of memory on which local automatic variables are created and function arguments are passed. The implementation allocates a default stack size per process. On modern operating systems, a typical stack has at least 1 megabyte, which is sufficient for most purposes. Under anomalous conditions, the

The Memory Layout of Members with Different Access Specifiers

Consider the following two classes: class A{private: int n;public: int m;};class B{private: int n; int m;}; Theoretically, the memory layout of these two classes may be different because A has different access types for each member. The C++ Standard allows an implementation to store such members in non-adjacent memory addresses.

Disabling Further Inheritance of a Class

To block a class from being derived any further, declare its constructor private. Next, add a public static member function Instance() that creates an instance of this class and returns its address. Calling Instance() is the only way to create instances of this class because the constructor is otherwise inaccessible.

Nested Classes and Friendship

When you declare a nested class as a friend of its containing class, place the friend declaration after the declaration of the nested class, not before: class A // containing class{private: int i;public: class B // nested class declared first { public: B(A & a) { a.i=0;}; // access a