Quantcast
Channel: Latest blog entries - Embarcadero Community
Viewing all 1683 articles
Browse latest View live

Delphi Blogs of the Month #61

$
0
0

Embarcadero Updates

Embarcadero released Delphi Community Edition, a great step to get the product back to students and hobbyist with support for mobile platforms in a free edition, for non-prossional developers. The release has been very well received and had a large number of downloads, but we are asking all Delphi developers to spread the word. 

We have released an updated roadmap for RAD Studio, https://community.embarcadero.com/article/news/16638-rad-studio-august-2018-roadmap, along with a commentary blog post bby the PM team, https://community.embarcadero.com/blogs/entry/august-2018-roadmap-commentary-from-product-management

Official considerations about "Deadline Approaching: Google’s new Android API level 26 Requirements" by Sarina at https://community.embarcadero.com/blogs/entry/deadline-approaching-google-s-new-android-api-level-26-requirements

Technical Blog Posts

Along with the community edition, we have released a new set of articles to get started with it. I updated a similar set of article Pawel had written for the Starter edition, they are all linked form here: https://community.embarcadero.com/blogs/entry/learn-to-program-with-community-edition (there is also a C++ counterpart). My series starts at https://community.embarcadero.com/blogs/entry/learn-delphice-part1.

Very nice post on "Some information about Embarcadero License Center" by Thomas at https://blog.dummzeuch.de/2018/07/14/some-information-about-embarcadero-licence-center/

Celebrating Five Amazing Years with Embarcadero by Jim at http://delphi.org/2018/07/five-amazing-years-with-embarcadero/

Upload An Attachment To SalesForce With The Delphi 10.2 Tokyo Enterprise Connectors by Eli at https://community.embarcadero.com/blogs/entry/upload-an-attachment-to-salesforce-with-the-delphi-10-2-tokyo-enterprise-connectors

Free Field Service App Template Solution Quick Start Guide For Android, iOS, macOS, and Windows also by Eli at https://community.embarcadero.com/blogs/entry/free-field-service-app-template-solution-quick-start-guide-for-android-ios-macos-and-windows

An Unusual Video

This video is interesting just because it is a presentation of RAD Studio by a person outside of our community, to an audience new to the product: https://www.youtube.com/watch?v=doc4AkJG5Kg

Libraries

High performance #Delphi  event driven component for parsing bitcoin and block-chain block files at https://github.com/SoftwareTools4Makers/Delphi-Component-for-BlockChain-Dat-Files​​

That's all for this round...​


Read More

Building REST services with RAD Server (Delphi & C++ Builder)

Webinar Replay: What you need to know about UX Design for Mobile IoT applications

$
0
0

The Internet of Things (IoT) is one of the hottest topics in the tech world today. The ability to connect everyday objects to the internet and control them with an application or your voice is a true game-changer for end users. With all the connectedness though, there are new challenges that have emerged for the mobile devices that bind this all together. Mobile applications have become a must-have requirement for interacting with the Internet of Things and the mobile users have even higher expectations on their experience than ever before.

Higher Expectations for Mobile IoT Applications

Mobile users, whether IoT enabled or not, have certain expectations from applications that they are interacting with. Consumers expect that the applications they use will

  • Be accessible
  • Provide exceptional personalized experiences
  • Provide real-time information
  • Be simple and intuitive
  • Have standard gestures that they are used to

Mobile users are far different than the traditional users of web and desktop applications. With desktop or web, you have a strong internet connection that typically doesn’t falter, but with IoT applications, the devices themselves may not have the ability to remain “connected” and synced in fear of less battery life. This is where UX or User Experience comes in.

What is UX Design?

User experience (UX) design is the process involved in designing an application that empowers users with a positive experience during their interaction with the product. It is about creating connections and consistency that drives further use. It is a difficult endeavor for anyone building IoT products.

Common Challenges for Iot Mobile Apps

While IoT brings convenience and efficiency to all our lives, the challenges it brings when designing mobile apps that give users consistency and are optimized towards user interaction can be easily overwhelming.

A few of the challenges you face include:

  • Usability
  • Glitches
  • Connectivity
  • Security
  • The impact on hardware

Check out the webinar replay below to see what you need to consider when building Mobile IoT applications with user experience in mind!

 

If you missed the additional resources page, here are the titles of the books that I mentioned:

 

  1. Designing Connected Products: UX for the Consumer Internet of Things by Claire Rowland, Elizabeth Goodman, Martin Charlier, Ann Light and Alfred Lui
  2. The Design of Everyday Things by Don Norman

 

Follow-up Questions from the Webinar

During the  Q&A session, I was asked several questions and wanted to provide a few responses or clarification to some of them.

In order to explore IoT what kind of devices do you suggest testing with?

That is really up to you and what your interests are. In RAD Studio, we provide some components that are easily available for purchase and we provide sample applications for them that you can test out and integrate into your own applications.

 

What is the future of IoT?

This is a very loaded question but I would say that IoT is going to evolve to the demands of the consumers. It will change the way we think about security, users, capabilities and beyond, but overall, the integration is already ingrained in the consumer space and products, services and devices will match to those adjusting requirements.

 

Is it better to have specialized screens or better to use the same screen everywhere?

If I am understanding the question correctly, it depends on the research conducted about your users and what your app functionality provides. The difficulty with stating one or the other is that UX is dependent upon what your users feel for the purpose of the application/product that you are building.

 

A couple of years ago, I was at a seminar about mobile UX design and they were saying that it's more important that the app looks great the features come second and at a minimum to keep it simple. Something like that is quite hard to grasp for software developers who want some technical masterpiece. Is this still the trend?

There is something to be said about simplicity. From my experience, users want the application to be able to perform how it would if they were on the website but don’t expect the same layout and design. It should be intuitive for them to get started and that can require some changes to the technical side. A minimalistic design declutters the UI and allows users to focus on what you want them to, removing elements that may cause errors or decrease speed in the completion of their tasks. That doesn’t mean you can’t have the technical masterpiece behind the scenes in your application code, it just means picking and choosing what functionality is important and perfecting that piece for the users.

 

You've said that some features like  "zoom" is crucial for some apps, and I agree, but almost none of the bigger apps don't have any zooming function. Like LinkedIn or WhatsApp, etc. They don't support zooming or coloring customization or whatever. How come they don't build such features? if they are crucial?

The design style you choose for your applications is largely based on how your users will interact with it and what the expectations are for functionality. The may have deemed that the “zoom” capability wasn’t something that users would find a reason to use. They choose to use the same coloring scheme as their website, so perhaps they decided to use the same design and icons as it provides the consistency that users would expect from the website to the mobile app or even just as a comfort. If they changed the design to purple or burnt orange, would it change the way you feel about what you would expect from LinkedIn or some other site? While colorful and frameless designs are the trend now, there are

I  didn't see a lot of discussion about data, either content or structure. Perhaps I overestimate the importance of data. Shouldn't data be a major consideration when designing UX?

Data is definitely a major concern when discussing the functionality of an application. Connectivity to data at any time is important to any user whether they are online or not. Especially offline. In regards to the lack of dedication to the discussion on data in this webinar, I wanted to provide a baseline for what you need to keep in mind, data is definitely not something to be overestimated (data is the most important to me!).

 


Read More

New CData Connectors For August 2018

$
0
0

Since last year, Embarcadero has teamed up with CData to offer easy to use FireDAC connectors for many web and cloud services, including data repositories, business services, social media and much more. These connectors are available at a flat fee and two packs, Enterprise and Enterprise Plus. You can read more at https://www.embarcadero.com/products/enterprise-connectors and at https://www.cdata.com/firedac/.

In general terms what is nice about these connectors from the point of view of a developer is the fact they are FireDAC drivers fully integrated in the IDE and the idea of using simple SQL queries to interact with countless data sources based on totally different APIs. Building applications becomes much easier and requires only limited access to the documentation. For example, I blogged about this at http://blog.marcocantu.com/blog/2017-november-cross-jira-analysis-cdata-connector.html.

CData keeps expanding the list of drivers and rolling them out as part of the existing packages (at no extra cost for those who signed up). Over the recent weeks, they added a number of new interesting drivers. In the Enterprise Pack there are now some additional drivers:

Act! CRM Excel Online Shopify Slack Survey Monkey Kintone (Japanese accounting platform)

There are also two additional beta versions for Instagram and Zendesk.

In the higher-level Enterprise Plus package there are now also the following drivers:

Amazon Athena Azure Data Management SAP Business One SAP Hybris C4C Salesforce Einstein Analytics Splunk

This brings the total number of drivers in the largest pack to over 100! Now while no developers generally needs to interact with all of them, even if you need only half a dozen of such systems, using CData Connectors will help you save a lot of development time.

Below you can see some of the new connectors (like the Instagram beta one) on the GetIt package manage, where you can find the trial versions. This is going to change in the (near) future as download mechanism, but the trials will remain available -- ony change will be in the download process.


Read More

2018年8月の新しいCData Enterprise Connectors

$
0
0

この記事は、Marco Cantu によるNew CData Connectors For August 2018の抄訳です。


昨年より EmbarcaderoはCDataと協力し、データレポジトリ、ビジネスサービス、ソーシャルメディアなど、多くのWebおよびクラウドサービスをFireDAC経由で容易に扱えるコネクタを提供しています。これらのコネクタはEnterpriseおよびEnterprise Plusの2種類のパックで利用できます。詳細については https://www.embarcadero.com/jp/products/enterprise-connectorshttps://www.cdata.com/jp/firedac/ をご覧ください。


Read More

Architect Edition Now Includes RAD Server Multi-Site License

$
0
0

RAD Server is a powerful solution for building web services and modern multi tier applications, and as a backend for mobile applications. You can use RAD Server to publish your own REST APIs, like exposing database data or any other data source, but also perform actions on the backend. This is often needed for mobile applications, but, in general, for any modern multi-tier architecture. Having the data access logic and business logic on the server helps making changes without having to update the client application, for example.

The RAD Server technology has been part of the RAD Studio development tools for a couple of years now. We have seen a lot of interest for the technical approach RAD Server uses in publishing REST APIs based on HTTP and JSON and we have been extending the server capabilities to better support JavaScript client (to help using RAD Server for ExtJS projects, but also for any other javaScript client library). The support for building RAD Server applications (and a local server used for debugging) are included with Delphi, C++Builder and RAD Studio Enterprise and above.

At the time we released RAD Studio 10.2.2, we decided to make the RAD Server deployment license for the single site available with Enterprise and Architect licences. Now we have taken an extra step, as an appreciation to our loyal customers on the Architect edition.

If you have an Architect edition license of Delphi, C++Builder or RAD Studio, you will receive a RAD Server multi-site license. This adds the ability to deploy RAD Server solutions on multiple, distinct company servers, cloud services, or on-premise customers servers. The RAD Server multi-site deployment license is roughy a $10,000 USD value when purchased separately. 

Who is going to receive this license? In short, all new Architect Edition customers and Architect Edition customers on an active Update Subscription, but the process is slightly different.

Any customer currently on an Architect level Update Subscription will receive a key over email (which is another good reason to keep your subscription active!). If you haven’t received it yet, please note that they are sent to companies, not individual developers -- so there might be a discrepancy on who receives them. If you checked with whoever receives license activations and your anti-spam filter and you still have not received it, feel free to ping your sales representative or partner.

Any customer buying a new Architect license after 16 August 2018 will receive this key instead of the RAD Server single-site key. Enterprise customers will continue to receive the RAD Server single-site deployment license. 

If you are interested in RAD Server multi-site deployment licenses and you do not have RAD Studio, Delphi, or C++Builder Architect editions with a current Update Subscription, you can purchase it separately through your partner or sales. However, now is a good time to evaluate if Architect license including RAD Server is a better value for your needs and may even save you money compared to separate purchases. 

I personally really believe RAD Server is a powerful solution for building web services and modern multi tier applications, and as a backend for mobile applications. We have been extending it and plan to expand RAD Server in the future (as highlighted in the recent RAD Studio roadmap). Now with this additional licensing option, make sure you double check this technology and migrate your existing client/server applications to it.

Summary: 

  • New RAD Studio, Delphi, and C++Builder Architect Editions now come with RAD Server multi-site deployment license ($10,000 USD value)
  • Existing RAD Studio, Delphi, and C++Builder Architect Edition customers with an active Update Subscription will receive their new license key via email. 
  • RAD Studio, Delphi, and C++Builder Enterprise Editions will continue to include RAD Server single-site deployment license ($5000 USD value)
  • RAD Studio, Delphi, and C++Builder Professional and Community editions do not include RAD Server development tools nor a deployment licenses.
  • For additional information on RAD Server and available licensing models, please see https://www.embarcadero.com/products/rad-server

Read More

Tudo o que você precisa saber sobre o Embarcadero Conference 2018

$
0
0

Screenshot_2018-08-23 Embarcadero Conference - O maior evento de desenvolvimento da América Latina.png

Foi dada a largada para o Embarcadero Conference 2018, e este artigo traz um resumo das informações vitais sobre o evento, além das principais novidades.

Logística

O evento deste ano será em 23 de Outubro, e está de casa nova, em um novo espaço recém inaugurado no Centro de Convenções Rebouças. Este novo espaço tem total relação com o novo formato do evento (detalhes a seguir).

Palestras

A submissão de palestras está aberta e assim seguirá até o próximo dia 30! Caso tenha algo legal  pra compartilhar, não deixe de fazer sua submissão aqui: http://embarcaderoconference.com.br/callforpapers/

Estamos buscando por tópicos como Android, Arquitetura, Big Data,​ Database, DevOps, iOS, JavaScript, Linux, macOS, Mobile, Testes, UX Design, Web, Windows 10 e Windows Store, porém, toda criatividade será muito bem vinda!

Novo Formato

Para este ano estamos preparando algo totalmente diferente, um novo formato em um grande espaço integrado, sem barreiras de salas ou horários rígidos. Com isso, será possível abordarmos muito mais assuntos, e você terá total liberdade sobre o que assistir. Não gostou do assunto? Caminhe um pouco e assista a palestra ao lado!

Grandes Novidades

Durante o evento teremos a oportunidade de revisar tudo o que ocorreu este ano no mundo do RAD Studio, e olha que não foi pouca coisa! Nova Community Edition, aquisições, novas releases, novos produtos, e por aí segue…

Mas além disso, este ano o evento será palco de muitas novidades, então se você é daqueles que gosta de saber de tudo em primeira mão, este é o lugar para estar!

Inscrições

A grade de palestras estará disponível em alguns dias, mas você não precisa esperar por ela para se inscrever. A exemplo dos anos anteriores, tenha certeza de que teremos um evento de altíssimo nível!

Link para inscrições: http://embarcaderoconference.com.br/ Call for papers: http://embarcaderoconference.com.br/callforpapers/ Dúvidas e solicitações especiais: atendimento@embarcadero.com.br

 

 

 


Read More

Full Featured FireMonkey Mobile Client Source Code For Delphi 10.2 Tokyo On Android, iOS, macOS, and Windows

$
0
0

The RAD Server Field Service Template utilizes a RAD Server based REST server module for the server side. On the admin side there is a FireMonkey based desktop client for adding, viewing, and managing appointments. Additionally, the admin client allows you to manage parts inventory and do user administration. The offline capable cross platform client app is built in FireMonkey and it can be deployed to Android, iOS, macOS, and Windows. There is a single codebase and single UI. It allows you to view pending and completed appointments, map their locations, and mark them as completed. You can also view parts inventory and receive local notifications when new appointments are synced from the server. Both LiveBindings and FireDAC are used extensively through the Field Service Template to provide a low code solution.

The Field Service Admin project is built in RAD Studio Delphi using FireMonkey (FMX). The Admin app connects to RAD Server on the backend via a REST API. You should be able to log into the Admin area by selecting a Branch ID (Tenant ID) plus entering the login and password for a user in the Managers Group. For this template the default user is manager1.

Be sure to configure the EMS_SERVER and EMS_PORT const in uMainForm.pas to point at your development server. The default is localhost 8080.

The Branch ID is stored with each data table so each branch will only see its own set of appointments, parts, and users. Each branch has its own users and groups as well. The Branch system is built on top of the Tenant functionality in RAD Server.

As of the time of this writing you can get a single site license for RAD Server with RAD Studio Enterprise and you can get a multi-site license for RAD Server with RAD Studio Architect edition.


[YoutubeButton url='https://www.youtube.com/watch?v=Y5Dex1miXj0']

 

Appointments

Appointments are records that can be created, viewed, and edited in the Admin client. They can also be assigned to a Technician. Appointments can be viewed and completed in the Field Service App. Appointments have various fields like Appointment date and time, customer title, description, address information, phone number, location, photo, status, and notes. The photo field supports PNGs and JPGs. Addresses can be converted to longitude and latitude using the Locate button utilizing the Google Geocoding API.

History

The Service History list is a view into the Appointments and only shows Appointments that have been their status set to Complete. Technicians using the Field Service App submit completed appointments and include notes. The History view utilizes TFDLocalSQL to show only the completed appointments.

Parts

Parts are records that can be created, viewed, and edited in the Admin client. They can also be viewed by Technicians. Parts have various fields like title, description, location, quantity, and photo. The photo field supports PNGs and JPGs.

Users

Users are records that can be be created, viewed, and edited in the Admin client. They also show up as an individual profile to logged in Technicians. When a user is created in the Field Service database it also creates a shadow user in the RAD Server Users API where their username and password are stored. By default users can be in the Managers Group or the Technicians Group. The Group information is also stored in the RAD Server Groups API and the server accesses the RAD Server User and Group data for the permissions.

Data Sync

The Data Sync tab in the Admin client is where JSON data is downloaded from the Field Service Server REST endpoint and loaded up into the various in memory TFDMemTable components. Data for the Appointments, Parts, Users, and Groups is all downloaded on this tab. You can also request to Refresh the data at any time to get new updates from the server. Additionally, there is a background TTimer which will refresh the data from the server automatically on an interval.

Architecture

The architecture of the app is built in a low code rapid application development style using TTabControls for handling pages and individual frames for each page. TActionList is used to consolidate much of the code in the MainForm. There are two TTabControls on the MainForm. The first one contains the Login frame and the second TTabControl. The second TTabControl contains the rest of the frames. Within the ApptsFrame, HistoryFrame, PartsFrame, and TechsFrame there are additional Master/Detail TTabControls.

If you want to make changes to the design time frames be sure to edit the frame itself and not the version of it that is embedded in the MainForm. This will keep your changes consolidated in one place. If your changes don't update in the MainForm you can delete the Frame from the MainForm and re-add it. Be sure to add it to the correct Tab and set to Align Client after you add the frame.

The frames are built to be as modular as possible with TBindSourceDB components used as endpoints for the LiveBindings. This allows you to easily re-use the frames in your own projects by connecting the TBindSourceDBs to your own datasets.

A TFDLocalSQL component is used to provide SQL access to the various TFDMemTables via TFDQuery components. This allows the App to provide query results for filtering some of the datasets.

  • uDataModule in 'uDataModule.pas' {MainDM: TDataModule},
    Contains the RAD Server (EMS) Provider client components, the in memory table components, and the various FireDAC connecting components.

  • uMainForm in 'uMainForm.pas' {MainForm},
    Contains the main form of the application with the various TTabControls and inline embedded TFrames.

  • uLoginFrame in 'uLoginFrame.pas' {LoginFrame: TFrame},
    Contains the UI and code for the Login screen.

  • uApptsFrame in 'uApptsFrame.pas' {ApptsFrame: TFrame},
    Contains the UI and code for the Appointments screen.

  • uHistoryFrame in 'uHistoryFrame.pas' {HistoryFrame: TFrame},
    Contains the UI and code for the History screen.

  • uPartsFrame in 'uPartsFrame.pas' {PartsFrame: TFrame},
    Contains the UI and code for the Parts screen.

  • uTechsFrame in 'uTechsFrame.pas' {TechsFrame: TFrame},
    Contains the UI and code for the Users screen.

  • uProgressFrame in 'uProgressFrame.pas' {ProgressFrame: TFrame},
    Contains the activity progress TFrame which is displayed when the app is busy.

  • uTenantsDM in 'uTenantsDM.pas' {TenantsDM: TDataModule},
    Contains the RAD Server (EMS) Provider connector components for accessing the Branch (Tenants) list.

  • uTenantListForm in 'uTenantListForm.pas' {TenantForm},
    Contains the UI and code for selecting a Branch/Tenant.

  • uQueueFrame in 'uQueueFrame.pas' {QueueFrame: TFrame},
    Contains the UI and code for syncing data from the server.

  • uGroupsListForm in 'uGroupsListForm.pas' {GroupsForm},
    Contains the UI and code for selecting a Group.

  • uTechsListForm in 'uTechsListForm.pas' {TechsForm};
    Contains the UI and code for selecting a Technician to assign to an appointment.

Permissions

The Field Server Admin app will make an additional call after it logs in to download the list of Groups that the current user account is in. It will check to see that the user is in the Managers Group. If the user is not in the Managers Group it will log you back out. There are additional permissions in the Field Server Server which govern what data is sent down to which users as well. Only users in the Managers Group will receive the full data and be able to make changes to it.

Customize The UI

You can quickly and easily customize most of the look and feel of the app with three easy changes. In TMainForm there is a BackgroundRect, a BackgroundImageRect, and a EmeraldDarkStyleBook control. You can change the background color of the app by changing the BackgroundRect.Fill.Gradient property. You can change the image that is overlayed over the entire app by changing the BackgroundImageRect.Fill.Bitmap.Bitmap property. The background image works by being above all of the other controls, having a low Opacity, having a HitTest of False and a Locked property of True. Finally, you can change most of the rest of the theme by loading different Premium Styles into the EmeraldDarkStyleBook control.

You can customize the header logo of the Login screen on the LoginFrame. There are a few other places where the custom green color is used on some elements in the TListView controls and some the search icons using a TFillRGBEffect.

You will need to update the BackgroundRect and BackgroundImageRect in the GroupsListForm, the TechsListForm, and the TenantForm as well. There is a BackgroundImage control in the LoginFrame if want to customize the background of the Login page. Remember that you will need to load one style for each of the four deployment platforms. You can access the Premium Styles here:

https://www.embarcadero.com/products/rad-studio/fireui/premium-styles

 

https://cc.embarcadero.com/item/30491

 

Check out the full deep dive into the Field Service Template for Android, iOS, macOS, and Windows.


Read More

Learn How To Replicate A TFDMemTable Into An IBLite Table With FireDAC In Delphi 10.2 Tokyo

$
0
0

The Field Service Template client app has offline capabilities which allows you to record changes offline without an internet connection. Later updates can be sent back up to the RAD Server once an internet connect is detected. One of the pieces of code in the Field Service Template client app that makes this possible is a function which will take the FireDAC JSON that is received from the RAD Server and store it as a table in IBLite.

As you will see in the source code below the procedure takes a table name, an TFDMemTable, a TFDTable, and a Recreate boolean parameter. In this instance TFDTable is connected to the IBLite database and TFDMemTable contains the FireDAC JSON from the server. The procedure first sets the Table name on the TFDTable. If Recreate is True it will overwrite the existing table if it exists. Next the FieldDefs in the TFDTable get cleared and then copied from the TFDMemTable into the TFDTable. Finally, the data from the TFDMemTable is copied (using CopyDataSet) into the TFDTable.

 

//
//
procedure TMainDM.SaveMemTableToIB(TableName: String; MemTable: TFDMemTable; FDTable: TFDTable; Recreate: Boolean);
begin
     FDTable.Close;
     FDTable.TableName := TableName;
     if Recreate=True then
       begin
         FDTable.FieldDefs.Clear;
         FDTable.FieldDefs.Assign(MemTable.FieldDefs);
         FDTable.CreateTable(True);
         FDTable.CopyDataSet(MemTable, [coStructure, coRestart, coAppend]);
       end
     else
      FDTable.Open;
end;

And that is all there is to it. The data from the server table has now been replicated from the server into the IBLite database on the client. When the server data changes the client data just gets overwritten by the replication. One reason to use IBLite or SQLite this way is that any changes you do make to the data are automatically saved to disk (vs. a TFDMemTable which you would have to manually save). You might also want to use IBLite or SQLite if your data was quite large instead of holding it in a TFDMemTable in memory. Another reason is that if the schema changes on the server it will automatically get updated on the client.

The code to send changes back up to the server is separate. In this instance there is no data syncing going on here because the changes that are made on the client side and sent back to the server are mostly separate from the replicated dataFor syncing data between a client and RAD Server using FireDAC check out this sample.

Check out more information about the Field Service Template in the Deep Dive article about it.


Read More

About the author

std::out << "Happy 35th birthday, C++!"

$
0
0
C++ Began in 1983

C++ has a long history, beginning in 1979, with Cpre, which added classes to C.  By 1980, it was C with Classes. And then in 1983, the term C++ was first used, suggested by Rick Mascitti.  Read more in this fascinating article by Bjarne Stroustrup, which also discusses many other aspects of C++’s history.  We also recently posted a short history of C++’s various standards ourselves.

My own journey with C++ began much later than 1983.  In fact, I was born the same month and year as C++ was named, and at zero years old I was not yet a programmer.  I began coding on a BBC microcomputer, followed by Pascal on DOS, followed by Delphi from free cover CDs (our Community Edition is the modern equivalent), Java, C, and PHP.  I loved C and learned a lot from it - not least, it was in C I first wrote a parser and evaluator, something I think every programmer should do at least once.  But it wasn’t until university that I started using C++, where it was introduced in the standard “this is an output stream, you overload these operators, write a class like this, now you know C++” method that is unfortunately still often the way C++ is taught today.

This did not prepare me for real-world C++.

How should you learn C++?  Ignore C, it’s a different language.  Start with object-oriented basics, classes vs structs, allocation and then quickly move to templates using unique_ptr as your first, to understand both them and memory management.  Then, STL collections, discover function objects in the form of lambdas and move on to iterators and pair those two to understand std::algorithm. Buy a copy of the C++ Primer by Lippmann, Lajoie, and Moo.  It’s a big book, but don’t be intimidated, it’s clear and understandable.

I was studying a Computing and an Arts degree, both at the same time, with all the scheduling difficulties you can imagine - for some strange reason, the philosophy department did not care much about not overlapping lecture timetables with the computer science department. I hope it’s different today, but expect that it’s much the same: there’s often little value seen, even in a university, in multiple disciplines. After several years I wanted to leave Uni and begin working, so compressed the two degrees into a single Computing degree with a minor in Philosophy - oddly enough, something the Uni was fine with. And then I got a job with a marine science company, for a data analysis and visualisation program written in C++.

I was out of my depth. I sat down with a copy of Stroustrup’s The C++ Programming Language and read the entire thing in a week. Then I went to work.

That was the third edition. Today I have the fourth edition on my bookshelf.

Years passed. I learned far more on the job than I did at Uni. I grew to love C++, and like to think that I contributed in some ways to improving that codebase - when I began, they still had parts of it using non-STL, homebrew containers. And we used CVS for source control. I wasn’t the one driving the source control change, but I did replace the last custom containers with STL. I removed OWL and rewrote the UI and app/document structure, this time using C++Builder’s VCL.

But, I introduced some bad code too. When I visited the company a few months ago last time I was in Australia, to say hello to old colleagues, and we discussed a formatted text control used for the dialogs that makes the UI look great but is hard to work with. These days I’d use Markdown; back then, it used a BBCode-like syntax. (If you’re reading this, Aussie colleagues… just rewrite it.) You can mark the development of a programmer by how much code you think back on and realise you’d write differently -- the same can be said about non-programming life as well.

I’m still proud of my part in that software: today, it’s a core part of much marine research and is used by scientists worldwide. It’s written in C++.

More years passed. I moved from Australia to Europe, started a company, wrote more in Delphi after a long absence, wrote IDE plugins for RAD Studio including C++Builder, and eventually ended up as the C++ Product Manager here at Embarcadero. Even after several years, perhaps even more so after several years, I feel it’s an honour to be working among these colleagues, people with such extraordinary expertise and who are all, every one, genuine and kind people, and on such an amazing product, one which itself has so much history. Today, I focus on ensuring we support C++17 and am looking at potential language tooling, among many other things we have on our roadmap.  And one constant thread through the past fifteen years has been C++. I learned from it, traveled with it, and I wouldn’t be writing this without it.

I’ll leave you with two really cool things in C++:

C++: happy 35th birthday!

 

Ready to Start Your Own C++ Journey?


Read More

Introducing FireMonkey Stencils

$
0
0

Last week, we released the FMX Stencils pack. The FireMonkey Stencils pack was designed to enhance communication between designers and developers who are building multi-device applications using the FireMonkey framework in Delphi, C++Builder and RAD Studio.

 

One of the challenges for designers in an application development cycle is understanding the breadth of UI components and styles available in the FireMonkey framework. We addressed this by providing visual assets that match the UI controls and styles available within the FireMonkey framework. Designers can create wireframes and mockups in Balsamiq, Sketch, Photoshop, Illustrator or other similar tools using FMX Stencils. Once mockups are finalized, designers can share redlines of designs, style guides and assets with application developers for implementation using the matching FireMonkey UI controls and FireMonkey style in Delphi, C++Builder and RAD Studio. Designers can also upload mockups to InVision and similar tools to create prototypes that illustrate component interactions.

 

The FMX Stencils pack consists of the following:

● Balsamiq, Sketch, Illustrator, Photoshop, SVG and PNG FMX stencils for a

platform agnostic, generic user interface theme

● Balsamiq, Sketch, Illustrator, Photoshop, SVG and PNG FMX stencils for the iOS Copper Dark Theme, part of the FireMonkey Premium Style Bundle

 

 

Shown: iOS Copper design assets in Photoshop for UI prototyping

 

 

 

Shown: iOS Copper premium FireMonkey style at runtime. You can see the iOS Copper premium FMX style in action here


Read More

Secrets Of FireDac: Last Inserted Auto Generated Id And Enterprise Connectors

$
0
0

A common pattern when inserting data into a database table which has an auto increment field set on it is to use an SQL query to select the last inserted ID of the newly created record. Once you use your TFDQuery to run your INSERT query you can run this second query to get the newly inserted auto increment ID. Different databases have different SQL queries to accomplish this. MySQL for example has a SELECT query function that you can run called LAST_INSERT_ID() (example: SELECT LAST_INSERT_ID() ). You can run this select directly or use the built in FireDAC feature.

FireDAC offers a function which you can call from your TFDConnection component called GetLastAutoGenValue. It will return the last inserted ID with support for a number of different databases including Oracle, InterBase/Firebird, MySQL, MSSQL, and some others as well. It uses whatever unique SQL query for each different database to return the last inserted ID. The following is from the DocWiki.

The GetLastAutoGenValue method returns the last autogenerated value. The meaning and result depend on the DBMS, as described in the following table.

DBMS 

Description 

Oracle 

AName is the name of a sequence. The method returns CurrValue if it exists in the session. 

InterBase / Firebird 

AName is the name of a generator. The method returns GEN_ID(0). 

MS SQL Server, MySQL etc 

The last autogenerated value in the session. 

 

The Enterprise Connectors powered by CData don't seem to support the GetLastAutoGenValue function in the version I am running but they do have their own SQL query that can be run to accomplish the task. The SELECT query is called SCOPE_IDENTITY() (example: SELECT SCOPE_IDENTITY() ). I used the SCOPE_IDENTITY() function successfully with the CData Salesforce Enterprise Connector. SCOPE_IDENTITY() isn't mentioned much in the CData help files for FireDAC but they do show it in the SELECT syntax of the help file.

 

//
//
SELECT {
  [ TOP <numeric_literal> | DISTINCT ]
  {
    *
    | {
        <expression> [ [ AS ] <column_reference> ]
        | { <table_name> | <correlation_name> } .*
      } [ , ... ]
  }
  [ INTO csv:// [ filename= ] <file_path> [ ;delimiter=tab ] ]
  {
    FROM <table_reference> [ [ AS ] <identifier> ]
  } [ , ... ]
  [ [ 
      INNER | { { LEFT | RIGHT | FULL } [ OUTER ] }
    ] JOIN <table_reference> [ ON <search_condition> ] [ [ AS ] <identifier> ]
  ] [ ... ]
  [ WHERE <search_condition> ]
  [ GROUP BY <column_reference> [ , ... ]
  [ HAVING <search_condition> ]
  [ UNION [ ALL ] <select_statement> ]
  [
    ORDER BY
    <column_reference> [ ASC | DESC ] [ NULLS FIRST | NULLS LAST ]
  ]
  [
    LIMIT <expression>
    [
      { OFFSET | , }
      <expression>
    ]
  ]
} | SCOPE_IDENTITY() 

Find out more about the Embarcadero Enterprise Connectors which you can use to access all kinds of cloud APIs using standard SQL.


[YoutubeButton url='https://www.youtube.com/watch?v=t6_UxH_ivpQ']

Read More

8-Weeks Delphi Community Edition Bootcamp Starts Next Week

$
0
0

Delphi CE Bootcamp is an 8 week FREE instructional lecture covering many different areas of Delphi development and focused on new developers as well as existing ones. The series begins next week, and I'm the first instructor. Lectures will be posted each week on each weeks topic and lecture replays will be available if you're not able to attend during a week. We expect to have also some Q&A sessions.

The bootcamp is free but be sure to reserve your space early to make you get in, at:
https://www.embarcaderoacademy.com/p/the-delphi-ce-bootcamp-2018

To follow the classes, you can use the free Delphi Community Edition or any Delphi 10.2.X Pro, Enterprise, or Architect edition. This is the currently planned schedule, by some of the leading Delphi experts:

Week 1 - Delphi Language Introduction with Marco Cantu - Begins Sept 3rd

Week 2 - GUI Fundamentals (FMX and VCL) with Andrea Magni- Begins Sept 10th

Week 3 - Mobile / Multi-Platform Concepts with Ian Barker - Begins Sept 17th

Week 4 - DataBase/FireDAC with Cary Jensen - Begins Sept 24th

Week 5 - Debugging with Alan Fletcher - Begins Oct 1st

Week 6 - REST Services & APIs with Cesar Romero - Begins Oct 8th

Week 7 - Threading and Performance with Olaf Monien - Begins Oct 15th

Week 8 - Using 3rd Party Components with Ian Barker - Begins Oct 22nd

I really hope this will be a nice long bootcamp, with a ton of information, and I encourage you (beside participating, if you are interested) to invite any new developer, developers who know nothing about Delphi, anyone who hasn't used Delphi in a while to both download the community edition (if they can legally use it) and join the bootcamp. This is a great time and a great event for Delphi!


Read More

Happy 35 years to C++

$
0
0

Choosing a programming language to learn and utilize is an extremely personal choice and not one that developers take lightly. C++ has a long history as a popular language used to create Operating Systems, drivers, gaming engines and so much more. It expanded the C language by adding classes, inheritance and abstraction to its core, making it my favorite language to use.

C++ is the first language that I learned in school and my experience with it actually started with Borland’s, now Embarcadero’s, C++Builder. I was a kid with a computer who had so many questions about the interactions of technology and its influence on the world. I was given one of the “free” Borland academic licenses by my teacher and told that C++Builder would be the IDE that our class and projects would be using. This class was the beginning of many projects and classes that allowed me to delve deeper into the world of programming, where I found an appreciation for how problems are solved... and it also didn’t hurt that solutions to my Physics homework was so much easier to understand with a few lines of code.

Now, 12-13 years later, I still use C++Builder everyday, but instead of as a student, as a Software Consultant at Embarcadero. I’m able to develop applications in C++ quickly that look great and perform even better.

So thank you C++, a language that has withstood the test of 35 years, for allowing me to enjoy 13  years of coding.

Get started using C++Builder IDE with all of these features including VCL and FMX to get your next app looking and performing great with a FREE 30 Day Trial!


Read More

API Limits with #FDEC

$
0
0

API Limits with FireDAC Enterprise ConnectorsThe FireDAC Enterprise Connectors (#FDEC) by CData and Embarcadero make it really easy to work with various APIs just like you would any SQL database. For example if you want to publish the results of a query to a Google Sheet (which I find incredibly useful) then it is just a few FireDAC components and you are off to the races. You might run into an API limit though.

What is an API limit? Most rest services have a limit to how often a client can call a specific API within a certain amount of time. Google calls this their usage limit:

This version of the Google Sheets API has a limit of 500 requests per 100 seconds per project, and 100 requests per 100 seconds per user. Limits for reads and writes are tracked separately. There is no daily usage limit.

That may seem like a lot, but I found I was running into that limit pretty quick once I moved my project into production. Luckily FireDAC and the FireDAC Enterprise Connectors have a simple workaround: Batch Processing.

Using the Array DML features of FireDAC you can batch multiple DML (Data Manipulation Language) operations into a single API call. The FDEC Google Sheets documentation from CData doesn’t cover Array DML, but the component supports this (they are updating the documentation). The Elasticsearch documentation does cover Batch Processing with an example, and I’ve used this with Sheets and it works great!

Bulk Insert

The following example prepares a single batch that inserts records in bulk.

FDConnection1.ResourceOptions.ServerOutput := True; FDQuery1.SQL.Text := 'insert into Account values (:Name, :Id )'; FDQuery1.Params.ArraySize := 100; FDQuery1.Params[0].AsStrings[0]:= 'MyName1'; FDQuery1.Params[1].AsStrings[0]:= 'MyId1'; //next statement FDQuery1.Params[0].AsStrings[1]:= 'MyName2'; FDQuery1.Params[1].AsStrings[1]:= 'MyId2'; ... FDQuery1.Execute(FDQuery1.Params.ArraySize); ShowMessage(IntToStr(FDQuery1.RowsAffected));

To retrieve the Ids of the new records, query the LastResultInfo#TEMP table:

sName := FDQuery1.Open('SELECT * FROM [LastResultInfo#TEMP]');

Bulk Update

The following example prepares a single batch that inserts records in bulk.

FDQuery1.SQL.Text := 'update Account set Name = :Name WHERE Id = :Id'; FDQuery1.Params.ArraySize := 100; FDQuery1.Params[0].AsStrings[0]:= 'Floppy Disks'; FDQuery1.Params[1].AsStrings[0]:= 'Id1'; //next statement FDQuery1.Params[0].AsStrings[1]:= 'Jon Doe'; FDQuery1.Params[1].AsStrings[1]:= 'Id2'; ... FDQuery1.Execute(FDQuery.Params.ArraySize); ShowMessage(IntToStr(FDQuery1.RowsAffected));

Bulk Delete

The following example prepares a single batch that inserts records in bulk:

FDQuery1.SQL.Text := 'delete Account where Id = :Id'; FDQuery1.Params.ArraySize := 100; FDQuery1.Params[0].AsStrings[0]:= 'MyId1'; //next statement FDQuery1.Params[0].AsStrings[1]:= 'MyId2'; ... FDQuery1.Execute(FDQuery.Params.ArraySize); ShowMessage(IntToStr(FDQuery1.RowsAffected));

If you want to learn more about Array DML check out these videos:

Array DML Skill Sprint with Pawel Glowacki

FireDAC in Depth with Cary Jensen

Also check out Cary Jensen’s book on the topic of FireDAC in Depth.


Read More

Articles and News from the C++ community

$
0
0

To prepare for the appearance of C++17 support in the "Carnival" release of C++Builder (RAD Studio August 2018 Roadmap), here are some recent articles that have appeared in the C++ community. To stay up to date on what's happening with ISO C++ you should bookmark the ISO C++ foundation's website.

 

 

 I can't wait for the next generation LLVM based C++Builder to appear.

 


Read More

Secrets of FireDAC: Pagination With Grids And LiveBindings

$
0
0

If you want to display only a range of results from a recordset you can using paging (otherwise known as pagination) to do so. It is a common pattern when doing web development to give the user 20 results for example and then the ability to move to the next page. If you are implementing a REST API in RAD Server you might also implement this functionality instead of delivering 2 million rows for the query you only deliver the first 20 rows and the next 20 can be requested in the next call. Obviously this works with Delphi FireMonkey applications on Android, iOS, macOS, and Windows that use FireDAC.

You can do paging manually with SQL and usually each different server like MSSQL or MySQL has a different SQL command to do paging. A paging query for MySQL might look like this: SELECT * FROM TABLE_NAME LIMIT 0,25 Whereas in SQL Server it would be different and might use an SQL syntax containing TOP or OFFSET. However, FireDAC allows you to do paging within a result set without changing your SQL (it handles the SQL behind the scenes). This means you code is database server independent. The two properties on a TFDQuery that allow paging are FetchOptions.RecsSkip and FetchOptions.RecsMax. Check out the DocWiki which shows a simple example of paging.

You can combine paging with the TGrid or TStringGrid controls using LiveBindings. Once you LiveBind a TStringGrid to your TFDQuery control only the results from the current page will show up in the grid. Here is an example of the DFM/FMX code showing the TFDQuery LiveBinded to a Grid control.

//
//
  object BindSourceDB1: TBindSourceDB
    DataSet = FDQuery1
    ScopeMappings = <>
    Left = 304
    Top = 224
  end
  object BindingsList1: TBindingsList
    Methods = <>
    OutputConverters = <>
    Left = 20
    Top = 5
    object LinkGridToDataSourceBindSourceDB1: TLinkGridToDataSource
      Category = 'Quick Bindings'
      DataSource = BindSourceDB1
      GridControl = StringGrid1
      Columns = <>
    end
  end

Once you have LiveBindings set up between the TFDQuery and the TStringGrid you simply need to change the RecsSkip property and reload the SQL query to get the new result set. In the example code below the Active property of the LinkGridToDataSourceBindSourceDB1 component is set to False and then True again to refresh the data in the grid. In the example code RecsMax is set to 2 but you can change that to however many results you want per page (like 20, 25, 50, 100, etc).

//
//
procedure TForm1.BackBTNClick(Sender: TObject);
begin
FDQuery1.Close;
FDQuery1.FetchOptions.RecsSkip := FDQuery1.FetchOptions.RecsSkip-1;
FDQuery1.open;
LinkGridToDataSourceBindSourceDB1.Active := False;
LinkGridToDataSourceBindSourceDB1.Active := True;
end;

procedure TForm1.NextBTNClick(Sender: TObject);
begin
FDQuery1.Close;
FDQuery1.FetchOptions.RecsSkip := FDQuery1.FetchOptions.RecsSkip+1;
FDQuery1.open;
LinkGridToDataSourceBindSourceDB1.Active := False;
LinkGridToDataSourceBindSourceDB1.Active := True;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
FDQuery1.FetchOptions.RecsMax := 2;
FDQuery1.FetchOptions.RecsSkip := 0;
end;

And that is all there is to paging using FireDAC. You could pass in the RecsMax and RecsSkip properties on a REST API call in RAD Server and get similar results.

Find out more about using low code LiveBindings to build cross platform Delphi FireMonkey apps with this tutorial.


 
[YoutubeButton url='https://www.youtube.com/watch?v=Ainlia-XOsM']

Read More

Offline Capable Cross Platform Delphi 10.2 FireMonkey Client Code For Android, iOS, macOS, And Windows

$
0
0

The RAD Server Field Service Template provides an end to end field service application template for routing appointments, managing parts, and user administration. It is made up of a REST server module, a desktop client, and a cross platform mobile client. The template can give you a head start in building your own field service solutions. This blog post is about the offline capable mobile client app that comes with the template. You can download the Field Service Template for free from Embarcadero's GetIt.

The Field Service App client project which is built in RAD Studio Delphi using FireMonkey (FMX). The client is targeted for deployment to Android, iOS, macOS, and Windows. The offline capabilities are provided by storing the data in IBLite.

InterBase is a full-featured, high performance, zero administration, lightweight, embeddable relational database for software developers. RAD Server uses InterBase for storing it’s users and groups. InterBase also provides an IBLite Edition of InterBase which can be deployed with your apps. This IBLite edition is the version that is demonstrated in the Field Service Template App client. You can find out more about the different editions here:

http://docwiki.embarcadero.com/InterBase/2017/en/Comparing_IBLite,_ToGo,_and_InterBase_Server_Edition


[YoutubeButton url='https://www.youtube.com/watch?v=SnIMq-s3EHc']

The Field Service App client connects to RAD Server on the backend via a REST API. You should be able to log into the App client by selecting a Branch ID (Tenant ID) plus entering the login and password for a user in the Technicians Group. For this template the default users are technician1 and technician2.

Be sure to configure the EMS_SERVER and EMS_PORT const in uMainForm.pas to point at your development server. The default is localhost 8080.

The Branch ID is stored with each data table so each branch will only see its own set of appointments, parts, and users. Each branch has its own users and groups as well. The Branch system is built on top of the Tenant functionality in RAD Server.

Appointments

Appointments are records that can be viewed in the Field Service App client. When you are logged in as a Technician you will only see appointments assigned to you, marked as pending, and with a date of today. Appointments have various fields like Appointment date and time, customer title, description, address information, phone number, location, photo, status, and notes. You can view a static map of the address of the appointment plus you can press a Locate button to bring up an interactive map of the address. You can also click on the phone number on a mobile device and it will launch the call functionality of the device. Technicians can enter notes about an appointment and mark it as complete. The notes and status change are sent to the server.

History

The Service History list is a view into the Appointments and only shows Appointments that have been their status set to Complete for this technician for today. Newly completed records show up in the History tab even if they have not yet been synced with the server yet.

Parts

Parts are records that can be viewed in the Field Service App client. Parts have various fields like title, description, location, quantity, and photo. Parts are not editable in the Field Service App but the data does get updated when synced from the server.

Profile

The profile section shows the current Technician that is logged into the Field Service App and their various information. You can also choose to disable the local notifications here. Profile information also shows up in the TMultiView menu.

Notify

The notify section shows new appointments that have been downloaded from the server that have not yet been viewed by the current technician. Choosing a notification here will take you to the appointment for that notification. Local notifications are also implemented and when new appointments are received local notifications will be sent to the device. The notification functionality is built so that you can implement your own remote notifications using the same system if needed.

Data Sync

The Data Sync tab in the Field Service App client is where JSON data is downloaded from the Field Service Server REST endpoint and loaded up into the local IBLite database. Data for the Appointments, Parts, and Technician is all downloaded on this tab. You can also request to Refresh the data at any time to get new updates from the server. Additionally, there is a background TTimer which will upload and sync the completed data from the Field Service App automatically on an interval. A cloud icon will appear in the upper left of the Field Service App when there is data to be synced in the queue.

Architecture

The architecture of the app is built in a low code rapid application development style using TTabControls for handling pages and individual frames for each page. TActionList is used to consolidate much of the code in the MainForm. There are two TTabControls on the MainForm. The first one contains the Login frame and the second TTabControl. The second TTabControl contains the rest of the frames. Within the ApptsFrame and the HistoryFrame there are additional Master/Detail TTabControls.

If you want to make changes to the design time frames be sure to edit the frame itself and not the version of it that is embedded in the MainForm. This will keep your changes consolidated in one place. If your changes don't update in the MainForm you can delete the Frame from the MainForm and re-add it. Be sure to add it to the correct Tab and set to Align Client after you add the frame.

The frames are built to be as modular as possible with TBindSourceDB components used as endpoints for the LiveBindings. This allows you to easily re-use the frames in your own projects by connecting the TBindSourceDBs to your own datasets.

  • uDataModule in 'uDataModule.pas' {MainDM: TDataModule},
    Contains the RAD Server (EMS) Provider client components, the in memory table components, the IBLite tables, and the various FireDAC connecting components.

  • uMainForm in 'uMainForm.pas' {MainForm},
    Contains the main form of the application with the various TTabControls and inline embedded TFrames. Additionally, it includes the TNotificationCenter.

  • uLoginFrame in 'uLoginFrame.pas' {LoginFrame: TFrame},
    Contains the UI and code for the Login screen.

  • uApptsFrame in 'uApptsFrame.pas' {ApptsFrame: TFrame},
    Contains the UI and code for the Appointments screen.

  • uHistoryFrame in 'uHistoryFrame.pas' {HistoryFrame: TFrame},
    Contains the UI and code for the Service History screen.

  • uPartsFrame in 'uPartsFrame.pas' {PartsFrame: TFrame},
    Contains the UI and code for the Parts screen.

  • uProfileFrame in 'uProfileFrame.pas' {ProfileFrame: TFrame},
    Contains the UI and code for the Profile screen.

  • uNotifyFrame in 'uNotifyFrame.pas' {NotifyFrame: TFrame},
    Contains the UI and code for the Notification screen.

  • uProgressFrame in 'uProgressFrame.pas' {ProgressFrame: TFrame},
    Contains the activity progress TFrame which is displayed when the app is busy.

  • uTenantsDM in 'uTenantsDM.pas' {TenantsDM: TDataModule},
    Contains the RAD Server (EMS) Provider connector components for accessing the Branch (Tenants) list.

  • uTenantListForm in 'uTenantListForm.pas' {TenantForm},
    Contains the UI and code for selecting a Branch/Tenant.

  • uQueueFrame in 'uQueueFrame.pas' {QueueFrame: TFrame},
    Contains the UI and code for syncing data from the server.

  • uWebBrowserForm in 'uWebBrowserForm.pas' {WebBrowserForm};
    Contains the UI and code for viewing real time map data in a TWebBrowser.

Offline Caching

The Field Service App is able to work offline once you have logged into your account at least once. The next time you log into the app it will use your previous RAD Server Session ID for any new connections it tries to make to the server. The data from the server is cached as JSON files and stored in the IBLite database. The Appointments are saved as appts.json, the Parts as parts.json, the Techs as technicians.json, and the Tenants as tenants.json. If no connection to the server is available the data will be loaded from those files instead. Additionally, if there is no internet connection it will save the appointments and notes that you have marked completed in the History table of the IBLite database. When the next time an internet connection is detected it will upload those changes.

The Field Service App has a local History table where is stores the local changed state of the Appointments. Even if you re-sync the data from the server and your changes have not been uploaded yet it will apply your existing local changes to this new data until which time it is able to upload the changes to the server.

If you log out of the existing account the local database is deleted until you log in again. If you log out before uploading your changes then you changes would be lost.

Notifications

The local notification functionality built into the Field Service App relies on the cross platform  TNotificationCenter component that is built into RAD Studio. There is a local IBLite Notify table in the Field Server App where it stores the current state of notifications (whether the user has viewed them already and whether they have been sent to the user’s platform).

When a new Appointment is downloaded from the server during a data sync a new record is added to the IBLite Notify table. A notification is sent to the platform through the TNotificationCenter when this happens. The user can view the notification by clicking on the record on the Notify tab. Once a notification is viewed it will no longer be displayed on the Notify tab.

Each platform handles notifications differently. You should be able to hook up remote notifications as well through this existing local notification system.

Customize The UI

You can quickly and easily customize most of the look and feel of the app with three easy changes. In TMainForm there is a BackgroundRect, a BackgroundImageRect, and a EmeraldDarkStyleBook control. You can change the background color of the app by changing the BackgroundRect.Fill.Gradient property. You can change the image that is overlayed over the entire app by changing the BackgroundImageRect.Fill.Bitmap.Bitmap property. The background image works by being above all of the other controls, having a low Opacity, having a HitTest of False and a Locked property of True. Finally, you can change most of the rest of the theme by loading different Premium Styles into the EmeraldDarkStyleBook control.

You can customize the header logo of the Login screen on the LoginFrame. There are a few other places where the custom green color is used on some elements in the TListView controls and some the search icons using a TFillRGBEffect.

The Profile screen for the technician has a background image in the ProfileFrame called HeaderBackgroundRect plus a BackgroundRect control. The Profile is also displayed in the TMultiView control on the MainForm with another control named HeaderBackgroundRect as well. Change the Fill.Bitmap.Bitmap property on both controls.

You will need to update the BackgroundRect and BackgroundImageRect in the WebBrowserForm and the TenantForm as well. Remember that you will need to load one style for each of the four deployment platforms. You can access the Premium Styles here:

https://www.embarcadero.com/products/rad-studio/fireui/premium-styles

 

https://cc.embarcadero.com/item/30491

Head over and check out the full deep dive into the Field Service Template for Delphi 10.2 Tokyo!


Read More

Build Flexible and Robust Apps with a Multi-Tier Architecture

$
0
0

A Multi-Tier architecture separates the UI/Presentation, the application and business logic layer, the data access layers, and the database itself in separate applications, potentially running on different computers. In this blog post we’ll examine some of the key traits of this architecture and discuss key reasons for adopting this model.

Multi-tier architectures are fairly common these days and they are becoming even more relevant in today’s mobile world, given the traditional client/server model doesn’t adapt much to lean and remote devices. Multi-tier applications are better suited to accommodate a multi-device world, in which users need to access information from apps running on different devices and different types of connectivity. Multi-tier architectures are certainly not new, but interest in this model keeps growing due to increased use of mobile devices and extended availability of cloud computing. 

From One to Three Tiers

In the early days of computing, developers built applications that were running on a single computer. As technology progressed, most non trivial applications migrated towards a client/server architecture. In many cases the server was a database server (or Relational Database Management System: RDBMS), in others it was a server implementing a standard Internet protocol (HTTP, NNTP, SMTP, FTP, …), and occasionally a custom server with a proprietary implementation.

In this blog post,  I will focus on data access so let’s consider the client/server scenario. It can be used in two “extreme” modes… with a continuum in between:

  • Fat Server Scenario. Have a fat server, with the business logic and data processing implemented in SQL, using views, stored procedures, triggers, and all of the wealth of features a database server provides -- and a fairly thin client with only UI rendering of the data and data entry.
  • Fat Client Scenario. Have a light server, with tables and little more, and have all of the business logic in the so-called fat client, which generally helps improving the quality of the UI and user experience, given data entry can be driven by the data and logic available at the client.

Why does it matter for this analysis on multi-tier? Because it is exactly that business logic layer that you might want to keep on the server, while you implement it with client technologies (like Delphi, or other programming languages).

In a typical 3 tier scenario, you have the database server with limited customization, an application server that accesses the database, processes the data, and provides data to the client, which is just a thin UI layer. These three logical tiers can be three physical tiers (ie, running on separate hardware) or they can be virtual.

Beyond the 3-Tier Model: Modern Multi-Tier

Over time multi-tier and web services have been implemented with different technologies and communication layers. As an example, RAD Studio’s DataSnap started by using DCOM and TCP/IP, and later migrated to HTTP and REST. Among the various options, the combination of SOAP and XML was the most popular for a few years.

Modern multi-tier architectures, also known as web service architecture or service-oriented architecture (SOA), favors REST/JSON over the older SOAP/XML approach.  We also see a trend in app development that moves from single large monolithic services to smaller focused services federated together (generally called micro-services).

Finally, a modern web service architecture tends to follow the HTTP protocol core tenet of being stateless. Each operation is complete in itself and each new operation doesn’t depend on a previous one. This way the services can be distributed flexibly on the physical servers, in multiple redundant copies, for failover and scalability.

Advantages of Modern Multi-Tier

There are so many different ways to define a multi-tier architecture, so I’ll focus on a fairly specific scenario, which is taking a “fat client” client/server application and migrating it towards a REST-based web service.

1. Server-Side Business Logic Provides Easier Updates

It is easier to update an application that has the database access and significant part of the business logic on the server, without having to update the client software that is installed on dozens, hundreds or thousands of client devices. For example, if you want to move to a per-customer discount and need to add extra fields in the database, modify SQL queries, and update a price list that depends on the customer, you can probably do this change without updating the client software used for placing orders. You might have to update only the software used for managing the customers and their discounts. Consider that even popular mobile games these days update the game logic from a central location and are heavily based on web services, with user status and progress saved in a central location, but at times even offering a way to play live and in real time with other players.

2. Faster, More Secure Data Access

Originally, one of the reasons for multi-tier was also to reduce the number of the users licences in the RDBMS, but licensing rules have since changed -- so this is rarely relevant these days. Direct database access also causes more dependency on having a proper and updated database client driver (which is not trivial on mobile) and as mentioned above requires a way to update queries in the client application dynamically (or updating the entire client software) as rules and data structures change.

Both for security reasons and performance, unless all of your client applications are on a VPN, granting remote access to the database is generally a security concern. This increases exponentially with clients on mobile devices, using public WiFis or other fairly unsafe scenarios. But even more, direct database access over the Internet is generally slow as the database access protocol are not optimized for low latency and potentially slow and unstable connections. A stateless HTTP access is much more reliable for an Internet and a mobile connection. 

3. Better Scalability and Easier Cloud Migration

As your application grows and adds users, you could approach the problem of scalability with mirrored databases and more powerful network infrastructure. This approach requires advanced planning and can become expensive quickly - both in terms of database server licenses and more expensive network services. 

Multi-tier architecture offers a less expensive approach through an intermediate tier of web services that absorb some of the network traffic burden. Having additional servers to handle HTTP requests (and any peak in network traffic) is much easier to manage, particularly when deployed to a cloud infrastructure. In other words, migrating a web service architecture to the cloud is generally easier and less expensive, compared to migrating an architecture relying on databases as the primary backend. Even if a database will still be there, if it is not the interface to the clients, this ends up adding flexibility to the system -- despite some additional complexity.

4. Separate the Data Access Layer

From the RAD Studio perspective, the migration of a Delphi or C++Builder client/server application to a multi tier model requires taking your data access layer (possibly hosted in data modules) and moving it to the web service side. The same data access layer you are using in client/server (we prefer FireDAC in our apps) can be used in the middle tier. Now depending on how clean is the separation of your data access code to the UI code (your data modules-to-forms coupling) this migration can be simple or require a significant rewrite.

This is an area we could discuss at length, but a general suggestion is to make sure you reconsider and rethink your architecture. What makes sense on a client (for example, caching a lot of data for future use) might not make sense on the web service, specifically if this is a stateless web service discarding any intermediate data after each individual request is completed. Some developers still prefer a fat middle tier (with an ORM or similar rich object models) but this is not always ideal for a web service, because of its stateless approach (you want to limit the data associated to a user or short-lived session) and the need to access  the data model concurrently by multiple threads processing multiple requests by different clients.

So why is this data access layer separation an advantage of multi-tier? Rethinking your application architecture will be an effort, but you can reach the goal of having a more modern, flexible, scalable, and performant architecture, compared to what you started from.

In general terms, avoiding the rich database server model reduces your dependency on the server vendor, so you could potentially switch your database back-end. You can achieve this with either a fat client or a web service. The fat client tends to move a lot of data to the user’s machine, while the web service application can run the DB locally and have a huge bandwidth available to access database data.

5. Many Clients, One Service… and Multiple Client Models

A very significant advantage of going towards a multi-tier model these days is the ability to use a single backend service for many different types of client applications. If you have a Windows client/server application today, you can start migrating the Windows applications to the multi-tier model, keeping most of the UI unchanged. Once this is done, you can create mobile or web applications based on the same web service and the same application logic the service already provides.

The mobile clients might be different from the Windows application, and generally “thinner” (less powerful, focused on specific features) but ultimately part of the same application architecture.

6. Caching Data Locally

Adopting this architecture doesn’t mean the data lives only remotely. For example, it often makes sense to build UI rich clients that handle data entry or local data processing for your customers. Also, on mobile platforms you might not always have a good quality connection and you might want to save some of the bandwidth cost to your end users.  

In all of these cases, a multi-tier architecture can be augmented by caching some of the database data locally on the client.

This might be done by using simple persistent data structures (like a FireDAC MemTable or a ClientDataSet in RAD Studio) or by embedding a full database on the user device (like the embedded version of InterBase, IBLite -- which is free to use for RAD Studio developers).

7. Ability to Build MicroServices and Use Additional Data Conduits

Another advantage of this architecture is the ability to build many web services that work together, rather than a single monolithic piece of software. Individual web services can access different back-end databases, if needed. They can also provide a unified way to access to additional cloud services (for storage, collaboration, and more), without the need for the client to authenticate with all of these services directly. The main advantages are a significant additional security and a way to change some of these services (like moving to a different provider) behind the scenes with no impact on the client application.

One interesting aspect of RAD Server is a single server can load multiple independent runtime packages providing custom APIs. If you have multiple servers, you can combine these APIs freely. But you can also make them all available in a single RAD Server instance if you prefer -- while the development can be focused on one module at a time, in isolation.

8. Migrate Versus Rebuild

Some companies think if they want to go to web service architecture they have to start from scratch. We believe that if you have an existing investment in RAD Studio source code, you can leverage it by migrating the existing code to a new architecture. You can also do it in phases, as this is not an all-or-nothing proposition. A phased migration to multi-tier is an significant advantage of this model. For example, you could take a limited subsystem, create a web service for it, build a mobile application using it, and retrofit an existing Windows application to use the web service as well -- even if the bulk of the application architecture remains based on client/server.

9. A Better Architecture for Mobile

While you might not be keen on abandoning the fat client/server model for desktop applications, consider that mobile applications have unique challenges:

Mobile Challenge Multi-Tier Solution
Limited Connectivity  Data processing on server, optimized communication from web service to client. Possibly also local caching.
Limited CPU power Use the more powerful server-side for CPU-intensive cycles. 
Intensive CPU data processing negatively affects device battery  Use the more powerful servers for processing cycles, reducing battery drain. 
Higher Risk of Device Loss and Theft  Ability to disable an account on the server and block the application, and get users back up running quickly with replacement devices.
Difficulty Installing and Updating database drivers No installation required on the user device (mobile but also desktop).

In Summary, It’s Worth the Effort 

Creating multi-tier applications increases the complexity and adds migration work, but is worth the effort. The ability to open your architecture might be critical, if you want your application to remain relevant in the future and avoid falling behind your competition.

By adopting a multi-tier architecture, as I’ve discussed, you gain easier updates, faster and more secure data access, better server scalability, a cleaner data access layer, easier migration to mobile platform, and better integration with other available services.

Want to Learn More? 

It’s easy to add multi-tier logic to your Delphi and C++ applications with RAD Server. Explore our RAD Server videos for examples using REST, web clients, and more. The docwiki provides a technical RAD Server reference. For a high level overview of RAD Server, along with deployment license information, visit https://www.embarcadero.com/products/rad-server

Note: RAD Server deployment licenses are now included in Enterprise and Architect editions of RAD Studio, Delphi and C++Builder, so if you’ve got those editions you can get started immediately, as the development tools are also already in the product. 

 

 


Read More
Viewing all 1683 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>