Noutați

Achieve High Performance By Using The string_view C++17 Feature In C++Builder

In this tutorial, you will learn another modern C++17 feature to work with strings. This feature is a std::string_view. The purpose of any kinds of string reference proposals is to bypass copying data that already owned someplace and of which only a non-mutating representation is required. The std::string_view is one such proposal. There was an earlier one named string_ref. The std::string_view is a picture of the string and cannot​ be utilized to alter the original string value. When a std::string_view is constructed, there’s no need to replicate the data. Besides, the std::string_view is smaller than std::string on the heap. How can you use std::string_view with C++ Builder? string_view lives in the header file Benefits of the string_view string_view is useful when you want to avoid unnecessary duplicates The creation of string_view from literals does not need a dynamic allocation. The following code illustrates how string_view supports save memory by restricting unnecessary dynamic allocations: #ifdef _WIN32 #include #else typedef char _TCHAR; #define _tmain main #endif #include #include #include #include #include // string_view // Unified way to view a string (memory and length) – without owning it // No allocation std::size_t parse(std::string_view str) { return std::count(str.begin(), str.end(), ‘e’); } int _tmain(int argc, _TCHAR *argv[]) { const std::string str = “hello world”; const char* c = “Rio de Janeiro”; 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 #ifdef _WIN32 #include #else typedef char _TCHAR; #define _tmain main #endif   #include #include #include #include #include   // string_view // Unified way to view a string (memory and length) – without owning it // No allocation std::size_t parse(std::string_view str) {     return std::count(str.begin(), str.end(), ‘e’); }   int _tmain(int argc, _TCHAR *argv[]) {     const std::string str = “hello world”;     const char* c = “Rio de Janeiro”;       std::cout “Occurrences of letter ‘e’: “ parse(std::string_view(str.data(), str.length())) std::endl;     std::cout “Occurrences of letter ‘e’: “ parse(std::string_view(c, strlen(c))) std::endl;     system(“pause”);     return 0; } So, std::string_view is an extraordinary utility for great performance. But, the programmer must assure that std::string_view does not outlive the pointed-to character array. Additional functions provided by std::string_view can be found here, on the official documentation. Head over and check out the Windows string_view demo for C++Builder on GitHub.

Read More

Boost C++Builder Compile Speed with TwineCompile – Deep Dive Webinar

TwineCompile is an advanced compile system that uses multi-threading technology and caching techniques to make your C++Builder compiles 50x faster! This IDE Plugin is included free with an active Update Subscription for all C++Builder and RAD Studio customers via the GetIt Package Manager. Install TwineCompile today from GetIt, before the webinar, so you can easily follow along as Jonathan demos the power of TwineCompile. Deep Dive Webinar: Boost C++Builder Compile Speed with TwineCompile Dec 14th, 2020 at 11 AM CST/1700 UTC [Register] with Jonathan Benedicto of JomiTech, creator of TwineCompile From an elevated RAD Studio Command prompt, you can install it with the command: getitcmd -i=TwineCompile-5.2.1 getitcmd –i=TwineCompile–5.2.1 Other TwineCompile features: Automatic background compiling engine ensures that files are compiled as fast as they are saved! A highly tuned, pre-compiled header handling system automatically maximizes simultaneous use of pre-compiled headers between multiple threads! Seamless integration into the C++Builder 10.4 Sydney IDE Theme support for all IDE themes providing a unified workspace! Full support for 32-bit and 64-bit compilers! Register now for the deep-dive webinar to maximize your C++Builder productivity and rocket your compilation speeds to new heights. TwineCompile performing an automatic background compile (SORTA) in C++Builder 10.4 Sydney. TwineCompile building a project in C++Builder 10.4 Sydney using the Dark Theme.

Read More

Learn How To Build A REST API App For iOS In 45 Minutes With Delphi

In this CodeRage session, you can find the most valuable information and best practices on building an application for iOS using Delphi FireMonkey. Easily learn how to build a real-world application using Delphi FireMonkey! Overview: Recipes app which fetches data from an open API Deploying to App Store After learning best practices, you can apply to your future projects easily As you walk through the session, you can find interesting approaches for refreshing the recipe list with the TTask. TTask means everything in the inside of the TTask, gonna be executed in the background. As you can see one of the best functionality of the TTask is to prevent the user interface from locking up if you want to start something in the background. And in this case, the response from an endpoint could get more time. Be sure to check out the whole session and learn how to deploy Delphi FireMonkey applications to the App Store! Learn more about using TTask in the parallel programming library. Learn more about deploying your Delphi apps to iOS. Find out more about using the REST debugger in RAD Studio to quickly connect to REST services.

Read More

Learn How To Use Connection Pooling With A Multi-threaded Environment In Delphi

This sample implements a multithreaded application, where each thread uses the IFDPhysConnection interface to establish a connection. The multiple connection establishments may lead to performance degradation across the whole system. To avoid this, you can enable the Pooled property to use the connection pooling. Location You can find the Pooling sample project at: Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to: Object PascalDatabaseFireDACSamplesPhys LayerIFDPhysConnectionPooling Subversion Repository: You can find Delphi code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version. How to Use the Sample Navigate to the location given above and open IFDPhys_Pooling.dproj. Press F9 or choose Run > Run. Interact with the sample: Select an option from the Use Connection Definition combo box. Click the Run button and see the execution time. Select the Run Pooled check box, click the Run button and see the execution time. Compare both execution times. Files File in Delphi Contains IFDPhys_Pooling.dprojIFDPhys_Pooling.dpr The project itself. fPooling.pasfPooling.fmx The main form. Implementation When you run the application, you can interact with the sample using the following objects: A TComboBox object labeled as Use Connection Definition.Click the Use Connection Definition combo box and select an option in order to define a connection to a database. The menu shows all the persistent connections defined on the file C:UsersPublicDocumentsEmbarcaderoStudioFireDACFDConnectionDefs.ini. Once you select a connection definition, the sample enables the Run button and the Run Pooled check box. A TButton object labeled as Run.If you click the Run button, the sample launches 10 threads. Each thread uses the CreateConnection method of IFDPhysManager to create a connection to the database. Moreover, each thread uses the CreateCommand method of IFDPhysConnection to create a command for each connection. Finally, each thread uses the Prepare method of IFDPhysCommand to execute 50 SQL queries. The executed SQL query is the following SELECT command: ‘select count(*) from {id Region}’. Therefore, in this case, each thread creates and uses a dedicated connection object working with the database. A TCheckBox object labeled as Run Pooled.If you select this check box, the Pooled property of the connection setting is set to True. The database connection pooling is a method used to keep database connections open so they can be reused by others. Therefore, if you select the option, the threads can reuse the current opened connection.Note: The connection pooling can be enabled only for a persistent or private connection definition. A TMemo object.The sample uses the memo object to display the type of connection. If you select the Pooled property, the memo displays the following message: ‘Run pooled…’. On the other hand, if you uncheck the Pooled property, the memo displays the following message: ‘Run non pooled…’. Through the link below you can visit the original post about this sample: http://docwiki.embarcadero.com/CodeExamples/Sydney/en/FireDAC.IFDPhysConnection.Pooling_Sample

Read More

Quickly Log Python Script Output To The Delphi Debug Log In Your Windows Apps

Sometimes developers need to log the output messages in Delphi for debugging purposes. You might aware this can be achieved by the windows API OutputDebugStringA . How about direct your python output messages to the Delphi Events Log Window? Yes, Python4Delphi has a flexible component PythonInputOutput to redirect your python output to the Delphi Events Log window with less code. You can also use Python4Delphi with C++Builder. Python4Delphi Demo23 Sample App shows how to create a Python script in Delphi Application which demonstrates creating thread and output the result in the Delphi Event log window. You can find the Demo23 source on GitHub. 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 Demo23 App: TPythonEngine: A collection of relatively low-level routines for communicating with Python, creating Python types in Delphi, etc. It’s a singleton class. TPythonInputOutput: Inherited from TPythonInputOutput (which works as a console for python outputs) Using this component event you can direct your Python Output to the Delphi Event log window. You can find the Python4Delphi Demo23 sample project from the extracted GitHub repository ..Python4DelphiDemosDemo23.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 uses a Python Script file threading_test.py where the below list of modules was used. threading: This module constructs higher-level threading interfaces on top of the lower level _thread module.  collections: This module implements specialized container datatypes providing alternatives to Python’s general-purpose built-in containers, dict, list, set, and tuple. In this sample, deque is used. time: This module provides various time-related functions. threading_test.py contains, ProducerThread, ConsumerThread, BoundedQueue class within the function _test. Memo1, used for providing the Python Script to execute. On Clicking Execute Button the below code executes the python script. procedure TForm1.Button1Click(Sender: TObject); begin PythonEngine1.ExecStrings( Memo1.Lines ); end; procedure TForm1.Button1Click(Sender: TObject); begin   PythonEngine1.ExecStrings( Memo1.Lines ); end; The script below is executed which will opens a window console, create threads put in a queue and execute one after other. import threading_test import sys # the following is needed to use the newly allocated console! sys.stdout = sys.stderr= open(‘CONOUT$’, ‘wt’) try: count = int(sys.argv[1]) except: count = 3 for i in range(count): print (“**** Pass”, i) threading_test._test() print (“**** Done.”) import threading_test   import sys # the following is needed to use the newly allocated console! sys.stdout = sys.stderr= open(‘CONOUT$’, ‘wt’)   try:   count = int(sys.argv[1]) except:   count = 3   for i in range(count):   print (“**** Pass”, i)   threading_test._test() print (“**** Done.”) PythonInputOutput1 provides a conduit for routing input and output between the Graphical User Interface (GUI) and the currentlyexecuting Python script. The OnSendData event helps to send the python output data to the Delphi Event log window using the below code. procedure TForm1.PythonInputOutput1SendData(Sender: TObject; const Data: AnsiString); begin {$IFDEF MSWINDOWS} OutputDebugStringA( PAnsiChar(Data) ); {$ENDIF} {$IFDEF LINUX} WriteLn( ErrOutput, Data ); {$ENDIF} end; procedure TForm1.PythonInputOutput1SendData(Sender: TObject;   const Data: AnsiString); begin {$IFDEF MSWINDOWS}   OutputDebugStringA( PAnsiChar(Data) ); {$ENDIF} {$IFDEF LINUX}   WriteLn( ErrOutput, Data ); {$ENDIF} end; Python4Delphi Demo23 You can customize your Events Debug Output messages background and foreground colors easily to differentiate your output messages with Delphi IDE. Right-click in the Events Tab -> Properties->Event Log->Colors -> Output Debug String-> Select Foreground and Background.

Read More

Powerful Petroleum And Mining Software For Surface And Subsurface Data Visualization Is Built In Delphi

Over the past three decades, Golden, Colorado-based RockWare, Inc. has established itself as a leader in the highly specialized geological mapping and modeling sector. Its flagship product, RockWorks, creates 3-dimensional geological models of the earth’s subsurface for customers in environmental (toxic cleanup, contamination audits), hydrogeology (surface and sub-surface water), and industrial minerals (e.g. gypsum, sand gravel) segments and it is built in Delphi. One of the key benefits of Delphi according to Jim Reed, Director R&D is that “It allows us to put in millions of lines of code and do it in an efficient way without maxing out memory. Because of that, we can have a monster program that does 50 zillion different things, but can be downloaded comfortably in a reasonable amount of time. Given that 65% of our business is outside of North America, executable files have to be small enough so that someone in Sudan can download data over a lousy connection.” He attributes this capability to the overlay features in Delphi, which allow for exceptional memory management. “Delphi allows you to easily load and unload things in memory so our software can run on any basic machine. In fact with a low-end PC you could have our application up and running in an hour. We couldn’t live without that.” Case Study https://www.embarcadero.com/case-study/rockware-inc-case-study Website https://www.rockware.com/ Screenshot Gallery

Read More

New Major Release for Delphi Code Analyzer v2.4 with Free Download

Delphi Parser has a new major release … Download Free The New & Powerful Delphi Parser Static Code Analyzer 2.4 & Get Your Delphi Code Analyzed in Minutes! This is an exciting year for Delphi programmers with one of the more significant new RAD Studio releases. With multiple new features and quality improvements, the time to upgrade your Delphi projects has never been better. Delphi Parser is the premier tool to support a wide range of Upgrade needs from simple projects to ones with millions of lines of code. We built it and improved it based on multiple projects. RAD Studio 10.4 allows developers to create amazing modern applications and Delphi Parser is the tool to get you there faster and cheaper. The Delphi Parser Analyzer 2.4 is the Newest Most Valuable Tool For Delphi Developers. It is built & aimed for dealing with huge legacy Delphi projects with hundreds of applications, thousands of unit files & libraries with millions of lines of code & decades of development & developers. It is a must-have tool in every development team through all the development life cycle. No Hard Work. You just need to provide the Delphi Parser Analyzer 2.4 the project source or code base folder you want to analyze, and the search path for the libraries & the Analyzer wizard will do the rest. The Delphi Parser’s Analyzer 2.4 is an automatic code analyzing wizard. It scans & analyzes an entire code base against all available Delphi’s system units, 3rd party components, libraries & even DCUs (using a special De-Compiler). Delphi Parser 2.4 – A Full Blown Independent Parser & Linker. The Analyzer 2.4 is built on the all new Delphi Parser 2.4 framework that has the ability to read millions of lines of code & parse the code into a unified run-time object mode. Multi Pass Parser – The Delphi Parser runs in several phases in order to remove all unnecessary compiler directives while stepping over syntax errors & bridging all Delphi versions differences, from Delphi 2 to 10.4 Sydney In order to build a unifying structured code in an object model in run-time memory. Built-in Linker & Semantic Objects Tree. As the New Delphi Parser v2.4 core technology reads all the code, it links between objects, find source declaration, links implementation code to objects & methods, checks for code dependencies, count references & usage, discover missing objects, and provides the developer an ability to review & drill down into the parsing & linking process in run-time like never been done before (as well as in any other language compilers). The Delphi Parser Analyzer 2.4 Wizard is available for all Delphi versions, as Express & Enterprise edition & also in an open-source edition based on the Delphi Parser 2.4 Developer’s Framework. The Delphi Parser Analyzer 2.4 helps your development team maintain a cleaned project’s codebase. Run it whenever you wish to release a new version update & removes unnecessary files & libraries from code before it is deployed. Take Control Over Your Code. Every software project contains many components that may become unnecessary or obsolete over the development process & stay there untouched, cause no one knows what to do with them & the fear of taking them out leaves them there for eternity. Today, with the Delphi Parser Analyzer 2.4 you can easily & quickly analyze your code on any given Delphi version, from the Legacy Borland to the Newest Embarcadero’s Delphi 10.4 Sydney – and get a true insight into what is going on in your code & […]

Read More

Combine Front End, Back End, And Business Logic In Modern Full-Stack Development With Delphi

Many application developers are building a web version of their services to get more users. For instance, you do not always have the same phone or same laptop to utilize the application, if the application has a web version everything is done.  In this webinar, you can see what is new with TMS Software and how you can use their full range of components to modernize your Windows 10 application and building web apps with Delphi.  New challenges today: Development for multiple platforms Desktop Client Applications need to interact with servers. Less RAD, more OOP Loosely-coupled Software Building Blocks Front-End – TMS VCL, FMX, FNC UI Pack & TMS Web Core Business Logic – TMS Aurelius, FlexCel, ANalytics, and more Back-End – TMS RemoteDB, Sparkle, XData If you are interested in building backend services with Delphi and TMS, you can utilize TMS XData to write custom services. TMS XData has several major features which you should know: Can be autogenerated from an existing database Open for any desktop, web, or mobile app Standardized REST protocol using JSON for data transport Fully documented REST API with SwaggerUI Be sure to watch the session Q&A learn more about the specific information. Head over and check out all of the different components available from TMS Software!

Read More

The Role of SAST in DevSecOps

Published November 25, 2020 WRITTEN BY MICHAEL SOLOMON Michael G. Solomon, PhD, CISSP, PMP, CISM, PenTest+, is a security, privacy, blockchain, and data science author, consultant, educator and speaker who specializes in leading organizations toward achieving and maintaining compliant and secure IT environments. Most people involved in the process of creating and deploying software applications today are familiar with DevSecOps, which integrates security and operations into the software development process. In figurative terms, we think of the software development lifecycle as a timeline, starting with the design on the left and the deployment (and post-deployment activities) on the right. Historically, security was overlooked until as late as possible in the process; it was something to consider once you had a viable product. But the truth is, ignoring security early on makes it harder and more costly to add on later. As DevSecOps continuously pushes security “to the left” in the software development process, autonomous assessment can provide assurance of security compliance from development’s earliest stages. One type of autonomous assessment, static application security testing (SAST), can help identify software flaws early on. Let’s explore how using SAST helps DevSecOps achieve its stated goals while minimizing friction. What SAST offers Experienced software developers can integrate correctness, robustness, efficiency, elegance and even security into the code they create. However, even the best developers don’t get it right every time. And less experienced developers tend to deviate from standards and best practices in order to get the job done. In today’s push to deliver products quickly and efficiently, it gets harder and harder to pay attention to all the details, including security. SAST can provide a valuable tool in the software developer’s toolbox for writing quality code. Far from some initial developers’ perception, SAST isn’t just one more hoop to jump through. Strategically laced SAST assessments can alert developers and management that potential flaws exist and should be addressed early in the process. Developers commonly find that SAST helps them to be more efficient. The last thing you want to find is a critical design flaw that stays hidden until the final testing before release. SAST can increase the likelihood you’ll find flaws long before they get “baked in.” One great way to leverage SAST’s value is to require assessment of all code before the initial check-in. You don’t (or shouldn’t) ever commit code that doesn’t compile, so why should you be able to commit code with security flaws? Find the flaws and fix them before committing work to the pipeline. Instead of increasing each developer’s workload, you’ll decrease (in many cases dramatically) the time required down the road in rework to fix flaws someone else finds. Plus, complete SAST codebase scans may take hours. Individual and small-batch scanning is much faster. Requiring developers to carry out SAST scans locally distributes the overall workload and reduces friction along the development pipeline. Although giving individual developers the ability to automatically flag potential issues is a huge benefit, management and auditors enjoy SAST’s help in doing their jobs as well. Developers can fix flagged issues before committing code, but some errors won’t be found until more comprehensive tests, including integration tests, get carried out. For example, pre-build SAST assessments may identify flaws that unit-based SAST assessments couldn’t see. Each time SAST identifies new flaws, management has […]

Read More

Get Free Responsive Cross-Platform Login Screen Templates For Android And iOS

This FireMonkey UI template designs for implementing a login screen in a multi-device application. And shows how to utilize FireMonkey designing guidelines. As you can see, this FireMonkey UI template is responsive and ready to utilize in any kind of project that requires a login screen like this! The templates should be cross-platform and work on Android, iOS, macOS, Windows, and Linux with a single UI and single codebase. From this demo project, you can learn: How to utilize ScrollBox Utilizing Layouts Making a blurred background image Changes to the layout should be made inside of the TFrame itself. Once changes are made to the TFrame you can delete it from the TForm and re-add it. Set its Align property to Client. Optionally, it’s ClipChildren property can be set to True if there are any overlapping background images. You can get this FireMonkey UI template from GetIt Package Manager Head over and get more information for the templates from GetIt and then download them in the Delphi IDE.

Read More