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

Entornos de ejecución de test con DUnitX (Bonus track)

$
0
0

Con la anterior entrada del blog completamos la serie sobre test unitarios y los frameworks a utilizar con Delphi, con una visión general sobre DUnitX. A continuación tenéis los links a las entradas de la serie.

Esta última no estaba prevista inicialmente, pero la última ya era bastante extensa y no quise mezclar con el tema de DUnitX este “Bonus track”. Digamos que esta es como un apéndice a la serie.

DUnitX permite ejecutar los test que diseñamos utilizando diferentes salidas. Digamos que el programa de ejecución de test puede estar diseñado en “modo consola”, utilizando un ejecutable VCL o generando un programa FMX. No hablamos de los test en sí, sino del programa que nos muestra la salida y los resultados de la ejecución.

A continuación vamos a repasar casda uno de ellos.

SALIDA “MODO CONSOLA”

Por defecto cuando creamos el proyecto de test, se nos genera un proyecto de tipo CONSOLA, pero no es el único que podemos utilizar. Este es el más básico y no nos permite interactuar con la ejecución o los resultados.

Si miramos el código del DPR (fichero de proyecto) veremos que aparece:

{$APPTYPE CONSOLE}

Y como ya hemos visto en las entradas anteriores, la salida de los test será algo parecido a la imagen siguiente.

Salida_formato_VCL

UTILIZAR PROGRAMA VCL

Además del modo consola, que es la salida que se configura por defecto en los test que generamos utilizando el asistente que viene con Delphi, también podemos utilizar un interface generado con VCL.

Si ejecutamos nuestra pruebas de test con este último, la salida de los resultados será algo similar a la imagen siguiente:

VCL_Ejecución

En la parte izquierda nos aparecen los test (que podemos seleccionar) y en la parte derecha podemos ver la ventana de resultados.

En este caso ofrece 2 vistas; En “Modo Estructurado” y en “Modo Texto”. La primera es en formato de árbol donde tenemos una visión rápida de los test que han funcionado y de los que han dado error, y la segunda muestra resultado en formato texto, similares a los que vemos en la aplicación anterior de consola. Podéis ver la diferencia en las imágenes siguientes:

VCL_resultado_estructurado

VCL_Resultado_formato_Texto

Al final los datos son los mismos en todos los casos, pero se nos presentan de diferente forma.

UTILIZAR PROGRAMA FMX (Firemonkey)

En la últimas versiones de Delphi que disponen de desarrollo para plataformas móviles, también podemos utilizar un interface desarrollado utilizando la librería Firemonkey (no es el más ágil de todos). Si ejecutamos los test utilizando esta interfaz para mostrar los resultados, veremos una imagen al acabar los test similar a esta:

Entorno FMX

En la parte izquierda podemos ver los test a ejecutar y en la parte derecha los resultados. En el caso de los test que fallan, nos muestra algo mas de información de cada uno de los tests que no se han ejecutado correctamente. A continuación las véis ampliadas.

FMX_Ejecucion_de_test

Detalle_error

Hasta aquí hemos visto las alternativas que ofrece el paquete DUnitX para mostrar los resultados de la ejecución de los test. Pero no son todos los posibles. Es más, nosotros mismos podríamos crear nuestro propio interface (aplicación) para ejecutar los test y mostrar los resultados como nos fuera más conveniente o cómodo.

PLUGIN TESTINSIGHT

Esto es lo que ha hecho Stefan Glienke con el pluging TestInsight. En este caso él ha optado por desarrollarlo como un plugin pra el IDE de Delphi y añadirle algunas opciones más de las que traen los que hemos visto anteriormente.

TestInsight es un plugin que soporta versiones posteriores a Delphi XE y que permite integrar dentro del IDE un entorno de pruebas con algunas opciones más de las que posee en entorno estándar. La salida es parecida, pero algo más flexible.

Podéis descargar la instalación del plugin desde GitHub utilizando el siguiente enlace. Y también acceder a una pequeña Wiki con información.

Si queréis más información os recomiendo revisar esta entrada escrita por Agustín Ortu, donde se hace un repaso completo y mucho más detallado de cómo hacer funcionar este addin para el IDE.

Si ejecutamos el mismo proyecto, pero activando TestInsight, la salida que veremos será similar a esta:

Imagen_TestInsight

En la parte superior cuenta con una barra de botones y opciones para ejecutar, filtrar, activar, desactivar test e incluso para ejecutarlos de forma repetitiva cuando el IDE esté “ocioso”.

Barra_de_botones_testInsight

PLANTILLA DE PROYECTO

Finalmente y basándome en esta consulta/respuesta en Stackoverflow, he generado esta plantilla que podéis utilizar en un proyecto de test. En la parte inicial aparecen 4 {$DEFINE}. Comentando tres de ellos y dejando uno sin comentar podéis ejecutar el mismo proyecto utilizando los 4 entornos vistos anteriormente (si habéis instalado TestInsight).

///// Selecciona 1 sólo segun interese  ////////////////////////
{.DEFINE UseWinConsole}
{.DEFINE UseVCL}
{.DEFINE UseFMX}
{$DEFINE UseTestInsight}
////////////////////////////////////////////////////////////////

Si os fijáis tenemos tres con un punto (comentadas) y una con el símbolo $, que es la que está “activa”. Si miráis al completo el fichero DPR del proyecto, veréis que se añaden unas u otras units al uses de proyecto dependiendo del DEFINE activo, y se ejecutan unas u otras instrucciones dependiendo también del DEFINE seleccionado. La parte de ejecución, podéis verla a continuación:

/////////////////////////////////////////////////////////////////////////
{$IFDEF TESTINSIGHT}
begin
  TestInsight.DUnitX.RunRegisteredTests;
  exit;
{$ENDIF}
/////////////////////////////////////////////////////////////////////////
{$IFDEF UseVCL}
begin
  Application.Initialize;
  Application.CreateForm(TGUIVCLTestRunner, GUIVCLTestRunner);
  Application.Run;
{$ENDIF}
/////////////////////////////////////////////////////////////////////////
{$IFDEF UseFMX}
begin
  Application.Initialize;
  Application.CreateForm(TGUIXTestRunner, GUIXTestRunner);
  Application.Run;
{$ENDIF}
/////////////////////////////////////////////////////////////////////////
{$IFDEF UseConsole}
var
  runner : ITestRunner;
  results : IRunResults;
  logger : ITestLogger;
  nunitLogger : ITestLogger;

begin
   try
      //Create the runner
      runner := TDUnitX.CreateRunner;
      runner.UseRTTI := True;
      //tell the runner how we will log things
      logger := TDUnitXConsoleLogger.Create(true);
      nunitLogger := TDUnitXXMLNUnitFileLogger.Create;
      runner.AddLogger(logger);
      runner.AddLogger(nunitLogger);

      //Run tests
      results := runner.Execute;

      System.Write('Done.. press  key to quit.');
      System.Readln;

   except
      on E: Exception do
         System.Writeln(E.ClassName, ': ', E.Message);
   end;
{$ENDIF}
/////////////////////////////////////////////////////////////////////////

Os adjunto el código completo del proyecto que he estado desarrollando para las anteriores entradas, con estas modificaciones en el DPR. <Código fuente del proyecto> Hasta aquí esta última entrada. Como siempre cualquier comentario, sugerencia, mejora, propuestas,… será bienvenida. Hasta la próxima.


Read More

RAD Studio 10.2.3 Delphi CodeInsight (and iOS 11.3) Patch

$
0
0

Over the last few months we were able to investigate some very specific CodeInsight bugs (with reproducible cases) and we have been able to work on several fixes to the Code Completion and other areas. A critical one involved the case a developer overaloads a generic method. While some of the fixes will be part of the next major release, some of them could be made available for the 10.2.x product and are included in this patch. One of the issues is purely a compiler issue a customer reported.

At the same time we have done some further cleanup to the iOS 11.3 patch we have released last month, and having also to include new compiler support in PAServer, we have decided to merge the iOS fixes and thd code insight fixes in a single download -- so you don't end up with a partially patched, unstable system.

The download is avaialble for registered users of any paid version at:

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

The iOS-related publicly reported issues addressed by the patch are:

RSP-20268: [DCC Error] E2597 ld: file not found: /usr/lib/system/libcache.dylib for architecture arm64
RSP-20303: XCode 9.3 and iOS 11.3 linker error
RSP-20342: A blank project of Delphi Tokyo 3 Don't compile in iOS
RSP-20346: Compiling error with SDK11.3 for iOS, XCode 9.3

The CodeInsight related issues include:
RSP-16046: [Regression] [Code Completion] Code completion dialog does not show up in overloaded method
RSP-14877: IDE freezes
RSP-17412: Code completion failure
RSP-19856: Code completion failure SY12895
RSP-19508: Code completion


Read More

RAD Studio 10.2.3 コード補完(及びiOS 11.3 対応)のパッチ

$
0
0

この記事は、Marco CantuによるRAD Studio 10.2.3 Delphi CodeInsight (and iOS 11.3) Patchの抄訳です。

ここ数ヶ月間で、コード補完でいくつかのバグ(再現可能なケース)を調べることができました。そして、コード補完などのいくつかの修正を行いました。クリティカルな部分では、開発者がジェネリックメソッドをオーバーロードするケースに関係していました。いくつかの修正は次のメジャーリリースの一部となりますが、その一部は10.2.x製品で利用可能になり、このパッチに含まれています。問題の1つは、カスタマーから報告を頂きましたコンパイラの問題です。

弊社で、先月リリースしたiOS 11.3パッチをさらにクリーンアップし、PAServerに新しいコンパイラサポートを組み込むことを決めました。従って、私たちはiOSの修正とコード補完の修正を一度にマージすることに致しました -- 部分的にパッチを当てて不安定なシステムにならないようにします。

ダウンロードは、アップデートサブスクリプションユーザーに対してご利用可能です:

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

上記URLの、パッチによって対処されたiOS関連の公表された問題は下記のとおりです。

  • RSP-20268: [DCC Error] E2597 ld: file not found: /usr/lib/system/libcache.dylib for architecture arm64
  • RSP-20303: XCode 9.3 and iOS 11.3 linker error
  • RSP-20342: A blank project of Delphi Tokyo 3 Don't compile in iOS
  • RSP-20346: Compiling error with SDK11.3 for iOS, XCode 9.3

 

CodeInsightに関連する問題は次のとおりです。

  • RSP-14877: IDE freezes
  • RSP-16046: [Regression] [Code Completion] Code completion dialog does not show up in overloaded method
  • RSP-17412: Code completion failure
  • RSP-19856: Code completion failure SY12895
  • RSP-19508: Code completion 

 


Read More

CodeRage DE 2018: Aufzeichnungen verfügbar

Delphi Blogs of the Month #60

$
0
0

It has been a while, again, but I'm back with a collection of relevant and notable links of the recent weeks. All of these are interesting reads and worth checking in case you have missed them.

Official Embarcadero Updates

Idera Adds Web App Text Editing through Froala Acquisition at https://www.businesswire.com/news/home/20180619005348/en/Idera-Adds-Web-App-Text-Editing-Froala

Technical Blog Posts

Removing the Community toolbar by David at https://community.embarcadero.com/blogs/entry/removing-the-community-toolbar

Editor Views in RAD Studio by David at http://www.davidghoyle.co.uk/WordPress/?p=1905

Chet – A C Header Translator powered by Clang by Erik of Grijjy at https://blog.grijjy.com/2018/05/29/chet-a-c-header-translator-powered-by-clang/

Using an IDE: Getting back to code faster by Mary helps us get back the the basics of why we us an IDE for our daily work: https://community.embarcadero.com/blogs/entry/using-an-ide-getting-back-to-code-faster

​RAD Server Solution Series: [Field Service Application] by Sarina at https://community.embarcadero.com/blogs/entry/rad-server-solution-series-field-service-application

Using Apple’s Grand Central Dispatch and Android’s ScheduledThreadPoolExecutor for Delphi timers by Allen of Grijjy at https://blog.grijjy.com/2018/05/20/using-the-apples-grand-central-dispatch-and-androids-scheduledthreadpoolexecutor-for-delphi-timers/

Targeting Android 8 and higher by (another) David at http://delphiworlds.com/2018/05/targeting-android-8-and-higher/ (this is an important and urgent area, we are working on this actively)

Open files in external apps from FireMonkey by Sergey at https://www.code-partners.com/open-files-in-external-apps-from-firemonkey/

Use the Source! by Jim at https://community.embarcadero.com/blogs/entry/use-the-source

​Libraries

Quite interesting: Delphi LeakCheck at https://bitbucket.org/shadow_cs/delphi-leakcheck

Tech Business

Interesting article on "Open source sustainability" by Tech Crunch at https://techcrunch.com/2018/06/23/open-source-sustainability/. The topic is certainly debatable, but the article raises some interesting points. When multi-million dollar tech giants rely on open source and don't contribute to it, it is a sign things are out of control. Of course, that's not always the case.

Another strong and interesting article, Case Sensitivity is an Anti-Pattern by Chad at https://www.kudzuworld.com/articles/casesensitivity/. I'm not 100% convinced, as much as a like case insensitive languages ;-)

Up to next month.


Read More

モバイル端末のデータを開発用PCに転送する

$
0
0

はじめに

モバイルアプリの開発で、端末に保存されているデータベースやログなどを、開発用のPCに持ってきて確認したいケースは良くあります。モバイル端末では「サンドボックス構造」として、モバイルアプリケーションがアクセス可能な領域が制限されています。PCからも同様で、モバイルアプリケーションの領域を直接参照することは出来ません。

以下の手段を使用すれば、モバイルアプリケーションのデータを開発用のPCに転送することが出来ます。

Andoroidの場合:

  1. Android端末のUSBデバッグを有効にします。
  2. コマンドプロンプトから"adb shell"を実行します。
  3. Andoroidのシェルが起動しますので、"run-as [アプリケーションのパッケージ名]"を実行して、アプリケーションのストレージに移動します。アプリケーションのパッケージ名はRAD Studioのプロジェクトオプションで確認出来ます。
  4. cpコマンドで、転送したいファイルをPCからアクセス可能なディレクトリにコピーします。
    例)"cp Test1.IB /sdcard/Pictures"
  5. "exit"を入力して、adbから抜けます。
  6. "adb pull"で開発用のPCにファイルを転送します。
    例)"adb pull /sdcard/Pictures/Test1.IB"

iOSの場合:

  1. ホストのMacでXCodeを起動して、[Window|Devices and Simulators]を選択します。
  2. "INSTALLED APPS"でアプリケーションを選択して、歯車のアイコンをクリックしてメニューを表示します。
  3. メニューの"Download Container"を選択します。
  4. 保存先を選択して[Save]をクリック。アプリケーションデータを保存します。
  5. 保存したアプリケーションデータで右クリック(オプションメニューを表示)して、[パッケージの内容を表示]を選択します。
  6. ホストのMacから開発用のPCにコピーします。

まとめ

今回の例はInterBase ToGoのデータファイルです。データをモバイル端末にデータベースとして持たせる場合、FireMonkey + FireDAC + InterBase Togoの組み合わせは非常に有力です。

 

 InterBase Togoはマルチデバイス対応ですので、Windows、AndroidとiOSの相互でファイルをコピーするだけでアクセス出来ます。デバッグに使用したり、編集してから再配置して、モバイル端末に再反映するなどの応用が可能です。

もちろん、データベースファイルだけではなく、ログファイルなどの一般的なファイルもこの方法で転送できます。

 データベース繋がりですが、来る7月18日(水)と8月28日(火)に技術セミナー「多様なデータベースへの接続を実現する最新データアクセス技術活用セミナー」を行います。

詳細は、以下のURLを参照してください。
https://www.embarcadero.com/jp/events-japan


Read More

Sencha日本語Webサイトオープン

$
0
0

昨年8月末にWebアプリケーション開発プラットフォームSenchaの買収を発表してから、早くも10ヶ月半が経過しました。Sencha買収後初のイベントとして「Sencha RAD Mix Tokyo」を実施したのが昨年12月。その後、3月と5月に実施したデベロッパーキャンプでは、Senchaに関する話題も取り上げ、Delphi / C++ユーザーのためのSenchaセッションも実施しました。

製品サイドでは、Sencha製品ファミリーのロードマップを発表し、定期的にアップデートを繰り返し、現在では、主力製品であるExt JSのバージョンが6.6にまで上がりました。アイデラの傘下となってからは、Ext JSのフレームワーク本体とビジュアルツールであるArchitectのアップデートタイミングも的確にシンクロするようになり、新しいフレームワークのためのツール環境が使えるようになるまで少し時間がかかるという問題も解消しています。

また、Delphi / C++Builder側でもSenchaとの連携性を高めるアップデートが加えられており、RAD Serverが供給するREST/JSONが、Senchaに適合しやすくなるような機能強化も行われています。Senchaは、データベースやバックエンドの企業システムとの接続にはオープンなREST/JSONを用いるのが一般的で、その手段のひとつとしてDelphi / C++Builderによる中間サーバー構築、すなわちRAD Serverが有効です。この件については、Atanasのブログ記事(の抄訳)でも紹介されています。

さて、そのように積極的な展開が始まったSenchaに対して、ちょっと歯がゆい思いをしていたのが、Webサイトです。日本以外の国は「英語さえあれば」という感覚ですが、日本においては、やっぱり日本語情報がほしい、特に新たにSenchaについて知りたいという方には必須、という意識です。Sencha Inc.は、エンバカデロほど日本語の情報提供について積極的でなかったり、経験がなかったりしたので、実現には少し時間がかかりました。しかし、いよいよ日本語サイトオープンです。

現時点では、Ext JSの製品情報を中心に日本語化してありますが、これからどんどん日本語情報の幅を広げていきます。ご期待ください。


Read More

Trilha Delphi/C++ Builder no TDC 2018

$
0
0

Pelo terceiro ano consecutivo estaremos com uma trilha RAD no TDC! Diferentemente das edições anteriores, nossa trilha será no sábado, dia 21/07, com inicio previsto para as 10 horas da manhã, logo após a abertura no Auditório Principal.

Confira o que reservamos para este ano:

Screenshot_2018-07-14 Trilha Rad Delphi C++ - TDC 2018 São Paulo

As inscrições seguem abertas, todos os detalhes estão neste link: shttp://www.thedevelopersconference.com.br/tdc/2018/saopaulo/trilha-rad-delphi-c

Teremos muito tempo para trocar ideias sobre desenvolvimento e também para networking! Nos vemos lá?


Read More

Tech Tip: How do I secure RAD Server for production deployment?

$
0
0

Note: This is not a comprehensive security tutorial for RAD Server merely a tech tip.

There are a number of sections in the emsserver.ini file which can help you secure your RAD Server for production which include Server.APICrossDomain, Console.Login, Server.Authorization. You can limit cross site scripting by changing the CrossDomain setting in Server.APICrossDomain to only allow your domains. You can customize the UserName and Password of the Console.Login section so that only you will be able to log into the console. Finally, you can limit the access to various endpoints on your RAD Server by customizing the settings in the Server.Authorization section. Here is a sample of settings you could add to limit the access to the Users resource:

Users={"public": false}
Users.LoginUser={"public": true}
Users.GetUserGroups={"users": ["*"]}
Users.GetUsers={"groups": ["Admin"]}
Users.GetUserFields={"groups": ["Admin"]}
Users.GetUser={"groups": ["Admin"]}
Users.GetGroup={"groups": ["Admin"]}
Users.UpdateUser={"groups": ["Admin"]}
Users.AddUser={"groups": ["Admin"]}

 

If the settings are too restrictive you may receive a 401 response from the server in which case you would need to modify your settings to allow that specific API call. Other sections you may want to review for adding more security to your RAD Server deployment are Server.Keys and Server.Connection.Dev where you can add a server wide master secret, app secret, and/or HTTPS.

Head over and check out the full documentation for the RAD Server Authentication section.

This text is an excerpt from the Field Service Template FAQ documentation. Find out more about the Field Service Template in the video:


 
[YoutubeButton url='https://www.youtube.com/watch?v=cT5tiPDPh3c&list=PLwUPJvR9mZHiMb6KBD-zb6uRvi6BS0HKN']

Read More

Updated IBLite 2017 GetIt Package With License File

$
0
0

IBLite is the local version of the InterBase database you can embed in your mobile and desktop applications. RAD Studio has full deployment support, so you can easily deploy the required file with your app, both for debug and for store deployment (see image below). IBLite offers more features and is a more robust mobile database compared to the commonly used SQLite. It is also fully compatible with the full InterBase server (and the free developer edition you receive with RAD Studio)

Until recently, the IBLite deployment required a unique license file. As a developer, you received a serial number and registration code along with your RAD Studio serial number, you had to enter them on an Embarcadero web site and download the IBLite license file, add it to the InterBase redistributable folder and deploy this specific file with your applications. If not you'd receive an "unregistered database" runtime error message.

Embarcadero has now updated the IBLite/IBToGo GetIt package for RAD Studio 10.2 Tokyo. This now automatically includes a ready-to-use, shared, license file, so you don't need to redeem the license or do any other step. Just build an IBLite powered application, use the automatic set of deployment files, and deliver the application with the embedded database to your mobile devices.

You can see an example of the deployment configuration for Android for one of the demos that ship with RAD Studio:

This change should make it much easier to start using IBLite with your projects, delivering the power of InterBase along with your mobile applications.... for free!


Read More

RAD Server 10.2.3 Performance Patch

$
0
0

Embarcadero has just released a performance patch for the RAD Studio 10.2.3 version of RAD Server, our REST-based web service hosting architecture. 

Getting The RAD Server Optimization Patch

This patch is available at http://cc.embarcadero.com/item/30838 and it includes a new set of binary files, for the different types of servers (both development and deployment). The patch includes a number of optimizations: better configuration of the memory manager for heavy multi-threading, optimized processing, optimized license checking, and much more. The patch includes also an additional feature, a KeepAlive option for the Dev server you can adding a setting to the EMS.INI configuration files (as described in the readme).

Testing the Optimization Patch

I've personally tested the patch against the development version of RAD Server in the following scenario: I run the server without debugging, disabled logging, and used Apache Benchmark client (ab) from a different machine on the same network. I used different calls, but eventually settled on these:

ab -n 1000 -c 10 -k http://192.168.1.111:8080/xyz ab -n 1000 -c 10 -k http://192.168.1.111:8080/data

The two endpoints were different. The first is a hello world type of call, returning the same string and the time in a JSON string, with a document length of 17 bytes:

// Code for [ResourceName('xyz')] procedure TXyzResource.Get(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse); begin AResponse.Body.SetValue(TJSONString.Create('xyz ' + TimeToStr(Now)), True) end;

The second endpoint executes a FireDAC query returning a database table in a stream, based on the internal FireDAC JSON format, and with a document length of 13,909 bytes.

// Code for [ResourceName('data')] procedure TDataResource1.Get(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse); var AStream: TStream; begin EmployeeConnection.Connected := True; FDQuery1.Open; AStream := TMemoryStream.Create; FDQuery1.SaveToStream(AStream, sfJSON); AResponse.Body.SetStream(AStream, 'application/json', True); end;

The components have a very simple configuration, with a connection to the sample InterBase database, and the query 'select * from employee'.

The Data from the Test

I've tested the same scenario, same machines, same code with 10.2.3 (before applying the patch) with the patch, and with some additional fine tuning in the configuration. The table below has the information from ab for the 2 endpoints:

  data xyz

10.2.3 plain

Requests per second: 49.70

Time per request: 20.121 ms

Requests per second: 111.93

Time per request: 8.934 ms

10.2.3 with performance patch

Requests per second: 402.67

Time per request: 2.483 ms

Requests per second: 3336.61

Time per request: 0.300 ms

10.2.3 with performance patch
with thread pooling and keep alive

Requests per second: 426.59

Time per request: 2.344 ms

Requests per second: 3954.74

Time per request: 0.253 ms

You can see that the difference is very significant: for the complex call, from 46 to 426 requests per second, is almost a 10x increase, for the simple code from just above 100 to almost 4,000 is just short of a 40x increase in throughput. 

Summary

For Embarcadero and the RAD Studio team, the RAD Server technology is a key piece of the plans and the future. Focusing on its performance was important, and more is coming in terms of Delphi RTL optimizations in the future. We have also added better support for JavaScript clients (including Ext JS) in the 10.2.x updates, and also made available a free deployment license with the Enterprise license. RAD Server is a key technology and a great way to bring your client/server applications towards the future, with a service oriented and more distributed architecture, ready for mobile and cloud deployment. Stay tuned for more.


Read More

Are you using Jira? Fill out the survey and get entered into a prize draw

$
0
0
In partnership with the wonderful folks at the Ministry of Testing, the Gurock team brings you the Jira Testing Plugin survey! You can participate in the survey here and get entered into a prize draw for Ministry of Testing goodies. Gurockan Idera, Inc. company, builds popular software testing tools for QA and development teams. 
 
If you love to learn about all things testing, you'll love our first prize:
A year long professional membership to the MOT Dojo. Unlimited access to videos, articles and training courses. Keeping you at the cutting edge of modern software testing practices.
 
Three runners up will also win world renowned TestSphere card decks. Play TestSphere with your colleagues and friends and keep your testing skills sharp!
 
The survey is open until the 26th of July. Don't miss this opportunity to provide some feedback on Jira Testing Plugins and a chance to win some goodies at the same time!
 

Read More

Learn How To Customize The Look And Feel Of The FireMonkey Field Service Template Apps

$
0
0

The RAD Server Field Service 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. The template can give you a head start in building your own field service solutions. You can download the template from within the RAD Studio IDE using Embarcadero GetIt.

You can quickly and easily customize most of the look and feel of the app with three easy changes. In TMainForm there is a BackgroundRect, a BackgroundImageRect, and a EmeraldDarkStyleBook control. You can change the background color of the app by changing the BackgroundRect.Fill.Gradient property. You can change the image that is overlayed over the entire app by changing the BackgroundImageRect.Fill.Bitmap.Bitmap property. The background image works by being above all of the other controls, having a low Opacity, having a HitTest of False and a Locked property of True. Finally, you can change most of the rest of the theme by loading different Premium Styles into the EmeraldDarkStyleBook control.

You can customize the header logo of the Login screen on the LoginFrame. There are a few other places where the custom green color is used on some elements in the TListView controls and some the search icons using a TFillRGBEffect.

You will need to update the BackgroundRect and BackgroundImageRect in the GroupsListForm, the TechsListForm, and the TenantForm as well. There is a BackgroundImage control in the LoginFrame if want to customize the background of the Login page. Remember that you will need to load one style for each of the four deployment platforms. You can access the Premium Styles here:

https://www.embarcadero.com/products/rad-studio/fireui/premium-styles

 

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


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

Read More

CodeRage Spotlight: Webinarreihe rund um Sencha Ext JS und Embarcadero RAD Server

$
0
0

Wir laden Sie zu einem Themenschwerpunkt zu Sencha Ext JS ein.

Neben einer Einführung durch unserem Partner Thorsten Suckow-Homberg, Senior Software Developer, von der eyeworkers GmbH, zeigt Ihnen Matthias Eißing, Embarcadero Germany GmbH, einen technologischen Durchstich von der Datenbank über die Middleware mit dem RAD Server und Delphi zu einem Ext JS Client.

Erleben Sie zwei spannende Stunden in Theorie und Praxis.

10:00 bis 10:45

Vorstellung Sencha Ext JS

Senchas Ext JS ist die umfangreichste Enterprise JavaScript Entwicklungsplattform für komplexe Webapplikationen. Bestehend aus dem SDK, Sencha CMD und weiteren integrierten Tools lassen sich Webanwendungen auf Basis von MVVM Paradigmen leicht und effizient entwerfen. Lernen Sie in diesem Vortrag

  • Vorstellung des ExtJS ecosystems: Sencha CMD und das SDK.
  • Aufsetzen einer Beispielanwendung mit Hilfe von Sencha CMD;  Erzeugen eines Workspaces, erzeugen einer App.
  • Vorstellung des Konzeptes der unterschiedlichen View Layer auf Desktop und Mobile - modern/classic Toolkit; Hinweis auf und Nutzung des responsive Layouts, Vor/Nachteile.
  • Rapid Prototyping: Live Coding einer kleinen Anwendung mit Master/Detail View. Hier werde ich besonders die Eigenschaft des Frameworks, eine Anwendung einfach "beschreiben" zu können, vorstellen. Auslagerung der Funktionalität in ViewController. Beispiel für ein Two-Way Databinding (MVVM als Architekturhilfe); mocken von Backend-Requests mit Hilfe des SimManagers
  • Aufteilung von Applikationen in Module und Packages, Möglichkeiten, die Sencha CMD bietet. Auslieferung eines ExtJS-Software Projektes

Anschließend: Fragen und Antworten

Thorsten Suckow-Homberg / Senior Software Developer / eyeworkers GmbH

11:00 bis 11:45 

Zentrale Daten mit dem Embarcadero RAD Server, visualisiert im Browser mit Sencha Ext JS

Datenbanken und Funktionen zentral Ihren Apps und Anwendungen zur Verfügung stellen. Das ist die Motivation für den “RAD Server”. Mit der JSON/REST-basierten Middleware haben Sie die Möglichkeit dies im Applikationsschicht inklusive Benutzerverwaltung und Auswertungsmöglichkeiten durchzuführen. Wahlweise können Funktionsmodule in Delphi oder C++ erstellt werden und die volle Geschwindigkeit auf der Middlewareebene nutzen.

  • Einführung in den Embarcadero RAD Server
  • Möglichkeiten der Nutzung
  • vorinstallierte Module und Standardauswertungen
  • Beispiel für ein RAD Server Modul mit Datenbankanbindung, Testdeployment und zur Verfügung stellen von Daten per JSON an einen Ext JS Client

Anschließend: Fragen und Antworten

Matthias Eißing / Senior Sales Consultant / Embarcadero Germany GmbH

Anmeldung und weitere Infos: 

http://forms.embarcadero.com/CodeRageSpotlight?utm_source=webinar&utm_medium=blog

 


Read More

Enabling GetIt Install Logs for RAD Studio Installation

$
0
0

At times, RAD Studio GetIt-based web installer stops with some fairly vague error message. These can be due to connectivity issues, odd file system configurations, lack of disk space, an existing partial install, and other causes. But some of the error messages like "operation error" don't explain the cause of the problem. For the future, we are making sure to surface more specific errors, like "Could not create folder xyz", "Could not copy file foo.dcu to folder bar", or similar. 

For the time being, and in general as a way to better report errors on Quality Portal, there is an undocumented registry setting you can use to enable the generation of a log file with the installer progress (notice, the same log file is used only for installation and manage platform dialog, not when you are installing regular, additional GetIt packages). 

After you have started the installation (up to the point of a failure or after a successfull operation) -- the configuration setting is read when you restart the process -- you can open the RegEdit Windows tool and navigate to a key like:

HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\xx.0\CatalogRepository\

where xx.0 is the internal version of RAD Studio, like 19.0 for the most recent version. Under that key add a DWORD value with the name "Debug" and the value 1.

As you restart an installation or restart the IDe to add new features, the system should create a detailed log file at a location like:

C:\Users\Public\Documents\Embarcadero\Studio\xx.0\GetItInstall.log

This helps getting more detailed information in case of error, but also have a full log of a successful installation. The same log file is used over time with more data added to the end. When you are calling support or reporting installer issues, adding this log file can help us identify the core issue.
 


Read More

Delphi/C++Builder: Aktuelle e-Books, Videos und mehr

$
0
0

Dr. Veikko Krypczyk: Geräteübergreifende Entwicklung mit RAD Studio

In diesem shortcut stellen Ihnen Olena Bochkor und Dr. Veikko Krypczyk die Möglichkeiten der geräte- und plattformübergreifenden Entwicklung mit RAD Studio vor. Dabei werden verschiedene Anwendungsfälle, wie zum Beispiel UI-Erstellung und Cloud-Anbindung, anhand leicht nachzuvollziehender Beispiele erläutert.

Amazon / Kindle Edition: https://www.amazon.de/dp/B07FKL2WX7/

Entwickler.de: https://entwickler.de/press/shortcuts/geraeteuebergreifende-entwicklung-mit-rad-studio-579850093.html

Marco Forestier: Das DLL Kompendium für Delphi & RAD-Studio

In diesem Buch wird beschrieben, wie DLLs erstellt und in Programme eingebunden werden, wie eine Programm-Funktion gekapselt wird und in eine DLL ausgelagert wird bzw. ein VCL-Formular in eine DLL ausgelagert. Beim Einbinden/Import wird sowohl das statische wie auch das dynamische Einbinden an Beispielen gezeigt.

Amazon / Taschenbuch: https://www.amazon.de/dp/1980973148

Marco Forestier: Das Thread Kompendium für Delphi und RAD-Studio

In diesem Buch wird beschrieben, wie Threads erstellt und in Programme eingebunden werden. Das Ganze geschieht anhand von Beispielen, die jeder in seiner eigenen Entwicklungsumgebung nachbauen kann. Es wird ausführlich darauf eingegangen, wie Threads erstellt, gestartet, pausiert und gestoppt werden. Es wird ebenso beschrieben, auf was man als Entwickler besonders achten sollte. Im Buch werden alle dazugehörigen Sourcecodes vollständig abgedruckt! 

Amazon / Taschenbuch: https://www.amazon.de/dp/1983074705

Marco Forestier: Multilinguale Anwendungsentwicklung für Delphi & RAD-Studio

In diesem Buch wird beschrieben, wie Sie Ihre Anwendung zu einer multilingualen Anwendung erweitern können. Das Ganze geschieht anhand von zwei Beispielen, die Sie in Ihrer eigenen Entwicklungsumgebung nachbauen können. Es werden verschieden Ansätze zur Lösung dieses Problems besprochen und auf die Vorteile beziehungsweise auf die Nachteile eingegangen. Es wird ebenso beschrieben, auf was man als Entwickler besonders achten sollte. Im Buch werden alle dazugehörigen Sourcecodes vollständig abgedruckt!

Amazon / Taschenbuch: https://www.amazon.de/dp/1983333875/

FREE Video Course - Master C++ Fundamentals (englisch)

C++ programmers are sought after for enterprise system software and video games. In these tutorials, Byte Academy and Embarcadero Technologies walk you through conditional statements, loops, simple and advanced data structures, and memory management using the C++Builder IDE. The C++Builder IDE allows you to design, code, test and deploy your C++ apps to desktops and devices with a single code base.

Hier anmelden / kostenfrei: http://forms.embarcadero.com/freecppvideocourse

 


Read More

Delphi/C++Builder Community Edition - kostenfreie Edition für nicht kommerzielle Zwecke

$
0
0

 

Einige Fragen&Antworten

F: Wo bekomme ich die Community Edition?

A: Auf der Webseite von www.embarcadero.com. Es gibt eine Delphi Edition und eine C++Builder Edition. Beide zusammen lassen sich *nicht* installieren.

Delphi: https://www.embarcadero.com/products/delphi/starter/free-download

C++Builder: https://www.embarcadero.com/products/cbuilder/starter/free-download

Hinweis: Die URLs haben weiterhin "Starter" im Namen..... Starter, die mit der Community Edition "starten" wollen!

F: Wo liegen die Limitierungen der Community Edition?

A: Das sind lizenzrechtliche Einschränkungen, die in der EULA (End User License Agreement) genau beschrieben sind. Hier einige wichtige Anhaltspunkte:

  • Kein Umsatz der Lizenznehmers (des Unternehmens, der staatlichen Einrichtung oder des Einzelentwickler ) oder Spenden (der gemeinnützigen Organisation) über 5.000,00 USD in Summe pro Kalenderjahr
  • Dazu zählen auch für Dienstleistungen, wo die Community Edition gar nicht eingesetzt wird (Consulting, Auftragsarbeit mit anderen IDEs)
  • Bei Erreichung der 5.000,00 USD Grenze (zB durch Verkäufe seiner mit der Community Edition erstellten Anwendungen und/oder Apps oder sonstige Einnahmen) muss der Entwickler/das Unternehmen eine kommerzielle Edition erwerben
  • Maximal 5 Entwickler mit einer Community Edition im Unternehmen
  • Keine Rechte der Veränderung am VCL/FMX Quellcode!
  • Keine Installation der Kommandozeilen-Compiler auf einem weiteren Rechner

Also nur sehr bedingt für kommerzielle Fälle geeignet! Für Start-Ups aber gut geeignet!

Open-Source Software, Hobby Entwickler, Studenten, Renter, Privatpersonen, die mal reinschnuppern wollen: Da ist das alles kein Problem!

F: Auf welcher Edition basiert die Community Edition?

A: Die Community Edition ist eine (leicht abgewandelte) Professional Edition (inklusive dem Mobile-Add-On für die Entwicklung von Android und iOS Apps

F: Kann ich die Community Edition parallel, auf dem gleichen Rechner zu einer Starter/Professional/Enterprise/Architect Edition oder Trial von 10.2 Tokyo installieren?

A: NEIN. Handelt es sich um die gleiche Version ("10.2 Tokyo"), egal von welcher Edition, geht das nicht. 10.1 Berlin und 10.2 Tokyo gehen aber parallel. Oder anders rum: Von einer 10.2 Version geht nur eine Edition (Starter, Community, Professional, ....). Mit anderen Versionen beisst sich das auch nicht!

Pro-Antwort: Nutzen Sie eine weitere/andere Virtuelle Maschine!

F: Sind auch FastReports, TeeChart und die GetIt Pakete verfügbar?

A: Ja!

F: vollständiger Debugger, Code Completion, 64-Bit Support, etc sind, im Gegensatz zur Starter Edition, mit dabei?

A: Ja!!

F: Was sind damit die wesentlichen Unterschiede zur Starter Edition?

A: Windows, macOS, iOS und Android Entwicklung mit 32- und 64-Bit Compilern, wo zutreffend (Starter: nur Windows 32-Bit). Darüber hinaus: Vollständiger Debugger, Datenbankkomponenten in der Community Edition, für lokale Datenbanken (Starter: keinerlei Datenbankzugriffskomponenten), erhöhte Umsatzgrenze von 5.000,00 USD (Starter: Nur 1.000,00 USD)

F: Wie lange läuft die Lizenz der Community Edition? Gibt es ein Ablaufdatum der Lizenz?

Die Community Edition läuft erstmal ein Jahr. Danach kann man sich sofort wieder eine neue Seriennummer holen und die bestehende Installation aktivieren. Dies setzt natürlich voraus, daß man noch die Lizenzbedingungen (kein/wenig Umsatz, maximal 5 Entwickler) erfüllt.

30 Tage vor Ablauf kommt ein Hinweisdialog.

Nach dem Ablauf darf man die selbst erstellte Software weiter vertreiben, kostenlos, oder auch kommerziell, wenn die jährlich kumulierten Gesamteinnahmen weiterhin 5.000,00 USB nicht überschreiten.

F: Gibt es auch Updates, Patches, Hotfixes, Support für die Community Edition?

A: Nein.

F: Ist die Starter damit am Ende?

A: Nein. Bestehende Starter Installation, Seriennummern und Lizenzen können weiterbenutzt werden. Sie wird aber nicht mehr ausgeliefert oder angeboten. Dafür gibt es jetzt die Community Edition.

F: Können Projekt-Dateien / Quelltext von der Community Edition mit der Professional/Enterprise/Architect Edition ausgetauscht werden?

A: Ja! In beide Richtungen. (Wenn die Komponenten, zB Datenbankzugriff, vorhanden sind. Wichtig, wenn man ein Projekt, erstellt mit der Enterprise Edition, mit der Community Edition bearbeiten will)

F: Gibt es Royalties / Deployment / Laufzeitkosten für vertriebene Anwendungen?

A: Nein! Denken Sie aber immer daran: Erreichen Sie oder Ihr Unternehmen mehr als 5.000,00 USD Umsatz, dann müssen Sie eine kommerzielle Edition erwerben.

F: Wie sieht es in Zukunft aus? Wird die Community Edition aktualisiert? Zum Beispiel eine 10.3 Community Edition?

A: Ja!

F: Gibt es eine Test/Trial-Version der Community Edition?

A: Nein, da nicht notwendig :-)

F: Was bedeutet 5.000,00 USD für mich in Deutschland?

A: Das sind (Stand jetzt) etwas über 4.300 EUR :-)

F: Was ist technisch anders?

  • Es wird ein individueller Startbildschirm benutzt (rot... mit dem Schriftzug "Community Edition")
  • Die Titelleiste ist nicht "RAD Studio", sondern "Delphi 10.2 Community Edition" bzw "C++Builder 10.2 Community Edition"
  • Es wird auch auf die ablaufende Lizenz hingewiesen
  • Delphi und C++Builder können nicht als Paket/Suite (AKA "RAD Studio" installiert werden
  • Die Installation ist nur als Web-Installer/ESD/GetIt möglich
  • Es gelten natürlich andere Lizenzbedingungen

F: Was sind die Gründe für eine Professional Edition?

A: Die Professional Edition bietet:

  • Dauerhafte Lizenz
  • Keine Umsatzgrenze
  • Benutzung des Sourcecodes für Änderungen, Erweiterungen
  • Update Subscription mit Patches, Hotfixes, Support-Zugang
  • Zugang zu Beta/Vorabversionen
  • Kommandozeilen Compiler für Build-Umgebungen / Build-Machines

F: Die Build-Nummer der Community Edition ist "3231". Mein Delphi ist aber älter! (2631 oder noch älter. Gilt auch analog für C++Builder)

A: Die Build Nummer 3231 lässt sich auch für die Installation von Pro/Ent/Arch verwenden (Download im Bereich der registrierten Benutzer). Dann werden auch automatisch die folgenden Patches mitinstalliert

  • 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
  • Delphi 10.2.3 CodeInsight and Compiler Patch 
  • RAD Server 10.2.3 Performance Patch

Das ist sehr praktisch!

Für die kommerziellen Edition gibt es auch eine aktualisierte ISO! und einen Webinstaller

Hat man die Patches auf Basis des Release 3 alle installiert, dann braucht man das nicht.


Read More

Learn to Program with Delphi Community Edition: Part 1 - Introduction and Installation

$
0
0

This blog post is the beginning of the "Learn to Program in Delphi" series. We are expecting that you have some previous experience in programming, but not in Delphi. In this five part series we are going to take you through the process of building a simple "calculator" application. 

This series has a counterpart in C++ using the same example project, so head over here if you want to compare how the same application is developed in both Delphi and C++. 

Learning to Program

In the 21st century programming is an art that is really useful to master. It can be very very useful to know how to write a computer program to solve a certain task, especially when you are a student. Programming will also make you smarter because it teaches how to think in a more organized way.

You need to have a program in which you are going to write your programs. This is called an Integrated Development Environment (IDE) and was invented many years ago with the ancient ancestor of Delphi called Turbo Pascal that combined together three previously separate programs - compiler, code editor and debugger - into one integrated programming environment. You can start learning programming using just Notepad and command line compilers but in the longer run it is not the most productive environment. With the IDE you get a lot of help like syntax checking of your code as you type and much more. Why not be like a pro?

Today we are going to start learning to program in the Object Pascal language used in Delphi Community Edition’s IDE. Object Pascal is probably the best choice to start with programming. From the very beginning it was designed for teaching good programming practices. Over time it grew up as the language of choice for building all kinds of software from Internet communicators like Skype to professional music production like FL Studio.

Today let's just focus on downloading and installing Delphi Community Edition. In the next post, we will go into writing your first lines of code.

Installing Delphi Community Edition

Let's get started! You will need a computer or laptop with Windows, because Delphi itself is Windows program. You can build applications for Windows, mac OS, Android and iOS with Delphi Community Edition. You only need to learn one language, get familiar with just one development environment and you can natively compile your projects to all major desktop and mobile platforms. 

The first step is to download Delphi Community Edition, which is free to developers and organizations with less than $5000 USD in revenue (view the license restrictions). (Don’t qualify for Delphi Community Edition? You can complete this series with a FREE 30 DAY Trial of RAD Studio.) You will then receive an automatically generated email with your own serial number and the download link to the installer program. The installer is about 182 MB in size. You need to download and run it. You will need to have an Internet connection because the installer will be downloading installation files from the internet. On one of the first screens there will be an opportunity for you to enter the serial number that you have received. The next step is to select which platforms and optional features you want to install, as shown in the image below. You can pick only a few and get back to install more later, directly in the Delphi IDE.

In a few minutes (mostly depending on the features and platforms you select) you should have the development environment ready to start working, and it's community splash screen:

In Part 2 of this series, we will start writing our first programs! Before we actually start programming, let's make sure there is a clear understanding of who can use Delphi Community Edition

But What is Delphi Community Edition?

What is Delphi Community Edition? Is it free? Can it be used commercially? Can I use it as a student?

Put simply, yes (with caveats) for all three.

Delphi Community Edition is intended to get people started with Delphi, and that can be either getting started with programming in general - such as a student - or for starting something else, such as writing software for your startup company.  It has the same features as our Professional Edition, but with a restricted commercial license That's enough to learn to program, or to write a saleable Windows or mobile application. If you are a startup, you can do almost all your development for no cost at all.

The only license restriction is based on revenue. This isn't legal advice - please read the EULA - but once your revenues reach $5000 USD (or local equivalent), or you have 5+ developers, you are required to purchase Pro.

  • So if you're a hobbyist? It's free. Enjoy!
  • If you're a student? It's free. Enjoy!
  • If you're a startup? It's free, but once you start making sales and get incoming revenue of $5000 USD or more, you need to move to Professional or above.
  • If you're an existing company? You may not be able to comply with the revenue and team size license limitation, and you'd have to use a commercial version of Delphi Professional, Enterprise or Architect. Remember there is always the fully-featured RAD Studio trial version if you just want to try Delphi out for free for a limited time.

Delphi Community Edition  is to help you get started. If you're using it and start making money, purchase Pro or higher editions; if you aren't, it remains free. Either way we're very glad you're using our products, and this series of blogs is a great resource to get you started.

What if I don’t Qualify for Delphi Community Edition? 

Don’t qualify for Delphi Community Edition? You can complete this series with a FREE 30 DAY Trial of RAD Studio, which includes Delphi Architect trial. 

Next in this Series

Part 1: Introduction and Installation (this blog post)

Part 2: Building and Debugging in Delphi

Part 3: Architecture and Layers

Part 4: Designing User Interfaces

Part 5: Putting the Calculator Together

Notice: This series of blog posts was originally written for an earlier release by the late Pawel Glowacki, a Delphi expert who contributed a great deal to the product promotion and friend we all miss

 


Read More

Learn to Program with Delphi Community Edition: Part 2 - Building and Debugging

$
0
0

In the first post we covered the installation of Delphi Community Edition. The best way to learn something is to start using it to build something useful, but not too complicated. Today we will start creating a “calculator” application that we will use as a vehicle to learn the basics of programming in Delphi.

Understanding the IDE

Probably the most important developer tool that programmers use is the compiler. Typically a compiler is available in the form of a command line tool that takes as arguments the location of source code files with programs written by a programmer and generates executable files. Another very important program is a debugger. As the name implies it is used to find “bugs” or “errors” in compiled programs. An “Integrated Development Environment” (IDE) combines code editor, compiler and debugger into one application. There are different Delphi compilers that generate executables for different operating systems. Delphi Community Edition includes compilers that generate code for iOS, Android, Mac OS and Windows. 

A Delphi Project

Typically Delphi compiler needs more than one source code file to generate an executable. Delphi IDE organizes all necessary files to generate an executable into a project. The project name later becomes the name of the resulting executable binary file. When you select options to generate a new project, the IDE automatically generates a number of files for you. Let’s have a closer look into what files and folders the IDE generates.

Project Types

Probably the very first thing to do after starting Delphi is to create a new project. You select “File”, “New” and then you have a choice of creating either a new “VCL Forms Application - Delphi” or “Multi-Device Application - Delphi”. These are two user interface frameworks that you can use with Delphi. The VCL - or Visual Component Library - is the traditional Delphi framework that is there since Delphi 1 and can only be used to create Windows applications. The second framework is focused on creating multi-device applications and has been added to Delphi in version XE2: it is called “FireMonkey” or “FMX”. It is a unique technology on the market that let you build natively compiled applications from the same source code for all major desktop and mobile operating systems. In this series we are going to focus on using the FireMonkey framework.

New Multi-Device Project

Let’s create a new multi-device project that later will become our “calculator” app. In the IDE you can do the same thing is many different ways. You can create a new project using the option on the “Welcome Page”, create it from the “File” menu using the “Multi-Device Application - Delphi” command. You should see the following image:

In this wizard screen you can select the project template to use. There are some complex, ready-to-use templates, but to start simple just pick "Blank Application" template and click "OK". You'll see the following:

The new empty application project will be created for you. Now click on “Save All” to make sure that all files generated by the IDE are securely saved on the hard drive. You should always make sure that you save project files in a new folder, because there is a number of files and subfolders generated for you. It can have any name. Let’s create a new “DelphiCalc” folder.

As you click the Save All toolbar button, you will be prompted to save the main form of your project. A “form” is an application “screen”. A visual application can have one or more visual forms. Save the main form of application as “uFormCalculator” in our newly created folder. After saving the form the IDE will ask you to save the whole project. Here the name that we will choose will become the name of the executable that we are going to create. Let’s give our project the name “DelphiSuperCalculator”. This could be anything, but the name cannot contain spaces, it needs to start from a character and in general needs to be a valid filename.

On the right side of the IDE there is "Project Manager". Here you can see all files that make up the project:

Now let’s go to the file system and have a look into our “DelphiCalc” folder. There are two files called “uFormCalculator” created there. One with *.pas and the second with *.fmx extension. The first file contains the source code with the definition of the form class. For now we are not going to go into the discussion of object oriented programming and what the class is. These are the files in the project folder:

In the “pas” file you will find the line with {$R *.fmx} statement that tells the compiler to look for the second file with the “fmx” extension. This file is managed by the visual form designer and the programmer does not edit this file directly. At the bottom of the IDE there are tabs called "Code" and "Design" that let you switch between code and form view.

You will also find two files called “DelphiSuperCalculator” in there. One with the “dpr” and one with “dproj” extensions. You can preview the content of the “dpr” file in the IDE by selecting “View Source” option in the “Project” menu. In Delphi the execution of the application always starts from a file that has the “program” keyword in the very first line. By convention the IDE gives this file “dpr” extension. The second “dproj” file is managed by the IDE and contains XML code that drives the MSBuild engine that manages the actual process of compilation. There are also some additional files that are generated by the IDE, but right now they are not critical to understand the basics.

Building the Project

The IDE not only allows us build the application, but you can also run it from within the development environment. In the “Project” menu you will find the option to build the application. We can also select “Run” command that will first build the project and then run it. The easiest way is to just click on the green arrow icon under the menu.

Click on the “Run” icon. The IDE will begin compiling the source code files that make up the project:

In the lower pane there will be messages with information showing what commands and parameters have been executed. In a moment you should see an empty form displayed. If you go to the Windows Task Manager you will see that “DelphiSuperCalculator” app is running:

Close the application and go back to the file system. After running the application the first time, the IDE has created a subfolder called “Win32”. This is how the IDE organizes output from different compilers. If we were creating an app for other platforms, there would be additional subfolders like “Win64” or "Android". Under the “Win32” folder there is “Debug” subfolder and there you can find the “DelphiSuperCalculator.exe” file which is our executable application! At this stage our app does not do anything useful but later we will add functionality to it.

Debugging the Project

Another very important functionality of the IDE is debugging. Programming is a mental art. Sometimes the compiled program does not behave how you think what your application should behave. At such moments the debugger is a super useful tool to you step through the execution of the program. You can also inspect and change almost all aspects of the environment in which your application executes from the contents of variables that you define to computer processor registers (if you need to).

In order to use the debugger we need to start adding some source code to our project. Let’s do something super simple. In the right-bottom part of the IDE you will find the “Tool Palette” that contains lots of reusable components that are used as building blocks for your applications. Locate “TButton” component and double-click on it. A new button will be added to the form:

Double-click on the button. You will be moved from the Form Designer to Code Editor. The “OnClick” event has been generated for you. Now you can enter between “begin” and “end” keywords the code that will be executed when the end user clicks on the button:

Type there one line of code (the one in the middle):

procedure TForm12.Button1Click(Sender: TObject);
begin
  ShowMessage ('Hello from Delphi');
end;

Click on “Save All” and “Run”. If you click on the button, you should see the message:

Go back to the code editor and click on the left side of the “ShowMessage” line in the gutter. That should add a red circle - so called “breakpoint” - and mark the whole line of code in red.

Now click on the button next to green arrow that has a hint “Run with Debugging”. This will start the program in the debugger. After you click on the button, the program will stop and you will be taken back to the code editor. The IDE will display many new windows:

You can go to “View - Debug” menu to see what debug windows are available.

What’s Next

That’s it for this time. We have created our first project, run and debugged it. Next week we will continue building our first Delphi “calculator” app! These are the blog post in this series:

Part 1: Introduction and Installation 

Part 2: Building and Debugging in Delphi (this blog post)

Part 3: Architecture and Layers

Part 4: Designing User Interfaces

Part 5: Putting the Calculator Together

Notice: This series of blog posts was originally written for an earlier release by the late Pawel Glowacki, a Delphi expert who contributed a great deal to the product promotion and a friend we all miss

 


Read More

Learn to Program with Delphi Community Edition: Part 3 - Architecture and Layers of Code

$
0
0

This is Part 3 of our five part “Learn to Program” series. In Part 2, we created “DelphiSuperCalculator” project and learned how to build, run and debug it. 

Layers

Before rushing into writing code it is a good thing to step back first and think about the overall architecture of your app. This typically involves breaking your app into smaller parts and in code a typical metaphor is a "layer" or "tier" of code. Even in the simplest possible app there could be at least two layers: one for the GUI (Graphical User Interface) and one for the application logic. Keeping the GUI part as thin as possible is always a good idea, especially when you build different screens for the same logic. Below the application logic there is typically some kind of data or service access layer, which encapsulates all aspects of interactions between an app and services or databases it depends on. Going further there are multi-tier, scalable, cloud architectures where database access can be further divided into additional layers which is important to implement scalable, fault-tolerant, multi-user systems.

You may think that a simple calculator apps does not need to have a “proper architecture”, but this leads to messy applications very quickly. Sooner than you expect even the simplest app starts to be complicated. Keeping the architecture of your app clean is one of the most important things in programming to improve performance, readability, and ongoing maintenance (and you never know when you might reuse a piece of code you wrote in a hurry today in a bigger application down the road).

In the case of our simple calculator app we can define just two layers. One layer with GUI - that is our main form unit, and one with the "calculation engine" that should live in a separate unit.

Adding a Second Unit

Let’s add a new unit (that is, a new Object pascal source code file) to our app with the File > New > Unit - Delphi command and save it as “uCalculator”. Here we are going to define a “TCalculator” class that is going to be responsible for performing basic calculations like adding, subtracting, multiplying and dividing numbers.

Enter the following code in the new unit:

unit uCalculator;

interface

type
  TCalculator = class
  public
    class function Add(a, b: Double): Double;
    class function Subtract(a, b: Double): Double;
    class function Multiply(a, b: Double): Double;
    class function Divide(a, b: Double): Double;
  end;

implementation

{ TCalculator }

class function TCalculator.Add(a, b: Double): Double;
begin
  Result := a + b;
end;

class function TCalculator.Divide(a, b: Double): Double;
begin
  Result := a / b;
end;

class function TCalculator.Multiply(a, b: Double): Double;
begin
  Result := a * b;
end;

class function TCalculator.Subtract(a, b: Double): Double;
begin
  Result := a - b;
end;

end.

The Object Pascal language used in Delphi has been designed to teach good programming practices. It is very readable and helps develop programs in the top-down fashion. It is possible to write your code in a purely procedural fashion, ignoring completely object-oriented programming. However thinking about the problem domain in terms of objects and classes of objects proved to be a very good approach.

We want to implement calculator app, so we would probably want to have a "TCalculator" class that could be used for encapsulating calculator functionality. When you define a class it serves as a blueprint for creating objects of this class. In the case of our calculator we do not really need to have an instance of a calculator. Here the class serves more as a grouping of related arithmetic operations. That is why declarations of TCalculator methods have been preceded with a "class" modifier (which corresponds to "static" in C++). Class members of a class belong to the type itself, and you do not need to instantiate an object in order to call them. That's what we want. In our application code we would be able to type just "z := TCalculator.Add(x,y);" without creating a TCalculator object.

In Part 4 we will start building the user interface for our calculator and write code that will use our TCalculator class.

Next in this Series

Part 1: Introduction and Installation

Part 2: Building and Debugging in Delphi

Part 3: Architecture and Layers (This blog post)

Part 4: Designing User Interfaces

Part 5: Putting the Calculator Together


Read More
Viewing all 1683 articles
Browse latest View live


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