Showing posts with label firemonkey. Show all posts
Showing posts with label firemonkey. Show all posts

Thursday, May 28, 2020

Delphi 10.4 Sydney is here!

Hi folks,

Delphi 10.4 Sydney has just released and this version comes with a lot of interesting features:

    • New Delphi CodeInsight based on LSP server
    • Custom Managed Records in the Delphi Language
    • New VCL Components, including TEdgeBrowser, and expanded High DPI support for VCL styled applications
    • Enhanced Delphi multi-device platform support integrating newer Apple APIs and supporting the latest Android
    • New LLDB-based debugger for Windows 64-bit for C++
    • Unified installer for online & offline installations
    • GetIt Package Manager Enhancements


            I would like to spend few words around the features that impressed me:


            Code Insight Technology in Delphi 10.4

            From David Millington blog post:

            In 10.4, Code insight features are implemented using a ‘LSP Server’. LSP refers to the Language Server Protocol, which is a standardized way to implement code insight-like features for many languages. An IDE talks to a ‘language server’, which is a small helper app that calculates and generates the information the IDE displays. It does so using a defined protocol, and that’s the language server protocol.

            In other words, the IDE now talks to a helper app when you do something like open a project, or type a keystroke in your file.

            What does it means?
            • Communication with another process is asynchronous
            • The work is done in another process
              • This means all the memory usage for calculating results is no longer in the IDE itself. The IDE has more memory, and the helper app can use its entire memory space dedicated solely to providing results
            • What you see onscreen is what the compiler sees. 
              • If your code compiles, you won’t see any Error Insight errors; conversely, if you do see red squiggly underlines in your code or in the Structure view, your code will not compile.
            • You can get code completion while debugging.

            If you want to know more about it have a look to David Millington post 


            Custom Managed Records 

            This is absolutely the top new language feature of Delphi 10.4!

            Now in 10.4 the Delphi record type supports custom initialization and finalization:

            From Marco Cantù blog post:

            You can declare a record with custom initialization and finalization code regardless of the data type of its fields, and you can write such custom initialization and finalization code.
            This is achieved by adding specific, new operators to the record type (you can have one without the other if you want).
            Below is a simple code snippet:

            type
              TMyRecord = record
                Value: Integer;
                class operator Initialize (out Dest: TMyRecord);
                class operator Finalize(var Dest: TMyRecord);
              end;


            The huge difference between this construction mechanism and what was previously available for records is the automatic invocation. If you write something like the code below, you can invoke both the initializer and the finalizer, and end up with a try-finally block generated by the compiler for your managed record instance.

            Marco Cantù post to know more.


            GetIt Package Manager Enhancements

            GetIt Package Manager Enhancements in Delphi 10.4:
            • the ability of sorting the list of entries by date, seeing the most recent ones on top
            • for each entry you have already installed, the indication that an updated version is available
            • the ability to list all installed entries that have an update available

            Rad studio patches

            A killer feature of the new GeIt is absolutely the ability to use GetIt to distribute patches, with a specific way to alert customers that a patch is available. There is a new section to the Welcome page to indicate when a patch is available and you have not installed it:


            Here a screenshot of Rad Studio patches in action:

            As you can see there is already a patch available through GetIt, this will completely revolutionize the patches distribution!

            Webinar Delphi 10.4

            Here the link for the launch webinar - https://www.youtube.com/watch?v=-rTLEXLVueQ&feature=youtu.be - Enjoy it!


            Other useful resources 


            As you can see from the info above this is a fantastic release! Enjoy it!


            Monday, August 6, 2018

            Delphi Cookbook - Third Edition

            This book is the 3rd edition of the Delphi Cookbook serie: Delphi Cookbook is a best sellers for PacktPub (the editor) in its category, so the editor decided to ask me a 3rd edition in co-authorimg with Daniele Teti (author of the 2 previous versions). So here it is!

            What's new

            In this third edition we wanted to add content to keep the book updated with emerging technologies and new features made available by Delphi: there are 2 chapters completely new, one for Linux Development and one for Integration with IoT, added useful chapters on FireDAC and RTTI attributes. Furthermore, this edition contains all the recipes from the previous editions updated to the new Delphi 10.2 Tokyo: reaching 780 pages for 78 recipes!

            This book today lets you learn all the development possibilities offered by Delphi: cross-platform (Firemonkey), mobile applications (Android and iOS), server-side programs (Linux and Windows), integration with IoT, working with data (FireDAC, JSON, XML) and so on...

            Topics of the book

            • Develop visually stunning applications using FireMonkey
            • Deploy LiveBinding effectively with the right OOP approach
            • Working with data (JSON, XML)
            • Design, develop and deploy server-side programs to serve RESTful web services (Linux and Windows) and provide data to your mobile apps
            • Use well-defined GUI design patterns to build mobile applications that provide a great user experience
            • Extremely useful recipes on FireDAC database access framework
            • Build mobile apps that read data from a remote server efficiently
            • Call the platform native API on Android and iOS even for an unpublished API
            • Manage software customization for your customer by making better use of an extended        RTTI
            • Implement the most popular design pattern without wasting too much time on debugging and bug fixing
            • Enrich your knowledge of Delphi deepening the libraries made available
            • Integrate your applications with Internet of Things

            It is not an introductory book, you will not find any “Introduction to the Object Pascal language”, however the majority of the chapters are not too complex and can be grasped also by the new Delphi programmers.

            Another interesting thing is that thanks to the release of the Delphi Community Edition (you do not know what it is ?? go here ...) all chapters except chapters 6 and 7 can be addressed through the use of this free version. For chapters 6 and 7, as it is Linux and server-side development, the Enterprise version of Delphi is required.

            Where to buy

            The book is available for sale on the editor website and on Amazon.

            PacktPub (Official book page)


            Amazon


            GitHub repo for recipes code


            Table of contents


            Chapter 1: Delphi Basics

            • Changing your application's look and feel with VCL styles
            • Changing the style of your VCL application at runtime
            • Customizing TDBGrid
            • Using owner-draw combos and listboxes
            • Making an owner-draw control aware of the VCL styles 
            • Creating a stack of embedded forms 
            • Manipulating JSON 
            • Manipulating and transforming XML documents 
            • I/O in the 21st century – knowing the streams 
            • Creating a Windows Service 
            • Using the TService.LogMessage method 
            • Be coherent with the Windows look and feel using TTaskDialog 
            • The amazing TFDTable – indices, aggregations, views, and SQL 
            • ETL made easy – TFDBatchMode 
            • Data integration made easy – TFDLocalSQL 


            Chapter 2: Becoming a Delphi Language Ninja 

            • Fun with anonymous methods – using higher-order functions 
            • Writing enumerable types 
            • Using enumerable types to create new language features 
            • RTTI to the rescue – configuring your class at runtime 
            • Duck typing using RTTI 
            • BOs validation using RTTI attributes 
            • Creating helpers for your classes 


            Chapter 3: Knowing Your Friends – The Delphi RTL

            • Checking strings with regular expressions 
            • Consuming RESTful services using native HTTP(S) client libraries 
            • Coping with the encoded internet world using System.NetEncodings 
            • Saving space using System.Zip 
            • Decoupling your code using a cross-platform publish/subscribe mechanism


            Chapter 4: Going Cross-Platform with FireMonkey

            • Giving a new appearance to the standard FireMonkey controls using styles 
            • Creating a styled TListBox 
            • Impressing your clients with animations 
            • Using master/details with LiveBindings 
            • Showing complex vector shapes using paths 
            • Using FireMonkey in a VCL application 
            • Reinventing your GUI, also known as mastering Firemonkey controls, shapes, and effects 


            Chapter 5: The Thousand Faces of Multithreading

            • Synchronizing shared resources with TMonitor 
            • Talking with the main thread using a thread-safe queue 
            • Synchronizing multiple threads using TEvent 
            • Communication made easy with Delphi Event Bus 
            • Displaying a measure on a 2D graph like an oscilloscope 
            • Using the Parallel Programming Library in the real world: Tasks 
            • Using the Parallel Programming Library in the real world: Futures 
            • Using the Parallel Programming Library in the real world: Parallel For/Join 


            Chapter 6: Putting Delphi on the Server 

            • Developing web client JavaScript applications with WebBroker on the server 
            • Converting a console application into a Windows service 
            • Serializing a dataset to JSON and back 
            • Serializing objects to JSON and back using RTTI 
            • Sending a POST HTTP request for encoding parameters 
            • Implementing a RESTful interface using WebBroker 
            • Controlling remote application using UDP 
            • Using app tethering to create a companion app 
            • Creating DataSnap Apache modules 
            • Creating WebBroker Apache modules 
            • Using native HTTP(S) client libraries 
            • Logging like a pro using LoggerPro 


            Chapter 7: Linux Development 

            • Creating Linux TCP/IP servers
            • How to correctly handle Linux signals
            • How to build a modern Linux daemon 
            • Building a TCP/IP Linux server and daemonizing it 
            • Building a RESTFul server for Linux 
            • Building a complete RESTful server with database access and web client interface 
            • Creating WebBroker Apache modules for Linux 


            Chapter 8: Riding the Mobile Revolution with FireMonkey

            • Taking a photo, applying effects, and sharing it 
            • Using TListView to show and search local data 
            • Using SQLite databases to handle a to-do list 
            • Do not block the main thread! 
            • Using a styled TListView to handle a long list of data 
            • Customizing the TListView 
            • Taking a photo and location and sending it to a server continuously 
            • Talking with the backend 
            • Making a phone call from your app 
            • Tracking the application's life cycle 
            • Building your own SMS sending service with the REST API 


            Chapter 9: Using specific platform features

            • Using Android SDK Java classes 
            • Using iOS Objective-C SDK classes
            • Displaying PDF files in your app 
            • Sending Android Intents 554
            • Letting your phone talk – using the Android TextToSpeech engine 
            • Using Java classes in Android apps with Java2OP 
            • Doing it in the background, the right way – Android services 


            Chapter 10: Delphi and IoT 

            • How to blink an LED using Arduino 
            • How to drive multiple relays with Arduino and Delphi
            • Reading data from Arduino 
            • How to blink an LED using Raspberry Pi 
            • How to drive multiple relays with Raspberry Pi and Delphi 
            • Reading data from Raspberry PI 

            Tuesday, April 11, 2017

            Delphi and Firebase: Remote configuration

            Hi all,
            as you know Firebase is a backend service that include a data storage service. One of common example of this kind of service is Remote Configuration, that allows you to change the behavior or appearance of your app (ex. change the welcome message of your app) without changing the app source code.
            I've just updated the Firebase4Delphi repository with a new demo : RemoteConfigDemo.
            In this demo I implemented a mechanism to allow to change the behavior and appearance of your app without publishing an app update.
            The process is very simple, you have to:
            1. create a JSON Object in your console project that represents the app configuration
            2. Wraps that configuration in your app
            3. Check when configuration change and communicate it to your app
            In this demo you have the possibilities to change the style of your application, according to OS, at run time.

            Firebase Console 

            AquaGraphite.style configured at run-time
            RubyGraphite.style configured at run-time




            ASAP I'll post a short video to show the power of this feature.

            Friday, March 24, 2017

            One codebase to rule them all - RAD Studio 10.2 Tokyo is here!

            Finally, it's arrived!! The penguin invasion has started! RAD Studio 10.2 Tokyo is here bringing with it support for Linux!
            Delphi for Linux is now available delivering support for Linux 64bit server-side and standalone applications for Ubuntu and RedHat Enterprise. Guys, I'm very enthusiastic about this new support! This is a very greats news for Delphi developers and not, everywhere!


            By now Delphi can support and generate native code for several platforms (7 to be exact!!!): Linux (64bit), Windows (x86 and x64), OS X (32-bit ), iOS (32 and 64-bit) and Android.
            I think that no citation may be more appropriate of this:
            one codebase to rule them all
            Below a list of the most interesting features available in this release (IMHO):

            Delphi Linux Compiler


            • 64-bit Linux platform support
            • Delphi language support
            • ARC-enabled
            • 1-based strings
            • LLVM engine based

            Supported Linux Distributions


            • Ubuntu Server (Ubuntu 16.04 LTS)
            • RedHat Enterprise Linux (version 7)

            RTL features supported


            • Linux file system access
            • Threading and Parallel Programming Libraries support
            • Memory management
            • HTTP and REST libraries support for HTTP calls

            64-bit Linux for Server Applications


            • FireDAC provides Linux support for all Linux-capable DBMS, with the only exception of Informix. See Database Connectivity.
            • WebBroker, RAD Server (EMS), and DataSnap support for Multi-tier servers (standalone and Apache modules).
            • DUnitX support.
            • PAServer support.
            • Indy-based client and server support.

            FireMonkey


            • New System Status Bar Options on iOS
              • Two new properties have been added to TForm for changing the behavior of the system status bar on iOS: SystemStatusBar.BackgroundColor and SystemStatusBar.Visibility.


            • Multi-Threading Support for TBitmap, TCanvas and TContext3D
            • Unification of Delphi and Java threads on Android: CallInUIThread has been deprecated. All code is now running in the Java UI Thread, removing the need for thread synchronization

            Improvements for Firebird


            • New Direct property to add support for the Direct I/O backup feature.

            Improvements for MySQL

            • Support for MySQL v 5.7.
            • Support for MariaDB v 5.5 or later. Use FireDAC's MySQL node to connect to MariaDB.
            • Compatibilty with the recent MySQL versions 5.6.x and 5.7.x.

            Database improvements


            • VCL TDBImage direct support for JPEG and PNG graphic formats.
            • Support for display options for BlobFields.
            • Direct GUID access for TField classes.

            RTL


            • HTTP Client
            • HTTP Client Library provides support for 64-bit Linux.
            • Improved async support in HTTP client
            • RTL support for 64-bit Linux
            • RAD Studio 10.2 Tokyo provides Linux file system support using standard system functions, streams, and the IOUtils unit. It also provides Standard RTL Path Functions support for 64-bit Linux.

            Improved C++ packages for mobile

            RAD Studio 10.2 Tokyo links C++ packages for iOS and Android statically. Previous versions of RAD Studio generated a file with the .so extension for C++ packages, but were not actually dynamic libraries. RAD Studio 10.2 Tokyo generates C++ packages with the correct file extension (.a). If you statically link against a .so package, you may need to change to link against the new filename.

            RAD Server Multi-Tenancy Support

            With Multi-Tenancy support, a single RAD Server instance with a single RAD Server database connection can support multiple isolated tenants. Each tenant has a unique set of RAD Server resources including Users, Groups, Installations, Edge Modules, and other data. All tenants have custom resources that are installed in the EMS Server. Also, as an administrator you can create new tenants, edit existing ones, add, edit, or delete details of your tenants, specify if the tenant is active, and delete the tenants that you do not need.

            iOS 10 Simulator, device, and macOS

            Full support for iOS 10, including iOS 10 32-bit and 64-bit debugging on device, Simulator support (Delphi only) and macOS Sierra support.

            The news are not only these, for the complete list of all news of this release go here.

            Sunday, February 19, 2017

            How-To implement 2 finger pan gesture in Delphi Firemonkey

            In Firemonkey, as you know, there is a great support for gestures: standard and interactive. The most important interactive gestures as Zoom, Pan, Rotate, DoubleTap (with an amazing description in dockwiki ), etc... are provided by the framework. See here for a full documentation. In a recent project I had the need to implement 2 finger pan gesture, that is not present in the provided gestures. But Firemonkey is a very great framework, and you can implement an event handler to manage custom actions when OnTouch occurs to specify what happens when a user touches the form using a finger or a similar device (not a mouse). So I wrote a little snippet of code that simulate the 2 finger pan gesture, I created a new demo and moved it into my Delphi Demos repository on Github.
            I tried it on Android and works fine and very smoothly. It should works fine on all Firemonkey supported platforms: Windows, Android, iOS and OSX.

            Saturday, June 18, 2016

            Simple chat messaging system with Delphi and Firebase

            Hi all,
            some time ago I posted about my open source project: Firebase4Delphi. Well, Firebase was acquired by Google and in Google I/O 2016 was showed very interesting news and new features (more info here ). My project provide a REST facade to consume FIREBASE RealTime Database API.
            The Firebase Realtime Database is a cloud-hosted database. Data is stored as JSON and synchronized in realtime to every connected client. When you build cross-platform apps with our iOS, Android, and JavaScript SDKs, all of your clients share one Realtime Database instance and automatically receive updates with the newest data. - Firebase Realtime Database Documentation
            In my project there is a sample application about a Chat messaging system. If you enjoy Firebase program (https://console.firebase.google.com/), you are able to create your first Firebase project! See the online documentation to undestand how Firebase works.
            Once you create your application you can start to use the Chat Messaging sample, it's very easy if you follow these steps:
            1. Create a clone of Firebase4Delphi project (or download it)
            2. Open Firebase4DelphiChatDemo.dproj
            3. Deploy the app on your favorite Target Platoform (Windows, Mac, Android, iOS)
            4. Once application started, put in the settings tab (Fig 1) the URL provided by Firebase Realtime Database related to your project (Fig 2) , adding the demo name "chatdemo" as REST parameter
            5. Choose a username
            6. Click Start Chat button
            Fig 1:

            Fig 2:

















            Monday, February 29, 2016

            DEB an Event Bus framework for Delphi

            Hi all,
            I have just started a new open source project: Delphi Event Bus a.k.a. DEB. As the title suggest DEB is an event bus framework based on publish/subscribe mechanism. It was inspired by EventBus framework for the Android platform.

            How it works

            DEB is designed to decouple different parts/layers of your application while still allowing them to communicate efficiently. The really exciting feature of this framework is that you can choose the delivery mode of the events: in the Main Thread or a Background thread.



            Simply put the Subscribe attribute on your subscriber method you are able to receive a specific event, and by specifying the TThreadMode in attribute you can choose the context where to deliver the event.
            For example, if you have to interact with the UI EventBus can deliver events in the main thread or If your subscriber does long running tasks (HTTP request), EventBus can also use background threads to avoid UI blocking. Regardless where an event was posted the EventBus will manage Thread synchronization, so you can deliver an Event in the MainThread and the subscriber will receive it on a background thread and viceversa.

            Show me the code


            Support

            • DEB is a 100% ObjectPascal framework so it works on VCL and Firemonkey
            • It works with DelphiXE7 and major
            • It should be works fine also on AppMethod

            Currently, the project consists in a simple getting started guide, 2 great samples and a suite of unit tests. There is a lot of work to do, so any contributor is welcome. The project is hosted on github and here there is the link. I hope you are excited as much as I am about this project!

            Stay tuned!

            Thursday, October 9, 2014

            Automate Save State Feature in Firemonkey

            Hi!
            One of the many exciting new features of Delphi XE7 is the Save State in Firemonkey.
            The FireMonkey Save State feature allows you to save data describing the state of the application before it closes. The Save State data can be used to recover the state after the application is restarted.
            This is a very cool feature but the way in which you save and restore the data is not so refined (for more info see this http://docwiki.embarcadero.com/RADStudio/XE7/en/FireMonkey_Save_State ).
            What happen if I need to save 10,15 or more components? I need to specify the save and the restore for each one.
            So I decided to write a class helper to automate this process!
            Using JSON serialization all the components of type TFMXObject are saved. In particular is stored the Data property.

            You can find the demo in my github repository .

            This is a snippet of the demo

            uses SaveStateHelper;
            
            procedure TForm1.FormCreate(Sender: TObject);
            begin
              LoadFormState;
            end;
            
            procedure TForm1.FormSaveState(Sender: TObject);
            begin
              SaveFormState;
            end;
            

            I hope you enjoy it!!