Professional Documents
Culture Documents
2003
Volume 9 Number 10
INSIDE
ON THE COVER
In Development
Totally Random
FEATURES
On Language
Greater Delphi
14
Delphi at Work
17
REVIEWS
29 VMware Workstation 4.0
Product Review by Bill Todd
Developers
6 Whats New in C# 2
D E PA R T M E N T S
2 Toolbox
33 File | New by Alan C. Moore, Ph.D.
T O O L B O X
TestComplete 3.0 Available
Developer Express
Upgrades
ExpressBars Suite
ExpressBars Suite 5 is now available
from Developer Express. A
toolbar, menu, and docking system
for Delphi and C++Builder,
ExpressBars Suite 5 allows you to
bring to your applications the user
interface elements and application
customization features introduced
in Microsoft Office (including
the yet unreleased Office 11) and
Windows XP.
ExpressBars Suite 5 features an
advanced toolbar/menu system, as
well as Developer Express newest
component library, ExpressDocking.
The ExpressDocking Library gives
you the ability to create flexible
docking applications with only a
few mouse clicks. You can create
complex interfaces like those in
the Delphi IDE, Visual Studio .NET
IDE, and others; simply place a
dock site on the form and add dock
panels populated with your choice
of VCL controls. The rest is done
automatically. Simply drag and
drop to dock panels to sites, float
them, or dock them to each other
to form complex dock controls,
including tab containers and side
containers.
Developer Express
Price: US$179.99 (single developer license,
includes source); US$129.99 (single developer
license, without source).
Contact: info@devexpress.com
Web Site: www.devexpress.com
T O O L B O X
DScriptVCL Provides Winamp Look and Feel
I N
D E V E L O P M E N T
By Fernando Vicaria
Totally Random
Getting a Truly Random Number
In
Development
Totally Random
function Random [ (Range: Integer) ];
var
Seed: Longword = a;
function _Random: Longword;
begin
Seed := Seed*b + c;
Result := Seed shr d;
end;
Function
Unit
Resolution
seconds
1 second
GetTickCount
milliseconds
10 ms
TimeGetTime
milliseconds
10 ms
QueryPerformanceCounter
milliseconds
< 1 ms
In
Development
Totally Random
Entropy = Randomness
In general, the importance of generating a good sequence of
random numbers is a bit more relaxed when were working
with mathematical or scientific applications, given that we only
need to fool our simulations or modeling programs into thinking that true random numbers have been used. This approach
isnt possible or is at least unwise when writing security
applications; to fool a strong-willed hacker, or the NSA, you
need to do a lot better than simply shuffling your numbers.
As the name implies, pseudo-random numbers arent really
random; they just seem random. As we discussed earlier,
they are knowable because they come from a mathematical
function, and are therefore not truly random. To avoid this,
we need to introduce genuine entropy; anything derived by
external factors can and should be used as input, e.g.
time between keystrokes, timing of disk interrupts, number
of network packages arrived, etc. The list goes on and on;
on a multi-user system you can use the number of page
faults, the number of disk read/writes, the time to wait until
eligible to get the next time slice any number that is difficult to predict or control.
Typically a cryptographically sound message digest
such as MD5 or SHA (the Secure Hash Algorithm) is computed over an entropy pool and used as your next random
number or seed. Its a good idea to have a tenth to a fifth
as much entropy as the length of the key. For example,
if youre generating a 1024-bit key, you should have
between 100 and 200 bits of entropy. Of course, more is
always better, but its also slower (as you would expect).
Sources of entropy usually involve significant overhead.
(By one bit of entropy I mean the equivalent of a true
random event with two, and only two, possible outcomes,
e.g. a coin toss.)
There are many ways to get true random numbers. Some
methods include making hardware devices that generate
noise, observing cosmic ray flux, and observing light
emissions from trapped mercury atoms. Theyre great
6
In
Development
Totally Random
Figure 5 shows a
simple GUI application that executes the Monobit and the Long
Run test on a sample generated with the Random function.
Continuous RNG test. Look for two consecutive outputs
that have the same value. Depending on how the generator
is implemented, you might have repetitions of 8- and 16-bit
values, but definitely not of 32- or 64-bit values.
You can run this test via the command line, passing a file
as a parameter. Figure 6 show the output when running
the test on the file test.txt. The output in the figure shows
a certain degree of predictability, since it shows a few
repeated sequences of 32 bits, i.e. pairs of four elements in
our file that are repeated.
In
Development
Totally Random
O N
.NET
L A N G U A G E
REGULAR EXPRESSIONS
By Bill Todd
Regular Expressions
and .NET
Powerful Text-handling Tool Not Just for UNIX Anymore
Regular expressions are old news in the UNIX world, but they
arent widely implemented in the Windows environment.
.NET changes that by including a set of classes that provide
a very powerful implementation of regular expressions. This
article starts with an introduction to regular expressions, then
examines the .NET classes that implement them.
Atoms, Repetition, and Groups
Regular expressions consist of atoms. An atom is a literal
character, a special character (usually called a metacharacter), or a group of one or more literal and/or metacharacters enclosed in parentheses. Suppose users must enter
a ZIP code. You want to verify that the string of characters the user typed has the form of a valid US ZIP code.
9
Shortcut For
{0,}
{1,}
{0,1}
Description
On
Language
Option
Character
Ignore Case
Multiline
ExplicitCapture
Singleline
Description
Specifies case-insensitive matching.
Specifies multiline mode. Changes the meaning of
^ and $ so that they match at the beginning and
end, respectively, of any line, not just the beginning and end of the whole string.
Specifies that the only valid captures are explicitly named or numbered groups of the form
(?<name>...). This allows parentheses to act as
noncapturing groups without the syntactic clumsiness of (?:...).
\A
\Z
\z
\G
\b
A word boundary
\B
\d{3,4}( \d{3,4}){3}
On
Language
Character
Shortcut For
\a
\x07
Description
A bell character
\d
[0-9]
\D
[^0-9]
\e
\x1b
An escape character
\f
\x0c
\n
\x0a
A newline character
\r
\x0d
\s
[ \f\n\r\t\v]
\S
[^ \f\n\r\t\v]
\t
\x09
A tab character
\v
\x0b
\w
[A-Za-z0-9_]
\W
[^A-Za-z0-9_]
procedure TestRegularExpression;
var
ARegex:
Regex;
RegexMatch,AMatch: Match;
Matches:
MatchCollection;
Groups:
GroupCollection;
AGroup:
Group;
Captures:
CaptureCollection;
ACapture:
Capture;
Im, Ig, Ic:
Integer;
begin
// Create a regular expression object.
ARegex := Regex.Create(RegexString);
// Get a match object and check its Success property.
RegexMatch := ARegex.Match(searchString);
if (RegexMatch.Success) then
Console.Writeline('Match Succeeded
')
else
begin
Console.Writeline('Match Failed');
Exit;
end;
// Get the matches collection.
Matches := ARegex.Matches(searchString);
// Loop through the matches collection and display the
// matched text and its starting position.
for im := 0 to Matches.Count - 1 do begin
AMatch := matches[im];
Console.Writeline('Match ' + IntToStr(im) + ' at ' +
IntToStr(AMatch.Index) + ' = |' + AMatch.Value +
'|
');
// Get the groups collection for each match.
Groups := AMatch.Groups;
// Loop through the groups collection and display
// the text and position for each group.
for ig := 0 to Groups.Count - 1 do begin
AGroup := Groups[ig];
Console.Writeline(#9'Group ' + IntToStr(ig) +
' at ' + IntToStr(AGroup.Index) + ' = |' +
AGroup.Value + '|
');
// Get the captures collection for each group.
Captures := AGroup.Captures;
// Loop through the captures collection and display
// the text and starting position for each capture.
for ic := 0 to Captures.Count - 1 do begin
Acapture := Captures[ic];
Console.Writeline(#9#9'Capture ' + IntToStr(ic) +
' at ' + IntToStr(ACapture.Index) + ' = |' +
ACapture.Value + '|
');
end;
end;
end;
end
Backreferences
Suppose you need to scan some text to find each case
where the same word appears twice in succession. Constructing a regular expression that matches a word is
easy. A word is just a word boundary followed by one or
more word characters followed by another word boundary, e.g. \b\w+\b.
(?<aword>\b\w+\b)\k<aword>
11
(?<aword>\b\w+\b)
On
Language
Using Regular
Expressions in .NET
The key to using regular expressions
in your .NET applications is the
Regex class. The sample program that
accompanies this article is a console
application that prompts you for a
command letter, a regular expression,
some text to search with the regular
expression, and, optionally, a replace
expression (see end of article for
download details). The command
letters are t to test the regular
expression, p to parse the string
on character groups that match the
regular expression, and r to replace
the characters that match the regular
expression using the replace string.
The program evaluates the regular
expression and displays the results.
Figure 5 shows the
TestRegularExpression procedure,
which begins by creating an instance
of the Regex object named ARegex.
Note that the regular expression the user entered is
passed as a parameter to the Regex objects constructor.
Next, the code gets a Match object by calling the Regex
objects Match method. The Match object has a Success
property that shows whether the string passed as a
parameter to the Match method contains a character or
characters that match the regular expression. This is all
you need for data validation.
When a regular expression is applied to a text string, the
expression may match characters at many locations in
the string. The Regex objects Matches method returns a
MatchCollection that contains all the matches. The code in
Figure 5 loops through the Matches collection and writes the
index of the Match object, its starting position in the string,
and its value to the console.
Each Match object in the Matches collection may match one
or more groups of characters. The Groups method of the
Match object returns a GroupsCollection that contains all the
On
Language
G R E A T E R
JAVA NATIVE INTERFACE
JAVA
D E L P H I
JBUILDER
DELPHI 6, 7
By Keith Wood
Going Native
Part 2: Calling Java Code from a Delphi App
Before you can call any Java code from Delphi, you
must first load the Java virtual machine (JVM). Add the
JNI unit to your application, then start by preparing the
parameters for the JVM. You have the option of using a
VM that conforms to the JNI 1.1 or 1.2 specifications. The
differences are mainly concerned with versioning of JNI,
reflection support, and enhancements of existing capabilities. This choice affects the format of parameters passed
to the initial call: JDK1_1InitArgs or JavaVMInitArgs.
In this case, use JNI 1.2 and the latter type. The arguments are the normal parameters you would pass to the
JVM if you were starting it from the command line. Only
the classpath option is handled here, after having been
entered by the user:
Greater
Delphi
Going Native
Greater
Delphi
Going Native
Conclusion
The Java Native Interface lets you call Java code from native
code, or vice versa. Through the efforts of Matthew Mead, a
Delphi version of the JNI is available, making it simple to use.
To call Java code you must first load the Java virtual
machine, setting appropriate parameters. Then locate the
classes required, find the methods on them to invoke, and
call these with the appropriate parameters. The demonstration program described here provides a Delphi GUI to the
JavaD tool, allowing you to easily generate Delphi skeleton
files for JNI from your Java classes.
Using the facilities described in this article, you can now
mix and match between Delphi and Java as the need arises.
See the documentation that comes with Matthews Delphi/
JNI package for more details and examples.
References
JNI Specification: http://java.sun.com/j2se/1.4.1/docs/guide/
jni/index.html
JNI FAQ: http://java.sun.com/products/jdk/faq/jnifaq.html
Delphi/JNI Home: http://home.pacifier.com/~mmead/jni/
delphi/index.html
The demonstration programs referenced in this article are
available for download on the Delphi Informant Magazine Complete Works CD located in INFORM\2003\OCT\
DI200310KW.
16
chkOverwrite.Checked], True);
{ $ELSE }
MID := FJNIEnv.GetStaticMethodID(Cls,
'generateDelphiWrapper',
'(Ljava/lang/String;Ljava/lang/String;Z)' +
'Ljava/lang/String;');
if MID = nil then
raise Exception.Create('Can't find method: ' +
'generateDelphiWrapper');
FileName := FJNIEnv.JStringToString(
FJNIEnv.CallStaticObjectMethod(Cls, MID,
[edtClassName.Text, edtDirectory.Text,
chkOverwrite.Checked]));
{ $ENDIF }
// Check for exception.
Exc := FJNIEnv.ExceptionOccurred;
if Exc <> nil then
begin
// Clear the exception so we
// can call other methods.
FJNIEnv.ExceptionClear;
// Find out about the exception // its class and message.
{ $IFDEF JNIUTILS }
Cls := JNIUtils.CallObjectMethod(
FJNIEnv, Exc, 'getClass', 'Class()', []);
ErrMsg := JNIUtils.CallMethod(
FJNIEnv, Cls, 'getName', 'String()', []) +
#13 + JNIUtils.CallMethod(
FJNIEnv, Exc, 'getMessage, 'String()', []);
{ $ELSE }
MID := FJNIEnv.GetMethodID(
FJNIEnv.GetObjectClass(Exc),
'getClass', '()Ljava/lang/Class;');
if MID = nil then
raise Exception.Create(
'Can't find method: getClass');
Cls := FJNIEnv.CallObjectMethod(Exc, MID, []);
MID := FJNIEnv.GetMethodID(
FJNIEnv.GetObjectClass(Cls),
'getName', '()Ljava/lang/String;');
if MID = nil then
raise Exception.Create(
'Can't find method: getName');
ErrMsg := FJNIEnv.JStringToString(
FJNIEnv.CallObjectMethod(Cls, MID, []));
MID := FJNIEnv.GetMethodID(
FJNIEnv.GetObjectClass(Exc),
'getMessage', '()Ljava/lang/String;');
if MID = nil then
raise Exception.Create(
'Can't find method: getMessage');
ErrMsg := ErrMsg + #13 +
FJNIEnv.JStringToString(
FJNIEnv.CallObjectMethod(Exc, MID, []));
{ $ENDIF }
raise Exception.Create(
'A Java exception occurred'#13 + ErrMsg);
end;
// Load the generated file.
memOutput.Lines.LoadFromFile(FileName);
ShowStatus('Done');
except
on E: Exception do begin
ShowStatus('Error');
MessageDlg('Error: ' + E.Message,
mtError, [mbOK], 0);
end;
end;
end;
D E L P H I
EVENT LOGGING
A T
NT SERVICES
W O R K
WINDOWS NT/2000
DELPHI 2-7
By Simon Murrell
Delphi
at
Work
Delphi
at
Work
Whats New in C# 2?
www.C-SharpPRO.com
C#
C#Builder
for Delphi
Developers
Whats Different?
Whats the Same?
FEATURE
Whats New
in C# 2?
Find out what
new features
will impact your
development.
Cover Story
By Corbin Dunn
ORLAND C#BUILDER IS THE FIRST COMPLETE DEVELOPment solution for the .NET Framework from Borland.
C#Builder combines a first-rate IDE for both Windows
Forms and Web Forms development, with links to Java
and a broad range of enterprise databases. For Delphi
developers who are accustomed to writing native Windows applications theres much to like in the C# language. Although the language superficially resembles C,
its been designed to be accessible to new programmers.
Similarly, Borland has designed C#Builder to be easy to
learn, and easy to use. Many of the features from Delphi
will be familiar, including the approaches to application
design, the Code Editor, and the debugger. Other features
are appropriate for C# and the .NET Framework, such as
the streamlined Tool Palette and the
new Model View.
Figure 1. Like Delphi, the Borland C#Builder IDE includes live tools, capable of displaying data
from databases, ADO.NET connections, and other data sources during design time. And its IDE
arrangement can be extensively customized and saved in various configurations.
www.C-SharpPRO.com
Cover Story
www.C-SharpPRO.com
Cover Story
Object Inspector. This improved help extends to the
Object Inspector as well (refer to Figure 1). This broadly
resembles the Delphi version, with items grouped in categories and those changed from their defaults marked in bold.
However, each property and event now displays a one-line
explanation at the bottom of the Object Inspector, which is
especially useful when using a new component for the first
time. While Delphi has always been able to include Component Editors on right-click context menus, C#Builder also
includes links to these at the bottom of the Object Inspector.
This makes it clearer to see what editors are available.
Code Editor. One area that will be immediately familiar is
the Code Editor, but its also been changed to make it even
easier to use. All the familiar features and keystrokes (including 9 for Run with Debugging) are available, together with the
standard Borland syntax highlighting, now updated for C#.
Code Insight remains, although it has naturally been
updated to understand the C# language and provide the same
abilities previously seen for Delphi, C++, and Java. And like
Delphi 7, it also supports HTML so its especially useful when
combined with the new visual Web Forms designer.
An important new feature is code folding; the developer
can now collapse a portion of code, temporarily hiding it.
This provides a general outline, similar to the interface
section of a Delphi unit, and provides the developer with a
clearer view of the source.
Other changes are subtle but no less important. Rather than
the begin and end keywords of Delphi, C# uses C-like braces;
the editor automatically highlights opening and closing pairs,
making it easy to check for mismatched pairs. The same feature is used to identify opening and closing braces, quotes, and
parentheses. Syntax errors are denoted by red wavy underlines,
as in Microsoft Word. Because C# is case-sensitive, this can
provide immediate feedback to prevent simple mistakes!
The new Tool Palette changes depending on context;
when code is displayed, for example, a set of Code Snippets are available. These are simple code extracts that can
quickly be selected and dropped into the program.
Database Development
The approach to creating applications, then, is broadly similar
to that used for Delphi. Applications are built of units of code,
which may optionally be used for Windows forms. The significant differences are in the component library, and in particular the way that the components are put together for database access and Web applications. Rather than the different
Borland database technologies, database access from C#Builder
uses the standard ADO.NET technology, with optionally
additional .NET components provided by Borland.
The first major difference encountered by Delphi database
application developers is that there is no equivalent to the
DataModule. Rather, non-visual components that are used
for data access are placed in the bottom margin of the visual
designer. Here they appear as separate icons, so their proper-
ASP.NET Applications
Perhaps the biggest difference in the user interface of
C#Builder is the approach taken to Web-based applications.
www.C-SharpPRO.com
Cover Story
Summary
Borland Delphi developers will quickly find themselves
at home with Borland C#Builder. Many of the features of
the two solutions are the same, from editor keystrokes to
the approach to development. However, C#Builder has
Corbin Dunn is a Research and Development software engineer for the .NET
group at Borland Software Corporation. He is currently working on the IDE.
When not speaking at conferences, writing for magazines, or posting to the
newsgroups, he can be found scaling steep rocks in the Santa Cruz Mountains,
riding motorcycles, or hanging out in his tree house.
www.C-SharpPRO.com
Feature
By Bill Wagner
Whats New in C# 2?
Feature
generics are, however, quite different. Lets look at one
simple example to see how generics work and how they
are implemented. Consider this portion of a list class:
public class List
{
internal class Node
{
object val;
Node next;
}
private Node first;
public void AddHead (object t)
{ // ...
}
public object Head ()
{
return first.val;
}
Whats New in C# 2?
}
.method public AddHead (!0 t) {
}
.method public !0 Head () {
}
{
ItemType val;
Node<ItemType> next;
}
private Node<ItemType> first;
{
return first.val;
}
Notice that I replace object with ItemType the parameter type in the class definition. The C# compiler stores
the parameter for ItemType as the proper type when you
instantiate the list. For example, take a look at this code:
List<int> intList = new List<int> ();
Feature
Figure 1. This error, edited for brevity, fails because the Test class does
not support copy construction or assignment, even though the specific
messages dont tell you that. C# 2 should, with constraints, give you
better indications about problems when you have compilation trouble.
Whats New in C# 2?
You can specify one base class and any number of interfaces as a set of constraints for each parameterized type. In
addition, you can specify that a type must have a constructor
without parameters (but this syntax is still being discussed).
Constraints also provide one more advantage: The compiler assumes the objects in your generic class support any
interfaces (or base-class methods) specified in the constraint
list. In the absence of any constraints, the compiler assumes
only the methods defined in System.Object. You would need
to add casts to use any other method. In general, whenever
you use a method not defined in System.Object, you should
specify that requirement in a set of constraints.
I like the design decisions in C# 2.0s generics. Its a nice
mix between run-time power and a powerful development tool.
You can specify your requirements on parameterized types
better than you can in C++, and Microsofts commitment to
reflection in generics will be an important advantage over the
Java Tiger project. Generics are important enough that Microsoft will release a new namespace containing generic versions
of the existing .NET collections: System.Collections.Generic.
This namespace will contain generic versions of ArrayList,
HashTable, and all the other classes in this namespace.
Generics are big news and require you to make big changes.
Some changes are still in discussion. For example, consider
generics and reflection. The C# designers have stated a goal
that you will be able to use reflection to find both a generic
class and a specific instantiation of a generic class. These
features also will have some impact on both MSIL and the
CLR. In addition, it might introduce new features in the
System.Reflection namespace.
Because generics require changes to the CLR and MSIL,
other .NET languages can add generics in time. No official statements have been made on when or if other languages will include generics.
www.C-SharpPRO.com
Feature
Explore Iterators
Iterators are a new syntax to create a common idiom
using much less code. Suppose you create some nifty
new container class (many general-purpose containers are
implemented in the .NET Framework library already). To
support your users, you need to create methods that support traversing this collection and returning the objects in
the collection.
Today, you would do this by creating a class that implements IEnumerator. IEnumerator contains two methods
Reset and MoveNext and one property Current. In
addition, you would add IEnumerable to the list of implemented interfaces on your binary tree, and its GetEnumerator
method would return an IEnumerator for your collection. By
the time youre done, you have written an extra class with at
least three functions as well as some state management and
another method in your main class. To illustrate this, consider
the code in Figure 2 its almost a full page of code, simply
to handle list enumeration.
C# 2.0 adds a new semantic to the foreach keyword
that lets you write these iterators much more concisely.
Here is the C# 2.0 version of the code in Figure 2:
public class List
{
public object foreach ()
{
int i=0;
while (i < theList.Length ())
yield theList[i++];
}
// Other methods removed.
}
The foreach operator, combined with the yield statement, lets you replace roughly 30 lines of code with only
six. This means fewer bugs, less development time, and
less source code to maintain all good things.
Internally, the compiler generates the MSIL that corresponds to those 30 lines of code in todays version. The
difference is that the compiler does it so you dont have
to. The compiler generates a class that implements the
IEnumerator interface and adds it to your list of supported
interfaces; youll have no control over the compiler-generated class name. The interaction between the source,
the generated MSIL, and the reflection APIs are all being
debated, and it will change before the final version of C#
2 is released. But a few requirements should stay true.
Youll be able to use reflection to find the GetEnumerator
method of the outer class, and youll be able to use the
inner enumerator class. But you might not necessarily be
able to use reflection to get at the inner enumerator class.
I always get this question when I talk about these new
features, and though it seems obvious, Ill say it anyway:
You can combine iterators with generic classes. In addition,
some syntax changes are planned for iterators. In the final
Whats New in C# 2?
Figure 2. You need all this code simply to support iterating a collection
based on an array. You would need even more code to support more
complicated internal data structures. C# 2.0 lets you write these iterators
much more concisely using the foreach keyword.
Bill Wagner has been an independent software consultant for more than nine
years, and he co-founded SRT Solutions in 2001. He is a nationally recognized
expert on Microsoft .NET, developing in .NET, C#, and C++, as well as
ASP.NET and ASP. His publications include The C# Core Language Little Black
Book (Coriolis). E-mail him at wwagner@SRTSolutions.com.
www.C-SharpPRO.com
N E W
&
U S E D
By Bill Todd
you can make the virtual hard disk on any virtual machine
non-persistent. This means that each time you shut down the
virtual machine you will be asked if you want to save all the
information that was written to the virtual hard drive. If you
decline, all the information written to the hard drive will be
discarded. The next time you start the virtual machine it will
be in exactly the same state it was before you used it. Instead
of using a non-persistent virtual disk you can take a snapshot
at any time while a virtual machine is running, and later revert
back to the snapshot. Snapshots and non-persistent disks make
repetitive testing using a known environment very easy.
What Is VMware Workstation?
VMware Workstation is a program that enables you to run
multiple operating systems simultaneously in fully networked,
portable virtual machines on one physical machine. You install
it just like any other piece of software. It does not modify your
operating system and it does not require any special hardware.
What you do need is fairly powerful hardware on the host
machine. For adequate performance you need a 500 MHz
P6-compatible processor and enough memory to run the
host operating system, the guest operating systems, and
any applications that you need to run. You will also need
enough disk space to accommodate the virtual disks for
New
&
Used
Creating a Virtual
Machine
To create a new virtual machine start
VMware Workstation and choose File |
New | Virtual machine from the menu to
start the virtual machine wizard shown
in Figure 1. You can choose a standard
configuration or create a custom configuration. Next, the wizard lets you choose
from a drop-down list of operating systems. The list includes an Other choice if
you want to try an O/S that is not in the
list. If you select a custom installation
you will be asked to choose the amount
of memory in your virtual machine.
Next, you can choose the type of networking support you want. VMware
supports three types of networking.
Bridged networking gives the virtual
machine direct access to the network to
which the host machine is connected.
The virtual machine will appear as
another machine on the network with
its own IP address and machine name.
Network address translation (NAT) gives
the virtual machine access to the hosts
network using the hosts IP address.
This works exactly like having two or
more machines connected to a network
through a router that supports NAT, and
can be used to connect to non-TCP/IP
networks, such as Token Ring. The third
choice is Host Only networking. This
provides a virtual network to which
only the host and the virtual machines
can connect. The great thing about Host
Only networking is that, unlike Bridged
and NAT, it works on a machine that is
not connected to an external network.
The only disadvantage to Host Only
networking is that if your machine is
connected to an external network, the
virtual machines cannot access it.
The next page of the wizard asks what kind of hard disk your
virtual machine will use. You can choose to create a new virtual disk, use an existing virtual disk, or use a physical disk.
If you elect to create a new virtual disk, the next page of the
wizard lets you choose the size of the disk. You also have the
option to allocate all the disk space at this time. Allocating all
of the disk space when you create the virtual disk means better performance when you use the disk because VMware does
not have to expand the file that contains the virtual disk as you
New
&
Used
Feature
Description
Snapshots
Shared folders
Share files between guest and host operating systems using shared folders.
New Linux UI
Favorites list
Full support for native program debugging, including user- and kernel-level
debuggers.
APIC hardware
VESA BIOS
DOS support
USB 2.0
USB 2.0 host devices are now supported by mapping to USB 1.1 in virtual
machines.
New
&
Used
Conclusion
If you need to perform repetitive testing starting with a known
machine configuration, test on multiple operating systems,
develop on multiple operating systems, run legacy applications,
or develop and test network applications, VMware Workstation
is a great solution. You get all the power and flexibility of having multiple machines connected on a network with advantages that you cannot get with physical hardware. You can change
the hardware configuration of a virtual machine simply by
editing the virtual machine configuration. You can restore the
machine to a known state using either a non-persistent virtual
disk or snapshots. VMware Workstation provides a development and test environment that is more flexible than hardware
at a fraction of the cost.
32
F I L E
N E W
File
New
except the user must complete certain tasks in the tutorial for it to be
identical to its corresponding demo.
While the demos are perfect for getting a quick idea of capabilities, the
tutorials are ideal for learning the
essential skills and architecture. Most
of the grunt work is done for you.
Although this approach is obvious
and logical, the developers at Developer Express have used some innovative techniques to set the demos
apart from the tutorials.
When you open a tutorial for the
first time and try to run it, you get
a warning message alerting you that
you have some tasks to complete.
Those tasks involve manipulating the
component/property editors, setting
properties, and yes relating to
code. Its in the latter task that we
find some truly clever approaches.
Instead of having you type a lot of
code, or even pasting code from
somewhere else, youre simply asked
to activate the code by relating to
comment characters. A block of code
to be activated would begin with:
{ remove/add the closing brace on
this line to disable/enable the
following code }
ExpressQuantumGrid includes a
demo and a tutorial for every major
topic. They are essentially the same,
34
Alan Moore is a professor at Kentucky State University, where he teaches music theory and humanities. He
was named Distinguished Professor for 2001-2002. He has been named the Project JEDI Director for 2002-2004.
He has developed education-related applications with the Borland languages for more than 15 years. Hes the
author of The Tomes of Delphi: Win32 Multimedia API (Wordware Publishing, 2000) and co-author (with
John C. Penman) of The Tomes of Delphi: Basic 32-Bit Communications Programming (Wordware Publishing,
2003). He also has published a number of articles in various technical journals. Using Delphi, he specializes in
writing custom components and implementing multimedia capabilities in applications, particularly sound and
music. You can reach Alan at acmdoc@aol.com.