July 2, 1998

Bandwidth-Friendly Separator Bars

If you want to create good-looking separator bars but aren’t satisfied withsolid colors or the download time of fancy graphical bars, try this easy andbandwidth-friendly method. Create a gradient image that’s one pixel wide.In your image tag, specify a WIDTH= parameter, for example . The browser will stretch the single-pixelgraphic

Avoid URL Root Name Dependencies

To avoid having to use a specific root name in your URL references, put allof your files except the default file (and global.asa if you’re using ASP)in named subdirectories and use dot-dot notation. For example, .Using this method, you can rename or move your site from server to server bysimply

Keep Anchor Tags from Changing Color

Anchor tags usually change color after they have been “visited.” You cankeep this from happening in your site by using this style tag at the top ofeach document.

Notify Session Time Out When Using ASP

Each time a user connects to an ASP Web site, they are assigned a SessionID. Each session times out after 20 minutes by default (although you can adjust the timeout duration). This frees server resources when a browser doesn’t return to a site within the specified time. The problem is

Use Inline Frames for Extra Power

With Internet Explorer (3.x and higher), you can use an inline frame to provide a rectangular area into which you can write or retrieve content. An inline frame essentially opens another copy of the browser with your choice of content at a specific location within an HTML page. You can

JavaScript Cookies

Question: How long can a document.cookie string be? In other words, how many cookies can I set? Answer: There are a number of important limitations on the use of cookies by Web site developers. These limitations originate from the fact that cookies are intended to be used for infrequent storage

Exceptions as objects

The traditional convention of sending an integer as an error flag is problematic and unsatisfactory in OOP. The C++ exception handling mechanism can offer much more flexibility, safety and robustness. It’s important to note that an exception is just like any other object: it can have data members and member

Accessing a string element

The standard string class offers two ways to access a single character from a string object. The first one is to use the overloaded subscript operator [ ] like in the following example: #include using namespace std;void main(){ string s = “hello world”; char c = s[0]; //assign ‘h’ to

Consistent operator overloading

Whenever you overload operators such as + or -, it is useful to support the corresponding += and -= as well. As opposed to a common belief, the compiler will not do that for you automatically: class Date {//…Date stuff public: Date& operator + (const Date& d); //note: operator +=

No more posts to show