0401
0401
2004
Volume 10 Number 1
INSIDE
ON THE COVER
Sound+Vision
3D Delphi
Delphi Informant
www.DelphiZine.com
FEATURES
.NET Tech
10
en
etwe
cts b aos
Proje
h
ftware and C
o
S
Keep igidity
R
Create and Use
es
.NET Resourc
Roll Your Own
Hotmail Proxy Server
Extreme W
eb Sites
In Development
16
On the Net
20
REVIEWS
26 Database Workbench
Product Review by Bill Todd
29
Pervasive.SQL v8
33
ExpressBars Suite 5
36
1
D E PA R T M E N T S
2 Toolbox
37 File | New by Alan C. Moore, Ph.D.
T O O L B O X
PASSOLO 4.0 Service
Release Includes Delphi/
C++Builder Solution
PASS Engineering announced a new
service release of PASSOLO 4.0. PASSOLO optimizes software localization
and ensures easy compilation, exchange,
and processing of translation data. PASSOLO requires neither time-consuming
and expensive training nor programming
experience. Many errors that occur during localization are avoided or automatically recognized by PASSOLO.
This service release includes enhanced
Delphi/C++Builder support, which
provides a visual localization solution for
Delphi/C++Builder resources.
PASSOLOs Delphi/C++Builder solution integrates seamlessly with any
edition of PASSOLO 4.0 (Standard, Professional, Team, or Translator). It offers
comprehensive support of PASSOLOs
visual localization environment and
extensive options for configuration and
customization. The latest PASSOLO service release is available free of charge to
all PASSOLO 4.0 customers, and can be
downloaded from www.passolo.com/
support/index.htm.
PASS Engineering GmbH
Price: Free to PASSOLO 4.0 customers.
Contact: [email protected]
Web Site: www.passolo.com
T O O L B O X
VssConneXion 3 for Delphi and C++Builder Available
EPocalipse Software released VssConAutomatic check-out when editneXion 3, a SourceSafe integration
ing forms and source files now offers
expert for Delphi and C++Builder
more options and works much better
that allows you to perform the most
with forms and project files. Find Last
common source control operations
Change allows you to select a line in
directly from the IDE. This version
the editor and find the last version of
introduces many new features, such
the file when this line was changed.
as Source History, which allows you
Review Changes is a great tool to enter
to see the history of a file together
check-in comments while viewing difwith the changes made to the file.
ferences before check in.
Also new is Source Analysis, which
GIS Development Toolkit
shows an overview of the changes
Component Supports
made to a file using different views
IntraWeb
(changes by user, changes by date,
TatukGIS announced a new component
my changes, and changes by count).
for the comprehensive TatukGIS DevelMultilizer 6.0 Released
oper Kernel toolkit to support IntraWeb,
Multilizer, Inc. announced the release
the popular Web application developof Multilizer 6.0, the next generation verment environment from Atozed Software
sion of their localization tool for devel(www.atozed.com).
oping multilingual VCL applications.
By supporting IntraWeb, TatukGIS offers
Multilizer localizes Delphi/
Delphi and C++Builder developers a
C++Builder binaries directly, thus simmethod of porting their DK-VCL appliplifying the localization process and min- cations to a Web server environment,
imizing developers overhead in creating
as well as the following advantages:
different language versions of software.
theres no need to change technologies
With its WYSIWYG capabilities Multifrom Borland development tools; only a
lizer 6.0 allows visual editing of dialogs,
minimum of changes are needed to the
menus, accelerators, and bitmap-type
core DK-VCL source code of any existing
resources. Multilizer 6.0 also supports
application; and it offers true WYSWIG
visual inheritance.
development. It is also reliable and easy
Multilizers comprehensive validation
to deploy, and offers an intranet user feel
rules automatically detect localization
similar to a desktop PC application.
issues that users dont even see or that
An IntraWeb license is bundled with
take too long to check manually.
Delphi 7. DK-VCL developers using
You can download free trials from the
C++Builder can obtain an IntraWeb
Multilizer Web site.
license separately from Atozed Software.
Multilizer Inc.
Price: Starts at US$1,475
Contact: [email protected]
Web Site: www.multilizer.com
Joe Mayo
SAMS
ISBN: 0-672-32589-6
Cover Price: US$34.99
(461 pages, CD-ROM)
www.samspublishing.com
TatukGIS
Price: Contact TatukGIS.
Contact: [email protected]
Web Site: www.tatukgis.com
Advantage Database
Server: The Official Guide
S O U N D + V I S I O N
ANAGLYPHIC STEREO IMAGES
DELPHI 4-7
By Alexander Gofen
3D Delphi
Sound+Vision
3D Delphi
Sound+Vision
3D Delphi
while the second and the third layers are drawn like this:
CopyMode := cmSrcPaint
Sound+Vision
3D Delphi
Constant
Viewed through
Red filter
Viewed through
Blue filter
Composite Red
Composite Blue
Theyre overlapping
T2DPoint = record
x, y : extended
end;
T3DPoint = object
// 3D coordinates to be mapped into two 2D coordinates
// RightEyeProj and LeftEyeProj.
x, y, z : extended;
RightEyeProj, // Right-eye perspective projection.
LeftEyeProj : T2DPoint; // Left-eye ...
procedure SetRightLeft;
// With rotation.
function Init(const x1, y1, z1: extended): T3DPoint;
// Without rotation.
function InitStill(const x1, y1, z1: extended): T3DPoint;
end;
cmImageWidth,
Abase, cmABase,
Dist, cmDist,
Front, cmFront,
Cx, Cy, Cz,
...
//
//
//
//
//
//
2) The proportional parallelepiped of the 3D scene corresponding to the physical sizes of your local macro-world:
your 2D screen, the distance from you to that screen,
and the distance between your eyes, say in cm. In this
scale, the 3D scene is to be projected onto the 2D plane
of your screen. The values x and y in the type T2DPoint
represent the coordinates of this screen.
3) The proportional logical screen, Canvas, with sizes and
points in pixels, corresponding to that physical 2D screen.
The simplest projection method for points (x,y,z) in 3D space
onto a 2D coordinate plane XOY, is such that projecting rays
are all parallel to the OZ axis (as if the viewing point were at
Sound+Vision
3D Delphi
procedure T3DPoint.SetRightLeft;
var
Kz : extended;
begin
Kz := Max(- z + Cz, Front);
RightEyeProj.x := Cx-Base+Dist*(x-Cx+Base)/Kz;
LeftEyeProj.x := Cx+Base+Dist*(x-Cx-Base)/Kz;
RightEyeProj.y := Cy+Dist*(y-Cy)/Kz;
// y values always equal for both projections.
LeftEyeProj.y := RightEyeProj.y
end;
Thus the function linearly transforms the real type coordinates into the values applicable to Canvas.Pixels with the axis
OY directed traditionally down-up. For example, the procedure in Figure 11 draws a stereo line between points p and q.
Having this, we can write a procedure that draws a triangular facet (of a polyhedron) with a certain gray color, i.e.
a certain level of half-tone Red and Blue. Now were ready
for stereo triangulation of a given surface in 3D space (surfaces are beyond the scope of this article however). Here
8
Figure 10: The overlapping Blue and Red images inside the rectangular area on
canvas of the form designated for the stereo pair.
Sound+Vision
3D Delphi
. N E T
.NET FRAMEWORK
T E C H
RESOURCES
By Fernando Vicaria
program ResMaker;
{$APPTYPE CONSOLE}
uses
System.Resources, System.Drawing, System.Windows.Forms;
var
rw: ResourceWriter;
b: Bitmap;
i: Icon;
c: Cursor;
begin
rw := ResourceWriter.Create('MyRes.resources');
b := Bitmap.Create('HANDSHAK.BMP');
I := Icon.Create('house.ico');
c := Cursor.Create('handpnt.cur');
rw.AddResource('HANDBMP', b);
rw.AddResource('MAINICON', i);
rw.AddResource('MAINCURSOR', c);
rw.AddResource('string 1', 'First String');
rw.AddResource('string 2', 'Second String');
rw.Generate;
rw.CLose
end.
.NET
Te c h
program ResXMaker;
program ResXReader;
{$APPTYPE CONSOLE}
{$APPTYPE CONSOLE}
uses
System.Resources, System.Drawing;
uses
System.Resources, System.Collections;
var
rxw: ResXResourceWriter;
b: Bitmap;
var
rsxr: ResXResourceReader;
id: IDictionaryEnumerator;
begin
rxw := ResXResourceWriter.Create('MyResX.resx');
b := Bitmap.Create('HANDSHAK.BMP');
rxw.AddResource('HANDSHAK', b);
rxw.Generate;
rxw.Close
end.
begin
// Create a ResXResourceReader for the file MyResX.resx.
rsxr := ResXResourceReader.Create('MyResX.resx');
// Create an IDictionaryEnumerator to iterate through
// the resources.
id := rsxr.GetEnumerator;
Console.WriteLine;
Console.WriteLine(' Name ' + #9#9 + ' Type');
Console.WriteLine(
' ====================================');
// Iterate resources; display contents to console.
while id.MoveNext do
Console.WriteLine(' ' + id.Key.ToString + #9 +
id.Value.GetType.FullName);
Console.WriteLine(' ====================================');
rsxr.Close; // Close the reader.
end.
.NET
Te c h
{$R MyRes.resources}
procedure TMainForm.InitComponents;
var
asmb: Assembly;
rm: ResourceManager;
begin
SuspendLayout;
Text := 'Using a *.resources file';
AutoScaleBaseSize := TSize.Create(5, 13);
ClientSize := TSize.Create(500, 500);
Button1 := TButton.Create;
Button1.Top := 5;
Button1.Left := 5;
Button1.FlatStyle := FlatStyle.System;
Button1.Text := 'Load Bitmap';
Button1.Add_Click(Button1Click);
Controls.Add(Button1);
asmb := Assembly.GetExecutingAssembly;
rm := ResourceManager.Create('MyRes', asmb);
Icon := TIcon(rm.GetObject('MAINICON'));
Cursor := TCursor(rm.GetObject('MAINCURSOR'));
FImageRes := TBitmap(rm.GetObject('HANDSHAK'));
FStrRes := string(rm.GetObject('string1'));
ResumeLayout(False);
end;
Using ResGen
Now that weve seen how to generate and retrieve resources in both XML and binary formats, its time to find out
how we can generate these resources using some of the
tools the .NET SDK provides. The first one is the Resource
File Generator (or ResGen.exe). The Resource File Generator converts .txt files and .resx (XML-based resource format) files to common language run-time binary .resources
files that can be embedded in a run-time binary executable
or compiled into satellite assemblies.
Figure 6: Loading resources from an embedded .resources file in Delphi for .NET.
Using ResXGen
The ResX Generator (ResXGen) is another console utility provided by the .NET SDK that converts an image file (such as a
.jpg or .bmp file) into an XML-formatted .resx file, which, as
we saw earlier, can then be compiled into a .NET-compatible
.resources files using ResGen.exe. This is a very simple tool that
wraps a ResXResourceWriter class; in fact, I find it very limiting
for any practical purpose, but for the sake of completeness I will
quickly describe it and then name a few alternatives.
The following command will add the icon MyIcon.ico into the
resource file MyRes.resx with the internal name of MAINICON:
C:\>resxgen /i:MyIcon.ico /n:MAINICON /o:MyRes.resx
.NET
Te c h
13
.NET
Te c h
24
"UseResources.exe.manifest"
14
Conclusion
This concludes our look into the basics
of how to use resources in .NET with
the Delphi for .NET Compiler Preview.
We learned how to create .resources and
.resx files in code, and how to use the
two resource generator tools provided
by the .NET SDK: ResGen and ResXGen. Finally, we looked
into ways of adding a manifest to our .NET applications as a
standalone file or compiled into the assembly as a resource.
Theres a lot more that can be done with resources in .NET,
and the Framework provides many ways for you to write and
retrieve resources in your assemblies. For more ideas, check
out these references:
MSDN Library: http://msdn.microsoft.com/library/
default.asp
Working with Resource Files: http://
samples.gotdotnet.com/quickstart/aspplus/doc/
resourcefiles.aspx
Lutz Roeders .NET Resourcer: www.aisto.com/
roeder/dotnet/
The files referenced in this article are available for download
on the Delphi Informant Magazine Complete Works CD
located in INFORM\2004\JAN\DI200401FV.
.NET
Te c h
VCL mapping }
System.Windows.Forms.Form;
System.Windows.Forms.Button;
System.Windows.Forms.Cursor;
System.Drawing.Icon;
System.Drawing.Size;
System.Drawing.Bitmap;
type
{ Application main form }
TMainForm = class(TForm)
private
FImageRes: TBitmap;
FStrRes: string;
Button1: TButton;
procedure InitComponents;
procedure Button1Click(Sender: TObject;
Args: EventArgs);
public
constructor Create(Owner: TObject);
end;
function LoadResource(resFile: string): HashTable;
var
rr: ResourceReader;
resTbl: Hashtable;
de: IDictionaryEnumerator;
begin
try
resTbl := Hashtable.Create;
rr := ResourceReader.Create(resFile);
de := IDictionaryEnumerator(rr.GetEnumerator);
while IEnumerator(de).MoveNext do
resTbl.Add(de.Key,de.Value);
rr.Close;
Result := resTbl;
except
on Exception do
Result := nil;
end;
end;
15
{ TMainForm }
constructor TMainForm.Create(Owner: TObject);
begin
inherited Create;
InitComponents;
end;
procedure TMainForm.InitComponents;
var
resTbl: HashTable;
begin
SuspendLayout;
Text := 'Using a *.resources file';
AutoScaleBaseSize := TSize.Create(5, 13);
ClientSize := TSize.Create(500, 500);
Button1 := TButton.Create;
Button1.Top := 5;
Button1.Left := 5;
Button1.FlatStyle := FlatStyle.System;
Button1.Text := 'Load Bitmap';
Button1.Add_Click(Button1Click);
Controls.Add(Button1);
try
resTbl := LoadResource('MyRes.resources');
Icon := TIcon(resTbl['MAINICON']);
Cursor := TCursor(resTbl['MAINCURSOR']);
FImageRes := TBitmap(resTbl['HANDSHAK']);
FStrRes := string(resTbl['string1']);
except
// Ignore if resource isn't there or file wasn't found.
on NullReferenceException do ;
end;
ResumeLayout(False);
end;
procedure TMainForm.Button1Click(Sender: TObject;
Args: EventArgs);
begin
BackgroundImage := FImageRes;
MessageBox.Show('String resource is: ' + FStrRes);
end;
var
MainForm: TMainForm;
[STAThread]
begin
MainForm := TMainForm.Create(nil);
Application.Run(MainForm);
MainForm.Free;
end.
I N
D E V E L O P M E N T
REQUIREMENTS
MODELING
Over the next several issues, we will walk through a practical approach to software process management thats
designed to improve your success at delivering on project
objectives achieving time-to-market with the appropriate
Methodology
Requirements
Modeling
Change
Management
Configuration
Management
Build
Management
Quality Assurance
Management
Defect
Management
Project/Schedule
Management
In
Development
quality level, and managing project lifecycle costs. A practical approach is one that is at neither extreme, nor suggests
a one-size-fits-all solution. And it cant be practical if it isnt
within both the budget and the bandwidth of virtually every
software development team.
Requirements
Requirements management is the process of eliciting,
capturing, and validating the capabilities to be delivered.
Requirements represent the various interests of the projects stakeholders, and as such, correctly capturing and
implementing requirements is critical to project success.
Types of requirements for a given project may include:
Business requirements the business objectives to be
accomplished through the execution of the project
Features or Marketing requirements the high-level
description of the services the product will provide
Software requirements the functionality to be provided by the product, as well as non-functional attributes of the solution
Methodology
A methodology represents the philosophical approach to be
taken in software development, and embodies the set of processes and practices to be used
throughout the development
Requirements management proThe practical approach
lifecycle. This philosophical
cesses vary widely in their rigor
recognizes that 80% of the
aspect of methodology makes
and approach, primarily driven by
benefit comes from 20% of
it the area of software developthe philosophy of the methodolment process management most
ogy being employed. Requirements
the effort, and that no single
likely to generate religious zeal
may be captured in a Software
philosophical approach has a
regarding alternative approachRequirements Specification documonopoly on success.
es. Its also the area most likely
ment, containing narrative descripto strike fear in the heart of the
tions of business, marketing, and
practical software development manager as methodologies
software requirements, complete with supporting use cases.
have a reputation for being academic. Methodology propoIn more lightweight methodologies, requirements may be capnents have a tendency to offer the exclusive answer for fast
tured as simple one-sentence statements and sequenced for
time-to-market and staying on budget, and quite often only
inclusion in frequent deliverables.
promise results if you follow the methodology in its entirety.
The level of documentation and clarity necessary in a products
The Rational Unified Process and the Agile methodology are
requirements depends on a number of factors. Incorrectly
excellent examples of clearly articulated and rich methodoloassessing the need for rigor in requirements gathering can lead
gies covering the full development lifecycle. Meta-methodoloto disaster in either direction of the error. If the degree of rigor
gies, such as the Capability Maturity Model (CMM) from the
is over-estimated, precious time and resources will be lost in
Software Engineering Institute (SEI), and ISO 9000-3 from the
compiling unnecessary documents and diagrams. If underestiInternational Organization for Standardization (ISO), are also
mated, stakeholder frustration and user acceptance issues may
available to guide methodology development. Meta-methodolothreaten the future of your project.
gies differ from methodologies in that they identify the processes and capabilities needed, rather than the specific approach
As with methodologies, well look at the factors that deterused to execute the process or provide the capability. For exam- mine the level of rigor required by your project, and discuss
ple, CMM will outline what is to be covered in a requirements
practical techniques for gathering requirements as a foundadocument, but does not prescribe how to gather requirements.
tion for project success.
Modeling
Modeling is a key software development practice thats receiving much attention these days in the press, with a focus on
Model Driven Architecture (MDA). The Object Management
Group (OMG) has established a specification for MDA (see
www.omg.org/mda), and software tool vendors, including
In
Development
In
Development
Many teams have a handle on Defect Tracking with the availability of low cost tools. However, Defect Tracking is not the
only component to Quality Assurance. Testing, design reviews,
code reviews, and walkthroughs are only some of the practices
teams can employ to keep control of the overall product quality. A goal of Quality Assurance is to prevent, manage, identify,
and resolve the specific cases in which a product does not
meet relevant specifications or requirements.
19
Steven Beebe is the chief operating officer and senior consultant with Xapware
Technologies Inc., provider of Active! Focus a practical solution for managing
a number of aspects of software projects. Steve has been developing software and
managing the development of software for over 15 years. Steves experience ranges
from managing teams from 10 to 120 professionals, in both start up and Fortune
20 companies. Steve is available for consulting engagements. You may contact him
at [email protected] or visit www.xapware.com.
Xavier Pacheco is the president and chief consultant of Xapware Technologies
Inc., provider of Active! Focus a practical solution for managing software projects
and requirements management. Xavier is the co-author of Delphi 6 Developers
Guide and has also written for publications such as Delphi Informant and Delphi
Magazine. Xavier is available for consulting and training engagements. You may
contact him at [email protected] or visit www.xapware.com.
O N
T H E
N E T
HOTMAIL
DELPHI 4-7
By Alfred Mirzagitov
Writing an E-mail
Proxy Server
Part I: Analyzing the HotServer Project
There are advantages to using a Web-based e-mail serSo my next logical step was to write some Delphi code to solve
vice. If you travel a lot and cannot access your mail
this problem once and for all. The next few evenings I spent
server reliably, or keep changing
listening to IP packets and writing a
your Internet service providers,
This is an undocumented Delphi program. The problem had
a Web-based e-mail service can
several distinctive parts to it that are
and non-standard interface,
be very handy. Hotmail is prorelated to different Internet technoland if Microsoft Outlook
vided by Microsoft and is probogies, and I thought my experience
ably the worlds most popular
with this application could provide
isnt your software of
Web-based mailing system. It
an interesting case study for other
choice, youre out of luck.
can be irritating at times, but
programmers.
its free and very stable. In my
experience it has never been down or too slow. Of course, This two-part article series provides a small case study
a hotmail.com return address too often means that its
on how to use Delphi to handle the e-mail protocols
spam, but thats a totally different story.
POP and SMTP, WebDAV (Web Distributed Authoring
and Versioning protocol), and to write a fully functional
There are also some drawbacks to Hotmail being a Weblocal POP/SMTP proxy server for sending and retrieving
based e-mail service. You can check your e-mails only using
hotmail.com e-mails using your favorite e-mail client.
a Web browser or Microsoft Outlook. Hotmail doesnt proIt also touches on some security issues such as Internet
vide standard SMTP and POP access to its mailboxes.
Explorer security zones and filtering client connections
based on IP addresses. This month well examine the
This got me thinking about what it would take to hook
problem and technologies; next month, well implement
up my Eudora e-mail client to Hotmail. Outlook uses a
the solution.
20
On
the
Net
Initially, the server host starts the SMTP service by listening on TCP port 25, and the POP service by listening on
TCP port 110. When a client wishes to make use of any
of these services, it establishes a TCP connection with
21
On
the
Net
than analyzing the code line by line. The full source code
of the HotServer application is included with this series
and includes additional comments (available for download; see end of article for details).
Lets start with a new application: File | New | Application.
We dont need a big main form, so resize the main form
to be no more than a thumbnail. Change the forms Caption to HotServer. Double-click the form and modify the
FormCreate event handler thus:
procedure TForm1.FormCreate(Sender: TObject);
begin
// Parse port numbers here.
end;
The comment will keep Delphi from automatically removing the event handler until we add more code to it. Drop an
instance of TPanel and set its Name property to Quit and set
the Align property to alClient. Double-lick on the panel and
modify its event handler:
procedure TForm1.QuitClick(Sender: TObject);
begin
Close
end;
procedure TForm1.PopSocketAccept(...
begin
// Show message to client.
ClientSocket.SendLn('Hello World')
Sleep(5000); // Wait 5 seconds, and disconnect.
end;
procedure TForm1.SmtpSocketAccept(...
// Make the body identical to PopSocketAccept.
telnet localhost 25
On
the
Net
Figure 2: This OnFormCreate event handler allows the user to change the POP
and SMTP ports.
function AcceptRemoteClient(remoteIP: string): Boolean;
begin
// IPs starting with 127 belong to localhost.
Result := Copy(remoteIP,1,4) = '127.'
end;
Parsing client IP addresses can be implemented in many different ways. The UChkIP.PAS unit offers one such way. It
has only one public function named AcceptRemoteClient in
its interface section. Skipping the implementation details,
all we need to do is add UChkIP to our units uses clause.
When you run the HotServer application the first time,
it will automatically create an .INI file and add the local
host to the list. You may edit the .INI file manually to add
allowed addresses other than the local host. By default
our little application will accept connections only from
the local host.
SMTP Server Implementation
The next step is to find out what exactly an SMTP server
is supposed to do for the client. Fortunately, SMTP is
exactly what its name implies incredibly simple. SMTP
is an open standard, and well documented in the RFC 821.
Consider a typical SMTP session (see Figure 3). The
SMTP conversation is very simple and readable by a
human. You can immediately try sending an e-mail to
yourself manually using only telnet, if you know a valid
SMTP server name or IP address that will relay e-mails
from your computer. Please note that when you are in
a telnet session, you can see only the server side of the
conversation. Everything you type will be invisible, except
the first line.
The SMTP commands and replies have a rigid syntax.
Commands and replies arent case-sensitive, with the
exception of mailbox user names. For some hosts the
user name is case-sensitive, and the SMTP server must be
aware of that.
The replies from an SMTP server always have a threedigit code, followed by a space, and (optionally) text.
The session must start with code 220 and a greeting, for
example:
220 MailServer ready
Imagine a hypothetical socket server running on a gateway computer with an IP address of 209.123.123.4. Imagine
also that we have two legitimate client computers in our
office with IP addresses 209.123.123.5 and 209.123.123.6.
We want to invent an easy way of screening out IP addresses. The easiest way would be to use an INI file to which we
could add acceptable client addresses one by one:
[AllowedClients]
allow_ip_1=209.123.123.5
allow_ip_2=209.123.123.6
23
On
the
Net
HELO <domain>
The host sending the command identifies itself with HELO; its like saying
Hello, I am <domain>. HELO must
be the first command of a session. It
can be sent only once during a session,
but the client may repeat the HELO
command after RSET.
MAIL FROM:
[email protected]
RCPT TO:
[email protected]
DATA
QUIT
RSET
DATA
354 Start mail input; end with <CRLF>.<CRLF>
Hello World!
...etc. etc. etc.
.
250 OK
C: QUIT
S: 221 Bye
C:<close connection>
S:<wait for next connection>
The POP server uses a POP3 protocol (Post Office Protocol Version 3). POP3 protocol is used for e-mail retrieval,
and it is intended to permit an e-mail client to dynamically access a maildrop on a server. POP3 protocol is used
to allow a workstation to authenticate and retrieve mail
that the server is holding for it.
Notice that building our SMTP server (and later our POP
server) in layers gives us a certain advantage of abstraction. At this point were not concerned about how the
e-mails get delivered. Later, well add the specific Hotmail
layer, but we could easily replace the Hotmail layer with a
special driver or a postal pigeon.
On
the
Net
C:
S:
C:
S:
S:
S:
S:
C:
S:
S:
S:
C:
S:
C:
S:
S:
S:
C:
S:
STAT
+OK 2 320
LIST
+OK 2 messages (320 octets)
1 120
2 200
.
RETR 1
+OK 120 octets
<the POP3 server sends message 1>
.
DELE 1
+OK message 1 deleted
RETR 2
+OK 200 octets
<the POP3 server sends message 2>
.
DELE 2
+OK message 2 deleted
C:
S:
QUIT
+OK POP3 server signing off
C:
S:
<close connection>
<wait for next connection>
25
USER <name>
PASS <password>
QUIT
STAT
LIST [msg]
RETR msg
Returns the full text of the specified message, and marks that message as read.
DELE msg
NOOP
RSET
QUIT
N E W
&
U S E D
By Bill Todd
Database Workbench
Everything You Need to Develop Complex Databases
MySQL. It gives you a single tool for creating, dropping, and modifying databases, tables, indices, constraints, stored procedures, triggers, domains, generators, exceptions, external functions, roles, users,
and every other object supported by the database
server youre using. And thats just the beginning.
Database Workbench has a very intuitive user interface.
The first thing I did after installing it was read the Getting Started section of the online help. After that I was
able to create an InterBase database, create domains,
tables, primary key constraints, foreign key constraints,
check constraints, generators, stored procedures, and triggers without using the help system again. When I did use
the online help, I found it clear, concise, and complete.
26
Note that the edit box for the domain name in Figure 2
already contains the characters D_. This is an example
of a name template. Name templates are predefined for
every database object. Select File | Preferences | Name templates from the menu to edit the templates to match your
naming conventions. You can also use macros in the
name templates to represent the table name, field name,
or referenced table name.
New
&
Used
Database Workbench
Figure 3 shows the Table Editor that you use to create and
modify tables. The Column Type field is a drop-down list.
You can choose the data type by dropping down the list,
or by tapping the first letter of the type to cycle through
the choices that begin with that letter. I did find this a
bit inconvenient because, if you use the default name
template for domains in InterBase, all of the domain
names start with the letter D. This means you may need
to press D many times to get to the domain you want. I
think that Quicken-style auto-fill would be a better choice
here. On the other hand, I really like the fact that I can
enter all the information for a column, and then add the
next column using the keyboard; I never have to stop and
reach for the mouse.
Another great feature of the Table Editor is the Field Specials dialog box. Just click the Field Specials toolbar button, or press CF, and a dialog box opens that lets you
create an ascending index, a descending index, an autoincrement trigger and generator, and upper-case triggers
for the current field. Being able to create all these objects
by just clicking some checkboxes saves a lot of time when
youre creating new tables.
Figure 4 shows the Procedure Editor in the process of creating a new stored procedure. Note that the procedure was
created with a comment block at the top. You can change
the templates for stored procedures and triggers to customize the comment block to fit your documentation standards.
You can also store all the templates used by Database
Workbench on a file server, so everyone on your development team will be using the same standards. The procedure
and trigger editors and the SQL Editor support code templates that work just like code templates in the Delphi IDE.
Just type the code letters for the template you want, then
press CJ to enter the code into the editor. You can also
type CJ without entering the code for a template to display the pop-up list of templates shown in Figure 4.
Some developers like to control access to database
tables by performing all SELECTs, UPDATEs, INSERTs,
and DELETEs through stored procedures. If you use this
model, youll save a lot of time by letting Database Workbench create the procedures for you automatically in your
InterBase and Firebird databases.
27
New
&
Used
Database Workbench
Figure 5 shows the Test Data Generator with the node for
a child table in a foreign key relationship expanded and a
VARCHAR field selected. In the Table Settings section on the
right you set the number of rows you want to generate, as
well as how often to commit and start a new transaction.
You can also choose to have the table emptied before generating the test data, and opt to have indices and/or triggers disabled while the test data is being inserted.
The real power of the Test Data Generator is in the Field
Settings section at the lower right. The Fill with drop-down
list lets you choose from Nothing, Fixed Value, Random Values,
Custom Values, Referential Link, and Values From List. In Figure 5,
Random Values is selected. If the column allows nulls, you
can choose the percentage of rows that will be set to null.
The radio buttons let you choose 11 different kinds of random data, including:
Random values within a length range
URLs
E-mail addresses
Phone numbers
Street addresses
First names
Last names
Full names
Cities
Countries
Mask values
The Mask Values option lets you define a mask containing
fixed text, random numbers of a specified length, and
random text of a specified length. If none of the random
values meet your needs, choose Value From List and enter a
list of values. The records will be created with a random
selection of values from your list. Custom Values is similar
to Values From List except that you specify a text file that
contains the values to be used. Perhaps the best feature
of the Test Data Generator is the Referential Link option.
This lets you fill a foreign key field with a random selection of values from the primary key of the parent table.
Just make sure you generate the parent tables data first
by moving it ahead of the child table in the tree view.
Do you need to get data out of an existing database? No
problem. Just choose Tools | Export Table or View, or Tools |
28
Upscene Productions
E-Mail: [email protected]
Web Site: www.upscene.com
Price: Database Workbench with all modules, US$544;
Database Workbench base module, US$74; InterBase
module, US$150; Firebird module, US$75; MySQL module, US$62; Microsoft SQL Server module, US$275.
Export Multiple Tables or Views.
N E W
&
U S E D
By Bill Todd
Pervasive.SQL v8
The Features You Need in an Easy-to-Deploy Package
database server? Are you looking for a zero administration database for small to medium applications,
or to embed in a vertical market product?
BDAC SQL
BDE
TPvSession
TPvSqlSession
TSession
TPvDatabase
TPvSqlDatabase
TDatabase
TPvTable
TTable
TPvQuery
TQuery
TPvStoredProc
TStoredProc
TPvUpdateSql
TUpdateSql
TPvBatchMove
Figure 1: Pervasive Direct Access Components (PDAC).
TBatchMove
New
&
Used
Pervasive.SQL v8
New
&
Used
Pervasive.SQL v8
New
&
Used
Pervasive.SQL v8
32
N E W
&
U S E D
ExpressBars Suite 5
For Building Modern, Responsive User Interfaces
33
New
&
Used
ExpressBars Suite 5
Component
Purpose
TdxBarManager
Most of the various bars (including floating menu bars) are created and controlled
by this component. It provides access to
individual bars and their properties through
the Object Inspector and allows you to set
properties that affect all bars. It also manages the items associated with toolbars.
TdxBarPopupMenu
TdxBarDBNavigator
TdxBarLookupCombo
TdxBarConverter
TdxStatusBar
TdxDockPanel
Special dock panel contains various controls. These panels dont reside directly on
forms, but may reside on a dock site or a
layout site. Otherwise, an underlying float
site is automatically created for them.
TdxDockSite
TdxDockingManager
TdxSideBar
TdxSideBarPopupMenu
Figure 2: The ExpressBars Mega Demo shows various toolbars and a status bar
with bitmap backgrounds.
Figure 3: Another view of the Mega Demo shows an Internet Explorer-like interface.
New
&
Used
ExpressBars Suite 5
35
The painting of the dock panels can be set using four predefined View Styles: vsStandard, emulating the Delphi IDE;
vsNET, emulating Microsoft Visual Studio .NETs IDE; vsOffice11, emulating Microsoft Office 11; or vsXP, using the
Microsoft Windows XP painting style (if that operating system is current). Theres also strong support for persistence;
the docking manager enables you to allow users to save the
current layout to a text file, stream, or the registry.
Documentation, Demos, and Support
The documentation that accompanies this library is excellent. The complex architecture is explained in a clear
manner. Much of the Help file is task-oriented, showing
how to accomplish common tasks. As with other libraries
from this company, the demos were excellent, covering all
the main components and their features. However, I did
miss the type of tutorials that I found so helpful in the
ExpressQuantumGrid library. Their addition would help
developers get up to speed more quickly. More specific
examples of working with docking panels through code
would also be welcome. But dont worry! If you get stuck,
the technical staff at Developer Express will get back to
you quickly with the help you need. Their e-mail support
and special forum are excellent.
Conclusion
This is a wonderful library for building modern and
responsive user interfaces. In fact, I wont build another
one without it. Keep in mind that Ive been able to
describe only the main features; be sure to visit the
Developer Express Web site for additional information
and demonstration applications.
T E X T F I L E
body of the material, there are numerous handy tables (C# keywords, .NET
types, etc.). In fact, one of my minor
complaints about the book is the lack of
a separate Table of Tables listing in the
front of the book.
Another recurring feature of the
book that is especially helpful are
the Shop Talk sections that provide
specific information on various topics, such as Understanding Interfaces and Installing New Components, just to name a couple.
Each chapter begins with an Overview
and ends with an In Brief section,
which reinforces the basic concepts
learned in that chapter. It is chock full of
tips that make it obvious that the author
spent a lot of time using the product.
For those anxious to get their hands
on any material whatsoever regarding Delphi 8.0 for the Microsoft .NET
Framework, much of the material in
this book will be interesting, helpful,
and applicable. After all, Delphi 8.0
for the Microsoft .NET Framework and
C#Builder share the same IDE, and of
course all the information in this book
about Microsofts .NET Framework
itself applies equally to both tools.
One thing I found a bit odd was the reference to the BCL (Base Class Library).
This is a result, apparently, of the book
being written at a time when what is
now called the FCL (Framework Class
Library) was known by a beta name
(Microsoft is constantly changing the
names of its various technologies).
Kick Start will benefit any .NET developer; it will also help any C# developer
(not just C#Builder developers), although
F I L E
N E W
Extreme Sites
File
New
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 [email protected].