Noutați

Quick Introduction To FireDAC And Its Features For Building Robust Delphi/C++ Builder Database Applications.

FireDAC is a powerful, yet easy-to-use access layer that supports, abstracts, and simplifies data access, providing all the features needed to build real-world high-load applications. FireDAC provides a common API for accessing different database back-ends, without giving up access to unique database-specific features and without compromising on performance. Use FireDAC in Android, iOS, Windows, and Mac OS X applications you are developing for PCs, tablets and smartphones. FireDAC Design Objectives and Architecture : FireDAC enables native high-speed direct access from Delphi and C++Builder.  Provides Universal Data Access i.e) Application built for a single data base can be used for other databases with very minimal changes at configuration. Highly configurable, using this you can fine tune your data access and it is important how your Software access with databases. Simple to deploy as no specific driver required, along with executable it is built. FireDAC local/embedded connectivity to certain local databases, including Microsoft Access database, SQLite database, InterBase ToGo / IBLite, InterBase on localhost, MySQL Embedded, MySQL Server on localhost, Advantage Database local engine, PostgreSQL on localhost, Firebird Embedded, and Firebird on localhost. Full source code provided, Developers can understand the underlying design and source code. Compatibility with the BDE means easy migration of legacy applications with reFind Utility. FireDAC Architecture Supported Database : InterBase, SQLite, MySQL, SQL Server, Oracle, PostgreSQL, IBM DB2, SQL Anywhere, Access, Firebird, Informix and more. Working With Database connections : Option 1: You can connect with any of the above listed Databases either from a Local Machine or Remote DBMS machine using the Data Explorer in the IDE. It is a tabbed pane that is located, along with the Projects Window and the Model View tabs, in the upper-right corner of the IDE window. Can use this, to create new connections, modifies, deletes, or renames your database connections.  The Data Explorer works for databases that use dbExpress or FireDAC connection types. The Data Explorer lets you browse database server-specific schema objects, including tables, fields, stored procedure definitions, stored functions, triggers, and indexes. FireDAC databases also display primary keys, foreign keys and generators. The Data Explorer presents a list of available database types (such as DATASNAP and MYSQL) that you can access and perform various actions on, using the context menus. With Data Explorer, you can easily create and manage database connections. Additionally, you can drag and drop data from a data source to a project to build your database application quickly. The commands available in the Data Explorer depend upon the object selected in the tree view. To display the associated context menu commands, right-click the following node types: You can also use Data Explorer to Obtain connection information, Check here. Option 2 : Create/Modify the connection via TFDconnection component by double clicking which will shows the editor same as Data explorer, where you can provide the DriverId, Username, Database name, Password etc. The connection string is stored in the TFDConnectionDefsparams and it is binded with application as hard-coded values. What if the database path changes after deployment of the application, you need to rebuild to avoid error in connection. To avoid such hard coded connection information, we can select the Connection Definition name in the TFDConnection editor, where Connection definition name need to be predefined and stored in the FDConnectiondefs.Ini file. The connection definitions for different databases are stored in the following fpath. C:UsersPublicDocumentsEmbarcaderoStudioFireDACFDConnectionDefs.ini To create TFDconnection with connection information, a clever way […]

Read More

Robust Way to Find Leaks With Deleaker In Delphi and C++Builder Applications

It’s quite normal for a developer to forget to destroy or free the objects while developing, these small memory leaks over a period of time lead the application to crash with, out of memory error. Finding that memory leaks in small projects it is easy. How about finding the leaks in large enterprise applications? Tired of finding the leaks? Don’t worry. The Deleaker solves the problem for you in a robust way. Find all the memory leaks, It doesn’t matter what type of leaks are occurring, Deleaker will find them all: memory leaks (produced by the heap, virtual memory, or OLE allocators, etc.), GDI leaks, leaks of Windows USER objects, and handles. Deleaker detects leaks in Delphi and C++ Builder. It can work either as a standalone application or as a RAD Studio extension. Standalone is convenient, for example, if RAD Studio is not installed. If Deleaker works as an extension, a developer can search for leaks without leaving RAD Studio, which lets him move to the source of possible errors quicker. After installation, a new Deleaker item is added to the RAD Studio main menu: How to use the Deleaker : Install the Deleaker setup check here. While installing choose the options as standalone or integration with RAD studio. Create a sample windows VCL application and write a piece of code with some memory leaks in it. Run the application, perform the action to create memory leaks, and close the application. Deleaker will create a snapshot of memory leaks where you can navigate to the line of code from the snapshot window directly to IDE. It’s that simple identify the memory leaks. Check the samples and resources available here. Check this below video demonstration of Deleaker for Delphi and C++ builder.

Read More

Quickly Learn To Use Delphi Classes To Create A New Python Type With Python4Delphi Sample App

import spam p = spam.CreatePoint(2, 5) print (p) p.OffsetBy( 3, 3 ) print (p.x, p.y) print (dir(spam)) print (spam.Point) print (“p = “, p, ”  –> “,) if type(p) is spam.Point:   print (“p is a Point”) else:   print (“p is not a point”) p = 2 print (“p = “, p, ”  –> “,) if type(p) is spam.Point:   print (“p is a Point”) else:   print (“p is not a point”) p = spam.CreatePoint(2, 5) try:   print (“raising an error of class EBadPoint”)   p.RaiseError() # it will raise spam.EBadPoint except spam.PointError as what: #it shows you that you can intercept a parent class   print (“Caught an error derived from PointError”)   print (“Error class = “, what.__class__, ”     a =”, what.a, ”   b =”, what.b, ”   c =”, what.c)   # You can raise errors from a Python script too! print (“——————————————————————“) print (“Errors in a Python script”) try:   raise spam.EBadPoint(“this is a test !”) except:   pass   try:   err = spam.EBadPoint()   err.a = 1   err.b = 2   err.c = 3   raise err except spam.PointError as what: #it shows you that you can intercept a parent class   print (“Caught an error derived from PointError”)   print (“Error class = “, what.__class__, ”     a =”, what.a, ”   b =”, what.b, ”   c =”, what.c)   if p == spam.CreatePoint(2, 5):   print (“Equal”) else:   print (“Not equal”)

Read More

Astral Heroes Is A Beautiful Multiplayer Collectible Card Game Built In Delphi

Developer Ivan Polyacov from Apus Software created Astral Heroes in Delphi. According to the site it is a collectible card game that’s simple to learn, exciting to play, and deep enough to challenge even the greatest strategists. It uses a truly fair Free-­to-­Play model that never hides the best content behind “pay walls” according to the developer. Some of the features of this beautiful game include: Fast-paced and simple core gameplay, 3 different game modes, Custom Decks: Construct and play a deck of your own personal design, Random Decks, Draft Tournament, a deep library of well­ balanced creatures and spells, A global Online League, Sophisticated and merciless AI opponents that will test your mettle, and a rich single ­player campaign. If you want to find out more about why Ivan selected Delphi and more about this development process check out this YouTube code review video. Website http://astralheroes.com/ Download https://store.steampowered.com/app/488910/Astral_Heroes/ Open Source Game Engine https://github.com/Cooler2/ApusGameEngine Screenshot Gallery

Read More

Delphi at the University – DelphiCon 2020

Are you a teacher, educator, or parent of a child interested in programming?  Are you looking for a simple but powerful language and student-friendly integrated development environment? With it’s combination of full-language features, simple syntax, and visual drag-and-drop development, Delphi rocks its competition. Still unsure? Let Victory Fernandes, a former mathematics and computer science professor at Brazil’s Unifacs University, walk you through the benefits of Delphi in education in his talk Delphi at the University – Insights for Students and Teachers. This presentation and Q&A session is free of charge and bundled with nine other talks and four panels by industry professionals.  Sign up now by clicking the “Save my seat” button at delphicon.embarcadero.com.

Read More

The Fastest And Easiest Way To Build Data-Driven Delphi And C++Builder Apps Using Enterprise Connectors

Enterprise connectors – Make Connecting to any application is easy as connecting to a database. Move, integrate, and analyze data with ease utilizing the FireDAC Enterprise Connectors, powered by CData. These unparalleled components allow you to integrate 180+ Enterprise applications, simplifying connectivity into a standard model using SQL. It allows you to integrate application services, like QuickBooks Desktop, MailChimp, Salesforce, YouTube, SugarCRM, Jira, SurveyMonkey, Amazon DynamoDB, Couchbase, PayPal, eBay, Google Sheets, Facebook, Twitter, Slack, and Dropbox. Features : Replication and Caching: Easily copy data to local and cloud data stores such as Oracle, SQL Server, Google Cloud SQL, etc. The replication commands allow for intelligent incremental updates to cached data. Functions Library: A library of over 50 string, date, and numeric SQL functions that can manipulate column values into the desired result. Popular examples include Regex, JSON, and XML processing functions. Client-Side Processing: Enhance the data source’s capabilities with additional client-side query processing to enable analytic summaries of data such as SUM, AVG, MAX, MIN, etc. Customizable: Customize the data model to add or remove tables/columns, change data types, etc. without requiring a new build. These customizations are supported at runtime using editable human-readable schema files. Secure Connectivity: Includes standard Enterprise-class security features such as TLS/ SSL data encryption for all client-server communications. Developer Friendly: Full Design-time support for data operations directly from RAD Studio. How to connect with Google Spread Sheet : Create a new VCL Forms Application. Drop a TFDPhysGoogleSheetsDriverLink and TFDConnection object onto the form. Double-click the TFDConnection object. The FireDAC Connection Editor is displayed. Select “CData.GoogleSheets” in the DriverId menu and configure the connection properties. You can connect to a spreadsheet by providing authentication to Google and then setting the Spreadsheet connection property to the name or feed link of the spreadsheet. If you want to view a list of information about the spreadsheets in your Google Drive, execute a query to the Spreadsheets view after you authenticate. Use the OAuth 2.0 authentication standard. To access Google APIs on behalf on individual users, you can use the embedded credentials or you can register your own OAuth app. OAuth also enables you to use a service account to connect on behalf of users in a Google Apps domain. To authenticate with a service account, you will need to register an application to obtain the OAuth JWT values. See the Getting Started chapter in the help documentation to connect to Google Sheets from different types of accounts: Google accounts, Google Apps accounts, and accounts using two-step verification. Watch this Video, how to connect to Google Spread sheet with powerful FireDAC enterprise connector components. Enterprise Connectors. Check out the full list of Applications supported and components available for Delphi/C++ Builder. Integrate faster with your applications using enterprise connectors.

Read More

Learn How To Use constexpr In Modern C++ With C++Builder For Windows Development

In this tutorial, you will learn how to utilize constexpr variables and constexpr functions. The principal idea is the performance enhancement of applications by doing calculations at compile time rather than run time. The purpose is to allocate time in the compilation and save time and run time. The constexpr keyword was introduced in C++11 and improved in C++14 and C++17. constexpr specifies that the value of an object or a function can be evaluated at compile-time and the expression can be used in other constant expressions. A compiler error is raised when any code tries to alter the value. Unlike const, constexpr can also be applied to functions and class constructors. constexpr symbolizes that the value or return value is constant and where possible is calculated at compile time. The primary difference between const and constexpr variables is that the initialization of a const variable can be deferred until run time. A constexpr variable must be initialized at compile time. Moreover, all declarations of a constexpr variable or function must have the constexpr specifier. constexpr float x = 42.0; constexpr float y{108}; constexpr float z = exp(5, 3); constexpr int i; // Error! Not initialized int j = 0; constexpr int k = j + 1; //Error! j not a constant expression constexpr float x = 42.0; constexpr float y{108}; constexpr float z = exp(5, 3); constexpr int i; // Error! Not initialized int j = 0; constexpr int k = j + 1; //Error! j not a constant expression With C++17, we can estimate conditional expressions at compile time. The compiler is then able to eliminate the false branch. template auto get_value(T t) { if constexpr (std::is_pointer_v) { return *t; } else { return t; } } templatetypename T> auto get_value(T t) {     if constexpr (std::is_pointer_vT>) {         return *t;     } else {         return t; } } You can do more amazing things with if constexpr. Be sure to check out these workshops: constexpr Functions A constexpr function is one whose return value is computable at compile time when consuming code requires it. A constexpr function or constructor is implicitly inline. constexpr int method_call(int a, int b) { return a * b; } constexpr int method_call(int a, int b) {     return a * b; } Example The following sample shows constexpr variables, functions and several use cases #ifdef _WIN32 #include #else typedef char _TCHAR; #define _tmain main #endif #include #include #include constexpr int method_call(int a, int b) { return a * b; } constexpr auto degrees_to_radians(const double degrees) { return degrees * (M_PI / 180.0); } constexpr int sum(int n) { if (n > 0) { return n + sum(n – 1); } return n; } template auto get_value(T t) { if constexpr (std::is_pointer_v) { return *t; } else { return t; } } int _tmain(int argc, _TCHAR* argv[]) { constexpr int i = 1 + 2; constexpr int j = method_call(5, 10); constexpr auto radians = degrees_to_radians(90); constexpr auto sum_one_to_ten = sum(10); int a = 5; int* pa = &a; int at = 5; int* pt = &at; auto value_a = get_value(a); auto value_pa = get_value(pa); std::cout 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 […]

Read More

Learn How Easy It Is To Create A Python Type In A Delphi Application With Python4Delphi Sample App

We have learned how to create a Python Module in Delphi and added some methods to it. It’s time to learn how to create a Python Type(Class) in Delphi. Creating a new class creates a new type of object, allowing new instances of that type to be made. Each class instance can have attributes attached to it for maintaining its state. Class instances can also have methods (defined by its class) for modifying its state. You can also use Python4Delphi with C++Builder. This post will guide you to create a Python Type in Delphi using Python4Delphi components. Prerequisites: Download and install the latest Python for your platform. Follow the Python4Delphi installation instructions mentioned here. Alternatively, you can check out this video Getting started with Python4Delphi. Components used in Python4Delphi Demo6 Sample App: TPythonEngine: A collection of relatively low-level routines for communicating with Python, creating Python types in Delphi, etc. It’s a singleton class. TPythonGUIInputOutput: Inherited from TPythonInputOutput (which works as a console for python outputs) Using this component Output property you can associate the Memo component to show the Output. TPythonDelphiVar: Inherited from TEngineClient, used to convert the python variable to the Delphi variable and vice versa. It has methods to set and get value as variant or PyObject. It contains property like Module(TPythonModule internally created by default) where the python variable(TPyVar) is created and later converted to and from the Delphi variant or PyObject. TPythonModule: It’s inherited from TMethodsContainer class allows creating modules by providing a name. You can use routines AddMethod, AddMethodWithKW, AddDelphiMethod, AddDelphiMethodWithKeywords to add a method which should be type compatible with this routine parameter. You can create events using the Events property. TPythonType: This component helps to create a new python type in Delphi which is inherited from the hierarchy of classes (set of APIs to create, manage methods, and members). TMemo: A multiline text editing control, providing text scrolling. The text in the memo control can be edited as a whole or line by line. You can find the Python4Delphi Demo6 sample project from the extracted repository ..Python4DelphiDemosDemo06.dproj. Open this project in RAD Studio 10.4.1 and run the application. Implementation Details: PythonEngine1 provides the connection to Python or rather the Python API. This project uses Python3.9 which can be seen in TPythonEngine DllName property. It Is assigned with InitScript which import sys module and prints the Python.Dll version, copyright information to Memo2. import sys print(“Python Dll: “, sys.version) print(sys.copyright) print() PythonGUIInputOutput1 provides a conduit for routing input and output between the Graphical User Interface (GUI) and the currentlyexecuting Python script. PythonDelphiVar1 component is intended for demonstrating how to assign value between Delphi(Edit1.Text)->Python Delphi variable(test.Value) and back from (test.Value) -> Edit1.Text using event PythonDelphiVar1GetData and PythonDelphiVar1SetData respectively. The data is passed as variant type here. PythonModule1 with Module name spam is created. During PythonModule1Initialization a method spam_foo,spam_CreatePoint,spam_getdouble is added to the Module. and the definition of these methods was included in the same unit file. In the method definition, we can use the python engine to manipulate between python and Delphi. In this sample, created a new Python Type(Point) which is a Delphi record that holds attributes Ob_refcount, X, Y positions, and a Pointer to TPyTypeObject. This Python type point is instantiated using the spam_CreatePoint routine. To get and set the attribute value for the created point instance, procedure PyPoint_getattr, PyPoint_setattrfunc is used. To represent the Point object procedure PyPoint_repr is used. To destroy the Point […]

Read More

Ultimate Enhanced Native Windows Task Manager Built In Delphi

Developer Michal Mutl with MiTeC has a powerful enhanced task manager utility available which is built in Delphi. The features in this enhanced task manager make it one of the most advanced task managers for Windows that I have seen. There are so many features here it’s incredible. According to the feature list Task Manager Deluxe (TMX) provides real-time observing of: running processes, installed services and drivers, available network adapters, network connections by process, network traffic, disk and I/O utilization, active terminal sessions, autostart entries, cpu usage, frequency and other advanced stats, gpu usage and gpu engines usage, memory map and utilization, system information, opened/locked files finder, machine journal, user account list, monitor layout view, and windows available updates. This is a great example of a native Delphi application and the speed and power that a native application can bring to a solution. It also features both light and dark modes which is a nice touch (and super easy in Delphi)! Website https://www.mitec.cz/tmx.html Screenshot Gallery

Read More

Flexible FireMonkey Material Design Templates Available Via GetIt In Delphi

The Bottom Navigation template is designed to embrace the Material Design user interface and user experience philosophy. It looks great on both iOS and Android and works on Windows for testing. The template has eight different varieties within the application as different forms. Basic – ufrmBasic Shifting – ufrmShifting Light – ufrmLight Dark – ufrmDar Icon – ufrmIcon Primary – ufrmPrimary Map Blue – ufrmMap Light Simple – ufrmLightSimple Most of the forms contain various tabs that you move between as you tap the buttons at the bottom. The tabs content looks mostly alike, so it may not be obvious that you are moving between tabs. Each one of the forms contains different examples of use cases of FireMonkey that you can apply to your projects easily.  With GetIt you can easily search and get the full template: There are a lot of subtle design elements that you may want to replicate in other applications, even if you don’t use these templates completely. To use these templates in your project just copy the unit and form file to your project. You can further customize them and remove the TListView from them as well. Be sure to check out other templates on Embarcadero GetIt!

Read More