TMS Software. All-Access

Another successful webinar!

Another successful webinar! On Thursday 4/11 we had a very successful webinar about our thriller project RADoween which we finalized in just 5 working days. It’s so cool that we can use our platform TMS Web Academy to reach people from around the world. Note that TMS Web Academy is, just like the RADoween app developed with TMS Web Core. One of the interesting features we have in TMS Web Academy is a view on our audience. On this map here you can see from which countries our viewers of the last webinar are attending from.  Viewers per country Can’t get enough? The recording of the webinar will be available on Tuesday next week for everyone.  You can also read this blogpost to learn more about the RADoween application. For those who missed this webinar and still want a similar experience of a live webinar, you’ll be able to attend Bruno Fierens session at Delphicon on Nov 16. Save your seat here!

Read More

Free Route Directions with OpenRouteService in TMS FNC Maps v2.3

TMS FNC Maps v2.3 now includes a new free service for geocoding and directions in addition to the existing supported directions services from Azure, Bing, Google, Here and MapBox. OpenRouteService The OpenRouteService API service provides geocoding, reverse geocoding and directions free of charge. It does, however, require the use of an API key. This service can be used in combination with all supported mapping services in TMS FNC Maps. Specifically in combination with the OpenLayers mapping service this is a worthwhile free alternative to comparable paying services. Geocoding A geocoding request converts a text address to a latitude & longitude coordinate. The coordinate can then be used to display a location on the map. With the following code we are going to look up the location of “Baker Street, London” and display it on the center of the map with a marker and a title that contains the address.Note that this example uses the asynchronous method with a callback. procedure TForm1.Button1Click(Sender: TObject); var Item: TTMSFNCGeocodingItem; begin TMSFNCGeocoding1.APIKey := ‘abc123’; TMSFNCGeocoding1.Service := gsOpenRouteService; TMSFNCGeocoding1.GetGeocoding(‘Baker Street, London’, procedure(const ARequest: TTMSFNCGeocodingRequest; const ARequestResult: TTMSFNCCloudBaseRequestResult) begin if (ARequestResult.Success) and (ARequest.Items.Count > 0) then begin Item := ARequest.Items[0]; TMSFNCMaps1.BeginUpdate; TMSFNCMaps1.SetCenterCoordinate(Item.Coordinate.ToRec); TMSFNCMaps1.AddMarker(Item.Coordinate.ToRec, Item.Address); TMSFNCMaps1.EndUpdate; end; end ); end; Reverse Geocoding A reverse geocoding request converts a latitude & longitude coordinate to a text address. The text address can then be used to display an address associated with a location on the map. With the following code we are going to track a click on the map, retrieve the address for that location and display it on the map with a marker and a title that contains the address Note that this example uses the synchronous method that provides an immediate result without a callback. procedure TForm1.TMSFNCMaps1MapClick(Sender: TObject; AEventData: TTMSFNCMapsEventData); var Address: string; begin TMSFNCGeocoding1.APIKey := ‘abc123’; TMSFNCGeocoding1.Service := gsOpenRouteService; Address := TMSFNCGeocoding1.GetReverseGeocodingSync(AEventData.Coordinate.ToRec); TMSFNCMaps1.BeginUpdate; TMSFNCMaps1.SetCenterCoordinate(AEventData.Coordinate.ToRec); TMSFNCMaps1.AddMarker(AEventData.Coordinate.ToRec, Address); TMSFNCMaps1.EndUpdate; end; Directions A directions request provides step by step directions between a start and end location. The directions data can then be used to display a route on the map. Additional options can be configured for the directions request, including: waypoints, alternative routes and language. With the following code we are going to retrieve driving directions between New York and Philadelphia. On the map, a marker is displayed at both the start and end location, a polyline displays the route and a label displays the distance and duration of the route.In the TListBox on the step by step directions are displayed for each step in the route directions. procedure TForm1.Button1Click(Sender: TObject); var cStart, cEnd: TTMSFNCMapsCoordinateRec; begin cStart.Latitude := 40.68295; cStart.Longitude := -73.9708; cEnd.Latitude := 39.990821; cEnd.Longitude := -75.168428; TMSFNCDirections1.APIKey := ‘abc123’; TMSFNCDirections1.Service := dsOpenRouteService; TMSFNCDirections1.GetDirections(cStart, cEnd, procedure(const ARequest: TTMSFNCDirectionsRequest; const ARequestResult: TTMSFNCCloudBaseRequestResult) var it: TTMSFNCDirectionsItem; I: Integer; p: TTMSFNCOpenLayersPolyline; Hours, Minutes: string; begin TMSFNCOpenLayers1.ClearPolylines; ListBox1.Clear; if ARequestResult.Success then begin if ARequest.Items.Count > 0 then begin TMSFNCOpenLayers1.BeginUpdate; it := ARequest.Items[0]; TMSFNCOpenLayers1.AddMarker(it.Legs[0].StartLocation.ToRec, ‘New York’, DEFAULTWAYPOINTMARKER); TMSFNCOpenLayers1.AddMarker(it.Legs[0].EndLocation.ToRec, ‘Philadelphia’, DEFAULTENDMARKER); Hours := IntToStr(Round(it.Duration / 60) div 60); Minutes := IntToStr(Round(it.Duration / 60) mod 60); p := TTMSFNCOpenLayersPolyline(TMSFNCOpenLayers1.AddPolyline(it.Coordinates.ToArray)); p.StrokeColor := gcBlue; p.StrokeOpacity := 0.5; p.StrokeWidth := 5; p.&Label.Text := FloatToStr(Round(it.Distance / 1000)) + ‘ km, ‘ + Hours + ‘h ‘ + Minutes + ‘ min’; TMSFNCOpenLayers1.ZoomToBounds(it.Coordinates.Bounds.ToRec); TMSFNCOpenLayers1.EndUpdate; ListBox1.Clear; for I := 0 to it.Steps.Count – 1 do begin ListBox1.Items.Add(it.Steps[I].Instructions) end; end; end; end ); end; Available Now The TMS FNC Maps v2.3 update is available now for Delphi & Visual Studio Code (with TMS WEB Core). You can download the latest version and start using the new features right away!

Read More

Thriller: a story to go from idea to live web app in less than 5 working days

All Blog Posts  |  Next Post  |  Previous Post Bookmarks:  Thursday, October 28, 2021 This is a different article. It’s a little bit longer than usual. It’s the story of how a software developer team, working together, using wonderful & highly productive development tools, made an idea become real in less than 5 working days. It’s the story of how TMS Software, using Embarcadero Delphi 11, TMS Web Core and TMS XData, made an unexpected and time-constrained request from Embarcadero to create RADoween, a cloud app available on nearly every platform around. In less than 5 working days! We hope you enjoy the ride.   The start Thursday Oct 14 at 16:24, Bruno Fierens received an email from Embarcadero General Manager Atanas Popov with a “quick idea” to create a web app that can be used to organise a contest for Halloween fun pics. Basically the app needs to provide the capability to send pictures, show a list of pictures and let people vote for the nicest pictures.  Bruno saw this email only a bit later this same day at around 18:00 and replied: And yes, only a few minutes later, on Oct 14 18:23, Bruno learned that the web app had to be live on Oct 21, that is 5 working days later and that technically we basically had a free choice for the needs for hosting and back-end: Realizing the immense challenge this would be if Bruno accepted to create this web app, Bruno immediately reached out an hour later to colleague and architect of our REST back-end server product TMS XData, Wagner Landgraf:  Over a Whatsapp call this Thursday night of Oct 14, Wagner and Bruno first of all discussed if it was feasible at all to allocate on such a short term the time and resources to create this project and also importantly, what could be the potential benefit for the TMS team to accept this somewhat unusual challenge. Bruno and Wagner agreed that this was clearly a risk to deliver this in such an incredibly short time, that if this challenge was successfully handled, it would be a very nice demonstration of the productivity that Delphi developers can have with Delphi and the TMS products. And finally, when hard challenges are given, Bruno and Wagner share that competitive spirit to prove we can do the impossible. But having become a bit older (and wiser?), Bruno and Wagner decided to leave the call with the decision to ask  Atanas commitment that there could be a nice promotional action around it for Delphi 11 & TMS tools and at least sleep one night over it before making a final decision. Friday Oct 15th, Bruno wakes up and finds the email with the confirmation from Atanas about the commitments. So, now there isn’t much time left for doubts, sometimes in life, one just has to jump and with this in mind Bruno leaves home for the office and first thing is having a meeting with the whole Belgian team to inform them about the story that crossed our path. Given the extensive experience with TMS WEB Core from our colleague Bradley Velghe with developing the TMS Web Academy, we decided in the meeting that Bradley would be the main developer for the front-end with TMS WEB Core. Bruno […]

Read More

The much anticipated TMS WEB Core v1.9 is released

For this new release of TMS WEB Core v1.9, we let us inspire by the extra-ordinary nature of the Italian place Sentina along the coast of the Adriatic sea. It is along this coast that in 1955 the famous Mille Miglia race was happening and that inspires the entire cycle of releases of TMS WEB Core. After the wonderful place Sirolo we chose for v1.8, we believe Sentina is equally beautiful.  TMS WEB Core v1.9 Miletus highlights As many TMS WEB Core users know meanwhile, it also brings cross platform development based on web technology via the Miletus technology. That means that you can create from TMS WEB Core a desktop cross platform application that will have a GUI built with HTML5/CSS3 and can be deployed as single EXE executable on Windows, macOS and Linux. In the area of Miletus, the two highlights for TMS WEB Core v1.9 are that from now on we support macOS ARM based CPUs as well as Raspberry Pi OS desktop apps.     So, from your favorite Delphi IDE, you can create a Miletus executable and do XCOPY deployment to your Apple device (with M1 CPU or Intel CPU) as well as to your Raspberry Pi device. The interesting part for Raspberry Pi is that there are also new components to let you take advantage of the hardware extensions connected to your Raspberry Pi via i²c, SPI, UART or GPIO.See for yourself in this video from colleague & evangelist Dr. Holger Flick: or read all the details about it in this blog.  TMS WEB Core v1.9 framework highlights Of course, TMS WEB Core v1.9 means much more than adding these two new Miletus targets. Also on the framework side we did numerous improvements and brought several new features. New Bootstrap 5 project typeOne of the immediately noticeable new features is the new Bootstrap 5 enabled web client application template. From the Delphi IDE, simply select this type and the IDE will create for you a ready to use Bootstrap 5 enabled app, including the deployment of the minimum Bootstrap JavaScript and CSS file. When you drop components on the forms in the Bootstrap 5 project, these components will be initialized with class settings to match preferred Bootstrap 5 CSS classes. We think this will help you gain more productivity than ever. Other new features New : TWebEdit.SpellCheck property added New : TWebHttpRequest GetSize() method & OnProgress event added New : TWebMainMenu & TWebPopupMenu: Menu Item Hint displayed when hovering New : WEBLib.Diagnostics unit added with TStopWatch record New : Runtime form creation demo added New : Published Title,Text,URL properties for TWebShare + Execute function New : ShowPicture, FontHoverColor, DragColor property added for TWebFileUpload New : Demo for Google Recaptcha added   Other than this, there are under the hood numerous component, RTL, library and compiler enhancements that will improve your day to day development job for creating web client applications with TMS WEB Core. Get started! If your customers ask for apps without deployment complexities, that are always up to date, that can be installed from mobile devices without the friction of app-stores and that can take advantage of a rich availability of modern & nice-looking GUIs made with HTML5 and CSS3 on any device with a modern browser, … dive into the world of TMS […]

Read More

TMS WEB Core for Visual Studio Code v1.8.5 is here!

A new week and a new milestone with the TMS team. We have released today a major update for TMS WEB Core for Visual Studio Code.The big new feature in this new release is that from now on, there is support for frames in TMS WEB Core for Visual Studio Code. This not only brings the compatibility between TMS WEB Core for Delphi & TMS WEB Core for Visual Studio Code to a higher level, but of course brings the advantages of using frames to your web client development experience on TMS WEB Core for Visual Studio Code running on Windows, macOS and Linux. Frames support With frames, you can significantly enhance your productivity for creating web client applications. Frames not only reduce repeating the same form logic within a project but can also be shared among different projects. Our chief architect for TMS WEB Core for Visual Studio Code José Leon Serna explains how you can work with frames from TMS WEB Core for Visual Studio Code in detail in this video: Framework improvements Other than frames support, the TMS WEB Core framework also got numerous new features andimprovements. The list is long, we cover in this blog only the major new features: New: Support for annotations & chart area optionsn in TWebGoogleChart New: ColAlignments[] public property for TWebStringGrid and TWebDBGrid New: GetSize() function and OnProgress() event added in TWebHttpRequest New: TStopWatch class in WEBLib.Diagnostics unit added New: Hints for menu items in TWebMainMenu, TWebPopupMenu New: Properties to set Title, Text, URL at design-time for TWebShare New: More design-time customizations for TWebFileUpload like ShowPicture, FontHoverColor, DragColor Improved: Enhanced Bootstrap 5 compatibility Lots of smaller improvements & fixes Get started TMS WEB Core for Visual Studio Code brings a fresh touch to the experience of developing Object Pascal based web client applications with RAD component-based methodology. It adds to that a WYSIWYG web technology-based form designer, can run directly on the operating system of your choice (Windows, macOS or Linux) and it is the IDE of choice for web developers withan abundance of other useful IDE extensions targeted to make the web client development experience as pleasant as possible.Get Visual Studio Code for free from and install the TMS WEB Core for Visual Studio Code extension today and explore this wonderful new world. What’s next Several exciting new features are meanwhile also well advanced in the pipeline. Expect shortly the release v1.9 with support for inherited forms, Bootstrap project template and Miletus targeting macOS ARM CPUs as well as Raspberry Pi among the highlights. So, stay tuned!

Read More

Delphi 11 high DPI? SVG has you covered!

Intro On top of high DPI support at run-time, RAD Studio 11 Alexandria adds support for high DPI at design-time. This means applications/components will need to be modified to live up to this new requirement. This is a tedious job, but nevertheless, one that can be made easier when picking the right tools and libraries. High DPI has been around for quite some time now, impacting the way controls are designed. An important aspect when designing controls is image resources. Typically 16×16 or 24×24 PNG resources are used for non high DPI applications, when running your application on a high DPI screen however (for example at 150%), those sizes are too small. We would need to make sure that each resolution has its image resources available and also dynamically switches between those resources when the scale changes. To take away the need for adding multiple image resources for every possible scale, we designed and integrated SVG into our products and automatically made it available to you.  What is SVG? SVG stands for Scalable Vector Graphics, an XML based graphic format completely built up from vectors. This basically means that an SVG file can be used without quality loss. Coming back to our requirements for high DPI, SVG fits in really nicely. No more numerous image resources for different screen resolutions. Designing various elements of your application based on SVG drastically reduces the time you need to make sure your application looks and feels nice on all various screen resolutions.  SVG also allows you to maintain only one resource. If your application is using one resource for multiple elements, for various sizes, changing only that single resource is sufficient to update your application, not having to worry about the behaviour and look and feel of that resource in all those different situations. In practice SVG support is available when installing one of the following 2 products. After starting the IDE, SVG is already available. This is not only registered for our products, but also available in default VCL controls. We start by adding VCL.TMSFNCTypes or AdvTypes unit (depending on the installed product). The unit will register the SVG type at runtime. At designtime, the package already registers SVG support. For this sample, we take 2 TButtons, one with a PNG and one with an SVG image resource. We drop a TVirtualImageList and a TTMSFNCSVGImageCollection on the form. The TTMSFNCSVGImageCollection can be used to add both image resources. After feeding the TTMSFNCSVGImageCollection to the TVirtualImageList, we are ready to connect our buttons. After connecting everything together, filling up the TVirtualImageList, the buttons look similar, because the resolution of the PNG is 24×24 and no scaling is applied.  TVirtualImageList has the option to scale images, so when we change the resolution from 28×28 to 128×128 making our buttons larger, we see the quality of the PNG is no longer good. The resolution of the SVG however, nicely scales to the new requested size. For PNG, this means we would need to create a TVirtualImageList for different resolutions, managing each list, detecting which scale is applied and applying the correct TVirtualImageList. While the SVG stays nice and sharp, and only one TVirtualImageList is required independent of the initial resolution, or the resolution of the screen. Additionally, using SVGs also immediately provides a clean and […]

Read More

New milestone:TMS FNC WX Pack released

We’re pleased and proud that after numerous months of hard work, we have reached the milestone of the first TMS FNC WX Pack release! A brand new product TMS FNC WX Pack is a brand new product in the FNC family, that is the family of our universal components or in other words, components you can choose to use in VCL applications, FireMonkey cross-platform applications, LCL Lazarus applications or TMS WEB Core based web, PWA and cross platform desktop applications. TMS FNC WX Pack is available as standalone product and as expected, it is also part of TMS ALL-ACCESS and TMS FNC Component Studio. What is WX Pack? With TMS FNC WX Pack, you can leverage existing web libraries in VCL Windows applications, FMX cross-platform applications for Windows, macOS, iOS, Android & Linux, or TMS WEB Core Web applications for any device running a modern browser. The integration is seamless and in almost all cases the functionality is offline usable as components from your Delphi or C++Builder applications. No extra files need to be deployed along with your applications, the components are designed in such a way they look, feel, behave just like other framework components. What components are included? At this moment there are following components included: TTMSFNCWXBarCode Bar code generating component with close to hundred bar code types and extensive customization TTMSFNCWXQRCode QR code generating component with several settings  TTMSFNCWXGHTMLMemo Editor component to edit HTML formatted text, including support for tables, hyperlinks, images, styles, undo/redo, … TTMSFNCWXCamera Access your device cameras and take pictures or record videos TTMSFNCWXPDFViewer Add the capability to render PDF files in your application, page by page and with optional thumbnails TTMSFNCWXVideoPlayer Play videos from local files or from URLs directly in your application TTMSFNCWXJSONFormatter Show JSON data in pretty format in your application TTMSFNCWXSpeechSynthesis Have text spoken with different voices directly from your app. TTMSFNCWXOCR Add an OCR engine to your Object Pascal app. Feed the OCR engine with an image with text and have the text extracted. Includes support for different languages. Returns in the result an accuracy score for the OCR process. Read our first announcement blog for more detailed information but here in this blog we also have two new videos showing and explaining several components in the TMS FNC WX Pack: Curious? If you are curious to see what is possible and how without immediately heading over to the fully functional trial download and experiment with the components, you can also follow our webinar we gave on TMS Web Academy: What’s next This release is only the first small step in this new direction. This new technique offers unseen capabilities to bring non-trivial functionality and new technology to Delphi developers. Several more such functionality that is not readily available at this moment for Delphi developers is on the radar to bring to Delphi developers. So, expect our team to bring new components over the coming months in this category. Our team is also listening to your suggestions and ideas for other functionality to leverage this way and in addition, we will bring more detailed information how you can use the FNC bridging technology yourself to wrap & expose existing web libraries as components in your Delphi apps.

Read More

Free (Reverse)Geocoding with OpenStreetMap Nominatim in TMS FNC Maps

TMS FNC Maps v2.2 now includes a new free geocoding service in addition to the existing supported geocoding services from Azure, Bing, Google, Here and MapBox. OpenStreetMap Nominatim The OpenStreetMap Nominatim API service provides geocoding and reverse geocoding free of charge and does not require an API key. This service can be used in combination with all supported mapping services in TMS FNC Maps. Specifically in combination with the OpenLayers mapping service this is a worthwhile free alternative to comparable paying services. Geocoding A geocoding request converts a text address to a latitude & longitude coordinate. The coordinate can then be used to display a location on the map. With the following code we are going to look up the location of “Baker Street, London” and display it on the center of the map with a marker and a title that contains the address.Note that this example uses the asynchronous method with a callback. procedure TForm1.Button1Click(Sender: TObject); var Item: TTMSFNCGeocodingItem; begin TMSFNCGeocoding1.Service := gsOpenStreetMap; TMSFNCGeocoding1.GetGeocoding(‘Baker Street, London’, procedure(const ARequest: TTMSFNCGeocodingRequest; const ARequestResult: TTMSFNCCloudBaseRequestResult) begin if (ARequestResult.Success) and (ARequest.Items.Count > 0) then begin Item := ARequest.Items[0]; TMSFNCMaps1.BeginUpdate; TMSFNCMaps1.SetCenterCoordinate(Item.Coordinate.ToRec); TMSFNCMaps1.AddMarker(Item.Coordinate.ToRec, Item.Address); TMSFNCMaps1.EndUpdate; end; end ); end; Reverse Geocoding A reverse geocoding request converts a latitude & longitude coordinate to a text address. The text address can then be used to display an address associated with a location on the map. With the following code we are going to track a click on the map, retrieve the address for that location and display it on the map with a marker and a title that contains the address Note that this example uses the synchronous method that provides an immediate result without a callback. procedure TForm1.TMSFNCMaps1MapClick(Sender: TObject; AEventData: TTMSFNCMapsEventData); var Address: string; begin TMSFNCGeocoding1.Service := gsOpenStreetMap; Address := TMSFNCGeocoding1.GetReverseGeocodingSync(AEventData.Coordinate.ToRec); TMSFNCMaps1.BeginUpdate; TMSFNCMaps1.SetCenterCoordinate(AEventData.Coordinate.ToRec); TMSFNCMaps1.AddMarker(AEventData.Coordinate.ToRec, Address); TMSFNCMaps1.EndUpdate; end; Available Now The TMS FNC Maps v2.2 update is available now for Delphi & Visual Studio Code (with TMS WEB Core). You can download the latest version and start using the new features right away!

Read More

Introducing the new TMS Aurelius Dictionary

TMS Aurelius 5.6 has been released, and the major feature is a brand new, full-feature dictionary. Aurelius dictionary is intended to be used in Aurelius queries. The idea is that instead of using strings to reference entity properties, you use the dictionary properties directly. For example, a usual Aurelius query is like this: Results := Manager.Find   .Where(Linq[‘Name’].Like(‘M%’))   .List; But the above approach is error prone, the ‘Name’ string can be wrong, it can be wrongly typed, or the name might be modified. You will only find the errors at runtime. With the dictionary, you can write the query like this: Results := Manager.Find   .Where(Dic.Customer.Name.Like(‘M%’))   .List; You can also reference associated objects, for example, querying all invoices where the country of the customer of the invoice is from Brazil:   Manager.Find     .Select(Dic.Invoice.Total.Sum)     .Where(Dic.Invoice.Customer.Country.Name = ‘Brazil’) It’s a simple thing that makes a huge difference when you are using it daily. You have code completion, you have compile-time check, you minimize the errors at runtime. In summary, it increases your productivity a lot. TDictionaryGenerator.GenerateFile(‘C:SomeFolderMyDictionary.pas’); Or from command-line using the AureliusDictionaryGenerator.exe tool, which generates it from a BPL package: AureliusDictionaryGenerator.exe -i:Default -p:”C:MyProjectBplEntities” “C:MyProjectMyDictionary.pas” Last but not least, the dictionary can be validated at runtime! This way, if somehow the dictionary and the real classes do not match (for example, you might modify your classes and forget to generate the dictionary again), the dictionary will tell you the differences: TDictionaryValidator.Check(Dic); It’s as simple as that. This way you make sure you don’t have surprises at runtime and your dictionary is correct! This is an awesome new feature that brings a night-and-day difference when writing Aurelius queries. If you want to have more detailed information, of course please refer to the documentation where all the above features are explained in details. Wagner R. Landgraf

Read More

Static code analysis for Delphi with TMS FixInsight v2021.10

We are pleased to announce the immediate availability of the new TMS FixInsight version v2021.10! Highlights of this new release are: Delphi 11 support Better type resolving Improved & more robust code parser 5 New code analysis rules added The first three highlights are quite obvious, but let’s have a deeper look at the 5 new code analysis rules that have been added and that will enable you to detect possible code issues faster. W537 Format parameter type mismatch The Delphi compiler is not able to check data types used in Format() function. The example below will compile, but will never work properly. FixInsight is able to catch that.  var  StringTypeParameter: string; begin   Result := Format(‘String type parameter value = %d’, [StringTypeParameter]); end; W539  Interface method call passing the same interface reference as out parameter In the example below access violation will be raised because Delphi compiler cleans up Node variable before the actual Node.GetParent() function call.  type    INode = interface   [‘{39EE5CA9-C4C1-46E1-B326-BAA2D004A5CD}’]    function GetParent(out Parent: INode): Boolean; end;  TNode = class(TInterfacedObject, INode) strict private   // INode.    function GetParent(out Parent: INode): Boolean; end; { TNode } function TNode.GetParent(out Parent: INode): Boolean; begin   Parent := TNode.Create;   Result := True; end; procedure InterfaceErrorSample; var   Node: INode; begin   Node := TNode.Create;   // Before calling Node GetParent, the compiler generates code that clears the Node variable   // because the GetParent parameter is declared with the out parameters.   // Thus calling Node.GetParent will result in AV.   while Node.GetParent(Node) do     // Getting root node.   ;   // Do somthing with root node. end; W540 String variable used twice in a call both as an output and an input parameter In the example below Str parameter in IsStringSliceNotEmpty() function will always be an empty string if you pass the same variable twice. Because the variable will be cleaned up by Delphi compiler. function IsStringSliceNotEmpty(const Str: string; out Slice: string; Index, Count: Integer): Boolean; begin   Slice := Copy(Str, Index, Count);   Result := Slice ”; end; procedure StringErrorSample; var   Str: string; begin   Str := ‘qwerty’;   if IsStringSliceNotEmpty(Str, Str, 1, Length(Str)) and (Str[Length(Str)] = ‘y’) then     ShowMessage(Str); // ShowMessage never run because Str was cleared before the SliceString call. end;  W541 Type-casting from Pointer to Integer type (or vice versa) Type casting from Pointer to Integer and Integer to Pointer is often used in legacy code. But it is not safe on some platforms, because types size are differ. For instance, Pointer is 8 byte on x64, and the code below will lead to data loss. procedure TypecastSample(A: Pointer); var   B: Integer; begin   B := Integer(A);   //… end; W542 Direct floating-point comparison There are several not obvious problems with comparing floating-point numbers. They are perfectly explained in DocWiki https://docwiki.embarcadero.com/RADStudio/Sydney/en/Floating-Point_Comparison_Routines In short, you should never use equal sign to compare two floating-point numbers, but rather use special comparison routines. var    X:Single;    Y:Double; begin   X:=0.1;   Y:=0.1;   if X=Y then    Writeln(‘Equal’)   else    Writeln(‘Not equal’);   ReadLn; end. The program outputs: Not equal Get the update & increase the quality of your code! If you have an active license for TMS FixInsight, the update is available for you free. Users with an expired license […]

Read More