Noutați

#WEBWONDERS : Making web async easy

Even these Delphi developers who have only set the very first steps into web client development will realize that quite a few important functionalities in web clients are executed only asynchronously by the browser.  Why asynchronous? First of all, why did the creators of browser implement certain functionality only asynchronously? The answer to this question is quite simple. For the developers behind the browser, the user experience comes first and a UI that freezes is a big no-go. At all times, the user interface should remain response. The user should never get the impression that the browser or the machine hangs while navigating on the internet. Now, several operations happening in the browser client application can by nature have a fairly unpredictable time to execute. So, no such function should stop the execution of user interface handling code in the browser.  Traditionally, the browser developers solved this “issue” by JavaScript event handlers that are called asynchronously when the result of a certain operation is ready and meanwhile, any other code can continue to execute. This is no different in TMS WEB Core web client applications written in Object Pascal (but of course compiled to JavaScript by the pas2js compiler). Here, we typically solved this with the Object Pascal event paradigm. When a class instance method is invoked that can only have its result asynchronously, this class instance triggers an event handler when the underlying function completed. When the pas2js compiler also introduced support for anonymous methods, we offered for various such asynchronous operations, anonymous result handlers. To focus on this, let’s take the example of a TWebHttpRequest class. This class permits to invoke HTTP(s) requests from the web client application. Clearly, this is an operation with an unpredictable duration, hence, the result of the request should be asynchronously handled. Classic approaches Example 1: handling via an event: // method starting the HTTP request procedure TForm1.WebButton1Click(Sender: TObject); begin   WebHttpRequest1.URL := ‘https://www.tmssoftware.com/sample.json’;   WebHttpRequest1.Execute(); end; // TWebHTTPRequest event handler for OnResponse procedure TForm1.WebHttpRequest1Response(Sender: TObject; AResponse: string); var jo: TJSONObject; jv: TJSONValue; begin jo := TJSONObject.Create; try jv := jo.ParseJSONValue(AResponse) // do any further processing here on the parsed JSON finally end; end; Example 2: handling via an anonymous method: procedure TForm1.WebButton1Click(Sender: TObject); begin WebHttpRequest1.URL := ‘https://www.tmssoftware.com/sample.json’;WebHttpRequest1.Execute( procedure(AResponse: string; ARequest: TJSXMLHttpRequest) var jo: TJSOBject; jv: TJSONObject; begin jv := TJSONObject.Create; try jv.ParseJSONValue(AResponse); // do any further processing here on the parsed JSON finally end; end); end; Introducing promises Now, while the implementation using anonymous methods probably leads to fairly readable code, imagine needing to handle with multiple HTTP requests that depend on each other, which is in web development a fairly common use-case. While you can in theory invoke another http request from the anonymous method handler that is in turn also handled by a new anonymous method handler, you can see that it quickly becomes clumsy. In the JavaScript world, a more elegant solution was introduced in 2015 with the ES6 standard and by now, any modern browser adopted this and supports it. The good news is that the pas2js v2.0 compiler also embraced and adopted JavaScript promises and offers a Pascal styled equivalent. If you want to read all about JavaScript promises, there are many good resources, but this is a well-written and concise one. In a nutshell, with pas2js […]

Read More

Published March 31, 2021 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 As applications become increasingly cloud-based – or even, cloud-native – more and more such code is sending data to and from cloud-based stores, both public and private. This makes the methods and controls that such applications use to access the cloud of particular interest. It also keeps the onus on application owners to protect and preserve application data, particularly when it involves information subject to compliance and regulatory requirements. That brings a host of other concerns into play that range from preserving privacy and confidentiality to the “right to be forgotten” (a GDPR requirement that obliges organizations to dispose of data about any registered individuals within 30 days of request for same, or face fines and penalties). Pass the Data, But Not the Buck Indeed, organizations must realize and own up to their responsibility for data, even when it leaves their hands and goes into the cloud. At best, the cloud service provider will assume a “shared responsibility” for an organization’s data once it hits their servers or data stores. But always, the organization that acquires (and presumably controls and protects) such data remains legally responsible for its privacy, confidentiality, and disclosures of breach, theft, or unwanted access or disclosure. Thus, organizations that use cloud platforms should thoroughly understand the provider’s security capabilities, and any data protection (such as encryption, access control and audit, and so forth) that the provider offers, and what responsibility and liability it assumes for data and applications that run within its systems. Best Security Practices for Cloud Access For cloud-consuming organizations, that’s just the beginning. Best security practices also insist that organizations implement the following principles where access to cloud applications, data, configurations, and resource consumption are concerned: Apply the Principle of Least Privilege (PLP): all access should be set to “deny” by default and only so much access allowed for authorized parties as they need to use an application (ordinary users) or administer the organization’s cloud environments and settings (and all admin level access should be logged, and routinely audited, especially use of privilege, account management, configuration and set-up of applications and data stores, and so forth). Use strong authentication, 2FA or better: Ideally, all access to cloud-based applications and data should require jumping demanding hurdles before access requests get granted. At a minimum, ordinary users should be required to use two-factor authentication (2FA: cellphone or email confirmation of one-time pads). Higher-level access, should probably use multi-factor authentication that includes something beyond 2FA, such as a certificate, smart token device, biometric data (fingerprint, facial scan, and so on), or be tied to a specific admin workstation’s MAC address. Encryption for data in motion and at rest: By default, organizations should turn on and use the strongest encryption they can employ without unduly affecting data access and/or application performance. Data should also be encrypted wherever it’s stored, both at endpoints when used on the client side, and in data stores when in use by an application or truly at idle rest (active or multi-tiered storage repositories). […]

Read More

Using Tabbed Maps Visualization In A Windows App is Easy!

This visualization sample demonstrates the use of the TMapView class. We will show how to display and interact with the map, including: Changing between two tabs that display different maps. Showing the coordinates of the map center. Zooming in and zooming out both maps. Location Visualization You can find the Tabbed Map sample project at: Start | Programs | Embarcadero RAD Studio Sydney | Samples and navigate to: Object PascalMulti-Device SamplesDevice Sensors and ServicesMaps CPPMulti-Device SamplesDevice Sensors and ServicesMaps Subversion Repository: You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version. Visualization with Google Maps on Android If you are running this sample on Android, in order to access the Google Maps servers, you have to add a Maps API key to the sample. To acquire the API key and add it in the sample you need to follow these configuration steps: Getting your Google Maps API key: Configuring the sample project options. Once you have the Maps API Key; in RAD Studio: Go to Project > Options > Version Info Select Android platform as Target (either in Debug, Release or All Configurations). Add the Maps API Key value in the apiKey key, and click OK. How Do We Use the Sample? Navigate to one of the locations given above and open: Delphi: TabbedMapProject.dproj. C++: TabMapProject.cbproj. If you are running the sample on Android, ensure you first follow the steps indicated in Using Google Maps on Android Before you run the sample, ensure the device is connected to the Internet. Press F9 or choose Run > Run. When you run the sample, the TMapView loads the map. To interact with the map: Use the Saint-Pétersbourg and San Francisco tabs to change between the two maps. Change the zoom using the Zoom out and Zoom in buttons. Move the map and see the coordinates of the map center in the CameraInfo TLabel, at the button of the app. Files File in Delphi File in C++ Contains TabbedMapProject.dproj TabMapProject.cbproj The project itself. TabbedMap.fmx TabbedMap.fmx The main form where the components are located. TabbedMap.pas TabbedMap.h, TabbedMap.cpp Implementation of the sample. Maps Visualization Implementation The sample uses TMapView to display and manage the maps. TMapCoordinate is used to create the initial coordinates with the indicated latitude and longitude. Then, the center of the maps are set to such coordinates with the TMapView.Location property. The TMapView.Zoom property is used to set the initial zoom of both maps to 10. This same property, is also used to zoom in and zoom out both maps by adding or subtracting 1 to the Zoom property. TMapView.OnCameraChanged updates the CameraInfo TLabel that indicates the Latitude and Longitude of the map Location. If you want to check the original post, follow the link below: http://docwiki.embarcadero.com/CodeExamples/Sydney/en/FMX.Tabbed_Map_Sample

Read More

Powerful Business Processes app works on all platforms

Taurec is a high-performance and powerful business processes app.  Also, thanks to Delphi it works on all platforms including Windows, iOS and Android.  It combines the advantages of multidimensional and relational database systems together to automate a company’s business processes. How does this app help with business processes? According to the developer, “It was developed for the Department to map to business processes. The focus is on the simple condition and a sophisticated security concept. Reports can be set up by the department itself. In addition, the end user can change the predefined views. For example, by filtering, show / hide columns, sort or group.” Website Taurec – Produkt Google Play Taurec Screenshot Gallery Taurec business processes app

Read More

Coming in TMS WEB Core v1.7: Miletus

When it comes to bringing web applications to a desktop enviroment the choice falls on Electron as it’s the most popular framework among web developers. We offer support for Electron applications already, but the downside is always there: it’s a 3rd party solution that we have no control over. At the end of the last year we asked ourselves if we can provide an alternative that fits us better. A few months later here we are about to release a beta version of TMS WEB Core v1.7 with Miletus! What is Miletus exactly? Named after Thales of Miletus, Miletus is a framework that enables TMS WEB Applications to run as desktop applications and it also provides access for native features. In a nutshell, you can fully reuse code created for a web application, take advantage of HTML/CSS for creating a modern & spectacular responsive user interface, access local files & local databases or closely integrate with operating system capabilities and still easily deploy the application as standalone executable. Our colleague Holger Flick explains it in more detail how one could create such Miletus application with TMS WEB Core: Let’s take a look at the available classes, functions and components that will enable you to interact with native operating system functionalities! Classes and functions TMiletusStringList: Read and write local text files. TMiletusBinaryDataStream: Similarly to TMiletusStringList this enables you to write and read local binary files. It also provides multiple formats to access the data. TMiletusClipboard: Read from and write to the OS clipboard. TMiletusShell: Exposes some shell functionalities: open a file with its default application, open an external URL with the default browser, move files to the trash and show files in the containing folder. GetCursorPos: Returns the position of the cursor. GetMiletusPath: Returns the common paths. StartFileDrag: Start dragging a file from your application to any destination where the file is accepted. Components TMiletusOpenDialog: Displays a native open dialog and returns the selected path(s). TMiletusSaveDialog: Similarly to TMiletusOpenDialog, it displays a native save dialog and returns the selected path. TMiletusMessageBox: Shows a native message dialog. The labels, the dialog type, the buttons and the verification checkbox are all customizable. TMiletusErrorBox: Shows a native error message dialog. TMiletusMainMenu: Creates and appends a native main menu to the form where it’s dropped. TMiletusPopupMenu: Creates and displays a native popup menu  TMiletusNotificationCenter: Allows you to show notifications on the operating system.  TMiletusWindow: Allows the creation of multiple application windows which can be linked to forms or other sources. TMiletusTrayIcon: Creates a tray icon on the OS tray. An optional popup menu can be assigned to it. TMiletusFileWatcher: Monitors a list of files for changes. Each file has its own event handler which will be triggered when the file has changed. TMiletusGlobalShortcuts: Add a list of keyboards shortcuts that will be recognized even when the application is not in focus.  What about database support? We also added support for local databases! The component TMiletusClientDataSet makes it easy for a Miletus application to create and use local databases by a familiar syntax of using TClientDataSet. It also allows a seamless integration of multiple types of databases with data-aware components like TWebDBGrid, TWebDBTableControl, TWebDBEdit etc… All the database operations can be done in the standard Delphi way through the TMiletusClientDataSet component.  We prepared 5 database drivers to […]

Read More

Sneak preview of what’s coming in FNC

Intro There are a lot of things going on in the TMS labs at the moment. We announced a lot of great improvements and new features for the upcoming TMS WEB Core 1.7 (https://tmssoftware.com/site/blog.asp?post=772) as well as a couple of past and future platforms FNC runs on (April Fools’ Day joke …). Today we are proud to announce a new platform is coming for FNC. (NOT an April Fools’ Day joke !). Sneak preview Before we want to announce exactly which platform is going to be supported in all it’s glory, here is a sneak preview. What’s coming? FMXLinux official support is coming in the near future! We are currently working hard to make all FNC components compatible with FMXLinux which means there will be a TTMSFNCWebBrowser based on WebKit (https://webkitgtk.org/), a REST based TTMSFNCCloudBase working with Curl (https://curl.se/), PDF export based on our own implementation and much much more! Of course, you can also expect all components that are working based on TMS FNC Core to have FMXLinux support. Stay tuned for more info coming real soon!

Read More

Discover The Powerful Custom ModernListView Library For Cross-Platform Development in Delphi FireMonkey

The website www.fmxexpress.com has an article with some really detailed information about the ModernListView Library. Lets check what they are saying. “Developer rzaripov1990 has a custom ListView component over on Github for Firemonkey in Delphi 10 Berlin. The ListView is the central component for every mobile application, and as a developer you should always choose the one that can be heavily customizable and very easy to use/implement. This modern ListView component is available for Delphi 10 Berlin with FireMonkey on Android, IOS, OSX, and Windows”. What are the features of the ModernListView Library? One nice feature is that it has both horizontal and vertical mode. Thus, using ListView.Horizontal := true ListView.Horizontal := true enables the list to display the cells (items) in a horizontal perspective, while ListView.AutoColumns := true // (default behavior) ListView.AutoColumns := true   // (default behavior) displays the items vertically. If you are an artist when designing your look and feel of the application, this component can customize every graphic aspect such with available events such as: SetColorItemSelected, SetColorItemFill, SetColorBackground, SetColorItemSeparator, SetColorText, SetColorTextSelected, SetColorTextDetail, SetColorHeader, SetColorTextHeader, and many other properties. The properties are self-explanatory, no need to cover them here. With the AutoColumns and ColumnWidth properties, the component will automatically calculate the best fit appearance and position for the items when populating the list (very useful when dealing with large number of items). Apart form the standard behavior events, you have OnColumnClick listener for the ListView. You also have the option to hide/show the scroll bars (ListView.ShowScrollBar), set indent for items separators (ListView.SeparatorLeftOffset and ListView.SeparatorRightOffset). How much does the ModernListView Library cost? The component is free and has some nice demos with it as well. For the moment it is available only for Delphi Berlin using FireMonkey, very useful too if you build multi-device applications. Using ModernListView Library Let’s get a better view of what is this all about. We will now go through some of the components, their design and what they do. Colorizer ListView1.SetColorItemSelected(TAlphaColorRec.Orangered); ListView1.SetColorItemFill(TAlphaColorRec.Whitesmoke); ListView1.SetColorItemFillAlt(TAlphaColorRec.Lightgrey); ListView1.SetColorBackground(TAlphaColorRec.Whitesmoke); ListView1.SetColorItemSeparator(TAlphaColorRec.Red); ListView1.SetColorText(TAlphaColorRec.Darkmagenta); ListView1.SetColorTextSelected(TAlphaColorRec.Blueviolet); ListView1.SetColorTextDetail(TAlphaColorRec.Darksalmon); ListView1.SetColorHeader(TAlphaColorRec.Crimson); ListView1.SetColorTextHeader(TAlphaColorRec.Whitesmoke); ListView1.SetColorTextHeaderShadow(TAlphaColorRec.grey); ListView1.SetColorPullRefresh(TAlphaColorRec.Lime); ListView1.SetColorPullRefreshIndicator(TAlphaColorRec.Limegreen); ListView1.SetColorStretchGlow(TAlphaColorRec.Limegreen); set custom color for item if ListView1.IsCustomColorUsed(ListView1.ItemIndex) then ListView1.SetDefaultColorForItem(ListView1.ItemIndex) else ListView1.SetCustomColorForItem(ListView1.ItemIndex, TAlphaColorF.Create(random(255) / 255, random(255) / 255, random(255) / 255, random(255) / 255).ToAlphaColor);   if ListView1.IsCustomColorUsed(ListView1.ItemIndex) then     ListView1.SetDefaultColorForItem(ListView1.ItemIndex)   else     ListView1.SetCustomColorForItem(ListView1.ItemIndex, TAlphaColorF.Create(random(255) / 255, random(255) / 255, random(255) / 255, random(255) / 255).ToAlphaColor);   Horizontal Mode ListView1.Horizontal := true; Columns Mode (only vertical) ListView1.ColumnWidth := 160; ListView1.AutoColumns := true; Events event for AutoColumn mode procedure OnColumnClick(const Column: Integer; const X, Y: Single; const AItem: TListViewItem; const DrawebleName: string);   procedure OnColumnClick(const Column: Integer; const X, Y: Single; const AItem: TListViewItem; const DrawebleName: string);   called when end of list procedure OnScrollEnd(Sender: TObject);   procedure OnScrollEnd(Sender: TObject);   Methods Style for ListView Columns Mode ListView1.ShowScrollBar – hide/show scrollbar ListView1.ItemsClearTrue – correct delete items ListView1.OffsetTop – indent of the first element ListView1.OffsetBottom – indent of the last element ListView1.getFirstVisibleItemIndex – first visible ItemIndex ListView1.getVisibleCount – amount of visible items ListView1.getLastVisibleItemindex – first visible ItemIndex + amount of visible items ListView1.SeparatorLeftOffset – indent for separator line ListView1.SeparatorRightOffset – indent for separator line ListView1.EnableTouchAnimation – enable/disable touch animation The list is long, so if you want to see all of it and try the library, just go to Github, download and test this package: https://github.com/rzaripov1990/ModernListView Note that the screen shots and some of the text in this article are drawn from the above GitHub repository.

Read More

The Excellent Windows Ribbon Framework For Delphi

The Windows Ribbon framework is a magnificent command presentation system that implements a fresh option to the layered menus, toolbars, and task panes of common Windows applications. This Delphi library allows Delphi developers to utilize the Windows Ribbon Framework in their Delphi applications. This library uses the native Windows Ribbon Framework library to implement the ribbon functionality. It does not emulate the Ribbon user interface as other Delphi component sets do and that’s a good thing. Windows Ribbon Framework Features This Delphi library is much more than a simple header translation. It has the following features: Complete translation of the UI Ribbon header files.  A class library that provides higher-level access to the Ribbon API.  A control for dropping on any existing VCL form that automatically loads the ribbon and maps ribbon commands to equally named VCL Actions. Delphi-versions of the UI Ribbon Samples from the Windows SDK.  A feature-complete semi-visual Ribbon Designer.  The Ribbon Designer comes with a WordPad template that lets you quickly create a Ribbon that looks virtually identical to the WordPad accessory that comes with earlier versions of Microsoft Windows. Check out the Ribbon Framework for Delphi here!

Read More

Incredible Workflow Automation Mobile App For Loggers

This great Android and iOS workflow automation app allows company or third party loggers / loaders to logon to a corporate LIMS database and create loads while loading it to trucks in forest. How does this Delphi app help with workflow automation? According to the developer, “Load can be created by scanning a predefined trip ticket. Each load is then associated with GPS location and along with load information is sent to Central server using Data line or WiFi connection. Loader Loads can then be sent to receiving station which can be matched to received loads for full Chain of Custody.” Using the app allows loaders and loggers to enter and manage details on their load slips without using a pen.  The company also says this “ensures truck loads are shipped and properly tracked“.  Delph’s cross-platform capabilities really help companies like 3Log with this kind of workflow automation and modernization. What sort of workflow automation does “LoaderWiz” provide? Here’s a brief extract from the company’s website.  LoaderWiz can: Create loads and barcoded trip tickets in the woods even when there is no internet connectivity.  load data is stored in local database on device. Synchronize bidirectionally with your corporate LIMS system when connectivity is available to conveniently download sources, trucks, trip tickets, and other key information needed.  You can then create loads and synchronize completed loads back to LIMS. Prove chain of chain of custody using GPS stamp. Print tickets with QR barcodes to portable Zebra printers and hand it to truck drivers. Electronically transfer a ticket with barcode to a truck driver’s device (if driver is using WeighWiz Mobile) which can then be used to expedite weighing in and out at scale site without him/her leaving truck. Lookup and review processed and delivered loads using a smartphone as well as run real-time reports.  Users can also manage trip tickets and scale data faster with less paperwork, more detail, and greater accuracy. Website 3LOG LoaderWiz Google Play 3LOG LoaderWiz Screenshot Gallery

Read More

Learning Programming In Delphi: Use This Astounding App

The developer says in their description that this application will teach learning programming in Delphi together with developing application using the RAD Studio Delphi IDE. How is this app helpful for learning programming in Delphi? There are over 50 Delphi lessons – Delphi.uz articles, a Delphi Programming Tutorial Module, eBooks in addition to free video tutorials, Subjects covered include “Enhanced and Fastest UI”, “Internet Connections using SSL”, “Smaller and bigger code sizes”, “Wrapping code” as well as a whole collection of other great resources for Learning Programming in Delphi. Website Delphi Examples Google Play Delphi Examples 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