Noutați

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

Leveraging High DPI with Ray Konopka – DelphiCon 2020

Have you ever accessed a website on your mobile device and found that it was formatted for desktop and nearly unreadable on a 5″ screen?  Similar problems occur for users running high-DPI screens. As 4K screens proliferate and the consumer pressure for 8K grows, it’s important to adjust user interfaces to prevent forms and controls from becoming unreadably small on high-resolution monitors.  RAD Studio 10.3 Rio and Rio Update 2 introduced enhanced controls for high-DPI applications to remedy this problem and Ray Konopka of Raize Software, Inc. is here to teach us how to maximize their advantages. Just seven days away, Leveraging High DPI in VCL Applications is a must-see talk for all developers, hobbyists, and RAD Studio enthusiasts looking to gain new techniques to stay relevant in our changing software landscape. DelphiCon 2020 offers ten talks and four expert panels by Embarcadero tech partners and Most Valuable Professionals spanning the range of software from education to industrial database access. Come for the High-DPI knowledge and leave with a greater understanding of Delphi web applications. The conference is free and open to the public. Sign up now by clicking the “Save my seat” button at delphicon.embarcadero.com!

Read More

Use 100% of TAdvWebBrowser

TAdvWebBrowser/TTMSFNCWebBrowser TAdvWebBrowser or TTMSFNCWebBrowser are both the same components. The first one is a component that is available in TMS VCL UI Pack and the TTMSFNCWebBrowser is included in TMS FNC Core. This component can display web pages, HTML and load files such as PDF files. Both browsers also allow executing scripts and catch the result in a callback. Get started You will need to take some additional steps to get started with the TAdvWebBrowser. The component is based on the Microsoft Edge Chromium web browser, so first of all this should be installed. Luckily Edge Chromium is now the default browser that Windows is distributing with the Windows 10 updates. Another important remark is that you can use the normal version of Microsoft Edge and you don’t need to intall one of their specific channels. Another thing that you will need is the WebView2Loader DLL file. There is a 32-bit and 64-bit DLL, the use of one of these depends on the version of the application that you want to build. You can find these files in the ‘Edge Support’ folder which comes with the installation package. These need to be placed in the systems folder of your system. In case you are working on a 32-bit system, you will need to put the file in the System32 folder. If you are working on a 64-bit system the file needs to be in the SysWOW64 folder as Delphi is a 32-bit program. More information on the setup can be found here. Now you are ready to start working with the TAdvWebBrowser. TAdvWebBrowser built-in features To start with the TAdvWebBrowser it can be as easy as placing the component on the form and setting the URL property to the link that you want. If you want to give the user some more control, we’ve created a demo application, in which you can navigate via a TEdit and have buttons to go forward and backward. This is easily done with the following code: AdvWebBrowser.Navigate(AURL); AdvWebBrowser.goBack; AdvWebBrowser.goForward; With the OnNavigationComplete event you can check if the webbrowser changed to the desired page. In this code sample we will add the URL to a listbox and check if we can go back or forward between the web pages. procedure TForm.AdvWebBrowserNavigateComplete(Sender: TObject; var Params: TAdvCustomWebBrowserNavigateCompleteParams); begin ListBox1.Items.Add(Params.URL); Back.Enabled := AdvWebBrowser1.CanGoBack; Forward.Enabled := AdvWebBrowser1.CanGoForward; end; Some other things that you can do is set your own HTML code. AdvWebBrowser1.LoadHTML(MyHTML); Go to the next level You can get much more out of your TAdvWebBrowser with the use of some simple methods. With the ExecuteJavascript method, you can run the JavaScript code that you want in your browser. For example you can set the inner HTML of an object, in this case a paragraph. AdvWebBrowser.ExecuteJavascript(‘document.getElementById(“myParagraph”).innerHTML = “‘ + s + ‘”;’); DOM access is currently not possible in the TAdvWebBrowser itself, but you can retrieve the HTML text of your page via this function as well. And you can make it readable by parsing the retrieved text to JSON. In this case it is done in an anonymous callback method. AdvWebBrowser.ExecuteJavascript(‘function GetHTML(){return document.documentElement.innerHTML;} GetHTML();’, procedure(const AValue: string) begin memo.Lines.Text:= TJSONObject.ParseJSONValue(AValue).Value;; end ); With the use of this JavaScript method, you can get almost everything out of this control. TAdvWebBrowser also supports bridging between the client and the […]

Read More

Learn How To Use C++ Lambda Expressions In C++17 With C++Builder

C++ got lots of additions throughout C++11, C++14 and C++17. Currently, C++ is a completely different language than it use to be. This Modern C++ post explains how to use the Standard Template Library and the most important features of the C++17 that will greatly help you write readable, maintainable, and expressive code! One of the new features of C++11 was lambda expressions. Throughout C++11, C++14, and C++17, the lambda expressions got some new additions that made lambda expression even more powerful.  If you do not know what lambda expression is, here is the answer: Lambda expressions or lambda functions construct closures. A closure is a very generic term for unnamed (temporary) objects that can be called like functions and can capture variables in scope. Lambda expressions are a great way to help to make code generic and tidy. Lambda expressions can be used as parameters for real generic algorithms to specialize in what those achieve when processing specific user-defined types.  With lambda expressions, we can encapsulate code to call it later, and that also might be somewhere else because we can copy them around.  Or we can also encapsulate code to call it multiple times with different parameters. Let’s have a real example: #ifdef _WIN32 #include #else typedef char _TCHAR; #define _tmain main #endif #include #include using namespace std; int _tmain(int argc, _TCHAR* argv[]) { string hello = “C++”; string world = “17”; auto add_things = [](auto a, auto b) { return a + b; }; auto i = add_things(1, 2); auto s = add_things(hello, world); 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 #ifdef _WIN32 #include #else typedef char _TCHAR; #define _tmain main #endif   #include #include   using namespace std;   int _tmain(int argc, _TCHAR* argv[]) {     string hello = “C++”;     string world = “17”;       auto add_things = [](auto a, auto b) { return a + b; };       auto i = add_things(1, 2);     auto s = add_things(hello, world);   cout i endl; cout s endl;   cout [](auto a, auto b){ return a + b; }(2, 2) ‘n’;       system(“pause”);       return 0; } Pay attention to this line: auto add_things = [](auto a, auto b) { return a + b; }; auto add_things = [](auto a, auto b) { return a + b; }; This is easy to use, just like any other binary function. As we defined its parameters to be of the auto type, it will work with anything that defines the plus operator (+), just as strings do. And here we are using the lambda expression and printing the output to the console: auto i = add_things(1, 2); auto s = add_things(hello, world); cout auto i = add_things(1, 2); auto s = add_things(hello, world);   cout i endl; cout s endl; We do not need to store a lambda expression in a variable to utilize it. We can also define it in place and then write the parameters in parentheses just behind it (2, 2): cout cout [](auto a, auto b){ return a + b; }(2, 2) ‘n’; As you can see this is the syntax for lambda expressions. The shortest lambda expression possible is []{}, it just accepts no […]

Read More

Delphi Compiler And LSP Patch for RAD Studio 10.4.1

Embarcadero has just released a new patch for RAD Studio 10.4.1. This includes Delphi compiler improvements and Delphi LSP improvements. The patch is available in GetIt, and the RAD Studio IDE Welcome page should indicate its availability. The patch is also going to be available in the my.embarcadero.com customers download portal. Read on to learn more about this patch and the two GetIt packages to deliver it. Delphi Compiler and Code Completion Patch This patch addresses two issues in the Delphi 10.4.1 compiler: a data layout issue with specific alignments, logged in Quality Portal as RSP-30890 and RSP-30787, and a performance issue when recompiling, logged as RSP-22074, RSP-30714, and RSP-30627. The performance improvement provided in this patch also helps with performance for Code Insight when using the LSP server. The patch comes in two packages. The first includes updated compilers for all platforms available in Delphi and RAD Studio Professional. The second package includes the Linux compiler and it is available only for Enterprise customers. Delphi and RAD Studio Enterprise customers should see and install both packages (the order doesn’t really matter, as they are independent). Each of these GetIt packages is a deferred package, which means you select it but the actual download and installation takes place when you close the RAD Studio IDE, as it replaces files the IDE uses. Just follow the steps, wait for the GetItCmd console app to perform the process, and notice that the files replaced in your RAD Studio installation folders are copied into a special backup directory under the main install location. See screenshot below for one of the steps of the automatic installation process: After the deferred installation, RAD Studio will reboot and the patch will show as installed in the GetIt Package Manager dialog and in the Welcome Page. Enterprise users will have to install both packages to see the Welcome Page notification go away.

Read More

[InfoGraphic] DevOps, Development and RAD Studio

DevOps is a term I’m hearing more and more during customer conversation, and I am often sharing the different ways that Delphi, C++Builder and RAD Studio programming supports DevOps. (Keep reading – free infographic below) The term DevOps originates back to around 2008/9 when the two worlds of Development and Operations were traditionally stereotypes as Dev V Ops, with typical exchanges like “It’s not my machines, it’s your code!” – “No, it’s not my code it’s your machines!”. These stereotypes were built from friction found in the key business requirement for almost any system – making changes! The ability to rapidly make changes is important if you want to stay ahead of the competition. RAD developers are used to Agile development and being able to create changes quickly, however, getting them deployed needs Operations. To the Operations team, making changes brings a high-risk of an outage, but this prevents innovations from being pushed in a timely manner. This conflict is something that DevOps acknowledges and tries to breakdown through new ways of working that bring both sides closer together. Over the years, the two worlds of Dev and Ops have had to start thinking more like each other, including, how to get feedback from live environments to find issues that appear in the code. Agile, and DevOps like to re-use and expand, so rather than giving a full-blown commentary on how RAD Studio supports Delphi and C++ Builder developers today, let me keep it simple and say that the libraries, components, toolchains (and more) found in RAD Studio, and our wider partner ecosystem, provide broad support to both Developers and Operations teams who need to communicate and share what is happening in the field. The component-based architecture and cross-platform libraries that work across multiple systems are the perfect foundation stone for rapid agile development, that can be supported simply. But finally, a picture paints a thousand words. This is just a snapshot of the RAD eco-system, there is too much to put everything on here, but I hope this gives a flavor of just the tip of the iceberg, and how the RAD Studio IDE, and the Delphi and C++Builder languages and libraries are enabling development teams the world over to support DevOps today. RAD Studio DevOps InfoGraphic Download Infographic PDF

Read More