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

macOS Sierra および iOS Simulator 向けの Debugger Hotfix がリリースされました [JAPAN]

$
0
0

2017/1/11付けの David Millington 氏のブログ記事にて案内されていますとおり、macOS Sierra および iOS Simulator 向けの Debugger Hotfix がリリースされました。

Hotfix は下記URLよりダウンロードできます。
http://cc.embarcadero.com/item/30680

この Hotfix をインストールすることで、macOS Sierra や iOS Simulator 向けのデプロイやデバッグに関する問題が解消されます。

なお、readme にて説明されているインストール手順が少々冗長でしたので、これをもうちょっとシンプルに行う方法をご案内します。


Read More

【シーズン2】 プログラミング言語をやさしく覚えよう![JAPAN]

$
0
0

昨年、無料の Delphi / C++ Starter Edition を使用して行った チュートリアルシリーズの 続編、 シーズン2を、1月23日(月)より開始いたします!

前シーズン、多くのお方々に視聴いただけたこと、御礼申し上げます。ビジュアル開発のDelphi / C++Builder の特性を生かして、かんたんなシューティングゲームのプログラム作成をおこないましたが、今シーズンはかんたんに作れる、といったコンセプトから離れて、DelphiとC++の言語の基礎を学びます。

かんたんに作れることが特徴のビジュアル開発でありますが、やはりプログラミングの言語はしっかりと身に着けておきたいもの。そこでシーズン2 は基礎固めをすべく「言語」にフォーカスします。


Read More

Modern Web Applications with Intraweb and Bootstrap with Olaf Monien

$
0
0

Building Web applications with Delphi and Intraweb is possible since many years. If you start off using the standard template that comes with the latest Delphi versions, then your application will look and feel outdated and ugly though. There is an open source Bootstrap integration for Intraweb, which will move your Intraweb applications into this century. In this session I will show you how to build great Web applications with Delphi. Materials: http://bit.ly/CRXI-MONIEN

Olaf Monien has been working as an IT consultant for international companies for many years. His areas of special interest are software architecture, database design, Internet applications and mobile devices. Olaf is the CEO of Developer Experts, LLC, a US based company, Olaf is also the owner of EDV-Beratung Monien, a Germany based company. Both companies are focussing on consulting and training in the area of Delphi software development. Developer Experts is an Embarcadero Technology Partner. Olaf Monien is an Embarcadero Technologies MVP and maintains a strong relationship with Embarcadero's development team. Olaf received a Master of Computer Science degree and has more than 25 years of software development experience.


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

Read More

IoT Boot Camp 2017

$
0
0

In this bootcamp you will learn how to build a RESTful Network of IoT Devices with Arduino and RAD Server. Arduino open source hardware provides a flexible platform to build connected Internet of Things hardware projects. RAD Server provides a RESTful service. 

Join industry experts for this FREE 4-day online workshop that runs February 6 to 9th. Create connected device projects with open source hardware. Connect several IoT (Internet of Things) devices to a smart network with RAD Server. Publish your RAD Server APIs with YAML and Swagger and share your smart network with the world.

During the course of this Boot Camp, you’ll have the opportunity to participate in these engaging experiences:

  • Day 1 - Rapidly customize and connect to Arduino based IoT device projects

  • Day 2 - Using RAD Studio, programmatically connect and configure your own IoT devices (through Bluetooth and app-tethering)

  • Day 3 - Build an auto-managing connected network of IoT devices that employs a unified REST API—using RAD Server and ThingPoints

  • Day 4 - Connect to the IoT network with your favorite programming languages, including consuming YAML into Swagger to create code for use in other languages.

Register for this FREE Boot CampStay tuned for more information on the the hardware and additional software to be used during the bootcamp. If you aren't currently on RAD Studio Berlin, then upgrade now, or download the 30-day free trial


Read More

3 mobile killer Delphi & C++Builder apps, developer view with Vsevolod Leonov

$
0
0

1C-RARUS is the biggest Russian software vendor, providing the most popular solution for accounting (more than 1 000 000 users). The company uses Delphi FMX platform for mobile app development, and we'll show 3 killer apps from inside (architecture, structure, component stack).

Vsevolod Leonov (aka Seva), Embarcadero MVP, over 15 years of experience in complicated software development for Delphi development, evangelism and IT trainings. Developer lead at rarus.ru/en, biggest Russian vendor. Vsevolod Leonov, manager Vitaliy Krivyakov, developer MobilityLab, 1C-RARUS


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

Read More

Use FireDAC to MSSQL Server in parallel(std::vector<std::thread>)[JAPAN]

$
0
0

std::thread exists.It is in the standard from C++11.

Insert data in MS-SQL Server in this way.

The data is a Japanese address CSV. that is,

It is in the post office in Japan web site.

The data looks something like this.

"0600000","北海道","札幌市 中央区","以下に掲載がない場合","HOKKAIDO","SAPPORO SHI CHUO KU","IKANIKEISAIGANAIBAAI"
"0640941","北海道","札幌市 中央区","旭ケ丘","HOKKAIDO","SAPPORO SHI CHUO KU","ASAHIGAOKA"
"0600041","北海道","札幌市 中央区","大通東","HOKKAIDO","SAPPORO SHI CHUO KU","ODORIHIGASHI"

It is a CSV mixed with Japanese.

To insert with TFDQuery,TFDConnection, do this.

////
		inline static void sql_add(String sql_values)
		{
			CoInitialize(nullptr);
			try
			{
				std::unique_ptr<TFDConnection> fdc_{std::make_unique<TFDConnection>(nullptr)};
				std::unique_ptr<TFDQuery> query_{std::make_unique<TFDQuery>(nullptr)};

				try
				{
					fdc_->DriverName 	= "MSSQL";
					fdc_->LoginPrompt   = false;
					fdc_->Params->Append("Server=localhost");
					fdc_->Params->Append("User_Name=sa");
					fdc_->Params->Append("Password=test");
					fdc_->Params->Append("Database=dbname");
					fdc_->Params->Append("DriverID=MSSQL");
					fdc_->Connected     = true;
					query_->Connection  = fdc_.get();
					query_->SQL->Text 	= sql_values;
					std::cout << (static_cast<AnsiString>(sql_values)).c_str() << "\n";
					query_->ExecSQL();
				}
				catch(...){}
			}
			__finally
			{
				CoUninitialize();
			}

		}

 

Read "CSV File" and loop processing.This is making 5 threads.

I used std::thread, but I think that System.Threading.TTask is also good.

////
		void load_csv(String csv_filename , std::function<void(String)> aproc)
		{
			std::unique_ptr<TStringList> csv =std::make_unique<TStringList>();
			try
			{
				int count_{0};
				csv->LoadFromFile(csv_filename, System::Sysutils::TEncoding::ANSI);

				for (int i=0; i < csv->Count; i++)
				{
					//aproc(csv->Strings[i]);

					std::vector<std::thread> v1;
					v1.clear();
					for (int th_count = 0; th_count < 5; th_count++) {
						if ((i+th_count) < csv->Count)
						{
							String line_ = csv->Strings[i+th_count];
							v1.push_back(std::thread([&](){aproc(line_);}));
						}
					}
					for (auto th_= v1.begin(); th_!=v1.end(); th_++) {
						th_->join();
					}
					Sleep(100);
					i +=4;
				}
				for (AnsiString line: csv.get())
				{

					count_++;
				}
			}
			catch(...){}
		}


It is a function calling "void load_csv(String csv_filename , std::function<void(String)> aproc)" and lambda.

////
		void start()
		{
			load_csv("C:\\Embarcadero\\ado_zip_insert\\KEN_ALL_ROME_test.CSV",
				[&](String aline){
					String sql_;
					std::wstringstream cols_;
					std::wstring value_;
					try
					{
						cols_.str(StringReplace(aline,L"\"", "",TReplaceFlags()<<rfReplaceAll).w_str());
						while (std::getline(cols_, value_, L',')){
							sql_ = sql_ + "'" + value_.c_str() + "',";
						};
						sql_add(
							Format(L"insert into T_ZIP values(%s, getdate())",
							ARRAYOFCONST(( sql_.Delete(sql_.Length(), 1) ))) );
					}
					catch(...){}
				}
				);
		}

 

Call on the main.

////
#include <FireDAC.Comp.Client.hpp>
#include <FireDAC.Comp.DataSet.hpp>
#include <FireDAC.DApt.hpp>
#include <FireDAC.DApt.Intf.hpp>
#include <FireDAC.DatS.hpp>
#include <FireDAC.Phys.hpp>
#include <FireDAC.Phys.Intf.hpp>
#include <FireDAC.Phys.MSSQL.hpp>
#include <FireDAC.Phys.MSSQLDef.hpp>
#include <FireDAC.Stan.Async.hpp>
#include <FireDAC.Stan.Def.hpp>
#include <FireDAC.Stan.Error.hpp>
#include <FireDAC.Stan.Intf.hpp>
#include <FireDAC.Stan.Option.hpp>
#include <FireDAC.Stan.Param.hpp>
#include <FireDAC.Stan.Pool.hpp>

#include <functional>
#include <memory>
#include <sstream>
#include <thread>
#include <vector>

 

////
namespace yubin_postoffice_japan
{
	struct Tmssql_import
	{
		Tmssql_import()
		{
			start();
		}
		~Tmssql_import(){}
		inline static void sql_add(String sql_values)
		void load_csv(String csv_filename , std::function<void(String)> aproc)
		void start()
	};
}

 

 It is a project of console application.

////
int _tmain(int argc, _TCHAR* argv[])
{
	using namespace yubin_postoffice_japan;
	TDateTime dtTemp{Now()};
	Tmssql_import();
	String out = "elapsed time "+FormatDateTime("hh:nn:ss.zzz", Now() - dtTemp);
	std::cout << out.c_str() << std::endl;
	OutputDebugString(out.w_str());

	return 0;
}




Read More

Multi-device Applications Using Embedded InterBase ToGo (Delphi) with Al Mannarino

$
0
0

Build a secure multi-device application using the embedded InterBase ToGo database to maximize data security using the embedded InterBase ToGo with both Database and Column Level Encryption. This session will also discuss multiple forms of database encryptions, including: - “Over the Wire” network encryption, - Strong Encryption (AES), - Database and Column Level Encryption, - Backup Encryption, and - Long Password Support (SHA-1) - How to Improve application robustness with Log-based Journaling, - Disaster Recovery and Automatic Crash Recovery capabilities - Demonstrate building a secure multi-device application using the embedded InterBase ToGo database.

Al Mannarino, SC Embarcadero Technologies


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

Read More

Ваши компоненты и библиотеки в дистрибутиве RAD Studio

$
0
0

Новый год всегда приносит надежду на хорошие изменения и обновления. В согласии с ранее объявленным перспективным планом, мы ожидаем свежего "большого" релиза RAD Studio в начале 2017 года. Я уже писал о поддержке разработки приложений для новой платформы - серверных сред под управлением Linux - в одном из предыдущих постов.

Вы хотите, чтобы в составе нового дистрибутива сразу были видны и готовы для скачивания и установки разработанные вами компоненты или библиотеки? Это возможно! Вы можете предоставить разработанные вами инструменты, компоненты или фреймворки - платные или распространяемые свободно - практически каждому пользователю Delphi или C++Builder, если поместите их в онлайн-каталог менеджера пакетов GetIt.

Онлайн каталог и менеджер пакетов GetIt доступны всем пользователям RAD Studio и входящих в нее инструментов, начиная с версии XE8. С этого же времени компания Embarcadero предоставила пользователям возможность расширять этот каталог своими разработками.  Все уже в курсе?

Если запустить IDE и посмотреть разделы каталога, то можно найти как бесплатные, так и платные варианты наборов компонент или библиотек, разные варианты лицензирования и монетизации. Можно разместить ограниченную пробную версию. Сейчас этот онлайн-каталог выполняет функции сходные с знаменитыми сайтами Torry's Delphi Pages или Королевство Делфи.

Основная цель GetIt состоит в том, чтобы дать возможность каждому пользователю быстро найти полезные для него библиотеки, компоненты или другой код, которые расширяют возможности стандартной среды разработки. Это также означает, что переход к следующим версиям RAD Studio должен стать проще, так как существующие проекты без проблем переводятся на новые версии при помощи быстрого выкачивания соответствующей версии использованного расширения.  Поэтому, в каталог включается не любая прикладная программа, а качественные и проверенные наборы компонент, дополнительные библиотеки и вспомогательные инструменты, расширяющие возможности текущей версии Delphi или C++Builder, или облегчающие переход к ней с предшествующих. 

Подробнее о принципах расширения онлайн-каталога GetIt, а также видах и типах разработок, которые могут быть включены в него, написано на странице  Submitting Libraries to the GetIt Package Manager

Если вы хотите, чтобы ваши продукты стали доступны всем пользователям RAD Studio через GetIt, вам нужно послать электронное письмо с запросом на адрес marco.cantu@embarcadero.com, в котором представить описание (на английском языке) продуктов в виде таблицы, образец которой находится в документе "Информация по расширению GetIt". Вы можете скачать его в виде документа MS Word или PDF.

В будущем процесс подачи заявки будет автоматизированным, но по крайней мере, до выхода нового релиза, заявки будут рассматриваться и одобряться сотрудниками Embarcadero, которые оценят возможность добавления в GetIt предложенного продукта, на основе принципов, изложенных в  Submitting Libraries to the GetIt Package Manager, оценки полезности продукта, отсутствия конфликтов с другими продуктами из каталога, четкости правил лицензирования и  качества работы в самых современных версиях RAD Studio.

 


Read More

Delphi: Kinderleicht - App AG am Vareler LMG

$
0
0

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

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

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

http://www.nwzonline.de/varel/sie-entschluesseln-jeden-code_a_6,1,2862134053.html

 


Read More

Delphi Blogs of the Week/Month #49

$
0
0

The first list of interesting links and blog post of 2017, focused on Delphi development.

Embarcadero Udpates

Press release "Embarcadero Announces RAD Studio Desktop Bridge Support for Windows 10 Deployments" including a comment by Kevin Gallo, corporate vice president for the Windows developer platform at Microsoft at http://www.businesswire.com/news/home/20170110005908/en

This press release got also referenced by SD Times at http://sdtimes.com/swift-announces-new-project-lead-embarcadero-updates-rad-studio-and-spare5-relaunches-as-mighty-ai-sd-times-news-digest-jan-11-2017/

There is Debugger Hotfix for macOS Sierra and the iOS Simulator for 10.1 Berlin. Information at https://community.embarcadero.com/blogs/entry/debugger-hotfix-for-macos-sierra-and-the-ios-simulator and download at http://cc.embarcadero.com/item/30680

Blog Posts

World First! A Linux web service written in Delphi by Craig at http://chapmanworld.com/2017/01/12/world-first-a-linux-web-service-written-in-delphi/

Got a link to this fairly interesting blog on Delphi: https://blog.grijjy.com/

Did you ever use Bold? Check out http://boldfordelphi.blogspot.it/2017/01/help-me-to-make-bold-open-source-project.html

I don't know who write this and don't agree in full (and it stirred some discussion), but I found it interesting: https://medium.com/@srcstorm/pascal-independent-language-for-2017-a5a25f7c62d8#.n88868sta

A Delphi wrapper for Slack API by Andrea at https://blog.andreamagni.eu/2017/01/introducing-sdriver-a-delphi-wrapper-for-slack-api/

Integrating with you favorite CRM/ERP web based client -- or poor mans integration? -- by Steffen at http://fixedbycode.blogspot.it/2017/01/integrating-with-you-favorite-crmerp.html

Webinars and More

Check out 2017 upcoming Delphi webinars at https://community.embarcadero.com/article/16466-upcoming-2017-webinars

In particular, there is a new BootCamp focused on Arduino and IoT early February, that looks pretty interesting. More information to come.

 


Read More

FixInsight: Finding Bugs with Static Code Analysis with RomanYankovsky

$
0
0

Roman Yankovsky will show you how to use FixInsight's static code analysis in Delphi to find bugs in your code before your customers do.

Roman Yankovsky of TMS Software is an Embarcadero MVP and the author of FixInsight static analysis tool for Delphi.


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

Read More

Windows 10 Store, Android, iOS, OS X, Linux: recursos para migrar sua aplicação Delphi/C++ Builder e suportar TODAS as plataformas (parte 2)

$
0
0

Na primeira parte deste artigo (aqui) exploramos os principais desafios na migração de projetos Delphi/C++ Builder, listamos alguns tópicos que vamos tratar ao longo de uma série de artigos, e iniciamos o entendimento da parte teórica sobre Unicode.

Neste post vamos retomar o assunto Unicode, porém de um ponto de vista mais técnico, buscando compreender as alterações que são necessárias (ou não) em um projeto.

Vale ressaltar que o suporte a Unicode foi introduzido no Delphi/C++ Builder 2009, portanto, projetos compilados em versões 2009+ não devem sofrer qualquer impacto no tocante a Unicode durante um processo de migração.

O que mudou?

A partir da versão 2009 (inclusive), o tipo String passou a ser definido pelo tipo UnicodeString, que é uma string UTF-16. Da mesma forma, o tipo Char é agora WideChar, um tipo de caractere de dois bytes e PChar é um PWideChar, um ponteiro para um Char de dois bytes.

O ponto significativo sobre as alterações a esses tipos de dados básicos é que, no mínimo, cada caractere é representado por pelo menos um “code unit” (dois bytes), e às vezes mais.

Coincidente com essas mudanças é que o tamanho de uma sequência de caracteres, em bytes, não é mais igual ao número de caracteres na sequência de caracteres. Da mesma forma, um valor do tipo Char não é mais um único byte; são dois bytes.

Opção #1: Mantenha tudo em seu lugar

Uma das opções com relação a Unicode é simplesmente não fazer nada. Isso mesmo… ou na verdade… quase isso. Nas versões anteriores a 2009, o tipo String era então mapeado para AnsiString. Logo, reverter as declaração de String para AnsiString pode ser uma alternativa para uma migração rápida – caso você não necessite suportar caracteres estendidos. O que precisa ser feito, na verdade, é converter declarações String para AnsiString, Chars para WideChars e PChars para PWideChars.

Para auxiliar nesta tarefa, um membro do Australian Delphi Users Group (ADUG) – Roger Connell – criou um convertor para pesquisar seus arquivos  Delphi (.pas e .dpr) e fazer as conversões, se essa abordagem funciona para você:
http: /www.innovasolutions.com.au/delphistuf/ADUGStringToAnsiStringConv.htm

Obviamente, mesmo reduzindo as mudanças ao mínimo, testar e validar sua aplicação previamente a enviá-la para um ambiente de produção, continua sendo uma recomendação mandatória.

Opção #2: Abraçando o Unicode de vez

O Unicode incentiva o uso de alguns novos termos. Por exemplo, a idéia de “caractere” é um pouco menos preciso no mundo do Unicode do que você pode estar acostumado. No Unicode, o termo mais preciso é “code point”. A partir da versão 2009, o SizeOf (Char) é 2. Dependendo da codificação, é possível que um determinado caractere ocupe mais de dois bytes. Estas sequências são chamadas de “Surrogate Pairs“. Assim, um “code point” é um código exclusivo atribuído a um elemento definido pelo Unicode.org. Mais comumente isso é um “caractere”, mas nem sempre.

String agora é igual a UnicodeString, logo suas suposições anteriores sobre o tamanho em bytes de uma matriz de caracteres ou sequência de caracteres podem agora estar incorretas.

Procure qualquer código que:

Pressupõe que SizeOf (Char) é 1. Pressupõe que o comprimento de uma sequência de caracteres é igual ao número de bytes na sequência de caracteres. Diretamente manipula sequências de caracteres ou PChars. Grava e lê strings em algum tipo de armazenamento persistente.

As duas suposições listadas aqui primeiro não são verdadeiras para Unicode, porque para Unicode SizeOf (Char) é maior que 1 byte, e o comprimento de uma sequência de caracteres é metade do número de bytes.

Além disso, o código que grava ou lê a partir de armazenamentos persistentes precisa garantir que o número correto de bytes estão sendo gravados ou lidos, uma vez que um caractere pode não ser mais capaz de ser representado como um único byte.

Compreendidas estas alterações, temos um sem números de ótimos documentos e tutoriais para se aprofundar no tema Unicode, os quais estou listando abaixo, porém gostaria de chamar a atenção para uma ferramenta em especial, o Unicode Statistics Tool. Este pequeno utilitário tem a capacidade de revisar seu código e dizer onde e o que você provavelmente vai ter que mudar. Obviamente, trata-se de um auxiliar e não uma ferramenta mágica, mas ajudará muito!

Recursos Adicionais


Read More

BeaconFence客戶端連結RAD Server - 1

$
0
0

在上次的文章中筆者說明了如何使用C++Builder 柏林版開發BeaconFence客戶端App並且能在室內精確定位. 隨後有人寫信詢問筆者是否可再說明如何連結後端查詢功能或是連結到雲端?

  由於DelphiC++Builder本來就對多層和雲端開發有著良好的支援, 因此要讓BeaconFence客戶端App連結後端供查詢或是推播功能, 那麼可有許多選擇, 例如可使用DataSnap, RAD Server, Amazon/MS的雲端服務,以及許多其他第3方解決方案等. 本文將使用RAD Server做為說明範例的後端解決方案, 因為在Delphi/BCB中即內附開發版的RAD Server.

 

首先我們可在IDE中建立EMS Package:

 

接著建立Package的資源, 此資源可稍後輸出讓客戶端呼叫使用:

 

選擇建立資料模組型態的資源並為此資源取名為對您有義意的名稱, 在本文中將使用” IoTBeaconFence範例POC

接著選擇您的資源要提供的服務種類, 例如下面筆者勾選了所有的功能以便提供完整的CRUD功能:

點選Finish按鈕後Delphi/C++Builder便會建立相關的檔案, 在建立的資料模組看到下面的程式碼:

type

  [ResourceName('IoTBeaconFence範例POC')]

  TIoTBeaconFencePOCResource1 = class(TDataModule)

  published

    procedure Get(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse);

    [ResourceSuffix('{item}')]

    procedure GetItem(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse);

    procedure Post(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse);

    [ResourceSuffix('{item}')]

    procedure PutItem(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse);

    [ResourceSuffix('{item}')]

    procedure DeleteItem(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse);

  end;

 

在本文中將使用下面的範例InterBase資料表讓客戶端的BeaconFence客戶端App進行CRUD的功能:

 

回到上面的範例資源資料模組, 加入下面的FireDAC元件連結範例InterBase資料表:

其中的qryBeacons元件使用SQL命令取得所有的範例資料:

SELECT * FROM TBLBEACONS

qryTheBeacon元件則可根據Beacon的資訊查詢特定Beacon相關的資料:

select NOTES from TBLBEACONS where BGUID = :BID and MAJORID = :ID1 and MINO

接著在資料模組的Get方法中使用下面的程式碼開啟qryBeacons元件, 取得InterBase範例資料表中的所有資料, 再以JSON格式儲存到TMemoeyStream中再回傳到客戶端:

procedure TIoTBeaconFenceResource1.Get(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse);

var

  oStr: TMemoryStream;

begin

  oStr := TMemoryStream.Create;

  try

    try

      qryBeacons.Open;

      FDSchemaAdapter1.SaveToStream(oStr, TFDStorageFormat.sfJSON);

      // Response owns stream

      AResponse.Body.SetStream(oStr, 'application/json', True);

    except

      oStr.Free;

      raise;

    end;

  finally

    qryBeacons.Close;

  end;

end;

 

現在我們就可以在IDE中執行此專案, 就可以看到RAD Server顯示它入了我們的 IoTBeaconFence範例POC” 資源而且此資源中提供了”Get”, “GetItem”, “Post”等服務方法:

 

OK, 現在我們就可以叫此範例 IoTBeaconFence範例POC” 資源並取得資料. 由於RAD Server是一個RESTful架構, 因此我們可以直接先用瀏覽器即可, RAD Server上方即有Open Browser按鈕, 點選它即可在瀏覽器中看到EMS的版本:

由於筆者的RAD Server的執行於8080通訊埠, 因此要叫範例資源服務, 我們只需使用範例資源名稱取代上面的Version資訊名稱即可執行一個查詢的動作, 而查詢功能即會自動在RAD Server中執行Get方法, 因此就會執行上面我們撰寫的程式碼. 因此我們在瀏覽器打入:

http://localhost:8080/IoTBeaconFence%E7%AF%84%E4%BE%8BPOC

 

即可看到RAD Server回應下面的執行結果:

 

OK, 我們的確在客戶端取得了資料表中所有Beacons的資訊了, 下回我們將說明如何建立Windows客戶端使用Backend元件RAD Server服務, 接著再修改AppBeaconFence App也可使用RAD Server提供的服務.

 

 

 

 

 

 

 


Read More

BeaconFence客户端连结RAD Server - 1

$
0
0

在上次的文章中笔者说明了如何使用C++Builder 柏林版开发BeaconFence客户端App并且能在室内精确定位. 随后有人写信询问笔者是否可再说明如何链接后端查询功能或是链接到云端?

  由于DelphiC++Builder本来就对多层和云端开发有着良好的支持, 因此要让BeaconFence客户端App连结后端供查询或是推播功能, 那么可有许多选择, 例如可使用DataSnap, RAD Server, Amazon/MS的云端服务,以及许多其他第3方解决方案等. 本文将使用RAD Server做为说明范例的后端解决方案, 因为在Delphi/BCB中即内附开发版的RAD Server.

 

首先我们可在IDE中建立EMS Package:

 

接着建立Package的资源, 此资源可稍后输出让客户端呼叫使用:

 

选择建立数据模块型态的资源并为此资源取名为对您有义意的名称, 在本文中将使用” IoTBeaconFence范例POC

 

接着选择您的资源要提供的服务种类, 例如下面笔者勾选了所有的功能以便提供完整的CRUD功能:

点选Finish按钮后Delphi/C++Builder便会建立相关的档案, 在建立的数据模块看到下面的程序代码:

type

  [ResourceName('IoTBeaconFence范例POC')]

  TIoTBeaconFencePOCResource1 = class(TDataModule)

  published

    procedure Get(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse);

    [ResourceSuffix('{item}')]

    procedure GetItem(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse);

    procedure Post(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse);

    [ResourceSuffix('{item}')]

    procedure PutItem(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse);

    [ResourceSuffix('{item}')]

    procedure DeleteItem(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse);

  end;

在本文中将使用下面的范例InterBase数据表让客户端的BeaconFence客户端App进行CRUD的功能:

 

回到上面的范例资源数据模块, 加入下面的FireDAC组件链接范例InterBase数据表:

其中的qryBeacons组件使用SQL命令取得所有的范例数据:

SELECT * FROM TBLBEACONS

qryTheBeacon组件则可根据Beacon的信息查询特定Beacon相关的资料:

select NOTES from TBLBEACONS where BGUID = :BID and MAJORID = :ID1 and MINO

接着在数据模块的Get方法中使用下面的程序代码开启qryBeacons组件, 取得InterBase范例数据表中的所有数据, 再以JSON格式储存到TMemoeyStream中再回传到客户端:

procedure TIoTBeaconFenceResource1.Get(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse);

var

  oStr: TMemoryStream;

begin

  oStr := TMemoryStream.Create;

  try

    try

      qryBeacons.Open;

      FDSchemaAdapter1.SaveToStream(oStr, TFDStorageFormat.sfJSON);

      // Response owns stream

      AResponse.Body.SetStream(oStr, 'application/json', True);

    except

      oStr.Free;

      raise;

    end;

  finally

    qryBeacons.Close;

  end;

end;

 

现在我们就可以在IDE中执行此项目, 就可以看到RAD Server显示它加载了我们的” IoTBeaconFence范例POC” 资源而且此资源中提供了”Get”, “GetItem”, “Post”等服务方法:

 

OK, 现在我们就可以呼叫此范例” IoTBeaconFence范例POC” 资源并取得资料. 由于RAD Server是一个RESTful架构, 因此我们可以直接先用浏览器即可呼叫, RAD Server窗口上方即有Open Browser按钮, 点选它即可在浏览器中看到EMS的版本:

由于笔者的RAD Server的执行于8080通讯端口, 因此要呼叫范例资源服务, 我们只需使用范例资源名称取代上面的Version信息名称即可执行一个查询的动作, 而查询功能即会自动在RAD Server中执行Get方法, 因此就会执行上面我们撰写的程序代码. 因此我们在浏览器打入:

http://localhost:8080/IoTBeaconFence%E7%AF%84%E4%BE%8BPOC

 

即可看到RAD Server响应下面的执行结果:

OK, 我们的确在客户端取得了数据表中所有Beacons的信息了, 下回我们将说明如何建立Windows客户端使用Backend组件呼叫RAD Server服务, 接着再修改AppBeaconFence App也可使用RAD Server提供的服务.

 

 


Read More

TCalendarView Custom Painting

$
0
0

The latest version of RAD Studio 10.1 Berlin Anniversary Edition introduced among other things two brand new VCL controls: TCalendarView and TCalendarPicker. Now there is in total 7 different VCL controls in the "Windows 10" category in the Tool Palette.

The best thing about these controls is that they do have Windows 10 look-and-feel, but they are pure VCL, so they do not depend on Windows 10 API and as such can be used for example on Windows 7. I really like to play with them and "TCalendarView" is one of my favorites. There is already quite some information on the Embarcadero Community site about its functionality

One of the coolest features of "TCalendarView" is that it can be custom painted. For example we may want to paint "Saturdays" and "Sundays" in red color, so our calendar is more readable. In fact it is very easy to achieve. There are three "OnDraw" events that can be used to customise drawing of each three possible views of a calendar

  • OnDrawDayItem
  • OnDrawMonthItem
  • OnDrawYearItem

To make the demo more complete let's also draw in red the current month and the current year. Here is the code.


uses
  System.DateUtils;

procedure TForm3.CalendarView1DrawDayItem(Sender: TObject;
  DrawParams: TDrawViewInfoParams; CalendarViewViewInfo: TCellItemViewInfo);
var d: integer;
begin
  d := DayOfTheWeek(CalendarViewViewInfo.Date);
  if (d = 6) or (d = 7) then
    DrawParams.ForegroundColor := clRed;
end;

procedure TForm3.CalendarView1DrawMonthItem(Sender: TObject;
  DrawParams: TDrawViewInfoParams; CalendarViewViewInfo: TCellItemViewInfo);
begin
  if MonthOf(CalendarViewViewInfo.Date) = CurrentMonth then
    DrawParams.ForegroundColor := clRed;
end;

procedure TForm3.CalendarView1DrawYearItem(Sender: TObject;
  DrawParams: TDrawViewInfoParams; CalendarViewViewInfo: TCellItemViewInfo);
begin
  if YearOf(CalendarViewViewInfo.Date) = CurrentYear then
    DrawParams.ForegroundColor := clRed;
end;

function TForm3.CurrentMonth: word;
var y,m,d: word;
begin
  DecodeDate(Now,y,m,d);
  Result := m;
end;

function TForm3.CurrentYear: integer;
var y,m,d: word;
begin
  DecodeDate(Now,y,m,d);
  Result := y;
end;

This is how our custom painted calendar looks in action.

    

This architecture is really nice. You can customise the look of the "TCalendarView" VCL component in many creative new ways. Enjoy!


Read More

IoT Boot Camp – Rapidly building a connected network of devices.

$
0
0
Arduino and RAD Server / IoT Boot CampArduino and RAD Server / IoT Boot Camp

IoT Boot Camp – From Arduino to any programming language

On the 6th February Embarcadero is running a free developer IoT boot camp, specifically looking at making some cool IoT devices and then building a network of connected devices using ThingPoints™ with RAD Server™.

During the boot camp you will learn how to work and build IoT Devices using Arduino maker boards and integrate them (along with another 50+ IoT device that RAD Studio IDE includes components for) into a RESTful middle-tier that can be accessed via any leading development language easily.

Day 1 – Building an IoT device with Arduino Day 2 – Programmatically controlling your IoT device Day 3 – Building a centrally managed distributed IoT network Day 4 – Connecting to the IoT network with multiple development languages

Options for coding along at home

While not necessary, you will get more out of the Boot Camp if you can follow along at home.

On day 1, you will go over the steps to make a IoT board using Visuino  (who have teamed up with the guys at Maker Fabs to create a hardware kit you can order in).

On day 2 you can connect to an IoT device component from the list of 50+ components available in the GetIt package Manager. (not on the latest RAD Studio? Download the trial to explore the options.)

On day 3 Connect to and use the IoT devices via REST as we establish the devices into a self managed network of IoT devices that allows device discovery – This will use RAD Server.

On day 4 you can see how to consume the REST Server from any leading programming language by using YAML and SwaggerUI via RAD Server.

Register & Download the trial

Register your free space on Boot Camp

Register Now Download your free 30 day RAD Studio trial*

*Boot Camp will use RAD Studio 10.1.2 Berlin Enterprise.  You will need  Delphi, C++ or RAD Studio Enterprise license on you machine for boot camp. If you already have 10.1 Berlin Starter or Professional installed, you may want to use a VM to run the trial (or you can upgrade now – check out the latest offers that include FREE RAD Server licenses

The post IoT Boot Camp – Rapidly building a connected network of devices. appeared first on Stephen Ball's Technical Blog.


Read More

FireUI Multi-Device Designer Deep Dive With Sarina DuPont

$
0
0

In this deep dive, Sarina will cover designing applications for multiple form factors using the FireUI Multi-Device Designer, native rendering support for FireMonkey, custom UI styling, FireUI Live Preview support and other key features for building applications for multiple platforms. This session will also include FireUI tips and tricks and frequently asked questions.

Sarina DuPont Embarcadero Technologies Senior Product Manager


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

Read More

RAD IoT Boot Camp Hardware Bundle!

$
0
0

Thanks to the hard work of Boian Mitov of Visuino and Mitov Software, and the fine folks over at MakerFabs we have an official kit for our boot camp. This kit was designed to work with our boot camp, so you will know you are getting quality compatible components. We may not get to all of these components during the bootcamp, but we will follow up with more materials after the camp to put them to work.

MakerFabs IoT Boot Camp Kit

MakerFabsThey offer a few shipping options so you should be able to get your package in time. If not, or if you want to only order some of the parts, even from a different vendor, here is the list of parts in the package. The bundled package also includes a nice case and discount. If you are new to Arduino and open hardware this package is designed as a great way to get started. 


Package List:

[DownloadButton Product='Delphi' Caption='Download the RAD Studio Trial today!']

Visuino


Read More

Create Fluent REST Client Interface with Cesar Romero

$
0
0

How to create a simple to use REST Client Fluent API using using Delphi REST Client Library and JsonDataObjects.

Cesar Romero Silva, Trier Sistemas


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

Read More

Create IoT solutions with Delphi and Arduino with Boian Mitov

$
0
0

Create IoT solutions with Delphi and Visuino Connect to Arduino or ESP8266 type devices from Delphi using USB, Wi-Fi, Bluetooth LE, or MQTT over Internet.

Boian Mitov is a software developer and founder of Mitov Software, specialized in the areas of Video, Audio, Digital Signal Processing, Data Acquisition, Hardware Control, Industrial Automation, Communications, Computer Vision, Artificial Intelligence, parallel and distributed computing. He is author of the OpenWire open source technology, the IGDI+ open source library, the VideoLab, SignalLab, AudioLab, PlotLab, InstrumentLab, VisionLab, IntelligenceLab, AnimationLab, and CommunicationLab libraries, OpenWire Studio, Visuino, and author of the “VCL for Visual C++” technology.


[YoutubeButton url='https://www.youtube.com/watch?v=ZC3bR856KvE']
 
IoT Boot Camp

Read More
Viewing all 1683 articles
Browse latest View live


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