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

SHA Hash with C++Builder and Delphi

$
0
0

SHA Family Hashes Icon by Uwe Martens - Used under CC BY-SA 4.0I've always been fascinated by encryption & compression, but my favorite is probably the cryptographic hash function. A hash function is a one-way algorithm that takes an input of any size and always produces the same size output. It is one-way in that there is information loss -- you can't easily go from the output to the input again. The cryptographic hash is a more secure version of the hash function. It is most often used in signing to validate that data hasn't been modified. 

Per Wikipedia, the ideal cryptographic hash function has five main properties:

  • it is deterministic so the same message always results in the same hash
  • it is quick to compute the hash value for any given message
  • it is infeasible to generate a message from its hash value except by trying all possible messages
  • a small change to a message should change the hash value so extensively that the new hash value appears uncorrelated with the old hash value
  • it is infeasible to find two different messages with the same hash value

SHA Family Icon by Uwe Martens - Used under CC BY-SA 4.0

A cryptographic hash function (specifically SHA-1) at work. A small change in the input (in the word

The Message Digest family of cryptographic hashes used to be the main players in the area, but they were found to be insecure. Now SHA family rules as the main workhorse of modern cryptography. 

The basis of hash support first appeared in the RTL around the 2009 release but in XE8 (2015) we got the System.Hash unit, which brought the MD5, SHA-1, and Bob Jenkins hashes. Then in 10.0 Seattle (2015) it was expanded with SHA-2 support. Most recently in 10.2 Tokyo (2017) the hash functions were expanded to accept either a string or stream in addition to the original bytes input. 

The SHA Family includes SHA-0, SHA-1, SHA-2, & SHA-3 family of hashes. SHA-0 is obsolete, and SHA-3 is an improvement on SHA-2. In practice I see most hashes using either SHA-1 or SHA-2. SHA-1 always produces a 160-bit (20-byte) hash (digest), while SHA-2 includes 224, 256, 384, and 512-bit outputs, making it both more secure and more flexible. SHA 256 & 512 represent 32 and 64-bit word size hash algorithms. The 224, 256, & 384 size digests are truncated versions of the 256 & 512 algorithms. 

So how do you use it in C++Builder and Delphi? I'm glad you asked. Once you have included the System.Hash unit then you can use the methods of the THashSHA2 class to create the digest. I'll show you how to use GetHashString, but know there are other variations you can use too. The GetHashString takes either a string or a stream and returns a hexadecimal string of the hash. 

In C++Builder your code would look like:

Edit512->Text = THashSHA2::GetHashString(
    EditMessage->Text, 
    THashSHA2::TSHA2Version::SHA512);

 and in Delphi your code would look like:

Edit512.Text := THashSHA2.GetHashString(
    EditMessage.Text, 
    THashSHA2.TSHA2Version.SHA512).ToUpper;

I made a little sample app that generates all the different hashes from the text you provide. It is a FireMonkey app, so will work on all the platforms, but the hash code will work in any type of app. There are both C++ and Delphi versions included.

SHA Hash Sample
[ShaHashSample.7z - Delphi & C++Builder 10.2.3 Tokyo - 401 KB ]


Read More

RAD Studio开发相关的一些重要更新信息

$
0
0

已经是5月下旬了, 对于开发人员来说今年有数件重要的开发事件值得关注. 首先是RAD Studio本身, RAD Studio最新几个版本我们可以观察到RAD Studio现在每一个大版本之后会有数个hot fix以及3个更新小版本. 而这些更新都需要使用者到特定的URL下载安装, 而且有许多使用者并不知道已经有hot fix/更新小版本推出因此仍然使用旧版本. 这个问题已经有许多朋友向我反映了, 我们也向RAD Studio的产品经理反映了用户的抱怨. 因此RAD Studio的产品经理已经响应未来的hot fix/更新小版本将可以直接由IDE中的GetIt管理员中下载安装, 如此一来不但方便多了, 也可以减少使用者不知道已经有新的hot fix/更新小版本的情形出现.

 

  2个重要的开发信息是今年7月是iOS App重要的里程碑, 因为Apple早已宣布7月后所有iOS App都必须使用iOS 11 SDK开发而且必须支持iPhone X, 而且必须支持iPhone XSuper Retina. 目前最新的RAD Studio 10.3.x是符合这些开发要求的, 因此如果您要开发iOS Apps, 那么您就一定要更新到最新的RAD Studio 10.3.x而且必须拥有iPhone X以方便开发测试. 我个人目前还没有iPhone X, 要好好的考虑要不要再次大失血给Apple, 呵呵.

 

另外在Windows平台MS也有数个重要的发展, 有兴趣的朋友可以看一下下面的信息:

https://www.theverge.com/2018/5/8/17319908/microsoft-build-conference-2018-news-recap-highlights-windows-10

 

我相信RAD Studio很快就会推出这些相关的Windows开发技术, 很快又有一堆新的技术要学习和玩耍了, 各位开发界的朋友又要加油了. 只是这几年新技术实在太多,动不动的就要加油, 不知道各位有没有加到脚抽筋呢?


Read More

RAD Studio開發相關的一些重要更新資訊

$
0
0

已經是5月下旬了, 對於開發人員來說今年有數件重要的開發事件值得關注. 首先是RAD Studio本身, RAD Studio最新幾個版本我們可以觀察到RAD Studio現在每一個大版本之後會有數個hot fix以及3個更新小版本. 而這些更新都需要使用者到特定的URL安裝, 而且有許多使用者並不知道已經有hot fix/更新小版本推出因此仍然使用舊版本. 這個問題已經有許多朋友向我反映了, 我們也向RAD Studio的產品經理反映了使用者的抱怨. 因此RAD Studio的產品經理已經回應未來的hot fix/更新小版本將可以直接由IDE中的GetIt管理員中下安裝, 如此一來不但方便多了, 也可以少使用者不知道已經有新的hot fix/更新小版本的情形出現.

 

  2個重要的開發資訊是今年7月是iOS App重要的里程碑, 因為Apple早已宣佈7月後所有iOS App都必須使用iOS 11 SDK開發而且必須支援iPhone X, 而且必須支援iPhone XSuper Retina. 目前最新的RAD Studio 10.3.x是符合這些開發要求的, 因此如果您要開發iOS Apps, 那麼您就一定要更新到最新的RAD Studio 10.3.x而且必須擁有iPhone X以方便開發測試. 我個人目前還沒有iPhone X, 要好好的考要不要再次大血給Apple, 呵呵.

 

另外在Windows平台MS也有數個重要的發展, 有興趣的朋友可以看一下下面的資訊:

https://www.theverge.com/2018/5/8/17319908/microsoft-build-conference-2018-news-recap-highlights-windows-10

 

我相信RAD Studio很快就會推出這些相關的Windows開發技術, 很快又有一堆新的技要學習和玩耍了, 各位開界的朋又要加油了. 只是這幾年新技術實在太多,動不動的就要加油, 不知各位有沒有加到腳抽筋呢?


Read More

Evolution of C++ standards

$
0
0

Programming languages are exciting for developers, and C++, one of the more technically challenging and also perhaps the most widely used compiled language, is one of the most exciting.  As Theodore Roosevelt is misquoted (*), 'the more you know about the past, the better prepared you are for the future,' so let’s dive into a bit of C++ history and how it’s shaped our coding today. 

Many people may know that C++ grew out of C language extensions, started by Bjorne Stroustrup in 1979.  You might even know of the first C++ compiler, Cfront, which compiled what was originally ‘C with classes’ to C, which was then compiled itself.  Cfront was eventually dropped because the language grew too complex to compile to C. But in today’s world of fast-moving language standards, C++17 and C++20, you might not know that it took almost two decades until 1998 for the language to have its first standards published.

Let’s have a quick look at the history of C++ standards and where our product, C++Builder, fits in today.

Standardization

For many years, the de facto standard for C++ was not in written form, but in the form of a compiler: Cfront.  If it compiled, it was valid C++.  In 1985 Stroustrup published The C++ Programming Language, the first edition of what is still today regarded as the canonical C++ reference book, and this augmented Cfront such that the pair were the de facto standard for AT&T C++. This was replaced by The Annotated C++ Reference Manual in 1990.

Languages are often ‘owned’ by a single individual or group, who defines the language specification.  If a single group owns the compiler and libraries, no open spec is required; if instead there are multiple implementations, a shared common specification is essential for compatibility.  In a forward-looking and humble move, Stroustrup handed over the language to the International Organization for Standardization, ISO.

How did we get from a compiler and reference book to a ISO standard?

A number of things all happened around 1990:

  • The Annotated C++ Reference Manual was released
  • Turbo C++, the ancestor of today’s C++Builder, was released, and “added a plethora of additional libraries which would have a considerable impact on C++'s development.”
  • The same month, the first ANSI C++ meeting was held
  • In 1991, the first ISO C++ meeting

It was a time of great progress.

Since then, there have been five standardized specifications of C++ released.

The First Standard: 1998

The first ISO C++ standard was released in 1998, and it formed what today is still the basic C++ many people learn at University. It codified C++ including the STL, with a baseline of C++ features: RTTI and dynamic_cast, many template features, and so forth (note that many of these had been de-facto or widely used before 1998.)

It surprises many people who regard a language and supporting libraries as separate, but today much of the C++ standard is not only the language per se, but the standard library and its behaviour.

In 2003, the standard was updated to C++03. (Keen-eyed readers may have noted that C++98 dates from 1998 and C++03 from 2003, and this two-digit year-based naming convention continues today. This means ‘17 is newer than ‘98.) Unless you delve deeply into the standard, C++98 and C++03 are regarded as, effectively, the same thing.  C++03 solves several issues in C++98, but to a programmer who uses the language, the core was defined in the 1998 standard. 

Fast-forward to Standard #3: C++11

C++03 was a powerful language, but for several years the language was regarded as stagnating, with no new key revisions.  (Remember that C++03 was a minor change.)  Innovation was driven by libraries, especially Boost and the technical report libraries, both of which were closely related to the standards committee.  In the second half of the 2000s, this changed and finally in August 2011, the imaginatively named C++11 standard was released.

C++11 brought in many core features.  Among them are lambdas (function objects), type inference (auto keyword), constexpr, and more.  Today, C++Builder supports C++11 for Windows, iOS and Android.

In 2014, C++14 was released.  While C++14 made incremental updates to C++11, it also brought in several new features as well as new library functions.

C++11, ‘modern C++’, especially in its polished C++14 form, drove a renaissance in C++ development.  The current excitement around language features and new standards is largely driven by the success of this version of C++, and the demonstration of the leadership and direction taken by the committee. The language was regarded as back to fast progress, as it had been some years before.

Standard #5: C++17

Since the resurgence in C++ interest after C++11 and C++14, the committee has been moving quickly to further improve the language.

This resulted in C++17, the next large revision, in December last year.

C++17 brings many new changes, including template deduction of constructors, inline variables, preprocessor directives for checking header availability, improved constant evaluation for template arguments, parallel STL algorithms, a union type (std::variant), and many other library improvements including std::string_view.  Anecdotally, string_view is one of the most-discussed C++17 topics in programming forums.

C++Builder’s Language Support and Innovations

Where is C++Builder today?

C++Builder’s ancestor products, Turbo C++ and Borland C++, were key to the foundations of C++, the development of the STL, and the first revisions of the standard.

Today, C++Builder supports modern C++11, and support for C++17 is in development.  C++Builder has also innovated a number of C++ extensions, such as __closure to capture an object-method pointer (considerably more flexibly than the combination std::func and std::bind), and __property for abstracting object’s logical, non-field-backed, properties - these can be backed by methods, have default values, and can be used for RTTI reflection and streaming. Of course, these language features are completely optional and you can use pure C++ if you wish.  These extensions enable some of our most powerful libraries, and work in combination with FireMonkey, a GPU-accelerated cross-platform UI framework; FireDAC, a very elegant cross-platform database technology supporting any database you need; and many other frameworks and features for app communication, visual design, and more.

 

You can learn more about the history of C++ in the linked references below, or get started with a FREE 30 Day Trial of C++Builder today. 

References

 (*) Roosevelt is commonly quoted as saying, 'The more you know about the past, the better prepared you are for the future.' One exact quote of his, perhaps the source of the previous, is 'Full knowledge of the past helps us in dealing with the future.' -- The Progressives, Past and Present (1910).

 


Read More

Building Stunning UIs with C++ and FireMonkey

$
0
0
With many companies taking the “mobile first” approach, building applications that work on multiple platforms is a requirement for success.
Developers who know how to build for more than one platform are in demand, while application users have become accustomed to stunning UIs and intuitive UX.
Normally, mobile app development requires learning multiple programming languages and tools like iOS’s Xcode or Android’s Android Studio, then replicating the same functionality for each platform’s display and unique UI requirements. With FireMonkey, there’s a better way.
FireMonkey, also known as FMX, is the multi-device application framework behind C++Builder. It is designed for teams building native apps for Windows, macOS, Android and iOS, and getting them to app stores and enterprises fast.  With C++Builder, we provide a full application stack: providing user interface, database, networking, inter-device communication, and other libraries across all platforms.

 

Do This to Stop Duplicating UI Work
With other tools, an app developer might create an iOS user interface using the default vendor tools in Xcode and Swift, and an Android user interface in Android Studio and Java or Kotlin. Despite being very similar, these efforts are entirely duplicated with no shared work. Even with other cross-platform solutions, the amount of shared work is limited. For example, Xamarin.Forms focuses on cross-platform development, but a lot of effort is duplicated since you need to interface in Swift (iOS) or Java (Android) to create anything non-standard. 
With FireMonkey, a developer creates an interface once. Developers can easily make per application or per platform level application tweaks. For example: in the iOS version ensuring one control is presented using the native implementation; then in Android, adjusting spacing and colors for material design. The only language you need to use is C++: all controls and UI interaction is in C++, and you don’t need to mix languages or create translation layers. Just bring your existing C++ code right into a native C++ app.

 

 
Shown: Native UI styling on Android and iOS with the ability to easily tweak button styles and more
Compared to other development tool vendors that only offer a small amount of controls, RAD Studio and C++Builder include hundreds of controls that can be used in multi-device applications, and has a rich 3rd party ecosystem. 
 
Building the User Interface
FireMonkey provides a large library of UI controls, including buttons, lists, input controls, switches, toolbars and more.You can leverage built-in pixel perfect native platform styling or apply fully custom themes to your application UI to match your company’s brand guidelines.
In addition to a full library of GUI controls with platform and custom styling support, we are providing a number of platform specific controls, such as input controls, and scrollable lists that can be implemented at runtime by the underlying operating system. This is supported on iOS and Windows, and we plan to bring this functionality to Android and macOS. This provides ultimate flexibility for developers building multi-platform applications.
As part of our IDE, we provide a visual designer. For FireMonkey, we call this the FireUI multi-device designer. The multi-device designer is extremely powerful and at the core of our multi-device application development approach: It allows you to design a user interface once, and create variations per device. This is a vast time and development saving.
C++Builder provides a set of predefined views, including Windows Desktop, Mac Desktop, iPhone, iPad, and several Android Phone and Tablet optimized views.
Views are a mechanism that allows you to define a different layout and components for the forms of your application depending on the device where your application is running.

 

 

 
The Multi-Device Runtime Library and Power of Components
FireMonkey relies on a multi-device runtime library that includes threading and parallel programming support, file system access, local and remote database access for relational and noSQL databases, HTTP and REST client library, specific Cloud and BaaS clients, and components for directly accessing embedded devices like GPS, gyroscope, and Bluetooth systems. All of these features are exposed with ready-to-use components and work the same way across all supported platforms, so developers can write single source applications leveraging device capabilities and data connectivity. 
Platform Specific API Calls
One concern often expressed by application developers evaluating cross-platform solutions is that they focus on the ‘lowest common denominator’, and provide a black box to developers, so to speak. If a component is not provided, whether that is maps support or in-app advertising, developers are mostly shut out from adding that functionality into their application. This is not the case with FireMonkey.  We provide full-featured and very powerful libraries in their own right, as well as full access to the native platform if required.
For example, the FireMonkey framework does not provide a device info component for quickly querying the device name and OS version. Given that you can access the native platform APIs through both our JNI Bridge on Android and our Objective C Bridge on iOS, you’re not blocked from accessing this functionality.

Summary
  • Customers expect stunning UI and intuitive UX and their apps to be available on their favorite devices
  • Building separate UIs is one of the lengthiest processes in application design for multiple platforms. Using vendor tools and other cross-platform frameworks requires a lot of duplicated effort for each target platform - something C++Builder developers using FireMonkey do not face
  • UI Customization is easy thanks to the FireUI Multi-Device Designer
  • C++Builder provides a large number of built-in, ready-to-use components and a rich 3rd party ecosystem
  • Accessing platform specific APIs is easy with C++Builder
 
Ready to have a look? Start a free 30-day trial today.

Read More

RAD Studio 10.2.3 – Patches e outras informações

$
0
0

O RAD Studio 10.2.3 está disponível desde Março de 2018 e pode ser baixado através do ISO ou Web Installer (modo preferencial).

Logo após a release, alguns patches adicionais foram disponibilizados para usuários em manutenção, eis aqui uma lista atualizada de todos eles até o presente momento (17/05):

RAD Studio 10.2.3 Android Push Notification Patch RAD Studio 10.2.3 EMS Package Wizard Patch RAD Studio 10.2.3 Context Help Patch C++Builder 10.2.3 C++ Compiler 4k Stack Allocation Patch RAD Studio 10.2.3 iOS 11.3 Patch Delphi 10.2.3 RAD Server Linux Apache Patch

Vale também lembrar que usuários em manutenção da versão Professional passaram a ter acesso a todos os recursos e compiladores para desenvolvimento mobile. Todos os detalhes, inclusive sua instalação, podem ser encontrados aqui e aqui.

Entre as muitas novidades do 10.2.3 estão os novos templates para FireMonkey, você pode conhecer cada um deles neste post.

900px-FireMonkeyUITemplates

Para uma revisão de todas as novidades desta release, recomendo um review do What’s New, disponível neste link.

 

 


Read More

RAD Studio 10.2.3 – Parches y demás información

$
0
0

El RAD Studio 10.2.3 está disponible desde marzo de 2018 y se puede descargar a través de la ISO o instalador web (modo preferido).

Después de la liberación, algunos parches adicionales se pusieron a disposición de los usuarios en mantenimiento, he aquí una lista actualizada de todos ellos hasta el momento (17/05):

RAD Studio 10.2.3 Android Push Notification Patch RAD Studio 10.2.3 EMS Package Wizard Patch RAD Studio 10.2.3 Context Help Patch C++Builder 10.2.3 C++ Compiler 4k Stack Allocation Patch RAD Studio 10.2.3 iOS 11.3 Patch Delphi 10.2.3 RAD Server Linux Apache Patch

Es importante recordar que los usuarios en mantenimiento de la versión Professional pasaron a tener acceso a todos los recursos y compiladores para desarrollo móvil. Todos los detalles, incluida su instalación, se pueden encontrar aquí y aquí.

Entre las muchas novedades del 10.2.3 están las nuevas plantillas para FireMonkey, usted puede conocer cada uno de ellos en este post.

900px-FireMonkeyUITemplates

Para una revisión de todas las novedades de este release, recomiendo una revisión en el contenido del What’s New, disponible en este enlace.

 


Read More

TDBGridのカラム単位でIMEを制御する場合の確認ポイント

$
0
0

TDBGridで、ある列はデフォルトでIMEをONにしたい場合はIMEを制御したい列のTColumn.ImeModeを"imHira"などに設定します。

このようなケースで文字列を入力したら最初の1文字だけが入力されない場合があります。

もし、カラム単位でIMEを制御したい場合、TDBGrid.OptionsでdgAlwaysShowEditorを有効にして、インプレイスエディタを常に有効にしてみてください。

 


Read More

C++ with LINQ

$
0
0

I found an interesting C++ libraly.That is "LINQ for C++".

What's "LINQ"?

LINQ (Integrated Language Query) is a function of C#. LINQ issues a query to the container and gets the result.

For details, please refer to MSDN.

https://docs.microsoft.com/en-us/dotnet/csharp/linq/

LINQ for C++

"LINQ for C++" is the libraly enable to use LINQ on C++.

https://archive.codeplex.com/?p=cpplinq

Usage is simple. Just include the header file published on GitHub.

https://github.com/mrange/cpplinq

Using "LINQ for C ++" in C++ Builder, first make sure to use the new Embarcadero C++ compiler with project options.

#pragma hdrstop
#pragma argsused

#ifdef _WIN32
#include <tchar.h>
#else
  typedef char _TCHAR;
  #define _tmain main
#endif

#include <stdio.h>
#include <iostream>
#include "CppLinq/cpplinq.hpp"    

int computes_a_sum ()
{
  using namespace cpplinq;
  int ints[] = {3,1,4,1,5,9,2,6,5,4};

  return
      from_array (ints)
    >>  where ([](int i) {return i%2 ==0;})     // extract odd number
    >>  sum ()                                  // Summing extracted numbers
    ;
}


int _tmain(int argc, _TCHAR* argv[])
{
  std::cout << computes_a_sum() << std::endl;

  return 0;
}

The sum of the even numbers extracted from the array was output.

Many libraries can be used by using the new Embarcadero C++ compiler. please try it


Read More

Delphi 10.2.3 RAD Server Linux Apache Patch Released

$
0
0

As you have probably seen, Embarcadero has released a few patches for 10.2.3. I wrote about them at http://blog.marcocantu.com/blog/2018-april-10-2-3-patches-recap.html and there was a new one for iOS covered by Sarina at https://community.embarcadero.com/blogs/entry/rad-studio-10-2-3-ios-11-3-patch-available.

Yesterday, the compony released a patch that addresses a few critical issues when deploying RAD Server modules to Apache on Linux. The reported bug mentioned is not the key one, as the main issue was found and reported internally and not on Quality Portal. If you have any interest in deploying a RAD Server solution to Linux, this patch is a must have. 

The download is at  https://cc.embarcadero.com/item/30836 .

Just in case you missed is, remember that part of a RAD Studio. Delphi, or C++Builder Enterprise or Architect product, you now have the license to deploy a single RAD server instance without any further cost.


Read More

Delphi 10.2.3 [RAD Server Linux Apache]パッチリリース

$
0
0

この記事は、Marco CantuによるDelphi 10.2.3 RAD Server Linux Apache Patch Releasedの抄訳です。

弊社はRAD Studio / Delphi / C++Builder 10.2.3用にいくつかのパッチをリリースしました。そのことについて私(Marco Cantu)は下記URLに記事をポストしています。http://blog.marcocantu.com/blog/2018-april-10-2-3-patches-recap.html

また、Sarina DuPontがiOS対象とするパッチを紹介しています。https://community.embarcadero.com/blogs/entry/rad-studio-10-2-3-ios-11-3-patch-available-ja

 

先日、弊社はLinux上のApacheにRAD Serverモジュールを導入する際にいくつかの重大なIssueに対処するパッチをリリースしました。このIssueは、Quality Portalやコミュニティなどで報告されたバグではなく、内部的に主な問題が見つけられて報告されています。  RAD Server ソリューションをLinuxに導入することに関心がある場合は、このパッチは必要です。

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

上記URLからダウンロードしてご利用下さい。

RAD Studio / Delphi / C++Builder EnterpriseまたはArchitect製品を使用すると、追加のコストをかけずに単一のRAD Serverインスタンスのデプロイライセンスがご利用いただけます。
 


Read More

標準C++の進化

$
0
0

この記事は、David MillingtonによるEvolution of C++ standardsの抄訳です。

 

開発者にとってC++プログラミング言語は技術的なチャレンジできる、おそらく最も広く使われているコンパイル言語の1つであり、最もエキサイティングなものです。

「過去について知っていれば分かるほど、あなたは将来のために準備が整っています(the more you know about the past, the better prepared you are for the future)」(Theodore Rooseveltの誤た引用)、C++の歴史とそのコーディング、昨今の様子を見てみましょう。 

C++は1979年にBjorne Stroustrupによって始められたC言語拡張からGrew Outしたことを多くC++ユーザーは知っていると思います。そして、もともと「C with classes」をCにコンパイルした最初のC++コンパイラ、Cfrontを知っているかとおもいます。Cfrontは 複雑すぎてC言語でコンパイルできないため削除となりました。そして急速に変化し今やC++17, C++20が言語標準で、1998年には最初の標準が公開されるまでに20年ほどかかりました。

C++標準の歴史とC++Builderが今日どこに対応しているのかを見てみましょう。

 

 

Standardization

何年もの間、C++の事実上の標準は書面形式ではなく、Cfrontコンパイラの形であった。それがコンパイルされていれば、それは有効なC++でした。

1985年にStroustrupは、The C++ Programming Languageを出版しました。これは今でもC++のリファレンスブックと見なされています。これによりAT&T C++のデファクトスタンダードとなるCfrontが増えました。これは、1990年にThe Annotated C++ Reference Manualに置き換えられました。言語は、言語仕様を定義する単一の個人またはグループによって「所有」されることが多く、1つのグループがコンパイラとライブラリを所有している場合、オープン仕様は必要ありません。複数の実装が存在する場合は、共通の共通仕様が互換性のために不可欠です。 先見的かつ謙虚な動きで、Stroustrupは国際標準化機構(ISO)に引き渡しました

では、どのようにしてコンパイラやリファレンスブックからISO標準化に至ったのでしょうか?

1990年頃に数多くの出来事がありました:

  • - The Annotated C++ Reference Manualがリリースされました。
  • - C++Builderの祖先であった Turbo C++がリリースされ、「C++の開発にかなりの影響を及ぼすライブラリが追加されました」
  • - 同月、最初のANSI C++会議が開催されました
  • - 1991年、最初のISO C++会議

その年は大きな進歩でした。

それ以降、C++の標準化された5つの仕様がリリースされています。

 

The First Standard: 1998

最初のISO C++標準は1998年にリリースされました。今や多くの大学が、基本的なC++を学んでいます。

それは、STLを含む、C++の機能のベースラインでコード化しました:RTTI、dynamic_cast、多くのテンプレート機能などがあります。(これらの多くは事実上1998年以前に広く使用されていました。)

言語とサポートライブラリを別々と見なす多くの人々を驚かせますが、今ではC++標準の多くは言語そのものではなく、標準ライブラリとそのビヘイビアです。

2003年に標準がC++03に更新されました。(目ざといの読者は、C++98が1998年とC++03が2003年からの日付を記していることに気づいたかもしれませんが、この2桁の年式命名規則は今日も続いています。)標準に深く掘り下げない限り、C++98とC++03は事実上同じものとみなされます。 C++03はC++98のいくつかの問題を解決しますが、言語を使用するプログラマにとっては、コアは1998年の標準で定義されています。

 

Fast-forward to Standard #3: C++11

C++03は強力な言語仕様ですが何年もの間、言語は新しい重要な改訂を伴わずに停滞しているとみなされました。 (C++03はマイナーチェンジだったことを忘れないでください)

イノベーションはライブラリからのドリブンで、特にBoostとテクニカルレポートライブラリによって推進され、どちらも標準化委員会と密接に関連していました。2000年代後半と続き、2011年8月に変更され、最終的に想像上の名前のC++11標準がリリースされました。

C++11は多くのコア機能をももたらしました。 その中には、lambdas (function objects), type inference (auto keyword), constexprなどがあります。 現在、C++BuilderはWindows、iOS、Android用のC++11をサポートしています。

2014年にC++14がリリースされました。 C++14はC++11への段階的な更新を行いましたが、新しいライブラリ機能だけでなく、いくつかの新機能ももたらしました。 

C++11(modern C ++)は、特に洗練されたC++14形式で、C++開発のルネッサンスを推進しました。言語機能と新しい標準に関する現在の盛り上がりは、このバージョンのC++の成功と、委員会のリーダーシップと方向性の実証によって主に推進されています。以前のように、言語は早い進歩に戻ると見なされました。

 

Standard #5: C++17

C++11、C++14以降のC++関心の復活以来、委員会は言語をさらに改善するために迅速に動いています。

この結果C++17は、昨年12月に次の大きな改訂版となりました。

 C++17の新しい変更 including template deduction of constructors, inline variables, preprocessor directives for checking header availability, improved constant evaluation for template arguments, parallel STL algorithms, a union type (std::variant), その他多くのライブラリ改善 std::string_viewなど。Anecdotally、string_viewは、プログラミングフォーラムで最も議論されているC++17のトピックの1つです。

 

 

C++Builder言語サポートイノベーション

C++Builderの現状

C++Builderの祖先製品であるTurbo C++とBorland C++は、C++の基盤、STLの開発、および標準の最初の改訂の鍵でした。

現在、C++Builderは最新のC++11をサポートしており、C++17への対応は開発中です。C++Builderは、オブジェクトメソッドポインタ(std::funcとstd::bindのフレキシブルな組み合わ)を取得するための__closureやオブジェクトの論理的で非論理的、non-field-backedなオブジェクトを抽象化するための__propertyなど、 フィールドベースのプロパティ - メソッドによってサポートされ、デフォルト値を持ち、RTTIのリフレクションとストリーミングに使用できます。もちろん、これらの言語機能は完全にオプションで、必要に応じて純粋なC++を使用できます。これらの拡張機能は、弊社の最も強力なライブラリのいくつかを有効にし、GPUアクセラレーションされたクロスプラットフォームのUIフレームワークであるFireMonkeyや必要なデータベースをすべてサポートする非常にエレガントなクロスプラットフォームのデータベーステクノロジーであるFireDACと組合せて動作します。 アプリのコミュニケーション、ビジュアルデザインなどのための多くの他のフレームワークと機能が含まれています。 

以下のリンク先のリファレンスでC++の歴史についてもっと学ぶことができます。また、C++Builderの30日間の無料トライアルを今すぐ開始することもできます。

 

References

 


(*) Rooseveltの言葉一般的に使われているのは、 'The more you know about the past, the better prepared you are for the future.' ですが、引用ソース源はたぶんこれ 'Full knowledge of the past helps us in dealing with the future.' -- The Progressives, Past and Present (1910).

 

 

 


Read More

Using an IDE: Getting back to code faster

$
0
0

A C++ IDE or an Integrated Development Environment is application development software written to give you a way to create or write C++ applications and programs. There is usually a single interface that incorporates all the tools you need to develop applications including:

  • Compiler
  • Debugger
  • Code Editor
  • UI Designer
  • Documentation

While some developers believe that you don’t necessarily need an IDE to write your applications they do have some exceptional common features that can prove beneficial. With an IDE, you have the added benefits of useful tools like syntax highlighting, linking, code insight, class browsers, intelligent code completion, documentation and so much more.

IDEs allow for a more comprehensive or integrated systems methodology that expands your application model. When you change a method and a series of red lines appear in your code, then you know that somewhere, something broke and you can easily navigate to find it. Using an IDE can provide you with control over each element in your application, as you are able to design your front-end to function with your backend and still have users not hate the experience.

Why C++ Devs should use IDEs

The number of C++ IDEs available now from Freeware to Proprietary is only second to the Python IDEs out there. When we write our applications in C++, we aren’t just writing and testing code for some application. We choose C++ for a reason. We want the portability. We want performance and speed. We want the power and control that comes with this language and it’s libraries as well as the ability to sufficiently debug our code. All properties or features that are incorporated into an IDE. Some other reasons C++ developers use IDEs include :

UI Design

With the rise in significance on UI design and user experience, we know that to develop great applications we can’t just look at the speed and performance, we have to have some way to generate (aesthetically pleasing) UIs. IDEs typically have great support for visual libraries that allow for you to couple your code to a front end user interface seamlessly for multiple targets. What’s more, you don’t have to start or compile your application just to see what it’s going to look like, so you can spend more time working on the backend and still have a good looking UI and if you happen to like UI, then by all means, spend more time developing the layout and styles for your application across a variety of different devices.

Cross-platform

With businesses and services taking to IoT, MEAP and BYOD, the significance of mobile development is enormous today.  As C++ developers, we want to spend our time developing effective code for our apps but the idea of having to work with multiple different languages to develop an application can be quite tedious, especially when we give each platform. Many IDE’s allow for cross-platform support, the ability to write your code, design the UI and deploy to multiple target platforms like Windows, Android, iOS and MAC OS with less steps.  

Frameworks

Even though an IDE provides all the features required for your projects, you can integrate other tools. The process of writing code isn’t too difficult for programmers, it’s in the libraries that you choose, the tradeoff in specific algorithms that have to be implemented, and making sure that you can test connections to outside or external systems. Pre-built frameworks, such as VCL,  for expansive native Windows controls or cross-platform controls like FireMonkey (FMX) and data frameworks that allow you to connect to a multitude of databases natively, allow you to build high quality and high performance applications without sacrificing your underlying application code.

Benefits of using an IDE

The main goal and benefit to an IDE is increasing productivity. This is the typical answer from most people give when speaking to the reasons why a Software Developer should use an IDE, but it is true. Each IDE incorporates editor features with components or easy to install wizards that allow you to quickly add some new functionality to your application.

There are many other well known advantages, that I haven’t mentioned, of using an Integrated Development Environment to write your applications.

  • Code Insight
  • Easier to navigate through your or others’ code. Especially when tied to a user interface.
  • Allows you to continually  learn what’s going on in the community and evolve your best practices. You continually learn and stay up to date
    • With any programming language, we always look to the community, the larger a community the more support you can get. Typically IDEs will add new features that just show up with new release installations and convince you to use them by incorporating videos, new samples, community events and such into a welcome page.
  • Project Management : The ability to write/use single files, add them to a project, compile and see them in a logical window. The list of files and forms grouped into the project are easily accessible and you can perform many of the important tasks needed to run your files like compiling and cleaning builds.

When you build software that you want to distribute, there is so much more that goes into software development. You have to create visual behaviors and install scripts, figure out deployment mechanisms, create license files, add in bug reporting tools, provide content to your tech writers… and that’s only a slice of the list in the ever-evolving SDLC.

The greatest strength of an IDE is not only in your ability to write your code, debug, and test your applications, but in the integration of your editor, compiler, debugger and visual designer in one environment that makes the overall process of developing great C++ software faster. Just be sure to use the development environment that makes you and your team the most productive for the task at hand.


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

Read More

IDE利用でC++の生産性向上

$
0
0

この記事は、MT KellyによるUsing an IDE: Getting back to code fasterの抄訳です。

 

C++IDE(統合開発環境)は、C++アプリケーション作成やプログラムコーディングを提供するためのアプリケーション開発ソフトウェアです。アプリケーションを開発するために単一のインタフェースで必要なすべてのツールが組み込まれています:

  • Compiler
  • Debugger
  • Code Editor
  • UI Designer
  • Documentation

 

一部の開発者は、アプリケーションを書くのに必ずしもIDEが必要というわけではありませんが、有益であると思われるいくつかの例外的な共通の機能があります。IDEを使用すると、構文強調表示、リンク、コード・インサイト、クラス・ブラウザー、インテリジェント・コード補完、文書化などの便利なツールが追加されます。

 

IDEは、アプリケーションモデルを拡張でき、より包括的(統合システムメソドロジ)を可能にします。メソッドを変更すると、コードに赤い線が表示され、どこかで何かが壊れてしまい、簡単に見つけることができます。IDEを使用すると、アプリケーションの各要素を制御できます。バックエンドでのファンクションをデザインする場合でもフロントエンドでを設計でき、利用者に苦痛の無いエクスペリエンスが可能です。

C++開発者がIDEを使うべき理由

FreewareからProprietaryまで利用可能なC++IDEの数は、そこのPython IDEに次ぐ第2位です。C++でアプリケーションを作成する場合、アプリケーションのコードを記述しテストするだけではありません。ポータビリティ、パフォーマンスとスピード、その言語とライブラリそしてそのコードを十分にデバッグできる機能を求めています。そのすべてがIDEに機能として組み込まれている。C++開発者がIDEを使用する理由:


UIデザイン

UIデザインとユーザーエクスペリエンスの重要性が高まるにつれて、スピードとパフォーマンスだけでは良いアプリケーション開発とはいえません。(Aesthetically pleasing)UIを生成するには何らかの方法が必要です。IDEは複数ターゲットに対してコードをフロントエンドのユーザーインターフェイスにシームレスに結合できるビジュアルライブラリを強力にサポートしています。さらに、アプリケーションを起動またはコンパイルしてわざわざアプリケーションの外観を確認する必要がないため、バックエンドで作業するのに多くの時間を費やすことができます。また、UIが好きであれば是非さまざまなデバイス間でアプリケーションのレイアウトとスタイルを開発するために、より多くの時間を費やしてください。

 

クロスプラットフォーム

昨今では、企業やサービスが IoT・MEAP・BYODを利用するのが必然となり、モバイル開発の重要性がさらに深まりました。C++開発者としては、アプリケーションに効果的なコードを開発するために時間を費やしたいと考えていますが、複数の言語を使用してアプリケーションを開発するというアイデアは、特に各プラットフォームに与えると非常に面倒です。多くのIDEでは、クロスプラットフォームのサポート、コードの記述、UIの設計、Windows・Android・iOS・macOSなどの複数のターゲットプラットフォームへの展開が可能です。

 

フレームワーク

IDEはプロジェクトに必要なすべての機能を提供しますが、他のツールを統合することもできます。コーディングに関しては、プログラマーにとってはそれほど難しくありません。選択したライブラリと、具体的なアルゴリズムのトレードオフが必要です。そして外部またはエクスターナルシステムへの接続テストできることの確認が必要です。豊富なネイティブWindowsコントロールや、FireMonkeyなどのクロスプラットフォームのコントロールや、多数のデータベースにネイティブに接続できるデータフレームワーク用の、VCLなどの事前構築されたフレームワークにより、高品質で高性能のアプリケーションを構築することができ、ユーザーコードでの記述時間を犠牲にすることはありません。

 

Benefits of using an IDE

IDEの主なゴールとベネフィットは、生産性の向上(increasing productivity)です。これは、ソフトウェア開発者がIDEを使用すべき理由を話すときに、ほとんどの人が話す典型的な答えですが、そのとおりです。IDEには、ウィザードに簡単にコンポーネントをインストールできるため、アプリケーションに新しい機能をすばやく追加できます。私が言及していない他の多くのよく知られている利点は、統合開発環境を使ってアプリケーションを書くことです。

 

  • コードインサイト
  • あなたのコードや他者のコードを簡単にナビゲートできます(特にユーザーインターフェースに結びついている場合)。
  • コミュニティで継続的に学習し、ベストプラクティスを進化させることができます。 つねに情報をアップデートできます。
    • どんなプログラミング言語であれ、常にコミュニティーを検索します。コミュニティーが大きくなればなるほどより多くの情報が取得できます。通常、IDEには新しいリリースのインストールで表示される新機能が追加され、ビデオ、新しいサンプル、コミュニティイベントなどをウェルカムページに組み込むことで使用することもできます。
  •  プロジェクト管理:単一のファイルを作成/使用し、プロジェクトに追加し、コンパイルして論理的なウィンドウで表示する機能。プロジェクトにグループ化されたファイルやフォームのリストは簡単にアクセスでき、ビルドのコンパイルやクリーニングなど、ファイルを実行するために必要な多くの重要なタスクを実行できます。 

 

あなたが配布したいソフトウェアを構築するとき、ビジュアルビヘイビア・インストールスクリプト・デプロイメント・バグツール・テクニカルコンテンツなどを提供することになります。それはSDLCリストの一部でしかありません。

 

IDEの最大の強みは、コードを書く、デバッグする、アプリケーションをテストすることだけでなく、エディタ、コンパイラ、デバッガ、ビジュアルデザイナを1つの環境に統合することで、優れたC++ソフトウェアの高速化 開発環境を使用して、チームの作業にとって最も生産的であることです。

 

VCLやFMXを含むこれらの機能をすべて備えたC++BuilderのIDE 30日間の無料トライアルで、素晴らしいパフォーマンスを実現しましょう!




Read More

RAD Server Solution Series: [Field Service Application]

$
0
0

Solution Name: RAD Server Field Service Application - Delphi

Industry: Field Service

Solution Overview: The RAD Server Field Service Industry Template provides an end-to-end field service application template for routing appointments, managing parts, and user administration. It is made up of a REST server module, a desktop client, and a cross platform mobile client. 

How to download: Available through GetIt (Tools > GetIt Package Manager > Industry Templates) in RAD Studio 10.2.

 

Setup Instructions: A Quick Start Guide and a detailed setup document are included with the sample project.

Overview:

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

The Field Service Template consists of a RAD Server backend connected to an InterBase database. RAD Service provides REST endpoints which both the Field Service Admin and the Field Service App connect to for performing CRUD operations. Additionally, there is a Field Service Setup app which you will run on the same machine as RAD Server to setup the Field Service Template database and sample data.

  • Field Service Admin
  • Field Service App
  • Field Service Server (RAD Server)
  • Field Service Setup

 

You should deploy and run the projects in the following order:

1. RAD Server Dev Server needs to be running for the Field Service Setup app to connect to and create the user accounts.

2. Field Service Setup app will help you set up your database, the tables and data, and your EMS user accounts.

3. Field Service Server is a RAD Server side REST resource which both the Admin client and the App client interface with. It should be deployable on Windows and Linux through IIS, Apache, or the stand alone RAD Server (EMS) server.

4. Field Service App is a RAD Studio FireMonkey based client application for Android, iOS, macOS and Windows. The client application should allow you to select a tenant from your RAD Server and then log in as a user. Once logged in it will download the sample appointment and parts data for your current tenant and allow appointments to be completed. Once an appointment is complete it can be submitted back to the server if there is internet access. If the Field Service App is offline it will save the changed data until it is online again.

5. Field Service Admin is a RAD Studio FireMonkey based client application designed for desktops on Windows and macOS. The Admin app can be used to create and edit appointments, view completed appointments, create and edit parts, and create and edit users.

 

We also have two other RAD Server Industry Templates, available in the GetIt Package Manager in Delphi and RAD Studio 10.2 Tokyo Enterprise and Architect edition:

RAD Server Solution Series: [Hospitality] Restaurant Survey Application

RAD Server Solution Series: [Healthcare] Nurses Station

 


Read More

A new mutlti-threading library for Delphi. (darkThreading)

$
0
0

My regular readers may be aware that over the past two or three months, I’ve been working on building a new video game engine for Delphi. I’ve also had many other demands on my time, which has meant that I’ve not posted in a while. Today however, I got to the point in the game development project that I’m able to release another of it’s sub-components as an open source library for Delphi. I’d like to introduce you to darkThreading.

Introduction

Many multi-threading or parallel programming libraries adopt a task model. In such a model, the main thread prepares a number of tasks and throws them at a pool of threads to be executed. This model works very well in most cases, but there are some cases in which it is not ideal. The game engine project is such a case.

A video game engine has many components which run constantly, throughout the lifetime of the game process. For example, a typical game might have an audio component which is responsible for playing the chilling foot-steps sounds as a foe approaches you in the game. The problem for a task based threading model is that often the hardware components or drivers, such as the audio system, expect your application to acquire a context to use them, and those contexts are often restricted to a single thread. In a task based model, the game system would either need a separate audio context for each thread in the thread pool, or else it would need to acquire a new context each time foot steps are to be played. Grabbing and freeing contexts is not good for performance, and so a better model is needed.

The darkThreading library solves this problem by providing a number of long-running threads, each of which may be dedicated to a particular function, such as playing creepy footstep sounds. During the periods that the threads aren’t needed, they can be ‘put-to-sleep’ in such a way that they aren’t consuming CPU cycles, and those cycles may be given over to another system which needs them. The darkThreading library retains the thread, and therefore any associated hardware contexts, and the thread may then simply be woken when it is needed.

darkThreading in more detail.

Like most multi-threading libraries, darkThreading provides a few ‘primitives’, that is classes for working with concurrent execution, which you can use to make your code thread safe.

ICriticalSection
The Critical Section uses a mutex (mutually exclusive) lock to ensure that a particular piece of code may only be executed by a single thread at any time. ISignaledCriticalSection
A Signaled Critical Section performs the same task as a Critical Section, but after the lock has been aquired, the exclusive running code may put the executing thread to sleep. While this thread is asleep it is removed from the operating system scheduling and therefore not consuming CPU cycles. Any other thread may then call on the ‘Wake’ method to wake the executing thread back up. IAtomicRingBuffer
An atomic ring buffer uses an atomic variable (a variable that may only be written to by a single thread at a time) to provide a buffer which can safely copy data from one running thread to another. The ring buffer is uni-directional, in that only one thread may copy data in, and only one (other) thread may copy data out of the buffer at any time. IThreadMethod
A thread method is a class which repeatedly calls a specified method from within a thread. This primitive is the basis of all threads in the darkThreading library.

darkThreading also provides a thread pool system for starting up multiple threads.

IPoolThread
A pool thread is a class that will be executed by a single dedicated thread within a pool of threads. IThreadPool
A thread pool is a collection of IPoolThreads, each of which will be executed in it’s own dedicated thread.

Where darkThreading differs from many threading libraries is in it’s more specialized classes and types…

TMessage
Is a record representing a message (not unlike the windows API messages) that may be transmitted between sub-systems (see IThreadSubSystem) running on different threads. IMessageChannel
A message channel is owned by a single thread, and is used by that thread to listen for messages from other threads. Other threads are able to send messages into the channel through the use of message pipes. Any one channel may have multiple message pipes, making the channel a multi-sender single-receiver messaging system. IMessagePipe
A message pipe is owned by a single thread and used to send messages into a message channel which is owned by another thread. Multiple threads may each own their own pipe to the target channel. IMessageBus
The message bus is simply an aggregating interface to combine the functionality of IMessagePipe and IMessageChannel instances. The message bus interface provides access to the methods of each of the other interfaces. IThreadSubSystem
A thread sub system is a slightly more advanced form of IPoolThread. It is a long running task which may be installed into an IThreadSystem to be executed. Unlike IPoolThread the IThreadSubSystem is able to be run in round-robin alongside other sub systems on the same thread. When sharing a thread, the IThreadSubSystem is expected to be cooperative and yield it’s free run-time to other subsystems. IThreadSubSystem also has access to the messaging system, allowing subsystems to communicate using the messaging interfaces. IThreadSystem
A thread system is a more advanced form of thread pool (IThreadPool). It is a collection of IThreadSubSystem instances which run on a pre-determined number of threads. IThreadSystem provides its sub systems with access to the messaging system.

How to use it?

The documentation for darkThreading is still in need of a little work (which will happen soon!), but it does come with several sample applications to demonstrate it’s features. For the moment, if you’re not sure how to make use of the library, please be patient for documentation updates and a follow up blog post with more details.

How to get it?

That’s the best bit. Like all of the components of the darkGlass game engine, darkThreading is free to use as you see fit under the MIT license. You can clone your own copy right from GitHub: https://github.com/chapmanworld/darkThreading

Conclusion

Watch out for my next post on darkThreading. In which I’ll write a sample application with you, and give updates on the documentation changes.
Meanwhile, feel free to experiment and get in touch if you have questions.

Thanks for reading!


Read More

Delphi用の新しいマルチスレッドライブラリ(darkThreading)

$
0
0

この記事は、Craig ChapmanによるA new mutlti-threading library for Delphi. (darkThreading)の抄訳です。

ご存知の方もおられるかとおもいますが、私は、過去2〜3ヶ月間、Delphiの新しいビデオゲームエンジンの開発に取り組んでいました。また、その要求にたくさんの時間がかかりました。そのため、しばらくblogを投稿できませんでした。しかし、ゲーム開発プロジェクトの中で、別のものをDelphi用のオープンソースライブラリとしてリリースすることができました。darkThreadingを紹介したいと思います。

 

Introduction

多くのマルチスレッドまたは並列プログラミングライブラリは、タスクモデルを採用しています。このようなモデルでは、メインスレッドはいくつかのタスクを準備し、それらを実行するスレッドプールにスローします。ほとんどの場合このモデルを採用し非常にうまく機能しますが、理想的ではない場合もあります。ゲームエンジンプロジェクトはそのようなケースです。

ビデオゲームエンジンは、ゲームプロセスのライフタイムで常に実行される多くのコンポーネントを備えています。例えば、典型的なゲームではプレイ中、敵が近づくにつれて冷たい足踏み音を鳴らすオーディオコンポーネントがあるかもしれません。タスクベースのスレッドモデルの問題は、オーディオシステムなどのハードウェアコンポーネントやドライバがアプリケーションでコンテキストを取得してそのコンテキストを使用することが多く、単一のスレッドに制限されることが多いことです。タスクベースモデルでは、ゲームシステムスレッドプール内の各スレッドに対して別々のオーディオコンテキストを必要とするか、足踏みステップが再生されるたびに新しいコンテキストを取得する必要がある。コンテキストを取得して解放することは、パフォーマンス的にあまり良くないのでより良いモデルが必要です。

darkThreadingライブラリは、長時間実行される多くのスレッドを提供することでこの問題を解決します。それぞれのスレッドは、不気味な足音を鳴らすなど、特定の機能に専念することができます。スレッドが必要でない期間は、CPUサイクルを消費しないように「スリープ状態にする」ことができ、それらのサイクルを必要とする別のシステムに渡すことができます。darkThreadingライブラリは、スレッド、したがって関連するハードウェアコンテキストを保持し、スレッドは必要なときに単に呼び出されることがあります。

 

darkThreading詳細

一般的なマルチスレッドライブラリと同様に、darkThreadingはいくつかの「primitives」を提供しています。これは同時実行で動作するクラスで、コードスレッドを安全にするために使用できます。

ICriticalSection

クリティカルセクションは、相互排他的なmutexロックを使用して、特定のコードがいつでも1つのスレッドによってのみ実行されるようにします。

 

ISignaledCriticalSection

Signaledクリティカルセクションは、クリティカルセクションと同じタスクを実行しますが、ロックが取得された後、排他実行コードは実行スレッドをスリープ状態にすることがあります。このスレッドがスリープしている間は、オペレーティングシステムのスケジューリングから削除され、CPUサイクルを消費しません。その後、他のスレッドは、「Wake」メソッドを呼び出して、実行中のスレッドを復帰させることができる。

IAtomicRingBuffer

アトミックリングバッファは、ある実行中のスレッドから別のスレッドにデータを安全にコピーできるバッファを提供するために、原子変数(一度に1つのスレッドによってのみ書き込まれる変数)を使用します。 リングバッファは単方向であり、1つのスレッドのみがデータをコピーし、唯一の(他の)スレッドはいつでもバッファからデータをコピーすることができる。 

 

IThreadMethod

スレッドメソッドは、スレッド内から指定されたメソッドを繰り返し呼び出すクラスです。 このprimitiveは、darkThreadingライブラリのすべてのスレッドの基礎となります。

 

darkThreadingは、複数のスレッドを起動するためのスレッドプールシステムも提供します。

IPoolThread

プールスレッドは、スレッドプール内の単一の専用スレッドによって実行されるクラスです。 

 

IThreadPool

スレッドプールはIPoolThreadsの集合であり、各スレッドは自身の専用スレッドで実行されます。

 

darkThreadingが多くのスレッドライブラリと異なるところは、もっと特殊なクラスと型です...

 

TMessage

異なるスレッドで動作するサブシステム(IThreadSubSystem参照)間で送信される可能性のあるメッセージ(Windows APIメッセージとは異なります)を表すレコードです。 

 

IMessageChannel

メッセージチャネルは単一のスレッドによって所有され、他のスレッドからのメッセージを受信するためにそのスレッドによって使用されます。 他のスレッドは、メッセージパイプを使用してメッセージをチャネルに送信することができます。 どの1つのチャネルにも複数のメッセージパイプがあり、チャネルを複数送信者のシングルレシーバメッセージングシステムにすることができます。

 

IMessagePipe

メッセージパイプは単一のスレッドによって所有され、別のスレッドが所有するメッセージチャネルにメッセージを送信するために使用されます。 複数のスレッドがそれぞれ独自のパイプをターゲットチャネルに所有している場合があります。 

 

IMessageBus

メッセージバスは、単にIMessagePipeインスタンスとIMessageChannelインスタンスの機能を結合するための集約インタフェースです。 メッセージバスインタフェースは、他の各インタフェースのメソッドへのアクセスを提供します。 

 

IThreadSubSystem

スレッドサブシステムは、IPoolThreadのやや高度な形式です。 これは、実行されるIThreadSystemにインストールされる長時間実行されるタスクです。 IPoolThreadとは異なり、IThreadSubSystemは、同じスレッド上の他のサブシステムとともにラウンドロビンで実行することができます。 スレッドを共有する場合、IThreadSubSystemは協調的で、他のサブシステムに対してはフリーランタイムを提供することが期待されます。 IThreadSubSystemはメッセージングシステムにもアクセスできるため、サブシステムはメッセージングインターフェイスを使用して通信できます。 

 

IThreadSystem

スレッドシステムは、スレッドプール(IThreadPool)のより高度な形式です。 これは、あらかじめ決められた数のスレッドで実行されるIThreadSubSystemインスタンスの集合です。 IThreadSystemは、サブシステムにメッセージングシステムへのアクセスを提供します。

 


利用方法

darkThreadingのドキュメンテーションにはまだ少しの作業が必要です(これは間もなく行われます)が、機能のデモを行うためのサンプルアプリケーションがいくつか付属しています。 現時点では、ライブラリの使用方法がわからない場合は、ドキュメントの更新や詳細については、ブログの投稿を参照してください。

 

ダウンロード

That’s the best bit.

darkGlassゲームエンジンのすべてのコンポーネントと同様に、darkThreadingはMITライセンスに適合するように自由に使用できます。 GitHubから自分のコピーを複製することができます:https://github.com/chapmanworld/darkThreading

 

Conclusion

darkThreadingに関する次回ポストするブログの記事をご覧ください。 ここでは、サンプルアプリケーションを書いて、ドキュメントの変更についての最新情報を提供します。

一方で、質問があればトライして連絡を取ってください。

 

Thanks for reading!

 

 


Read More

Desktop Development on Windows and Delphi VCL Library

$
0
0

Despite all the push for web and mobile development, which are certainly growing a lot, Windows desktop development is far from death. In fact, at the recent Build 2018 conference Microsoft reported that over the last year the developers using Visual Studio for building desktop applications has doubled. On our side, we know the the majority of the RAD Studio customers are still maintaining a lot of Windows applications and building many new ones.

Windows Desktop: A Moving API Target

Over the years, Microsoft has been shifting the Windows platform. The original C-language API (often indicated as Win32, even if a Win64 counterpart exists), was augmented many years back with COM interfaces (mostly around desktop and shell integration). This never fully took off. At one point, it seems the "object-oriented Windows core" was going to be based around .NET, but that never happened either, as the core Windows OS remains written in C/C++ and fully native.

Starting with Windows 8, and more fully in Windows 10, Microsoft has added a new core to Windows, known as WinRT. This is a complete overhaul of the system API, with an OOP layer (almost binary compatible with COM), covering applications management, the file system, integrated devices, desktop integration, a complete new set of platforms controls (the first one after the original Windows 1 user.dll controls like edits and buttons). While this is a big leap forward, adoption has been tepid, as regardless of your current language and development tools you'd have to do an almost complete rewrite -- and the resulting applications won't run on the still popular Windows 7.

Seeing the limited adoption of WinRT, Microsoft has decided to improve the compatibility of the old and new world, introducing the Desktop Bridge (aka Centennial) and at the last Build conference highlighting a plan of full integration, with the ability for Win32 applications to host WinRT UI controls. This technology is called UWP XAML Islands and will become available in future versions of Windows.

The Confusing Microsoft Stack for Desktop UI

Along the same period of time, Microsoft has introduced several different UI libraries. With .NET they first introduced WinForms (which offers a layer on top of the Win32 API, similarly to the VCL). After that, they started pushing .NET developers towards XAML markup in WPF (Windows Presentation Framework) and its light, web-oriented twin, Silverlight. These are .NET libraries in which controls are painted on screen using optimized graphic libraries, in a fashion similar to what FireMonkey does.

As mentioned, more recently Microsoft has been pushing the WinRT UI, which differently from WinForms and WPF is not a .NET library, but a core platform library written in C++ library. You can program for WinRT with C# and .NET, but also in JavaScript, directly in C++ and in Delphi, as we'll see. However, again, this new platform requires an almost complete rewrite of your applications.

When I ask the many friends I have on the Microsoft side, the question: which UI framework to target is the one with the most diverse answers, and many "don't know for sure". This is a summary from Tim Anderson, a very good observer of the Microsoft development stack: https://www.itwriting.com/blog/10182-which-net-framework-for-windows-uwp-wpf-or-windows-forms.html.

After the Build conference, Tim was very happy to see a new focus on desktop and wrote:

"With Windows 10 and changes like these Microsoft is acknowledging that Win32 is still hugely important to developers, the industry, and to their platform. They are making Win32 a first class citizen on Windows again. Basically we held the course of what developers wanted, and now Microsoft is finally acknowledging that and circling back around. This does represent a good sized R&D investment to take full advantage of these new APIs and controls. In the short term developers can use the APIs and controls manually, but ideally we should update our shipping controls to "light up" automatically with these new features on Windows 10."

You can find the full text, a very interesting read for anyone doing Windows development, at https://www.itwriting.com/blog/10687-what-is-happening-with-desktop-development-on-windows-and-will-wpf-be-upgraded-at-last.html

And Where is the Delphi and the VCL in All This?

Now comes the interesting part, at least for me. Delphi started in the native camp, was lured into the temptation of shifting to .NET, and got back squarely into the native world -- which is now becoming fashionable again (see the push towards C++, even on desktop). In terms of UI libraries, the VCL has always been considered the best wrapper on top of the native Windows API. Compared to MFC and WinForms, there was never really a context. Moreover, Delphi and VCL offer a much better encapsulation of the COM layer on Windows, both for consuming objects and publishing them. And recently Delphi started offering a great and smooth encapsulation of the WinRT APIs, directly mapped to interfaces and other core language features.

Among all of the libraries mentioned (with the exception of the very limited MFC) only the VCL offers long term support for your code investments. An application build 15 or 20 years ago can still be maintained and updated for Windows 10, while someone following Microsoft trends would have rewritten it 3 or 4 times with WinForms, WPF, Silverlight, and WinRT.

Compatibility with old code is nice, but that's true also for legacy libraries and tools. But that's not the case for VCL. The library has a styling architecture to modernize the UI, it offers new UI controls mimicking the WinRT look and feel (written in pure VCL, so you can use them also on Windows 7), and it offers WinRT API encapsulation and ready to use components for Windows 10 only features like notifications and sharing. This means that with a limited effort you can make sure your application looks modern and behaves properly on Windows 10. While there are still gaps, Embarcadero has been also investing in layout management, HighDPi support, multi-monitor support, and many other features that are becoming increasingly important on today's desktop Windows computers. We can certainly do more (and have new features and more quality in the works right now), but we are ahead most other solutions.

Finally, Delphi (and C++Builder) VCL applications support APPX format deployment via Desktop Bridge, so you can publish them on the Windows Store (the RAD Studio IDE integrated support for Desktop Bridge is still much easier to sue than the Visual Studio counterpart). 

Is VCL Today the Best Windows Desktop Library?

I really think it is, but I fully understand your mileage might be different. Native optimized applications, very fast to load, with multi-core CPUs support, integration with all Windows APIs, not to mention the large number of great third party VCL UI controls. There are a lot of reasons start new desktop applications development in VCL today, maybe even more than in the past given Microsoft renewed focus on native desktop applications.


Read More

Tech Tipp #13: Rechnen mit InterBase

$
0
0

Frage: Ich mache Berechnungen beim SELECT Statement von InterBase. Zum Beispiel (Standard EMPLOYEE Datenbank; nur als Beispiel)

SELECT TOTAL_VALUE, TOTAL_VALUE*1.19 AS RESULT FROM SALES

Das funktioniert auch so weit, so gut!

Dazu habe ich zwei Fragen

(i) Wie wird die Anzahl der Nachkommastellen festgelegt? Beispiel: Wenn ich (oBdA) ein

SELECT DISTINCT 1/3 AS DRITTEL FROM SALES

ausführe kommt da "0" raus?

(ii) Früher hat das funktioniert!

Antwort: Das ist erstmal abhängig vom Dialekt (DIALECT) von InterBase und der (internen Darstellung von Dezimalzahlen)

Mit dem heute (üblichen) DIALECT 3 ist die Anzahl der Nachkommastellen die Summe der Nachkommastellen in der Berechnung.
Beispiel

SELECT DISTINCT 1.000/3.0 AS DRITTEL FROM SALES

hat in Summe 3+1=4 Nachkommastellen. Also hat das Ergebnis auch 4 Nachkommastellen:

0,3333

Das sollte man unbedingt bei seinen Berechnungen berücksichtigen

Beim DIALECT 1 war das noch anders.

Siehe auch

http://docwiki.embarcadero.com/InterBase/2017/en/Migrating_Databases_to_Dialect_3
http://docwiki.embarcadero.com/InterBase/2017/en/Fixed-decimal_Data_Types

 

 


Read More

RAD Server 製品[フィールドサービスアプリケーション]

$
0
0

この記事は、Sarina DuPontによるRAD Server Solution Series: [Field Service Application]の抄訳です。

ソリューション名:RAD Server Field Service Application - Delphi

業種:フィールドサービス

 

ソリューションの概要

RAD Server Field Service インダストリーテンプレートは、予定のルーティング・部品の管理・ユーザー管理のためのエンドツーエンドのフィールドサービスアプリケーションテンプレートを提供します。 これは、RESTサーバーモジュール・デスクトップクライアント・クロスプラットフォームモバイルクライアントの3つで構成されています。

ダウンロード方法

Delphi / RAD Studio 10.2 のGetIt(ツール> GetItパッケージマネージャ>インダストリアルテンプレート)で利用できます。

 

セットアップ手順

クイックスタートガイドと詳細なセットアップドキュメント(英文)がサンプルプロジェクトに含まれています。

 

Overview

RAD Server フィールドサービステンプレートは、サーバー側にRAD Server ベースの RESTサーバーモジュールを使用します。管理側には、予定の追加・表示・管理を行うFireMonkeyベースのデスクトップクライアントがあります。

さらに、管理クライアントを使用すると、部品在庫を管理し、ユーザ管理を行うことができます。オフライン対応クロスプラットフォームクライアントアプリケーションはFireMonkeyに組み込まれており、Android・iOS・macOS・Windowsに展開できます。1つのコードベースと1つのUIがあります。保留中および完了済みの予定を表示し、その場所をマップし、完了したものとしてマークすることができます。新しい予定がサーバーから同期されると、パーツのインベントリを表示したり、ローカルの通知を受け取ることもできます。LiveBindingとFireDACの両方がフィールドサービステンプレート全体で広く使用され、必要なコードの量を削減します。

フィールドサービステンプレートは、InterBaseデータベースに接続されたRAD Server バックエンドで構成されています。 RADサービスは、フィールドサービス管理者とフィールドサービスアプリケーションの両方がCRUD操作を実行するために接続するRESTエンドポイントを提供します。 さらに、Field Service Templateデータベースとサンプルデータをセットアップするために、RADサーバと同じマシン上で実行するField Service Setupアプリケーションがあります。

  • フィールドサービス管理者(Field Service Admin)
  • フィールドサービスアプリケーション(Field Service App)
  • フィールドサービスサーバー(Field Service Server - RAD Server
  • フィールドサービスのセットアップ(Field Service Setup)

 

次の順序でプロジェクトを展開して実行する必要があります。

1. Field Service Setupアプリケーションがユーザアカウントに接続してユーザアカウントを作成するには、RAD Server 開発サーバーが動作している必要があります。

 

2. Field Service Setupアプリケーションは、データベース・テーブルとデータ・EMSユーザーアカウントの設定を補助します。

 

3.フィールドサービスサーバーは、管理クライアントとアプリケーションクライアントインターフェイスの両方と連携するRAD Server側のRESTリソースです。 これは、IIS・Apache・またはスタンドアロンのRADサーバ(EMS)サーバを介して、WindowsおよびLinux上に配置可能である必要があります。

 

4.フィールドサービスアプリケーションは、Android・iOS・macOS・Windows用の RAD Studio FireMonkeyベースのクライアントアプリケーションです。 クライアントアプリケーションでは、RAD Serverのテナントを選択してから、ユーザーとしてログインする必要があります。 ログインすると、現在のテナントのサンプルアポイントメントとパーツデータがダウンロードされ、アポイントメントが完了します。 予定が完了すると、インターネットにアクセスできる場合は、サーバーに返信することができます。 フィールドサービスアプリケーションがオフラインの場合、変更されたデータはオンラインになるまで保存されます。

 

5. Field Service Adminは、WindowsとMacOS上のデスクトップ用に設計されたRAD Studio FireMonkeyベースのクライアントアプリケーションです。 管理アプリケーションを使用して、予定の作成と編集・完了予定の表示・パーツの作成と編集・ユーザーの作成と編集を行うことができます。

 


Delphi / RAD Studio 10.2 Tokyo Enterprise版と Architect版の GetItパッケージマネージャーには、その他2つのインダストリーテンプレートもあります。

RAD Server Solution Series: [Hospitality] Restaurant Survey Application(レストラン調査アプリケーション)

RAD Server Solution Series: [Healthcare] Nurses Station(医療系ナースステーション)

 


Read More
Viewing all 1683 articles
Browse latest View live


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