The Latest

DevX - Software Development Resource

Pointers’ content reset

Question: I’ve declared a pointer to integer in file A of project. The pointer is also being used by file B of the same project. I discovered that the pointer’s

DevX - Software Development Resource

OnPaint Flickering

Question: I am a high school student using MS VC++ version 5.0 for my school science project. I am loading bitmaps with the StretchBlt function in the OnPaint function to

DevX - Software Development Resource

Adding a help file to an executable

Question: A quick question that should be a quick one for an experienced PB guru. How do you attach/add a help file that was created in Winhelp or any other

DevX - Software Development Resource

16 table limitation for a datawindow select stmt

Question: Is there a work around the SQL server 16 table limitation? Maybe temporary tables, Access, or even denormalization of the database tables? The database is large and very complex

DevX - Software Development Resource

Toggling Edit Control Word Wrap

Question: I have an OWL application in C++. I need to be able to switch in run-time between wordwrap and no-wordwrap text in the Editor window. How can I do

DevX - Software Development Resource

System calls for Clearing Screen

Question: Right now i’m still learning Visual C++, version 4.0. It may seem like the easiest thing in batch or Basic languages, but I can’t figure out how to clear

DevX - Software Development Resource

Parallel port prgoramming

Question: How can I access the parallel port to control a car which can move in any direciton.I want to control each pin seperately. If you have any tutorial or

DevX - Software Development Resource

Exceptions and operator new

Standard C++ states that operator new should throw an exception of type std::bad_alloc when it fails. This is different from previous stages of C++ and it means two important things:

DevX - Software Development Resource

Exception specification

A function that may throw an exception can warn its users about that by specifying a list of exceptions it may throw, thus helping its users to catch such exceptions

DevX - Software Development Resource

Operator overloading rules of thumb

When overloading an operator to support a user-defined type (object), it is best to adhere to the basic semantics of that built-in operator. For instance, the built-in operator ==, which

DevX - Software Development Resource

Advantages of bool type

Standard C++ supports a built-in Boolean type: Bool. Variables of this type are can be assigned either a true or false values exclusively ( true and false are now reserved

DevX - Software Development Resource

Struct assignment

Both standard C and Standard C++ support struct assignment using = . In fact, C++ programmers are often surprised to discover that assignment operator applies also to plain structs, and

DevX - Software Development Resource

Object I/O

Question: How can i add many java objects to a file then retrieve them as Java objects from the file? Answer: Java 1.1 introduced a concept called serialization. Serialization isa

DevX - Software Development Resource

Constant pointers

There are cases when you need to define a constant pointer to a variable/object; for instance, when taking a function address, or when you want to protect a pointer from

DevX - Software Development Resource

Namespaces are open

Unlike structs, classes, enums, and unions, the enclosing brace of a namespace definition does not prohibit you from further extensions to that namespace. A namespace can be extended this way:

DevX - Software Development Resource

Garbage Collection

Question: Is it possible to preserve an object from garbagecollection (to live as long as the applet)? Answer: Yes, it is possible to preserve an object from garbage collection andlive

DevX - Software Development Resource

Unix Signal Handling

Question: Is there a way in Java to handle Unix signals(i.e. to trap a Control C signal)? Answer: You can handle Unix signals only by writing native code. However, theJava

DevX - Software Development Resource

byte array to int conversion

Question: I have just read a packet of data into a byte array from a socket. At offsets 5-8, 9-12, and 13-16 are binary integers. How can I get them

DevX - Software Development Resource

Invocation of methods of a dynamically loaded clas

Question: I have two classes in two separate files. I don’t want to use an interfacebecause the types of objects I’ll instantiate dynamically can be quitedifferent each time. What can

DevX - Software Development Resource

Java OOP

Question: What exactly is a Factory or Factory class? Answer: A Factory is a class that you use to create sets of related objects withoutexplicitly invoking their constructors. You usually

DevX - Software Development Resource

Single bit assignment

Question: Is there an easy way to assign each bit in a byte, and how do Iaccess those bits individually? Answer: Usually, if you come from a C programming background,

DevX - Software Development Resource

Multithreading Applets—the Right Way

The canonical design of multithreaded applets is inherently flawed. You know what I’m talking about: the run method with the repaint/sleep statements embedded in a while(true). Any self-respecting operating systems

DevX - Software Development Resource

Conversion Operators

Sometimes, an object must be converted into a built-in type (for instance, a string object passed as an argument to C function such as strcmp()) : //file Mystring.hclass Mystring {

DevX - Software Development Resource

Correct syntax for automatic object instantiation

When you instantiate an automatic object (e.g., on the stack) using its default constructor, mind that the correct syntax is: String str; //correct And not this: String str(); //entirely different

DevX - Software Development Resource

IsA or HasA?

When designing a class hierarchy, you may face a decision between inheritance (aka IsA ) vs. containment (aka HasA) relation. For instance, if you are designing a Radio class, and

DevX - Software Development Resource

A base class destructor should be virtual

If a class may serve as a base class for others, its destructor should be virtual. This ensures RTTI support for objects of this class and objects derived from it,

DevX - Software Development Resource

A Simple, Easy, and Efficient Way to Initialize Structs

Struct instances created on the stack are uninitialized (i.e., contain garbage values). The easiest, most efficient, and future-proof way to initialize them is: struct PlainData {char [20] name;long ID;char [15]