Professional Documents
Culture Documents
BLAISE PASCAL
PASCAL MAGAZINE
MAGAZINE
34
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,
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
Cary Jensen
Ode To the Code
Detlef Overbeek
Animation Lab for Android
Interview with Boian Mitov:
All about understanding the RTTI / Attributes / Functional Programming
Multiple Inheritance /Parallel Processing and GP GPU - Part 1
Rik Smit
Raize Components Version 6PART IIContinuation from issue 33
Max Kleiner
QR (Quick Response) Codes
David Dirkse Image Compression
Jeremy North
Review : Documentation Insight by DevJet Software
Cary Jensen
Introduction Local SQL with FireDAC
Michael van Canneyt
Unit testing - test driven development
Kim Madsen
Serving an off the shelf Content Management System
BLAISE
BLAISE PASCAL
PASCAL MAGAZINE
MAGAZINE 34
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, 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
Article overview
S O F T W A R E
QR (Quick Response)Codes
PAGE 18 By Max Kleiner
PAGE 24
Open Wire
By Rik Smit
Raize Components Version 6
PART II- Continuation
from issue 33
PAGE 18
Review :
Documentation Insight
by DevJet Software
By Jeremy North PAGE 36
Ode to Code:
Reflections on Software Development in Iambic Heptameter
by Cary Jensen
While true, it's said, there's work to do, and now it's time to start
This is my task, so plain and clear, it's science, love, and art
My slate starts clean, a screen pure white, no logic bears my will
Upon this page, through thought and might, it's my intent to fill
I make my plan, each step designed, my spec is well thought out
It matters much, oh yes it does, there can't be any doubt
S
NT S
NE ER
PO LOP
OM EVE
MOTION
BLAISE
BLAISE PASCAL
PASCAL MAGAZINE
MAGAZINE
BARNSTEN TOGEHTER WITH BLAISE PASCAL MAGAZINE
ORGANIZES THIS FALL:
THE BIG DELPHI CONFERENCE 11 SEPTEMBER 2014:
4 POWER TRAINING SESSIONS 12 SEPTEMBER 2014:
LOCATION: LEIDEN, HOLIDAY INN
Barnsten
BetterOffice
Components 4 Developers
Evers Custom Technology
Raize Software
Books
Page
Page
Page
Page
Page
Page
35
34
60
52
28
45
Articles
Cary Jensen Ode To the Code PAGE 4
Detlef Overbeek Animation Lab for Android PAGE 5
Interview with Boian Mitov: All about understanding the RTTI / Attributes / Functional Programming
Multiple Inheritance /Parallel Processing and GP GPU - Part 1 PAGE 7
Rik Smit Raize Components Version 6PART II- Continuation from issue 33 PAGE 18
Max Kleiner QR (Quick Response)Codes PAGE 24
David Dirkse Image Compression PAGE 29
Jeremy North Review : Documentation Insight by DevJet Software PAGE 36
Cary Jensen Introduction Local SQL with FireDAC PAGE 41
Michael van Canneyt Unit testing - test driven development PAGE 46
Kim Madsen Serving an off the shelf Content Management System PAGE 53
COMPONENTS
DEVELOPERS
Alexander Alexeev
www.alexander@blaisepascal.ru
Alexander @ blaisepascal.ru
Peter Bijlsma
-Editor peter @ blaisepascal.eu
Marco Cant
www.marcocantu.com
marco.cantu @ gmail.com
David Dirkse
www.davdata.nl
E-mail: David @ davdata.nl
Daniele Teti
www.
Bruno Fierens
www.tmssoftware.com
bruno.fierens @ tmssoftware.com
Primo Gabrijeli
www.
primoz @ gabrijelcic.org
Fikret Hasovic
www.
Cary Jensen
www.jensendatasystems.com
http://caryjensen.blogspot.nl
Wagner R. Landgraf
Sergey Lyubeznyy
Kim Madsen
www.component4developers
Mattias Gaertner
Jeremy North
Tim Opsteeg
Detlef Overbeek
www.blaisepascal.eu
Email:editor @ blaisepascal.eu
Rik Smit
Bob Swart
www.eBob42.com
Bob @ eBob42.com
jeremy.north @ gmail.com
Howard Page Clark
E-mail: hdpc @ talktalk.net
Please note:The spacings in the emails was added on purpose. Please delete for use
editor @ blaisepascal.eu
Alexander Alexeev
Peter Bijlsma,
Michal Van Canneyt, Marco Cant,
David Dirkse, Daniele Teti
Bruno Fierens
Primo Gabrijeli,
Fikret Hasovic
Cary Jensen
MOTION
L
K
M
N
O
P
S
BLAISE
BLAISE PASCAL
PASCAL MAGAZINE
MAGAZINE
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 editor@blaisepascal.eu
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 60.-- Incl. VAT 6 % (including code, programs and printed magazine,
6 issues per year excluding postage).
2: Electronic - non printed subscription 45.-- 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 office@blaisepascal.eu
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
office@blaisepascal.eu
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.
COMPONENTS
DEVELOPERS
Ode to Code:
Reflections on Software Development in Iambic Heptameter
by Cary Jensen
While true, it's said, there's work to do, and now it's time to start
This is my task, so plain and clear, it's science, love, and art
My slate starts clean, a screen pure white, no logic bears my will
Upon this page, through thought and might, it's my intent to fill
I make my plan, each step designed, my spec is well thought out
It matters much, oh yes it does, there can't be any doubt
My fingers fly, the logic pours, a waterfall sublime
I see my goal, I type and click, I lose all sense of time
My words are key, my syntax right, and subtly reserved
I own this world, I'm in control, though humble, numb, and nerved
It's getting close, the tension firms, anticipation's high
I hit F9, compile and run, I feel success is nigh
But wait! It fails! How can this be, catastrophe I feel
I've lost my touch, my senses fail, my mortal soul revealed
Oh, damn the Gods! This logic broke, a bug I cannot find
I check the source. I check each line. I think I'll lose my mind
But what is this, a misplaced test, can this thing truly be
Compile again, and it just works, I'm now in ecstasy
I document the change I made, my comment explains why
I always try to take this step, to prevent a future cry
Relaxed, I am, my goal achieved, a conquest satisfied
It's what I do, a job compelled, a source of joy and pride
You beauty mine, my cherished child, the product of my soul
From white blank slate to final code, a void has morphed to whole
No eyes will see this gold I've spun, no heart with feel its beat
It lies beneath the interface, resplendent and complete
I scratch one item off my list, but I cannot pretend
With this task done, there will be more, my work will never end;
Copyright 2014 Cary Jensen. All Rights Reserved
COMPONENTS
DEVELOPERS
1.
2.
Make sure you have chosen for the Mobile you want.
Try to loacte this under the android
Search for ALTimeLine and drop a
ALTimeLine component from the Animation Lab -Tab
Samsung S4
3.
4.
5.
COMPONENTS
DEVELOPERS
Boian Mitov
S O F T W A R E
INTRODUCTION
Editor:
Boian, to start with your name:, where does it come from
and what does it mean?
Boian Mitov:
Boian is a Bulgarian name. Not widely used. Not sure of
the exact origin. I have been told that it is based maybe
on the word painter in Bulgarian, although it differs a lot
from it. There is also a famous Old Bulgarian Theater
play called "Boian the Wizard", so some people may
associate it with that too.
Boian Mitov:
My first Pascal encounter was while I served the
mandatory 2 years of military service in the Bulgarian
Army.
I was mainly developing in Assembler, and Basic, but
we got a project developed in UCSD Pascal. So I took a
course. Couple of years ago actually I have gone
through some Pascal books, so I had some familiarity
with the language already. This was approximately
1988-89.
Editor:
So you have been working with the language since the
beginning?
Boian Mitov:
Hardly...It has existed since 1970, I was nearly 20
years late
Editor:
Yes but the first versions were on mainframes etc.
That's the period Mr Wirth was working on it...
Boian Mitov:
That does not make it any less important. I have
worked on Mini VAX, but mostly used Fortran 77 and C
Editor:
I don't recall the exact time that Apple started with it...
Editor:
When I hear your voice, you remind me of a young boyvery enthusiastic and young... So when did you come to
the states?
Boian Mitov:
Apple started 1978 so I have been 10 years late there
too. I can hardly pretend to be a pioneer there.
Boian Mitov:
Hmm... at 45 I am hardly young, but I guess I never
grew any way. I came to the states in 1996.
Editor:
I still have some of the books from that period.
What was the reason for you to start with it it? Did
you want to start your own company - was that it?
Editor:
So you already had done the biggest part of your
education...?
Boian Mitov:
Yes, and fair amount of work-experience.
Editor:
Did you do Pascal? Or started with another language?
Boian Mitov:
I started with 6800 Assembler and then 6502 Assembler,
and Apple ][ Apple soft Basic. At the time I started,
there were no personal computers in Bulgaria, so I
designed and built my own 6800 based "KIT", somewhat
similar to the Motorola 6800 kits from the period.
Boian Mitov:
I have worked with many different languages over the
years. Before Delphi 1 my primary language was C++.
When Delphi 1 appeared, it offered OOP comparable to
C++ and visual development. We had a DB related
project we needed to handle in the company I was
working for at the time, so it was a very good fit. Since
most of the development I was doing at the time was
hardware related, and often embedded, I was still
working primarily with C++, but I was always looking
for the right tool for the right task, and Delphi was the
right tool for the application. This was in 1995.
When I moved to the USA, in 1996, the C++
Builder appeared, and I was one of the first adopters.
It promised the same visual development with the full
power of C++ - templates and everything. I worked in
a number of companies in C++ Builder from 1996 to
2001. In 2001 I was hard at work on the Open Wire
architecture. At that time during a conversation with
Atanas Stoyanov, he suggested to try to port it from
C++ Builder to Delphi. The port went well. 2 years
later, the company I was working for went through
some difficult times and I decided to leave it.
Edit Controls
The other database fields are connected to TRzDBEdit,
TRzDBSpinEdit, TRzDBDateTimeEdit, TRzDBMemo,
TRzDBComboBox and TRzDBCheckBox components.
Figure 37: The data controls are flat and apear as lines
(brown in this example)
TRzDBLookupDialog
The Event field is also edited by a TRzDBButtonEdit.
However, for this field the user is allowed to type in an
Event Number. The user can also click the Find button (the
magnifying glass with hint: Search by name) to search by
Event Name using a TRzDBLookupDialog component,
which is a dialog-based component that provides an easy
way to perform lookups. In this example, the KeyField
property is set to the EventNo field while the SearchField
property is set to EventName (see Figure 36).
TRzDBComboBox
The Method of Payment field is edited using a
TRzDBComboBox control. The Values property contains
the coded values that map to the more descriptive strings
in the drop down list (see Figure 34). The combo box is
folded out with the choice for the means of payment in
blue. Furthermore there is a drop-down calender to enable
to select a date.
21
Zend Email
TRzSendMessage
This form illustrates how to send electronic mail using the
TRzSendMessage component.
First, enter the email addresses for all recipients. Next,
enter a subject and a message body, and then select any file
attachments. Press the Send button to send the message.
Note: The TRzSendMessage component requires a MAPI
compliant messaging service such as Microsoft Outlook.
Shell Controls
This form (Figure 40) uses the Shell controls included in
Raize Components to create a Windows Explorer-like
interface.
TRzColorPicker
This component displays a grid of colour values. The user
simply clicks on a cell to select a colour. There are several
ways to customize the control. In particular, the
ShowNoColor, ShowCustomColor, ShowDefaultColor,
and ShowSystemColors properties toggle the visibility of
the various regions in the control.
TRzTimePicker
This component provides a visual way of selecting times.
The hands of the clock face are moved using the Leftmouse button (hours) and the Right-mouse button
(minutes). Holding the Ctrl key down while using the
Right-mouse button causes the minutes to be Restricted to
5 minute increments (i.e. 5, 10, 15, etc.) To always restrict
minutes, set RestrictMinutes to True. Select AM or PM by
clicking the appropriate radio button.
TRzCalculator
This component provides calculator, which can be used to
perform simple mathematical calculations. Like the other
controls on this page, the appearance of the calculator can
be customized
22
Figure 41: The combo box is folded out and the splitter
just visible on the left-hand side makes the shell-list fully
visible
TRzLauncher
This nonvisual component makes it very easy to start
another application from within your program. Simply
select a file to launch. If the file is not an executable file, the
component attempts to start the application associated with
the selected file's type. TRzLauncher supports two ways
of starting another application: Launch and Execute.
Launch method:
The Launch method causes the component to become
notified when the launched application is terminated or if
an error occurs. Check the Wait Until Finished option if
you want the main application to sleep while the launched
application is running. Otherwise, a background thread is
created to wait for the launched application to terminate. In
this demo, the notification of termination is displayed
using the TRzTrayIcon.ShowBalloonHint method.
Execute method:
The Execute method simply starts the appropriate
application and immediately returns control back to the
calling program.
TRzURLLabel
This TRzLabel descendant makes it easy to create
hyperlinks within your application, which point to web
pages, email addresses, newsgroups, and more.
TRzTrayIcon
The last example:
Located in the system notification tray, you will find an
icon for this application. The icon displayed is changed as
you navigate through this application, and when you
minimize this application, the button from the task bar is
hidden. To restore the app, double click on the tray icon.
This functionality is all handled by the TRzTrayIcon
component.
Conclusion
In this article a global description is given of the
possibilities of a number of components
belonging to Raize version 6, based on the
accompanying demo. More information about
this can be found on the website:
http://www.raize.com {/Downloads/RC/RC6.zip}
Cost (per first quarter 2014): $399
Contains: more than 120 components distributed
over various main groups.
23
WinInet API
Indy Sockets
Direct Library
Wiki says: A QR code (abbreviated from Quick Response)
is the trademark for a type of matrix bar-code (or twodimensional bar-code) first designed for the automotive
industry in Japan developed by Denso-Wave.
The point is that QR codes give users or customers
instant access to the information they need on the move;
whether its on your website, social media or another
news channel a QR service is dedicated to making access
to it quicker and easier than ever before.
We can put many information in a QR code; the code
contains information such as a website address,
telephone number, or a business card information.
24
COMPONENTS
DEVELOPERS
expert
Delphi
Colors.
A bitmap in true color format has 24 bit colors, which are
stored as pictured below:
This looks like a dramatic loss but how big is the "error"
caused by this rounding?
Rounding 1110 1000 to 1111 0000 is an "error" of 8/256 =
3,125%. Actually a little more because differences in the
higher colors are more visible then in the lower color
values. Another, however small, reduction is to replace the
color 0000 0000 by 0001 0000., so eliminating color 0. The
difference between 0000 0000 and 0001 0000 is not visible.
So, red, green and blue have 15 intensities: 0001 .. 1111.
The naval battle painting is shown in this format and I see
no difference with the original 24 bit pixel image.
COMPONENTS
DEVELOPERS
29
Size
The size of a bitmap is not tested. Up to 1,5 million pixels
may not be a problem. Bigger pictures possibly require a
larger value of constant maxDir. Also temporary space
could be reserved on the heap to accomodate the director.
The paintbox on Form1 for showing the bitmaps is 800
pixels wide and 600 pixels high.
34
COMPONENTS
DEVELOPERS
MOTION
Review :
Documentation Insight by DevJet Software By Jeremy North
Version reviewed Enterprise v3.1.4.15
Documentation insight is an IDE Expert or Plug-in that
greatly reduces the burden of documenting your source
code.
Prior to the Delphi XE6 release, a cut down version of
Documentation Insight was shipped with the IDE.
Unfortunately, this was stopped for the Delphi XE6
release most likely because the Express version was
too feature reach to encourage uses to upgrade to the
paid versions.
Excluding the now defunct Express version there are two
editions available, Professional and Enterprise. The only
difference between the two editions is the ability to
output the source code documentation into a number of
formats.
Documentation Inspector
The documentation inspector is where you will spend most
of your time documenting your code. It is an easy to use
IDE dockable form.
36
COMPONENTS
DEVELOPERS
expert
COMPONENTS
DEVELOPERS
41
LEARN TO PROGRAM
by Howard Page-Clark
maxbox3.zip
Lazarus Win64.zip - Win32.zip - Laz_Mac.zip
LearningHowardPageClark.pdf
LazarusFileOverview.txt
45
expert
Introduction
As a software engineer, it is (hopefully) natural to test
your code before shipping your software. There are
many ways to test code. Manually, through some test
program, or using a test framework.
Test-Driven Development (TDD) takes this last
approach even one step further: the test code is written
parallel with (or even before) the actual code to be
tested.
The use of test frameworks became well-established
starting with the junit test framework for Java:
Extremely simple in its design, it is nevertheless very
powerful.
46
COMPONENTS
DEVELOPERS
expert
By Kim Madsen
COMPONENTS
DEVELOPERS
53
54
COMPONENTS
DEVELOPERS
COMPONENTS
DEVELOPERS
55
Then click the Next step button at the bottom right corner.
56
COMPONENTS
DEVELOPERS
COMPONENTS
DEVELOPERS
CUSTOM TECHNOLOGY
b.evers@eversct.nl
COMPONENTS
DEVELOPERS
57
sd:=TkbmMWHTTPFastCGIServiceDefinition(kbmMWServer1.RegisterService(TFastCGIHTTPService,false));
// Its possible to define a default file name if no file is referenced.
// As we define a PHP FastCGI site, index.pbp is typically the default.
// Its also possible to define the default via an URL rewrite. See further down.
// sd.DefaultFile:='index.php';
// Define the root of all resources for the PHP site.
// Actual .php files are placed in the mwhfcOther category.
// Typically these values all points to the same PHP webapp root directory.
// The directory is seen from the current directory of the kbmMW server.
sd.RootPath[mwhfcHTML]:='phpsqlitecms';
sd.RootPath[mwhfcImage]:=sd.RootPath[mwhfcHTML];
sd.RootPath[mwhfcJavascript]:=sd.RootPath[mwhfcHTML];
sd.RootPath[mwhfcStyleSheet]:=sd.RootPath[mwhfcHTML];
sd.RootPath[mwhfcOther]:=sd.RootPath[mwhfcHTML];
// Most FastCGI servers require these settings to be made.
// ServerName and ServerPort is the name/port for which the server
// is accessed from the "outside" before any NAT translations or proxying.
sd.ServerName:='192.168.1.103';
sd.ServerPort:=80;
// Define how to connect to FastCGI servers serving this PHP application.
// Here we define one local PHP FastCGI server (the group name is not
// relevant as such but is used to separate different FastCGI instances
// from eachother).
// More can be defined as separate groups. kbmMW will then round robin
// loadbalance requests to them.
// As a minimum IP and Port entries must be defined for a FastCGI server.
// Optionally Launch and Parameters can be defined, to let kbmMW automatically
// start FastCGI servers as needed.
sl:=TkbmMWConnectionStringArray.Create;
try
sl.Add('<|local|>');
sl.Add('IP=192.168.1.103');
sl.Add('Port=8764');
sl.Add('Launch=c:\PHP\php-cgi.exe');
sl.Add('Parameters=-b 192.168.1.103:8764');
// Rewrite any url for files not found.
sd.Rewrites.Add('^/cms/(.*)$','/cms/index.php?qs=$1',[mwhuroIfFileNotExists,mwhuroBreak]);
sd.Rewrites.Add('^/(.*)$','/index.php?qs=$1',[mwhuroIfFileNotExists,mwhuroBreak]);
sd.FastCGIModules.RegisterFastCGIModule(KBMMW_FASTCGI_URL_MASK_PHP,sl,
'C:\svn_c4d\kbmmw\trunk\demos\FastCGIServer\phpsqlitecms'
);
finally
sl.Free;
end;
end;
58
COMPONENTS
DEVELOPERS
Best regards
Kim Madsen
Components4Developers
COMPONENTS
DEVELOPERS
59
S
NT RS
E
N E
PO ELOP
M
O EV
COMPONENTS
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.