Subscribe: marcocantu.blog
http://blog.marcocantu.com/blog_rss2.xmldata
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
blog  controls  delphi  embarcadero  end  jira  json  new  rad server  rad studio  rad  studio  support  time  tokyo  vcl 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: marcocantu.blog

marcocantu.blog



Techie Italian Blogging on Delphi and More



Updated: 2018-01-18T00:09:37.663Z

 



HTTP Protocol Related Improvements in Delphi 10.2.2

2018-01-18T00:09:37.663Z

In Delphi and C++Builder Tokyo 10.2.2 we have added a number of features so the HTTP client and REST client libraries. Here is a summary.

The new features for the HTTP client library offer more flexibility and options in terms of protocol and standards support. 

Better Secure Protocols Support

The first change is the improved support for security protocols. In the past it wasn't possible to specify the required security protocols (TLS1.1, TLS1.2, etc.) for an HTTP request. We have added a new enumeration, THTTPSecureProtocol with the values (SSL2, SSL3, TLS1, TLS11, TLS12). THPPTClient and related classes have now a SecureProtocols property which is a set based on that enumeration.

The property (available only at run-time) controls which security protocols to use and it is currently implemented only for Windows. This was requested in our Quality Portal at https://quality.embarcadero.com/browse/RSP-18713

HTTP Redirect Improvements

Another set of improvements is in the way the HTTP client library handles redirects. There is a new RedirectsWithGET runtime property offering another set of options, this time based on the following enumeration:

THTTPRedirectWithGET = (Post301, Post302, Post303, Post307, Post308, Put301, Put302, Put303, Put307, Put308, Delete301, Delete302, Delete303, Delete307, Delete308);

The property controls which request method and response status must be redirected using GET method and it was reported in several entries in QP, including https://quality.embarcadero.com/browse/RSP-14671.

New REST Client Events OnNeedClientCert and OnAuthEvent

These events corresponds to their HTTPClient counterparts and are now surfaces at a higher level:

TRESTClient.OnNeedClientCertificate: TNeedClientCertificateEvent
TRESTClient.OnAuthEvent: TCredentialAuthEvent

This was requested in https://quality.embarcadero.com/browse/RSP-15857

MIME Name Helper

We added a function that to the TEncoding support, which returns the encoding MIME for a speficied encoding:

function GetEncodingMimeName(AEncoding: TEncoding): string;

Changed TIniFile Behaviour

This one is totally unrelated, beside the fact it was also done in 10.2.2. The Ini File behavior was platform specific, not is it platform independent. On Windows, TIniFile ReadString ignores the case of Key parameter. On Linux, the ReadString call was case sensitive, leading to issues when migrating code and configuration files. Now by default TIniFile content structure (not the actual values) is treated in a case-insensitive way on all supported platforms.

(image)



My Year in Cities 2017

2017-12-31T16:45:55.956Z

Following a long tradition of this blog, dating back to 2006 (and continued in each of the following years), here is my year 2017 seen through the cities I've been to.

This is my end-of-the-year blog post listing places I've visited in 2017 for at least one night (plus some relevant daily trips, marked with an asterisk), in chronological order. At times, the reason for the trip is listed: 

Torino (Italy)*

Trento (Italy)*

Sydney (Australia)

Brisbane (Australia), ADUG conference

Melbourne (Australia), ADUG conference

Altdorf (Switzerland)

Sprendlingen (Germany)

Nieuwegein (Netherlands)

Amsterdam (Netherlands)

Texel Island (Netherlands)

Nieuw Vennep (Netherlands)

Rotterdam (Netherlands)

Bruxelles (Belgium)

Vincey (France)

Colmar (France)

Berlin (Germany)

Zegrze (Poland), Delphi conference

Pisa (Italy)*

Frascati (Italy), ITDevCon conference

Koln (Germany), EKON conference

Viareggio (Italy)

Lucca (Italy)*, Lucca Comics event

Katowice (Poland)*

Ravenna (Italy)*

While I've been traveling a bit, my trips this year have been limited to Europe, plus a long trip to Australia. Planning a trip to the US within a few weeks, and spend some time booking flights today. Good sign.  

Have a great 2018 full of health and happiness (and traveling!).

(image)



Moving DNS, Some Hiccups Expected

2017-12-18T17:48:44.316Z

Site and blog might have hiccups in the coming days over DNS transition.

Not much to add. I'm (finally) changing my registrar and DNS provider. Hope everything goes smootly, but it might be that the site and blog are not working in the few coming days. The physical server is not moving, so there should be no big trouble.

(image)



DataSet Mapping to JSON for JavaScript client support in RAD Studio 10.2.2

2017-12-15T10:45:40.815Z

In the latest release of Delphi and C++Builder, Embarcadero has added a new component to the FireDAC BatchMove architecture, to support generating JSON data from database tables, in an easy and flexible way. RAD Studio has offered support for JSON in different ways and for a long time. From the JSON system unit (originally part of the DBX space) to the old DataSnap table mapping (also via DBX) and to FireDAC tables to JSON mapping, there are many ways to interact with JSON data structures. However, until the most recent release, we lacked a way to map a dataset to a custom JSON structure -- the FireDAC JSON support produces a FireDAC specific structure, with meta data and record status information. While this is a gap we already wanted to fill, it become more important to address it now that we are pushing RAD Server (a free deployment license is included with 10.2.2 Enterprise and above) and use it as a backend for ExtJS applications. As you can read in my blog post Implementing AJAX and JSONP Support in RAD Server for ExtJS, while this works the dataset mapping to JSON required writing custom code. Our first step in simplifying the use of Delphi as a backend for JavaScript applications is offering a better way to produce the JSON data from a database table. While we have build this support for the scenario of using RAD Server, FireDAC, and ExtJS, the same component and technology can be used for any web service architecture written in Delphi and C++Builder (even pure and simple WebBroker), any dataset other than FireDAC, and any JavaScript client. It is a completely open and a fairly flexible solution. But it certainly works great for our specific scenario! A VCL Application I'll describe the solution using two demos. The first is a plain VCL application. while the second will be a RAD Server package. This highlights the fact that the solution is fairly general. In the first demo, I have the following components on a form (I know, I should have used a data module...): This is the configuration of the components: object EmployeeConnection: TFDConnection Params.Strings = ( 'ConnectionDef=EMPLOYEE') end object EmployeeTable: TFDQuery Connection = EmployeeConnection SQL.Strings = ( 'SELECT * FROM EMPLOYEE') end object FDBatchMoveDataSetReader1: TFDBatchMoveDataSetReader DataSet = EmployeeTable end object FDBatchMoveJSONWriter1: TFDBatchMoveJSONWriter DataDef.Fields = end object FDBatchMove1: TFDBatchMove Reader = FDBatchMoveDataSetReader1 Writer = FDBatchMoveJSONWriter1 Mappings = LogFileName = 'Data.log' end With this configuration in place, all you need to do to produce the JSON is connect the output to the JSON writer and execute the batch move operation. In this case I've used a stream: procedure TForm5.Button1Click(Sender: TObject); var sstr: TStringStream; begin sstr := TStringStream.Create; try EmployeeTable.Active := True; FDBatchMoveJSONWriter1.Stream := sstr; FDBatchMove1.Execute; ShowMessage (sstr.DataString); finally sstr.Free; end; end; Other options are assigning to the writer for the output a JSONWriter (as I'll show shortly) or a JSONArray. A RAD Server Web Service For the second demo, the RAD Server demo, I've used the same set of components with the same configuration. In this cases I've added to an EMS package an "employee" resource, and implemented its get operation with the following stream-based code: procedure TEmployeeResource1.Get(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse); var mStream: TMemoryStream; begin mStream := TMemoryStream.Create; AResponse.Body.SetStream(mStream,'application/json', True); FDBatchMoveJSONWriter1.Stream := mStream; FDBatchMove1.Execute; end; As a better and simpler alternative, I could have used the JSONWriter pro[...]



New VCL Panels in Delphi 10.2.2

2017-12-14T21:47:58.632Z

Along with the picker controls I described yesterday, the VCL in Delphi 10.2.2 has two additional panel controls: TCardPanel and TStackPanel.

With the need to support more screen resolutions, while creating nice looking user interfaces and pleasant user experiences, we think it is important to offer additional ways to build the UI of your VCL applications. This is why in 10.2.2 we introduced two new VCL panel controls. These are control containers with specific way to manage the layout and position of their child controls. You can see the controls at design time below:

(image)

TCardPanel

The CardPanel control is a set of pages, like the old PageControl, with no tabs. You display one page at a time, and it has built in support for swiping pages using a gesture. It is a collection of panels of the same size, each hosting its own controls.

At design time, you can use the local menu to add a card or select one, as shown here (image courtesy of RAD Studio DocWiki):

(image)

Each page is a "TCard" object, which is just a regular panel in disguise, so no special properties of configuration. More information at http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Using_the_Card_Panel_Component

TStackPanel

The stack panel is a panel with a special layout. All controls added to it are placed in a different "row" (or column if you set it horizontally). The controls can be aligned to the left, the right, the center or use the entire space (fill). You set the default alignment at the stack panel level, and you can override it for each individual control (or use the special default value to pick the parent control setting). Each of the controls hosted by the panel, gets three additional properties "injected" by the container -- at the bottom of the Object Inspector list -- as you can see below:

(image)

More information at http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Using_the_Stack_Panel_Component

The VCL remains a central pillar of Delphi (and C++Builder), and Embarcadero is and will continue to enhance it matching the evolution of the Windows platform and user experience, while on the other hand ensuring a very high degree of compatibility with the existing VCL code.

(image)



Debugging Delphi Apps on Android 8.1 Works

2017-12-14T11:52:01.559Z

With Android 8.1 Google has fixed an issue preventing debugging of applications on device

When Google introduced Android 8 this summer, they increased the platform security but happened to block socket access to the debugger, basically preventing debugging applications on a device. You'd see the error message "Can't open socket: Permission denied." as reported also at https://quality.embarcadero.com/browse/RSP-18992. The issue was not a change in out debugger support, but a problem at the operating system level. You can read some of the discussion here: https://github.com/android-ndk/ndk/issues/447

Now the good news is Google fixed the issue (as indicated in the thread above). We tested it on previews and it seemed fine. Now Google has shipped Android Oreo 8.1, I got it for my Nexus 5X device this morning, installed it, and I can now debug a Delphi application as usual. I captured an image of the program stopped at a breakpoint below. 

(image)

Now this is not related to 10.2.2 in any way, as the change was only on the Android side, not the RAD Studio side. What we have fixed at our end is the display of the device name as target, but that wasn't a really big issue anyway.

(image)



New VCL Date and Time Picker Controls in Delphi 10.2.2

2017-12-13T16:34:16.364Z

There are 4 new VCL controls in Delphi and C++ Builder 10.2.2. In this blog post I'll focus on the two new date and time pickers. We at Embarcadero continue to consider the VCL as the best library for Windows-specific GUI development and are continuing the effort of improving and modernizing it, particularly improving the overall support for Windows 10. One of the directions of this effort (along side with styling, WinRT API, Desktop Bridge and more) is the addition of new VCL controls with the look of feel of the latest Windows platform controls, part of the WinRT UI layer. We have already delivered similar controls in 10 Seattle and 10.1 Berlin, and now adding 2 more in this release. The goal od this control is to offer a more modern UI for VCL applications, adopting the Windows 10 UI style and elements without forcing you to rewrite the entire application (as someone in Redmond suggests) and allowing you to build programs that will still work fine and look great on Windows 7 -- a version of Windows still largely used today. This is the reason why this family of controls is a set of pure VCL controls, that mimic the WinRT controls with no WinRT dependency. You can see the current list in the image below. Of these 4 controls are new in 10.2.2 Tokyo, the two pickers I'm covering in this blog post and two additional container panels I'll cover in a separate post. As the name implies, the Date Picker and Time Picker components offers a simple, intuitive, and modern way to select a date or a time. These components are highly configurable, and can be adapted to any locale and format -- as these are quite different depending on where people live.  TDatePicker The date selection component both displays a date in a given format and offers the user a simple way to select a date value from a dropdown. Rather than displaying a calendar, the user can change the day, month, and year values separately, similarly to what happens in most mobile platforms and applications. The user can change the selection with the keyboard arrow keys, clicking with the mouse on the upper or lower elements of a list or on the top and bottom arrows, or using the mouse wheel. The key property of the component is the DateFormat property. This allows you to establish the format in which you want to display the date, changing the sequence in which the control displays the elements (month/day/year vs. day/month/year, vs year/month/day, etc.). This affects both the initial display and the actual selection. Below you can see a couple of different configurations, one at design time above and one at runtime. You can also see in the drop down a list of sample configurations, including month names or numbers, one or two digit days, and so on. The image is from the DateTimePickers sample that ships with RAD Studio 10.2.2 in the VCL section of the demos. More information about the component is available in the RAD Studio DocWiki at http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Using_the_Date_Picker_Control. TTimePicker The time selection component is very similar to the date selection. Again it has multiple sections for the hour, the minute, possibly the seconds, and possibly the AM/PM selector. In this case the fundamental property is the TimeFormat property. Again, it determines both the display and the pickers behavior. You can include seconds or exclude hours and add AMPM to the time format to use a 12 hours format and to include an AM / PM selector to the dropdown. Again, here is an example with a couple of different settings (at design time and runtime) with an image taken from the same demo mentioned above. Additional documentation is at http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Using_the_Time_Picker_Control. That's all for now. Stay tuned for info on the other two new V[...]



Delphi 10.2.2 Has Been Released

2017-12-12T20:56:53.697Z

Today Embarcadero has released the second update to Delphi 10.2 Tokyo, C++ Builder 10.2 Tokyo and RAD Studio 10.2 Tokyo

As you can see at https://community.embarcadero.com/blogs/entry/rad-studio-10-2-2-released-today, the new version 10.2.2 of Delphi, C++Builder, and RAD Studio is now available. 

The new features are covered in the docWiki, at http://docwiki.embarcadero.com/RADStudio/Tokyo/en/10.2_Tokyo_-_Release_2

There are hundreds of bugs fixed (including over 150 bugs reported by customers in Quality Portal), as you can read in List of new features and customer reported issues fixed in RAD Studio 10.2 Tokyo Release 2 (we'll close the matching QP report in the coming days).

In the coming days I and the other PM will write a few blog posts on specific features added to the product. Also, there is a webinar on Thursday you can sign up for (at 3 times in the day). It will be an introduction to 10.2.2. Follow one of the 3 links at: https://community.embarcadero.com/index.php/all-events?language=en-GB&sort=embevent.

(image)



Delphi Blogs of the Month #57

2017-12-12T09:51:42.885Z

I've been a busy, more than usual, but here is a summary of external blogs and I'm going to be fairly active in the coming days here. As usual, this is a collection of links to relevant blog post and other newws you might heve missed over the recent perios of time, and that relate with Delphi one way or another. Embarcadero News There is a new Sencha MVP program, similar to the RAD Studio one: https://www.sencha.com/blog/sencha-mvp-program/ Healthcare App Prototype Built In Delphi Wins First Place In Startup Weekend Competition! Read more at https://community.embarcadero.com/blogs/entry/healthcare-app-prototype-built-in-delphi-wins-first-place-in-startup-weekend-competition Blog Posts Top 10 Most Popular Open Source Delphi Projects On GitHub By Star Rating by Eli at https://community.embarcadero.com/blogs/entry/top-10-most-popular-open-source-delphi-projects-on-github-by-star-rating RAD Studio Custom Editor Sub-views by David Hoyle at http://www.davidghoyle.co.uk/WordPress/?p=1831 (this is an extremely detailed example of writing editor views, which is a fairly complex extension to the RAD Studio IDE) Persisting enumeration and sets to JSON by Chee Wee Chua at http://chuacw.ath.cx/blogs/chuacw/archive/2017/12/11/persisting-enumeration-and-sets-to-json.aspx (a small and handy tip) Microsoft has a very interesting blog post by Matteo Pagani covering the Desktop Bridge, a technology we support in Delphi, and while not everything is directly applicable, it is a very interesting read: https://blogs.msdn.microsoft.com/appconsult/2017/11/06/desktop-bridge-best-practices-and-common-issues/ Supporting iPhone X display with Delphi by Dave Nottage at http://delphiworlds.com/2017/11/supporting-iphone-x-display-with-delphi/ (some related improvements will be made available in RAD Studio 10.2.2) Delphi + Enterprise Connectors + RAD Server = SAP native client for iOS and Android by Fernando Rizzato at https://community.embarcadero.com/blogs/entry/delphi-enterprise-connectors-rad-server-sap-native-client-for-ios-and-android (given the Enterprise Connectors cannot be used directly on mobile, you need a middle tier architecture to leverage them on your phone -- which also opens us to using push notifications) Experimenting with Neural Networks – Part 6 by Craig Chapman at http://chapmanworld.com/2017/11/19/experimenting-with-neural-networks-part-6/ (read the previous 5 parts as well, of course) Massive Collection Of Design Patterns, Frameworks, Components, And Language Features For Delphi at https://community.embarcadero.com/blogs/entry/massive-collection-of-design-patterns-frameworks-components-and-language-features-for-delphi Older but Great Posts I missed this, but worth highlighting: A Delphi Primer with RAD Studio 10.2 by T Theobald at http://borkedcode.com/wp/?p=1470 (a nice, long, and detailed "first look" to Delphi) Roll your own lightweight, scalable backend using ZeroMQ at https://blog.grijjy.com/2017/05/02/roll-your-own-lightweight-scalable-backend-using-zeromq/ Projects and Libraries Pyscripter is a feature-rich but lightweight Python IDE (written in Delphi): https://github.com/pyscripter/pyscripter. There is also a related Python Delphi integration package at https://github.com/pyscripter/python4delphi and this classic page http://www.atug.com/andypatterns/pythonDelphiTalk.htm ​     [...]



Cross JIRA Analysis with FireDAC CDATA JIRA Connector

2017-11-24T16:06:05.362Z

In Embarcadero, for the RAD Studio project, we have two JIRA systems, that would occasionally fall out of sync. So I used Delphi and the FireDAC CDATA Connector for JIRA to make some automated analysis. Here is some information about the project, including configuration and actual code. In Embarcadero, for the RAD Studio project, we have two JIRA systems. One is a public system better known as Quality Portal (https://quality.embarcadero.com), while the second is an internal JIRA system accessible only behind the firewall. The two systems are kept in sync, as I explained in the past, so that a bug opened in the public system is reflected in the internal one; as we close a bug in the internal system and ship the fix, the internal status is reflected in the public system. Almost always. In fact, there are reasons (timing, specific configurations, unexpected workflows, timeouts during synch operations, scripts that get stuck...) that prevent the regular flow to happen, leaving bugs in an inconsistent state. Specifically, we often have bugs closed internally that remain open (indefinitely) in the public system. I've spent time in the past looking for these orphaned items, but it is a fairly tedous process. So I though of writing an application to automate this. I could have used JIRA own scripting, but the process needs manual overview, which makes it more complex. So why not use Delphi? Using the CData JIRA Enteprise Connector to run a query against JIRA and storing the data in a dataset takes literally a few minutes. You can use FireDAC query editor to refine your query, and write fairly standard Delphi dataset processing code. This blog post is a description of what I did to achieve my goal -- and the application I build it going to save me a lot of time in the future. First, I've added to a data module (of a good old VCL application) the components needed to access quality portal and query for all of the open issues: object QualityportalConnection: TFDConnection Params.Strings = ( 'URL=http://quality.embarcadero.com' 'ConnectionDef=QualityPortal' 'IncludeCustomFields=true') LoginPrompt = False end object QPIssuesTable: TFDQuery Connection = QualityportalConnection SQL.Strings = ( 'SELECT Key, StatusName, IssueTypeName, Summary, InternalID FROM ' + 'CData.JIRA.Issues where ProjectKey = '#39'RSP'#39' AND StatusName = '#39'Open'#39) end The connection uses the IncludeCustomFields flag to retrieve extra custom fields of our JIRA installation, namely the cross reference from one JIRA system to the other, stored in the InternalID field -- and something a regular user without admin permissions should not be able to see. In fact, you need to provide your user name and password, the regular ones you use on the site. For query I've picked the fields I'm interested in, to reduce network traffic (I'm reading a lot of data!) and filtered on RSP (Data Studio Project) and Open status. You can see the query running in FireDAC query editor below: I also created static field objects for all fields in the query. For the internal JIRA analysis I've defined a query to retrieve information about an individual item, using a parametric query (like in SQL): SELECT Key, StatusName, FixVersionsAggregate, StatusName, ResolutionName FROM CData.JIRA.Issues where Key = :key With this query I'm retrieving the status, the type of resolution and the fix version. The basic approach of the application is to iterate all of the items open in the public system, fetch the internal status and check for inconsistencies. This is the basic loop: QPIssuesTable.Open; // for each, check internal status QPIssuesTable.First; while not QPIssuesTable.EOF do begin JiraIssuesTable.Close; JiraIssuesTable.Pa[...]