News, Blogs, and Tips

New Tip: TBooleanHelper.ToString and TUseBoolStrs enumeration

Marco Cantu - Mon, 10/07/2019 - 09:07

Among the native type record helpers that were introduced in the Delphi RTL a few years back, there is one for the Boolean data type. It has a few methods you can apply to a Boolean variable, including ToString. This is the class helper definition:

If you call ToString on a Boolean variable you get 0 or -1 depending on the value. In other words, True.ToString produces -1.

The ToString method has also a second parameter, UseBoolStrs, to let the method return a string with the text False or True.  However, if you call True.ToString(True) you still get -1. What's up? As you can see in the definition above, there are both a regular instance method and a class method called ToString that can be called with one Boolean parameter. The compiler picks the one without default parameter as best match. 

So the question is, how can I get the desired string output? Simply by using the TUseBoolStrs enumeration. In fact, originally the signature of the methods was using a Boolean as parameter, that is the values False or True. More recently, this was changed to use a TUseBoolStrs enumerator, with identical values False or True. In this way, the existing code compiles. The advantage of this trick you can specify the full value of the parameter, using the type as prefix and write:

True.ToString(TUseBoolStrs.True)

This returns the string True, which is what we wanted in the first place. It it not an obvious solution, but it allows keeping the existing code compatible while addressing a design limitation (the two methods with the same name) that was already there. The only problem is that few Delphi developers realize this -- I was ignoring the solution until recently -- and this is why I just wrote this blog post!

Categories: News, Blogs, and Tips

EKON 23 in October and UK RoadShow in November

Marco Cantu - Mon, 09/30/2019 - 10:34

I have two conference trips planned for the fall, after the event I attended in Germany at Foren-Tage last week. Here is some more information.

EKON 23, Dusseldorf

As one of the longest running conferences focused on Delphi, EKON is at its 23rd year. It is always packed with solid information and very goods speakers from around the world. Beside the many Delphi experts from Europe, in fact, this is one of the few conferences in Europe hosting US speakers, which this year include Cary Jensens and Ray Konopka. Tagged as "the Conference for Delphi & More", it takes place on October 28th - 30th, 2019 in Dusseldorf, Germany.

I'll be giving a keynote and sessions Windows 10 VCL development and on multi-device development for 64-bit macOS and 64-bit Android. I'm really looking forward to get there, meet other speakers, and chat with attendees about anything Delphi related and even beyond the product.

Detailed information at https://entwickler-konferenz.de/program-en/

Embarcadero UK Roadshow

About 2 weeks later, I'll be in Manchester on November 13th and London on November 14th, presenting a half day session on Windows development, migration for older code bases, 10.3.2 and roadmap, mobile applications. The events are organized by our partner Grey Matter and will be a good opportunity to touch base with our UK customers.

Sign up at https://www.greymatter.com/corporate/embarcadero-uk-roadshow

See You There!

Hope to see you at one of these events in you live in those areas or if you can reach them. All of the events around Delphi also often great opportunities for networking, sharing development ideas, and also jobs offers and requests. The board of offers for Delphi positions at Foren-Tage was quite impressive!

Categories: News, Blogs, and Tips

Joint Windows 10 Webinar with Microsoft and Embarcadero

Marco Cantu - Mon, 09/16/2019 - 08:20

Embarcadero has been focusing a recent series of webinar on Windows 10 and the RAD Studio features (mainly in VCL) specifically focused on the latest version of Windows. This week we are going to have a special event, presented by Microsoft and Embarcadero, and offering a overview of Microsoft plans for the platform and how Embarcadero already supports them or is planning to.

This is the official description: "Join Microsoft’s Matteo Pagani, Windows AppConsult Engineer, and Embarcadero’s Product Manager, Marco Cantu, with host Jim McKeeth, Embarcadero’s Developer Advocate for this special live webinar. Learn about the vision and direction of Microsoft with Windows 10 and how Embarcadero makes it easy for you to take your applications there with RAD Studio, Delphi and C++Builder."

This is next Thursday, September 19, at 8AM US Central time, 3PM for those like me in Europe. Sign up at:

https://embt.co/MoveYourWindowsApps

Categories: News, Blogs, and Tips

A Tale of 3 APIs: VCL integration with WinAPI, COM & ShellAPI, WinRT

Marco Cantu - Mon, 09/09/2019 - 03:48

In this blog post I want to offer some highlights from the session, but I won’t cover all of the details of the 40+ minutes technical discussion of the webinar.

Windows APIs Timeline

Let me start by covering the timeline of the various APIs added to the operating system over the years, by sharing the introductory slide I created:

Beside the timeline itself, it is important to notice that all of these three layers (the traditional API, COM, WinRT) are written in C/C++ and are natively compiled libraries. This means that a native compiled language like Delphi can bind directly to these APIs, with no marshaling needed. All three mechanisms use memory directly and manually (although with notable differences) and none uses .NET or garbage collection.

Finally, I don’t want to get into the discussion of trends, Microsoft dropping or not UWP, and so on -- I prefer keeping this blog post focused on technical elements of Delphi APIs support.

The Traditional Windows API

Calling Windows APIs is quite simple for functions Delphi already provides a translated header, but there are multiple options. Suppose you want to call MessageBox. This is declared in the Winapi.Windows unit as:

function MessageBox(hWnd: HWND; lpText, lpCaption: LPCWSTR; uType: UINT): Integer; stdcall;

And it is defined as an external function from a system DLL:

function MessageBox; external user32 name 'MessageBoxW';

where user32 is defined as:

const user32 = 'user32.dll';

You can call it directly just as you’d call a regular function:

procedure TFormCallAPI.btnStandardClick(Sender: TObject); begin MessageBox (0, 'Some text here', 'Caption', MB_OK); end;

This creates an entry in your application import table, that will need to match an export table entry in the DLL when the application starts and the library is loaded. In other words, linking happens at initial execution time. As an alternative (which makes more sense for a DLL which might be missing on the end user computer) you can load the library and bind to the function at the time you want to execute it.

First you need to have a specific procedural type:

type TMessageBoxCall = function (hWnd: HWND; lpText, lpCaption: PWideChar; uType: UINT): Integer; stdcall;

At this point, you can use the following code:

There is also an in-between options called delayed loading. In this case (sed for new functions added to an existing library, something Microsoft does for core system libraries over time) you need to use a specific delayed keyword after the declaration. This is something we add for more recent APIs, for example:

function WindowFromPhysicalPoint; external user32 name 'WindowFromPhysicalPoint' delayed;

In your code, you write the standard call, with no change needed, although you might want to make the call only if you are on a recent enough version of Windows:

if CheckWin32Version (6, 0) then hwnd1 := WindowFromPhysicalPoint (aPoint);

The complete code of this demo is available at https://github.com/marcocantu/DelphiSessions/tree/master/Win10Session/CallWinApi

There is another area I covered in the webinar in terms of core APIs, and that is the ability to handle Windows messages by using the matching method modifier, as in:

type TJumpListForm = class(TForm) public procedure DropFiles(var Msg: TWmDropFiles); message wm_DropFiles; COM and Shell Interfaces

The integration with COM is also quite deep but fairly simple in Delphi. It has long been considered the best COM integration available -- and probably still is even if COM is not so popular any more, it is still the foundation of the integration with the Windows shell and desktop. 

If you open the Winapi.ShellObj unit you can find a large number of the declarations of COM interfaces for the Windows shell. Here is an image with a short section -- the unit interface section is 14,000 lines! 

In the demo I covered in the webinar I used a component (TJumpList) which wraps some shell API rather than going deep level and doing it manually. The full demo is at https://github.com/marcocantu/DelphiSessions/tree/master/Win10Session/JumpListFilesDemo

COM has it own logic in terms of interfaces, IID (Interface IDs), the use of the registry and more. However COM interfaces maps to interfaces in the Delphi language and integration is smooth. The complexity comes more from proper lifetime management and objects creation, but this goes beyond the scope of this blog port.

Interfacing with WinRT

WinRT is a different but still native library, that has a different type system and memory management model compared to COM, but shared with it the binary interface (and VTable) model. Therefore, WinRT interfaces map naturally to Delphi interfaces.

This is how WinRT interface looks once remapped to a Delphi language declaration:

The system also defines a IToastNotificationFactory used to create an instance, and this is marked with a unique string -- which replaces the use of the registry and GUIDs -- namely 'Windows.UI.Notifications.ToastNotification'. Delphi also defines a helper “factory, in this case the class TToastNotification that is fairly simple to use, as in the code below:

This is the core of the code required to show a notification in Windows 10, although the TNotificationCenter component wraps it nicely in few lines of code. Both demos (the complete low-level WinRT API version and the easy to use component-based one) are available on GitHub respectively as https://github.com/marcocantu/DelphiSessions/tree/master/Win10Session/WinRTDirect and https://github.com/marcocantu/DelphiSessions/tree/master/Win10Session/Windows%2010%20Notifications.

Conclusion

There is again much more information in the webinar, and also additional demos covering how we are extending the core API support continuously in the VCL. For this blog post, let me end with the final summary slide of the webinar:

If not already there, the webinar replay will soon be available and get listed at https://community.idera.com/developer-tools/b/blog/posts/windows-10-modernize-webinar-series#replays.

Categories: News, Blogs, and Tips

My Favorite New Delphi 10.3 Rio Features

Tech Blog - from David Cornelius - Thu, 09/05/2019 - 00:18
Category: Programming

If you code a large share of your day, the IDE, or Integrated Development Environment, plays a key role in how productive you are. Getting around quickly and being very familiar with shortcut keys can save a lot of time. Several years ago, I bought Castalia, a popular Delphi IDE plugin that added several productivity enhancements. One of my favorite enhancements was stack-based bookmarks. You could hit F2, go navigate through your code or even bounce to a different file then by simply hitting Escape, you'd be right back where you left off and the temporary bookmark that had been left would be removed.

In 2014, Embarcadero purchased the product from TwoDesk, offered it for free to registered users of Delphi XE7 and then integrated parts of it into XE8. I was maintaining products in Delphi XE and XE2 and had let my Delphi subscription lapse so didn't pay much attention to it. Later, when I renewed, I found there were no more updates to Castalia and the stack-based feature I had loved didn't seem to exist. I was disheartened.

I forgot about it and started using manually created bookmarks more often when using Delphi 10 Seattle. The problem with them is they're only useful within the current source file and once you have several bookmarks in several different source files, it's easy to confuse yourself with which one goes where.

So when Delphi 10.3 came out and had a couple of new plugins available from it's GetIt Package Manager that provided this forgotten capability, I was elated. Reading about the Bookmarks and Navigator plugins, I found that stack-based bookmarks had been finally integrated into the Delphi IDE in 10.1 Berlin, but the hotkey, instead of being the simple function key used by Castalia was an obtuse, hard-to-remember combination of Ctrl+K & Ctrl+G. What? Why would they do that? Are they not creative enough to come up with something easier to remember than that?

Enter Parnassus. I had never heard of them before 10.3 Rio was released but evidently they had their "Bookmarks" plugin clear back in 2014.

But another, equally exciting plugin, also by Parnassus, is Navigator. This goes hand-in-hand with Bookmarks because it helps you jump quickly to places you might likely go temporarily, then quickly get back to work. For example, when I'm coding, I often realize I need to include a unit to support a method I need. So I have to go up to the implementation section, add a unit under the uses section, then go back to my code to continue. With the Navigator plugin, I can hit Ctrl+G (for Go), down-arrow two times to the Implementation-Uses section and hit Enter. That creates a stack-based bookmark where I am, jumps me up to the implementation section of my Delphi unit, I type in the name of the unit I need, possibly navigate inside and check the syntax, then simply hit Escape and I'm right back to where I can continue coding. Sweet!

Admittedly, this isn't really a built-in feature of Delphi, it's a third-party product they acquired (just like Castalia a few years prior) and are offering free. But at least now I know about it and once again have the convenience and productivity boost of fast navigation and stack-based bookmarks.

I just hope Embarcadero does not change the Navigator's hot key to some weird Ctrl+key combination that is hard to remember.

Categories: News, Blogs, and Tips

Why Should You Move to Windows 10?

Marco Cantu - Tue, 08/27/2019 - 02:11

While RAD Studio offers a great multi-device mobile and desktop development experience, Embarcadero is focused on keeping its development tools at the top spot for Windows clients development, with the best Windows client UI library, offering deep API integration. There are many technical areas VCL and FireMonkey are offering top features, and for example VCL focus on High-DPI support is significantly more powerful than what Microsoft offers at the native platform level with C++ MFC or C# WinForms.

But that's not the topic I really want to delve into in this introductory blog post. The RAD Studio team has decided to give a significant focus on Windows 10 support and Windows 10 migration (with a series of webinars and blog post over the coming 3 weeks) based on some fairly important business drivers for everyone building Windows applications.

Windows 7 EOL

First and foremost, Microsoft has announced long time ago the EOL (End of Life, or more precisely, end of support) date for Windows 7, which is less than 5 months away, as their page https://www.microsoft.com/en-us/microsoft-365/windows/end-of-windows-7-support states quite clearly:

"After January 14, 2020, Microsoft will no longer provide security updates or support for PCs running Windows 7. Now is the time to upgrade to Windows 10."

They leave no doubt about the consequences (although large companies will most likely receive exceptions):

Other Reasons to Move to Windows 10

Now this is a fairly relevant reason to get in touch with any of your customers still on Windows 7 and offer them help in moving to Windows 10. While most of your applications build with RAD Studio will run seamlessly -- we have no special runtime requirements or dependencies -- it is a great occasion for you to also offer your customers new versions of your applications with an improved user interface (UI) and user experience (UX), better High-DPI monitors support, full integration of platforms features like notifications, and general app modernization. You can achieve some of these features by upgrading to the latest RAD Studio and putting a relatively limited effort in updating your code, adding some newer components, adopting styles, and so forth.

There is also another feature that is relevant in particular if you are selling or distributing applications to end users, and that is the ability to leverage the Microsoft Store as distribution channel for your Windows applications, also easy to achieve thanks to the support for Windows Desktop bridge and APPX format available in the RAD Studio IDE.

Windows 10 Webinar Series

If these are all great reasons to focus on Windows 10, how can you learn more. First, join our webinar series. Sarina DuPont starts today (this evening European time) with a session on "Windows 10 and New Key UX Principles (for RAD Studio Developers)".

Jim McKeeth has published the complete list with all of the signup links, so I won't repeat it, just head to https://community.idera.com/developer-tools/b/blog/posts/windows-10-modernize-webinar-series for more information. There are 10 Windows 10 focused webinars, given by us and also by many MVPs, covering the UI, the APIs, comparing to alternative solutions, and discussing migration of third party components.

I'll be giving one of this webinars, "A tale of 3 APIs: VCL integration with WinAPI, COM & ShellAPI, WinRT" next Wednesday September 4th at 11 am Central time, which is 6 pm European time. I hope you find these webinars and the coming blogs posts useful from the technical point of view, and if you are not using a recent version of RAD Studio check out the latest using a Trial Version: https://www.embarcadero.com/products/rad-studio/start-for-free

Categories: News, Blogs, and Tips

More Delphi 10.3.2 patches and an Update on GetIt Installation

Marco Cantu - Wed, 08/14/2019 - 08:36

Just a quick blog post with some updates, in case you missed them.

2 More 10.3.2 Patches

First, there are two new patches for 10.3.2 Embarcadero made available yesterday (older one is here):

Both patches are fairly relevant and recommended to install if you are on Delphi or RAD Studio 10.3.2.

GetIt Update

There is also an update from the PM team regarding GetIt installation availability, as you can read in Sarina's blog post at https://community.idera.com/developer-tools/b/blog/posts/rad-studio-installer-options. The getit.embarcadero.com service should now respond correctly from your IDE for add-on packages.

Categories: News, Blogs, and Tips

RAD Studio 10.3.2 Runtime Packages Compatibility Patch Released

Marco Cantu - Wed, 08/14/2019 - 00:31

Embarcadero has just released a patch for RAD Studio, C++Builder and Delphi 10.3.2. The patch is available at:

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

Here are the readme notes:

Issue: Applications compiled with RAD Studio 10.3 or 10.3.1 and using runtime packages will not start when executed against the 10.3.2 version of the RTL runtime package.



Summary: This patch addresses a compatibility issue with mixing runtime packages built with 10.3.2 with earlier releases of Delphi or C++Builder 10.3. The platforms impacted are Win32, Win64, macOS32, and Linux64.



After applying the patch, older applications will keep running when you deploy a new application with new runtime packages. This means that the updated 10.3.2 packages are backward compatible. 



Note: A new application built in 10.3.2 will not run if executed against a 10.3.x version of the runtime packages, showing surfacing an error like 'Entry Point not Found "@System@Classes@TFieldsCache@$bcctr$qqrv"'.

The installation requires copying the content of the ZIP file to the installation folder. The complete files list is in the readme file included in the download.

Notice that this patch is critical for third-party component vendors who plan rebuilding their components with 10.3.2.

Updated on August 11th

There is now also a second patch available for Delphi 10.3.2 and related with macOS 64-bit debugging:

Categories: News, Blogs, and Tips

August 2019 RAD Studio Roadmap Udpate

Marco Cantu - Tue, 08/13/2019 - 09:06

On the Embarcadero developer community site, there is a new blog post by Sarina DuPont covering:

August 2019 Delphi Android Beta Plans & August Roadmap Update

The blog post has an update to the May 2019 roadmap and it also highlights the plans around a Delphi Android 64-bit Beta that's going to be made available soon to update subscription customers. Read the article linked above for all of the details.

Categories: News, Blogs, and Tips

Installation and GetIt Workarounds for Delphi 10.3.2 (Updated)

Marco Cantu - Thu, 08/01/2019 - 03:05

Some of the Embarcadero servers (in one of the web farms) are experiencing some severe and prolonged outage. This is affecting (among other things) Delphi 10.3.2 installation. As a temporary workaround, the company has:

We should soon have the regular GetIt-based offline installer for 10.3.2 working again with the temporary server. 

August 1st Update

We now have the ability to install 10.3.2 via GetIt using this temporary system, there is no need to change the GetIt URL manually, as it is embedded in an updated installer. And CodeCentral MyRegistered products is online again with the updated downloads.  Read more on the latest status at https://community.idera.com/developer-tools/b/blog/posts/new-10-3-2-getit-installer.

Thanks for your patience and sorry again for the inconvenience. 

Categories: News, Blogs, and Tips

IDE Fix Pack 6.4.4 Hotfix for Delphi 10.3.2

Andy’s Blog and Tools - Wed, 07/31/2019 - 12:26

There was a bug in IDE Fix Pack 6.4.3 for Delphi 10.3.2 that caused the Win32 compiler to crash. The CodeGenMod.Win32.VirtFinalSealed patch didn’t work correctly. Even if the actual patch code doesn’t run without the “-x-fvs=1” compiler command line option extension specified, the hooking code failed to inject the correct code for the compiler’s version. Only Delphi 10.3.2 was affected by this bug.

Download:
Name IDE Version File Size Downloads Added IDE Fix Pack 6.4.2 2009 (UP4)IDEFixPack2009Reg64.2.7z242.75 KB781 times2019-03-23 IDE Fix Pack 6.4.2 2010 (UP5)IDEFixPack2010Reg64.2.7z237.09 KB931 times2019-03-23 IDE Fix Pack 6.4.2 XE (UP1)IDEFixPackXEReg64.2.7z221.38 KB438 times2019-03-23 IDE Fix Pack 6.4.2 XE2 (UP4+HF1)IDEFixPackXE2Reg64.2.7z316.78 KB514 times2019-03-23 IDE Fix Pack 6.4.2 XE3 (UP2)IDEFixPackXE3Reg64.2.7z257.4 KB387 times2019-03-23 IDE Fix Pack 6.4.2 XE4 (UP1)IDEFixPackXE4Reg64.2.7z260.1 KB264 times2019-03-23 IDE Fix Pack 6.4.2 XE5 (UP2)IDEFixPackXE5Reg64.2.7z257.7 KB350 times2019-03-23 IDE Fix Pack 6.4.2 XE6 (UP1)IDEFixPackXE6Reg64.2.7z423 KB303 times2019-03-23 IDE Fix Pack 6.4.2 XE7 (UP1)IDEFixPackXE7Reg64.2.7z429.48 KB457 times2019-03-23 IDE Fix Pack 6.4.2 XE8 (UP1)IDEFixPackXE8Reg64.2.7z431.7 KB371 times2019-03-23 IDE Fix Pack 6.4.2 10 Seattle (RTM/UP1)IDEFixPackD10Reg64.2.7z428.33 KB750 times2019-03-23 IDE Fix Pack 6.4.2 10.1 BerlinIDEFixPackD101Reg64.2.7z430.65 KB879 times2019-03-23 IDE Fix Pack 6.4.2 10.2 (RTM/UP1/2/3)IDEFixPackD102Reg64.2.7z426.27 KB1847 times2019-03-23 IDE Fix Pack 6.4.4 10.3 (RTM/UP1/2)IDEFixPackD103Reg64.4.7z444.98 KB623 times2019-08-01

Download (fastdcc for the command line compiler):
Name IDE Version File Size Downloads Added fastdcc 6.4.2 2009 (UP4)fastdcc2009v64.2.7z112.87 KB244 times2019-03-23 fastdcc 6.4.2 2010 (UP5)fastdcc2010v64.2.7z120.38 KB256 times2019-03-23 fastdcc 6.4.2 XE (UP1)fastdccXEv64.2.7z121.36 KB205 times2019-03-23 fastdcc 6.4.2 XE2 (UP4+HF1)fastdccXE2v64.2.7z166.48 KB205 times2019-03-23 fastdcc 6.4.2 XE3 (UP2)fastdccXE3v64.2.7z150.88 KB191 times2019-03-23 fastdcc 6.4.2 XE4 (UP1)fastdccXE4v64.2.7z153.55 KB159 times2019-03-23 fastdcc 6.4.2 XE5 (UP2)fastdccXE5v64.2.7z151.87 KB219 times2019-03-23 fastdcc 6.4.2 XE6 (UP1)fastdccXE6v64.2.7z198.67 KB182 times2019-03-23 fastdcc 6.4.2 XE7 (UP1)fastdccXE7v64.2.7z219.84 KB197 times2019-03-23 fastdcc 6.4.2 XE8 (UP1)fastdccXE8v64.2.7z224.67 KB192 times2019-03-23 fastdcc 6.4.2 10 Seattle (RTM/UP1)fastdccD10v64.2.7z219.65 KB283 times2019-03-23 fastdcc 6.4.2 10.1 BerlinfastdccD101v64.2.7z223.52 KB320 times2019-03-23 fastdcc 6.4.2 10.2 (RTM/UP1/2/3)fastdccD102v64.2.7z219.06 KB518 times2019-03-23 fastdcc 6.4.4 10.3 (RTM/UP1/2)fastdccD103v64.4.7z228.61 KB160 times2019-07-31

Changelog

  • Fixed: CodeGenMod.Win32.VirtFinalSealed was broken for Delphi 10.3.2
  • Removed: IDE Insight Listbox drop shadow patch isn’t necessary for Delphi 10.3.2 anymore
Categories: News, Blogs, and Tips

The new 10.3.2 RAD Server Management Console

Marco Cantu - Fri, 07/26/2019 - 03:47

Since Embarcadero started bundling RAD Server development support with RAD Studio, there has been a little-known utility available to manage installations from a desktop client. This application was originally called EMS Desktop console, and used to ship both as a binary in RAD Studio bin folder and with complete source code in the product source code folder. In 10.3.2 we have replaced that application with a significantly re-written version, now called RAD Server Management Console and available as rsconsole.exe. You can read about it also at http://docwiki.embarcadero.com/RADStudio/Rio/en/RAD_Server_Management_Console_Application_UI

A Redesigned UI

The user interface of this FireMonkey application has been significantly redesigned, as you can see in the image below. The RAD Server Console now uses FireMonkey styles and it can switch between a light and a dark style at runtime

The other significant change is the connection configuration. This was covering the top part of the screen and has now been moved out to a separate dialog box. The left panel lists the connections you have already configured (making it easy to switch between different RAD Server instances) and the dialog is used to edit connections or add new ones



An Integrated REST Debugger

In terms of new features, beside the UI and usability improvements, a key addition is the integrated version of the REST Debugger. This pane uses the current configuration and it can list the available endpoints on the specific RAD Server instance:

Once you execute a request, you can see the JSON response data and in case this has a tabular format, convert it to a table and preview is

Notice that from this pane you can also copy the components a client application will need to connect to the specific endpoint. After hitting copy in the application, you can paste the components in a client data module (for any platform), as I’ve done here:

The Integrated EmsServer.INI File Editor

The other brand new feature added to the RAD Server Console is an editor for the emsserver.ini local configuration file (this work only on a file on the local machine, we are considering a remote configuration mechanism for the future). Once you select the file, you can see the various sections and change the values in the INI file. The editor guides in filling some of the options by listing available values and checking the input:

Notice that most items have a check box on the side, this is sued to enable a feature or not. When a feature is not enabled the value is written to the INI file but it is commented out (which is the case for most default values). At runtime, RAD Server will just use its current default. If that’s fine, leave the check box disabled. If you want to use a specific value, enable the check box and enter the value.

Categories: News, Blogs, and Tips

RAD Server Improvements in RAD Studio 10.3.2

Marco Cantu - Thu, 07/25/2019 - 02:14

Over the last couple of years, Embarcadero has been expanding the features and capabilities of the RAD Server architecture, while at the same time making it more affordable (by including free deployment  licenses with different RAD Studio editions).

The recent 10.3.2 Release of RAD Studio continues in the same direction, adding several interesting features to RAD Server, which I’m going to cover in some detail in this blog post and in a second coming blog post focused on the RAD Server Console. The focus has not been the addition of totally new features, but improving each of the steps, from development to configuration, from deployment to management.

RAD Server Database Mapping Wizard

In 10.3 we introduced new components that can help you configure a RAD Server endpoint mapped to a database table. While this simplified development quite a bit, there is still a necessary step to configure these components. For this reason, we added to the RAD Server New Module Wizard a new option to select one or more database tables and let the wizard fully configure the data module of a working RAD Server package for you.

The first step is to select the new checkbox, “Database EndPoints”. While you can also keep regular sample endpoints, these are often alternative -- so I disabled the sample endpoints below:

By pressing next, you are now presented with a new page of the wizard, which allows you to pick a FireDAC connection name (out of those already configured) and provide a table filter. In the resulting list you can pick one or more tables. Here I selected a couple:

As you finish the wizard execution, the IDE will add a new data module with a FireDAC connection component and a FireDAC query with a matching EMSDataSetResource component for each of the selected tables:

These components have rather standard settings you can easily configure. The additional benefit, though, is that the component declarations are properly decorated with attributes, making this data module ready-to-use:

Now you can just build the package and run RAD Server, and you’ll be able to use URLs with the matching elements to access the exposed database data. If you just use “/one” you’ll get an error, because the module doesn’t have a global GET operation defined. But a URL like “one/employee/” will let you read the entire query:

Notice you need the final / to hit the resource matching the entire component, while adding to the URL the record key field will end up selecting an individual record for fetching, updating, or deleting, like in:

While using default configuration settings is only a good start, requiring more refinement and configuration and often custom code, having a ready to use server with database mapping is certainly very nice to get started.

Swagger API Documentation Improvements

Another feature of the wizard (see the first image above) is the ability to generate Swagger API documentation attributes for the sample methods generated. While Swagger API support has been in RAD Server for a while, it is far from simple to get it going and for this reason we decided to offer some additional guidance.

If you use the wizard and select the “API Documentation” checkbox while keeping some of the sample endpoints selected, the wizard will decorate your endpoints with proper documentation attributes:

Now if you start RAD Server and hit the /api/apidoc.yaml endpoint you can get the complete documentation for your APIs, including the specific section displayed below that matches “test” endpoint above:

Using a Swagger client you should be able to easily browse that documentation.

Improved Logging and Error Messages

In past versions the logs displayed by RAD Server would display information about registered endpoints in a fairly cryptic way, and not providing the actual URL you can call. Now this is much more clear, better structures, nicely formatted, and also offers much more detailed error messages in case something goes wrong. Here is an example:

ExtJS Web Console

Another change is that the ExtJS Web Console previously available in GetIt as an additional download is now fully integrated with the standard installation, replacing the older jQuery-based Web Console.

The New Windows Server and Linux Installers

Finally, in the GetIt Package manager you can find the downloads for two installers for the deployment version of RAD Server, one for Linux and one for Windows Server, including all of the binaries needed, like the InterBase server installation and the various files to deliver. The installers should make deployment significantly easier.

The RAD Server Console

We have also fully redesigned and re-implemented the RAD Server Console FireMonkey client. Given this is a fairly rich client with many new features, I’ll write about it in a new specific blog post. Stay tuned and .... enjoy the new features and enhanced quality of RAD Studio 10.3.2.

Categories: News, Blogs, and Tips

IDE Fix Pack 6.4.3 for Delphi 10.3.2

Andy’s Blog and Tools - Wed, 07/24/2019 - 12:30

With the newest Delphi 10.3.2 (Rio Update 2) the IDE Fix Pack failed with two compiler extension patches. The updated version 6.4.3 adds support for the Delphi 10.3.2 update.

Only Delphi 10.3.2 requires this update. Older Delphi versions are unchanged and stay at IDE Fix Pack version 6.4.2.

Download:
Name IDE Version File Size Downloads Added IDE Fix Pack 6.4.2 2009 (UP4)IDEFixPack2009Reg64.2.7z242.75 KB781 times2019-03-23 IDE Fix Pack 6.4.2 2010 (UP5)IDEFixPack2010Reg64.2.7z237.09 KB931 times2019-03-23 IDE Fix Pack 6.4.2 XE (UP1)IDEFixPackXEReg64.2.7z221.38 KB438 times2019-03-23 IDE Fix Pack 6.4.2 XE2 (UP4+HF1)IDEFixPackXE2Reg64.2.7z316.78 KB514 times2019-03-23 IDE Fix Pack 6.4.2 XE3 (UP2)IDEFixPackXE3Reg64.2.7z257.4 KB387 times2019-03-23 IDE Fix Pack 6.4.2 XE4 (UP1)IDEFixPackXE4Reg64.2.7z260.1 KB264 times2019-03-23 IDE Fix Pack 6.4.2 XE5 (UP2)IDEFixPackXE5Reg64.2.7z257.7 KB350 times2019-03-23 IDE Fix Pack 6.4.2 XE6 (UP1)IDEFixPackXE6Reg64.2.7z423 KB303 times2019-03-23 IDE Fix Pack 6.4.2 XE7 (UP1)IDEFixPackXE7Reg64.2.7z429.48 KB457 times2019-03-23 IDE Fix Pack 6.4.2 XE8 (UP1)IDEFixPackXE8Reg64.2.7z431.7 KB371 times2019-03-23 IDE Fix Pack 6.4.2 10 Seattle (RTM/UP1)IDEFixPackD10Reg64.2.7z428.33 KB750 times2019-03-23 IDE Fix Pack 6.4.2 10.1 BerlinIDEFixPackD101Reg64.2.7z430.65 KB879 times2019-03-23 IDE Fix Pack 6.4.2 10.2 (RTM/UP1/2/3)IDEFixPackD102Reg64.2.7z426.27 KB1847 times2019-03-23 IDE Fix Pack 6.4.4 10.3 (RTM/UP1/2)IDEFixPackD103Reg64.4.7z444.98 KB623 times2019-08-01

Download (fastdcc for the command line compiler):
Name IDE Version File Size Downloads Added fastdcc 6.4.2 2009 (UP4)fastdcc2009v64.2.7z112.87 KB244 times2019-03-23 fastdcc 6.4.2 2010 (UP5)fastdcc2010v64.2.7z120.38 KB256 times2019-03-23 fastdcc 6.4.2 XE (UP1)fastdccXEv64.2.7z121.36 KB205 times2019-03-23 fastdcc 6.4.2 XE2 (UP4+HF1)fastdccXE2v64.2.7z166.48 KB205 times2019-03-23 fastdcc 6.4.2 XE3 (UP2)fastdccXE3v64.2.7z150.88 KB191 times2019-03-23 fastdcc 6.4.2 XE4 (UP1)fastdccXE4v64.2.7z153.55 KB159 times2019-03-23 fastdcc 6.4.2 XE5 (UP2)fastdccXE5v64.2.7z151.87 KB219 times2019-03-23 fastdcc 6.4.2 XE6 (UP1)fastdccXE6v64.2.7z198.67 KB182 times2019-03-23 fastdcc 6.4.2 XE7 (UP1)fastdccXE7v64.2.7z219.84 KB197 times2019-03-23 fastdcc 6.4.2 XE8 (UP1)fastdccXE8v64.2.7z224.67 KB192 times2019-03-23 fastdcc 6.4.2 10 Seattle (RTM/UP1)fastdccD10v64.2.7z219.65 KB283 times2019-03-23 fastdcc 6.4.2 10.1 BerlinfastdccD101v64.2.7z223.52 KB320 times2019-03-23 fastdcc 6.4.2 10.2 (RTM/UP1/2/3)fastdccD102v64.2.7z219.06 KB518 times2019-03-23 fastdcc 6.4.4 10.3 (RTM/UP1/2)fastdccD103v64.4.7z228.61 KB160 times2019-07-31

Changelog

  • Added: Delphi 10.3.2 (Rio Update 2) support
Categories: News, Blogs, and Tips

Building macOS 64-bit Applications with Delphi 10.3.2

Marco Cantu - Fri, 07/19/2019 - 03:59

Yesterday, Embarcadero released RAD Studio 10.3.2, which includes Delphi 10.3.2 -- available also as a stand-alone product. There are many great features in 10.3.2, along with a high number of quality improvements, but the most notable is certainly the addition of a new target platform.

As you are probably aware of, Apple has stopped accepting 32-bit applications to the online macOS store, has started adding a warning screen when you run a 32-bit app, and has announced that the next version of the operating system (Catalina) won't run 32-bit applications at all. These are all reasons that pushed us to increase the priority of a Delphi macOS 64-bit compiler, that we are shipping with all the required libraries, IDE support, and so forth.

More precisely, the is a new Delphi compiler for the macOS 64-bit platform, based on the LLVM compiler infrastructure, with a non-ARC model like all other Delphi desktop and server platforms (macOS, Windows, Linux). The RTL includes all core file features from system access to platform integration, from memory and threads management to HTTP and REST client libraries.

Of course, we have complete support for the FireMonkey library and all FireMonkey controls previously available on the macOS 32-bit platform are also in the 64-bit version. Regarding database access, the core database RTL and the FireDAC client access libraries are there, with support for the same databases previously available on the macOS 32-bit platform. The ClientDataSet component is also working, while the older and long-deprecated DBX drivers are not available. Finally, there is IBLite and IBToGo support for the Delphi macOS 64-bit. Here are some FMX 64-bit apps, but they don't really look much different than their 32-bit counterparts.

There are also specific new features and improvements for macOS. Notably, you can use the IDE directly for macOS notarization support, see http://docwiki.embarcadero.com/RADStudio/Rio/en/MacOS_Notarization and https://developer.apple.com/documentation/security/notarizing_your_app_before_distribution for more information.

There is another small change worth noticing. The way the system menu items are merged, has changed compared to the past versions of Delphi -- for both 32-bit and 64-bit versions of macOS. Now in the Application menu, which appears just after the Apple icon in the menu bar, system menu items (Services, Hide, Hide Others and Quit) are added automatically, so do not need to be added by the developer. Other items can be added manually to the Application menu using sub-items of the first visible main menu item in TMainMenu. You can see an example in the macOS screenshot above.

Categories: News, Blogs, and Tips

Delphi 10.3.2 is Now Available

Marco Cantu - Fri, 07/19/2019 - 01:59

Embarcadero has just announced Delphi 10.3 Release 2:

https://community.idera.com/developer-tools/b/blog/posts/announcing-the-release-of-delphi-c-builder-and-rad-studio-10-3-2

Most notably, this release adds macOS 64-bit support, with App Store and even Apple Notarization support included from the IDE. But there are many other features available I'll blog about in the coming days,

Some links for now:

That's all for the time being. We are hosting a webinar next week covering the release, as I blogged about yesterday.

Categories: News, Blogs, and Tips

What’s New in Delphi 10.3.2 Webinar Next Week

Marco Cantu - Wed, 07/17/2019 - 09:53

Embarcadero has announced a webinar for next week, focused on the new features of the coming 10.3.2 release. The title is "What’s New in Delphi, C++Builder, and RAD Studio 10.3.2" and it is scheduled for Wednesday, Jul 24, 2019 at 8:00 AM US Central Time (that is 3:00 PM in Europe).

I'll present it with the other RAD Studio Product Managers, Sarina DuPont and David Millington.

In the free webianr we'll introduce and demo new features in the coming release of Delphi, C++Builder and RAD Studio.

Register at https://register.gotowebinar.com/register/1262173778065437955

Categories: News, Blogs, and Tips

IDE Fix Pack moved to a new server

Andy’s Blog and Tools - Sat, 06/29/2019 - 04:53

After 18 years of using a sub-domain on a very old server on a domain that wasn’t owned by me, my blog and therefore IDEFixPack got a new home.

My blog is now accessible via https://www.idefixpack.de . The old sub-domain has a “Moved Permanently” redirection to the new domain. Some time in the future the old sub-domain will be deleted.

Categories: News, Blogs, and Tips

Random Thoughts on the Passing Scene #162

Nick Hodges - Mon, 06/14/2010 - 15:07
Categories: News, Blogs, and Tips

Delphi Pretty Good Practices #5 – Don’t Use Literals

Nick Hodges - Wed, 06/09/2010 - 11:03

If there is a bedrock, bottom line, everyone-should-follow-it-all-the-time rule in programming it is “The DRY Principle” – Don’t Repeat Yourself.  This simple rule states that you should write code once and only once, and that you shouldn’t allow the same code to be used all over the place.  Or, as the Wikipedia article deftly states: "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system."  Put more simply, it means that you shouldn’t have the same thing repeated all over your code, but that you should create a single identifier and use that in the many places where it might be needed.

As a practical matter, the DRY principle in its most basic form tells us that we should, as a matter of course, not use literals in our code, but instead should declare constants (or resourcestring types as we’ll discuss in a minute) and use those instead. That way, if you need to change the value for something, you can do it in a single place instead of having to make multiple, error-prone changes throughout your existing code.

For example:  Say you have a system that has an arbitrary number of required repetitions, say 17.  You might end up writing a whole bunch of code like this:

for i := 1 to 17 do begin ProcessStuff; DoSomeMoreStuff; end;

Now imagine that you have that kind of code all over the place, and then your boss comes around and says "Hey, we need to repeat all that stuff 18 times now, not just seventeen.” Well, if you haven’t followed the DRY Principle, you could very well end up with a lot of code to change.  And don’t use search and replace, because what if you change the 17 that is part of a variable name or something?  Things could get ugly fast.

Of course, the thing to do is to declare a constant:

const NumberOfRepetitions = 17;

and declare your loops as

for i := 1 to NumberOfRepetitions do begin ProcessStuff; DoSomeMoreStuff; end;

and now when your boss switches things up, you have but one simple change to make, and all is well.

Now this is a pretty simple, basic thing to do, but I’m constantly surprised at how often I find myself forgetting to do it.  (For instance, if you look through the code for TextScrubber, you’ll probably notice that I need to apply the DRY Principle to the TVersionInfo constructor in uTextScrubberTypes.pas.) You might be surprised how many literals you use in your code. I often take advantage of the syntax highlighting feature to scan code for specific colors for strings and numbers and replace them with constant values as much as possible. For instance, some code from TextScrubber used to look like this:

procedure TStraightTextMainForm.InitializeMainFormInformation; var IniFile: TIniFile; begin IniFile := TIniFile.Create(IniFileName); try TextScrubberOptions.ClickChoice := TClickChoice( IniFile.ReadInteger('Options', cClickChoice, 0)); TextScrubberOptions.ShouldTrim := IniFile.ReadBool(cOptions, 'ShouldTrimText', False); finally IniFile.Free; end; end;

with a bunch of string literals.  Instead, now, I’ve declared two constants in the uTextScrubberConsts.pas unit

const cOptions = 'Options'; cClickChoice = 'ClickChoice'; cShouldTrimText = 'ShouldTrimText'; cVersionLangCodePage = '040904E4';

and the new code looks like this:

procedure TStraightTextMainForm.InitializeMainFormInformation; var IniFile: TIniFile; begin IniFile := TIniFile.Create(IniFileName); try TextScrubberOptions.ClickChoice := TClickChoice( IniFile.ReadInteger(cOptions, cClickChoice, 0)); TextScrubberOptions.ShouldTrim := IniFile.ReadBool(cOptions, cShouldTrimText, False); finally IniFile.Free; end; end;

Those constants are also used when I write out information to the INI file, so that I can change the value in one place if I need to, and so that I can know that there won’t be any typographical errors in my strings that will cause a bug.  The same string value is always going to be used for the INI file entry.

Now let’s take a look specifically at strings.  Strings are a bit special because they are very often used to communicate information, and as such, they frequently need to be translated into other languages through the process of “localization”.  Windows provides an easy way to do this via string resources, and Delphi provides an easy way to create string resources via the resourcestring identifier.  These strings are then created as resources, making them easy to translate.  And “easy to translate” can often be, well, translated into “cheaper to translate” and that is a good thing.

Practically speaking, I apply this principle by placing as many const and resourcestring declarations as I can in a single file, thus centrally locating them for easy management and translation.  In our case with the TextScrubber project, I’ve created a file called uTextScrubberConsts.pas and put constants and resource string values into it.  If you look through the project code, you’ll probably notice that I need to apply the DRY Principle to the TVersionInfo constructor in uTextScrubberTypes.pas, even if it is keeping those constants within the unit.

One question that might get asked is “How do you choose what to make a const and what to make a resourcestring?”  My answer is that as a general rule, any string that could change without changing the UI or the functionality of the code, make a const.  Any string that, if changed, will trigger a change in UI or translation should be made a resourcestring.  There are exceptions to that, of course. More simply, a rule to use that anything that might get translated should be a resourcestring.

Now, this is a pretty simple “pretty good practice” to follow, but for you folks who have not been following this principle,  simply doing so can make your code more readable and maintainable.

Categories: News, Blogs, and Tips