Noutați

Competitive BQGolf Viewer: Golf Management On Your Phone

Embarcadero’s users understand the scalability and stability of C++ and Delphi programming, and depend on the decades of innovation those languages bring to development. Ninety of the Fortune 100 and an active community of more than three million users worldwide have relied on Embarcadero’s award-winning products over the past 30 years. Icons by Icons8.com. © 2020 EMBARCADERO INC. ALL RIGHTS RESERVED

Read More

MQTT: How Do I Write An App To Communicate With IOT Devices?

When we combine MQTT with Delphi we can easily write apps which will communicate with IOT devices. Follow along with us now as Bruno Mileto tells us how to do it. IoT – the unseen world Internet of Things, or IoT, is a concept that defines the connection between physical objects with the user and the internet. It makes use of intelligent sensors, in addition to software, used in the collect and transmit data to the network, allowing the control of different devices. IoT devices communicate using IoT protocols that are a set of rules that determines how data is sent. IoT protocols ensure that information from one device or sensor is read and understood by another device, a gateway and a service. MQTT stands for Message Queuing Telemetry Transport and it is a simple and easy implement, IoT protocol. It is a message protocol with support for asynchronous communication between the parts. It makes a light application, ideal for remote communication between devices where the amount of data communicated is highly limited, and, in networks whose bandwidth for communication is restricted and of high latency. The MQTT protocol defines two types of entities: a message broker and numerous clients. The broker is a server that receives all messages from clients and then routes those messages to the relevant target clients. A client is anything that can interact with the broker and receive messages. A customer can be an IoT sensor in the field or an application in a data center. The client connects to the broker. He can subscribe to any message “topic” at the broker. The client publishes the messages to a topic, sending the message and topic to the broker. The broker then forwards the message to all customers who subscribe to that topic. A Delphi MQTT Client Application To create a Delphi MQTT client application, we are going to need a Delphi MQTT component. We can use the Delphi WebSocket components from eSeGeCe. The download and installation process, is detailed here. First drop the two main components to a form, the TsgcWebSocketClient, and the TsgcWSPClient_MQTT. In the TsgcWebSocketClient component, go to properties, and in Authentication/Session/Enabled, change it to True. In Options/Parameters add ‘/ws’, in the host, add www.esegece.com, and in Port, change it to 15675. There are a lot of servers that act like a broker, so you can use them to test, like: broker.hivemq.com test.mosca.io iot.eclipse.org mqtt.simpleml.com But here, we will stick with the broker found at www.esegece.com Setting up the MQTT connection In the TsgcWSPClient_MQTT component, go to properties, and in Authentication/Enabled, change it to True. In Client, choose the TsgcWebSocketClient component and in HeartBeat/Interval, change it to 5. To complete the Delphi MQTT Client Application, you will need at least: Three buttons: two to subscribe and unsubscribe to a topic, and one to publish a message. Two TEdit, to inform the topic to subscribe and the message to publish. A way to inform the quality of service. We do this in a TComboBox component Quality of service levels The Quality of Service (QoS) level is an agreement between the sender of a message and the receiver of a message that defines the guarantee of delivery for a specific message. There are 3 QoS levels in MQTT: At most once (0) (mtqsAtMostOnce) At least […]

Read More

Showcase: Interactive Roman Numbers Kids Mobile App

I’m old enough to remember the days when movies used to have have copyright messages where the years were listed out in a series of letters. I like to think it added to the magic of the big screen movie experience to see things like MCMLXXVI underneath that roaring lion or a huge gong being banged to signal the start of a trip into the cinematic wonderland. A few years later our school was still teaching us to read the Roman Numerals as they were known. A fading art now along with Morse Code and darning holes in socks. Roman Numbers Mobile App “Roman Numbers” is a mobile app produced by Spanish developer Demontriz programacion which tries to keep the lost art of reading numerals alive. It introduces this two thousand year-old numbering system to the computer-savvy younger generation of the 21st Century. Written using RAD Studio Delphi using the cross-platform FireMonkey FMX platform to make excellent use of the user’s mobile devices it’s a great way to make learning fun. A mobile app to convert Roman numerals to decimal and back again The app converts Arabic numbers to Roman numbers and is especially aimed at children. They can type any number between 1 and 999999 and the app will show the equivalent roman number. You can also type in any Roman number between 1 and 999 and check its decimal value. So, do you know what DCCCLXXXVIII is in the based 10 decimal system? Website Roman Numbers Google Play Roman Numbers Screenshot Gallery Do you have a great idea for an educational app? Why not use the power of RAD Studio Delphi to bring it to life?

Read More

Low Code App Wizard for Delphi

Low code app development is increasingly popular today, and for good reason: it speaks to the demand for software paired with the difficulty of creating it. In many ways, Delphi led the low code revolution: RAD, where you build software by connecting components in a visual designer, is low code. The key with many low code solutions is extensibility: low code which cannot be extended to a traditionally coded app has a hard upper limit of functionality. If you’re a technology adviser, you do not want to recommend something which will limit your client or company. The best development solutions that target low code provide an avenue to grow and extend. In this too, Delphi excels. Until recently in Delphi you still had to create a new project and create the forms or screens yourself – no matter how little code you may have to write to get powerful functionality when you did. This is something we’ve now addressed with an addon to 10.4.2. In GetIt for 10.4.2 and later is a Low Code App Wizard for FireMonkey, our technology for cross-platform applications. Once installed, the New Items dialog lets you run a wizard which will create a Delphi FireMonkey app for you. It is a fully functional cross-platform application, which already contains basic functionality that every mobile app will need — you can run and use the app as is — and hooks to build more, plus demonstrates application development best practices with a very clean extensible design to add more screens with low code, plus a set of tests to ensure your app remains high quality as you customise it. Basic setup: Choose your app’s name, where to save it, and if you want a database. Choose your app’s screens. If you selected to add a database on the previous page, you can also add a Data screen Two screenshots of the Low Code Wizard The app that Delphi builds for you is configurable through the wizard, but you can choose any set of the following: User accounts: sign up, sign in, and a profile screen, with hooks for your own authentication Settings screen (where you can change the app theme (light or dark), plus some example settings you can reuse or extend) Contacts screen Terms of Use, About, and Privacy policy screens, easily configurable for your own data A database layer: using Interbase, store data in your app An example new screen you can use as a template or example for adding new functionality In other words, it generates the framework of an already working, useful application which you can extend using Delphi’s RAD (or low code) visual application design. The generated wizard, showing the hamburger menu The Settings screen, here showing the Theme setting plus some other example working settings Two screenshots of the generated low code app, here running on Windows (great for quick development, since you don’t need to deploy to a device or emulator to test.) Install the Low Code App Wizard through GetIt today, and use Delphi, one of the most productive development environments, providing you rapid development through visual design yet remaining fully extensible as your business needs grow. And join us on Thursday 10th June for a webinar demonstrating the low code wizard and how to quickly build powerful apps […]

Read More

Data ETL: Adding Custom LiveBindings To Your Apps

In the recent Data ETL focused TCoffeeAndCode episode there was some excellent discussion around the use of FireDAC to extract and manipulate data in various ways. The replay, in case you missed it, the replay video is linked below. Data ETL done the easy way – thanks to a tweet! We also – among many other things – talked about the benefits of LiveBindings. Literally ten minutes before we were due to start the webinar I came across a Tweet from newly-minted Embarcadero MVP David Cornelius where he mentioned that he had been experimenting with RAD Studio’s LiveBindings. I’ve been using Delphi’s LiveBindings more and more lately and think they’re more useful than many people give them credit. I’ve started an open-source library of CustomFormat methods on GitHub: https://t.co/yUds77hYIQ. I’d be interested to hear what people think. — David Cornelius (@delphidave) May 26, 2021 Well, that was perfectly-timed! David goes on in his blog post to describe a little about LiveBindings and his personal journey where he went, not unlike myself, from a feeling of lukewarm complacency toward them to an appreciation of the finer points of their use. LiveBindings are more powerful than they appear When I first heard of LiveBindings they seemed, to me, to be some kind of variation on the old datasource / datafield kind of relationship found in older versions of Delphi and the venerable Visual Basic. They looked like we should link the controls on the screen to a field (or fields) of a database table, albeit with a prettier graphical relationship editor. Once you start to scratch the surface of LiveBindings, if you’re anything like me, LiveBindings will start to gradually reveal themselves and you’ll find there is a LOT more power going on than simple point-this-field to this-control kind of relationships. Linking controls to classes and internal code data structures is one of those Programmer Super Power RAD Studio features I keep telling people is the reason why a fairly lazy coder like myself can actually be scarily productive. It’s not me, it’s RAD Studio and, in my case at least, Delphi. Data ETL with LiveBinding Expressions There are some other great articles around which describe LiveBindings from initial beginnings through to more advanced topics: But David Cornelius embraced the idea of LiveBindings and went a little further! How to extend LiveBindings with custom binding expressions David has produced a set of code, available on GitHub, which adds some custom expressions in the LiveBindings editor. The repository contains a set of units that can be included in your apps which then enhance the available LiveBinding custom expressions to include things like automatically calculating the years since the date contained in the database field (or record or class – it’s a LiveBinding, don’t forget). LiveBindings Custom Expression Here’s a few lines of example code from David’s repo: function MakeMinutesSinceMethod: IInvokable; begin Result := MakeInvokable(function(Args: TArray): IValue var InputDate: TDateTime; RoundDigits: Integer; MinutesSince: Double; begin CheckArgs(Args, InputDate, RoundDigits); MinutesSince := RoundTo(TTimeSpan.Subtract(Now, InputDate).TotalMinutes, RoundDigits); Result := TValueWrapper.Create(MinutesSince); end); end; function MakeMinutesSinceMethod: IInvokable; begin   Result := MakeInvokable(function(Args: TArray<IValue>): IValue       var         InputDate: TDateTime;         RoundDigits: Integer;         MinutesSince: Double;       begin         CheckArgs(Args, InputDate, RoundDigits);         MinutesSince := RoundTo(TTimeSpan.Subtract(Now, InputDate).TotalMinutes, RoundDigits);           Result := TValueWrapper.Create(MinutesSince);       end); end; That code means you can add a LiveBinding custom expression MinutesSince(MyDateTimeDBField, 2) to output the […]

Read More

Developer Stories: Pietro Ruvolo Shares His D.Fence Application

Pietro Ruvolo has been programming ever since 1988. He has a showcase entry (D.Fence) at the Delphi 26th Showcase Challenge and we talked to him about his programming journey over the years. Check out his website on D.Fence. When did you start using RAD Studio Delphi and how long have you been using it? I started programming in 1988 at the time of MS Dos, dBase III, and Clipper. Then at the release of Delphi, I switched to OOP programming and since then I have followed the evolution of the product. I started converting my old programs in Delphi for 26 years. I created my first software company in Rome, Italy dedicated to the development under the “new” MS Windows. What was it like building software before you had RAD Studio Delphi? It was the time of MS Dos and procedural programming, where programs generated sources of infinite size and where debugging, with languages like Clipper, Fortran, basic was a real nightmare. I started to learn OOP and Delphi RAD allowed me to create more and more lean and easily maintainable programs, as well as to create classes of objects reusable between projects, gaining a lot in development time. With the advent of Firemonkey there was a further leap in quality, introducing the possibility to maintain the same code for different platforms (macOS, Windows, Android, iOS and Linux) expanding my market to a new type of user. How did RAD Studio Delphi help you create your showcase application? In 2015, I used Delphi to create a distributed risk management platform for a client (using REST Technology). Two years later I moved to MALTA to continue the development and maintenance of the platform of that client. This activity lasted until December 2020 when I opened my own software company in Malta and started again to create products in RAD Studio. The first product we decided to develop was dictated by the pandemic situation in which we found ourselves and it is D-Fence, a product for social distancing and contact tracing. Being composed of a software platform and having to interact with the BLE sectors mounted on wearables, and with APP of different operating systems, Delphi and Firemonkey were the best and most effective solution for the realization of the entire software suite. What made RAD Studio Delphi stand out from other options? As mentioned before, the use of Firemonkey made possible the realization of this project in a short time and without the need to have different teams of programmers for each operating system, ensuring cross-platform development. The server platform uses REST technology, the apps use native compiler for IOS and ANDROID and access to the wristbands is via Bluetooth Low Energy. Finally, it is very important to maintain a single version of the source code so that any changes made becomes automatically available on all platforms. What made you happiest about working with RAD Studio Delphi? Surely the ease of reusing already used source codes is one of the most pleasant aspects of Delphi together with a powerful debugging engine that helps to develop important software in a limited time. I am also happy to have been able to reopen in Malta my original activity as a software developer. What have you been able to achieve through using RAD Studio […]

Read More

Have You Made Your Application Server HTTP/2 Ready?

In early 2015, HTTP/2 was introduced as the new standard by IESG. This standard makes your application faster, simpler, and more robust. In this article we take you through the differences between HTTP/1 and HTTP/2, the benefits and some key terms. Why should I use HTTP/2? Converting from using HTTP/1 to HTTP/2 brings the following benefits: HTTP/2 reduces latency by enabling full request and response multiplexing. Efficient compression of HTTP header fields. Support for request prioritization. Multiple concurrent exchanges on the same connections. An unsolicited push of representations from servers to clients. What is SPDY? SPDY was an experimental protocol, developed at Google and announced in mid-2009. The primary goal with SPDY was to try to reduce the load latency of web pages by addressing some of the well-known performance limitations of HTTP/1.1. Since 2012 the new experimental protocol was supported by the Chrome, Firefox, and Opera web browsers. A rapidly growing number of sites, both large and small, were deploying SPDY within their infrastructure. In effect, SPDY was on track to become a de facto standard through growing industry adoption. After a lot of discussion within the working group, the SPDY specification was adopted as a starting point for the new HTTP/2 protocol. If you want to read more about this click here for the full story  What are the key differences between HTTP/1.x and HTTP/2? The most significant changes between HTTP/1.x and HTTP/2 are : There is a new binary framing layer which dictates how the HTTP messages are encapsulated and transferred between the client and server. The HTTP semantics, such as verbs, methods, and headers, are unaffected, but the way they are encoded while in transit is different. Unlike the newline delimited plaintext HTTP/1.x protocol, all HTTP/2 communication is split into smaller messages and frames, each of which is encoded in binary format. All communication is performed over a single TCP connection. For the official “RFC” document describing HTTP/2 you can go to the following link: https://datatracker.ietf.org/doc/html/rfc7540#section-4 What are the performance differences between HTTP/1.x and HTTP/2? The really great thing about Delphi is we can already use the latest technology so that server applications with the HTTP/2 protocol can be implemented by developers. One of the Embarcadero Technology Partners, namely ESEGECE, has created a HTTP server component which implements the HTTP/2 protocol. Let’s compare the performance difference between the HTTP/1 and HTTP/2 using ESEGECE’s components. You can download a trial version here: https://www.esegece.com/websockets/download Here’s a video taking you through the demo: As you can see HTTP/2 has a speed of at least 50% more than HTTP/1.x RAD Studio Delphi gets your applications from idea to reality with maximum speed and efficiency. Why not try it for yourself today?

Read More

Example WebSockets Server And Client Chat Application

WebSockets are gaining more and more strength with the implementation in most browsers, including for mobile devices. This article introduces briefly, the concept of WebSockets, and creates a chat app using a websockets component for Delphi, by Delphi component provider Esegece. What are Websockets? The WebSockets protocol allows the creation of a client-server communication channel with bidirectional transmission where both sides (client and server) can transmit data simultaneously. WebSockets came to fill the shortcomings of the HTTP protocol for this purpose, which by the way, is unidirectional (transmission occurs only from one end to the other). The most common uses for WebSockets are, among other things: home brokers (where quotes are updated all the time), social network feeds, chat apps, collaborative tools, and even multi-player games What are the differences between HTTP and WebSockets? WebSockets are a great choice if there is a need for a connection to remain open for a long time for constant data exchange. In summary, the benefits over HTTP are Low Latency, Persistent Connection and Full-Duplex (bidirectional transition). A WebSockets Delphi component To create our chat app we will use the WebSockets component. Here we are using the eSeGeCe Delphi WebSocket component. You can check its benefits here. Also, you can check some implementations here and the documentation here. To start the work, you need to download the eSeGeCe Delphi WebSocket Components and the Indy Components. These two and a video of how to install them, you can check here. How to create a WebSockets Delphi client for a chat application Let’s start with the client-side. After installing the components, get a TsgcWebSocketClient component along with two TEdit a TMemo, and a TButton. The two TEdit controls will be used as name and message fields. The TMemo control will be the field that displays all messages. In the TsgcWebSocketClient properties, you need to change just the host and port. Add ‘localhost’ to the host and 5416 to the port. Looking at the code, there are two main parts. The connection and the messages. For connection and disconnection, you can add the following in the OnShow and OnClose methods of the form: procedure TFrmClient.FormShow(Sender: TObject); begin sgcWsClient.Active := True; end; procedure TFrmClient.FormClose(Sender: TObject; var Action: TCloseAction); begin sgcWsClient.Active := False; end; procedure TFrmClient.FormShow(Sender: TObject); begin   sgcWsClient.Active := True; end;   procedure TFrmClient.FormClose(Sender: TObject; var Action: TCloseAction); begin   sgcWsClient.Active := False; end; To receive a message is very simple. The OnMessage event of the TsgcWebSocketClient, already comes with the text sended by the server. You just need to get it and put on the TMemo component: procedure TFrmClient.sgcWsClientMessage(Connection: TsgcWSConnection; const Text: string); begin mmLog.Lines.Add(Text); end; procedure TFrmClient.sgcWsClientMessage(Connection: TsgcWSConnection;   const Text: string); begin   mmLog.Lines.Add(Text); end; Sending a message over a WebSockets connection using Delphi To send a message is also, very simple. You can use the OnClick event of the button: sgcWsClient.WriteData(edtName.Text + ‘: ‘ + edtMessage.Text); sgcWsClient.WriteData(edtName.Text + ‘: ‘ + edtMessage.Text); Creating a WebSocket Delphi Server for a Chat Application For this WebSocket Delphi Server Example, we will need the TsgcWebSocketHTTPServer component, and at least, a TMemo. In the sgcWebSocketHTTPServer properties Options, mark the HTML files. Also in Fallback/ServerSentEvents/Retry, set to 3 and set the port to 5416. Here we also have two main parts, when looking in the code: the connection, and the messages. You […]

Read More

Quickly Build Powerful Executive And Admin Dashboards With Javascript

First impressions last, especially when you start working with a new framework or library. Many people struggle and it difficult and frustrating. That is why Sencha has put in the time and effort to make Ext JS accessible, no matter what your skill level is. This is because on your first contact with our framework it is important that you can familiarize yourself quickly and get started running basic code examples that show you its real potential. Today we will show you just how easy it is to get up and running with Sencha. How to Download GPL Version You may not know this but Ext JS has a GPL version in addition to our Ext JS Trial. It is a totally free, fully functional version. Simply put, you can build anything you want, but you have to share your code with the community. Pretty cool. To get started using the GPL version all you have to do is fill out this form. Once you are done, you will receive an email download link. Getting Started Getting started once you have downloaded the software is easy. The Ext JS documentation has a lot of guides explaining all the steps you need to run the product and start recreating its examples. To get you moving more quickly however here is the bare minimum you need to know. Starting with Sencha CMD If you still don’t have Sencha CMD, you can download it for free here. Once you have it installed you need to make sure it is properly configured. To do this, run the following command on the CMD terminal/shell: If it returns sencha cmd, you are good to go. If it doesn’t, click here. It will take you to more information on how to install, configure and use Sencha CMD. You shouldn’t need it though because we will cover the basics here. Reusing Ext JS Templates as Our Base Application Sencha CMD and Ext-gen use templates to help you create your applications. For example, the Executive Dashboard and Admin Dashboard are templates that you can use as a base to automatically help you through your own applications. How to Build Executive Dashboard Example To get started let’s check out the Executive Dashboard. First, there is a very important trick — Open the app.json file on ext-7.0.0-gpl/templates/executive-dashboard and replace the word from ${ext.dir} to ${framework.dir}. A single command to creates the application. Remember to use your own username : sencha -sd /Users/fabio/sencha-sdks/ext-7.0.0-gpl generate app -s /Users/fabio/sencha-sdks/ext-7.0.0-gpl/templates/executive-dashboard ExecutiveDashboard ./executive-dashboard-extjs /Users/fabio/sencha-sdks/ext-7.0.0-gpl is where your Ext JS GPL SDK folder is. /Users/fabio/sencha-sdks/ext-7.0.0-gpl/templates/executive-dashboard is the template. In this case, we are using the executive dashboard, which means your application will start with all elements existent on it. ExecutiveDashboard is the name of our application. That will be our namespace for our classes. ./executive-dashboard-extjs is the path where we will create our project structure containing the needed files. Done! You have created an application. Now, let’s run the command that will call up the server on a specific port and see the result: The output of this command will show you the URL where your app will be available. in this case, it is available on http://localhost:1841/. Open it on your browser and you will see the app created: How to Build Admin Dashboard Example To build […]

Read More

Custom control development with TMS WEB Core for Visual Studio Code, an intern reports

At tmssoftware.com we love to have interns. I believe it is a fantastic experience to learn young aspiring software developers about Delphi, its eco-system, its amazing productivity and at the same time, absorb a lot of energy, get new fresh ideas and get to know what drives and motivates the next generation of software developers. So, also this school year, we had 2 interns learning all about Delphi, TMS WEB Core, Object Pascal, components and much more here at tmssoftware.com. Today, we want to give the word to our intern, and very soon colleague, Bradley who did a lot of stunning work this school year and tells in his first blog post about building his first custom control for TMS WEB Core. Nothing but an amazing and exciting story! So, with pleasure, I give the word to Bradley: A first custom web control Having only one year experience using Delphi and TMS WEB Core, I was assigned the (at first sight) daunting task of developing my first ever custom web control, namely a chat box control. I had only been developing web applications since I joined tmssoftware.com as an intern, so clearly writing a component was something completely new. Using the available documentation and the experience of my mentor Bruno I quickly obtained the necessary skills for developing a TMS WEB Core custom control, the TWebChatBox control. First steps To gain some experience, I first developed another very small control, a custom toggle button control to switch a web application between full-screen and normal mode. I went for developing the custom control directly from TMS WEB Core for Visual Studio Code because I just feel more comfortable for web projects to use this IDE. I had the “privilege” to use first the alpha and then the beta version of TMS WEB Core for Visual Studio Code v1.3 (released yesterday btw) as this introduced component package support. Using the new package support for installing custom controls made it very easy to test the control, also at design-time. The development of this first small control allowed me to get used to the concept of custom controls as well as the steps involved to get it installed in the IDE. Starting the chatbox implementation After I was comfortable enough with the principle of custom controls. I’ve started building the chat box component. As there were a ton of features on the requirements list, I had actually no idea where to start. I’ve focused first of all on a working way of sending/receiving messages. When I had that going, I started focusing on adding a basic design, followed up by adding the necessary properties for manipulating said chat box.  I think implementing collections as a way of managing messages was the only thing I really struggled with. Having never implemented anything like this, figuring out how to implement the chat message bubbles at collection item level was a challenge. If you add a message to your collection, a chat message bubble will be generated and displayed in the chat control. The collection item will also keep a reference of the chat message bubble so that you can manipulate it later on. A chat bubble contains several HTML elements. We have a SPAN for the message. For the user avatar there is an IMG element. […]

Read More