Channel: Tips, Tricks and Techniques - Embarcadero Community
Mark channel Not-Safe-For-Work? cancel confirm NSFW Votes: (0 votes)
Are you the publisher? Claim or contact us about this channel.

Delphi/C++ BuilderのPAServerがmacOS Sierraでは日本語メッセージが出ない場合の対処方法 [JAPAN]


この記事は http://qiita.com/kazinoue/items/0a2c454f9ce304be9629 を community.embarcadero.com 向けに再編集したものです。


MacOS / iOS 向けの開発を行われている方が作業用のMacをmacOS Sierraにしたら、PAServerが出力するメッセージが日本語ではなく英語になっていた、というケースがでているかと思います。

これはmacOS Sierraでロケールに関する下記APIの仕様が変わったことが原因です。




そこで、この対処方法をRAD Studio/Delphi/C++Builderのバージョン別に紹介します。


## 10.1 Berlin Update 2 をご利用中の場合

このリリースに付属の PAserver は日本語メッセージが正しく表示されます。特別な対処は不要です。


## 10.1 Berlin Update 1 をご利用中の場合

このリリースに付属の PAserver を macOS Sierra で実行すると、メッセージが英語になります。PAServer のバージョン番号が 10.1 Berlin Update 2 と同じなのは、大変残念なことに typo ではありません。Update 2で多言語対応の改修されているのだからバージョン番号は変わっていたほうが良かったのですが、とりあえず11/15時点ではバージョン番号では区別できません。

ちなみに Berlin Update 2 の IDE から Berlin Update 1 の PAServer を経由しての macOS / iOS アプリの実機デプロイは全く問題なく動くように見えましたので、多言語対応以外の部分は全く同じのようです。




### 10.1 Berlin Update 2 にアップデートする。

10.1 Berlin Update 2 にアップデート可能な方はアップデートをご検討ください。


### PAServer の日本語リソースファイルのファイル名を書き換える。

10.1 Berlin Update 2 へのアップデートが直ちに行えず、かつメッセージを日本語で出したい場合は、/Application/PAServer-18.0.app/Contents/MacOS にある "paserver.ja" を "paserver.ja-jp" にリネームしてください。




$ cd /Application/PAServer-18.0.app/Contents/MacOS 
$ sudo paserver.ja paserver.ja-jp








## 10.1 Berlin Update 1 より前のバージョンをご利用中の場合


10.1 Berlin Update 1 より前のバージョンをご利用中の方も、Update 1 向けと同じ対応を行っていただければOKです。



Demos and Presentation from my CodeRage Sessions

Creating Custom Styles with the Bitmap Style Designer - CodeRage Replay, Tips & Tricks and Sample Files


During this week's CodeRage event, I gave a lightning talk on using the Bitmap Style Designer to create a custom style for TSwitch. This blog post summarizes the steps, tips and tricks shown during my CodeRage session. It also includes the style graphics shown during the session and the session replay link.

Learn How To Debug Faster And Smarter In RAD Studio With Primoz Gabrijelcic


We all have to debug programs and we never like it. This CodeRage XI replay session will show you a few tips & tricks that will help you debug your code in a faster and smarter way. The session will show how to use few less-known debugger features (groups, thread support, data breakpoints ...) and will also present few tips and trick (how to add a log ""form"" in two lines of code, when modifying code is preferable to setting a breakpoint with condition etc). Be sure to check out the tip about super fast DCU compiles.

Primož Gabrijelčič is a long time Pascal and Delphi developer, MVP, speaker at Delphi conferences and writer of the The Delphi Geek blog. His professional career is focused mostly on high-availability data processing servers which resulted in a well-known open source parallelization library - OmniThreadLibrary. Recently he is spending his free time on the FastMM project where he focuses on improving memory manager performance in highly-parallel environment.

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

RAD Studio 10.1 Berlin - Anniversary - Update 2: Kalenderkomponente mit einer Datenbank nutzen


Es haben mich in den letzten Tage immer wieder Kunden angesprochen, wie man die neue VCL-Komponente "TCalenderView", die mit dem Update 2 von Delphi/C++Builder/RAD Studio 10.1 Berlin eingeführt wurde, mit einer Datenbank benutzen kann.

Ausgangslage: In einer Datenbanktabelle sind Datumswerte gespeichert (31.12.2015) und diese sollen visualisiert werden.

Das Ganze ist recht einfach (ohne Code) umsetzbar. Ohne Beschränkung der Allgemeinheit habe ich eine Standard-VCL-Formularanwendung erstellt mit Datenbankzugriff über FireDAC auf eine SQLite Datenbank (DB-Komponenten direkt im Form):

Standard Form, aktivierte DB-Komponenten

Danach die TCalendarView-Komponente und ein DBGrid zur Visualisierung der Tabelle / Font-Eigenschaft der Kalendar-Komponente angepasst, TDataSource hinzugefügt und verbunden (die Anwendung ist sicherlich nicht schön :-)):

DBGrid, CalendarView, noch nicht verbunden

Mit dem LiveBindings-Designer kommt nun die Verbindung: Ansicht | LiveBindings-Designer:

  • In der CalendarView Komponente fügt man explizit "Date" als "binares Member" hinzu
  • Und verknüpft die passende Spalte mit dem "Date":
  • Das war es schon (für die unidirektionale Verbindung):

Möchte man auch (was wahrscheinlich ist :-) ), die Datenbankwerte auch über die TCalendarView verändern, so kann man folgendes beim OnChange der Kalendar-Komponente einpflegen:

procedure TForm1.CalendarView1Change(Sender: TObject);
begin if OrdersTable.CanModify then begin if not (OrdersTable.State in [dsEdit,dsInsert]) then OrdersTable.Edit; OrdersTable.FieldByName('OrderDate').Value := CalendarView1.Date; end; end;

(Hinweis: Da SQLite eine Single-User-Datenbank ist (Datenbankdatei ist gelockt!), habe ich in diesem Zusammenhang die Active-Property der DB-Connection und der Tabelle wieder ausgeschaltet und manuell im Form-Create gesetzt:

procedure TForm1.FormCreate(Sender: TObject);
  Sqlite_demoConnection.Connected := true;
  OrdersTable.Active := true;


[DownloadButton Product='Delphi' Caption='Download von Delphi Testversion'][DownloadButton Product='Cbuilder' Caption='Download von C++Builder Testversion']


Learn to program with C++Builder: #5 Operators, and final application!


Welcome to the fifth and final episode of Learning C++ with C++Builder Starter. Last time, we had a calculator and numerical input, demonstrating using boost::optional, smart pointers, and more. This post is shorter: it will finish the calculator with operators (implementing addition, subtraction, etc) and end with a full application, ready to move to cross-platform if you wish.


The calculator is almost functional. The one thing missing is actually performing the math operations.

We want to support four operations: addition, subtraction, multiplication, and division. Each of these is an operation; each takes two operands, a left and a right operand.  In the expression

3 x 4

The left operand is 3, the right operand is 4, and the operation is Multiply.

This gives us a good basis for an interface, and an object-oriented design for operations, and is a good excuse to make a polymorphic class hierarchy with virtual methods - a useful thing to see done when learning C++.  Let’s make an interface and factory methods in a new unit called uOperator.cpp:

class IOperator {
	virtual double Calc(const double A,const double B) = 0;
	virtual std::wstring Name() const = 0;

std::unique_ptr<IOperator> CreateOp(const EOperator Op);

And implement these in the .cpp file. For example, Add would be:

	class TAdd : public IOperator {
		virtual double Calc(const double A, const double B) {
			return A + B;
		virtual std::wstring Name() const {
			return L"+";

Along with the factory method, switching on Op.

Any call to the interface's methods, Calc or Name, will call into the implemented descendant.

Next, create this when the user sets the operator.  Add a std::unique_ptr<IOperator> m_Op; to the TCalculator class, and change TCalculator::SetOperator to look like so:

if (Op == EOperator::eNull) {
	} else {
		m_Op = CreateOp(Op);

This is currently simplified - we’ll examine some other things that have to happen here in a moment.

This allows us to calculate the result of an operator, so long as we have two numbers. How do we get those two numbers?

Left and Right Operands, and the Result

Last post, we had an accumulator - a small object whose job was to take button keypresses and turn them into numbers. When has the user finished typing?

  • When the user presses an operator (like + or -)
  • When the user presses Equals

In both these cases, it indicates one number is complete, and something else needs to happen: in the first case, that the second number needs to be entered; in the second, to calculate the result. Also in the first case, entering the second number might mean calculating as well - if the user has entered ‘1 + 2’, and presses the multiply button, they want to multiply 3 by something. That something is the new right operand, and the result is the new left operand.

This means that SetOperator needs to be able to promote the accumulator’s value to a new left or right operand value, and also sometimes invoke Equals and moving the result to the left operand, before setting the operator.

Secondly, the left and right operands, and the result, do not always exist.  When the calculator app has just started, and the user has entered nothing, there are no operands or result. When Equals has been pressed, there is a result but no left or right operand. This harks back to last week’s post: how do you represent something that may or may not exist? Using boost::optional.

Let’s add three optional values to the calculator class’s declaration:

	boost::optional<double> m_Left;
	boost::optional<double> m_Right;
	boost::optional<double> m_Result;

They’re not initialised to any value in the class constructor, since at app startup they are empty.

Promoting the accumulator

First, let’s create a method for moving a number from being typed in (the accumulator) to a left or right operand. It’s fairly simple: if there is no left operand, initialize the left with the accumulator’s value; if there is, then initialize the right operand with the accumulator’s value. If there’s already both a left and a right, that indicates a logic error.

void TCalculator::PromoteAccumulator() {
	if (!m_Accum.Entering()) {

	if (!m_Left) {
		m_Left = m_Accum.Value();
	} else {
		m_Right = m_Accum.Value();
	// Reset
	m_Accum = Accumulator();

Setting the operator

We can now expand the method called when the user wants to set the operator - when they press + or -.

  • If the operator changes, and the user was typing, that needs to be promoted to an operand.
  • If there are two operands, both left and right, then it needs to calculate (this addresses when the user has typed 1, +, 2 and then presses *. In this situation they want to get the result of three, and multiply that by something soon to be typed in, so move the result to the left.)
  • Assuming all this resulted in a left-side operand, create an operator class instance.

The code to do this looks like so:

void TCalculator::SetOperator(const EOperator Op) {
	if (Op == EOperator::eNull) {
	} else {
		PromoteAccumulator(); // once the op changes, stop entering, make it a number

		// 1 + 2 [now press -] -> want to calc that, make it the left operand
		if (!m_Result && m_Left && m_Right) {
		if (m_Result) {
			// Operator after result -> want the result to be the new left operand
			m_Left = m_Result;
		if (m_Left) {
			// Require a left operand, because all ops have to operate on at least
			// one operand
			m_Op = CreateOp(Op);



Not much left!  We can now make use of the operator classes we created at the beginning of the post.  The calculation method, called Equals after the button, will promote the accumulator if necessary (the user might have been typing what should become a right-side operand); if it has a left, a right, and an operator, call the virtual Calc method to get a result.

void TCalculator::Equals() {

	if (m_Left && m_Right && m_Op) {
		m_Result = m_Op->Calc(*m_Left, *m_Right);
		m_Left.reset(); // No operands any more
		SetOperator(EOperator::eNull); // Nothing to do any more



One final step: displaying this onscreen.

A traditional calculator only displays the number currently being entered, or the result. The operator interface we designed has an operator name, and there’s no reason our app can’t be slightly more advanced than a desktop calculator.  If the user is trying to calculate “1 + 2” why display only 1, or only 2, and no sight of ‘+’?

My version of this code will show the left and right operands, if they exist, along with the operator if it’s set, accounting for the user typing (for example, there might not be a right operand, just the accumulator in use - same with the left operand.)

There's not much new here: this uses string streams, and dereferences the optional left or right values.


void TCalculator::UpdateUI() {
	std::wstringstream stream;
	if (m_Left) {
		stream << *m_Left;

		if (m_Op) {
			stream << L" " << m_Op->Name() << L" ";

			if (m_Right) {
				stream << *m_Right;
			} else if (m_Accum.Entering()) {
				stream << m_Accum.ValueStr();
	} else if (m_Accum.Entering()) {
		stream << m_Accum.ValueStr();
	} else if (m_Result) {
		stream << *m_Result;


The Calculator

And that’s it. Really. Congratulations, you now have a fully functional calculator!

This code, being FireMonkey, can be compiled on Windows, macOS, and mobile. (Note some possible problems with Android's boost - looking into it.)  You can theme it, and change the layout for any device using the multi-device designer. What you've done is create a cross-platform app without even trying.

We've covered:

  • Basics
    • Installing C++Builder Starter
    • Basic debugging
    • Designing a UI
  • UI design
    • FMX styles, to give your app a new theme
  • Coding
    • Basic C++ syntax
    • Basic object oriented classes in C++
    • Useful C++ classes and techniques, including smart pointers and optionals, an understanding of heap-allocated objects, RAII, and other C++ basics
    • Good application architecture: separating the UI and logic
      • Interfaces and implementing interfaces
    • Good application architecture: principles of ownership

and ended with a complete, working, very nice calculator. Your challenge? Recompile it for macOS or iOS! (Hint: investigate the 'Target Platforms' node in the Project Manager...)

Thanks for reading each post. I hope you learned some good stuff!

Source code


Extending VCL to Mobile with App Tethering


App Tethering was first introduced in RAD Studio XE6 as a way to extend your VCL and FireMonkey (FMX) apps to other companion applications.  The companion apps can be Windows, Mac OS X and/or FMX multi-device apps.


With App Tethering, you can breathe new life into your existing Windows VCL apps! You can extend Windows VCL and FMX apps connecting them to other devices, sensors, data and services to build connected apps to add to a distributed Internet of Things (IoT) solution!

RAD Studio 10.1 Berlin added these App Tethering Improvements:

App tethering gains the following features:

          Network_V4       Network_V6

       procedure DiscoverManagers(const ATargetList: TTetheringTargetHosts); overload;

For security, you can encrypt the data or streams before sending to any connected app, and then you decrypt the data or streams when it’s received by any of the connected apps as I described in this post, App Tethering using Encryption Hooks.

The RAD Studio 10.1 Berlin sample PhotoWall app shows AppTethering sending streams between other paired profiles. 

The Photo Wall app has a DesktopWall viewer app is a Multi-Device app to display photos taken with its mobile counterpart application.

The Mobile app from the PhotoWall lets you take a photo with your Android or iOS device and display it on one or more DesktopWall instances over the network.


This sample app demonstrates how to scan for App Tethering enabled Remote Instances across a network, pair with individual Remote Instances, and send Temporary Resources to those individual Remote Instances.

 [DownloadButton Product='RAD' Caption='Get RAD Studio 10.1 Anniversary Edition today!']

Accessing the battery level on your iOS device


I recently saw a question on our forums on how to access the current battery level on an iOS device using FireMonkey, so I thought I would do a quick post about it. This sample code extends the DeviceInfo code snippet included with RAD Studio 10.1 Berlin Anniversary Edition.


unit uMain;


  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls, FMX.ListBox,
  FMX.Layouts, FMX.Controls.Presentation;

  TDeviceInfoForm = class(TForm)
    btnGetDeviceInfo: TButton;
    ListBox1: TListBox;
    lbOSName: TListBoxItem;
    lbOSVersion: TListBoxItem;
    ToolBar1: TToolBar;
    Label1: TLabel;
    lbDeviceType: TListBoxItem;
    lblBatteryLevel: TListBoxItem;
    procedure btnGetDeviceInfoClick(Sender: TObject);
    { Private declarations }
    { Public declarations }

  DeviceInfoForm: TDeviceInfoForm;

  iOSapi.UIKit, iOSapi.Foundation, Macapi.Helpers;

{$R *.fmx}

procedure TDeviceInfoForm.btnGetDeviceInfoClick(Sender: TObject);
  Device : UIDevice;
  Device := TUIDevice.Wrap(TUIDevice.OCClass.currentDevice);
  lbOSName.Text := Format('OS Name: %s', [NSStrToStr(Device.systemName)]);
  lbOSVersion.Text := Format('OS Version: %s', [NSStrToStr(Device.systemVersion)]);
  lbDeviceType.Text := Format('Device Type: %s', [NSStrToStr(Device.model)]);

//code added for detecting battery level
  lblBatteryLevel.Text := Format ('Battery Level: %d', [Round(Device.batteryLevel*100)]);





[BuyButton Product='RAD' Caption='Buy RAD Studio Berlin now']


Multi-Device UI Styling with our Premium Style Pack


FireMonkey provides support for both native styling and custom styling. Part of the current Bonus Pack are eleven premium FireMonkey styles. Choose from Jet, Sterling, Diamond, Emerald Crystal, Emerald Dark, Coral Crystal, Coral Dark, Vapor, Copper, Copper Dark and Radiant styles, optimized for iOS, Android, Windows and Mac application development.

Each style includes the required graphics to ensure the user interface looks great on each supported target platform. For example, this includes 1x, 1.5x, 2x and 3x resolution graphics on Android. We have many great resources to help you get started using custom styles in your multi-device applications.

Docwiki Tutorials:


If you are interested in creating your own custom styles, check out my latest blog posts for step-by-step tutorials:


Emerald Crystal Premium Style

Diamond Premium Style



Jet Premium Style


By adding a style selector to your multi-device application, you give your users the option to select the theme they like best. Click here for the tutorial.

A great collection of style related posts can be found here.

[BuyButton Product='Delphi' Caption='Get RAD Studio 10.1 Berlin Anniversary Edition today! ']




Dave's Coding Roundup #2


Random interesting C++ and general programming items.

  • Being a Good Programmer, where 'good' relates to ethics. This is a topic I think about from time to time. Are the products we or you create good for your users and good for the world? There have been a couple of great posts and discussions on these topics recently, examining things programmers have been asked to do, as well as 'dark patterns', UI design patterns intended to mislead.
  • The posts raise questions such as: are you personally responsible for the behaviour of your code, the way an engineer is responsible if a bridge he or she designs collapses? What about smaller, non-life-or-death items: if you create a UI to trick users into agreeing to something (an email subscription, installing a browser addon, etc) is that something you should say no to? What about your code running slowly, and irritating the user? Is there a difference between a bug in code you wrote with a detrimental effect, and a deliberate design choice you implement? These are degrees of arguably ethically bad code, where the effect ranges from serious to minor. At what point do you, personally, look at the code you are writing and take personal responsibility for its effect? How do you respond to it?

    I've been lucky to never have worked for an unethical company. My first employer was a marine science company and the software we created was largely used by scientists, and the research they did directly affected environmental policy in several countries. I was even on site for one gigantic environmental disaster, which I probably can't openly discuss, and the work we did that week directly affected the response. I always felt good working at that company. Years later, at Embarcadero, I feel the same: we here are a step back in that we create software that others use to create software, but we create great tools that let people do amazing things, and I know of many extraordinary applications made with our tools that make the world better, and make people's day to day lives better, or even just a bit happier.

    We also want to make the product better, for you - more powerful, easier to use, and nicer to use. Quality work is included in every release, especially focusing on bugs and improvements.

  • Are you interested in 3D engines? This is a fascinating writeup on a lighting system using voxel cone tracing. Even if you're not familiar with existing lighting techniques in 3D games, you might find the article and its explanation an interesting read.

  • Programming and debugging in interesting places: How a problem where trains stopped mid-tunnel in Singapore's Circle Line was solved. A great example of data-driven debugging, with analysis and a flash of insight.

  • Concepts have been coming soon for a long time in C++. It's not always easy to understand what concepts are. Bjarne Stroustrup gave this great talk on Good Concepts.

  • Writing IDE plugins with C++Builder: Dave Hoyle is a MVP and has written extensively on the OTAPI or Open ToolsAPI, the API the IDE exposes to write plugins. Plugins are most commonly written in Delphi, but there's no requirement for that - remember C++ and Delphi interoperate fantastically. He has a great post showing a C++ example of an IDE plugin that some basic and not-so-basic items, plus a downloadable template.

  • Why is the size of an empty class not zero in C++? And how does that relate to the zero-size empty base classes optimization (which we support in both classic and Clang-based compilers)?

  • How do debuggers work? This series (parts one, two, three), writing a simple debugger in Linux, is on my to-read list. Linux is a little different from Windows, but the principles will be the same. If you're interested in writing one for Windows, MSDN actually has some articles on how to write one. Playing around with this sort of code has been one of the most fun and interesting coding areas I've ever played with.

  • Berlin Update 2 came out recently with some really cool stuff. Go download it! Use the same installer you used to install before (ie if you used the ISO installer to install Berlin, upgrade using the ISO installer too.)

That's it for this roundup. You can read the last one too.

Mixing Delphi and C++


Would you like to add C++ to your Delphi application? Or add Delphi code to your C++ application? Here's how.

One thing you might not know is how closely integrated the C++ and Delphi languages are in RAD Studio. You can compile a single application in a single project to a single EXE, mixing both languages. (And of course you can do so using DLLs or packages as well.) If you use C++Builder, this is useful to add Delphi-implemented libraries. If you use Delphi, you might want to use portions of C++ to take advantage of C++ libraries, or perhaps the LLVM optimizer. 

For CodeRage XI (2016), I gave a presentation on mixing Delphi and C++ code.  The talk is online, but this blog post also discusses how to mix the two and also gives source code.

[YoutubeButton url='https://www.youtube.com/watch?v=6f5UBL0bQ9U&list=PLwUPJvR9mZHhduLqFX352uV1APPIRAu1h&index=25']

There are two areas: adding Delphi to a C++Builder project, and adding C++ to a Delphi project.

Adding Delphi to C++Builder

You can add any .pas file to a C++ project. (C++Builder has supported adding Pascal files into a C++ project for many years, since at least CB2006.) When you add a Pascal file and build the C++ project, the .pas files are built before any C++ files, and the Delphi compiler auto-generates a C++ header with a .hpp extension. This is exactly the same as the headers for the VCL or FMX! This allows C++ code to refer to Delphi classes and types, completely unaware they are not implemented in C++, and at link time the Delphi code is linked in to C++ code.

Delphi and C++ are ABI compatible. In fact, you can even create C++ classes that inherit from Delphi classes. Delphi language extensions such as ARC, closures, etc are supported in our C++ compilers. Combined with header generation, this means the two languages can interoperate seamlessly, and it's very easy for C++ to call Delphi code. You do this every time you write a UI using the VCL, in fact.

Adding C++ to Delphi

The reverse, calling C++ code from Delphi, is also possible although slightly more complicated. There's no equivalent to the header generation of Delphi code to declare C++ code to Delphi. Delphi has no concept of headers, for example. The closest is the interface section of a unit - and what would a unit look like that was a translation of C++ code?

The video instead shows one technique, which I personally recommend, to call from Delphi code into C++. Define an abstract base class in Delphi, and then in a package, inherit from it and implement it in C++. This gives you an interface defined in Delphi, an instance of which you can use in Delphi as though it was a Delphi object, but that is actually implemented in C++.

C++Builder supports packages, and that leads to elegant code separation. In the video, the C++ class is implemented in the package, combined with a factory method which Delphi can call to create an instance. In the C++ class, you can use any C++ you want - one common question from customers is, "Are you limited in the C++ features you can use if you're using the class from Delphi?" The answer is no, you're not limited. Delphi sees only the interface defined in Delphi, and types it can understand. In the implementation, including in the header of the derived class, you can use any C++ you want to.

This is a very powerful technique to add C++ to your Delphi applications. You might want to do this for a number of reasons, such as to use C++ libraries, or to make use of the LLM optimizations on Windows for, eg, math code.

Note that having both Delphi and C++ projects requires you to have both Delphi and C++Builder - that is, RAD Studio, which costs less than the two individually. A good deal, giving you access to powerful code!


Mixing two languages at the natively compiled, binary level, ABI-compatible, no runtime, is a very powerful feature. The video is worth watching: it goes into depth about the techniques, including the reasons for them, and shows an explains the code in the projects.

You can find the example projects on Github. There are three projects:

  • Starting with a C++ project, call into Delphi code:
    • CPP_Call_Delphi: a C++ project with a .pas file added
  • Starting with a Delphi project, call into C++ code:
    • Delphi_Call_CPP: a Delphi project which defines an abstract base class, and calls into a package
    • CPPPackage: a C++ package which implements the abstract class, returns an instance of it to Delphi code, and does various things in C++ to demonstrate the use of C++, regardless of the fact it's called by Delphi

Webinaraufzeichnungen verfügbar


Unter den folgenden Links findet Ihr die Webinaraufzeichnungen der vergangenen Tage:

[YoutubeButton url='https://youtu.be/7FgGmFpM06k']

[YoutubeButton url='https://youtu.be/UHxXSM3OvsM']

[YoutubeButton url='https://youtu.be/FQn3pjBscaY']

Mit Delphi die ganze Welt im Griff


Direkt an der Elbe in Hamburgs Speicherstadt ist die größte Modelleisenbahn der Welt beheimatet – das Miniatur Wunderland.  

Hamburgs Touristenattraktion Nr. 1 lockt jährlich 1,3 Millionen Besucher aus allen Teilen der Welt in seine Ausstellungsböden und begeistert nicht nur Modellbahnbegeisterte. Auf 6.800 qm Ausstellungsfläche ist in rund 760.000 Arbeitsstunden eine einzigartige Miniaturwelt entstanden. Sie besticht neben ausgefeilter Technik vor allem durch ihren Detailreichtum. 260.000 liebevoll in Szene gesetzte Figuren, fahrende Züge und Autos, Schiffe; sogar Flugzeuge starten am Knuffingen Airport im Minutentakt. Ein atemberaubender Miniaturkosmos, den es so nirgendwo anders auf der Welt zu sehen gibt.

Wie alles anfing

Im Jahr 2000 begann der Bau des Miniatur Wunderlandes. Das Vorhaben der Zwillingsbrüder Gerrit und Frederik Braun sowie Stephan Hertz wurde vor über zehn Jahren noch von vielen belächelt. Doch aus dem Lachen sind bereits bei der Eröffnung im Jahr 2001 Loblieder geworden. Die Anlage lädt zum Träumen ein und zeigt nicht nur detailgetreue Abbilder aus der ganzen Welt, sondern stellt immer wieder aktuelle Ereignisse in den Vordergrund und das Wunderland engagiert sich für wohltätige Zwecke.

Mit Delphi den Überblick behalten

Innerhalb des Wunderlandes gibt es eine breitgefächerte Software-Landschaft, welche seit Beginn mit Delphi entwickelt wird und mittlerweile knapp eine dreiviertel Million Zeilen umfasst. Die für die Steuerung der Anlage wichtigsten Projekte:

  • Die Fahrzeugsteuerung, die für die Steuerung der Fahrzeuge, Flugzeuge und Schiffe zuständig ist.
  • Die Lichtsteuerung, die neben sämtlichen Anlagen- und Fahrzeuglichtern auch das Deckenlicht kontrolliert und so für imposante Tag- und Nachtszenen sorgt.
  • Die Zugsteuerung “Railware”, welche nicht im Wunderland entwickelt wird, aber dennoch ein Delphi-Programm ist und den kompletten Zugverkehr aller Anlagen-Abschnitte steuert.
  • Die Anzeigetafel für Knuffingen Airport, die ihrerseits mit der Fahrzeugsteuerung synchronisiert. Die Liste der Abflüge und Ankünfte ist auch live im Internet abrufbar.
  • Die Videoshows im HSV-Stadion
  • Der Befehlsverteiler (“The Brain”) sorgt für die Synchronisation der verschiedenen Systeme. So stellt er beispielsweise sicher, dass alle Software-Systeme über dieselbe Wunderland-Zeit verfügen.Der Befehlsverteiler arbeitet über ein selbst entwickeltes, ultra-kompaktes binäres Protokoll, welches Informationen mit geringstmöglicher zeitlicher Verzögerung transportieren kann und dabei sogar robust gegenüber Ausfällen von Einzelsystemen ist.

Der Leitstand

Alle diese - und weitere - Programme laufen im sog. “Leitstand” zusammen, von wo aus die Techniker die gesamte Anlage im Blick haben und auf Ereignisse reagieren können. Die IT-Infrastruktur wurde bewusst dezentral aufgebaut, um eine höhere Sicherheit gegen Ausfälle zu erreichen. Seltene, aber leider unvermeidliche, Hardware-Defekte bleiben dadurch in ihren Auswirkungen auf lediglich jeweils einen einzigen Anlagen-Abschnitt oder gar Teil-Abschnitt beschränkt.

Es gibt viel zu entdecken

Das offizielle Video vom Miniatur Wunderland Hamburg zeigt einen Überblick über die größte Modelleisenbahnanlage der Welt. Auf der 1.300 qm großen Anlage fahren weit über tausend Züge, Flugzeuge, Autos und Schiffe. Ein Weltwunder in miniatur.

[YoutubeButton url='https://www.youtube.com/watch?v=2-Y-tBuglfs']
Neben den o.g. Projekten existiert noch ein Werkzeugkasten weiterer kleinerer, teils hoch spezieller, Tools, die im Alltag zum Einsatz kommen und für einen reibungslosen Ablauf sorgen.
Inzwischen rüstet man sich für den Umstieg auf Delphi 10.1 Berlin. Hierzu gab es bereits ein Teilprojekt als “Proof of Concept” auf Basis der Starter Edition bei der der Flughafen Knuffingen mit Flugzeugen, Fahrzeugen und LEDs gesteuert wurde. Dank an Daniel Wolf.

"RAD Studio 10.1 Berlin" Roadshow in Hannover, Nürnberg, Innsbruck und Bochum


Die Roadshow zum RAD Studio 10.1 Berlin geht in eine neue Runde. Diesmal sind wir in 

Neben den Neuerungen vom RAD Studio 10.1 Berlin werden auch explizit die Neuerungen vom Update 2 für RAD Studio 10.1 Berlin gezeigt: Die Möglichkeit Windows-Anwendungen in APPX Pakete für den Windows 10 Store bereitzustellen, aber auch die neuen Produktivitätserweiterungen und die neuen VCL Komponenten, die mit Update 2 eingeführt worden sind.

Durch den Tag begleitet mich Bernd Ua (probucon Business Consulting) für die Termine Hannover und Bochum und Volker Hillmann (adecc Systemhaus) auf allen Terminen für den C++Builder.

Nutzen Sie die Gelegenheit, um in den Pausen Ihre Fragen zu stellen und sich untereinander zu vernetzen. Wir laden Sie herzlich ein, dabei zu sein. Für die Tagungspauschale erheben wir einen Beitrag von 45 EUR.

Anmeldung, Anreise und Agenda sind jeweils unter den oben angegebenen Links.


Debugger Hotfix for iOS32



We have been working on several hotfixes to address recent operating system changes on iOS (10), macOS (Sierra) and Windows (10 Anniversary) that affect debugging with RAD Studio.

We have two debugger hotfixes in the works which you will be able to apply to 10.1 Berlin Update 2.

The first of these is now available, and addresses RSP-16324, debugging a 32-bit iOS application on iOS10. Download it here!

Other debugging issues

In addition to the this hotfix, we are also working on a hotfix to address the following items:

  • RSP-16322: Problems deploying to macOS Sierra
  • RSP-16368: Problems debugging using the iOS Simulator on macOS Sierra
  • RSP-16475 and RSP-16429: Error evaluating a function call in C++ Win64 on Windows 10 Anniversary

We will update this post with a download link to the second hotfix once it’s ready.

VMwareの実行環境や仮想マシンをチューニングしてDelphi/C++Builder/RADStudioの開発環境のパフォーマンスの改善を試みる [JAPAN]


第33回デベロッパーキャンプ・イン・大阪で、来場者の方より「VMwareで RAD Studio で開発しているけど仮想マシンが遅くて困っている」というご相談を頂きました。

最近では仮想マシンを開発で使うことは普通の作業になっていますが、VMware Workstation/Fusionの仮想マシン設定は各種リソースを控え目に使っています。このために初期設定のままでは性能がイマイチの場合があります。そこで、仮想マシンのチューニング項目を挙げてみることにします。

Microsoft Azure App Service(ISAPI) 上でDataSnapを利用する


Microsoft Azureには App Serviceと言うIIS機能だけを提供しているサービスがあります。

ISAPIが利用可能なので Delphi / C++Builder DataSnapをApp Service上でISAPIとして実行します。

App Serviceを登録します






Delphi / C++Builder側でDataSnap(ISAPI)のDLLを作成

新規プロジェクトファイルから「DataSnap Server」「DataSnap Server WebBroker アプリケーション」でプロジェクトを作成します。

ISAPIダイナミックリンクライブラリにチェックを入れて[次へ >>]




2.[App Service]側にアップロードとISAPI設定

アップロードに関しては 様々な手段が使えるかと思います





手元のPCローカルにあるWindowsのIIS Managerを起動します。

[File]→[Connection to a Site...]を選ぶとウィザードになっています


発行プロファイル*.PublishSettings内のpublishUrl, userName, userPWDを使って登録できます

IIS Managerの[Handler Mappings]でDLLを選び

左項目の[Edit Feature Permissions...]で[Execute]にチェックを入れます。



これで App Service側の設定は完了です



Delphi / C++Builderで新規マルチデバイスアプリケーションを作成し




Debugger Hotfix for macOS Sierra and the iOS Simulator


We have been working on several hotfixes to address recent operating system changes on iOS (10) and macOS (Sierra) that affect debugging with RAD Studio. In December we released a hotfix for debugging on 32-bit iOS 10, and we are pleased to release a second hotfix for debugging on macOS Sierra and the iOS Simulator.

This hotfix addresses:

  • RSP-16322: Problems deploying to or debugging on macOS 10.12 Sierra

  • RSP-16368: Problems running and debugging using the iOS Simulator on macOS 10.12 Sierra

  • RSP-16324: debugging a 32-bit iOS application on iOS 10 (the first debugger hotfix.)

This hotfix is for RAD Studio, Delphi and C++Builder 10.1 Berlin, and includes the previous debugger hotfix - that is, you only need to install this one to address all the above issues; you do not need to install the other one first. Download it here!

Other debugging issues

In addition to the above issues, we were also investigating:

  • RSP-16475 and RSP-16429: Error evaluating a function call in C++ Win64 on Windows 10 Anniversary

We currently believe the issue has been addressed by a recent Windows update.  If you are still encountering issues on a fully updated Windows 10 Anniversary Edition machine, please comment in one of the above QP reports to let us know.


Delphi: Kinderleicht - App AG am Vareler LMG


Auch Schüler setzen immer wieder gerne (und in letzter Zeit vermehrt) Delphi ein.

So ist im Zuge des Lothar-Meyer-Gymnasiums aus dem Landkreis Friesland (LMG Varel) innerhalb der Arbeitsgemeinschaft "App AG" ein einzigartiges Projekt entstanden, welches Schülern aus der Klasse 6E die Programmierung näher bringt. Gefördert vom Landkreis Friesland, entwickelt mit Delphi und viel Spaß an der Sache.

Ein guter Onlineartikel findet sich dazu hier bei der Nordwest-Zeitung:



元号が改正された場合の西暦と和暦の相互変換について [JAPAN]




Windows OS側の対応



これに基づくと、たとえば 2017年1月1日から元号が “改元” に変わるという設定は以下のように書けます。

Windows Registry Editor Version 5.00

"2017 01 01"="改元_改_Kaigen_K"

この設定の結果は PowerShell で以下のように実行することでも確認できます。

PS C:\> $path = "HKLM:\SYSTEM\CurrentControlSet\Control\Nls\Calendars\Japanese\Eras"
PS C:\> Get-ItemProperty $path
1868 01 01   : 明治_明_Meiji_M
1912 07 30   : 大正_大_Taisho_T
1926 12 25   : 昭和_昭_Showa_S
1989 01 08   : 平成_平_Heisei_H
2017 01 01   : 改元_改_Kaigen_K
PSPath       :
PSParentPath :
PSChildName  : Eras
PSDrive      : HKLM
PSProvider   : Microsoft.PowerShell.Core\Registry

PS C:\> $CultureInfo = New-Object system.Globalization.CultureInfo("ja-JP");
PS C:\> $CultureInfo.DateTimeFormat.Calendar = New-Object System.Globalization.JapaneseCalendar
PS C:\> $CurrentDate = Get-Date
PS C:\> $CurrentDate.ToString("ggyy年MM月dd日",$CultureInfo)

PS C:\>

テストを終えたらレジストリの設定を元に戻すことをお忘れなく。このようにレジストリだけで新しい元号に対応できるので、改元の際には Windows Update によって新しい元号の情報が追加されることになるでしょう。


FormatDateTime, DateToStr, DateTimeToStr を実行すると、上記レジストリの値を参照しての西暦→和暦変換が行われます。


TFormatSettingsでShortDateFormatに元号を含む書式を指定した上で、StrToDate を使えば改元後の和暦の日付を西暦に変換できます。

 JPNEraFormat: TFormatSettings;
 strDate: String;
 timestamp: TDateTime;
 strDate := '改元1年1月19日';
 JPNEraFormat := TFormatSettings.Create('ja-JP');
 JPNEraFormat.ShortDateFormat := 'ggee/m/d';

 strDate := StringReplace(strDate, '年', '/', []);
 strDate := StringReplace(strDate, '月', '/', []);
 strDate := StringReplace(strDate, '日', '', []);

 timestamp := StrToDate(strDate,JPNEraFormat);

このように日付の文字列に年、月、日を含む場合は / に置換するなどの前処理を行ってから StrToDate を実行することに注意が必要です。

なお、VarToDateTime で和暦→西暦変換を実装すればコードの量はもっと少なく済むのですが、ことに VarToDateTime は前述のレジストリを参照していません。改正後の元号を用いた日付を渡すと例外が発生します。ただしVarToDateTime の機能自体はOS側の機能に依存しています。Windows で日付文字列を内部データに変換する処理は複数の関数があるのですが、関数によって挙動が違うようです。これは今後の Windows Update によって対応がなされるかもしれません。