Delphi

RAD Server CRUD Procedures – Part 3

In this RAD Server CRUD Procedures – Part 3 post we will show how to implement a FireMonkey (FMX) Client to call the RAD Server CRUD procedures and interact with the Employee Table. In the part 2 post, we discussed modifying the default generated CRUD procedure implementations from the RAD Server Package Wizard, to show one possible way to implement Get, GetItem, Post, Put and Delete. In the part 1 post, we discussed the the default generated CRUD procedure implementations from the RAD Server Package Wizard. The Embarcadero RAD Server (also known as EMS – Enterprise Mobility Server) uses the industry standards of REST, and to transfer data to and from the RAD Server REST Service, JSON – JavaScript Object Notation, is typically used as the transfer encoding. Due to the Embarcadero RAD Server supporting industry standard REST and JSON, we will use Delphi’s, C++ Builder and/or RAD Studio’s REST Client Library components (TRESTClient, TRESTRequest, and TRESTResponse ) to implement our EMS REST Client. And recall from Post 2, we used the System.JSON Classes (TJSONArray and TJSONObject) on the back-end RAD Server to implement our CRUD procedures. Employees REST Client For our main REST Client UI form, we have all of the ten (10) columns (fields) from our Employee Table, mostly as TEdit controls for First Name, Last Name, etc., and TSpinBox for the Employee Number, Department Number, and Salary, and one TDateEdit for the HireDate: The bottom panel has 10 TButtons. These buttons will perform the following functions from our RAD Server CRUD procedures:READ: performs the REST HTTP GET, to return all records from the Employee table.PREV: Displays the previous record.NEXT: Displays the next record.FIRST: Displays the first record.LAST: Displays the last record.CREATE: Starts the create mode, to allow the user to use the form to enter a new record.COMMIT: The commit button gets enabled by the CREATE button, and this COMMIT button makes the REST HTTP POST call to the RAD Server to INSERT a new record into the Employee table.EDIT: Starts the Edit mode for the UI form, similar to how Create enter a create mode, allow the user to edit a record.UPDATE: The update button gets enabled by the EDIT button, and after we have made edits to the record, this Update button makes the REST HTTP PUT call to the RAD Server to UPDATE this existing record in the Employee table.DELETE: This Delete button, let’s us delete the current EMP_NO from the Employee table, by making the REST HTTP DELETE call to the RAD Server to DELETE this EMP_NO from the Employee table. With the COMMIT and UPDATE buttons, we do perform their REST calls, and then we perform another GET (READ) call, to get all of the records again. This was just done just for simplicity reasons. This REST Client application also uses the REST Client Library components; RESTClient, RESTRequest and RESTResponse: The Embarcadero REST Client Library is a framework for accessing REST-based web services, like the Embarcadero RAD (EMS) Server. The library is available for all platforms that are supported by Delphi and/or C++ Builder The REST Client Library framework focuses on JSON as the representation format. Let’s now take a look at the implementation code for this Employees REST Client. READ (GET) The source code for the READ (Get) button is this: […]

Read More

Build A Modern, Scalable AI Chatbot Into Your Apps in Under 5 Minutes!

User interaction now has a new set of tools: Chatbots and they have many advantages. Chatbots have become almost ubiquitous in recent times. Not only that but many of the bots have added power by the inclusion of basic artificial intelligence and machine-learning to make them much smarter and with that added smarts they can become much more useful than a simple “hi how are you” interaction, often carrying out tasks such as automated order tracking, support inquiries and appointment management. Chatbots have come a long way from the days of Joseph Weizenbaum’s Eliza. Is it hard to add a chatbot to my app? No! Things have come along in leaps and bounds in recent years. Modern chatbots are easier to install, often distributed across robust, scalable cloud platforms, and are extremely portable across different operating systems and device targets. Despite this the time involved in implementing them in your code is extremely fast. What makes up a modern chatbot? The construction of a chatbot basically goes through two major challenges: Natural Language Processing (NLP) and natural language understanding (NLU). In this article we’re going to meet those challenges in an easy to understand and rapid-to-implement way using Wit.ai as the foundation for our AI Chatbot. Wit.ai is an open NLP engine for developers. It allows you to build human-like conversational applications. Wit.ai provides an easy interface and API allowing our apps to understand human conversation from interactions, parsing the message into data we can then act on. Wit.ai is one of the most powerful APIs used to understand natural language and it’s free. Wit.ai works with NLP and NLU. NLU is the process of understanding what a sentence means. This kind of extracted meanings are called “intents”. A typical intent might be that the user wants to view a weather forecast or they want to see or hear a collection of tasks on a todo list. What does natural language processing (NLP) actually do? NLP breaks a sentence into pieces called entities. They are variables that contain details of the user’s task. For example, for a weather forecast, you should be able to identify which place the user wants the forecast for. Wit.ai offers an API that takes text or voice input and returns intents and entities. When NLP is combined with NLU – the input from the user – your application may take actions or even interact with and ask the user new questions. How do I create an AI chatbot in my application? Go to https://wit.ai/ create an account and a new app. You should see something like the following screen: In the “Utterance” section, you can enter a message that a user would type. Wit.ai may not understand the intent and the entities at first, you need to train it. Choose the intent and highlight the entity manually, as my example: Then click on the button to train your bot. Also, check  ‘See how it works’ to get more information and, the API documentation here. Add some more Utterances to train your bot, until, at least, it can get the intents and entities automatically. Now, we are ready to implement AI on a chatbot application. How do I implement Wit.ai in my own chatbot application? First, you will need a chatbot application. This post will not […]

Read More

From Bindings List to Visual LiveBindings

Having looked into Delphi’s expression engine, component bindings, and the bindings list component, we can now look at the easy and intuitive way to configure an application with dynamic bindings, the Visual LiveBindings design surface. Over the past few weeks, I blogged about Delphi’s expression engine, binding expressions and component, and the bindings list component. Now it is time to put it all together by looking at the visual tools Delphi makes available to easily configure bindings. This is called LiveBindings Designer (available under the View | Tool Windows menu) and it’s an additional pane you can display alongside a design time form or data module. Here is how the demo from the last blog post looks in the LiveBindings Designer: Now if you want to create some of the bindings directly in the designer, you can do the following sample steps: Open a new form Drop a NumberBox controls and a Progressbar controls In the LiveBindings designer drag from the Value property of the NumberBox to the Progress property of the Progressbar, like below: Now, enable the inline arrows to change the value and it will work with no code. Alternatively, if you type in the NumberBox, the value gets refreshed when you leave the control (so you need at least another control that can receive the input focus. Now this is a very simple scenario, there are many properties of controls you can connect, but you might need to expand the “bindable” properties from the default ones, by selecting the three dots at the bottom of the elements in the LiveBindings designer. Now it is important to notice that this designer and the related wizards are primarily focused on database data binding scenarios, which is why associating UI controls doesn’t always work easily. We’ll look into data bindings in a future blog post.

Read More

This Native High-Accuracy Walking Profiler Can Measure Reality

Whenever we try to represent The Earth we tend to use globes. The planet we live on is spherical, right? A flat stretch of sidewalk is… flat, isn’t it? Well, no, actually, it’s very far from flat. If you get down to the nitty gritty (literally, gritty) ground level it is, in fact, a rolling landscape of microscopic hills and mountains with sweeping gullies. The Walking Profiler from ARRB Systems is a specialized device which measures those tiny ups and downs and captures that information. Flexibility and high-performance in the palm of your hand The app which performs this high-performance and super-accurate integration of micro reality with the digital world is written with RAD Studio Delphi and the cross-platform FireMonkey framework. ARRB Systems Website The Walking Profiler G3 is the third generation Walking Profiler since its initial inception, and continues to be the ‘gold standard’ unit for high accuracy pavement reference profiling. As stated by the developer, “Differing from the previous generations, the unit utilises a tri-axial accelerometer mounted on a rolling platform to enable measurement of longitudinal profile. This platform is separate to the carriage, which means it is less susceptible to operator input ie. lean and change of angle.” Walking Profiler in action. Source: ARRB Systems Website Website Walking Profiler G3 – ARRB Systems Google Play Walking Profiler Screenshot Gallery Integrating with physical hardware devices is made much easier by the power of RAD Studio Delphi. Why not download a trial copy today?

Read More

TCoffeeAndCode: Data Visualization – Components, Libraries, Tools and Services

This blog post contains information, tools and links that I will discuss and demo during today’s TCoffeeAndCode webinar on Data Visualization.   What Inspired My Data Vizualization Journey – The Joy of Stats / GapMinder “Our mission is to fight devastating ignorance with a fact-based worldview everyone can understand.” Founded in Stockholm on 25 February 2005 by Ola Rosling, Anna Rosling Rönnlund, and Hans Rosling. Hans gave his first TED talk, called, “The best statistics you’ve ever seen” in 2006. https://www.ted.com/talks/hans_rosling_the_best_stats_you_ve_ever_seen https://www.gapminder.org/videos/the-joy-of-stats/ https://www.gapminder.org/ https://www.gapminder.org/tools-offline/ Programming Delphi C++Builder Python Components and Libraries FMX Draw2d 3d TeeChart – VCL and FMX GigaSoft Pro Essentials – VCL – https://www.gigasoft.com/ FastReports FastCube Python4Delphi (and C++Builder) – via visualization packages https://github.com/pyscripter/python4delphi https://blogs.embarcadero.com/python-for-delphi-developers-webinar/ https://blogs.embarcadero.com/using-python4delphi-with-cbuilder-vcl-applications/ Ray Konopka white paper and webinar replay Seeing-is-Believing-Data-Visualization-in-Multi-Device-Apps Ray Konopka White paper download and on-demand webinar replay https://www.embarcadero.com/rad-in-action/data-visualization Python Visualization Libraries https://mode.com/blog/python-data-visualization-libraries/ https://analyticsindiamag.com/top-5-python-libraries-for-data-visualization/ https://www.analyticsvidhya.com/blog/2020/03/6-data-visualization-python-libraries/ Data visualization blogs to follow https://informationisbeautiful.net/ https://flowingdata.com/ https://www.storytellingwithdata.com/blog https://www.visualisingdata.com/ https://junkcharts.typepad.com/ https://pudding.cool/ https://www.economist.com/graphic-detail Interactive Things https://www.interactivethings.com/ https://blog.interactivethings.com/ Other Tools and Services GapMinder – https://www.gapminder.org/ and Gapminder Desktop Google Public Data Explorer – https://www.google.com/publicdata/directory Tableau – https://www.tableau.com/ Datawrapper – https://www.datawrapper.de/ MicroStrategy Analytics – https://www.microstrategy.com/en Qlik Sense – https://www.qlik.com/us/ Oracle Analytics Cloud – https://www.oracle.com/middleware/technologies/oracle-analytics-cloud.html Microsoft Resilience – https://www.microsoft.com/en-us/resilience/ Sisense – https://www.sisense.com/ Grow – https://www.grow.com/ Conversionomics – https://conversionomics.com/ Qrvey – https://qrvey.com/ Zoho Analytics – https://www.zoho.com/analytics/ Domo – https://www.domo.com/ Sources of Data The World Bank https://www.worldbank.org/en/home World Bank Open Data – https://data.worldbank.org/ World Bank Data Catalog – https://datacatalog.worldbank.org/ Kaggle.com – data sets for data scientists https://www.kaggle.com/datasets US Census https://data.census.gov/cedsci/ https://covid19.census.gov/ https://www.census.gov/library/visualizations/interactive/2020-complete-count-committees.html Data Gems – highlighted examples of census data https://www.census.gov/data/academy/data-gems.html Jackson County, Oregon Profile https://data.census.gov/cedsci/profile?g=0500000US41029 Ashland City, Oregon Profile https://data.census.gov/cedsci/profile?g=1600000US4103050 DATA GEMS: How to Use the COVID-19 Data Hub https://www.census.gov/data/academy/data-gems/2020/how-to-use-the-covid-19-data-hub.html DATA GEMS: How to Visualize your Data Using Thematic Maps on data.census.gov https://www.census.gov/data/academy/data-gems/2021/how-to-visualize-your-data-using-thematic-maps-on-data-census-gov.html DATA GEMS: How to Visualize Data for Your Area on data.census.gov https://www.census.gov/data/academy/data-gems/2019/visualize-data.html More Inspirations Information is Beautiful https://informationisbeautiful.net/ https://informationisbeautiful.net/blog/ https://informationisbeautiful.net/data/ https://www.informationisbeautifulawards.com/ https://www.informationisbeautifulawards.com/news/10-2013-the-winners Why is Data Visualization Important? What is Important in Data Visualization? https://hdsr.mitpress.mit.edu/pub/zok97i7p/release/3 See The 25 Most Beautiful Data Visualizations Of 2013 https://www.fastcompany.com/3022248/see-the-25-most-beautiful-data-visualizations-of-2013 Beautiful Visualizations https://www.pinterest.com/ascii27/beautiful-visualizations/ Learn how to create beautiful and insightful charts with Python — the Quick, the Pretty, and the Awesome https://towardsdatascience.com/plotting-with-python-c2561b8c0f1f Tableau Public Gallery https://public.tableau.com/en-us/gallery/?tab=featured&type=featured https://public.tableau.com/en-us/gallery/?tab=viz-of-the-day&type=viz-of-the-day Build your own Animated Data Visualization in Tableau in Just 5 Minutes https://www.analyticsvidhya.com/blog/2020/06/animated-data-visualization-tableau-5-minutes/ Additional Resources Magnificent print visualizations http://www.thefunctionalart.com/2016/05/magnificent-print-visualizations.html Web App Masters: Steps to Beautiful Visualizations https://www.lukew.com/ff/entry.asp?1284 Create High-Impact Data Visualizations: Nine Effective Strategies https://www.kaushik.net/avinash/tag/data-visualization/page/2/ Data Visualization Aurora.txt – A Bit of History The… https://www.coursehero.com/file/58980014/Data-Visualization-Auroratxt/ Marvelous Maps https://www.esri.com/about/newsroom/arcwatch/marvelous-maps/ http://1millionhealthworkers.org/operations-room-map/day-life/ Books Beautiful Visualization: Looking at Data through the Eyes of Experts (Theory in Practice) Paperback – July 13, 2010 https://www.amazon.com/Beautiful-Visualization-Looking-through-Practice/dp/1449379869 The Visual Display of Quantitative Information 2nd Edition https://www.amazon.com/Visual-Display-Quantitative-Information/dp/0961392142/

Read More

Ultimate Hockey Playview Application Is Delphi Powered

Hockey is an immensely popular sport in North America, both in the USA and with Canada their Northern neighbors. Just to be clear for our British and European readers, in this article we are referring to the form of hockey played on ice-rinks, not the version played on grass. What does the Hockey Playview app do? With Hockey Playview coaches and players can view animated plays, drills and practice plans on their phone or tablet. Hockey plays, drills and practice plans can be created with the Hockey Playbook program from Jes-soft, which is free to try and available at http://www.jes-soft.com/hockey/index.html. The playbook desktop program is compatible with Windows modern versions including Windows 10. Create your plays and practice plans on your desktop. Save them to your cloud drive (gdrive, Dropbox for example). Open the plays and practice plans on your mobile device from your cloud drive. The mobile app takes the data entered in the desktop and integrates with it to allow the visualizing of the plays and tactics. Jes-Soft’s website Website Hockey Playview Apple Store Hockey Playview Google Play Hockey Playview 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

Learn To Build A Powerful WhatsApp Chatbot With Twilio

Chatbots have managed to save many huge amounts of time and money for the customer service industry. Increasingly, companies are creating chatbots using well known and widely-used social media and communication apps which have expanded their platforms to offer services specifically targeted at this kind of market. An example is WhatsApp and their WhatsApp Business API. In this post, we will create a simple chatbot for WhatsApp using that API and communication platform Twilio. Chatbots are applications that simulate a human conversation. Typically they help customer services departments answer online questions, saving time and money while also providing an alternate method for customers to engage and interact with staff. It is also possible to use chatbots to automate certain repetitive processes such as obtaining delivery schedules for orders, requesting refunds or pointing customers to additional areas such as on-boarding. Some chatbots are based on simple mechanisms which match parsed text input with a raft of likely answers matching keywords extracted from that parsed data. Others are more subtle and complex and use artificial intelligence to perform their tasks. What is the WhatsApp Business API? It is a solution to help companies that want to scale up their messenger service and can be integrated with service management platforms. To obtain an account it is necessary to seek a Solution Partner. They are companies that provide the infrastructure for the operation of the service. Twilio is the world’s leading cloud communication platform and is one of the Solution Partners of WhatsApp. It is aimed at companies that need communication services to integrate with their systems. Twilio operates in the pay-as-you-go format, with no contracts. Also, it offers a Sandbox to develop applications for free. How do I to create a Twilio account ? Go to the Twilio website at https://www.twilio.com and create an account. Go to your console and check your ACCOUNT SID and AUTH TOKEN. On the left panel, click on the message icon, then settings and WhatsApp Sandbox Settings. You will see: As it says, you need to send, in my case, the message ‘join poet-earth’ to that number. If you receive the message below, you are all set and ready to go: How do I create a simple Delphi WhatsApp chatbot application? To receive messages we need a server API. When someone sends a message, Twilio will get it and make an HTTP Post in an endpoint. The endpoint needs to be informed on Twilio Sandbox (When a message comes in): On your application, in that endpoint, you can grab the data and send a response, based on the message received. To create the Server API, we will use the Delphi MVC Framework. You can check an easy implementation of it, here and also, how to expose your API endpoint with ngrok. Also, you will want to use a ‘Twilio Client’. Download the TwilioClient.pas here and add it to your project. How to create Twilio client application with Delphi After creating a DMVC project and added the TwilioClient, go to your controller, add an endpoint: [MVCPath(‘/messages/receive’)] [MVCHTTPMethod([httpPOST])] procedure Receive(WebContext : TWebContext);     [MVCPath(‘/messages/receive’)]     [MVCHTTPMethod([httpPOST])]     procedure Receive(WebContext : TWebContext); Also, add as const your account sid and auth token as strings. On the receive procedure, you can access data through: This returns a string with data so, we just need to […]

Read More

Whitepaper: RAD Studio – Should I Choose Enterprise?

RAD Studio, Delphi® and C++Builder® are available in Professional, Enterprise and Architect editions. This paper explores the differences between the Professional and Enterprise editions to help you choose the right edition for your needs. The Professional Edition of RAD Studio, Delphi® and C++Builder® is ideal for developers creating desktop and mobile applications with high speed and performance, and applications connecting to local peripherals and devices. Developers choose the professional edition for the deepest Windows 10 APIintegration in the market, plus rapid low-code application prototyping with stunning native UI, providing the best end user experience. The Enterprise Edition of RAD Studio, Delphi® and C++Builder® includes all the power of the Professional edition, plus a host of powerful enhancements and additional libraries for highly connected application development and secure mobile data storage. Keep reading to discover more about those. This paper is for those looking to choose the right edition of RAD Studio, Delphi® or C++Builder® for themselves or their team, or those looking to validate their reason to jumpstart their development with a higher edition.  

Read More

Powered By Delphi: Rapid Prime Numbers Calculator For Kids

I remember being taught Prime Numbers at school. I’m sure you, like me, were told “a prime number can only be divided by itself and one“. It was a lot to take in at that early age when we were all still learning how to tie shoelaces so they stayed tied and questioning why we had to eat our vegetables instead of just surviving on ice cream. How do you make Prime Numbers fun? Unlike for most of our childhoods, kids today have access to the wonder of the internet and a plethora of mobile devices. These devices are a source of fun but we can carefully combine fun things with learning too. Spanish Developer Demontriz programacion a medida SL, based in Madrid, try to help with learning primes in this simple mobile app using the FireMonkey FMX framework. What does the Prime Numbers app do? The app can answer questions like “is the number 8 prime?” No, it can be divided by 2. “How about the number 121? By 3, no. By 7, no. By 11, yes, it can be divided by 11”. The application lists the first 5000 primes. I you don’t find the number you are looking for you can enter the number and the application will check to see if it is either prime or one of the factors. Website Prime Numbers Google Play Prime Numbers Screenshot Gallery Do you think you have an idea for a mobile app? Why not download a trial copy of RAD Studio Delphi and start creating today? It’s easy.

Read More

How Easy Is It To Add A REST API To Your Own Apps?

unit employee;   interface   uses   Horse, System.JSON, sysutils;   procedure Get_Employees(Req: THorseRequest; Res: THorseResponse; Next: TProc); procedure Get_Employee(Req: THorseRequest; Res: THorseResponse; Next: TProc);   implementation   procedure Get_Employees(Req: THorseRequest; Res: THorseResponse; Next: TProc); var   LRespArr: TJSONArray;   LRespObj: TJSONObject;   LEmployee1, LEmployee2, LEmployee3, LEmployee4, LEmployee5: TJSONObject; begin   LRespObj:= TJSONObject.Create;   LRespArr:= TJSONArray.Create;   LEmployee1:= TJSONObject.Create;   LEmployee2:= TJSONObject.Create;   LEmployee3:= TJSONObject.Create;   LEmployee4:= TJSONObject.Create;   LEmployee5:= TJSONObject.Create;   try     LEmployee1.AddPair(TJSONPair.Create(‘id’, TJSONNumber.Create(1)));     LEmployee1.AddPair(TJSONPair.Create(‘name’, ‘Employee1’));       LEmployee2.AddPair(TJSONPair.Create(‘id’, TJSONNumber.Create(2)));     LEmployee2.AddPair(TJSONPair.Create(‘name’, ‘Employee2’));       LEmployee3.AddPair(TJSONPair.Create(‘id’, TJSONNumber.Create(3)));     LEmployee3.AddPair(TJSONPair.Create(‘name’, ‘Employee3’));       LEmployee4.AddPair(TJSONPair.Create(‘id’, TJSONNumber.Create(4)));     LEmployee4.AddPair(TJSONPair.Create(‘name’, ‘Employee4’));       LEmployee5.AddPair(TJSONPair.Create(‘id’, TJSONNumber.Create(5)));     LEmployee5.AddPair(TJSONPair.Create(‘name’, ‘Employee5’));     LRespArr.AddElement(LEmployee1);     LRespArr.AddElement(LEmployee2);     LRespArr.AddElement(LEmployee3);     LRespArr.AddElement(LEmployee4);     LRespArr.AddElement(LEmployee5);       LRespObj.AddPair(TJSONPair.Create(‘r’, TJSONBool.Create(true)));     LRespObj.AddPair(TJSONPair.Create(‘m’, ‘Success’));     LRespObj.AddPair(TJSONPair.Create(‘d’, LRespArr));       Res.Send(LRespObj.ToString);   finally     LRespObj.Free;   end; end;   procedure Get_Employee(Req: THorseRequest; Res: THorseResponse; Next: TProc); var   LRespObj: TJSONObject;   LEmployeeSelected: TJSONObject;   id: Double; begin   id := StrToFloat(Req.Params[‘id’]);     LRespObj := TJSONObject.Create;   LEmployeeSelected := TJSONObject.Create;   LEmployeeSelected.AddPair(TJSONPair.Create(‘name’, ‘Employee’+Req.Params[‘id’]));   LEmployeeSelected.AddPair(TJSONPair.Create(‘id’, TJSONNumber.Create(id)));     LRespObj.AddPair(TJSONPair.Create(‘r’, TJSONBool.Create(true)));   LRespObj.AddPair(TJSONPair.Create(‘m’, ‘Success’));   LRespObj.AddPair(TJSONPair.Create(‘d’, LEmployeeSelected));   res.Send(LRespObj.ToString); end;   end.

Read More