From the blog

Easily Bridge Your FireMonkey Windows Apps And JavaScript Using ScriptGate

Before knowing how to bridge FireMonkey application and JavaScript using ScriptGate, Let’s understand what is Native App and Hybrid App? What’s the difference between them? How to develop a Hybrid App using Delphi? Is it possible? What’s the challenge? This post will guide you to understand better. Native Apps : A software application built in a programming language, for the specific platform like iOS, Android ,Windows, macOS and Linux. The pros and cons are, The Best performance – no extra calculations or interpretations layers. No way to update UI without updating the app (only if you don’t have some built-in UI update engine) Your app can be used only for target platforms. You cannot start the app inside the browser without using something like Thinfinity Virtual UI. Hybrid Apps: Hybrid apps are part native apps, part web apps. It can take advantage of some device features available. Like web apps, they rely on HTML being rendered in a browser, with the caveat that the browser is embedded within the app. The pros and cons are, Possibility to update the UI and logic without updating the whole app. Great opportunity if you like to use HTML/CSS/Javascript for UI and even for business logic. Not the best performance – your app UI or business logic ( like Javascript) executes inside the browser component. Risk during submission to app stores (but your app still looks like a native app to the play store). Hybrid apps with Delphi is that possible? Yes, using the TWebBrowser component and ScriptGate. Why do we want to use ScriptGate? It looks like a native application, access to platform-specific features, like get device token, working with push notifications (including background mode), access to BLE and other hardware onboard features, working with permissions, and so on. Possibility to publish the application to app stores like a native app. What’s the challenge here?The main challenge – organize communication between your HTML/CSS/JavaScript web application, stored inside the TWebBrowser component, and your Host application code..E.g) Get Push notifications token in the host app and transfer it to the web app. Initiate permission requests from web app before calling some restricted function, e.g perform calls. Register geofences for the platform, e.g get a list of geofences via Rest API from Web Server using javascript code and put them to the OS using host app. ScriptGate solves the above challenges: ScriptGate is a library that allows you to call back and forth between JavaScript and Delphi code on TWebBrowser across Android, iOS, macOS, and Windows. Watch the Video Demonstration on how to bridge the FMX and JavaScript using ScriptGate mentioned below. Check out the other ways to Bridge Your Delphi Application and Javascript here. You can download the ScriptGate library for Delphi over on BitBucket.

Read More

Feel The Lightning Speed Of The Delphi Compiler For Maximum Productivity!

In this demonstration, you can see the speed of Delphi compiler which compiles one million lines of code in 5 seconds! This is epic! This demonstration has done using Delphi 10.1 Berlin version. Since then, we have got big major updates, compiler enhancements, and Delphi language enhancements. Be sure to check out the latest update in this post: 1 Million Lines of Code: 18,000 pages of printed text 14 copies of War and Peace 25 copies of Ulysses 63 copies of Catcher in the Rye Check out this million lines of code visualization Improving Compile Times Library packages – Built-in, 3rd party, and shared libraries are precompiled so they don’t need compilation with each build Precompiled units – Only new compile the units that change since the last compile Divide large projects into multiple smaller packages Inlining compiler optimizations, run time packages, optional debugging, and RTTI Watch the demonstration and feel the speed!

Read More

Powerful Visual Optimizer For Investment Portfolios Built In Delphi

OptiFolio is an advanced interactive portfolio optimization software built in Delphi. According to the developer “OptiFolio can produce an interactive visualization of all possible investment strategies for any given set of financial assets. Delphi’s compiled code extreme execution speed makes it possible to examine millions of strategies per second. This global perspective of feasible portfolios helps investors around the world to identify their best long-term strategies.” Some of it’s portfolio optimization features include: Apply quasi-stochastic and stochastic optimization methods, Find global optimums even with numerous and complex constraints, Report the composition of each point along the efficient frontier, and Save optimum portfolios for further analysis. Additionally, it has performance statistics to Calculate expected return, standard deviation and Conditional Value-at-Risk and Use multivariate copulas to forecast the performance of any portfolio. Website https://www.optifolio.net/ Ready to get started with the latest RAD Studio version? Start Free Trial or Learn More About Upgrading Screenshot Gallery Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder. Design. Code. Compile. Deploy.Start Free Trial   Upgrade Today    Free Delphi Community Edition   Free C++Builder Community Edition

Read More

Learn About C++11 In This Video Archive Conversation With C++ Designer Bjarne Stroustrup From 2014

In this session, you can see and listen to a conversation with C++ designer, Bjarne Stroustrup.  Overview ISO/IEC 14882-2011 aka C++11, formerly “C++0x” How C++ 11 builds on C++’s strengths How C++ 11 makes C++ easier to Application portability C++’s ubiquitous presence in the markets About Bjarne Stroustrup Designer and original implementor of C++ Distinguished Professor and holder of the College of Engineering Chair in Computer Science, Texas A&M Member, the C++ standards committee When is the right time to start a language standard? What’s like to work on the C++ standard with others from the industry and academia? Bjarne Stroustrup has shown his views on C++. And how the C++ designed, what things were the influence for the creation of the C++ language. What are some of the key areas that help make C++ easier to use? Is inheritance overused? Be sure to watch the whole session to get a deep understanding of C++ language!

Read More

Learn About How To Use Non-static Data Member Initializers For Windows Apps In C++

Embarcadero Bcc32c and bcc32x (Clang-enhanced compiler for Win32) implements all of the ISO C++11 standard. It includes the use of non-static data member to be initialized where it is declared. The basic idea for C++11 is to allow a non-static data member to be initialized where it is declared (in its class). A constructor can then use the initializer when run-time initialization is needed. #include struct B { B(int, double, double); }; class A { int a = 7; // OK std::string str1 = “member”; // OK B b = {1, 2, 3.0}; //OK std::string str2(“member”); // ill-formed }; #include   struct B {         B(int, double, double); };   class A {         int a = 7; // OK         std::string str1 = “member”; // OK         B b = {1, 2, 3.0}; //OK         std::string str2(“member”);   // ill-formed }; Why useful.-Easier to write.-You are sure that each member is properly initialized.-You cannot forget to initialize a member like when having a complicated constructor. Initialization and declaration are in one place – not separated.-Especially useful when we have several constructors.-Previously we would have to duplicate initialization code for members.-Now, you can do a default initialization and constructors will only do its specific jobs. If a member is initialized by both an in-class initializer and a constructor, only the constructor’s initialization is done (it “overrides” the default). Head over and find out more about C++ non-static data member initializers in the Embarcadero DocWiki!

Read More

Easily Pass Values Between Delphi And Python In Your Windows Delphi/C++ Builder Apps

function TForm1.GetProperty(pSelf, Args : PPyObject) : PPyObject; cdecl; var   key : PAnsiChar; begin   with GetPythonEngine do     if PyArg_ParseTuple( args, ‘s:GetProperty’,@key ) > 0 then       begin         if key = ‘Title’ then           Result := VariantAsPyObject(cbTitle.Text)         else if key = ‘Name’ then           Result := VariantAsPyObject(edName.Text)         else if key = ‘Informatician’ then           Result := VariantAsPyObject(cbInformatician.Checked)         else if key = ‘PythonUser’ then           Result := VariantAsPyObject(cbPythonUser.Checked)         else if key = ‘Age’ then           Result := VariantAsPyObject(edAge.Text)         else if key = ‘Sex’ then           Result := VariantAsPyObject(rgSex.ItemIndex)         else           begin             PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Format(‘Unknown property “%s”‘, [key])));             Result := nil;           end;       end     else       Result := nil; end;   function TForm1.SetProperty(pSelf, Args : PPyObject) : PPyObject; cdecl; var   key : PAnsiChar;   value : PPyObject; begin   with GetPythonEngine do     if PyArg_ParseTuple( args, ‘sO:SetProperty’,@key, @value ) > 0 then       begin         if key = ‘Title’ then           begin             cbTitle.Text := PyObjectAsVariant( value );             Result := ReturnNone;           end         else if key = ‘Name’ then           begin             edName.Text := PyObjectAsVariant( value );             Result := ReturnNone;           end         else if key = ‘Informatician’ then           begin             cbInformatician.Checked := PyObjectAsVariant( value );             Result := ReturnNone;           end         else if key = ‘PythonUser’ then           begin             cbPythonUser.Checked := PyObjectAsVariant( value );             Result := ReturnNone;           end         else if key = ‘Age’ then           begin             edAge.Text := PyObjectAsVariant( value );             Result := ReturnNone;           end         else if key = ‘Sex’ then           begin             rgSex.ItemIndex := PyObjectAsVariant( value );             Result := ReturnNone;           end         else           begin             PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Format(‘Unknown property “%s”‘, [key])));             Result := nil;           end;       end     else       Result := nil; end;

Read More

Learn About Using The Windows Subsystem For Linux (WSL) With Delphi

StoreIn this session, you can how to take advantage of the new Windows Subsystem for Linux (WSL) to develop, debug, and deploy Linux applications from Delphi. What is the Windows Subsystem for Linux (WSL) Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables natively on Windows 10 and Windows Server 2019 Multiple distributions are available via the Microsoft Store (Ubuntu, Debian, OpenSUSE, Kali, Fedora e.t.c) Mostly focused on the command-line interface with limited support for GUI apps via the external X11 server Less abstraction and better Windows integration than a traditional Virtual Machine Similar to Hyper-V or Windows Sandbox Invoke Linux binaries from Windows and Windows executables from Linux Be sure to watch the whole session to learn: WSL Installation Managing WSL Distros Targeting from Delphi to Linux  Installation of the PAServer Automation All these steps are shown in action with real demos.

Read More

Powerful Chromium Based WebView Component To Host Web Content In Your Delphi/C++ Builder FireMonkey Apps

RAD Studio 10.4 Sydney brings support for working with web content through the Chromium-based Edge WebView2 browser control in VCL applications via the new TEdgeBrowser component. Embarcadero DocWiki But, this is for only the VCL applications currently. So, what if you want to utilize this feature in your FireMonkey application?! Problem solved! We have the WebView for FireMonkey component by WINSOFT which offers you to host web content in your applications. Uses Microsoft WebView2 API Supports Windows 32 and Windows 64 Available for Delphi/C++ Builder 6 – 10.4 Requires Microsoft Edge (Chromium) version 84.0.515.0 or higher After downloading the WebView component you should install the component. Here you can follow the installation video. Moreover, the WebView2Loader dynamic-link library should be with the executable file. You can find that dynamic-link library from the Library folder within the installed component files. Because the WebView2 is the part of the Microsoft WebView2 SDK. After configuring and installing, you can just create a FireMonkey application and drop the TFWebView component from the System category on the Palette. Using the TFWebView is similar to TWebBrowser or TEdgeBrowser.  Let’s start investigating the features of the TFWebView component. You can give the Uniform Resource Identifier (URI) using the Uri property. With the Zoom property, you can control the view. FWebView.Zoom := FWebView.Zoom – 0.1; FWebView.Zoom := FWebView.Zoom + 0.1; You can fetch the web document title by this code: Caption := ‘WebView – ‘ + FWebView.DocumentTitle; CapturePreview procedure takes a screenshot of the TFWebView component to save the screenshot you can just use the TMemoryStream. Here is a use case. procedure TFormMain.SpeedButtonCaptureClick(Sender: TObject); begin if CapturePreviewStream = nil then CapturePreviewStream := TMemoryStream.Create else CapturePreviewStream.Clear; FWebView.CapturePreview(pfPng, CapturePreviewStream, CapturePreviewCompleted); end; procedure TFormMain.CapturePreviewCompleted(Sender: TObject); const FileName = ‘preview.png’; begin CapturePreviewStream.SaveToFile(FileName); FreeAndNil(CapturePreviewStream); Open(FileName); end; procedure TFormMain.SpeedButtonCaptureClick(Sender: TObject); begin   if CapturePreviewStream = nil then     CapturePreviewStream := TMemoryStream.Create   else     CapturePreviewStream.Clear;   FWebView.CapturePreview(pfPng, CapturePreviewStream, CapturePreviewCompleted); end; procedure TFormMain.CapturePreviewCompleted(Sender: TObject); const FileName = ‘preview.png’; begin   CapturePreviewStream.SaveToFile(FileName);   FreeAndNil(CapturePreviewStream);   Open(FileName); end; TFWebView comes with some amazing functionalities like posting a web message to an HTML document.  Or, showing HTML in memory, like you give the HTML/CSS/JS code as a parameter of the ShowHtml procedure that then creates a document to you within the TFWebView.  Moreover, you can manipulate the HTML document by executing JavaScript code, for instance fetching elements by Id and setting a new value. For this, you can utilize the ExecuteScript procedure. Finally, the best feature is playing with the developer tools. For instance, using Browser methods, like executing the getVersion function. To use this option, you can call the CallDevTools procedure. Be sure to check out part two of this post. In the next one, we will go through these given examples with a full explanation. Head over and check out the full WINSOFT WebView for FireMonkey component.

Read More

OpenSSF Takes a Collaborative Approach to Open Source Security

Published November 18, 2020 WRITTEN BY ED TITTEL. Ed Tittel is a long-time IT industry writer and consultant who specializes in matters of networking, security, and Web technologies. For a copy of his resume, a list of publications, his personal blog, and more, please visit www.edtittel.com or follow @EdTittel Open source software is essential to application development, particularly for the web. At the same time, it also represents a key source of application vulnerabilities. To help make open source software more secure, the Linux Foundation has announced a cross-industry collaboration with open source leaders including GitHub, Google, IBM, JP Morgan Chase, Microsoft, Red Hat, the OWASP Foundation, and others. This collaboration is called the Open Source Security Foundation, or OpenSSF. In an August blog post, Microsoft Azure CTO Mark Russinovich explained the OpenSFF’s impetus and mission as follows: Open source is everywhere and essential for just about every company’s strategy Securing open source is essential to security the supply chain for all parties, including Microsoft itself Because open source software is so widely used, attackers can exploit many vulnerabilities. These cover most critical services and their supporting infrastructures, across industries such as utilities, healthcare, transportation, government, and IT (especially traditional software, cloud services and IoT) The community-driven nature of open source software means no central authority is responsible for its quality control and maintenance Because open source code may be copied and cloned, versioning and dependencies are particularly complex and can be hard to follow Open source is vulnerable to developer attack, wherein attackers can become maintainers of open source projects and introduce malware Given all these factors, especially how complex and intertwined open software can be, it’s fair to say that building and securing open source software must be a community-oriented and -supported effort. The OpenSSF home page states that its first group of technical initiatives will include the following areas of focus:  Vulnerability Disclosures Security Tooling Security Best Practices Identifying Security Threats to Open Source Projects Securing Critical Projects Developer Identity Verification The site also offers related security resources from the OSSC ( an analysis of the Open Source ecosystem in pdf format), the Linux Foundation’s CII  (a discussion of vulnerabilities in the Internet core), and Red Hat’s Product Security Risk Report, to help readers get started on understanding open source threats and mitigation approaches and strategies. The OpenSSF GitHub repository is also likely to be of great interest. What is the Kiuwan response to the formation of the OpenSSF? Kiuwan welcomes the formation of the OpenSFF and Microsoft’s participation and leadership role in that initiative. Because open source is such an important part of application development, the Kiuwan team is excited to see community initiatives that are focused on improving the security of open source projects. Information and collaboration are key tools in combating the proliferation of security threats. Kiuwan solutions currently supports OWASP, the Open Web Application Security Project, as well as FS-ISAC, the Financial Services Information Sharing and Analysis Center, and is open to additional opportunities for promoting application security. How does Kiuwan acquire open source software vulnerability and security data? Kiuwan draws its OSS data primarily from the NIST NVD (National Institute of Standards and Technology’s National Vulnerability Database), with a handful of additional feeds. How does Kiuwan obtain implementation recommendations and best practices […]

Read More

Learn About Using Threads Inside Python For A Windows Delphi App In This Sample

We know Delphi supports Multithreading. Multithreading in Python can be achieved using Python Module Threading. However, In a use case like Delphi Application embedding Python(Python4Delphi) or CPython, the interpreter is not fully thread-safe. In order to support multi-threaded Python programs, there’s a global lock, called the global interpreter lock or GIL, that must be held by the current thread before it can safely access Python objects. Locking the entire interpreter makes it easier for the interpreter to be multi-threaded, at the expense of much of the parallelism afforded by multi-processor machines. Some extension modules, either standard or third-party, are designed so as to release the GIL when doing computationally-intensive tasks such as compression or hashing. Also, the GIL is always released when doing I/O. More Details here. This post will guide you on how to evaluate several python functions concurrently using Python4Delphi TPyDelphiThread. Python4Delphi Demo11 Sample App shows how to achieve concurrency(using more interpreters) inside Python. You can find the Demo11 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 Demo11 App: TPythonEngine: A collection of relatively low-level routines for communicating with Python, creating Python types in Delphi, etc. It’s a singleton class. TPythonModule: It’s inherited from TMethodsContainer class allows creating modules by providing a name. You can use routines AddMethod, AddMethodWithKW to add a method of type PyCFunction. You can create events using the Events property. TPaintBox provides a canvas that applications can use for rendering an image. TPyDelphiThread: Inherited from TThread has properties like ThreadState( A pointer which stores Python last state), ThreadExecMode(emNewState, emNewInterpreter). Protected functions like ExecuteWithPython, Py_Begin_Allow_Threads, Py_End_Allow_Threads helps to run concurrently without thread conflicts. 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 Demo11 sample project from the extracted GitHub repository ..Python4DelphiDemosDemo11.dproj. Open this project in RAD Studio 10.4.1 and run the application. Implementation Details: PythonEngine component provides the connection to Python or rather the Python API. This project uses Python3.9 which can be seen in TPythonEngine DllName property. SortModule(TPythonModule) has initialized with 2 Delphi Methods SortModule_GetValue, SortModule_Swap which is imported in python script to perform sorting. 3 arrays are randomized with integer values, later get sorted. Three Sort functions were defined in the script such as BubbleSort, SelectionSort, and QuickSort which is evaluated by PyDelphiThread Instance’s ExecuteWithPython procedure. Note: Don’t override Execute Method, use always ExecuteWithPython. In this Sample, one interpreter Button uses an emNewState(single interpreter with new state and upon execution completion, restores the thread state) ThreadExecMode and three interpreter button use an emNewInterpreter (same as a new state but with new interpreter fully initialized) ThreadExecMode to Execute. procedure TThreadSortForm.InitThreads(ThreadExecMode: TThreadExecMode; script: TStrings); begin RandomizeArrays; ThreadsRunning := 3; with GetPythonEngine do begin OwnThreadState := PyEval_SaveThread; with TSortThread.Create( ThreadExecMode, script, SortModule, ‘SortFunc1’, BubbleSortBox, BubbleSortArray) do OnTerminate := ThreadDone; with TSortThread.Create( ThreadExecMode, script, SortModule, ‘SortFunc2’, SelectionSortBox, SelectionSortArray) do OnTerminate := ThreadDone; with TSortThread.Create( ThreadExecMode, script, SortModule, ‘SortFunc3’, QuickSortBox, QuickSortArray) do OnTerminate := ThreadDone; end; StartBtn.Enabled := False; Start2Btn.Enabled := False; end; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 procedure TThreadSortForm.InitThreads(ThreadExecMode: TThreadExecMode; script: TStrings); begin   RandomizeArrays;   ThreadsRunning := 3;   with GetPythonEngine do   begin […]

Read More