Tip Bank

DevX - Software Development Resource

Creating a Recordset for Testing

When working with pages, the database is not always available. Sometimes, you need to access a test recordset. Here are is an example of how to create a function that

DevX - Software Development Resource

Overriding toString()

While definitely not required, overriding the toString() method in your classes will make their use much easier. Although java.land.Object provides basic implementation for this method, it is far from being

DevX - Software Development Resource

<fstream> Open Modes

The library defines the following open modes and file attributes: ios::app // appendios::ate // open and seek to file’s endios::binary // binary mode I/O (as opposed to text mode)ios::in //

DevX - Software Development Resource

Truncating a File Stream

Certain files need to be emptied every time an application opens them before it writes new data to them, for example, a per-session log file. One way to achieve this

DevX - Software Development Resource

Avoid Unnecessary Constructors and Destructors

Some programmers consistently define an empty constructor and destructor in their classes, as in: class A{//..public: A() {} ~A() {}}; This is totally useless. C++ guarantees that when a class

DevX - Software Development Resource

Avoid Empty Member Initialization Lists

Following yesterday’s tip, here’s another deprecated habit that programmers should avoid. Consider the following class hierarchy: class base{public: base();};class derived: public base{public: derived() : base() {/*some code*/} // superfluous}; The

DevX - Software Development Resource

Quick and Easy Queue

Listboxes provide suitable functionality to act as a quick queue. Create a listbox named ListMyQueue. Use this code to add to your Queue: Public Sub Enqueue(StringToAdd As String)If Len(String_to_Add) >

DevX - Software Development Resource

Clear Structure Data With one Assignment

User-defined types are useful when you need to store structured data that has no specific behavior. If you have associated behavior, you should encapsulate the data in its own class.