Noutați

TMS MemInsight, Delphi runtime memory inspection: statistics and filters

Using TMS MemInsight is easy: drop a component on your form, set some properties and there you go. Altough the component and UI of TMS MemInsight are currently based on the VCL you can already use it in your FireMonkey (on Windows and without UI), Windows service or console applications or any other headless application, such as a TMX XData server. But in this blog, we dive deeper: TMS MemInsight has a wide API and offers all of its options and features by code. Let’s start by looking at some of the properties of the memory profiler first. To access it, as well as other parts of TMS MemInsight, use the units TMS.MI.Access and TMS.MI.Memory from within your code. These units contain some functions which serve as entry point to gain access to the interfaces needed to control tracing, filters as well as more advanced options like collecting memory statistics as it’s done within the UI. Another handy unit is TMS.MI.Core which offers some ready to use utility functions. You can enable/disable the profiler by setting it’s Active property. You can Suspend/Resume profiling for the current thread by calling the methods of the same name or exclude them completely to control and tune what is being traced. For this, TMS MemInsight also offers filters which allow for even more fine tuning. Filters can also be customized and attached and removed dynamically. The folder “Dev” contains a sample for such a filter which allows tracing of objects contained in certain units only. We will use it in our example below. Another useful method is SuspendMethod which disables tracing for the current thread until the current scope is exited. Usually this is, as the name suggests, the current method, although this has slightly changed in Delphi 11 Alexandria with the introduction of inline variables where the scope might be limited to the current begin/end block. The memory profiler includes three different filters. The Default filter allows to configure, which threads are being traced as well as setting the TraceTypes: mtString, mtObject, mtArray, mtRecord and mtUnknown. Beside of that you can, if your applications is build using run-time packages, select which package classes are shown. The IncludeFilter and ExcludeFilter allow fine grained tracing considering the class name of objects and supports pattern matching. This way you can limit the tracing to certain class names as well as class names matching something like “TYourPrefix*” or exclude class names matching similar patterns. All filters can be activated/deactivated by setting their Active property. You can store and reload these configurations for latter use. Let’s jump right into our first example: collecting memory statistics and dumping them into a file. Working with these statistics is, in almost all cases, my starting point when trying to understand why, where and what the application is consuming. As this is happening during run-time I can use the application, repeat certain functions and observe its behavior to isolate and concentrate on concrete spots. Limiting the tracing on these identified classes by using the above mentioned filters is also helpful. For the sake of this example we create five utility functions: InitializeProfiling, StartProfiling, StopProfiling, ResetStatistics and SaveToFile. InitializeProfiling will set up some default options and attach and configure the filter as well as the memory statistics. We also disable stack traces as […]

Read More

TMS WEB Core for Visual Studio Code 1.9.7.0 released

We’re happy to announce that with the new release of TMS WEB Core for Visual Studio Code, we stepped up the level of web client application development with Object Pascal. The key goals of this new release 1.9.7.0 are: Introduce visual form inheritance Framework synchronization with TMS WEB Core for Delphi Increased robustness, compatibility and stability Improved coding experience thanks to a new OmniPascal update Visual form inheritance Now you can take advantage of the visual form inheritance feature also from the TMS WEB Core Visual Studio Code IDE. This means you can design a form and created an inherited form and use base form class and inherited form live visually in the IDE. Any changes you apply to the base class will be immediately visible in the descending form class and modifications to the descending class are nicely managed and persisted. Using visual form inheritance should significantly increase your productivity when you deal with web application form logic with repeating patterns. See for yourself how this visual form inheritance feature is used in the IDE: Framework synchronization with TMS WEB Core for Delphi In the new release, all latest features & improvements of the TMS WEB Core framework are adopted in TMS WEB Core for Visual Studio Code. This includes: New : geMemo editor type added in TWebStringGrid New : WordWrap property added in TWebStringGrid New : TWebResponsiveGrid.OnGetItemTemplate event added New : Support for custom images added in TWebDBNavigator New : SelectCell() added in TWebTableControl New : ScrollRowInView() added in TWebTableControl New : MultiSelect option added to TWebResponsiveGrid New : Miletus use of USB UART on Raspberry Pi New : Miletus extensibility through libraries New : Hyperlinks clickable with Ctrl key in TWebRichEditToolbar New : Hyperlink button added in TWebRichEditToolbar New : FindCellFindNext functions added in TWebTableControl New : Filtering capability added in TWebTableControl TWebDBTableControl       + various smaller improvements and fixes. Given that the TMS WEB Core framework under TMS WEB Core for Visual Studio Code is identical to TMS WEB Core for Delphi, this means you can perfectly continue development projects handled by other team members in Delphi also from Visual Studio Code and vice versa.  Increased robustness, compatibility and stability. While TMS WEB Core for Visual Studio Code is younger than the version for Delphi, it comes with the additional challenge that it has a web technology based form designer. This means that it uses a full WYSIWYG form designer that also uses HTML elements or complete HTML templates live on the form designer. You can understand this brings increased complexities to manage in the designer and we focused on improving the experience at design-time in this new release. Improvements were done to the framework to handle this design-time situation better and we significantly extended the number of tests run from within the IDE itself to guarantee stability & compatibility. This new release should move this a significant step forward. Improved coding experience thanks to a new OmniPascal update Not really a part of this new TMS WEB Core for Visual Studio Code 1.9.7.0 release, but the new OmniPascal version will still improve your coding experience while developing in TMS WEB Core for Visual Studio Code. We worked together with the author of OmniPascal. This Visual Studio Code plugin provides code completion & highlighting […]

Read More

The Top 5 Misconceptions About Windows Program Development

The Windows operating system is the most used desktop operating system in the World. Windows 11 launched with a substantial firestorm of publicity from Microsoft. With the new innovations such as the excellent Windows Subsystem For Linux (WSL) there seems to be a large uptick in interest from coders looking to Windows program development. Microsoft have consolidated their position as the dominant desktop operating system and by incorporating increasingly innovative features such as Android support and the WSL Windows is in a very strong position to beat back challenges from those who are looking toward devices like Chromebooks and Linux on the desktop. Accompanying that ethos of modernization Microsoft turned their attention toward the look and feel of Window’s user interface. The Microsoft Fluent Design System introduced a new UI/UX to the Windows OS ecosystem. It was a lighter, more modern ‘feel’ to the controls and embraced many of the stylistic ideals from the likes of Apple and Android. The current Windows program development industry is embracing the open platform, and this means everyone has unrestricted access to run the most comprehensive range of apps on Windows. This open platform also enables developers to build the apps and experiences that empower users to create, learn, and play. Video courtesy of Microsoft.com We can see lots of improvements in these three areas for Windows 11: The Fluent Design System & the new Microsoft Store News for Game Developers and Gamers Advances in end-to-end Web development along with new features for native Windows apps. The new Microsoft Store on Windows announced that it accepts more app types, like Win32, .NET, and PWAs, and support for Android apps from Amazon Appstore. This all creates a new collection of complex development tools that you should know. You might already think about how complicated it gets, but with Delphi, everything becomes much easier. In 1995 Delphi was acclaimed as the next-generation Windows development tool, blending the most intuitive visual design environment with the unrivaled performance of a world-class optimizing native code compiler. With Delphi, you can create apps for all major platforms with less coding effort. You can target Windows, Android, iOS, macOS, Linux, and Web with your single codebase. If you search for a Windows desktop development tool online, you come across web technologies that offer desktop development. But these tools force you to learn many technologies to create a simple application. Moreover, it is hard to understand, and applications built with web technologies do not offer your product pure device performance and security. Delphi’s RAD Studio provides native app development 5x faster than other development tools. The syntax of the Delphi language is friendly, and it is like giving commands to the computer using plain English. I’m pretty sure that in several hours you can learn all the basic details of the Delphi programming language and its visual development tools and start developing cross-platform native GUI applications. For instance, this Delphi Boot Camp helps you to learn: Delphi IDE and Intro to your first app Delphi Language from basics to advanced How to build compelling user interfaces with FireMonkey Game Development with Delphi and FireMonkey Mobile and Database Development and more! Is it hard to deploy a Windows app to the Microsoft Store? Since we have lots of different technologies and the Microsoft Store […]

Read More

Embarcadero MVP Jens Fudge on FlexCel

TMS FlexCel is one of our flagship products, with well over 20 years of development going into it and meanwhile supporting the near entire Microsoft Excel feature set and as development tools Delphi, C++Builder and .NET via C#, VB.NET or .. actually any Windows language that can use DLL’s via TMS FlexCel DLL.  While FlexCel can be used to read and write .XLS and .XLSX files extremely fast, on-the-fly and most importantly, without the need to have Microsoft Excel installed, it can actually also being used as a reporting tool where it generates Excel, PDF, HTML, SVG, Image files… with  report templates defined in an Excel file and possibly also data coming from an Excel file. Today, we bring you a fantastic opportunity to discover how Jens Fudge, Embarcadero MVP in Denmark, frequent speaker at Delphi conferences uses FlexCel. Jens is not only Delphi expert, he was also Paralympic Champion Archery and still heavily involved with archery and training top sportspeople. And that’s not all, Jens runs his own Delphi development consulting company and published in 2020 also a book “Choose to be a Winner” about adopting a winning mindset for sports people but equally applicable to anyone wanting to get more out of life.  See in this video how Jens Fudge created score cards as reports from archery competition results using FlexCel: If you feel like discovering more of the power of FlexCel, Jens informed us that he was involved in setting up a one hour webinar for the Danish Delphi user group in March. So, stay tuned, as soon as we have the final information on this webinar, we’ll inform so you can also register and attend this webinar! 

Read More

Final Build Times With Delphi And Electron – Benchmark Study

The final build time metric in the “Discovering The Best Cross-Platform Framework Through Benchmarking” whitepaper measures the total amount of time required for the framework to produce the final build for the benchmark application. The whitepaper evaluates two frameworks supporting multi-platform desktop application development: Delphi and Electron. This is the fourth in a series of blog posts looking more closely at each of the 26 individual metrics used in the study, and how Delphi and Electron each fared on these metrics. The first can be found here. Download the complete whitepaper here Benchmark Category: Developer Productivity Developer productivity is the measure of effort and code required for developers to complete typical development tasks. Productivity directly impacts product time-to-market and long-term labor costs so tools that increase developer productivity have substantial impacts on business timelines and bottom lines. Productivity can be realized in two distinct ways – reduced coding requirements due to native libraries, and IDE tools like code-completion and visual design.IDEs with greater library breadth generally result in fewer lines of code per application and produce a clean, lean codebase that minimizes opportunities for bugs or maintenance problems later in the product life cycle. Benchmark Metric 4/26: Final Build Time Final Build Time: Total hours required to “speedrun” the application using a known solution. This measures the number of actions and volume of code required to complete the full application by an expert developer with perfect knowledge of a working solution. Productive frameworks reduce development time on repetitive but slightly altered tasks. Benchmarking Results Delphi Score: 5 (out of 5) Electron Score: 3 (out of 5) Once complete, the Electron application was “speedrun” in half the time of the Delphi application despite requiring almost twice as many lines of developer-typed code. This is largely because Delphi’s IDE provides visual application development [P2] through drag-and-drop components, decreasing the complexity of GUI creation at the cost of increased time configuring components. Delphi exhibited strength in other areas, however. Its database and network code composed only 46% of developer-typed lines compared to 61% for Electron, a clear indication that Delphi’s FireDAC database library and network tools abstract those operations better than Node.JS, reducing developer effort and opportunities for error. Overall, similar results in the initial development phase made Delphi and Electron appear equivalent. This conclusion changed after amending the specification to add internal unit tests. Once the contractors sufficiently understood the test requirements, the Delphi application was modified andaccepted in 8.33 hours of work. The Electron application, on the other hand, took 47.8 hours to add the same functionality. Although the Electron developer implemented the test features in his development environment within 28.6 hours, troubleshooting a variety of Javascript and database library errors occurring on the client machines (Windows, macOS, Linux) nearly doubled the delivery time of the amended RSS reader to 47.8 hours. Download the complete whitepaper here

Read More

Code Size Benchmark Comparison Between Delphi And Electron

Code size is a simple metric that compares the number of lines of code required to create the benchmark application in the study. The “Discovering The Best Cross-Platform Framework Through Benchmarking” whitepaper evaluates two frameworks supporting multi-platform desktop application development: Delphi and Electron. This is the fifth in a series of blog posts looking more closely at each of the 26 individual metrics used in the study, and how Delphi and Electron each fared on these metrics. The first can be found here. Download the complete whitepaper here Benchmark Category: Developer Productivity Developer productivity is the measure of effort and code required for developers to complete typical development tasks. Productivity directly impacts product time-to-market and long-term labor costs so tools that increase developer productivity have substantial impacts on business timelines and bottom lines. Productivity can be realized in two distinct ways – reduced coding requirements due to native libraries, and IDE tools like code-completion and visual design.IDEs with greater library breadth generally result in fewer lines of code per application and produce a clean, lean codebase that minimizes opportunities for bugs or maintenance problems later in the product life cycle. Framework productivity was evaluated according to six metrics that sought to capture howframeworks and IDEs improve product time-to-market. Benchmark Metric 5/26: Code Size Code Size: Total lines of code the developer must write, adhering to accepted formatting and styles, to create a fully functional application. This objective measure of code volume sheds light on the difficulty of future code maintenance – more code typically requires more time to learn and troubleshoot. Benchmarking Results Delphi Score: 5 (out of 5) The Delphi FMX RSS reader required 178 lines of typed code total and 97 lines for the GUI (54%). Electron Score: 3 (out of 5) The Electron RSS reader required 293 lines of typed code total and 115 lines for the GUI (39%). Download the complete whitepaper here

Read More

Alister Christie And Serge Pilko Talk Delphi, Part 2 of 3: Farms And Books

On 12 January Serge Pilko, Embarcadero MVP and founder of Softacom, a world leading Delphi software development services and software solutions provider, published a video of his interview with Alister Christie, author of the legendary “Code Faster in Delphi” and the creator of hundreds of videos that have shown many of today’s Delphi developers around the world how to program and accomplish things with Delphi. Download Code Faster in Delphi for free here Alister also has an upcoming book, “Code Better in Delphi”, scheduled to hit bookstores soon. We have chosen to publish the transcript of their conversation in a three-part series of blog posts, of which this is the second. Read the first part here Alister Christie And Serge Pilko Talk Delphi, Part 2 of 3 Serge For me, because I am also creating some content for me, it’s interesting. Where are you getting your ideas for your videos nowadays? Because… Alister Sometimes it’s just, you know, I’ll stumble across something that’s interesting. So now we might make a video on it. Other times, you know.. sometimes YouTube comments, a source of video content. Serge Okay. Alister Or maybe someone else’s blog, post an idea for something. Serge Do you have any personal messages from people? For example, you posted some video, then they are trying to reach you somehow. I don’t know. Alister Yeah. I get, you know, a fair number of comments, Youtube comments, and occasionally I’ll get messaged. Quite often, LinkedIn is often the best way to get in touch with me. I’m Allister Christy on that. Serge Are you answering their questions? Because for example, sometimes we are posting something about Delphi and FireMonkey, and we have a lot of haters for Delphi, saying “stop, you’re providing wrong ideas, it’s dead, stop, you’re a liar. I’m just ignoring such kinds of comments. Alister I tend to get much negative. I often get comments that I talk too fast, which I definitely do, and I can’t help it. This is just my normal talking speed. I try to slow down a little bit for recording videos, but it can be hard to concentrate on so many different things when recording. Yeah, that one gets lost, I just end up talking fast, but yeah. ideas.  Yeah. Like the Deepstack one that was just, you know, I saw that Blue Iris, which is a security software I used was using it for doing object detection for providing alerts. And I thought “that obviously has an API. I wonder if you can access it in Delphi”, and of course, you know, has a  REST…, so it was pretty trivial to work it out. Serge Your format, like short videos, you think this is the best way for getting information or it’s more convenient for you? For example, for me, it’s not easy to find and prepare a huge video to deeply explain some subject. What about you? Because for you it’s easy, or you think it’s useful for the people, because they want long videos, because…? Alister Yeah, I, most, most of my videos are short. I mean, I’ve had to do DelphiCon, Coderage and that kind of stuff, and they took about an hour, 45 minutes to an hour, maybe half an hour. And usually, to produce an hour of […]

Read More

How To Save Money On UI Components

The quality of the tools you use almost entirely determines the quality of the websites and apps you create. So, when it comes to building websites and apps, it is always better to use efficient and cost-effective resources that can complete the task in less time than usual. This is where ready-made UI components come in. Ready-made UI components are comprehensive resource sets that allow you to properly plan the structure of your design without sacrificing your original and creative ideas. Using high-performing UI components (progress bars, checkboxes, buttons, and so on) like Sencha for user interface design can save a lot of money. They enable designers to produce outstanding visuals on time. Sencha’s UI components, on the other hand, allow you to focus on what you do best: creating great designs, rather than wasting time figuring out how to implement components. Ready-made UI components like Sencha Ext JS can help in the improvement of your design workflow in several ways, but the two most common applications are website and mobile design and prototyping. These tailormade UI components and elements that you can combine in a new project entirely or use in your current project, saving you not only a lot of time but also a lot of resources. Let’s take a look at how to save money on UI components.   How UI Components Save Your Clients Money Experiencing a small project getting out of control is an annoying situation. Workloads quadruple, the project takes twice as long as expected, and clients become frustrated that they must foot the bill for the extra hours. To help manage expectations, designers frequently inform their clients that it is difficult to accurately estimate the time it will take to complete an app or website. While ready-made UI components like Sencha will not do the estimation for you, it will help you get a more realistic sense of how long a project will take. The design is already in place; all you have to do now is structure the elements from the Sencha high-performing UI components based on your created wireframe, and then customize those design elements to meet your brand requirements. The time required to create the design elements of an app or website can be unpredictable at times. High-performing UI components will help you estimate project costs by giving you a more realistic sense of what a design project will entail and how long it will take. This will save your clients money.   How UI Components Save Your Money Sencha Ext JS UI components can also help you save money! Our UI components enable you to create high-quality designs without hiring additional talent or spending a fortune on design assets. Premium high-performing UI components may appear expensive at first glance, but if you intend to use them for every design project, it will be an extremely worthwhile investment. While tailormade UI components like Sencha Ext JS require an initial investment, this investment will result in lower budgets in the long run because brands will not need to spend more on foundational design elements unique to each project. These UI components allow for and contain many high-quality functionality elements and designs, and they are flexible, which means that more elements can be added to these components over time, saving money in […]

Read More

The Beginner’s Guide to Clean Code Windows Development

Designing a well-crafted and easily manageable software system is the ultimate goal of any professional developer. Therefore, we need the best windows development tool and coding practices to achieve this goal. Clean coding is one such core practice that can help us in our mission. However, unfortunately, many new developers are not even aware of clean coding. So, let us briefly discuss clean coding methods and their relationship to the best windows development tool, Delphi. What is clean code? By definition, clean code is well crafted, easy to understand, and easy to change because change is inevitable in any usable software. To change a software system, we need to understand it. If the code is poorly written and messy, it would not be cost-effective to change it. On the other hand, if code follows a well-thought structure, is well organized, and is easily understandable, it is clean code. What are the basic concepts of clean code windows development? Clean coding is a discipline in itself now. Here is a brief overview of some basic concepts of clean coding. Why is code duplication bad? Clean code does not repeat itself because code duplication generates many problems, from bug fixing to updating and maintenance. What is the “boy scout” rule? Always leave the code in a better state than you found it. If you always check out with a little bit better code, then the quality and clarity of your codebase will increase over time. On the other hand, if you do not follow this rule, the code will rote over time, and it will be a nightmare to maintain. Do you have empathy? Show that you care about the person who will read your code. For example, I once saw that the previous electrician marked a wire with a sticker in electrical wiring. It was a good help for the new electrician to understand and repair the circuit. Both of us were thankful for this act of kindness of the previous electrician. Why is naming so important? A code is full of variables, constants, methods, arguments, classes, directories, etc. If a developer takes some time and care in naming these entities, it will drastically increase the readability of the code. There will not be a need for many comments to explain these variables. Choose a name that clearly describes their purpose, functionality, and usage when naming your entities. What is the Single Responsibility Principle (SRP)? If a function or class does more than one thing, you have not designed it well. On the other hand, making an entity do only one thing well improves its readability, usability, and changeability. How many function parameters are ideal? Single parameter functions and procedures are ideal. However, you can increase this limit by up to three parameters. You should pass an object instead of many parameters for anything above that. This arrangement will improve readability, and it is easier to change if necessary. Are you directly using numbers and strings? If a code uses a value like ’33’ or ‘m’ in assignments, it is challenging to guess its purpose. Therefore, you should name these as constants and then use those constants in all assignments. With this arrangement, if you need to change it in the future, you can easily do it in one place only. […]

Read More

FNC Conversion Components in TMS Analytics & Physics 3.3

From version 3.3, TMS Analytics & Physics library contains several FNC components for converting math formulae and units of measurement to special text formats. In this article, we’ll consider how to do the conversion and how then use the converted strings in Delphi applications.  Let’s begin with formula converters: TFNCFormula2PlainConverter – converts a formula to plain text. TFNCFormula2TeXConverter – converts a formula to TeX format. The TFNCFormula2PlainConverter component has the following published properties: Formula (string) – a formula to convert. PlainFormula (string) – the formula in plain text format (read-only). Valid (boolean) – the formula is valid for conversion (read-only). Error (string) – description of the error if occurred during conversion (read-only). The component provides a very simple functionality: when the ‘Formula’ property changes, the value is converted to plain text format and assigned to the ‘PlainFormula’ property.  What is the plain text format and when it could be useful? Plain text format just presents a formula as a string using special Unicode characters to make it closer to natural math notation. For example, the formula ‘x^2’ can be written with the superscript symbol as ‘x2’. In the following picture, an example of such conversion is presented. Here we should note that not all formulae can be presented in this format. If a formula is not valid for the conversion, an error message will be shown with the ‘Error’ property. Now let’s use this converter to make a fine math application. In one of the previous articles, we explained how to use curve fitting FNC math components. In the following picture, we showed an example of data approximated with a Taylor series.   On the FNC chart, we showed the formula of the fitted curve in the legend. Let’s use the converter and improve the design of the application. We just need to write a small piece of code: procedure TForm1.ShowCurveLegend(const formula: string);begin  FNCFormula2PlainConverter1.Formula:= formula;  TMSFNCChart1.Series[1].LegendText:= FNCFormula2PlainConverter1.PlainFormula;end;procedure TForm1.FNCApproxFunction1D1FormulaChanged(Sender: TObject; const formula: string);begin  ShowCurveLegend(formula);end; When a formula of the approximated function is changed, we convert it to plain text format and show the formula on the chart. The resulting form is presented in the picture below. As one can see, the formula of the fitted curve looks like a natural math expression, without superfluous symbols, like power operator ‘^’ and indexing brackets ‘[]’. One more example of the curve, fitted with a Fourier series, is shown in the following picture.   The full source code of the demo project is available with the latest version of TMS Analytics & Physics library.  We can use the same approach to present units of measurement in the form of natural physics notation with the TFNCUnit2PlainConverter component. An example of such conversion is shown in the picture below.   The next component TFNCFormula2TeXConverter has similar functionality, but it converts formulae to TeX format. This format is not for human reading, so, we need a drawing library to display formulae in natural math notation. We’ll use the MathJax library, as described in this article, together with the TTMSFNCWebBrowser component. Here is a simple code for converting a formula to TeX format and showing it in the browser component: procedure TForm1.DrawFormula(const formula: string);var  texf, htmlcode: string;begin  FNCFormula2TeXConverter1.Formula:= formula;  texf:= FNCFormula2TeXConverter1.TeXFormula;  htmlcode:= GetTeXHTML(texf);  DrawTeXInBrowser(htmlcode);end; Thus, we have a simple application to display math formulae. An example of a […]

Read More