Noutați

JSON backstage pass for TMS WebCore developers

2. First things first In the previous section we used the terms JSON and JavaScript object. But what is it exactly and what are the differences? In JavaScript, a variable can contain a simple value as well as an object or an array. // JavaScript let i = 5; let s = ‘some text’; let o = { a = ‘text’, b = i } In this example the variable o contains a JavaScript object with the two attributes a and b where a contains a text and b contains a number. In TMS WEB Core there is a type JSVALUE for the value of a variable from the JavaScript world. Whenever we want to access the value of a JavaScript variable, we can use the JSVALUE type for it. // WEBCore function sampleJavascriptVariable : JSVALUE; assembler; asm let i = 5; return i; end; procedure AccessJsvalue; var javascriptvalue: JSVALUE; i: integer; begin javascriptvalue := sampleJavascriptVariable; // value will now contain the JavaScript VALUE (hence JSVALUE) 5 i := integer(javascriptvalue); // we needed to typecast javascriptvalue to integer because the compiler // doesn’t know the type of the value actually stored in that variable end; So whenever we want to access JavaScript values directly from TMS WEB Core, we need a typecast to tell the compiler which type the value in the variable with the type JSVALUE contains. This is already cumbersome with simple types and also error-prone and it gets even more complex when we want to access JavaScript objects. Let’s summarize: A JavaScript object is an object in the JavaScript world that is stored in an internal representation in a JavaScript variable. To store such a JavaScript object in an Object Pascal variable in TMS WEB Core, the object pascal type JSVALUE is available. And what has all this to do with JSON ? JSON (JavaScript Object Notation) is a string that represents a JavaScript object. A JavaScript object can be converted to JSON and a JSON string can be converted to a JavaScript object. More information about the syntax definition of JSON can be found here: https://www.json.org/json-en.html. Whenever we talk about JSON, we mean a string from an Object Pascal point of view. Whenever we talk about a JavaScript object we mean a JSVALUE from an Object Pascal point of view. // WEBCore var json: String; javascriptobject: JSValue; begin json := ‘{ “x” : 5, “y” : 7 }’; javascriptobject := TJSJSON.parse(json); end; In this example the JSON variable contains a JSON representation (data type String) of an object with the members x and y, both containing numbers. This string is parsed into a JavaScript object using the static method TJSJSON.parse() and stored in the variable javascriptobject. Note: All sample sources use only the units that are already automatically included in the uses list of a standard TMS WEB Core web project. So you can try and reproduce everything directly in TMS WEB Core when you include the source texts in the unit1.pas of a newly created project. To keep the example source code short, only necessary code is shown, in real world code you would need to add some exception handling here and there… All well and good, now we have a JavaScript object in an Object Pascal JSVALUE variable in TMS WEB Core. But how […]

Read More

Keep up with the latest developments!

Everything evolves so incredibly fast in the software world! So our team is also trying really hard to keep up with the latest developments. And to give our customers access to all our latest developments we have created our no-nonsense subscription TMS ALL-ACCESS! Because we want our customers to be able to use all our products with no restrictions or limitations. And when we say ALL we really mean ALL our products we offer now and also all new products we’ll release in the year of the subscription. Moreover, our all-access users are the first to receive the previews and betas of our non-released products! Here is a small overview of the new products we added in 2021: January 2021: TMS VCL UI Pack v10.4: Powerful, extensive & flexible component suite for native Excel report & file generation & manipulation for VCL & FireMonkey TMS FNC Cloud Pack v1.3: Seamless access to cloud services from Windows, cross-platform and the web TMS WEB Core v1.6: Framework for creating modern web applications February 2021: March 2021:  April 2021:  May 2021:  Get full access with:  Easy plan: All current and new products for 1 price! Easy renewal: Yearly renewal only for 495 EUR! Easy install: all products accessible via TMS Subscription Manager tool Easy support: Full online support center access to all areas Easy up-to-date: Early access to product betas Easy learning: Access to TMS WEB Academy Act now: So what are you waiting for? Find out more about our products included in TMS ALL-ACCESS. NOTE: Contact sales for special upgrading pricing for existing customers of other products.

Read More

Is .NET Really Dead? What Is The Best Alternative?

.NET is one of the most popular frameworks for building powerful desktop and web applications. But it hasn’t received any new update since 2019. Is the framework REALLY dead? Should you look for alternative solutions for developing applications in 2021? In this post, you will find all the details. What is .NET framework? .NET is a full-stack platform for building and running server-side applications on Windows. It is compatible with different languages, including C#, F#, and Visual Basic. You can use it to create desktop, web, mobile, and IoT applications. Is .NET framework really dead? Back in 2019, Microsoft announced that the .NET 4.8 would be the last release of .NET framework. Also, the company declared that the successor of .NET Core 3.0 would be known as .NET 5.0. In other words, .NET Core would replace the .NET framework. Eventually, .NET 5.0 was rolled out in November 2020. With .NET 5.0, Microsoft aims to transform the .NET and .NET Core into a new cross-platform framework. However, there are some drawbacks. The developers have been using ASP.NET Web Forms for years to build dynamic web UIs. It is no longer supported on .NET 5.0. Instead, you will have to use Blazor. Even Windows Communication Foundation (WCF), the traditional communication framework for Windows, is deprecated. So, you will be forced to use alternative solutions, like gRPC or CoreWCF. Overall, Microsoft is unifying .NET and .NET Core frameworks by making drastic changes. So, you can no longer use the key features like the way you do with the original full-stack platform. In this sense, the .NET framework is dead. Microsoft’s controversial move on .NET framework had infuriated a large number of developers around the world. They feel that there is a significant gap between release and stability in the products of the software development giant. One of the Y Combinator users, known as @TheRealDunkirk, vividly described the issue: My problem with these kinds of Microsoft technology evangelism articles/videos is that it always seems like Microsoft has juuuust gotten their new hotness to work, and is telling the world that it’s awesome, and ready for production. Then you go to implement it, and as soon as you leave the perfect world of their demo, it all falls apart, and THEN you find out the docs were written for the beta version, and no longer apply, so you’re left guessing at the right invocation signature for the method you need. What is the best alternative to .NET framework? There are different alternatives to .NET framework, including Node.js, Django and Laravel. However, the best one is Delphi. Unlike .NET framework, it is providing new releases and support for more than 26 years continuously. Why Delphi is the best alternative to .NET framework? Safe Future: Delphi has been evolving since 1995. It is being updated constantly. There is no possibility of seeing it abandoned anytime soon. .NET Compatibility: Delphi supports a compiler and a base class for .NET framework. So, you can build native .NET applications with the same class library and IDE. High Performance: Delphi is super-fast. Similar to .NET framework, it is well suited for graphics and math-intensive application development. GUI Designing Made Easy:  Delphi supports a powerful GUI designer, which makes the process of creating amazing interfaces pretty straightforward Well Documented: Delphi supports comprehensive […]

Read More

Developer Stories: Bruce McKibben And The Excellent Macaos

Bruce McKibben has begun programming in 1997. His software (Macaos Enterprise) was one of the showcase entries for the Delphi 26th Showcase Challenge and we interviewed him to get more of his insights on working with Delphi. Go to the Macaos Enterprise website and learn more about the software. When did you start using RAD Studio/Delphi and have long have you been using it? The original MACAOS application, the predecessor to Macaos Enterprise, was begun with Delphi 3 in 1997. I have been involved in the project since 2002, Delphi 6. The system uses a middle-tier built in Kylix/RemObjects, for which a RAD Server replacement is under development. What was it like building software before you had RAD Studio Delphi? Personally, I have developed or maintained software using more than a dozen different languages (over a span of 40+ years). With the exception of Delphi and Visual Basic, they were all mostly suitable for console or batch type processing. Delphi brings nearly unlimited processing functionality and flexible, modern UI design together in an intuitive development environment. Prior to using Delphi, I didn’t have the tools to think in terms of building apps with the user experience in focus. How did RAD Studio Delphi help you create your showcase application? Macaos Enterprise is the fourth generation of this functionality. The second generation version basically hit the wall, and we nearly concluded that Delphi was not up to doing the job. (The third generation was built as a Delphi UI wrapper around an MSVC++ motor, which we later abandoned.) That led to a total rebuild of our internal data structures and our graphics engine — making use of newer technologies that had come into the toolset by then. Looking forward, it appears that Delphi provides more than we are likely to need for the forseeable future. The long-awaited release of the Delphi Linux compiler has allowed us to finally start developing a replacement for our stable, but aging, middle-tier which was developed with Kylix 3. What made RAD Studio Delphi stand out from other options? There are several things. Pascal is a much more readable – and thereby self-commenting – language than C-based languages. The Delphi forms designer paradigm is a very efficient UI-design methodology. The availability of 3rd-party components is a huge plus. The somewhat recent addition of mobile platforms opens up new possibilities which we have yet to fully explore. What made you happiest about working with RAD Studio Delphi? I think perhaps it is the event driven program model which makes it easy to expand the application incrementally. I like that I can try out things without needing to build everything before I can run it. What have you been able to achieve through using RAD Studio Delphi to create your showcase application? Our goal has been to make it easy to get an electronics development project from development to production. There are powerful electronics design (CAD) tools out there, and manufacturers have powerful editors and CAM tools at their end. But there is a gap between these two which we aim to fill with intuitive, task-oriented functionality. Our system is widely used in Scandinavia (the home markets of our manufacturing partners), but we believe that other markets can also benefit from these tools. What are some future plans for […]

Read More

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