February 27, 1999

Unconsting a const Variable

There are two types of const data storage: true const and contractual const. const int cn = 5; // true const A contractual const variable is a non-const one, which is treated as though it were const: void ReadValue(const int& num){ cout

Store Your Code Snippets in the Visual InterDev 6 Toolbox

Chances are you’ll need the routines that you write in Visual InterDev 6 in other pages. Once you debug a subroutine, you can add it to the Visual InterDev 6 toolbox for instant access another time. First, click the Toolbox tab and then click the General bar. Highlight the code

Preload Your Images

If you use JavaScript rollover images on your Web pages, it’s a good idea to preload them in order to reduce lag time while the image downloads. Non-preloaded images won’t show up immediately when the user rolls over the images in question, and if the user has a slow connection

Turn Off Page Caching When Developing Web Sites

The major browsers speed up the loading of Web pages by storing a local copy of visited pages in what is called the cache. This works well for surfing the Internet because you won’t have to wait to download a page that you have recently visited. However, page caching is

Minimize Server Script in Active Server Pages

To improve performance in your Active Server Pages, try to minimize the amount of server script present. From a design point of view, putting extensive code and business rules in your pages is bad design. Putting them in components allows you to reuse the same component for both Internet/Intranet applications

Include Files Directly Referenced by User or Search

Often times you may have include files on your Web site that store textual information whose content varies, but that are shown in a layout that remains constant (for example, a template page). An example is press releases–you need to show the text for the press release, but otherwise the

Ensuring Proper Cleanup in the Case of an Uncaught Exception

It is implementation-dependent whether the destructors of local objects are invoked when an uncaught exception occurs. To ensure that destructors of local objects are invoked in this case, you can add a catch-all statement in main() like this. int main(){ try { //

Global Anonymous Unions Have to be Declared Static

An anonymous union declared in a named namespace or in the global namespace has to be explicitly declared static: static union { int num; char *pc; }; //anonymous union in global namespace namespace NS { static union { double d; bool b;}; //anonymous union in a named namespace } int

Understanding the Listener Pattern

The Listener pattern is commonly used in the AWT since JDK 1.1. In fact, the Listener has been the base for the event handling mechanism for UI events in Java. The Listener pattern also provides the foundation for Java’s component model, Java Bean. The pattern is based on these simple

No more posts to show