Blaise Pascal Magazine 57: Livebindings in Delphi & C++ Builder VCL Applications

Download as pdf or txt
Download as pdf or txt
You are on page 1of 40

D E L P H I, L A Z A R U S, O X Y G E N E, S M A R T M O B I L E,

A N D P A S C AL R E L A T E D L A N G U A G E S
A N D R O I D, I O S, M A C, W I N D O W S & L I N U X

BLAISE PASCAL MAGAZINE 57

LIVEBINDINGS IN DELPHI & C++ BUILDER


VCL APPLICATIONS
STEPHEN TELLS AS MUCH AS POSSIBLE ABOUT THE SUBJECTS
BY STEPHEN BALL
NEW VERSION OF FASTREPORT 6
BY DEN ZUBOV
THE NEW VERSION WILL BE READY FOR THE FUTURE.
THE BASICS OF FUNCTION PLOTTING
BY DAVID DIRKSE
VERY HANDY TOOL TO CREATE
DATABASE WORKBENCH 5.2
THE NEWEST UPDATED VERSION
BY DETLEF OVERBEEK
WORK WITH CODE METRICS YOU SHOULD KNOW
MAXBOX 43
THINGS ABOUT CODE YOU PROBABLY NEVER KNEW
BY MAX KLEINER

PRINTED ISSUE PRICE € 15,00


DOWNLOAD ISSUE PRICE € 5,00
BLAISE PASCAL MAGAZINE 57
D E L P H I, L A Z A R U S, S M A R T M O B I L E S T U D I O,
A N D P A S C A L R E L A T E D L A N G U A G E S
F O R A N D R O I D, I O S, M A C, W I N D O W S & L I N U X

CONTENTS
ARTICLES:
LIVEBINDINGS IN DELPHI & C++ BUILDER PAGE 5
VCL APPLICATIONS
STEPHEN TELLS AS MUCH AS POSSIBLE ABOUT THE SUBJECTS
BY STEPHEN BALL
NEW VERSION OF FASTREPORT 6 PAGE 11
BY DEN ZUBOV
THE NEW VERSION WILL BE READY FOR THE FUTURE.
THE BASICS OF FUNCTION PLOTTING PAGE 17
BY DAVID DIRKSE
VERY HANDY TOOL TO CREATE
DATABASE WORKBENCH 5.2.2.130
THE NEWEST UPDATED VERSION PAGE 23
BY DETLEF OVERBEEK
WORK WITH CODE METRICS YOU SHOULD KNOW
MAXBOX 43 PAGE 30
THINGS ABOUT CODE YOU PROBABLY NEVER KNEW
BY MAX KLEINER

What is this?

ADVERTISERS
Barnsten page 4
Christmas offer page 16
Components4Developers page 40
Free Pascal and Lazarus Foundation page 22
Mitov Software page 29
Nexus page 39
Visuino page 15
Publisher: Foundation for Supporting the Pascal Programming Language
in collaboration with the Dutch Pascal User Group (Pascal Gebruikers Groep)
© Stichting Ondersteuning Programmeertaal Pascal

2 Issue Nr 9 2016 BLAISE PASCAL MAGAZINE


Stephen Ball Peter Bijlsma -Editor Dmitry Boyarintsev
http://delphiaball.co.uk peter @ blaisepascal.eu dmitry.living @ gmail.com
@DelphiABall

Michaël Van Canneyt, Marco Cantù David Dirkse


michael @ freepascal.org www.marcocantu.com www.davdata.nl
marco.cantu @ gmail.com E-mail: David @ davdata.nl

Benno Evers Bruno Fierens Primož Gabrijelčič


b.evers www.tmssoftware.com www.primoz @ gabrijelcic.org
@ everscustomtechnology.nl bruno.fierens @ tmssoftware.com

Fikret Hasovic Cary Jensen Peter Johnson


fhasovic @ yahoo.com www.jensendatasystems.com http://delphidabbler.com
http://caryjensen.blogspot.nl [email protected]

Max Kleiner
www.softwareschule.ch
max @ kleiner.com

John Kuiper Wagner R. Landgraf KimMadsen


Kim Madsen
john_kuiper @ kpnmail.nl wagner @ tmssoftware.com www.component4developers
kbm @ components4developers.com

Andrea Magni Boian Mitov Jeremy North


www.andreamagni.eu mitov @ mitov.com
andrea.magni @ gmail.com
jeremy.north @ gmail.com
www.andreamagni.eu/wp
Detlef Overbeek - Editor in Chief Howard Page Clark Heiko Rompel
www.blaisepascal.eu hdpc @ talktalk.net [email protected]
editor @ blaisepascal.eu

Wim Van Ingen Schenau -Editor Peter van der Sman Rik Smit
wisone @ xs4all.nl sman @ prisman.nl rik @ blaisepascal.eu
www.romplesoft.de

Bob Swart B.J. Rao Daniele Teti


www.eBob42.com [email protected] www.danieleteti.it
Bob @ eBob42.com d.teti @ bittime.it

Anton Vogelaar Siegfried Zuhr


ajv @ vogelaar-electronics.com siegfried @ zuhr.nl

Editor - in - chief
Detlef D. Overbeek, Netherlands Tel.: +31 (0)30 890.66.44 / Mobile: +31 (0)6 21.23.62.68
News and Press Releases email only to [email protected]

Editors
Peter Bijlsma, W. (Wim) van Ingen Schenau, Rik Smit,
Correctors
Howard Page-Clark, James D. Duff
Trademarks
All trademarks used are acknowledged as the property of their respective owners.
Caveat Whilst we endeavour to ensure that what is published in the magazine is correct, we cannot accept responsibility for any errors or omissions.
If you notice something which may be incorrect, please contact the Editor and we will publish a correction where relevant.
Subscriptions ( 2013 prices )
1: Printed version: subscription € 80.-- Incl. VAT 6 % (including code, programs and printed magazine,
10 issues per year excluding postage).
2: Electronic - non printed subscription € 50.-- Incl. VAT 21% (including code, programs and download magazine)

Subscriptions can be taken out online at www.blaisepascal.eu or by written order, or by sending an email to [email protected]
Subscriptions can start at any date. All issues published in the calendar year of the subscription will be sent as well.
Subscriptions run 365 days. Subscriptions will not be prolonged without notice. Receipt of payment will be sent by email.
Subscriptions can be paid by sending the payment to:
ABN AMRO Bank Account no. 44 19 60 863 or by credit card: Paypal
Name: Pro Pascal Foundation-Foundation for Supporting the Pascal Programming Language (Stichting Ondersteuning Programeertaal Pascal)
IBAN: NL82 ABNA 0441960863 BIC ABNANL2A VAT no.: 81 42 54 147 (Stichting Programmeertaal Pascal)
Subscription department Edelstenenbaan 21 / 3402 XA IJsselstein, The Netherlands / Tel.: + 31 (0) 30 890.66.44 / Mobile: + 31 (0) 6 21.23.62.68
[email protected]

Copyright notice
All material published in Blaise Pascal is copyright © SOPP Stichting Ondersteuning Programeertaal Pascal unless otherwise noted and may
not be copied, distributed or republished without written permission. Authors agree that code associated with their articles will be made
available to subscribers after publication by placing it on the website of the PGG for download, and that articles and code will be placed on
distributable data storage media. Use of program listings by subscribers for research and study purposes is allowed, but not for commercial
purposes. Commercial use of program listings and code is prohibited without the written permission of the author.

Issue Nr 9 2016 BLAISE PASCAL MAGAZINE 3


ü Amnesty
ü 10% discount Professional
ü 15% discount Enterprise
+ 15 month support
ü 20% discount Architect +
Free perpetual RAD Server
site license

Make contact with Barnsten


for an offer you can’t refuse!
Promotions are valid until
21 december 2016

Landing page: https://www.barnsten.com/default/promotions

4 Issue Nr 9 2016 BLAISE PASCAL MAGAZINE


LIVEBINDINGS IN DELPHI & C++ BUILDER PAGE 1 / 6
VCL APPLICATIONS BY STEPHEN BALL
starter expert
Delphi, VCL, FMX The DataSource.DataSet property is set to
While LiveBlindings is at the core of fast FireMonkey
the ClientDataSet and the DataSource is
prototyping, the VCL still has a rich heritage of used to link 3 data aware controls (2 x
TDataSource components that enable prototyping the TDBEdit and 1 x TDBImage ) to the data.
traditional way using TDBGrid, TDBEdit, TDBLabel etc. So
The start point for this application is a
is LiveBindings useful or needed in VCL?
traditional VCL application with a TDataSource
Beyond TDBxxxx the VCL also has a rich set of inbuilt and TDataSet, (I’m using a TClientDataSet
and 3rd party controls (e.g. TListView) that are not data and biolife sample XML data as I can quickly load
aware in the traditional approach. LiveBindings is
however a doorway to using these controls alongside the
this in from the samples folder).
traditional data aware controls.

LiveBindings is a powerful way to add in new functionality


to existing applications or mix in functionality that you
wouldn’t have thought possible in the traditional VCL
model as we are about to see. At this point, rather than using a TDBGrid to
Making VCL TListView data aware! create a master list on the left to navigate the
data, I will show how we can use a TListView a
BACKGROUND
non data aware control to Group the data in a
When programming, something most list.
applications have is a user interface.
A key duty of the user interface is to show the Firstly, we need the data in order in the
values and data inside the application and allow DataSet so they group correctly. This is done
interaction with it. with the ClientDataSet by setting the
Delphi and C++ Builder excelled from the
IndexFieldNames property. In this example it
beginning with TDataSet and TDataSource is set to “Category;Common_Name” to order the
enabling developers to rapidly prototype data by Category and name.
database applications, linking data to controls via
a couple of properties and making them fully Now it’s time to add a TListView component and
data aware and interact-able. This was, and still is set the following properties to show the data in
awesome. This approach however has some groups and columns
drawbacks.
● You always need data aware versions GroupView = True
of your controls ViewStyle = vsReport
● It only works with TDataSet descendants
(i.e. not with TObject) And add some columns, I added Common
Name and Length CM, but you can put anything
MAKING VCL TLISTVIEW DATA AWARE
Taking the example of a database aware VCL as the titles. (we are going to use Category as the
application we are going to add TListView as an group so no need to have a column for that), see
alternative source for the data. Figure 2 at the next page

Figure1: The datafield to be connected

Issue Nr 9 2016 BLAISE PASCAL MAGAZINE 5


LIVEBINDINGS IN DELPHI & C++ BUILDER PAGE 2 / 6
VCL APPLICATIONS

Figure 2 Editing the list columns


Finally, it’s time to get the data added.
Traditionally with data aware controls we would
use would run via a TDataSource, but we will
use LiveBindings. Right click on the TForm and
Next, we can add the fields to the ListView
choose Bind Visually (or choose View > LiveBindings
properties.
Designer )
Item.Caption = Common_Name
You will now see components on the form Item.SubItems[0] = Length (cm)
represented in the LiveBindings Designer . ItemHeader.Header = Category
Select “Synch ” on the ListView by clicking and
holding the mouse button down, and move the You should now see the data as in the image
mouse over the * on the DataSet. This will above, and at run time, selecting the items in
create a binding that keeps the record cursor the ListView will automatically update the
inline with the data on the screen. cursor in the DataSet.

6 Issue Nr 9 2016 BLAISE PASCAL MAGAZINE


LIVEBINDINGS IN DELPHI & C++ BUILDER PAGE 3/ 6
VCL APPLICATIONS
PROTOTYPE BIND SOURCE
Now we are going to move away from the
DataSet and use Objects.
Working with Objects in Delphi is great, but
building UI’s to interact with them has always
been a bit time consuming. With LiveBindings,
you can easily treat objects like they are data
with a little bit of work. Now I will look into
how the basics work, before moving on from
there.
TDataSets are great at enabling VCL
application developers to see how the UI is going
to look as it’s built, but how do you achieve that
with objects that are only created at run time?
The answer is to use the powerful ProtoType
Bind Source component!

1. Firstly, the ProtoType Bind Source allows


you to do something you have never been
able to do with objects – See how data
from them will look on the screen as your
prototype of your application.
2. Secondly, the ProtoType Bind Source enables
direct connection of objects to the UI
without any code!
So how do we use this magic?

ADDING FIELDS TO THE


PROTOTYPEBINDSOURCE
First add a ProtoType BindSource to the
application. It behaves a little like a dataset in
setup and behaviour, so first we need to add
in some fields. This is done double clicking on
the ProtoTypeBindSource (or right click and
FieldsEditor).
This displays the current fields in the prototype
bind source .
There should be none listed at the moment,
so go ahead and choose Add icon. (top left).
Rather than being presented with a screen that
asks you to define the size and type of the data
you will be presented with a list of pre-
installed Generators and the chance to specify
a field name. See right column middle.

The Generators are sample data (many of which My favourite (from a business point) are the
are paired together to give values that make sense ContactXXXXX generators as these provide great
when seen together) e.g BitmapNames sample data for title, names and photos (with male
(ftString) has values Bitmap28, Bitmap40 etc and female names linked to gender relevant photos).
and the Bitmap (tfBitmap) has values that
show images with 24 and 40 in the middle. Once you have selected the Generator you want,
Further down you will also find Generators that enter a field name that will match the field you
have no data and just provide a fields type. want to use on your object. – Don’t worry if you
forget, you can always select the FieldDef later and
change the Name in the Object Inspector .

Issue Nr 8 2016 BLAISE PASCAL MAGAZINE 7


LIVEBINDINGS IN DELPHI & C++ BUILDER PAGE 4 / 6
VCL APPLICATIONS

Figure 4: Once you have sample data,


you are now ready to build a UI.
CREATING A PROTOTYPE UI WITH The most common thing to do here is either link
PROTOTYPEBINDSOURCE one object, or a list of objects into the
It is now time to add standard (non DB aware) ProtoTypeBindSource to display on screen.
controls onto the form and use the LiveBindings to The list uses TListBindSourceAdapter –
link the prototype fields to the controls. e.g. when linking to a list of TFoo objects
In the same way controls were linked to
ABindSourceAdapter :=
the UI using the DataSet in the first blog TListBindSourceAdapter<TFoo>.Create(Self, FooList, True);
post on Visual Live Bindings with VCL and
TDataSet, right click on the form and The single instance uses
choose Bind Visually and then draw links between TObjectBindSourceAdapter with a pointer to
the controls and the ProtoTypeBindSource the single object.
fields.
ABindSourceAdapter :=
I suggest using a TListView and TEdit for a TObjectBindSourceAdapter<TFoo>.Create(Self, Foo, True);
sample to see how Values can be changed
easily. The last parameter defines if the Adapter or you
You can also right click on the will be managing the memory to the object
ProtoTypeBindSource and choose “Add passed in. If you are managing the list else
Navigator” if you want to link navigation where, then set that false.
quickly using a BindSourceNavigator.
You can run the application to see and work USING PROTOTYPEBINDSOURCE WITH
with prototype data now. GLOBAL LIST.
Because the ProtoTypeBindSource is created with
the form, the event to create the
BindSourceAdapter fires as the form is created,
CONVERTING PROTOTYPE TO LIVE
before the Form.OnCreate event fires.
So, now prototype data is showing, how to
convert it to live data?
If you are using the Prototype BindSource with a
The ProtoTypeBindSource has a single event on it
global list then you are likely to have to override
OnCreateAdapter(Sender: TObject; the form constructor and add in the pointer to
var ABindSourceAdapter: TBindSourceAdapter);
the object / object list before inherited create is
called. e.g.
This event has a variable ABindSourceAdapter
that is used to pass back in the link between your
object or object list and the PrototypeBindSource .

8 Issue Nr 8 2016 BLAISE PASCAL MAGAZINE


LIVEBINDINGS IN DELPHI & C++ BUILDER PAGE 5 / 6
VCL APPLICATIONS
constructor TForm1.Create(AOwner: TComponent); procedure TForm1.Button1Click(Sender: TObject);
var Foo: Tfoo; var Stream: TMemoryStream; Surf: TBitmapSurface;
begin aFile : string;
FooList := TObjectList<TFoo>.Create(true); begin
Foo := TFoo.Create; ImageViewer1.Bitmap := TabControl1.MakeScreenshot;
Foo.Name := 'Stephen';
Foo.Value := 100; // Comparison save file as BMP
FooList.Add(Foo); aFile := 'c:\test\myImage';
ImageViewer1.Bitmap.SaveToFile(aFile+'.bmp');
Foo := TFoo.Create; Stream := TMemoryStream.Create;
Foo.Name := 'James'; try
Foo.Value := 200; Stream.Position := 0;
FooList.Add(Foo); Surf := TBitmapSurface.Create;
inherited; try
end; Surf.Assign(ImageViewer1.Bitmap);
// use the codec to save Surface to stream
If you do need to use the FormCreate, then if not TBitmapCodecManager.SaveToStream(
Stream,
you can always set the ProtoTypeBindsource Surf,
active = false and then active = true , but '.png') then
you will need to ensure it is false at design time raise EBitmapSavingFailed.Create(
or it will already create the adapter internally. 'Error saving Bitmap to png');
finally
BITMAP TO PNG/JPEG/JPG IN DELPHI / Surf.Free;
C++BUILDER end;
In FireMonkey, Bitmap is the common currency // do something with the png stream image
for working with images. If you want to send an Stream.Position := 0;
ImageViewer2.Bitmap.LoadFromStream(Stream);
image via Stream using LiveBindings or want to
save an Image to disk or into a database on a // comparison output as PNG from the stream
device with limited storage however, they are Stream.Position := 0;
quite large. Stream.SaveToFile(aFile+'.png');
Thankfully FireMonkey has a really easy to use finally
Stream.Free;
CodecManager that allows you to SaveToFile or end;
SaveToStream and convert to PNG or JPG end;
across all platforms (which are vastly smaller in
size).
SaveToFile Now, you can obviously save as a ‘PNG’ from
Creating a PNG, JPG/JPEG is as simple as the bitmap, but the above code shows how to
calling the Bitmap.SaveToFile with the correct avoid saving a file to disk unless you really need
file extension. This works really well with even to.
more extensions supported.
Personally I would use PNG as the JPG In LiveBindings in a VCL application, I looked at
formats are around the same size on some test using the Prototype bind source for the first time
I’ve run, but produce a better quality of image, and how it can be used to link objects to screens.
especially when grabbing screenshots.
SaveToStream and TBitmapCodecManager But what if you need to work this out
dynamically?
Bitmap.SaveToStream doesn’t expose the
Dynamically linking to objects is possible if you
CodexManager in the same way as it is available
create the LiveBindings at run time .
automatically with the SaveToFile option so
takes a little more work to get a compressed
image into the memory stream.
This is done using the
TBitmapCodecManager class. A simple screen
test has gone from over 1mb as a bitmap to
around 6kb when saved to PNG using this
approach.
The following code is an example using two
image viewers (and a few save to files to help
demonstrate the difference in file size). The key part
is the TBitmapSurface and
TBitmapCodecManager.

Issue Nr 8 2016 BLAISE PASCAL MAGAZINE 9


LIVEBINDINGS IN DELPHI & C++ BUILDER PAGE 6 / 6
VCL APPLICATIONS
While live bindings are easy to build at design
time, sometimes it’s nice to see them in code.
Building them manually is a case of linking the
values together using the same objects created at
design time.

LINKING TO LIST
WITH TLINKLISTCONTROLTOFIELD;
The LinkListControlToField allows you to
link a specific field into a List. The example in the
video looks at using the TListView showing the
list of TFoo objects in the list represented by their
for Job Hunters
Name property.
ListLink :=TLinkListControlToField.Create(Self);
and Employers
ListLink.DataSource := PrototypeBindSource1; https://www.delphijobsboard.com
ListLink.FieldName := 'Name';
ListLink.Control := ListView1;

LINKING TO CONTROL
WITH TLINKCONTROLTOFIELD;
The TLinkControlToField allows you to link a
specific property to a control. It also
automatically helps control data input for
controls (e.g. it makes TEdit only accept Integers for
Integer fields).
LinkControl := TLinkControlToField.Create(Self);
LinkControl.DataSource := PrototypeBindSource1;
LinkControl.FieldName := 'Value';
LinkControl.Control := Edit1;
LinkControl.Track := True;

The Track option means that notifications are


sent more frequently. Imaging a run-time
example using a TCheckBox that is bound to a
field in a database table:
● If Track is set for the checkbox, then the change
occurs immediately when you click the checkbox.
● If Track is not set, the change does not occur
until the checkbox control loses focus.

Finally…
About the author: Stephen Ball has lead
If you do you LiveBindings at runtime, then you development teams for over 15 within the UK,
may need to create tell the DataSource to refresh. Europe and beyond working with a range of
This is easily done by setting setting the blue chip companies including Hilton, American
PrototTypeBindSource.Active property to Express, Fitness First, Virgin Active;
False and back to True.
Stephen is a Chartered IT Professional and is
If you are interested there are also a number the Product Manager for the award winning
of videos available: InterBase and also a Product Evangelist for
https://delphiaball.co.uk/ RAD Studio, regularly speaking across EMEA.
LiveBinding to DataSets
LiveBinding to Objects
Creating LiveBindings via Code
Master Detail relationships (and objects as properties)
Advanced Master Detail Relationships
Mashing up Master Detail on different sources
Helpful classes for LiveBindings

10 Issue Nr 9 2016 BLAISE PASCAL MAGAZINE


NEW VERSION OF FASTREPORT 6 PAGE 1/4
BY DEN ZUBOW
At Fast Report we not only follow the course of
technological advances, we keep improving the
reporting functionality of our products. We aim Fast Reports
to stay at the cutting edge of advanced Reporting must be Fast!
reporting software. This article details the
This means that the report object itself
advantages of using the new version of
manages moving, resizing, and other
FastReport 6 VCL (soon to be released).
behavior which was previously
implemented in the report designer. The
designer no longer manages report
CHANGES DEEP INSIDE.
objects. It simply tells report objects
Architecture is of fundamental importance in what event fired and what action was
designing a good product (and this is true beyond the raised.
realm of software engineering). Good software
architecture usually means a more extensible This approach allows us to build independent,
application. However, even the greatest software self-determining objects with complex logic (to
architects can't take into account everything that do with internal selection, zooming and so on)
new technologies or new requirements might bring without altering the designer code at all. This
in the future. So sometimes we have to go back deep results in very rich possibilities for extending
inside and change some foundational architecture. report object behavior and functionality.
FastReport 6 VCL has undergone such architectural To understand the advantages of this
changes in its report object. First of all several new approach let's consider a situation in which it's
interfaces were added to the report objects, necessary to develop a new object which needs
interfaces which allow better object management to handle internal mouse movement.
behavior in different situations.
It would not have
been possible to do
this in previous
FastReport versions
without changing a
lot of report designer
code (which means you
would have needed the
report designer
sources).

The picture shows a comparison of the old (left Let’s look more closely at the new report object’s
side) versus the new logic (right side). Under the interactions.
old architecture, when a user made any change The diagram on the next page shows an
in the report designer, all that behavior was "Event sender" which receives a window message
managed by the report designer. And to make a and generates a similar message for the report
new interactive editor or introduce any new object. Both the Designer and Preview windows
object behavior meant that all the required hold a list of individual editors, and pass a
changes inside the report designer had to be reference to that list to the Sender object.
“hard-coded” . This severely limited the In our case the Sender is the window
extensibility of current versions of FastReport. (Designer or Preview) which generates the event.
The right hand side of the diagram shows an The report object receives an event detailing the
improved logic. The new architecture provides
for the report object itself to manage editing
available editors and the type of the Sender.
changes, and the report designer merely calls Based on these sets of passed parameters, the
report object events, displaying the report object can decide which editor to call and
outcome. how to interact with that editor.

Issue Nr 9 2016 BLAISE PASCAL MAGAZINE Fast Reports 11


Reporting must be Fast!
NEW VERSION OF FASTREPORT 6 PAGE 2/4 Fast Reports
Reporting must be Fast!

Having called a particular editor and then This facilitates building complicated container
having subsequently facilitated the user to objects like Tables and Maps (these are newly
change the report object, the report object’s introduced objects in FastReport VCL).
Modify event is triggered and passed back to the
Sender. The Table object also has internal selectors for
This interactive scheme lets us build columns and rows, and all manipulations are
independent objects with customized behavior accomplished using child objects. A table object
which can call an appropriate editor whenever sorts all its children and can't accept, for
needed either in the Preview or in the Designer. example, an instance of another table class as
It is thus possible for a developer to build an column. In other words a table knows what
interactive inline editor for the report Preview, objects it can (or cannot) contain.
and edit objects in the Preview window without
needing the report Designer.

The illustration above shows a Table object with


a selected row. As mentioned before a Table
manages all selections itself without the report
The illustration above shows a classic inline Designer. Table objects has plenty of other
editor which can be used in both preview and features like combining cells by row or column.
design modes without adding anything to A Table draws its text and its frames separately
preview or designer code. In the newest version as one big object, not as a set of memo objects.
all logic has been moved directly to report object This design helps avoid objects overlapping each
interfaces, since report objects now manage their other.
child objects.
A report object can now decide which instance of
what class it will accept; it also sorts its child
objects as well.

12 Fast Reports Issue Nr 8 2016 BLAISE PASCAL MAGAZINE


Reporting must be Fast!
NEW VERSION OF FASTREPORT 6 PAGE 3/4 Fast Reports
Reporting must be Fast!

Both the report Preview and the Designer can


access a Map object which allows for internal
region selection and navigation around the map
by mouse (you can select and move regions, zoom in
or zoom out). Users can interact with a Map and A further interesting feature is the new Metafile
build “Detailed reports”, since a Map holds a list parser. The base class of the report object now has
of layers and each layer has list of shapes (which methods to draw directly based on an enhanced
the user can edit or manipulate). Map and Table metafile (EMF) and the FastReport engine uses
objects handle drag-and-drop events. this for new vector graphic export .
For example using drag-and-drop you can drop In FastReport 6 VCL an export filter can convert
data from a data tree to fill a Table. EMF to native sets of objects.

Issue Nr 9 2016 BLAISE PASCAL MAGAZINE Fast Reports 13


Reporting must be Fast!
NEW VERSION OF FASTREPORT 6 PAGE 4/4 Fast Reports
Reporting must be Fast!

This approach lets you save any FastReport data


to different places. Moreover, a single filter class
works for everything, starting from a report
template and ending with the exported file.
That does not exhaust all the new features of
the upcoming FastReport version. You can
expect to see further interesting improvements,
but for this article that is all I wanted to share.

Fast Reports
Reporting must be Fast!
https://www.fast-report.com/nl/

The design of the new export engine is shown


above. The export filter calls to an object and
receives its metafile. The engine passes that EMF
to a metafile parser, parsing each command in
that EMF. Depends on the export filter in use the
engine converts that set of commands to a native
format. For PDF it will be sets of PDF graphics
commands. So exported RichView documents
have formatted text, and exported charts have Den Zubov
appropriate vector graphics.

Another interesting architectural change is the


introduction of a new layer between file
operations and the report engine. We call it
save filters (not to be confused with export filters).
When we need to save something to disk (be it a
report or an exported file), the FastReport engine via
“save filters” calls a basic filter interface
requesting that filter for a stream to save the data
to a disk file. Michael Phillipenko

Alexander Tzyganeko

The filter can be a simple File filter which just


creates a file on a disk (as in previous FastReport
versions which created files directly) or it can be a
filter which sends the file by e-mail (or to the cloud). Fastreport Lazarus

14 Fast Reports Issue Nr 8 2016 BLAISE PASCAL MAGAZINE


Reporting must be Fast!
15 Issue Nr 8 2016 BLAISE PASCAL MAGAZINE
CHRISTMAS OFFER:
GET THE BOOK INCLUDING
THE NEWEST LIBRARY STICK
R K S E
D DI es.htm
l INCLUDING 1YEAR DOWNLOAD

DAVI
_Gam
DAVID DIRKSE COMPUTER MATH & GAMES IN PASCAL

/Com
p uterM
ath
FOR 75 EUROS + SHIPPING
irkse
u/DavidD
at cal.e
ales
pres laisepas
.b
INCLUDING:
www
• 53 projects and code fully explained.
HOWARD PAGE-CLARK

The Delphi 3 – Delphi Berlin source code


is available together with full explanation.
Most of the projects can be done with
FPC and or Lazarus as well.
• For a preview go to:
http://www.blaisepascal.eu/david_dirkse/
UK_Book_Department_DavData.html
• PDF file - excellent readable on your
dure
; tablet. Printable.
proce
var 9 do
begin := 1 to
for i
begin

end;
end;
L I B R A R Y 2 0 1 6

TH & 3 4
1 2 5
MA
UTER PASCAL
6 10 12
7 8 9 11
M P 13 18 19
CO S IN 14 15 16 17 27
ME 20 25 26
GA 28
21
22 23 24
34
35 36 37
29 30 31+ 33
32
32 40 41 42
38 39 45+ 43
POCKET EDITION 46 47 48 49
44
Also printed in full color. 50 53
51 52 54+
A fully indexed PDF file is included. 55
Resize, rotate, compress digital images.
Design your own font, generate and reduce
Truth Tables from Boolean algebra.
And more important: understand how it all
works!
The book contains 87 chapters, 53 projects
with source code and compiled programs
(exe). The book is highly educational and
suitable for beginners as well as for WINDOWS 10

professionals. P lay board games, solve


puzzles, operate a vintage mechanical BLAISE PASCAL MAGAZINE
AUTHORS ALFABETICAL ALL ISSUES IN ONE FILE
calculator, Produce 3-dimensional computer
art, generate lists of prime numbers, explore PUBLISHER: PRO PASCAL FOUNDATION
and draw any mathematical function.
Solve systems of equations, calculate the
area of complex polygons. THE FAMOUS LIBRARY STICK
Draw lines, circles and ellipses. Newest technique USB 3 / 16 GB
For the games, winning strategies are you receive the library of the magazine updated
explained. For puzzles the search algorithm. from issue 1 to issue 55. See details at
For all projects: the math behind is thoroughly http://www.blaisepascal.eu/subscribers/
discussed. UK/UK_CD_DVD_USB_Department.html

COMBINATION: 3 FOR 1
BOOK INCLUDING THE LIBRARY STICK EXCL. SHIPPING
INCLUDING 1YEAR DOWNLOAD FOR FREE
75€
http://www.blaisepascal.eu/david_dirkse/UK_Book_Department_DavData.html
16 Issue Nr 8 2016 BLAISE PASCAL MAGAZINE
SE
DIRK html

DAVID
mes.

DAVID DIRKSE COMPUTER MATH & GAMES IN PASCAL


h_Ga
rMat
pute
/Com
irkse
vidD
les at u/Da
cal.e

THE BASICS OF FUNCTION PLOTTING PAGE 1/ 5


presa epas
.blais
www

HOWARD PAGE-CLARK
BY DAVID DIRKSE proce
var
dure
;

begin := 1 to
for i
9 do

begin

end ;

starter
end;

expert H&
R MAT
PUTE PASCAL
COM
ES IN
Delphi 7 and up to BERLIN GAM

The basics of function plotting


This article presents the basics of math function
plotting and a Delphi implementation.

The functions are known at design time so we do not


need to translate formulas into basic arithmetic
operations taking parenthesis and priorities into
account.

This article focusses on zooming and scrolling.


Also a method is explained to avoid the plotting of
asymptotes.

THE COORDINATE SYSTEM


The purpose of a (2D) coordinate system is to
define the position of points.
For this purpose we use two right-angle lines The width is 800 pixels and 10 pixels spacing at
called the X- and the Y-axis. the left and right side.
The X-axis is generally drawn horizontally, the The height is 640 pixels plus 10 pixels at the top
Y-axis vertically. and at the bottom.
Given a point P in the coordinate system, the The raster lines are spaced 40 pixels apart.
distance to the Y-axis (horizontally) is called X and Y axis are painted in red.
the X coordinate and the vertical distance to the
X-axis is called the Y coordinate. An important pixel is (410,330) which is the
center of the paintbox.
Zooming and scrolling is relative to this point.

The following constants and variables define


the coordinate system
const maxscalecode = 9;
minscalecode = 0;
maxCenter = 1000;
minCenter = -1000;
scalesBase : array[0..2] of single = (1, 2, 5);
scalesExp : array[0..3] of single = (0.01, 0.1, 1, 10);

var centerX : single = 0;


centerY : single = 0;
scaleX : single = 1;
P(3,2) means that point P has distance 3 to the Y- scaleY : single = 1;
axis and distance 2 to then X-axis. scaleCodeX : byte = 6;
scaleCodeY : byte = 6;
The intersection of the X and Y axis has
timercode : byte = 0;
coordinates (0,0). formulaNr : byte = 1;

In general, not knowing a specific context, we


call the independent variable X and the function
scaleX,scaleY is the distance between two
value Y.
horizontal or vertical raster lines,
so the length of 40 pixels.
In this project we use a paintbox to show the
coordinate system.
The default scale is 1.
All drawing is done directly in this paintbox.
Left- or right mouseclicks in a statictext
component alter the scales.
Below is a reduced image of the paintbox.

Issue Nr 8 2016 BLAISE PASCAL MAGAZINE 17


SE
DIRK html

DAVID
mes.

DAVID DIRKSE COMPUTER MATH & GAMES IN PASCAL


h_Ga
rMat
pute
/Com
irkse
vidD
les at u/Da
cal.e
presa epas
.blais
www

HOWARD PAGE-CLARK
THE BASICS OF FUNCTION PLOTTING PAGE 2/ 5 proce
var
dure
;

begin := 1 to
for i
begin
9 do

end ;
end;

H&
R MAT
PUTE PASCAL
COM
ES IN
GAM
Scalecodes are convenient because they may be Say we calculate f(x) for x values
incremented or decremented. 0, 0.5, 1, 1.5....
The scalecode defines the scale: First we position the (canvas) pen
on point(0,f(0)) then we draw a straight line to
scalecode scale (0.5 , f(0.5))
0 0.01 next we draw the line to (1,f(1)) etcetera.
1 0.02
2 0.05 However we deal with pixels, not coordinates.
3 0.1 A translation has to be made between coordinates
4 0.2 and pixels taking the scale and center values into
5 0.5 account.
6 1
Starting with X pixel 10, we calculate the
7 2
coordinate X value.
8 5 This X value is passed to a procedure which
9 10 calculates the function value.

The function value is passed to a function which


centerX, centerY are the coordinates of the
converts this coordinate Y value to a pixel
paintbox center pixel.
position. Then the procedure repeats for
The center values are adjustable as well by
horizontal pixel 11,12.....etc.
mouseclick on the appropriate statictext
Straight lines are drawn from one pixel to the
components.
next.
CenterX, centerY are adjusted to be a multiple of
the X,Y scales.
This function converts a horizontal pixel value to
the coordinate value
Next procedure converts the scalecode to the
proper scale value
function pix2X(px : smallInt) : single;
//pixel value px to x value
procedure scalecode2scales;
begin
// scaleCode = scaleBaseIndex + 3*scalesExpIndex result := centerX+0.025*(px-410)*scaleX;
var i,j: byte; end;
begin
i := scalecodeX mod 3;
j := scalecodeX div 3;
scaleX := scalesBase[i] * scalesExp[j];
centerX := round(centerX/scaleX) * scaleX; //make center multiple of scale
i := scaleCodeY mod 3;
j := scaleCodeY div 3; The following function
scaleY := scalesBase[i] * scalesExp[j]; converts a Y coordinate to
centerY := round(centerY/scaleY) * scaleY; //make center multiple of scale its pixel Y position
end;

Changing the scales is called zooming, function getPixelValue(y : single) : smallInt;


changing the center values is scrolling. var pixY : single;
begin
PixY := 330 - 40*(y-centerY)/scaleY;
The general way of function plotting if PixY < 0 then pixY := -1; //avoid integer overflowing
If y = f(x) for every value of x we may calculate if PixY >= 660 then PixY := 660;
y. result := round(PixY);
This results in a set of (x,y) points and when end;
placed in a coordinate system they show
the relationship between x and y: we see a Notice that at first a floating point value (pixY) is
picture of the function. used for the pixel position.
This avoids overflowing of the integer result.
So far, many functions may be plotted but not all

18 Issue Nr 8 2016 BLAISE PASCAL MAGAZINE


SE
DIRK html

DAVID
mes.

DAVID DIRKSE COMPUTER MATH & GAMES IN PASCAL


h_Ga
rMat
pute
/Com
irkse
vidD
les at u/Da
cal.e
presa epas
.blais
www

HOWARD PAGE-CLARK
THE BASICS OF FUNCTION PLOTTING PAGE 3 / 5 proce
var
dure
;

begin := 1 to
for i
begin
9 do

end ;
end;

H&
R MAT
PUTE PASCAL
COM
ES IN
FLOATING POINT EXCEPTIONS This code does the drawing: GAM

Some floating point operations result in errors. ….............


Division by zero and the attempt to take the var px,py : smallInt;
square root out of a negative number x,y : single;
plotcode: byte;
are the main causes of floating point exceptions. valid : boolean;
What to do if this happens during function begin
plotting? with form1.plotbox.canvas do
............
for px := 10 to 809 do
The answer is simple: nothing. begin
We may only draw lines when we obtain valid X := pix2X(px);
floating point values. Y := getValue(x,valid);
Therefore the calculation of the function value if valid then py := getPixelvalue(y);
also returns a (v) flag indicating the validity of plotcode := (plotcode shl 1) and $3;
if valid then plotcode := plotcode or $1;
the result. with form1.plotbox.Canvas do
case plotcode of
At a valid value we may position the pen, at a 1 : MoveTo(px,py);
following valid value we may draw a line. 3 : lineto(px,py);
To control this proces there is a variable plotcode end;//case
end; //for px

ASYMPTOTES
There is one other pitfall.
Imagine the function y = 1/x
This function calculates the value of the selected For x = -0.001 y = -1000.
formula For x = 0.001 y = 1000.
The vertical line x = 0 is called an
function getValue(x : single; var v : boolean) : single;
//calculate function value
asymptote.
var sqx : single; We do not want the drawing of asymptotes
begin as they do not represent valid function
result := 0; values.
try When asymptotes coincide with the
case formulaNr of
1 : result := 0.1*x*x-6; coordinate system raster, the valid flag will
2 : result := sqrt(64-sqr(x)); drop because we generate infinite floating
3 : begin point values.
sqx := x*x; The asymptote will not be drawn in this
result := sqx*(-0.01*sqx +0.5);
case.
end;
4 : result := 1/(x-2.001); The function y = 1/(x-0.01) however has
5 : result := 5/((x-4.001)*(x+3.999)); asymptote x = 0.01 and
end;//case for a horizontal scale of 1 (0.025 per pixel),
v := true; this happens:
except
x=0 ---> y = -100
v := false;
end; x = 0.025 ---> y = 66.67
end; Without extra checks and precautions,
the line from (0, -100) to (0.025, 66.67) is
drawn erroneously.

Issue Nr 8 2016 BLAISE PASCAL MAGAZINE 19


SE
DIRK html

DAVID
mes.

DAVID DIRKSE COMPUTER MATH & GAMES IN PASCAL


h_Ga
rMat
pute
/Com
irkse
vidD
les at u/Da
cal.e
presa epas
.blais
www

HOWARD PAGE-CLARK
THE BASICS OF FUNCTION PLOTTING PAGE 4 / 5 proce
var
dure
;

begin := 1 to
for i
begin
9 do

end ;
end;

H&
R MAT
PUTE PASCAL
COM
ES IN
What to do? GAM

Please look at the function plots below:

Inc. ascent Dec. ascent Inc. descent Dec., descent

We notice functions which ascent increasingly, So here is the trick:


ascent decreasingly, If we calculate the y values for three adjacent
descent increasingly or descent decreasingly. points and the two derivatives have the same
This behaviour is described by the derivatives of sign (both positive or negative) we may draw
the function. the two lines between these points.
Between two successive pixels (x1,y1) and (x2,y2)
the 1st derivative is (y2-y1)/(x2-x1). If the derivatives between points have unequal
signs however, we observe the second
Now consider three successive pixels with values derivative calculated for the three previous
(x1,y1) (x2,y2) and (x3,y3). points.
Because the horizontal pixel distance is the same,
for comparison of the derivatives we may assume If this first and second derivatives have unequal
(x3-x2) = (x2-x1) = 1. signs, the function value is set invalid.
Then the derivatives are (y2-y1) and (y3-y2).
So the derivative is positive for an ascending
function and negative for a descending function.

The so called second derivative is the difference


between derivatives : (y3-y2) - (y2-y1).
For an increasingly ascending function, the first
and second derivatives are both positive.
For a decreasing descending function the first
derivative is negative but the second is positive. Below is the complete plotting method:

No plotting OK No plotting OK

20 Issue Nr 9 2016 BLAISE PASCAL MAGAZINE


SE
DIRK html

DAVID
mes.

DAVID DIRKSE COMPUTER MATH & GAMES IN PASCAL


h_Ga
rMat
pute
/Com
irkse
vidD
les at u/Da
cal.e
presa epas
.blais
www

HOWARD PAGE-CLARK
THE BASICS OF FUNCTION PLOTTING PAGE 5 / 5 proce
var
dure
;

begin := 1 to
for i
begin
9 do

end ;
end;

H&
R MAT
PUTE PASCAL
COM
ES IN
procedure TForm1.plotbtnClick(Sender: TObject); GAM

var x,y,prevY,dY,prevdY,ddY : single;


valid,OK : boolean;
plotcode : byte;
px,py : smallInt;
begin
plotcode := 0;
py := 0;
prevY := 0; prevdY := 0; ddY := 0;
with form1.plotbox.Canvas do
begin
pen.Color := $000000;
pen.Width := 1;
end;
for px := 10 to 809 do
begin
X := pix2X(px);
Y := getValue(x,valid);
if valid then py := getPixelvalue(y);
dy := Y-prevY;
if dY*prevdY >= 0 then OK := true //asymptote suppression
else OK := dy*ddy >= 0;
// OK := true; //OK=true allows
//drawing asymptotes
valid := valid and OK;
plotcode := (plotcode shl 1) and $3;
if valid then plotcode := plotcode or $1;
with form1.plotbox.Canvas do
case plotcode of
1 : MoveTo(px,py);
3 : lineto(px,py);
end;//case
ddY := dY - prevdY;
prevdY := dY;
prevY := Y;
end; //for px
end;

This concludes the description.

Issue Nr 8 2016 BLAISE PASCAL MAGAZINE 21


FREE PASCAL AND
LAZARUS FOUNDATION
http://foundation.freepascal.org
The Free Pascal and Lazarus foundation is a non-profit organisation
dedicated to the promotion and sponsoring of the
open source projects Free Pascal and Lazarus.
Donations are welcome

A NEW HORIZON
FOR LAZARUS
AND FREE PASCAL

Get in touch with us:

Lazarus/Free Pascal forum


Mail us at: [email protected]
Use the contact form
and we'll get back to you !

On the foundation Google+ community, on invitation


https://is.gd/BJG4dY
http://foundation.freepascal.org
DATABASE WORKBENCH 5.2
THE NEWEST UPDATED VERSION PAGE 1/6
BY DETLEF OVERBEEK
Database Workbench 5.2 now has PostgreSQL
support. The Swiss army knife for databases just
got more interesting. We've seen Database
Workbench version 5 before, in issue UK 44.
Recently, version 5.2 was release and it includes
new features and support for yet another database
system. What originally started out as a
development tool solely for InterBase, has become
the tool-of-choice for thousands of developers DATABASE TYPES SUPPORTED
working with different database systems.
Database Workbench is a multi-database design,
The following are fully supported: Oracle, Microsoft
SQL Server, MySQL, Firebird, PostgreSQL, SQL development and testing tool.
Anywhere, InterBase and NexusDB. In addition to Within a single application, you can use the
these, you can connect to ODBC or ADO data different database systems in a consistent and
sources to browse a database structure and query uniform way.
data. This avoids the need to switch between
database vendor applications.
The Register Server Wizard shows something we That is really a nice option since a lot of
had not yet seen before. Here you can add a server concurrent vendors do not deliver the quality of
and make it available to this application. Here are creating a colorful detailed diagram, which
a lot possibilities shown, in practice people use to makes it so much more easy to discus and design
buy the version they need. But you can of course the whole database, and document it in an easy
get all of them...Select the server type and understandable design.
Very important because you can save a lot of time
over discussions on the diagram.
You also can print it and it’s possible to do that
even on A3 (large format) or export it to any Image
format.
I talked to some pro’s and they were very much
surprised and delighted because of the low cost
of this software. The most recent version adds
support for PostgreSQL to its long list of features.
There is of course a fully functional version for trials,
only limited by time.
Figure 1 all yet available databases http://www.upscene.com/downloads/

Figure 2
colorful and
therefor very
self explainng

Issue Nr 9 2016 BLAISE PASCAL MAGAZINE 23


DATABASE WORKBENCH 5.2
THE NEWEST UPDATED VERSION PAGE 2/6

DATABASE DESIGN
The Diagram Editor
supports two types of
diagramming:
conceptual and physical.
With a conceptual diagram ,
you're creating a purely
logical diagram: define domains for entity
attributes, logical entities and their relationships
including cardinality .
Entity attributes have common data types or are
based on a logical domain.
A conceptual diagram can be converted to a If you have existing databases and you want a
physical, database specific, diagram.
visual representation of it, just use the "reverse
Entities will be converted into tables, relationships
engineer" tool. You can move tables to sub-
into foreign key constraints and possible linking
tables.
diagrams for more clarity, modify table colors
The common data types and logical types will be or work with background regions for functional
converted to database specific data types and grouping.
domains, possibly with constraints. And when the database changes during
A physical diagram can be used to create the development, you can update the information in
actual database. the diagram from the modified database.

Figure3:A conceptual diagram

24 Issue Nr 9 2016 BLAISE PASCAL MAGAZINE


DATABASE WORKBENCH 5.2
THE NEWEST UPDATED VERSION PAGE 3/6

CREATING AND EDITING There's no need to remember specific meta data


THE DATABASE SQL statements in specific SQL dialects, as these
Once you have created the statements are created for you automatically.
database or if you have When a database object has more to offer, like
existing databases, no doubt table objects for example, additional tabs will be
you will have to modify or available. In the table editor screen shots you can
extend it. There is a special see tabs for Data, Table Options and table objects
editor window for each kind like Indices & Constraints.
of database object. The editor windows are
consistently designed across the supported SQL AND STORED PROCEDURE
database systems. DEVELOPMENT
Each editor window has the details for the Database Workbench includes a code editor with
object itself, a to-do list (whom I hate for Unicode support, syntax highlighting , code
obvious reasons, they never end...), meta data structure "staples" , collapsible sections, current
statement for the complete object and changes block or subroutine highlighting, SQL Insight,
you've done, and a list of permissions, called parameter insight and optional object hyperlinks.
"grants" in SQL. These visual editor windows It’s almost infinit...
allow us to create objects by using check boxes,
drop down lists and grids.

Figure 4: Table Editors for Firebird and PostgreSQL

25 Issue Nr 9 2016 BLAISE PASCAL MAGAZINE


DATABASE WORKBENCH 5.2
THE NEWEST UPDATED VERSION PAGE 4/6

Figure 5: SQL Insight with Join Completion

SQL Insight with Join Completion


SQL Insight helps when selecting database objects like tables and views, or columns for those objects.
It also helps you to create SQL-JOINs, by using the foreign key constraints and suggesting these as
matches in your SQL statement. SQL Insight is context sensitive when determining possible
suggestions and understands table aliasses when completing column names and joins.
When editing stored procedures or triggers, the code editor displays code structure and highlights
the current block or subroutine.

Figure 6: Package Editor with several routines

26 Issue Nr 9 2016 BLAISE PASCAL MAGAZINE


DATABASE WORKBENCH 5.2
THE NEWEST UPDATED VERSION PAGE 5/6

In the screenshot on the last page 24, Figure nr. 6 MAINTENANCE & ADMINISTRATION
you can see the staples ([)around BEGIN..END Got your application up and running?
blocks, current routine highlighting . Time to maintain it.
for INVOICE_ORDER and current block Modify the structure of
highlighting for the BEGIN..END in which the your database, print your
cursor resides. visual representation or
And code-folding in action can be seen for listing of meta data
function CREATE_INVOICE. objects for documentation
purposes and keep
TESTING AND DEBUGGING track of your changes by
When you're creating using the statement recorder. With Database
your database and your Workbench you can compare the database
application, it's time to structure of one database to another and see
start testing and debugging. what has changed.
Database Workbench There also is a Data Compare tool for those
includes a simple test data cases you need to compare the content of
generator (there's also a stand your database tables.
alone application available named Advanced
Data Generator, which can generate Via user and role management tools you can
complex real life like test data for you ) that create or edit database users.
allows you to generate street names, e-mail The Grant Manager allows you to grant object
addresses, personal and company names. privileges by point and click methodology,
By generating test data, you can fill your or by using grant templates to re-use your
database to test query response times, run your choice in privileges.
stored procedures and test your SQL views. Once again, there's no need to remember
When you use test data during development or specific SQL dialects , this is handled for you .
presentations, there's never the risk of private Depending on your database system, several
information slipping or testing with a-bit-too- monitoring tools are available to check on the
much-rubbish data entered by hand. performance of your server, specific databases
or queries that run for far too long.
Every query is executed according to a query
plan, with the visualized query plan and query
statistics you can see how your database system
is executing your query and adjust your SQL
accordingly.
The program “Database Workbench” includes a
stored procedure debugger for InterBase,
Firebird, Oracle, SQL Anywhere and MySQL.
You can execute your routines line by line to
check the logic in your code,
including viewing and settings variable values
while debugging.

Issue Nr 9 2016 BLAISE PASCAL MAGAZINE 27


DATABASE WORKBENCH 5.2
THE NEWEST UPDATED VERSION PAGE 6/6
CONCLUSION
CROSS-DATABASE TOOLS I MUST SAY HAVING BEEN ABLE TO TEST IT AND USE IT - I WOULD
Database Workbench adds RATHER NOT START DOING ALL THE WORK BY CODING AGAIN.
special cross-database THE AMOUNT OF TIME I DID NOT HAVE WASTED ON EXTRA HOURS IS
VERY VALUABLE.
development tools as well: Database Workbench is licensed in a modular fashion:
DataPump, Data
pay for what you use. Each supported database system is an
Compare, Database Migrator
additional module and you can add modules later on depending on
and the Database Compare
your requirements.
can all work against different It currently comes in two editions: Basic and Pro, a feature matrix is
systems, yet work across available on the website so you can check which edition would be the
these systems as well. best fit for your needs:
The DataPump transfers http://www.upscene.com/database_workbench/editions
data from one database to http://www.upscene.com/downloads/
another, including from one http://www.upscene.com
database system to another.
For the source database, this includes any ADO or
ODBC data source.
With the Data Compare tool you can compare
the contents of tables in one database to another,
including databases across different systems.
The Database Migrator allows you to convert a
database or selection of objects from one
database to another database system and
automatically convert missing data types,
commonly used data default clauses and other
details .
If you need to develop an application for
In coming Issues we will explain in smaller
multiple database systems, you can use the
articles about specific items: the next article
Database Migrator to get a head start.
will be about the Diagram Editor.
Later on, you can use the Database Compare tool
to see where you made changes but forgot to
Detlef
copy those changes in your other database.

Database Tools for Developers


COMPANY FOCUS
The main focus of Upscene Productions is creating software specifically aimed at database
developers. We strive to make their job easier, increase their productivity and enabling them to
develop their applications and responding to changes rapidly.

Being a small company enables us to focus not only on our software, but also on our customers
and listening to their feedback when planning new features or products.
How it all started

Back in the Spring of 2001, Martijn Tonies published the early betas of a tool called "InterBase
Workbench" (later to be known under the name "Database Workbench") under the company
name of "Upscene Productions", a name he used for software tools he developed on the
Commodore 64.

As InterBase Workbench improved and users enjoyed the tool, things got official in May 2002,
the company "Upscene Productions" got registered.

In the years after that, the company established its name, the product line expanded and
potential customers keep finding our website.

Since then, Upscene Productions has proven to be a viable company, ready to support the latest
features in different database systems and enabling software developers to do their jobs as
efficient as possible.

28 Issue Nr 9 2016 BLAISE PASCAL MAGAZINE


WORK WITH CODE METRICS: YOU SHOULD KNOW
PAGE 1 / 9 BY MAX KLEINER maXbox
writeln(CommentLinesWithSlashes('this is a //comment for a moment'))
Function CommentLinesWithSlashes(const S: String): String');
Function UncommentLinesWithSlashes(const S: String): String');

All macros and metrics are marked with yellow.


CODE METRICS One of my favourites as I said is #locs: means
maXbox Starter 43 lines of code metric and you get always the
certainty if something has changed by the
INTRODUCTION numbers of line. So the editor has a
Measure with Metrics programmatic macro system which allows the
Software quality consists of both external and pre compiler to be extended
internal quality. Continuous Inspection is a holistic, by user code I would say user tags. You find
fully-realized process designed to make internal more macros at All Functions List:
code quality an integral part of the software maxbox_functions_all.pdf
development life cycle process. Today we step Some macros produce simple combinations of
through optimize your code with maXbox and some
one liner tags but at least they replace the content
style guide.
You can not improve what you don’t measure by reference in contrary to templates which just
and what you don’t measure, you can not copy a content by value. After the End. of the
prove. code section you can set a macro without
comment signs so you can enlarge your
documentation with version and time
A tool can be great for code quality but also information like:
provides a mechanism for extending your
functions and quality with checks and tests. #tech:perf: 0:0:1.151 threads:
One of a first metric is lines of code which you 4 192.168.56.1 12:06:17 4.2.2.95
can define as a macro in maXbox and many
other tools with #locs. Or you put a macro behind a code-line, so this is
A good style is to set a header in your code file not the end of the line, a second time test is
to document your purpose.
maxcalcF('400000078669 / 2000123')
You can set the macros like #locs: and #host: in //#perf>0:0:1.163
your header or elsewhere in a comment line, but
not two or more on the same line when it and we get as float: 199987.740088485
expands with content: maXbox4 568_U_BigFloatTestscript2.pas
Try: 369_macro_demo.txt Compiled done: 6/18/2015
Generally you can categorize metrics in
following groups:
{***************************************************************
* Project : Metrics Macro Demo Maintainability 29
* App Name : #file:369_macro_demo.txt Readability 25
* Purpose : Demonstrates function macros in header Understandability 4
* Date : 21/09/2010 - 14:56 - #date:01.06.2015 16:38:20 Modularity 3
* #path E:\maxbox\maxbox3\examples\ Changeability 2
* #file 369_macro_demo.txt Data 1
* #perf-50:0:4.484
* History : translate/implement June 2013, #name@max
Logic 1
* : Sys demo for mX3, enhanced macros, #locs:149 Reliability 10
***************************************************************} Architecture 1
Data 1
Exception handling 1
As you may know there's no simple solution to Fault tolerance 1
put a macro because the step of the Instruction 5
Logic 1
preprocessor has to be the first to expand. So a
Testability 1
macro is not part of the source code and the best Unit level 1
way is to set a macro always as a one liner or Uncharacterised 3
somewhere else in comment.
The ratio of code to comment is also a well
known metric which you can predefine with a
few procedures.

30 Issue Nr 9 2016 BLAISE PASCAL MAGAZINE


WORK WITH CODE METRICS: YOU SHOULD KNOW PAGE 2 / 9 maXbox
Let’s go back to our performance metric example
to close, which is one of a non static metric:

29×37×127^(-1)×179×15749^(-1)×2082607
maxcalcF ('29*37*(127^-1)*179*(15749^-1)*2082607');
>> 199987.740088485
maxcalcF ('29*37*(127^-1)*179*(15749^-1)*2082607');
//#tech>perf: 0:0:1.190 threads: 6 192.168.56.1 12:49:55 4.2.2.95
//>>> 199987.740088485

EXTEND WITH TECHNICAL QUALITY 5. Security.


There is an ISO definition of software quality, Degree of protection of information and data so
called ISO 25010 [2]. that unauthorized persons or systems cannot
This standard defines 8 main quality factors and read or modify them and authorized persons or
a lot of attributes. systems are not denied access to them.
The 8 main technical quality factors are: 6. Compatibility.
1. Functional suitability. Degree to which two or more systems or
The degree to which the product provides components can exchange information and/or
functions that meet stated and implied needs of a perform their required functions while sharing
style guide when the product is used under the same hardware or software.
specified conditions. 7. Maintainability.
2. Reliability. Degree of effectiveness and efficiency with
The degree to which a system or component which the product can be modified.
performs specified functions under specified 8. Transferability.
conditions for a specified period of time. The degree to which a system or component can
3. Performance efficiency. be effectively and efficiently transferred from a
The performance relative to the amount of hardware, software or other operational or
resources used under stated conditions. usage environment to another.
4. Operability. • http://www.tiobe.com/_userdata/
The degree to which the product has attributes files/TIOBEQualityIndicator_v3_8.pdf
that enable it to be understood, learned, used and
attractive to the user, when used under specified
conditions.

Issue Nr 9 2016 BLAISE PASCAL MAGAZINE 31


WORK WITH CODE METRICS: YOU SHOULD KNOW PAGE 3 / 9 maXbox
Now we step with a traceable real world function 1. Functional suitability
through the 8 points. This means for e.g. also to use the modifier
For example a DLL is a library, short for Dynamic stdcall because this is a C convention.
Link Library , a library of executable functions or
The function name OpenProcess2 is different
data that can be used by a Windows or Linux from the original name OpenProcess!
application. This is how we declare a function we This is an alias to prevent name conflicts or
want to use from a DLL: name it you like because you do have
conventions you are free to rename or reuse
Function OpenProcess2(dwDesiredAccess: DWORD;
a function in your script.
bInheritHandle: BOOL; dwProcessId:DWORD): THandle;
External '[email protected] stdcall'; 2. Reliability
For this we have to test the fault tolerance or
Suppose you want to use the function correctness of the function and to proof the
OpenProcess of the ‘kernel32.dll ’. correctness with a real call.
All you have to do is to declare above statement The fault tolerance is covered with a try finally
and you get access to the kernel! statement to free resources and the result can be
With external you made these functions done with the help of the resource monitor:
available to callers external to the DLL, so we As an output we get:
Process Id 12316
must export them or at least say the function
Process Handle inside: 3384
we use is from External. Working Set Memory KB: 108136
But is it the right result of 108136 at runtime, so
lets open the resource monitor and find to find
and compare our process best with a screen shot:

ProcessHandle:= OpenProcess2(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, false, ProcessID);


Writeln('Process Handle inside: '+inttostr(ProcessHandle));
try
if GetProcessMemoryInfo(ProcessHandle, MemCounts, sizeof(MemCounts))
then writeln('Working Set Mem KB: '+inttostr(MemCounts.WorkingSetSize div 1024));
finally CloseHandle(ProcessHandle);
end;

Yes right 2 functions with the same result.

32 Issue Nr 9 2016 BLAISE PASCAL MAGAZINE


WORK WITH CODE METRICS: YOU SHOULD KNOW PAGE 4 / 9 maXbox
By the way another test is “Don't test floating
point numbers for equality!”
Of course those 2 numbers are Integers to
compare but I had to divide the
result by 1024 to get Kbytes:
then
Now we have a clear name
Writeln('Working Set Mem KB:
ProcessMemoryUsageWorkingSet and the
'+inttostr(MemCounts.WorkingSetSize div 1024));
var globals are gone:
Therefore, the use of the equality function ProcessMemoryUsageWorkingSet(ProcessID : DWORD): DWORD;
(== or = ) var ProcessHandle : Thandle; MemCounters : TProcessMemoryCounters;
and inequality begin
(!= or <>) Result:= 0;
operators on float or double
values is almost always an
Two of them are now local variables and the
error. Instead the best course is to avoid floating
third one ProcessID is a parameter of the
point comparisons altogether as in our case with
function.
the div operator.
Then we initialize the result with zero and we
delete the writeln as a dangerous direct output.
3. Performance efficiency
No problem at all because the performance ProcessHandle:=
relative to the amount of resources used under OpenProcess2(PROCESS_QUERY_INFORMATION or
this conditions is small, check it with PROCESS_VM_READ, False, ProcessID);
#tech: perf: 0:0:3.450
threads: 11 192.168.56.1 13:40:05
4.2.2.98
The PROCESS_QUERY_INFORMATION is required
4. Operability
to retrieve certain information about process,
This one is not so easy. Operability for instance,
such as its token, exit code, and priority class
with sub-attributes such as “Attractiveness” and
- 0x0400 and PROCESS_VM_READ is need to
“Ease of Use” is not that clear to understand.
How to measure this and what is the unit of read memory at runtime in a process using
measurement? ReadProcessMemory.
For me global variables and possible side effects
is a test to find and global variables as well as
direct output has to be prevented.
In our case we use 3 nasty variables:

ProcessHandle : THandle;
MemCounts : TProcessMemoryCounters;
ProcessID : DWORD;

This is not operable and we design a real


procedure with parameters around the snippet:
function ProcessMemoryUsageWorkingSet(ProcessID : DWORD): DWORD;
var ProcessHandle : Thandle; MemCounters : TProcessMemoryCounters;
begin
Result:= 0;
ProcessHandle:= OpenProcess2(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False, ProcessID);
try
if GetProcessMemoryInfo(ProcessHandle, MemCounters, sizeOf(MemCounters))
then Result:= MemCounters.WorkingSetSize div 1024;
finally
CloseHandle(ProcessHandle);
end;
end;

Issue Nr 9 2016 BLAISE PASCAL MAGAZINE 33


WORK WITH CODE METRICS: YOU SHOULD KNOW PAGE 5 / 9 maXbox
5. Security Now we can change it e.g. to 64bit:
This is always a big thing. function MyGetTickCount64: Longint;
Check for administration rights and exceptions. external '[email protected]
In our case we don't handle sensitive data. stdcall';
Exceptions are meant to represent the 7. Maintainability
application's state at which an error occurred. Use modifying as a need like programming for
Making all fields or functions final with Consts change.
ensures this state: Comments describing function behaviour has to
• Will be fully defined at the same time be put before the function itself. Comments
the exception is instantiated. within the function body is aligned with code
• Won't be updated or corrupted by and is best placed before the code if the comment
some bogus error handler. apply to several lines, or is too long
This will enable developers to quickly to fit at the right of the code.
understand what went Result:= 0;
wrong. If a property is //PROCESS_VM_READ Required read memory in a process using ReadProcessMemory
mapped with accessory ProcessHandle:= OpenProcess2(PROCESS_QUERY_INFORMATION or
functions, the their names PROCESS_VM_READ, False, ProcessID);
begin with « Get » or « Set ».
The following code shows it:

ProcessHandle:= OpenProcess2(PROCESS_QUERY_INFORMATION or
PROCESS_VM_READ, false, ProcessID);

6. Compatibility Constant identifiers shall be written in all


The degree to which two or more systems or upper-case, with underline character to split
components can exchange information and/or the identifier in more readable words.
perform their required functions. Const IP_MULTICAST_TTL = 3;
OK it seems with a DLL you guarantee some IP_MULTICAST_LOOP = 4;
degree of independent use of a certain function: IP_ADD_MEMBERSHIP = 5;

Function OpenProcess2(dwDesiredAccess:DWORD; bInheritHandle:BOOL; dwProcessId:DWORD): THandle;


External '[email protected] stdcall';

Function GetProcessMemoryInfo(Process: THandle;


var MemoryCounters: TProcessMemoryCounters; cb: DWORD): BOOL; //stdcall;;
External '[email protected] stdcall';

Variables and functions identifiers are written


using concatenated words in lower case with Global variables are prefixed with uppercase
each first letter in upper case. The names shall be letter ‘G’:
chosen to be as meaningful as possible. var GClassCritSect :
TRTLCriticalSection;

Function GetProcessMemoryInfo(Process: THandle; For example we want to change or expand our


function to get the PeakWorkingSetSize,
Built-in data types are written in lower case there's the change to do:
except the first letter. trytry
Function arguments are separated by comma if if GetProcessMemoryInfo(ProcessHandle,
GetProcessMemoryInfo (ProcessHandle,
when calling the function. MemCounters,
MemCounters , sizeOf (MemCounters))
sizeOf(MemCounters))
Put a space after the comma but none before and then
then := MemCounters.PeakWorkingSetSize div
Result:=
Result
so on. To get more compatibility there's a 1024 ;
MemCounters.PeakWorkingSetSize div 1024;
template dll , write the word dll maybe at the finally
finally
beginning or below or inside of your code and CloseHandle(ProcessHandle);
CloseHandle(ProcessHandle);
press <Ctrl> j and it gets expanded to: end;
end;

function MyGetTickCount: Longint; and the result again:


external '[email protected] Working Set Mem KB: 108148
stdcall'; Working Set Peak KB: 124348

34 Issue Nr 9 2016 BLAISE PASCAL MAGAZINE


WORK WITH CODE METRICS: YOU SHOULD KNOW PAGE 6 / 9 maXbox
8. Transferability You find the script to test and work:
So this criterion is about portability and http://www.softwareschule.ch/examples/
migration to other platforms. For this we can use 615_regex_metrics_java2pascal.txt
for example conditional expression. Do not use
SONAR QUBE AND MAXBOX
leading and ending parenthesis. When the
Most of metric functions you can control and run
expression is made of several subexpressions,
with Sonar. The Goal is to audit, measure,
parenthesis are used around each part.
refactor, find and fix in the Sonar Dashboard
Conditional compilation directives start at the
with the following Quality Gates:
left margin when possible.
Indentation is not affected by the conditional
• Lines of code
compilation.
• Code Complexity
• Code Coverage
uses • Rules Compliance
{$IFDEF FPC} • Document Comments
// use the LCL interface support whenever possible
{$IFDEF USE_WINAPI} Generally, there is a “runner”
Windows, that consumes the source code
{$ENDIF} and analyses it via plug-ins. This
GraphType, IntfGraphics, LCLType, LCLIntf, LMessages, LResources, information is published to the
{$ELSE}
SonarQube database directly to
Windows, Messages,
{$IFDEF USE_PNG_SUPPORT} get the code review result.
PngImage, Before each run, the runner
{$ENDIF} makes a call to the server to
{$ENDIF} download configuration settings
Classes, Forms, Graphics, Controls, Types, KFunctions stored there, and mashes those
{$IFDEF USE_THEMES} with configuration settings
, Themes stored in a local configuration
{$IFNDEF FPC} file, as well as project-specific
, UxTheme configfiles which can be
{$ENDIF}
controlled by maven, maXbox or
{$ENDIF} ;
another runner.

Sometimes conditional compilation apply to SonarQube is originally written for Java analysis
only a part of a statement. In that case, it is at PMD and later added C# and further support.
necessary to put the directives in line with the The SonarQube (web) server pulls the results
statement: from the database and provides a UI for
procedure MyOwnProc();
procedure MyOwnProc {$IFNDEF
(); {$IFNDEF BCB} ;
BCB} virtual reviewing and managing them, as well as a UI for
virtual;
{$ENDIF} {$ENDIF} managing configuration settings, user
procedure
procedure ClearClear; {$IFDEF
; {$IFDEF FPC}override;{$ENDIF} authentication, etc. The server also has its own
FPC}override;{$ENDIF} config file sonar.properties where you define
database settings, user authentication settings,
But that's just a simple solution because the etc. The monitor shows then the following topics:
computer world is full of incompatibility like
the following and last example: • Duplicated code
• Coding standards
// SOME REMARKS OF CR AND LF • Unit tests and Code Coverage
# On Mac, the newline is the CR
• Complex code
character (# 13)
# Windows , il se fait par • Potential bugs and issues
caractère CR+LF (#13+#10), Win it • Comments /API Documentation
is the character CR + LF (# 13 + # • Design and architecture
10)
# UNIX , par le caractère LF
(#10). , and on Unix, the LF (#
10).

Issue Nr 9 2016 BLAISE PASCAL MAGAZINE 35


WORK WITH CODE METRICS: YOU SHOULD KNOW PAGE 7 / 9 maXbox
The defined Ruleset of SonarQube (web) 5.1.1 It is important to note that some special events
can be found at: like /c java -version must be captured with
Important metrics to look for different parameters like /k or in combination.

• duplicated_blocks Here's the solution with GetDosOutput


• violations – info_violations GetDosOutput():
• public_undocumented_api writeln('GetDosOut: '+GetDosOutput('java -version','c:\'));
or like the man-pages in Linux
writeln('GetDosOut: '+GetDosOutput('help dir','c:\'));

• uncovered_complexity_by_tests
BYTE CODE PERFORMANCE
(it is considered that 80% of coverage
Intermediate representations such as byte-code
is the objective)
may be output by programming language
• function_complexity_distribution >= 8,
implementations to ease interpretation, or it
• class_complexity_distribution >=
may be used to reduce hardware and operating
60 package_edges_weight
system dependence by allowing the same code
CONSOLE CAPTURE DOS SONARQUBE51 to run on different platforms.
But then I want to test some Shell Functions on a So you can share your code as source in a
DOS Shell or command line output. The code normal text-file (*.txt) or as bytecocde
below allows to perform a command in a DOS (*.psb) to gain speed or obfuscation. In some
Shell and capture its output to the maXbox cases, you may want to export or deliver a script
console. First step with with its bytecode to store on removable media
Function or to use on a different
cyShellExecute(Operation,FileName,Parameters,Directory:String; computer without the
ShowCmd:Integer):Cardinal; source as a text-file.
function ShowFindFilesDlg(const Folder: string): Boolean;
begin
Result:= {mXCindyShellAPI.}cyShellExecute(
'find', PChar(Folder), '', '', {Windows.}SW_SHOW
) > 32;
end ;
This is how you can do that:
Next step is to capture the DOS output: 1. You open a script and compile it before.
The captured output is sent “real-time” to the 2. you go to /Options/Save Bytecode/ and
Memo2 parameter as console output in maXbox: the console writes:
-----PS-BYTECODE (PSB) mX4-----
srlist:= TStringlist.create; 13:48:38 -----BYTECODE
ConsoleCapture('C:\', 'cmd.exe', '/c dir *.*',srlist); saved as:
writeln(srlist.text) C:\maXbook\maxbox3\mX3999\maxbox3\examples\
srlist.Free; 287_eventhandliing2_primewordcount.psb
----IFPS#
But you can redirect the output srlist.text 3. you load the byte-code by
anywhere you want. For example you can /Options/Load Bytecode...
capture the output of a DOS console and
IFPS#
input into a textbox, or you want to
### mX3 byte code executed: 10.06.2015 13:53:20 Runtime:
capture the command start of demo app
0:0:1.577 Memoryload: 60% use ByteCode Success Message
and input into your app that will do
of: 287_eventhandling2_primewordcount.psb
further things.
ConsoleCapture('C:\', 'cmd.exe', '/c ipconfig',srlist);
ConsoleCapture('C:\', 'cmd.exe', '/c ping 127.0.0.1',srlist);

4. When testing is finished you send the byte-


code to your client.

36 Issue Nr 9 2016 BLAISE PASCAL MAGAZINE


WORK WITH CODE METRICS: YOU SHOULD KNOW PAGE 8 / 9 maXbox
EXCEPTION HANDLING
A few last words how to handle Exceptions
within maXbox:
Prototype:
procedure RaiseException(Ex: TIFException; const Msg: String);

Description: Raises an exception with the


specified message. Example:
begin
RaiseException(erCustomError,'Your message goes here');
// The following line will not be executed because of the
exception!
MsgBox('You will not see this.', 'mbInformation', MB_OK);

This is a simple example of a actual script that


shows how to do try except with raising a
exception and doing something with the
exception message.
procedure Exceptions_On_maXbox;
var filename,emsg:string;
begin
filename:= '';
try
if filename = '' then
RaiseException(erCustomError,
'Exception: File name cannot be blank');
except
emsg:= ExceptionToString(ExceptionType, ExceptionParam);
//do act with the exception message i.e. email it or save to a log etc
writeln(emsg)
end;
end;

NOTE The ExceptionToString() returns a message


associated with the current exception. This
function with parameters should only be called
from within an except section.

THE LOG FILES


There are 2 log files a runtime log and an
exception log:
using Logfile: maxboxlog.log ,
Exceptionlogfile: maxboxerrorlog.txt
New Session Exe Start C:\maXbox\tested
>>>> Start Exe: maXbox4.exe v4.0.2.80 2016-02-03 14:37:18
>>>> Start [RAM monitor] : Total=2147483647, Avail=2147483647,
Load=30% ; [Disk monitor] : Available to user=671317413888, Total on
disk=972076589056, Free total on disk=671317413888 ; 2016-02-03
14:37:18
>>>> Start Script: C:\Program Files
(x86)\Import\maxbox4\examples\640_weather_cockpit6_1.TXT 2016-02-03
14:37:33 From Host: maXbox4.exe of C:\maXbox\maxbox3\work2015\Sparx\
>>>> Stop Script: 640_weather_cockpit6_1.TXT
[RAM monitor] : (2147483647, 2147483647, 30%) Compiled+Run Success!
Runtime: 14:37:33.267
New Session Exe Start C:\Program Files(x86)\Import\maxbox4\
examples\640_weather_cockpit6_1.TXT
>>>> Start Exe: maXbox4.exe v4.2.2.95 2016-05-19 09:15:17
>>>> Start [RAM monitor] : Total=2147483647, Avail=2147483647,
Load=25% ; [Disk monitor] : Available to user=675888001024, Total on
disk=972076589056

Issue Nr 9 2016 BLAISE PASCAL MAGAZINE 37


WORK WITH CODE METRICS: YOU SHOULD KNOW PAGE 9 / 9 maXbox

APPENDIX
“Wise men speak because they have something to say; Fools, because they have to say something”. -Plato

Something with the Internet of Things


Feedback @ [email protected]
Literature: Kleiner et al., Patterns konkret, 2003, Software & Support
https://github.com/maxkleiner/maXbox3/releases
Ref: TIOBEQualityIndicator_v3_8.pdf
http://www.tiobe.com/_userdata/files/TIOBEQualityIndicator_v3_8.pdf

ISO, “ Systems and software engineering – Systems and software Quality


Requirements and Evaluation (SquaRE) – System and software quality models ”,
ISO/IEC 25010:2011, 2011, obtainable from
http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?
csnumber=35733

Tutorials concerning Clean Code and Metrics:


http://www.softwareschule.ch/download/maxbox_starter24.pdf
Wikipedia, “ Code Coverage ”, extracted July 2012, obtainable from
http://en.wikipedia.org/wiki/Code_coverage.

Wikipedia, “ Abstract Interpretation ”, extracted July 2012, obtainable from


http://en.wikipedia.org/wiki/Abstract_interpretation
Wikipedia, “ Coding Conventions ”, extracted July 2012, obtainable from

http://en.wikipedia.org/wiki/Coding_standard
Test Script:
http://www.softwareschule.ch/examples/615_regex_metrics_java2pascal.txt

38 Issue Nr 9 2016 BLAISE PASCAL MAGAZINE


- Now multimonitor remote desktop V5 (VCL and FMX)
- Rad studio and Delphi 10.1 BERLIN support
- High performance LZ4 and Jpeg compression
- Impoved NextGen support including IOS 64 bit

- Native high performance 100% developer • Supports Delphi/C++ Builder/RAD Studio


defined application server with support for 2009 to 10.1 Berlin (32 bit/64 bit, Android,
loadbalancing and failover IOS 32/64 and OSX where applicable)"
- Native high performance JSON and XML
kbmMemTable is the fastest and most feature rich
(DOM and SAX) for easy integration with
in memory table for Embarcadero products.
external systems - Easily supports large datasets
- Native support for RTTI assisted object with millions of records
marshalling to and from XML/JSON, - Easy data streaming support
now also with new fullfeatured XML schema - Optional to use native SQL engine
(XSD) import - Supports nested transactions and undo
- High speed, unified database access - Native and fast build in M/D,
(35+ supported database APIs) with aggregation /grouping,
range selection features
connection pooling, metadata and
- Advanced indexing features for
data caching on all tiers extreme performance
- Multi head access to the application server,
via AJAX, native binary, Publish/Subscribe, Warning!
SOAP, XML, RTMP from web browsers,
kbmMemTable and kbmMW
embedded devices, linked application
servers, PCs, mobile devices, Java systems are highly addictive!
and many more clients Once used, and you are hooked for life!
- Full FastCGI hosting support. Host PHP/Ruby
/Perl/Python applications in kbmMW!
- AMQP support
( Advanced Message Queuing Protocol)
- Added AMQP 0.91 client side gateway
support and sample.
- Fully end 2 end secure brandable Remote
Desktop with near REALTIME HD video,

COMPONENTS
4
8 monitor support, texture detection,
compression and clipboard sharing.

DEVELOPERS
EESB, SOA,MoM, EAI TOOLS FOR INTELLIGENT SOLUTIONS. kbmMW IS THE PREMIERE N-TIER PRODUCT FOR DELPHI /
C++BUILDER BDS DEVELOPMENT FRAMEWORK FOR WIN 32 / 64, .NET AND LINUX WITH CLIENTS RESIDING ON WIN32 / 64,
.NET, LINUX, UNIX MAINFRAMES, MINIS, EMBEDDED DEVICES, SMART PHONES AND TABLETS.

You might also like