Blaise 28

download Blaise 28

of 30

Transcript of Blaise 28

  • 7/25/2019 Blaise 28

    1/30

    2 / 2013Publisher: Foundation for Supporting the Pascal Programming Language

    in collaboration with the Dutch Pascal User Group (Pascal Gebruikers Groep) Stichting Ondersteuning Programmeertaal Pascal

    BLAISE PASCAL MAGAZINEBLAISE PASCAL MAGAZINED E L P H I, L A Z A R U S, O X Y G E N (P R I S M), 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

    2828

    NEW AND ENHANCED FEATURES IN DELPHI XE4

    First Look at FireDACWriting UI-Independent Code with Anonymous Methods

    Development for lazarus part two

    Delphi XE4 iOS DataSnap ClientsIntro to kbmMW connectivity package 'Spider '

    Alternative datastreams (ADS) By Jean Pierre Hoefnagelalternative and a far better inifile

    By Cary Jensen

    By Cary Jensenthe e

    Programming in Smart: Refactoring By Primo Gabrijel i refactoring and the code of the Todo list

    additional extras for simple development Matching files By Peter van de Sman

    By James D (Jim) Duff

    By Bob Swart

    By Marco Cant

    BookreviewStart Programming using Object Pascal -

    Free Pascal/Lazarus Book

    By Fikret Hasovic

    Introduction to Databases Part 12: A DataSnap Client

    ffects of Authentication and Authorization

    By Joost van der Sluis

  • 7/25/2019 Blaise 28

    2/30

    Editor - in - chief

    News and Press Releases

    Authors

    Editors

    Trademarks

    Caveat

    Subscriptions

    ABN AMRO Bank

    Subscription department

    Detlef D. Overbeek, NetherlandsTel.: +31 (0)30 890.66.44 / Mobile: +31 (0)621.23.62.68

    email only to

    A Alexander

    N Jeremy North,O Tim Opsteeg,

    Howard Page-Clark,

    Peter Bijlsma,

    Howard Page-Clark, James D. Duff

    ( 2013 prices )

    (including code, programs anddownload magazine)

    or by written order, or by sen ding an email to

    Subscriptions can start at any date. All issuespublished in the calendar year of the subscription willbe sent as well.

    Account no. 44 19 60 863 or by credit card: Paypal or TakeTwoName: Pro Pascal Foundation-

    NL82 ABNA 0441960863ABNANL2A VAT no.: 81 42 54 147

    (Stichting Programmeertaal Pascal)

    [email protected]

    www.blaisepascal.eu

    [email protected]

    [email protected]

    Alexeev

    Michal Van Canneyt,Daniele Teti

    F Bruno Fierens

    Fikret HasovicJ Cary JensenL Wagner R. Landgraf, Sergey LyubeznyyM KIm Madsen, Felipe Monteiro de Cavalho

    Inoussa Ouedraogo

    Foundation forSupporting the Pascal Programming Language(Stichting Ondersteuning Programeertaal Pascal)

    BC Marco Cant,D David Dirkse,

    G Primo Gabrijeli,H

    PS Henk Schreij, Rik Smit, Bob Swart,

    W. (Wim) van Ingen Schenau,Rik Smit

    All trademarks used areacknowledged as the property of their respectiveowners.

    Whilst we endeavour to ensure that what ispublished in the magazine is correct, we cannotaccept responsibility for any errors or omissions.If you notice something which may be incorrect,please contact the Editor and we will publish acorrection where relevant.

    1: Printed version: subscription 65.--(including code, programs and printed magazine,6 issues per year including postage).

    2: Non printed subscription 45.--Incl. VAT 21%

    Subscriptions can be take n out online at

    Subscriptions will not be prolonged without notice.Receipt of payment will be sent by email.Subscriptions can be paid by sending the payment to:

    Edelstenenbaan 21 / 3402 XA IJsselstein,The Netherlands / Tel.: + 31 (0) 30 890.66.44 /Mobile: + 31 (0) 6 21.23.62.6 8

    Peter Bijlsma,

    Correctors

    Subscriptions run 365 days.

    IBAN:BIC

    CONTENTSArticles

    All material published in Blaise Pascal is copyright SOPP StichtingOndersteuning Programeertaal Pascal unless otherwise noted and maynot 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 ofthe PGG for download, and that articles and code will be placed ondistributable data storage media. Use of program listings by subscribersfor research and study purposes is allowed, but not for commercialpurposes. Commercial use of program listings and code is prohibitedwithout the written permission of the author.

    Copyright notice

    AdvertisersBarnsten Page 13

    BetterOffice Page 45Bod Swart Page 51Components 4 Developers Page 60Delphi Developer Days Page 3FastReport Page 40Learn to program using Lazarus Page 41Lazarus the complete guide Page 56Parallel Programmingwith Omnithread Library Page 22Smart Mobile Studio Page 33

    NEW AND ENHANCED FEATURESIN DELPHI XE4 page 4

    First Look at FireDAC

    Writing UI-Independent Codewith Anonymous Methods

    Development for lazarus part two

    Delphi XE4 iOS DataSnap Clients

    Intro to kbmMW connectivitypackage 'Spider '

    Alternative datastreams (ADS) By Jean Pierre Hoefnagel page 14alternative and a far better inifile

    By Cary Jensen page 16

    By Cary Jensen page 23the eProgramming in Smart: Refactoring

    By Primo Gabrijel

    i

    Page 34refactoring and the code of the Todo list

    additional extras for simple development

    By James D (Jim) Duff Page 48

    By Bob Swart Page 52

    Page 57

    By Marco Cant page 18

    BookreviewStart Programming using Object Pascal -Free Pascal/Lazarus Book

    By Fikret Hasovic

    Introduction to Databases Part 12:A DataSnap Client

    ffects of Authentication and Authorization

    By Joost van der Sluis Page 42

    Matching files by Peter van de Sman Page 46

    2 COMPONENTSDEVELOPERS 4 Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    28 28BLAISE PASCAL MAGAZINEBLAISE PASCAL MAGAZINED E L P H I, L A Z A R U S, O X Y G E N (P R I S M), 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 V O L U M E 2 8, I S S N 1 8 7 6-0 5 8 9

    DUTCH PASCON 7 SEPTEMBER 2013I N T E R N A T I O N A LP A S C A L & D E L P H I S E S S I O N SC O N F E R E N C E I N E N G L I S H

    mailto:[email protected]:[email protected]:[email protected]://www.blaisepascal.eu/mailto:[email protected]:[email protected]://www.blaisepascal.eu/mailto:[email protected]:[email protected]:[email protected]://www.blaisepascal.eu/mailto:[email protected]
  • 7/25/2019 Blaise 28

    3/30

    Nr 2 / 2013 BLAISE PASCAL MAGAZINE 3

    Don't Miss! Delphi Developer Days 2013

    www.DelphiDeveloperDays.com

    Delphi Developer Days 2013Featuring Bob Swart & Cary Jensen

    Bob Swart and Cary Jensen present Delphi Developer Days 2013, a Delphi training tour in theUnited State and Europe. Delphi Developer Days is an intense two-day live event where youwill experience both joint sessions, presented by Bob and Cary together, as well assimultaneous tracks. Some of the topics covered include browser-based clients, essentialthrough advanced database development, from VCL to FireMonkey, mobile development andDelphi's NextGen Compiler, data access components, DataSnap, REST versus DBX, XMLand JSON, SOAP, debugging applications, writing Windows services, and gestures and touchin Delphi applications. There's also an Embarcadero keynote, plus a session by a guestspeaker.

    te City Location

    30-31 May 2013 Frankfurt, Germany Holiday Inn Express Frankfurt

    3-4 June 2013 Amsterdam, NL Park Plaza Victoria Amsterdam

    Seating is limited to 42 people per city.

    Attendees Receive: An extensive course book (several hundred pages) written by Bob and Cary

    that includes material covered in their joint and individual sessions Source code examples from all of their sessions A chance to win valuable prizes from our sponsors Lunch on both days

    Register early for an additional discount. Previous attendee and group discounts are available.

    Register Now to Reserve Your Space!

    www.DelphiDeveloperDays.com

    Delphi Developer Days 2013 Dates and Cities

    http://www.delphideveloperdays.com/http://www.delphideveloperdays.com/http://www.delphideveloperdays.com/http://www.delphideveloperdays.com/
  • 7/25/2019 Blaise 28

    4/30

    4 COMPONENTSDEVELOPERS 4 Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    The advantages of multi-device developmentMulti-device app development means you don't have to

    support multiple development projects to deliver your appnatively on multiple platforms (iOS, Windows, and Mac).Why is multi-device with RAD Studio the bestdevelopment approach? Most desktop development solutions don't support

    mobile app development Most mobile development solutions do not support the

    creation of PC apps for Windows and Mac As a result, development teams not using RAD Studio

    often have to support multiple development projectsusing different tools, programming languages, codebases, and sometimes different teams to deliver theirapp on both desktop and mobile devices

    Delphi XE4 short overview

    Here is a short overview of what I think is impressive. I am not sure whohad the Idea for all the extras, but Embarcaderomost certainly made quite a job out of it.

    There has been put an enormous effort in to XE4to create samples, help and code views.We decided to show you some of the internalextra's that are delivered with the new version.Just to make you curious.

    Now even if you are not experienced with mobileapp development, XE4 will make it very easy tostart some projects that will really teach you howto and we are quite sure you will be creating yourfirst ideas and applications very soon.

    We also do believe that this will have a fargreater impact on coding AND hardware ANDtechnological development then we now can see.It might even turn the future in a new direction.

    If youre interested in technology anddevelopment you should read Ray Kurzweil'sbook: The Singularity Is Near: When HumansTranscend Biology. This version of Delphi fits quitewel into that...Oh, by the way: it works, but as all code it is notwithout errors. But we will see that it is becoming afantastic tool.

    Your Editor: Detlef

    Multi-Device, True NativeCompanies are under pressure to deliver apps that theircustomers can use in the office and on the road, but codingand managing these different versions can be costly andtime-consuming.

  • 7/25/2019 Blaise 28

    5/30

    5COMPONENTSDEVELOPERS 4Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    Develop apps for iPhone and iPadCreate mobile apps using the programming skills,knowledge and code that you already have. Your RAD

    Studio Delphi iOS apps will have fast native performanceand better security than web-based or scripting languagebased apps. Use a full visual designer for iOS userinterfaces with multiple device types, resolutions, andorientations.

    iOS user interface controlsWith Delphi in RAD Studio XE4, you get a full range ofnative styled user interface controls, including buttons,listboxes and combo boxes, to incorporate into your apps.The iOS apps you create include native controls like thedate picker and custom picker, different keyboard types,services like notifications, and support for Share Sheet toprint and share via social media, email and directcommunication with other apps. Learn more >

    Rapid prototypingRAD Studio XE4 delivers an enhanced and optimizeddeveloper workflow for mobile development thatautomates deployment and debugging on both thesimulator and device. Rapidly prototype your apps withlayouts for each device type and quickly go fromprototype to production. Integrate feedback quickly bydeploying your prototype directly onto your target deviceusing actual framework objects and code. Learn more >

    Delphi XE4 short overview (Continuation 1)Building your app in RAD Studio eliminates the need toengage in multiple development efforts for the sameapplication on multiple devices. This means you get tomarket faster, on more platforms for the first releaseand every release after that while keeping costs down.

    What are "true native" apps, and why should you care?True native app development lets you deliver script-free,device-native apps that expose the full range ofcapabilities and performance in the underlying devices for faster, richer apps that end users love.Many tool vendors are using the term "native" appdevelopment to describe web technologies and scriptswrapped into an app package to deliver an app-like userexperience. This approach can impose limits on appperformance and capabilities.

    How do true native apps built with RAD Studio differ fromwhat others might call "native"?True native apps in RAD Studio are script-free and rundirectly on hardware CPU delivering the followingadvantages: Fast Uncompromised native device performance with

    full native API and CPU control when you need it, andnot limited by or slowed by script interpreters andvirtual machines.

    Predictable Apps run directly on the device CPU,as intended by the device vendors, and are not slowedby additional software layers and processes, such asrandom garbage collection.

    Better User Experience (UX) Apps take full advantageof device capabilities and performance.

    RAD Studio is the app development suite for companiesthat need to create true native apps for PCs, tablets, andsmartphones and get them to market fast.

    Multi-device, true native app development

    RAD Studio's multi-device app development solutionmeans you don't have to support multiple developmentprojects to deliver your apps natively on multipleplatforms (iOS, Windows and Mac OS X). RAD Studio XE4makes it easy to build script-free true native apps formultiple devices that expose the full range of capabilitiesand performance in the underlying devices.

  • 7/25/2019 Blaise 28

    6/30

    6 COMPONENTSDEVELOPERS 4 Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    FireMonkey FM3 Application PlatformRAD Studio XE4 leverages FireMonkey FM3, the nextgeneration platform for building multi-device, true nativeapps from a single C++ or Delphi codebase. You codeonce and the framework takes care of optimizing your appfor multiple target platforms. Visual components give youextendable and reusable building blocks for faster andhighly maintainable development. Learn more >

    IBLite and SQLite iOS database supportRAD Studio XE4 includes iOS local database support forSQLite and embedded InterBase via dbExpress, FireDACand IBX. You also get a free development and freeunlimited deployment license for IBLite for iOS a newedition of the popular embedded InterBase ToGodatabase. Learn more >

    Multi-tier client support for DataSnap, web servicesand enterprise databasesRAD Studio XE4 includes ISV and enterprise-classintegrated database connectivity, middleware and cloudcomputing via dbExpress and FireMonkey. You getintegrated support for SQL Server, Oracle, Sybase, DB2,InterBase, SQL Anywhere, SQLite, MySQL, and manymore embedded and server databases as well as cloudservices including Windows Azure and Amazon WebServices.

    New FireMonkey Mobile Wizard FireMonkey Mobile Application: When you select File > New > FireMonkey MobileApplication - Delphi, the FireMonkey Mobile Applicationwizard opens, and you are prompted to select one of thefollowing FireMonkey Mobile Application types:

    Blank Application3D Application

    FireMonkey Mobile Form

    - with no preset components- with no preset components

    Header/Footer Header/Footer with Navigation Tabbed Tabbed with Navigation Phone Master-Detail Tablet Master-Detail

    You can use one of the mobile application templates asyour starting point when you create a new application. Atemplate is a predefined mobile application, a project thatcontains forms that are preconfigured with components.For more information, see FireMonkey Mobile ApplicationTemplates.

    is a new wizard for creating aFireMonkey mobile form.

    iOS Target Platforms Supported The iOS mobile target platforms are now represented inthe Target Platforms node of the Project Manager.

    When you create a FireMonkey Mobile Application, thereare two basic iOS target platforms that you can select(iOS Simulator and iOS Device).

    As the target platform for the next build, you can select: iOS Device (for an iOS device connected to your Mac),

    which is any of the following: Debug (for development cycles) Ad-hoc (for private distribution) App Store (for submitting your app to the App Store)

    iOS Simulator (for the iOS simulator running onMac OS X; the default iOS app),which is any of the following: iPad iPhone (the default) iPhone 5

    You can add iOS Device and iOS Simulator to your customrun-time packages, and build them for those platforms, soyour components can be used in those platforms as well.

    IDE Changes for XE4

    Delphi XE4 short overview (Continuation 2)

    Access more databases, on more devices, moreeasily with FireDACFireDAC gives you native high-speed direct access fromDelphi and C++Builder to InterBase, SQLite, MySQL, SQLServer, Oracle, PostgreSQL, DB2, SQL Anywhere,Advantage DB, Firebird, Access, Informix, DataSnap andmany more local/embedded, mobile and enterprisedatabases. Easily migrate from BDE and other

    technologies.

  • 7/25/2019 Blaise 28

    7/30

    7COMPONENTSDEVELOPERS 4Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    Overview of Building samples:

    This code snippet (available inside theDelphi IDE) shows you how to use theTLocationSensor component in orderto read the GPS location of the deviceand display it realtime on the form.The snippet also shows you how todisplay Google Maps in a web browserin order to accurately pinpoint thelocation of the device on a real map.

    This snippetshows you how to use standard

    actions to open the Camera Applicationon your iOS device to take a photo anddisplay it on your FireMonkey form.Then, with another standard action,you will open the Share Sheet to shareyour image via email, post to Facebookand Twitter, print via AirPrint and more.

    (available inside the DelphiIDE)

    This code snippetshows you how to

    record some sound via themicrophone and then playback usingthe device speakers or headphones.

    (available insidethe Delphi IDE)

    This code snippetshows you how to pinchand zoom an image on an iOS device.

    (available inside theDelphi IDE) This code snippet shows you how touse tap and hold to display amessage

    (available insidethe Delphi IDE)

    This code snippetyou how to use the

    Notification API in order to send anotification immediately or with a 10second delay and how to cancel ascheduled notification or all notifications.

    (available inside theDelphi IDE)

    This code snippetshows you how to rotate

    an image on an iOS device

    (available inside theDelphi IDE)

    This code snippet shows you how to

    use a TWebBrowser component onan iOS device. The applicationconsists of an edit box, a button andthe web browser component. Typean address in the edit box and pressthe "GO" button in order to redirect

    the browser to your address.

    (available insidethe Delphi IDE)

    This code snippet shows you how to use the

    TCalendarEdit component in order topick dates from it and process them touse in your own applications.

    (available inside theDelphi IDE)

    iOS Location

    iOS Share Sheet iOS AudioRecPlay

    iOS Interactive Gestures- Image Zoom

    iOS Interactive Gestures - Tap and Hold

    iOS SendCancelNotifications

    iOS Interactive Gestures- Image Rotation

    iOS Web Browser iOS DatePicker

    Delphi XE4 short overview (Continuation 3)

    In the pdf:click to seethe video

    In the pdf:click to seethe video

    In the pdf:click to seethe video

    In the pdf:click to seethe video

    In the pdf:click to seethe video

    In the pdf:click to seethe video

    In the pdf:click to seethe video

    In the pdf:click to seethe video

    In the pdf:click to seethe video

  • 7/25/2019 Blaise 28

    8/30

    This code snippetshows you how to use the

    TOrientationSensor component in orderto get various compass relatedinformation such as three axis tilt,distance and heading, heading relativeto magnetic north compensated anduncompensated and heading relativeto true north compensated and

    (available inside theDelphi IDE)

    This code snippetshows you how to use

    obtain device information thatincludes OS version, OS name, anddevice type.

    (available inside theDelphi IDE)

    This applicationshows how to pop-up

    various alert messages both standardone button information box style, andmultiple button input box styles thatallows various confirmations.

    (available inside theDelphi IDE)

    This snippetshows you how to use

    the accelerometer in order to obtaininformation about the acceleration,angular acceleration, motion andspeed.

    (available inside theDelphi IDE)

    This snippetshows you how to use the

    Gyroscope in order to rotate a 3Dcube when the iOS device is tilted.

    (available inside theDelphi IDE)

    This code snippetshows you how to use the

    TLocationSensor component in order toread the GPS location of the device anddisplay it realtime on the form. Thesnippet also shows you how to displayGoogle Maps in a web browser in order toaccurately pinpoint the location of thedevice on a real map.

    (available inside theDelphi IDE)

    This application

    shows how to use thePhoneDialer API in order to make aphone call and to obtain the carrier

    (available inside the

    Delphi IDE)

    This snippet

    shows you how touse standardactions to open theCamera Applicationon your

    (available insidethe Delphi IDE)

    iOS OrientationSensor iOS DeviceInfo iOS MessageAlerts

    iOS Accelerometer iOS Gyroscope iOS Location

    iOSNotifications(Set/ResetBadge Number)

    iOS PhoneDialer

    iOS ShareSheet

    iOS device to take a photo and display iton your FireMonkey form. Then, with

    another standard action, you will openthe Share Sheet to share your image viaemail, post to Facebook and Twitter, printvia AirPrint and more.

    8 COMPONENTSDEVELOPERS 4 Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    This code snippetshows you how to use the

    Notification API in order to set thebadge number on the application iconto a specified value or to reset thebadge number to 0.

    (available inside theDelphi IDE)

    Overview of Building samples:Delphi XE4 short overview (Continuation 4)

    In the pdf:click to seethe video

    In the pdf:click to seethe video

  • 7/25/2019 Blaise 28

    9/30

    This set of code snippetsshows you how

    to rotate an image on an iOS device. .

    (availableinside the Delphi IDE)

    This snippetshows you how to use a

    TabControl with TabPosition set totpDots in order to enable scrolling oftab items on iOS devices. TheApplication has 2 tab items each onecontaining a different image.

    (available inside theDelphi IDE)

    This snippetshows you how to populate a

    listview from an IBLite database usingLiveBindings.To deploy this snippet you need to usethe IBLite license, following theinstructions that were emailed alongwith the RAD Studio license (or triallicense).

    (available inside the DelphiIDE)

    iOS Interactive Gestures- Image Rotation

    iOS TabSliding iOS IBLite

    This snippetshows you how to

    populate a list box from a SQLitedatabase using LiveBindings.

    (available inside theDelphi IDE)

    This code snippetshows you how to use the

    TComboBox component in order topick an item from it and display itsText on a label.

    (available inside theDelphi IDE)

    This snippet showsyou how to use the

    THorzScrollBox component in order toscroll through two identical pictures.

    (available insidethe Delphi IDE)

    iOS SQLite iOS CustomPicker iOS HorizontalScroll

    This snippet showsyou how to use

    standard actions in order to open theCamera Application on your iOSdevice, take a picture and retrieve thetaken image for displaying on yourFireMonkey form.

    (available insidethe Delphi IDE) This code snippet

    shows you how tomanipulate the Camera on your iOSdevice. The snippet allows you toselect either the front facing cameraor the back facing camera. Also youcan select whether to use the flash(always on or automatic) or not.

    (available inside the

    Delphi IDE)

    This snippet showsyou how to use

    standard actions in order to open thePhoto Library on your iOS device andretrieve an image from the library fordisplaying on your FireMonkey form.

    (available insidethe Delphi IDE)

    iOSAccessCameraApp

    iOS CameraComponent iOS CameraRoll

    9COMPONENTSDEVELOPERS 4Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    Overview of Building samples:Delphi XE4 short overview (Continuation 5)

    In the pdf:click to seethe video

  • 7/25/2019 Blaise 28

    10/30

    This code snippetsshows you how to use

    the Notification API in order to send anotification immediately or with a 10second delay and how to cancel ascheduled notification or all

    (available insidethe Delphi IDE)

    This code snippetshows you how to use the

    TCalendarEdit component in order topick dates from it and process them touse in your own applications.

    (available inside theDelphi IDE) This set of code snippets

    shows you howto pinch and zoom an image on an iOSdevice.

    (availableinside the Delphi IDE)

    iOS SendCancelNotifications iOS DatePicker iOS Interactive Gestures- Image Zoom

    This set of code snippetsshows you how

    to use tap and hold to display amessage.

    (availableinside the Delphi IDE)

    This code snippet showsyou how to

    record some sound via themicrophone and then playback usingthe device speakers or headphones.

    (availableinside the Delphi IDE)

    This code snippet showsyou how to use

    a WebBrowser component on an iOSdevice. The application consists of anedit box, a button and the webbrowser component. Type an addressin the edit box and press the "GO"button in order to redirect the browserto your address.

    (availableinside the Delphi IDE)

    This code snippet showsyou how to

    include an audio file for playback inyour iOS application.

    (availableinside the Delphi IDE)

    iOS Interactive Gestures- Tap and Hold

    iOS AudioRecPlay iOS Web Browser

    iOS PlayAudioFile

    10 COMPONENTSDEVELOPERS 4 Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    Overview of Building samples:Delphi XE4 short overview (Continuation 6)

    In the pdf:click to seethe video

    In the pdf:click to seethe video

    In the pdf:click to seethe video

    In the pdf:click to seethe video

    In the pdf:click to seethe video

  • 7/25/2019 Blaise 28

    11/30

    NEW AND ENHANCEDFEATURES IN DELPHI XE4 Archit. Ultim. Enterpr Profess. StarterINTEGRATED COMPILERS AND TOOLCHAINS

    APPLICATION PLATFORMS, INTEGRATED FRAMEWORKS, DESIGNERS AND SDKS

    FIREMONKEY (FM2)

    Delphi command line toolchainsfor iOS (dccios32, dcciosarm) X X X OptionalDelphi iOS ARM Compilerand Delphi iOS Compiler for iOS Simulator X X X Optional

    Enhanced in XE4! FireMonkey platform for creatingOS X 10.7 and 10.8 applications X X X XFireMonkey platform for creating nativeiOS applications for iOS 5.1 and 6.x X X X Optional

    Native message alerts for iOS X X X OptionalCustom Pickers for both iPhone and iPad X X X OptionalDate Picker for both iPhone and iPad X X X OptionalPhone Dialer Support for iOS X X X OptionalBuilt-in text editing mode for TEdit andTMemo controls on iOS, including Cut/Copy/Paste/Zoom X X X OptionalNotification center on iOS X X X OptionalGesture support for iOS, including swipe (pan), tap, tap and hold,double tap and pinch & zoom X X X OptionalNative iOS application styling for iPhoneand iPad (Retina and non-Retina) on iOS 5.1 and 6.x X X X OptionalFireMonkey Mobile Application Wizardwith header/footer, tabbed, and master detail templates X X X OptionalFull set of native iOS styling optionsfor buttons, toolbars, listboxes, sliders, switch controls X X X OptionalMobile Form Layout Tools: designfor landscape/portrait/upside down landscape andupside down portrait layouts X X X OptionalSupport for multiple form factors:choose from iPhone/iPhone 5/iPad or add a custom device X X X OptionalMobile Status Bar:

    toggle form property to show/hide status bar X X X OptionalWeb Browser for loadingand displaying web content in your iOS applications X X X OptionalEnhanced in XE4! Extended ListBox capabilities for iOS,including header/footer/grouped styling, embedded searchand expanded LiveBindings support X X X OptionalSupport for various keyboard types on iOS X X X OptionalTMagnifier component for easily zooming inon images and text X X X X XTCamera component for accessing the frontand back camera, flash etc. X X X X XTabControl with new settings for using tabs as views X X X X XFireMonkey Frames X X X X XToggle Device Skin to show/hidemobile device background X X X Optional

    iOS Sample Applications for usingthe new sensors and services X X X OptionalMac OS X Full screen Mode X X X XAction for accessingthe camera application on iOS X X X OptionalAction for accessing imagesfrom the camera roll on iOS X X X OptionalShare Sheet support on iOS 6 forsharing content via Messaging, Mail, Facebook, Twitter etc. X X X OptionalSlide transition action for TTabControlEnhanced XE4! Location Services componentfor GPS or triangulation X X X X XOrientation sensor (gyroscope/compass)on iOS X X X OptionalOrientation sensor (gyroscope/compass) on Windows X X X X XEnhanced in XE4! Motion Sensor componentfor accelerometer access on iOS X X X OptionalEnhanced in XE4! Motion Sensor componentfor accelerometer access on Windows X X X X XEnhanced in XE4! FireMonkey performance optimizations

    X X X X X

    9Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    Delphi XE4 short overview (Continuation 7)

  • 7/25/2019 Blaise 28

    12/30

    NEW AND ENHANCEDFEATURES IN DELPHI XE4 Archit. Ultim. Enterpr Profess. StarterFireMonkey application wizards X X X X X

    Deploy apps to the iOS Simulator X X X OptionalDefine info.plist applicationsettings including supported orientations in the IDE X X X OptionalDeploy apps to the iOS Device(Debug/Ad Hoc/ App Store) X X X OptionalDefine application splash screensand app icons in the IDE X X X OptionalEnhanced in XE4! Platform Assistant for deployingand debugging across platforms X X X XEnhanced in XE4! Delphi 1 through XE3 project import X X X X X

    Automatic Reference Counting in iOS ARM compiler X X X OptionalOptimized, 0-based,immutable Unicode strings in iOS ARM compiler X X X OptionalDelphi RTL for iOS X X X Optional

    Deployment Manager: Deploy to iOS X X X Optional

    Remote iOS Simulator Debugging X X X OptionalRemote iOS Device Debugging X X X Optional

    Enhanced in XE4! Continually updated help system with diagramsshowing class hierarchy, and new declared members pages

    SQLite dbExpress client support for iOS X X X OptionalInterBase Express (IBX) for iOS X X X OptionalDataSnap Mobile Connector supportfor latest versions of iOS, Android and BlackBerryInterBase ToGo dbExpress driver for iOS

    Data Access components for Win/Mac X X X OptionalData Access components for iOS X X X OptionalWindows/Mac enterprise database support,including MySQL, Microsoft SQL Server, Oracle Database,InterBase, PostgreSQL, Sybase SQL Anywhere, MicrosoftAccess, IBM DB2 Server, Firebird, Advantage Database X X X OptionalMobile database support, including SQLiteand InterBase IBLite X X X OptionalComprehensive support for SQLite v3+database, including "smart" data type recognition X X X OptionalEasy to use TDataSet descendant classes X X X OptionalUnified Data Access API X X X OptionalComprehensive support for InterBase v6+,

    including multiple transactions X X X OptionalFireDAC clients for DataSnap X X X OptionalHigh-performance in-memory dataset X X X OptionalFireDAC source code X X X OptionalEasy to use TADMemTable - in-memory dataset,highly compatible with TClientDataSet X X X OptionalDataSnap client support for HTTP, HTTPSand TCP/IP protocols and authentication X X X OptionalLocal SQL with heterogeneous SQL commandsto TDataSet's,full SQLite SQL dialect support,add-hoc TDataSet lookup X X X Optional

    New in XE4! TClientDataSet support for iOS X X XNew in XE4! DataSnap clients for iOS X X X

    Enhanced in XE4! Apple iOS(iPhone, iPad, iPod Touch) 5.1 and 6.x

    IBLite for iOSwith unlimited deployment license X X X Optional1

    INTEGRATED BUILD TOOLS AND PROJECT SUPPORT

    LANGUAGE AND RUNTIME LIBRARY FEATURES

    PERSONAL DEVELOPER PRODUCTIVITY

    INTEGRATED DEBUGGING

    INTEGRATED UNIT TESTING

    DATABASE APPLICATION DEVELOPMENT AND CONNECTIVITY DBEXPRESS

    FIREDAC MULTI-DEVICE DATA ACCESS LIBRARY

    DATASNAP MULTI-TIER

    DATASNAP MOBILE CLIENT CONNECTORS

    INCLUDED DATABASES

    (iPhone/iPhone 5/iPad)

    X X X X X

    X X XX X X Optional

    X X X

    10 Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    Delphi XE4 short overview (Continuation 8)

  • 7/25/2019 Blaise 28

    13/30

    Requires purchase of Mobile Add-On Pack for Professional Requires purchase of FireDAC Client/Server Pack for Professional Requires purchase of Mobile Add-On Pack for Professional for use with mobile apps. Requires purchase of

    FireDAC Client/Server Pack for Professional for use in Windows and Mac apps.

    http://www.barnsten.com/smashing-deal

    NEW AND ENHANCEDFEATURES IN DELPHI XE4 Archit. Ultim. Enterpr Profess. StarterADDITIONAL COMPONENTS AND TOOLS

    INTERNET DIRECT (INDY)

    VISUAL COMPONENT LIBRARY (VCL)

    DATABASE MODELING AND DESIGN

    LICENSING AND TOOL MANAGEABILITY

    SOAP Clients for iOS X X X Optional

    Indy for iOS X X X Optional

    Enhanced in XE4! Interactive multi-touch gesturesfor pan, zoom, rotate, tap, double tap, tap and hold(requires multi-touch enabled OS) X X X X X

    Updated in XE4! EmbarcaderoER/Studio 9.5 Developer Edition, a database modelingand design tool for better understandingdatabase structures X

    Enhanced in XE4! Earlier version licenses includedin AppWave network licenses (Delphi 2007- XE3).Delphi 7 available separately X X X XEnhanced in XE4! Access to licenses and downloads

    for earlier versions with purchase ofstandalone product licenses (Delphi 2007 XE3, Delphi 7) X X X X

    13Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    Adopting a new software version is always a challenge.

    What's new? How does it work?What are the improvements?How do I??? etc.

    That's why we want to add instant value if you move up to XE4.Please check o ur exclusive time limited offer for Blaise read erson our site via http://www.barnsten.com/smashing-dealSo ACT NOW and start building your Windows, Macand Mobile iOS Apps!

    Delphi XE4 short overview (Continuation 9)

    http://www.barnsten.com/smashing-dealhttp://www.barnsten.com/smashing-dealhttp://www.barnsten.com/smashing-dealhttp://www.barnsten.com/smashing-dealhttp://www.barnsten.com/smashing-deal
  • 7/25/2019 Blaise 28

    14/30

    14 COMPONENTSDEVELOPERS 4 Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    Alternative datastreams:a little known Windows feature

    Windows has a little known feature that solves all of this:ADS.It is available since Windows NT3.1 and works by storing afile on disc that is not a normal file, but is embedded intoanother (normal) file. This only works on the NTFS filesystem. Media that use the FAT file system will NOTsupport this . The content of the visible file remainsunaltered, and the file size and date remain untouched.Copying or moving the visible file also copies the contentof the attached files. When the visible file is deleted, theattached hidden files are also deleted.One very useful application of this file scheme is adding avery small hidden file to an Exe with just its CRC and size.The exe itself will not change, but a program that knowsabout these ADS files can check the file CRC and size...

    For a Delphi programmer it is not very useful to attachADS files to the exe file. Each time the Delphi application isrecompiled then exe file is overwritten and all attachedADS files are deleted. Any other file is better, but one filetype is best: the INI file. INI files are normal for any exe,and more importantly, their name corresponds to the exe,and is not replaced when you recompile.An inifile already stores common settings betweenprogram runs, so it is a logical choice to store hidden datain there tooLet's create a simple Form that automatically creates anduses its own INI file. First we need to include the unitinifiles in the uses section. Then we add a variable of thetype TIniFile to the form, and a string variable that holdsthe name of the INI file.

    privatestring

    public

    IniFileNameAppIni TInifile

    : ; : ;

    In the we initialize the file name to a name that

    is equal to the exe, but with the .INI file extension. It hasthe same file path and name as the application, and willappear in the same directory. Next we create the inifileobject AppIni.

    FormCreate

    procedure begin

    0

    end

    . ( : );

    :=( ( ), );

    :=. ( );

    .. ;

    TfrmADSExample FormCreate Sender TObject

    IniFileNameChangeFileExt paramstr

    AppIniTInifile Create IniFileName

    '.ini'

    Everything you create must also be freed when no longerneeded. The freeandnil() also writes data that is still inmemory to the INI file on disc and closes the ini file. InFormDestroy() we put this line of code:

    procedure begin

    end

    . ( : );

    .. ( );

    ;

    TfrmADSExample FormDestroy Sender TObject

    freeandnil AppIni

    Thats all you need to start using inifiles, but how do youuse them? That too is surprisingly simple.The TInifile class has lots of methods to read or write data.An example: we place an edit box named edUser on theform for a user name, but we do not want to fill it in everytime the program is started..In the FormDestroy (or OnChange of the edit box) we savethe user name into the inifile :

    procedure begin

    end

    . ( : );

    .. . ( , ,

    . ); ( );

    ;

    TfrmADSExample FormDestroy ender TObject

    AppIni WriteStringedUser Text

    FreeAndNil AppIni

    S

    'MainForm' 'edUser '

    This part takes care of storing the data, but without loadingit back that is not very useful. Loading can be done inmany ways like for instance overriding the Loaded()method of the form.To keep this example as simple as possible we assign anevent handler to the form's OnActivate event.

    procedure begin

    end

    . ( : );

    . := . (, , );

    ;

    TfrmADSExample FormActivate Sender TObject

    edUser Text AppIni ReadStr ing'MainForm' 'edUser' ''

    This loads the data into the edit box when the form isactivated. Of course the TInifile class can do a lot more,

    please check the help if you want to know more about this.There are lots of moments data can be stored and loaded,this is just an example.

    For now we do not even use the inifile as an inifile to storesettings data; we only created it as a carrier for ADS files.ADS files can be addressed by using any normal file namefollowed by a colon and another name.Example: MyApplication.ini:cache1.bin.We add another string variable ADSFileName to theform that is initialized in the FormCreate.

    procedure begin

    0

    end

    . ( : );

    := ( ( ), );

    := . ( ); := + + ;

    ;

    TfrmADSExample FormCreate Sender TObject

    IniFileName ChangeFileExt paramstr

    AppIni TInifile Create IniFileNameADSFileName IniFileName

    '.ini'

    ':' 'hidden.txt'

    > Most programs need to store data ondisk. Properties such as checkboxsettings, log-in names, in fact anythingyou want the program to remember when itrestarts.Normally you would use the registry oran INI file to do this. INI files are

    designed specifically for this, and theyare fine for text fields, radio buttonsetc. when it does not cause a problemthat users can manually alter the data.However there are times when you dontwant a user to do this. Typing errorsmight give trouble when reading thefile, or some settings might depend onother settings and their inter-relationship becomes corrupted theseare typical scenarios you want to avoid.Sometimes it makes sense to store datain non-text files as binary or cacheddata. Your exe folder can soon lookmessy if you do this. Auto creatingsubdirectories helps, but if the user

    has no business editing those files, whyallow him to open them?

    By Jean Pierre Hoefnagels

  • 7/25/2019 Blaise 28

    15/30

    By Cary Jensen

    I'm a database guy, which you've probably figuredout if you are a regular reader of Blaise Pascal.Way back in the 1980's I was building multi-userdatabases for local area networks using Paradox.When Delphi shipped it immediately became my

    development tool of choice. And although some ofthose early applications used the Paradox fileformat, due to my client's specifications, almosteverything I do these days involves a remotedatabase server.

    Until recently, Delphi's out-of-the-box support forclient/server development was less than perfect.SQL Links for Windows, the Borland DatabaseEngine's (BDE) support for client/server, wasdeprecated more than a decade ago. It'sreplacement, dbExpress, failed to live up toexpectations, leaving many Delphi developersturning to alternative sources for quality TDataSetdescendents for their data connectivity.

    expertstarter Delphi XE4 and later

    But things have changed in this "Marco Cant" era ofDelphi. In February, Embarcadero announced that it hadacquired AnyDAC from DA-Soft, and that AnyDACarchitect Dmitry Arefiev was staying on to bring hissubstantial talents to the Delphi team.All of a sudden the game has changed. Not only doesDelphi have a new data access component library, it has aworld-class data access component library that lives up tothe high expectations of Delphi developers.

    Those of you who used AnyDAC, newly christenedFireDAC, are familiar with the many features and benefits

    of this powerful set of components. This article is notintended for you. Instead, this article is designed tointroduce Delphi developers unfamiliar with FireDAC tothis new data access mechanism.

    To begin with, FireDAC's data access components are trueTDataSet descendants, just as are TSQLDataSet andTSQLQuery from dbExpress and TTable and TQuery fromthe BDE. However, unlike the dbExpress TDataSets,FireDAC TDataSets support the full breadth of theTDataSet interface.

    A Complete TDataSet Implementation

    TSQLDataSet, while being a TDataSet descendant, includesmany methods and properties you cannot not use withoutraising exceptions. These include Edit, Prior,AppendRecord, and many others associated with editing

    and navigation. In fact, it is not even possible to hook anactive TSQLDataSet or a TSQLQuery to a DBGrid througha TDataSource. Attempting to do so raises an exception.

    FireDAC components, however, support all of the TDataSetmethods, and can be wired to VCL data-aware controls aswell as to BindSourceDB components for use withLiveBindings. In short, FireDAC TDataSets support the fullset of methods and properties original found in BDETDataSets, including cached updates. (Even the BDEstopped supporting cached updates beginning with Delphi6. This was not intentional, however. It's just that cachedupdates broke in that version and were never fixed).FireDAC TDataSets go even further. FireDAC's TDataSetssupport a number of features previously only found in theTClientDataSet. These include Aggregates, GroupingLevel,and GetGroupState. And it does this all while supportingall platforms supported by Delphi, which currentlyincludes 32-bit and 64-bit Windows, Mac OSX, and iOS.

    A Real Replacement forthe Borland Database EngineFor years now Embarcadero has been admonishingdevelopers to migrate their applications from the BDE todbExpress. To be honest, dbExpress was never an acceptableBDE replacement. The closest thing to a true BDEreplacement that I was familiar with was the Delphi Data

    Access Components for the Advantage Database Server. Youreally could convert your TTables to TAdsTables andprovide you users essentially the same experience. Thedrawback, however, was that you had to convert your datafrom Paradox or dBase to the proprietary Advantage format,or less preferably, to FoxPro, Visual FoxPro, or Clipper.

    FireDAC's TADTable provides the same navigationalsupport found in TTable, and does so across all of itssupported file formats. If you want to stick with Paradoxtables (not the most stable of formats due to its file servernature), you can do so using FireDAC's support for ODBC.

    First Look at FireDAC

    16 COMPONENTSDEVELOPERS 4 Nr 2 / 2013 BLAISE PASCAL MAGAZINE

  • 7/25/2019 Blaise 28

    16/30

    18 COMPONENTSDEVELOPERS 4 Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    With the advent of the new Delphi iOS compiler, youoften have the need of having a different userinterface for an application you already have workingon Windows, maybe on the Mac. A few years ago, I

    had a simple Twitter search client written in a VCLapplication and wanted to move it to FireMonkey torecompile on the Mac. Recently, I took the sameapplication and easily made an iOS version, with adifferent user interface (UI). The technique?Separate the application logic from UI-related codeby using anonymous methods.

    On Anonymous MethodsIn case you don't know, an anonymous method orclosure (this is how they are called in otherprogramming languages) is more or less like afunction you can pass as parameter. However,different from traditional functions (or methods, likeevent handlers) passed as parameters, an

    anonymous method has a peculiarity: It can refer tothe data structure available in the code where it isdeclared, even if those structure aren't (apparently)accessible when the code is executed. In otherwords, an anonymous method captures its executioncontext and changes the scope and the lifetime ofsome data structure.

    Writing UI-Independent Codewith Anonymous Methods

    Separating UI

    Here comes a Data Module

    In the specific scenario, the application retrieves an XMLdata structure. I could have passed that data structure tothe user interface processing code, populating the visualcontrols. In this way, however, the code used to parse the

    XML would have been written multiple times.The anonymous method in question, instead, receivesas parameter an individual XML node, from which it canextract the information for the user interface.I guess things will be clearer as we start looking to theactual code.

    The first version I wrote was a little different from whatI'm showing here, but after some refactoring to make itmore portable became the following.At the core of the family of programs there is a datamodule with two components:

    object

    end

    object

    end

    : =

    :=

    IdHTTP1 TIdHTTPHandleRedirects True

    XMLDocument1 TXMLDocumentDOMVendorDesc 'ADOM XML v4'

    The first is an Indy HTTP client component, with redirectsupport enabled; the second is an XMLDocumentcomponent, based on the ADOM native Pascal XML DOM,the only one portable across all of the platforms Delphisupports.In the same data module, there is a code method called

    GetData and receiving as parameters the string to searchfor an an anonymous methods to be used to process eachentry:

    procedureconst string

    type is as

    type

    reference to procedure

    . ( : ;

    : );

    :

    =

    ( : );

    TTweetsDataModule GetDatastrTopic

    processEntry TProcessEntry

    The anonymous method declared follows

    TProcessEntry

    iEntry IXMLEntryType

    As you can see the parameter is an XML node based on theinterfaces for the individual entry in the response.This interface has been obtained by using the XMLData Binding Wizard on a sample structure returnedby a search on twitter and simplifies interactingwith the XML data.

    Now, with this information in mind, you can look at thecomplete source code of the GetData methods in Listing 1.In the code you can see the HTTP call to search on Twitter,how the resulting XML is loaded in the DOM, mapped tothe interfaces, and how the anonymous method is invokedfor each entry in the resulting data structure

    Listing 1 :The GetData method of the ( shared ) data module

    procedureconst string

    varstring

    begin

    for 0 to 1 do begin

    end end

    . ( : ; :

    );

    : ; : ;

    : ;

    :=

    . (

    + + );

    . ( ); . := ;

    := ( );

    := . . -

    ( . [ ]); ;

    ;

    TTweetsDataModule GetDatastrTopic processEntry

    TProcessEntry

    strResultfeed IXMLFeedType

    I Integer

    strResult

    IdHTTP1 Get

    strTopic

    XMLDocument1 LoadFromXML strResultXMLDocument1 Active True

    feed Getfeed XMLDocument1I feed Entry Count

    processEntry feed Entry I

    // get the data from twitter

    ' http://search.twitter.com/search.ato m?q='

    '&rpp=30&page=1'

    // now process the info

    VCL was firstThe first application I had up and running with thisapproach was a very classic VCL application, based on aListView component.

    In this case (like in all following ones) you can enter thesearch term in an edit box, and pass this value plus theanonymous method to fill the UI to the GetData methodof the data module shows above.The complete code is in Listing 2

    expertstarter Delphi XE4 and later

    By Marco Cant

    http://search.twitter.com/search.atohttp://search.twitter.com/search.ato
  • 7/25/2019 Blaise 28

    17/30

    UTRECHT - NETHERLANDSDUTCH PASCONCONFERENCE IN ENGLISH

    SEPTEMBER 20137

    RAY KONOPKA - RAIZE COMPONENTS / DMITRY AREFIEV - FIREDACBRUNO FIERENS - TMS SOFTWARE / BOB SWART TRAINING & CONSULTANCY

    RAYMOND HORSTEN - ER/STUDIO /GIRISH PATIL - PDF COMPONENTS - GNOSTICE

    KIM MADSEN - COMPONENTS4DEVELOPERSGWAN TAN - BETTER OFFICE -

    MATTHIAS GRTNER - LAZARUS / JOOST VAN DER SLUIS - LAZARUS IOS

    DANNY WIND - THE DELPHI COMPANY

    JEROEN PLUIMERS

    MICHAEL PHILIPPENKO - FASTREPORT / MICHAEL VAN CANNEYT - FREE PASCALDANNY WIND - THE DELPHI COMPANY / MARIO VERMEULEN - 3D OFFICE

    I N T E R N A T I O N A LPA S C A L & D E L P H I S E S S I O N S

    BL ISE P SC L M G ZINEL ISE P SC L M G ZINEL ISE P SC L M G ZINE &

  • 7/25/2019 Blaise 28

    18/30

    23

    Connecting to a DBX DataSnap ServerConnecting to a DBX DataSnap server from a Delphi client requires two components. One of these isSQLConnection, the component that you use to access database servers using dbExpress drivers. Thesecond is DSProviderConnection, and it takes responsibility for enumerating the DataSetProviders

    exposed by the server.That DBX DataSnap clients communicate to their servers using a dbExpress driver introducessome interesting configuration options. Specifically, you can either configure the connection to theDataSnap server using the DriverName and Params properties of the SQLConnection component, oryou can create a reusable DataSnap connection with Delphi's Data Explorer.

    The following description describes how to create a reusable connection in the Data Explorer.Unfortunately, these steps cannot be completed with the DataSnap server I described in the precedingarticle in this series (with a successful connection test) since the Data Explorer does not support theencryption filters used by that server.

    If you are not using filters for encryption or compression you start by ensuring that the DataSnapserver for which you are configuring this connection is running. If your DataSnap server is a VCLForms application, and you are running Windows Vista or Windows 7 (or later), you might have to runyour DataSnap server with administrative privileges.

    Next, open the Data Explorer, shown in Figure 1. By default, the Data Explorer is available as a tabin the same pane as the Project Manager. If you do not see this tab, you can click the right arrow at thelower right corner of this pane until you see the Data Explorer tab, after which you should click thistab. Alternatively, you can select View | Data Explorer from Delphi's main menu to display the DataExplorer.

    If you expand the DATASNAP node of theData Explorer, you should find an existingconnection namedDATASNAPCONNECTION. If you want,you can modify this connection. In mostcases, however, you will want to create anew DataSnap connection. To do this,right-click the DataSnap node and selectAdd New Connection to display the AddNew Connection dialog box shown inFigure 2.

    Introduction to Databases Part 12: A DataSnap ClientBy Cary Jensen

    expertstarter Delphi XE4 and above

    In the preceding article in this series I discussed a DataSnap server that implemented authorizationand authentication. In addition, that server employed filters for encryption. In this article I introducea Delphi client that communicates with that DataSnap server.

    Before I continue, however, I want to clarify a term that I have been using in this series. I haverepeatedly referred to the type of DataSnap server that I described in the past two articles in thisseries as IP-based DataSnap servers.

    While it is true that this type of server use TCP (Transmission Control Protocol) over IP (InternetProtocol), it has been brought to my attention that Embarcadero's documentation refers to thesetypes of servers as DBX DataSnap servers.

    The original DataSnap server used COM (Component Object Model) to communicate, and thenew style, introduced in Delphi 2009, uses TCP/IP. Since the COM style of DataSnap server is limitedto Windows installations, and should generally be considered deprecated (though Embarcadero hasnot officially deprecated COM-based DataSnap servers), from this point on I am going to refer to IP-based DBX DataSnap servers simple as DBX DataSnap servers.

    Figure 1. The Data Explorer

    Make sure that Provider Name is set to DATASNAP, and enterthe name of your connection in the Connection Name field. Inthe preceding image, the name IPDataSnapServer has beenentered. Click OK when you are done.You are ready to configure your new connection. Expand theDATASNAP node in the Data Explorer, right clickIPDataSnapServer, and select Modify Connection (Figure 3).

    Figure 2. The Add New Connection dialog box

    COMPONENTSDEVELOPERS 4Nr 2 / 2013 BLAISE PASCAL MAGAZINE

  • 7/25/2019 Blaise 28

    19/30

    smartmobilestudio.com

  • 7/25/2019 Blaise 28

    20/30

    34

    Programming in Smart: Refactoring By Primo Gabrijel i

    A quick reminder: In this series we are looking into theworld of mobile/browser programming in Object Pascalwith the Smart Mobile Studio( www.smartmobilestudio.com ). In the previous twoinstalments (published in issues 25 and 26) we have puttogether a small (and very stupid) To-do application.This time we'll adapt it to Smart 1.1 and refactor thecode so that it will be easier to manage.You can test the application and download the sourcecode athttp://www.gabrijelcic.org/Smart/BlaisePascal /.While restructuring the code I still found time to do somesmall enhancement. In this version, editing is supported(previously you could only add new to-do items), as isitem persistence in the browser's local storage. (For moreinformation on Web local storage, see Wikipedia:http://en.wikipedia.org/wiki/Web_storage#localStorage ).The program appearance (CSS styling) has also beenimproved.

    Structured codeThe ToDoList v3 has been split into several units. I tried to

    separate view and data models from each other but I didn'tfollow any design pattern, such as MVC, MVP or MVVM.On the model side, we have two units. ToDoModel stores adata model while ToDoModelSerializer knows how toserialize and deserialize this model into a textualrepresentation. Persistence layer is implemented in theToDoStorage unit.

    The view (GUI) part contains forms ToDoMain andToDoAbout, frame ToDoCategoryFrame and a modaldialog ToDoTaskDlg. In Smart, frames and dialogs are notnatively supported but we can design them as normalforms which are then used in a special way.Connecting the view and the model is a view-model unitToDoListTemplate which represents one to-do item.

    There are two other units in the program. ToDoList represents the main program (a .dpr file in Delphi) andToDoCommon contains some configurable parameters.I have tried to introduce some order by using hierarchicalnames (ToDo.Model, ToDo.Model.Serializer etc) but Smart1.1 has some problems with hierarchical unit names and Ihad to revert to the naming scheme described above.

    Model

    Let's start our walk through the program with the datamodel. At the moment it is (intentionally) very simple.

    A model class contains a reference to a category list and anitem list. A category list contains just an array of strings(category names) and an item list contains an array of item

    Figure 1: A data model.)

    objects which describe individual to-do items. All modelclasses are implemented as a pure JavaScript objects. Thistype of objects is usually only used for external classes(Pascal classes that serve just as an interface representationof external JavaScript objects) but in this case I have usedthem as normal Pascal-side objects.The reason for using pure JavaScript objects will beexplained in the next section (Serialization).Instead of showing the entire ToDoModel source, I'llconcentrate just on the most important part the list of to-do items.

    typeclass

    publicconstructor

    end

    class

    property public

    stringstring

    string procedure

    end

    class

    array offunction

    public procedure

    function property

    read default

    end

    = ( )

    ; ;

    = ( )

    : ;

    : ; : ; : ; : ; : ; ; ;

    = ( )

    : ; ( : ): ;

    ( : ); : ; [ : ]:

    ; ;

    ;

    JToDoEntity JObject

    Create

    JToDoItem partial JToDoEntityprotected

    OnModified TNotifyEvent

    ID integerTaskDetailPriority integerCategory

    Modified

    JToDoItemLis t part ial JToDoEnti typrotected

    Items JToDoItemGetItem idx integer JToDoItem

    Add item JToDoItemCount integerI tem idx integer JToDoItem

    GetItem

    The JtoDoEntity class is a base for all model classes (exceptthe TToDoModel, which is a normal Pascal class thatbinds all pure JavaScript classes together). It is derivedfrom the JObject pseudo-class which represents basis for allpure JavaScript classes in Smart. As the pure JavaScriptclasses don't contain a default constructor, we have toprovide one. (If you check the code, you'll see that it doesexactly nothing).

    The JToDoItem class represents one to-do list item. It isimplemented as a partial class which means that it canbe extended in another unit. This is necessary because theToDoModelSerializer unit extends it with a serializationsupport.

    The JToDoItemList class represents alist of to-do items. They are stored inan array. In Smart, arrays represent JavaScript arrays and are as suchalmost equivalent to Delphi'sTObjectList in functionality.The full model is exposed as asingleton object of a TToDoModelclass. This class combines the pure JavaScript model with manipulation

    methods and an interface to thestorage system (implemented in theToDoStorage unit).

    COMPONENTSDEVELOPERS 4 Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    http://www.smartmobilestudio.com/http://www.gabrijelcic.org/Smart/BlaisePascalhttp://www.gabrijelcic.org/Smart/BlaisePascalhttp://en.wikipedia.org/wiki/Web_storage#localStoragehttp://en.wikipedia.org/wiki/Web_storage#localStoragehttp://www.gabrijelcic.org/Smart/BlaisePascalhttp://www.smartmobilestudio.com/
  • 7/25/2019 Blaise 28

    21/30

    The complete Package 60,00 (Paperback)MAGAZINE

    Windows installer for Lazarus / Linux for Lazarus / Mac for Lazarus / Lazarus Portable, including aprenstalled Lazarus on an 8 GB USB stick (Click and Go) / 60 additional sample projects / additionalprenstalled component suites on USB Stick / LEARNING TO PROGRAM USING LAZARUS as pdf Blaise Pascal Magazine Library (LIB STICK) - Completed up to all 26 issues / ALL ON USB STICK

    includes a download subscription ofand the book LEARNING TO PROGRAM USING LAZARUS as pdf

    BLAISE PASCAL

    LAZARUSTHE COMPLETE GUIDE

    http://www.blaisepascal.eu

    LEARNING TO PROGRAM USING LAZARUS

    COMBINED PACKAGE

    http://www.blaisepascal.eu/http://www.blaisepascal.eu/
  • 7/25/2019 Blaise 28

    22/30

    42

    The first article in this iOS series explained how to usenative iOS controls in Lazarus, using the form designerto create the layouts (see the previous Blaise issue).

    That article also included a short introduction toFPC's Objective-Pascal language extensions and theObjective-C classes. To exploit the full potential ofnative iOS controls you should use the design patternsthat Apple advocates and on which Apple bases theentire iOS developer kit.

    This second tutorial article illustrates some of thosedesign patterns by showing you how to create a simpleapplication with a tableview.

    By Joost van der Sluisexpertstarter Lazarus 1.1 or higher

    .iOS Development for lazarus Part 2

    COMPONENTSDEVELOPERS 4 Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    Tableviews are one of the most important controls in iOSapplications. They are used to display a list of multipleitems and are eminently customizable. Begin by creating anew iOS application with a UIWindow and drop aUITableView on it. You will probably have to resize theUITableView to see what it looks like.

    You could run the application (in the simulator or on areal device) to see that the tableview remains empty,although at design-time there are some items visible.This is because adding data to your tableview has to bedone in code.

    That's not a missing feature in Lazarus but how Appledesigned it. The items that you see in the designer are justthere to help you get an idea of how the finishedapplication will look.

    type

    publicfunction

    message

    function

    messageend

    = ( ,)

    (

    : ;: ): ;

    ;

    (: ;: ): ;

    ;;

    NSTableViewDelegate objcclass NSObjectUITableViewDataSourceProtocol

    tableView_numberOfRowsInSectiontableView UITableViewsection NSInteger NSInteger

    tableView_cellForRowAtIndexPathtableView UITableViewindexPath NSIndexPath UITableViewCell

    'tableView:numberOfRowsInSection:'

    'tableView:cellForRowAtIndexPath:'

    Note that the class name does not start with a 'T'.That's because in Objective-C (and thus in Objective-Pascal)it is normal to start the class-names with 'NS'.This also makes it easier to differentiate between astandard Pascal class and an Objective-C class. I also calledthe class 'Delegate'. Why this is done is explained later.

    Now you can control-click on the word'UITableViewDataSourceProtocol' to see how it is defined.As you see, the two methods defined above are required,and there are some optional methods.

    I don't discuss these, but you can guess their purposesfrom their names. If you search for them on the net, youwill find thousands of examples, since they are usedheavily in iOS apps.These functions are used identically to the way they areused in Objective-C, except for the different syntax.

    To create the code for the NSTableViewDelegate class, wenow place the cursor within the class definition and pressctrl-shift-c. Adapt the code so that it looks like this:

    { NSTableViewDelegate }

    function

    begin50

    end

    function

    varstring

    begin

    if not then begin

    end if then

    else

    end

    .(

    : ;: ): ;

    := ( );;

    .(

    : ;: ): ;

    : ;

    := .(

    ( )); ( )

    := . .(

    , ());

    . ();

    ; ( . )

    . . ( ( ))

    . . ( ( ));;

    NSTableViewDelegatetableView_numberOfRowsInSection

    tableView UITableViewsection NSInteger NSInteger

    result random

    NSTableViewDelegatetableView_cellForRowAtIndexPath

    tableView UITableViewindexPath NSIndexPath UITableViewCell

    s

    result tableviewdequeueReusableCellWithIdentifier

    NSSTRassigned result

    result UITableViewCell allocinitWithStyle_reuseIdentifierUITableViewStylePlain NSSTR

    result setAccessoryTypeUITableViewCellAccessoryDisclosureIndicator

    odd indexPath Rowresult textLabel setText nsstr

    result textLabel setText nsstr

    'DefTableItem'

    'DefTableItem'

    'Item 1'

    'Item 2'

    So how do we add data to a tableview? To do this youhave to create a datasource and bind it to the UITableView.This datasource is not the datasource you might knowfrom working with default database controls, but anObjective-C class that implements theUITableViewDataSourceProtocol. As explained in theprevious article, a protocol is part of the Objective-Pascalextensions, and is something like an interface with optionalmethods. Thus to create a datasource we have to define ourown objcclass that implements theUITableViewDataSourceProtocol, which requires addingthe following code to your unit (the code can be placed in aseparate unit, but this is not necessary):

  • 7/25/2019 Blaise 28

    23/30

    46 COMPONENTSDEVELOPERS 4 Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    Matching files By Peter van der Sman

    Sometimes when you're browsing the files on yourcomputer you wonder Surely I already have that filesomewhere? Then you also wonder whether the twofiles you have are the same or not. You may have aduplicate-file-finding program somewhere, and thequestion is why you don't use it. Because it is not thatyou never deal with file duplication, but rather that theproblem posed by the existence of matching files tendsto be different every time.

    Usually when I encounter a problem like this I findthe best solution is to implement a customised answerto it myself.

    Recently I had to compare numerous files with eachother, and each time I had the same questions:What is in both files? What is only in file A?What is only in file B?.

    In my case the files were word lists, but the sameproblem arises with membership lists, stamp collectionsand so on. It would be rather handy to have a simpletool designed to resolve exactly this type of problem.To give you an example I wrote two small files based on

    a section of the (Dutch) text of this article. Each filecontains a word-for-word translation (one in English andone in Spanish). The exercise then is how to combinethe two files into a three-language word list.I also introduced some numbers and extra information

    just to make it a bit more complicated and moreinteresting.

    A universal algorithm for file matchingTo compare two text files we can employ the followinguniversal algorithm: 1. Sort both files (FileA and FileB) on the chosen key. 2. Take the first line/record in each file

    (RecA and RecB).

    3. Find the keys in RecA and RecB and compare them.There are three scenarios: a. RecA=RecB: mark that both records match, and

    select the next line in both files b. RecARecB: mark RecB as unique, and select

    the next line in FileB 4. If each file has at least one

    remaining line continue from step 3. 5. If one file has lines

    remaining after completelyworking through the otherfile, mark any vanderSmanremaininglines as unique.

    Thats all there is to it!In principle this approach always works. However it is notalways the most efficient method. For instance, to look upthe value of a stamp in a worldwide stamp database youdont download the whole database, sort it and look for a

    match against your particular item. You would perform aquery on the database to return a single piece ofinformation!

    Note that matching can go wrong for a variety ofreasons. Suppose in a file of names you use only the firstname as a comparison key, then it is obvious that you'relikely to find more than one person named David in yourfile. Without unique key values you'll end up matchingincorrectly.

    Another pitfall is using data files that (perhapsunknown to you) contain errors. In my whole life I havenever met an Englishman who could pronounce my firstname the way it is pronounced in Dutch. They all

    pronounce it in the way we pronounce the first namePieter. So possibly, due to verbal miscommunication, Ican be found as Pieter in some files.

    By the way: commercial databases often containerroneous data of this sort. This is deliberately inserted sothat if the data is used illegally there is clear proof of suchdata theft. When you complain, the company will correctthe error in an updated version, and another Peter willbe renamed to Pieter.

    Another pitfall you will find in using the program withreal data is that files may contain duplicate data(incorrectly and without you being aware of it).In that case the algorithm above will mark one of the twoduplicates as unique!So the moral is: file matching can be enjoyable, but neverblindly trust the results. Always do some checkingafterwards!

    expertstarter Delphi 5 and later

  • 7/25/2019 Blaise 28

    24/30

    48 COMPONENTSDEVELOPERS 4 Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    Motaz Abdel Azeem, who graduated from SudanUniversity of Science and Technology in 1999.

    He is a Software Developer who lives in Khartoum.

    Pat Anderson, who graduated fromWestern Washington State College in 1968 and RutgersLaw School in 1975.

    Jason Hackney, a graduate of WesternMichigan University's College of Aviation.Number of chapters: 4 / Number of Pages: 150

    The list of Contents below is a minimised list, as there areseveral items, such as sample program names, that havebeen excluded to save space for this review;you will understand the issue of minimising once you startreading the Book Review comments further down.

    Introduction to The Object Pascal Language, Delphi, FreePascal and Lazarus - Object Pascal featuresEnvironment for book examples

    Our First ApplicationVariables, Sub types, Conditional Branching, The Ifcondition, Case .. of statement, Loops, For loop, Factorialprogram, Repeat Until loop, While loop, Strings, Copyfunction, Insert and Delete procedures, Trim function,

    StringReplace function, Arrays, Records, Files, Text filesRandom access files, Typed files, File copying, Date andTime, Date/time comparison, Constants, Ordinal types,Sets, Exception handling, Try except statement, Raise anexception

    Procedures, Parameters, Functions, Local VariablesFunctions as input parameters, Procedure and functionoutput parameters, Calling by reference, Units in Lazarusand Free Pascal,

    Start Programming using ObjectPascal - Free Pascal/Lazarus Book

    Author:

    First Editor:

    Second Editor:

    Introduction

    Contents

    Chapter One - Language Basics

    Chapter Two - Structured Programming

    Calendar, Procedure and functionOverloading, Default value parameters, Sorting - severalmethods and samples

    Two initial GUI (Graphical User Interface) applications,plus a ListBox,Text Editor and News Applications

    First example: Date and TimeNews application in Object Oriented Pascal, QueueApplication, Object Oriented File, Copy files usingTFileStream Inheritance

    Chapter Three - The Graphical User Interface

    Chapter Four - Object Oriented Programming

    BThis is a quotation of the book's introductory paragraph:

    IntroductionThis book is written for programmers who want to learnthe Object Pascal Language. It is also suitable as a firstprogramming book for new students and non-programmers. It illustrates programming techniques ingeneral in addition to the Object Pascal Language."

    The above opening paragraph is a relevantly short andaccurate description of what this book is all about: shortand accurate, as the idea behind the book is to getnewcomers straight into Pascal programming via minimalinitial documentation, plus a very quick and easygeneration of their first program.

    The first set of instructions in the Contents section"Environment for book examples" says: "We will useLazarus and Free Pascal for all the examples in this book.You can get the Lazarus IDE, including the Free Pascalcompiler, from this site: http://lazarus.freepascal.org ." A

    few other points are raised regarding usage of Linux,Ubuntu or Fedora, but for my purposes to follow theinstructions I merely had to click on the Lazarus link,download and install it under Windows 7. Hopefully, theaverage newcomer in this day and age would be able tofollow such instruction easily and get through in a veryshort time without any problems. Step one of two to getstarted completed.

    In many books or demonstrations of Pascal systemscontaining a productive GUI, updates or otherenhancements, the first sample is usually a GUI based"Hello World". However, in this book, the first part isexplained and demonstrated via console applications in

    text mode/command lines, while the GUI and ObjectOriented sections come in as the second part.Once past the Introduction and table of Contents, the

    starting part of the first page of Chapter One contains thissample:

    ook Review

    Book Review By James D (Jim) Duff

    http://lazarus.freepascal.org/http://lazarus.freepascal.org/
  • 7/25/2019 Blaise 28

    25/30

    Bob Swart's courseware manuals are used in training and programming workshops around the world. You can obtain Bob'sbooks from Blaise Magazine as individual PDF files which are updated over the following 12 months for f ree. For instance,currently each PDF contains screenshots based on Delphi XE2 features, but an XE4 update will will be available shortly. So ifyou buy a courseware manual now, in a few months (without further payment) you will receive an XE4 download editionenlarged to cover the new features of Delphi XE4, in which Bob gives details about iOS, DataSnap and XML/SOAPdevelopment.

    Bob Swart's Delphi Courseware books

    Delphi iOS DevelopmentThis book is about configuring your Delphi and Mac OS X environments so you can design, compile, debug and deployiOS applications. The book includes extensive discussion of the database and multi-tier (DataSnap) potential of iOS

    dev elopment.See which lists the table of contents for the current XE2 edition.http://www.drbob42.com/courseware/56/56.pdf

    Delphi DataSnap DevelopmentThis book shows you how to design, build, compile and deploy multi-tier DataSnap applications using Delphi XE2, andinclu des sections on DBX and REST techniques.See which lists the table of contents for the current XE2 edition.http://www.drbob42.com/courseware/53/53.pdf

    Delphi XML, SOAP & Web ServicesThis manual explains XML Document Programming and how to use SOAP Web Service techniques in Delphi, includingcove rage of SOAP Servers as Clients.See which lists the table of contents for the current XE2 edition.http://www.drbob42.com/courseware/52/52.pdf

    Each book costs 99 euros (excluding VAT). You can order any of these books at this price by sending an emailto [email protected] Please give the name and email address of the developer who will be using the orderedbook(s), and specify clearly the titles of the PDF files you are ordering. You will also receive a DelphiDev elopment Essentials PDF as a free bon us with your order!See or for more details.http://www.bobswart.com/courseware http://www.eBob42.com/courseware

    subscribers having a magazine download subscription will be given a 10 euro discounton their order. Subscribers having a printed magazine subscription will be given a 20euro discount. This discount is offered per subscriber (not per book), so irrespective of thenumber of Courseware books ordered, each subscriber will given a single 10 or 20 discount forthe one order only. To or der via Blaise Pascal Magazine you can contact Detlef Overbeek at

    for delivery within 48 [email protected]

    42eBob42.com

    Special announcement: Bob Swart in collaboration with BLAISE PASCAL MAGAZINE:

    http://www.drbob42.com/courseware/56/56.pdfhttp://www.drbob42.com/courseware/56/56.pdfhttp://www.drbob42.com/courseware/56/56.pdfhttp://www.drbob42.com/courseware/53/53.pdfhttp://www.drbob42.com/courseware/53/53.pdfhttp://www.drbob42.com/courseware/52/52.pdfhttp://www.drbob42.com/courseware/52/52.pdfmailto:[email protected]://www.bobswart.com/coursewarehttp://www.ebob42.com/coursewarehttp://www.bobswart.com/coursewarehttp://www.bobswart.com/coursewarehttp://www.ebob42.com/coursewaremailto:[email protected]:[email protected]:[email protected]://www.ebob42.com/coursewarehttp://www.bobswart.com/coursewaremailto:[email protected]://www.drbob42.com/courseware/52/52.pdfhttp://www.drbob42.com/courseware/53/53.pdfhttp://www.drbob42.com/courseware/56/56.pdf
  • 7/25/2019 Blaise 28

    26/30

    52 COMPONENTSDEVELOPERS 4 Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    DBX Clients

    DataSnap DBX Server

    Delphi XE2 with Update #4 offered the ability to use theMobile Connectors to write DataSnap Clients for mobiledevices using the REST protocol (because many of theclients were written in other languages like Java, C# orObjective-C). We could also use FireMonkey for iOS incombination with the FreePascal Compiler to writeDataSnap clients for iOS using REST. But this technique isnow outdated.With Delphi XE4, we are no longer limited to REST andHTTP, but can also communicate using DBX and TCP/IP.This is great news, since DataSnap DBX is a more powerfularchitecture than the DataSnap REST capabilities (asexplained in more detail in my DataSnap Developmentcourseware manual).

    In this article, I will quickly build a DataSnap DBX Server,and spend most of the time using Delphi XE4 to build aniOS client for this DataSnap Server.

    To build a DataSnap DBX Client, we first need to have aDataSnap DBX Server, which is a simple matter of usingthe New DataSnap Wizard.

    Select a VCL Forms Application, in the next page makesure to select TCP/IP (and use the default port 211,although I would recommend to change that port numberto a different number when you want to deploy theapplication). Select a Server Method Class with SampleMethods, and change the TComponent ancestor type toTDSServerModule (so we can call ApplyUpdates whenneeded).Save the project, using the generated filenames (althoughyou can save the main form in MainForm.pas instead ofUnitXXX.pas).On the Server Methods unit, we will now place some dataaccess components to connect to a database. In thisexample, I'll use InterBase, but we can also use any otherdatabase of course. Place a TSQLConnection component onthe ServerMethodsUnit1. Set the Driver property toInterBase Server (or another value, if you want to useanother database). Set the LoginPrompt to False, and theDatabase to C:\Users\Public\Documents\RADStudio\11.0\Samples\Data\EMPLOYEE.GDB (or the

    location of the EMPLOYEE database on your machine).Now, in order to validate the settings, we can setConnected to True. If this works (without errors), makesure to set it back to False again.

    Next, place a TSQLDataSet next to the TSQLConnection.Point the SQLConnection property to the TSQLConnectioncomponent, and enter the following SQL in theCommandText property:

    SELECT FIRST_NAME, LAST_NAME, FULL_NAME,HIRE_DATE FROM EMPLOYEE

    In order to test the SQL, set Active to True (and back toFalse again, after which you also need to set the Connected

    Delphi XE4 iOS DataSnap Clients

    Delphi XE4 was released a little while ago, andcontained one big feature compared with DelphiXE3: the support for iOS development.Technically, this feature is only available in the

    Enterprise edition (or when you purchase theMobile Development AddOn package), so thisarticle will be of less "use" for people who onlyhave the Professional edition of Delphi.

    expertstarter Delphi XE4 and later

    property of the TSQLConnectionback to False again I'm afraid).Now, place a TDataSetProvider onthe Server Methods unit, points itsDataSet property to theTSQLDataSet, and change thename of the TDataSetProvider to asensible name (one that will makeit clear to "clients" what data theycan expect). For our example, I'vechanged the name todspEmployee, which results in the

    following overview of the ServerMethods Unit at design-time:

    By Bob Swart (DrBob)

  • 7/25/2019 Blaise 28

    27/30

    54 Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    Finally, we need a TClientDataSet component. Set theRemoteServer property to the TDSProviderConnectioncomponent, and then open up the ProviderName property.If you did not make a mistake along the way (for examplewith the ServerClassName property of theTDSProviderConnection component), then you will nowsee the one and only choice dspEmployee in the drop-down listbox. Select that one.Set the Active property of the TClientDataSet to True, toverify that we can connect to the DataSnap Server andretrieve the data.

    After you've set Active back to False, make sure to set theConnected property ot the TSQLConnection componentalso back to False again. This will ensure that the iOSDataSnap Client does not make a connection when youopen the project (or when you run the app itself). We willadd some code to connect to the DataSnap Server andretrieve the data in a minute.

    Now all we need to place the data, is a TListBox forexample. Set Align to Client, to it will take the spacebetween the Header and Footer.

    Place a TButton component on the Footer, set the Textproperty to Open, the Name property to btnOpen, andwrite the following code in the OnClick event handler:

    procedure

    begin

    end

    . ( :);

    ( );;

    THeaderFooterForm btnOpenClick SenderTObject

    ShowMessage 'test'

    Before we can deploy the application, we need to ensurethat the MIDAS library is also included. On Windows, thisis of course already taken care of using the MIDAS.DLL or- even more effective - the MidasLib unit. But for OSX orthe iOSSimulator, we need to explicitly check the MIDASLibrary.

    Do Project | Deployment, to view the deployment page.Then, click on the 4th speedbutton from the left (to addfeature files), and in the dialog that follows, check theiOSSimulator option for the MIDAS Library.

    Then, close the dialog, compile and run the DataSnapClient application from the IDE. It will show up in theiOSSimulator on your Mac. We can click on the Button (onthe Footer) to get the OnClick event.

    The final test involves opening the TClientDataSet, andentering the data into the TListBox. This can be done bymodifying the OnClick event handler as follows:

    Delphi XE4 iOS DataSnap Clients (Continuation 2)

    COMPONENTSDEVELOPERS 4

  • 7/25/2019 Blaise 28

    28/30

    Good news for startes

    has publishd a book in Englishaimed at people who are just setting

    out to learn to code.It is called

    Learn to Programusing Lazarus 1.0,

    and is written by Howard Page-Clark,our editor, corrector

    and writer of many articles

    Among the many topics introduced are:Pascal types, the Lazarus IDE,

    Coding discipline,GUI editing components,Pascal files and streams,

    Object oriented principles,debugging techniques.

    As Loose Leaf Book 35 plus postage 17,50

    As PDF File 25 no postage

    50

    LEARN TO PROGRAMUSING LAZARUS 1.0

  • 7/25/2019 Blaise 28

    29/30

    APACHE FLEXVIA kbmMWSPIDER/FLEX

    JAVAVIA kbmMWSPIDER/JAVA

    C/OBJ.CVIA kbmMWSPIDER/C

    PHPVIA kbmMWSPIDER/PHP

    .NETVIA kbmMWSPIDER/.NET

    DELPHI / C++ BUILDER OS X / iOS /WIN 32 /WIN64

    VIA THE kbmMW STANDARDTRANSPORT

    SOAPVIA kbmMWSOAPTRANSPORT

    KBMMW

    APPSERVER

    DATABASESERVER

    DATABASESERVER

    DATABASESERVER

    XMLVIA kbmMWAJAXTRANSPORT

    HTTPVIA kbmMWAJAXTRANSPORT

    HTTPSERVER

    PC

    57COMPONENTSDEVELOPERS 4Nr 2 / 2013 BLAISE PASCAL MAGAZINE

    Intro to kbmMW connectivity package 'Spider'

    kbmMW supports a number of native clients under thecodename Spider.It contains clients for kbmMW enabling direct accessfrom the following platforms:- .Net on desktop and server- .Net on Compact Framework

    (Microsoft PocketPC/Mobile 2003 and up)- Java Standard Edition- Java Enterprise Edition- C/C++ on many different platforms- PHP on Windows- PHP on Linux- OCX for access to kbmMW application servers from

    for example Microsoft Office, CodeFusion and otherframeworks supporting OCX.

    - Adobe Flex

    All clients come with full source and comprehensivedocumentation, giving you not only comprehensive detailsof the functionality, but also how to install and compile thecode.It is bundled with the kbmMW Enterprise editionand installs in the kbmMW folder but it can be purchasedas a separate download.

    .NET versionThe kbmMW C# client library contains native C# basedclasses that allow a developer to access a kbmMWapplication server, in a similar way as usingTkbmMWSimpleClient with a traditional request/responsetransport like TkbmMWTCPIPIndyClientTransport.

    The library is compatible with both .Net StandardFramework and .Net Compact Framework.You probablyalready know that in order to use .net version you aresupposed to have .net framework and SDKinstalled, and.Net CF SDK if you need compact framework capability. In\{app}\dotNet\bin you can find pre-compiled binaries.

    The pre-compiled assemblies can then be installed orreferenced from all .Net development environments, andmust be copied to end user machines when deploying anapplication relying on the kbmMW C# client library.

    The library contains several classes which generally aremodelled according to the same structure asthe main Delphi kbmMW client classes

    A basic setup requires an instance ofTkbmMWTCPIPTransport and TkbmMWSimpleClient. Eg.

    By Fikret Hasovic

    4.21 Contains many new features, including a newhigh performance RTTI based object marshallingmechanism, making it extremely easy to serializecomplex objects with their dependencies to andfrom XML. Remote Desktop has been updated to v.2 and further improves performance and usability.As always the full source for Remote Desktop isincluded with kbmMW Enterprise Edition.

    XE4 is about to be supported, with IOSsupport expected too.

    expertstarter

    Delphi 2009 and later

  • 7/25/2019 Blaise 28

    30/30

    4.21 Contains many new features, including a newhigh performance RTTI based object marshallingmechanism, making it extremely easy to serializecomplex object with their dependencies to andfrom XML. Remote Desktop has been updated to v.2 and further improves performance and usability.As always the full source for Remote Desktop isincluded with kbmMW Enterprise Edition.

    For kbmMW there are multiple new items: RemoteDesktop Client/Server/Proxy Support, NEWJSON support, JSON streaming of kbmMemTabledatasets, bugfixes and more. Improved HTMLtemplate support , improved Cookie Support etc.

    Lots of improvements related to using kbmMW as aweb server producing dynamic web pages.kbmMemTable on Win64.

    Tests done:10 million records in memorywith multiple fields and indexes... XE4 is about to be supported, with IOS supportexpected too.

    New V4.21 available for DELPHI 2009 up to XE4 -32 and 64On iPad and iPhone Full kbmMW support (client and server)

    Looking into a bright future

    The Delphi Starter Edition now also has theability to do multi tier development for no cost at all.

    The andprovides access to SQLite in addition to the standardDelphi Starter Edition database connectivityframeworks, BDE and IBExpress .

    Delphi Starter Edition also lacks proper XML supportand the local TClientDataset , which is

    Pro/Ent is available for Win32/Win64/OSX/FPC.CodeGear Edition is for Delphi XE2 / Win32 only

    also to befound as part of kbmMW Code Gear Edition inthe form of TkbmMWDOMXML and the highp e r f o r m a n c e T k b m M e m T a b l e .In addition its possible to upgrade to kbmMemTable Standard Edition for only US$30.The upgrade includes full source for kbmMemTable, and includes kbmSQL which provides a SQLfrontend to kbmMemTable.

    COMPONENTS

    DEVELOPE