Validation in Xamarin.Forms Enterprise Apps 

animation We released an eBook this past May on Enterprise Application Patterns using Xamarin.Forms. The eBook focuses on core patterns and architectural guidance for developing Xamarin.Forms enterprise apps that are easier to test, maintain, and evolve. Guidance is provided on how to implement the Model-View-ViewModel (MVVM) pattern, dependency injection, navigation, validation, and configuration management, while maintaining loose coupling. In addition, there’s also guidance on performing authentication and authorization with IdentityServer, accessing remote data from containerized microservices, and unit testing.

This blog post explores validation in Xamarin.Forms enterprise apps. There are, of course, many approaches that can be taken to validation. What’s presented here is the validation approach taken in the eShopOnContainers mobile app, which is extensible, easily unit testable, and supports data binding and property change notification.

Introduction

Any app that accepts input from users should ensure that the input is valid. An app could, for example, check for input that contains only characters in a particular range, is of a certain length, or matches a particular format. Without validation, a user can supply data that causes the app to fail. Validation enforces business rules, and prevents an attacker from injecting malicious data.

In the context of the Model-ViewModel-Model (MVVM) pattern, a view model or model will often be required to perform data validation and signal any validation errors to the view so that the user can correct them. The eShopOnContainers mobile app performs synchronous client-side validation of view model properties and notifies the user of any validation errors by highlighting the control that contains the invalid data, and by displaying error messages that inform the user of why the data is invalid. The following diagram shows the classes involved in performing validation in the eShopOnContainers mobile app:

View model properties that require validation are of type ValidatableObject<T>, and each ValidatableObject<T> instance has validation rules added to its Validations property. Validation is invoked from the view model by calling the Validate method of the ValidatableObject<T> instance, which retrieves the validation rules and executes them against the ValidatableObject<T> Value property. Any validation errors are placed into the Errorsproperty of the ValidatableObject<T> instance, and the IsValid property of the ValidatableObject<T> instance is updated to indicate whether validation succeeded or failed.

Property change notification is provided by the ExtendedBindableObject class, and so an Entrycontrol can bind to the IsValid property of the ValidatableObject<T> instance in the view model class to be notified of whether or not the entered data is valid.

Specifying Validation Rules

Validation rules are specified by creating a class that derives from the IValidationRule<T>interface, which is shown in the following code example:

 

public interface IValidationRule<T>
{
    string ValidationMessage { get; set; }
    bool Check(T value);
}

 

This interface specifies that a validation rule class must provide a boolean Check method that is used to perform the required validation, and a ValidationMessage property whose value is the validation error message that will be displayed if validation fails.

The following code example shows the IsNotNullOrEmptyRule<T> validation rule, which is used to perform validation of the username and password entered by the user on the LoginView when the eShopOnContainers mobile app is configured to use mock services:

 

public class IsNotNullOrEmptyRule<T> : IValidationRule<T>
{
    public string ValidationMessage { get; set; }
    public bool Check(T value)
    {
        if (value == null)
        {
            return false;
        }
        var str = value as string;
        return !string.IsNullOrWhiteSpace(str);
    }
}

 

The Check method returns a boolean indicating whether the value argument is null, empty, or consists only of whitespace characters.

Adding Validation Rules to a Property

In the eShopOnContainers mobile app, view model properties that require validation are declared to be of type ValidatableObject<T>, where T is the type of the data to be validated. The following code example shows an example of one such property:

 

public ValidatableObject<string> UserName
{
    get
    {
        return _userName;
    }
    set
    {
        _userName = value;
        RaisePropertyChanged(() => UserName);
    }
}

 

For validation to occur, validation rules must be added to the Validations collection of the ValidatableObject<T> instance, as demonstrated in the following code example:

 

private void AddValidations()
{
    _userName.Validations.Add(new IsNotNullOrEmptyRule<string> 
    { 
        ValidationMessage = "A username is required." 
    });
}

 

This method adds the IsNotNullOrEmptyRule<T> validation rule to the Validations collection of the ValidatableObject<T> instance, including a value for the ValidationMessage property, which specifies the validation error message that will be displayed if validation fails.

Triggering Validation

Validation can be triggered manually for a view model property. For example, this occurs in the eShopOnContainers mobile app when the user taps the Login button on the LoginView, when using mock services. The command delegate calls the MockSignInAsync method in the LoginViewModel, which invokes validation by executing the Validate method, which in turn invokes the ValidateUserName method:

 

private bool ValidateUserName()
{
    return _userName.Validate();
}

 

The ValidateUserName method performs validation of the username entered by the user on the LoginView, by invoking the Validate method on the ValidatableObject<T> instance. The following code example shows the Validate method from the ValidatableObject<T> class:

 

public bool Validate()
{
    Errors.Clear();
    IEnumerable<string> errors = _validations
        .Where(v => !v.Check(Value))
        .Select(v => v.ValidationMessage);
    Errors = errors.ToList();
    IsValid = !Errors.Any();
    return this.IsValid;
}

 

This method clears the Errors collection, and then retrieves any validation rules that were added to the object’s Validations collection. The Check method for each retrieved validation rule is executed, and the ValidationMessage property value for any validation rule that fails to validate the data is added to the Errors collection of the ValidatableObject<T> instance. Finally, the IsValid property is set, and its value is returned to the calling method, indicating whether validation succeeded or failed.

Validation is also automatically triggered whenever a bound property changes. For more information, see Triggering Validation when Properties Change.

Displaying Validation Errors

The eShopOnContainers mobile app notifies the user of any validation errors by highlighting the control that contains the invalid data with a red line, and by displaying an error message that informs the user why the data is invalid below the control containing the invalid data. The following screenshot shows part of the LoginView in the eShopOnContainers mobile app when a validation error is present:

Highlighting a Control that Contains Invalid Data

The LineColorBehavior attached behavior is used to highlight Entry controls where validation errors have occurred. The following code example shows how the LineColorBehavior attached behavior is attached to an Entry control:

 

<Entry Text="{Binding UserName.Value, Mode=TwoWay}">
    <Entry.Style>
        <OnPlatform x:TypeArguments="Style"
          iOS="{StaticResource EntryStyle}"
          Android="{StaticResource EntryStyle}"
          WinPhone="{StaticResource UwpEntryStyle}"/>
    </Entry.Style>
    ...
</Entry>

 

The Entry control consumes an explicit style, which is shown in the following code example:

 

<Style x:Key="EntryStyle"
       TargetType="{x:Type Entry}">
    ...
    <Setter Property="behaviors:LineColorBehavior.ApplyLineColor"
            Value="True" />
    <Setter Property="behaviors:LineColorBehavior.LineColor"
            Value="{StaticResource BlackColor}" />
    ...
</Style>

 

This style sets the ApplyLineColor and LineColor attached properties of the LineColorBehaviorattached behavior on the Entry control. When the value of the ApplyLineColor attached property is set, or changes, the LineColorBehavior attached behavior executes the OnApplyLineColorChanged method, which adds or removes the EntryLineColorEffect class to the Entry‘s Effects collection. For more information about the EntryLineColorEffect class, see Highlighting a Control that Contains Invalid Data.

The Entry control also has a DataTrigger added to its Triggers collection. The following code example shows the DataTrigger:

 

<Entry Text="{Binding UserName.Value, Mode=TwoWay}">
    ...
    <Entry.Triggers>
        <DataTrigger 
            TargetType="Entry"
            Binding="{Binding UserName.IsValid}"
            Value="False">
            <Setter Property="behaviors:LineColorBehavior.LineColor" 
                    Value="{StaticResource ErrorColor}" />
        </DataTrigger>
    </Entry.Triggers>
</Entry>

 

This DataTrigger monitors the UserName.IsValid property, and if it’s value becomes false, it executes the Setter, which changes the LineColor attached property of the LineColorBehaviorattached behavior to red.

Displaying Error Messages

The UI displays validation error messages in Label controls below each control whose data failed validation. The following code example shows the Label that displays a validation error message if the user has not entered a valid username:

 

<Label Text="{Binding UserName.Errors, Converter={StaticResource FirstValidationErrorConverter}"
       Style="{StaticResource ValidationErrorLabelStyle}" />

 

Each Label binds to the Errors property of the view model object that’s being validated. The Errors property is provided by the ValidatableObject<T> class, and is of type List<string>. Because the Errors property can contain multiple validation errors, the FirstValidationErrorConverter instance is used to retrieve the first error from the collection for display.

Summary

Enterprise Application Patterns using Xamarin.Forms focuses on core patterns and architectural guidance for developing Xamarin.Forms enterprise apps that are easier to test, maintain, and evolve. The eBook also ships with a sample application, the eShopOnContainers mobile app, which performs synchronous client-side validation of view model properties and notifies the user of any validation errors by highlighting the control that contains the invalid data, and by displaying error messages that inform the user why the data is invalid.

The post Validation in Xamarin.Forms Enterprise Apps appeared first on Xamarin Blog.

Posted by Andrew Tierney Friday, August 18, 2017 10:41:00 PM Categories: C# Xamarin

Adding Storage to Mobile Apps with OneDrive for Business 

Every app needs storage, whether it’s for storing a collection of the same type of records in Azure Mobile Service with Easy Tables, or a SQL Database exposed via Web Services. When the data is unstructured, NoSQL with Azure DocumentDB can be used. For scalability and high availability, Azure CosmosDb can be used in both the cases. In enterprise situations, however, where different types of documents need to be stored and shared with colleagues, the best solution is OneDrive for Business. OneDrive for Business is part of Office 365 and provides easy access across multiple Office 365 services. We learned previously how to integrate OneDrive for Business in mobile apps developed using Xamarin.

Since then, there have been changes to APIs and SDKs that have made this integration simpler. We’ll take a look at those changes in this blog post. You can find the repo for this post on GitHub.

Step 1: App Registration

To integrate OneDrive for Business with mobile apps, the app needs to be registered with the Azure Active Directory service. This will authenticate and authorize users while providing access to the resources. The process is the same as registering any other app with Azure Active Directory.

Visit https://apps.dev.microsoft.com/ and click on Add an app to get started. Name your app and continue, making sure you note the Application Id. Click on Add Platorm and select Native Application.

Ensure you define Delegated Permissions for the application to be able to access files stored on OneDrive for Business:

  • Files.Read
  • Files.Read.All
  • Files.Read.Selected
  • Files.ReadWrite
  • Files.ReadWrite.All
  • User.Read

Step 2: Calling APIs

Once the app is registered, create a Blank Xamarin.Forms application with the PCL code sharing strategy. Make sure that the profile selected for PCL is set to Profile7 by right-clicking the PCL project and selecting Properties > Build > General. Add two NuGet packages: Microsoft.Identity.Client and Microsoft.Graph.

Use the Microsoft Authentication Library (MSAL) to authenticate the user in the code-behind in App.xaml.cs.

 

using Microsoft.Identity.Client;
...
public static PublicClientApplication IdentityClientApp = null;
public static string ClientID = "4f91166f-c946-438f-8d07-33792251026d";
public static string[] Scopes = { "User.Read", "User.ReadBasic.All", "Files.Read", "Files.Read.All", "Files.ReadWrite", "Files.ReadWrite.All" };
public static UIParent UiParent = null;
public App()
{
   InitializeComponent();
   MainPage = new XamarinDrive.MainPage();
   IdentityClientApp = new PublicClientApplication(ClientID);
   MainPage = new NavigationPage(new MainPage());
}

 

After the authentication process is complete, create a GraphServiceClient object which will be responsible for further requests in the code-behind for MainPage.xaml.cs.

 

using Microsoft.Graph;
using Microsoft.Identity.Client;
...
private async Task CreateGraphClientAsync()
{
   try {
      Client = new GraphServiceClient("https://graph.microsoft.com/v1.0",
               new DelegateAuthenticationProvider(
               async (requestMessage) =&gt; {
                         var tokenRequest = await App.IdentityClientApp.AcquireTokenAsync(App.Scopes, App.UiParent).ConfigureAwait(false);
                         requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", tokenRequest.AccessToken);
                }));
                Me = await Client.Me.Request().GetAsync();
                Username.Text = $"Welcome {((User)Me).DisplayName}";
                return true;
       }
       catch (MsalException ex){
            await DisplayAlert("Error", ex.Message, "OK", "Cancel");
            return false;
       }
}

 

Using this GraphServiceClient and Graph Model, traverse through the Drive and get a list of items (files and folders) within the drive. Assign this list of items to the listview control in ListPage.xaml.cs.

 

using Microsoft.Graph;
...
var client = new GraphServiceClient("https://graph.microsoft.com/v1.0",
                new DelegateAuthenticationProvider(
                async (requestMessage) =&gt;
                {
                   var tokenRequest = await App.IdentityClientApp.AcquireTokenSilentAsync(App.Scopes, App.IdentityClientApp.Users.FirstOrDefault());
                   requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", tokenRequest.AccessToken);
                }));
var data = await client.Me.Drive.Root.Children.Request().GetAsync();
var list = data.ToList();
FileList.ItemsSource = list;

 

This list of DriveItems will then be displayed on ListPage using the binding with ListView. When a user clicks on an item inside List, the file will be opened as requested. This can be achieved with the OnItemTapped event.

 

var item = ((DriveItem) e.Item);
   if (item.Folder != null)
      await DisplayAlert("Type", "Selected Item is a Folder!", "Ok");
   else
      Xamarin.Forms.Device.OpenUri(new Uri(item.WebUrl));

 

Just like any Xamarin.Forms app is required to implement platform-specific functionality differently, follow the guide for each individual platform to implement authentication from here.

Step 3: Running the App

Run the app on a device or simulator and log in with your Office 365 credentials. The app will ask for appropriate permissions. Once those permissions are granted, the app will display the list of files.

Wrapping Up

OneDrive for Business, which is part of Office 365, allows users to store, share, and collaborate with different types of documents. Using Microsoft Graph Client Libraries and Microsoft Authentication Library, it’s easy to integrate various Office 365 services such as OneDrive. As usual, you can find the sample used in this blog post on GitHub.

The post Adding Storage to Mobile Apps with OneDrive for Business appeared first on Xamarin Blog.

Posted by Andrew Tierney Friday, August 18, 2017 10:39:00 PM Categories: C# Xamarin

Workaround for FMX Memory Leaks on Windows in 10.2.1 

POSTED BY  ON IN TUTORIAL

Many of our customers today write FireMonkey Windows applications. We recently got some customer reports on FMX memory leaks on Windows using RAD Studio 10.2 Release 1 (or Tokyo Release 1). The issue is reported at https://quality.embarcadero.com/browse/RSP-18774 and https://stackoverflow.com/questions/45588741/delphi-recompiling-application-with-10-2-1-causes-memory-leaks.

If you encounter such issues after installing 10.2.1, we recommend trying the workaround below. We will address this issue in the future.

To our knowledge, the memory leak doesn't happen during program execution, but on termination because a cleanup thread does not excute in time. Delphi MVP Stefan Glienke suggested a relatively simple workaround both on the Quality Portal bug report and in the StackOverflow page linked above. By calling CheckSynchronize (from System.Classes) you can have the application wait for the cleanup threads to execute. This does a quick sync, but does not cause any noticeable delay. 

There are different places where you can put this code, but the simplest one for me is a finalization block in the main form source code (no need to update the library units). This is an example of the code added to the end of the main form unit, along with activating memory leak reporting:

 

Another very good suggestion is to change the project file (the .dpr file), but your mileage might vary -- you can also consider fixing the library as this will fix all of your applications at once.

Posted by Andrew Tierney Thursday, August 17, 2017 9:45:00 PM Categories: embarcadero

Windows App Modernization with RAD Studio Tokyo 

POSTED BY  ON IN TUTORIAL

With RAD Studio 10.2 Tokyo, you can easily update your existing application and give it a modern Windows 10 look and feel. In today's post, I thought I would highlight our Windows 10 support to help you move your existing applications forward.

Windows 10 VCL GUI Controls

These controls were specifically designed for Windows 10 and address common UI paradigms on Windows 10. While they were designed for Windows 10, the controls will also work with older versions of Windows, such as Windows 7 and Windows 8.

 

 

Support for Native WinRT APIs

In RAD Studio, we provide support for native WinRT APIs, allowing you to leverage specific Windows 10 features. This includes ready-to-use components for notifications and contracts.

 

Windows 10 Store Support

Windows Desktop Bridge Deployment Support allows you to package new and existing desktop applications ready for the Windows 10 Store directly from your IDE using Microsoft's Desktop Bridge. Target hundreds of millions of Windows 10 devices with your existing VCL or FMX code base.

 

UI Theming

We provide a number of ready to use Windows 10 styles that you can apply to your Windows applications. For FireMonkey, custom styles are applied via a StyleBook. For VCL, a custom style can be applied via Project > Options > Application > Appearance.

 

Shown: OnxyBlue VCL style

 

Shown: Windows 10 Green VCL style, included in 10.2 Tokyo

 

Shown: Black Rock VCL Style from DelphiStyles.com

 

 Shown: Regal Blue VCL Style from DelphiStyles.com

 

 

Shown: FireMonkey Windows 10 Dark style, included with RAD Studio 10.2

Posted by Andrew Tierney Thursday, August 17, 2017 9:41:00 PM Categories: embarcadero

Syncfusion Essential Studio 2017 Vol 3 

Syncfusion

RELEASE HIGHLIGHTS

Xamarin.Forms

Build Cross-Platform Apps

  • New picker control
  • New radial menu control
  • Text selection and copy support in PDF Viewer

Learn More »

Xamarin.Android

Develop Amazing Android Applications with C#

  • New picker control
  • New data form control
  • Table summaries for data grid

Learn More »

Xamarin.iOS

Create World-Class iOS Apps with C#

  • New picker control
  • New data form control
  • Table summaries for data grid

Learn More »

ASP.NET Core

Publish Superior Web Applications

  • New radial menu
  • Stacking spline area and 100% stacking spline area charts
  • Ruler support for diagram

Learn More »

ASP.NET MVC

Build Powerful Web Apps

  • Stacking spline area and 100% stacking spline area charts
  • Ruler support for diagram
  • Work week support for Gantt control

Learn More »

ASP.NET Web Forms

Master Web Development

  • New date range picker
  • Stacking spline area and 100% stacking spline area chart types
  • Ruler support for diagram

Learn More »

UWP

Develop Across the Windows Ecosystem

  • New picker control
  • Axis scale break for charts
  • Style customization support for Gantt control

Learn More »

JavaScript

Get the Most out of JavaScript

  • Stacking spline area and 100% stacking spline area charts
  • Ruler support for diagram
  • Work week support for Gantt control

Learn More »

Windows Forms

Create Better Apps

  • Content control support for DocIO
  • Customization support for message boxes
  • Tagged PDF support

Learn More »

WPF

Take Control of the Desktop

  • Themes support for tree grids
  • Axis scale break for charts
  • Report Viewer parameter rending based on parameter layout

Learn More »

Dashboard Platform

Build Better Dashboards

  • Multi-dashboard organization
  • Filter widget sliding panel
  • Data notifications
  • Personalized home pages

Learn More »

Report Platform

Create, Manage, and Share Reports

  • SSO login support using Azure ADFS
  • Microsoft Azure support for Report Server
  • Parameter layout support

Learn More »

Big Data Platform

Master Large Data Sets

  • Mobius integration
  • Faster access to YARN memory changes
  • Editable PostgreSQL credentials

Learn More »

Data Integration Platform

Do More with Data

  • User-friendly UI
  • Publishing template
  • Brand new processors

Learn More »

Posted by Andrew Tierney Friday, August 11, 2017 10:06:00 PM Categories: C# Syncfusion

FREE controls for uniGUI 

Well..

I've decided to release 3x uniGUI controls as a gift to the Delphi / uniGUI community..

 

Attached is a simple wrapper for the SweetAlert2 library.  (QUICK HACK.. No unit testing, no tidy up etc..)

** No warranty - Use at your own risk **

FREE for commercial use, etc.. (just don't remove the copyright header).

 

1) Compile the Package/Install

2) Make sure your path includes the control folder

3) Copy the files/sweetalert folder into your project

4) Drag/Drop the uniSweetAlert control onto your form.

 

Simple usage like:

 

procedure TMainForm.UniButton1Click(Sender: TObject);

begin

 

   UniSweetAlert1.ShowMessage;

 

// or like

 

   UniSweetAlert1.Error('Oops','Something went wrong');

 

// or like

 

   UniSweetAlert1.Error('Oops','Error again','FixMe',3000);

 

// or like

 

   UniSweetAlert1.Question('Is this true','Please click one of the options below:','YES','NO',3000);

 

// or like

 

   UniSweetAlert1.title := 'Hello';

   UniSweetAlert1.text  := 'Testing';

   UniSweetAlert1.alertType := TAlertType.success;

   UniSweetAlert1.ShowMessage;

end;

 

// Events for Confirm or Cancel/Dismiss

 

procedure TMainForm.UniSweetAlert1Dismiss(Sender: TObject);

begin

   UniButton1.Caption := 'DIS';

   uniMemo1.Lines.Add('Dis');

end;

 

procedure TMainForm.UniSweetAlert1Success(Sender: TObject);

begin

   UniButton1.Caption := 'CLICKED';

   uniMemo1.Lines.Add('Clicked');

end;

 

Either (1) set properties and call .ShowMessage;

 

Or call the Error, Info, etc methods.

The second control is a wrapper for jQuery Toast:

https://github.com/k...ry-toast-plugin

(uniJToast currently has properties, a simple ShowMessage and events for Before/After Show/Hide.)
 

The third and final control is a wrapper for iTyped:

https://github.com/l...icius167/ityped

Simply add the uniTyped control (resize to your size).

var s: TStrings;

begin

  s := TStringList.Create;

  s.Add('Welcome to the jungle');

  s.Add('Restarting soo...');

  UniTyped1.text := s;

  UniTyped1.PlayTyped;

  s.Free;

end;

or 

Just set the properties in the control and do a UniTyped.PlayTyped.

Source code and Example for all controls is available below:

https://goo.gl/bnU2Ab

 

 

  

 

Posted by Andrew Tierney Wednesday, August 9, 2017 10:15:00 PM Categories: CastleSoft embarcadero

"Expert Delphi" book published! 

My "Expert Delphi" book published!

 "Expert Delphi" book has been published by PACKT Publishing and is currently available for a limited time for just  $10 at https://www.packtpub.com/application-development/expert-delphi. The book is about how to become developer super  hero and gain amazing productivity powers to develop stunning, native cross-platform mobile apps from the same codebase  for Android and iOS! The foreword was written by David Intersimone and I'm very proud about it, because I have the deepest  respect to David I!

 I have always wanted to write a Delphi book and never thought it takes so much work. More then 500 pages about Delphi  technology. This book is designed for Delphi developers that want to learn about latest Delphi technologies including cross-  platform mobile development from the same source code for Android and iOS. The main focus of "Expert Delphi" is mobile  development with Delphi.

 

What "Expert Delphi" book covers

 Chapter 1Fasten Your Seat Belts, where we learn how to install Delphi and prepare it for mobile cross-platform  development. We build a “Hello World” FireMonkey app and natively compile it from the same source code to Android and iOS.

 Chapter 2Mind Your Language, where we review basic constructs of Object Pascal programming language used in Delphi.  After covering fundamentals we quickly move on to the discussion of more advanced language concepts used in FireMonkey  programming, including class helpers, generics, anonymous code and Runtime Type Information.

Chapter 3Packing Up Your Toolbox, where we cover some of the most useful, every day programmer skills like writing multithreaded code with Parallel Programming Library and working with JSON and XML.

Chapter 4, Playing with FireMonkey, where we learn basics of building cross-platform, mobile Graphical User Interfaces with FireMonkey. We learn how to use shapes, effects and animation components. We cover working with touch, multi-touch and gestures. At the end of this chapter we write the complete mobile “Game of Memory” game.

Chapter 5FireMonkey in 3D, where we learn how to build stunning, interactive 3D graphical user interfaces, including working with wireframes, 3D controls and importing 3D models into your Delphi apps.

Chapter 6Building User Interfaces with Style, where we learn about FireMonkey styling. We look into using built-in styles, custom styles with “TStyleBook” component and customizing styles with embedded Style Editor. We also cover working with frames and using inherited views for specific mobile form factors.

Chapter 7Working with Mobile Operating System, where we are accessing mobile hardware and operating systems with high-level components abstracting away underlying mobile APIs. We look into working with sensors, camera, address book, embedding web browsers, using maps, creating and consuming Android services and working with language bridges for accessing APIs and frameworks not surfaced through FireMonkey library.

Chapter 8Extending to the Internet of Things where we learn how to build cross-platform mobile apps that communicate with IoT sensors and devices using Bluetooth LE communication protocol. We look into working with “TBluetoothLE” components, but also using specialized IoT components available via GetIt Package Manager. We also cover building proximity enabled apps that work with beacons, using “TBeacon” components and BeaconFence. The App Tethering framework is discussed as well for easy communication between mobile apps.

Chapter 9Embedding Databases, we build “To-Do List” mobile app that illustrates best practices for architecting data-driven solutions with clear separation between user interface and data access layers. We use FireDAC database access framework for communicating with embedded SQLite mobile database and build user interface with “TListView” component with dynamic appearance.

Chapter 10Integrating with Web Services, where we look at different Delphi frameworks and components for integrating with web services. We start from low-level native HTTP client library, consuming XML SOAP Web services, and moving on to REST and BaaS client components. In the last part we are looking into Cloud API for integrating with Amazon and Azure clouds. We also replace the “To-Do List” app data access tier with logic to store JSON data in the Amazon Simple Storage Service (S3). 

Chapter 11Building Mobile Backends, where we look at building scalable, multi-tier systems with Delphi. We learn how to build mobile backends with different Delphi frameworks including WebBroker, DataSnap and RAD Server. During the course of this chapter we will split the “To-Do List” app into separate client and server parts. 

Chapter 12App Deployment, where we look into practical steps of deploying Delphi mobile apps to Google PlayStore and Apple iOS App Store. We also look into best agile practices for continuous enhancement of your apps with using version control, refactorings and unit testing.

The Road Ahead, where we review what we have learnt in this book and look into emerging technologies including serverless backends, trends in mobile app development and new IoT communication protocols. We also discuss best places for getting more information and inspiration for your next, great, cross-platform Delphi app.

Hopefully Delphi developers will enjoy reading this book as much as I did writing it:-)

Posted by Andrew Tierney Wednesday, August 9, 2017 10:02:00 PM Categories: embarcadero

Some Data from the 2017 RAD Studio Developers Survey 

Post by Marco Cantu

As most of you know, the Embarcadero PM team has been running fairly extensive yearly surveys regularly. We had the last yearly survey in April 2017. In the past, the company decision has been not to share data coming from the survey, as some of it is fairly sensitive in terms of business analysis and planning. But given that not all of the information fits into this category, this year Embarcadero has decided to share some of the results of the main yearly developer's survey -- that saw several thousand people taking the time and effort to go over almost 100 questions. We plan on sharing some more information in the future, in blog posts focused on specific product features.

RAD Studio Versions Owned

One interesting question we ask our customer is to indicate not only which is the last version they own or are using, but also list all of the versions they owned. This is not historical data, as it depends on developers who took this year survey. A lot of the current customers have been using the product for a long time, but not all versions have been equally successful:

General Information Channels

Another question we want to share the answer for is which online outlets developers go to get information and learn about the product. Notice this was a question allowing multiple answers. This is the list in order of preference (from most popular to least popular), of the group of sites that got over a thousand votes:

1. Stack Overflow

2. Embarcadero Website

3. Embarcadero Community (community.embarcadero.com)

4. Embarcadero Webinars

5. Old forum (forums.embarcadero.com)

6. MVP and Other User's Blogs

7. Quality Portal (quality.embarcadero.com)

These are additional sites and information channels that received less than a thousand votes, again listed from most to least popular

8. User groups and local community forums

9. Country specific developers forums

10. Google+ Delphi Community

11. Live "in person" events

12. Facebook

13. Twitter

Appears our customers are not really social media fanatics, with the limited exception of the Google+ community.

Most Relevant Development Scenarios

These are the key focus areas our customers, in terms of product use. This is another question allowing multiple answers, and the 4 most popular were:

1. Windows VCL Desktop clients

2. FMX/mobile clients

3. FMX/desktop clients

4. JSON/REST Web Services

Building Windows VCL applications clearly remains an important focus for the largest majority of our customers, with over 90% of the survey respondents indicating VCL is relevant to their work.

Developers Revenues Tied to the use of RAD Studio

There is clearly a very varied group of developers using Delphi, C++Builder and RAD Studio, and one way to highlight it is to look at the revenues from using our products developers declared in the survey (and we hope they were honest!). From a 25% of customers not making any money or making less than 1,000 dollars a year, to a few claiming businesses over 100 million dollars!

 

Other Programming Languages Used

Besides Delphi and C++ languages, most of the developers using RAD Studio use other development tools and programming languages alongside. Among the other popular languages, this year JavaScript surpassed C#. This is the list from most to least popular:

1. JavaScript

2. C#

3. PHP

4. C

5. Java

6. Python

7. VB

8. VB.NET

9. Objective-C

Of course, most of these languages are used with other IDE and editors, the two most popular being:

1. Visual Studio

2. Notepad++

Target Desktop and Mobile OSes

Among the operating systems RAD Studio developers build software for, we have two separate questions, focused on desktop and mobile operating systems, with Windows and Android clearly leading the two groups. The versions break out is fairly interesting, with Windows XP still significantly high (even if decreasing a lot since the last survey).

On the mobile front, data is more or less as expected, with iOS receiving much more focus than its installed user base numbers and the "Other" category significantly dropping from past surveys.

Version Control

Which version control are RAD Studio developers using? I found it worrisome that the second most used VCS is "none" -- at about 30% of the total! Come on, even for a single developer on simple projects, not using a version control system is hard to justify these days:

1. Subversion

2. No Version Control System

3. Git

4. Microsoft's TFS

5. Other

Cloud Services

Another question we asked was about cloud services developers use. This is the list in order from the most popular of the top picks, although there is a mix of real cloud services and file system services:

1. Amazon Web Services (growing from previous year)

2. DropBox

3. Windows Azure (growing from previous year)

4. Google Drive

5. Google Docs

Commonly used Database Engines

Another very interesting question is about the most popular databases among the developers using RAD Studio. No big surprise and very stable over time (with the exception of a huge growth of MariaDB -- a database we already started supporting natively in FireDAC). This is our top ten for relational databases, again starting with the most popular:

1. Microsoft SQL Server

2. MySQL

3. SQLite

4. Firebird

5. Oracle

6. PostgreSQL

7. Access

8. InterBase

9. MariaDB

10. IBLite / IBToGo

The top pick for NoSQL engines remains MongoDB, but the second one, Redis, is a new entry -- all other trailing with only a handful of votes.

Conclusion

Our yearly developers survey provides us with a lot of useful data we use for our planning and product directions. While we cannot share all of it, there is data relevant for the community at large we started covering in this blog posts and we are more than happy to discuss in public. I'll also cover Delphi language requests and other product areas in future blog posts. Stay tuned.

Posted by Andrew Tierney Wednesday, August 9, 2017 9:59:00 PM Categories: embarcadero

Delphi Tokyo Release 1 or 10.2.1 is Now Available 

You can read more about the release and its rationale in the PM article published in the community:

https://community.embarcadero.com/article/16556-rad-studio-10-2-1-released-today

For the actual release information docWiki page, including how to obtain the release, what's new, known issues, visit:

http://docwiki.embarcadero.com/RADStudio/Tokyo/en/10.2_Tokyo_-_Release_1

For a more detailed of issues fixed in this release, see the EDN article at:

http://edn.embarcadero.com/article/44763

We had to put a significant effort into some of the issues, like those caused by Creators Update and changes in iOS, so very happy to make this new version of Delphi and C++ Builder available to our customers. 

Posted by Andrew Tierney Wednesday, August 9, 2017 9:55:00 PM Categories: embarcadero

Smart Mobile Studio - Updates 

Below is a post by "Smart Mobile Studio"  - Looking forward to the next release...

We are working very hard on the Smart RTL update, full time and almost round the clock. We have done some amazing refactoring and optimalization that gives Smart applications even more power. And we are going over the system with a fine tooth comb.

On the demo side we will be shipping probably the biggest demo any software development product has done to date - namely the Smart Desktop (also known as Amibian.js). The desktop even includes a working emulator so you can run legacy Amiga software in your browser.

The demo is intended to show many different techniques and how you can use Smart to leverage standard web technologies. For example, if you drop a zip archive on the desktop it will mount the archive as a drive. We are positive that our users will appreciate our solutions for what have traditionally been native only code.

More exciting is how you can easily run your Smart applications as the only program running on a pc. So when Linux boots up it simply boots straight into your web application without anything else (a full-screen web view). This opens up for some very interesting solutions, at a fraction of the cost compared to native development.

So there are exciting days ahead! Stay tuned!



 

Posted by Andrew Tierney Wednesday, August 9, 2017 9:42:00 PM Categories: embarcadero smart mobile studio