The Latest

DevX - Software Development Resource

GetFiles – Returns all the files in a directory

‘ Returns a collection holding all the filenames that’ match a given filespec and search attributes.Function GetFiles(filespec As String, Optional Attributes As VbFileAttribute) _ As Collection Dim filename As String

DevX - Software Development Resource

Taking an Address of a Member Function

The name of an ordinary function is implicitly converted to its memory address. For example: typedef int (*pf) ();int func();pf=func; // OK, ‘func’ is implicitly converted to ‘&func’ However, member

DevX - Software Development Resource

Making System Calls in Stored Procedures

Question: I’m writing a procedure to send an e-mail that will receive two parameters: the e-mail address of the recipient and the subject of the e-mail (e-mail content is not

DevX - Software Development Resource

References

Question: I want to know if the following declaration is possible: int *p;p= new int;int &refval= *p; Answer: It’s valid C++. You’re binding a reference to an l-value of type

DevX - Software Development Resource

Taking the Address of a Member Function

Question: class a;typedef void(a::*func)();class a{protected: int x;public: func f; void fg(){f=&a::as;}; void as();}; This code compiles in Visual C++6.0. However, Borland C 3.1 gives me the following error at line”void

DevX - Software Development Resource

Query from One Informix Database to Another

Question: I have two Informix databases existing on a Unix server. How do I write a stored procedure in one database that can access data from the other database? Answer:

DevX - Software Development Resource

Memory Addresses

Question: How do I get the addresses of primitive variables, reference variables, and objects in Java? Answer: Unlike systems programming languages like C, Java does not have pointers. Objects are

DevX - Software Development Resource

String Equality

Question: When you compare two objects through the”== operator,” Java checks for reference equality. For example, if you create two String objects with “new” keywords and initialize them with same

DevX - Software Development Resource

The NowCombo Control

The NowCombo control is a multi-columns ComboBox that expands on the DBCombo control. You can use it to select and copy an item from another table in the database. For

DevX - Software Development Resource

MTS black box or white box perspective

Object and component technology has brought us a way of composing new functionality of existing parts. MTS and COM+ has extended this to include transaction handling. But can we, with

DevX - Software Development Resource

Swap the mouse buttons’ behavior and meaning

You can programmatically swap the meaning of the left and right mouse buttons, to account for your left-handed users. All you need is a call to the SystemParameterInfo API function

DevX - Software Development Resource

Cascade all the child windows of a window

The Windows API provides an handy function that lets you cascade all the child windows of another window with one single call. The effect of this function is similar to

DevX - Software Development Resource

EncryptString – Encode and decode a string

Private Declare Sub CopyMemory Lib “kernel32” Alias “RtlMoveMemory” (dest As _ Any, source As Any, ByVal bytes As Long)’ encrypt a string using a password” you must reapply the same

DevX - Software Development Resource

Using “sprintf” function in Java

In C, the “sprintf” function will format a string, including integer values, to a specific length. For example, you could do “sprintf(%2d)”; and it would show 00 as part of

DevX - Software Development Resource

Learn Java from the Source

I’m continually suprised by the number of veteran Java programmers(those with more than six months’ experience) I encounter who aren’taware that the full source code for the standard Java libraries

DevX - Software Development Resource

Maximum Number of Characters

Question: I’m reading approximately two million characters into an array. The max number of elements that Borland Turbo C++ 5.02 allows me is not enough. Can I declare this array

DevX - Software Development Resource

Positioning the Cursor

Question: In qbasic there is a command called LOCATE. What it does is locate where you want your output on the screen, eg: locate 1,1: meaning one down and one

DevX - Software Development Resource

Creating a Temporary File

Many applications create temporary files that exist as long as the program is running and are later discarded. For example, a Web browser can store a list of pages that

DevX - Software Development Resource

Generating a Unique Filename

To generate a unique filename that won’t conflict with any other files that exist in the current directory, use the tmpnam() function declared in as follows: char * tmpnam(char *

DevX - Software Development Resource

Designated Initializers

Another new feature in C99 is called designated initializers. Designated initializers enable you to initialize specific array elements without having to initialize the entire array. For example, suppose you have

DevX - Software Development Resource

Reading Strings that Contain White Spaces

The std::getline() functions reads data from an input stream and writes it to a string object. Unlike cin’s >> operator, getline() also reads white spaces, which makes it useful for

DevX - Software Development Resource

Changing the Endian-ness of a Number

Suppose you receive an int from a remote host and you wish to convert it to big-endian order. Here is another portable solution for handling of big and littleendian data