Watch, Follow, &
Connect with Us

Embarcadero Blogs

Latest Posts


RAD Studio, C++Builder and Delphi July 2014 Special Offers

If you don't have RAD Studio, Delphi or C++Builder XE6 yet, you won't want to miss out on these offers.

If you are currently on version XE or earlier, July is your best time to upgrade to XE6 because you can upgrade from any earlier version and save up to 45% off the regular new user price.

Don't miss out!
Invent Your Future Today!
Cool Embarcadero RAD offers are soon to end, so hurry and get RAD Studio XE6 now - the most complete multi-device tool for Windows, mobile, wearables and beyond. These special offers for upgrades and new users are available through July 31, 2014.
Get free upgrades and support through the end of 2014
When you buy select RAD Studio, Delphi or C++Builder XE6 New User editions by July 31, 2014 and get FREE support and maintenance including all major upgrades free until the end of 2014.

Upgrade to RAD Studio XE6, Delphi XE6 or C++Builder XE6 from any earlier version
Get the tools you need for modernizing your Windows applications and mobile development for Android and iOS, and save up to 45% off the regular new user license price. Offer available until July 31, 2014.

Buy or upgrade NOW from any version and claim your free Bonus Pack of additional tools including the Coding in Delphi ebook by Nick Hodges, Mida Converter, and VCL and FireMonkey Style Packs to help improve your development skills, simplify your multi-device development and create beautifully styled apps.





posted @ Mon, 21 Jul 2014 10:56:00 +0000 by Tim Del Chiaro


BaaS User Accounts and Password Management

Over the last couple of months, I have been covering various BaaS (Backend-as-a-Service) features introduced in RAD Studio XE6.
Today, I thought I would expand on the User Account Creation and Authentication topic I previously covered by showing you how to allow the user to change their password within your BaaS enabled application.

In this app, I am using Kinvey as my BaaS Provider but the UI and code are the same if you are using Parse.
The app consists of 3 Edit controls: One for Username, one for Password and one for the Session ID.
There are also 4 TButtons on the form: One for Sign Up, one for Login, one for Logout, and one for Change Password.
I parented the input controls to TListbox items and added ListBoxItemGroupHeaders to divide up the UI.

Screenshot: iOS UI at design time; Windows app at runtime with Mobile Preview style

Below is the Object Pascal code for my application:

unit Unit7;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, IPPeerClient,
  REST.OpenSSL, REST.Backend.ServiceTypes, REST.Backend.MetaTypes, System.JSON,
  REST.Backend.KinveyServices, FMX.Edit, FMX.StdCtrls, REST.Backend.Providers,
  REST.Backend.ServiceComponents, REST.Backend.KinveyProvider, FMX.ListBox,
  FMX.Layouts;

type
  TForm7 = class(TForm)
    KinveyProvider1: TKinveyProvider;
    BackendUsers1: TBackendUsers;
    ButtonChangePassword: TButton;
    ButtonLogin: TButton;
    ButtonLogout: TButton;
    ButtonSignup: TButton;
    EditPassword: TEdit;
    EditSessionID: TEdit;
    EditUserName: TEdit;
    ListBox1: TListBox;
    ListBoxItem1: TListBoxItem;
    ListBoxItem2: TListBoxItem;
    ListBoxItem3: TListBoxItem;
    ListBoxGroupHeader1: TListBoxGroupHeader;
    ListBoxGroupHeader2: TListBoxGroupHeader;
    ToolBar1: TToolBar;
    Label1: TLabel;
    procedure ButtonSignupClick(Sender: TObject);
    procedure ButtonLoginClick(Sender: TObject);
    procedure ButtonLogoutClick(Sender: TObject);
    procedure ButtonChangePasswordClick(Sender: TObject);
  private
    { Private declarations }
    FLogin: TBackendEntityValue;
    procedure Login;
    procedure Signup;
  public
    { Public declarations }
  end;

var
  Form7: TForm7;

implementation

{$R *.fmx}

procedure TForm7.ButtonChangePasswordClick(Sender: TObject);
var
  LPassword: TJSONObject;
  LUpdatedAt: TBackendEntityValue;
begin
  LPassword := TJSONObject.Create;
  try
    LPassword.AddPair('password', EditPassword.Text);
    BackendUsers1.Users.UpdateUser(FLogin, LPassword, LUpdatedAt);
    Login;
  finally
    LPassword.Free;
  end;
end;

procedure TForm7.ButtonLoginClick(Sender: TObject);
begin
  Login;
end;

procedure TForm7.ButtonLogoutClick(Sender: TObject);
begin
  BackendUsers1.Users.Logout;
  EditSessionID.Text := '';
  EditUsername.Text := '';
  EditPassword.Text := '';
end;

procedure TForm7.Signup;
begin
  BackendUsers1.Users.SignupUser(EditUserName.Text, EditPassword.Text, nil, FLogin);
  BackendUsers1.Users.Login(FLogin);
  EditSessionID.Text := FLogin.AuthToken;
end;

procedure TForm7.Login;
begin
  BackendUsers1.Users.LoginUser(EditUserName.Text, EditPassword.Text, FLogin);
  BackendUsers1.Users.Login(FLogin);
  EditSessionID.Text := FLogin.AuthToken;
end;

procedure TForm7.ButtonSignupClick(Sender: TObject);
begin
  Signup;
end;

end.

posted @ Fri, 18 Jul 2014 16:38:46 +0000 by sarinadupont


Developer Direct 2014 Mobile School: Lesson 4 Slides and Replays

Wednesday, July 16, 2014: Lesson 4 - Building Powerful Multi-tier, Multi-device Applications using DataSnap REST/JSON

This lesson will show you how to create multi-tier applications (in some cases with zero lines of code) that work with your mobile applications. In this lesson, you will learn how to create middle-tier server applications containing business logic and access to remote enterprise SQL databases. This lesson will also show you how to use the same MastSQL.GDB database in the middle-tier for access and updating, update client information from the mobile app, update customer orders, etc. in the mobile client that serves data to iOS and Android devices.

Lesson 4 Slides

You can download the slides (PPTX and PDF) slides and a PDF draft of an unreleased, "Tutorial: Using a REST DataSnap Server with an Application and FireDAC" for the Lesson 4 (Wednesday, July 16, 2014) Developer Direct 2014 Mobile School at

http://cc.embarcadero.com/item/29906

Download size is 4.3mb.

This will allow you to follow along during the course lessons for both C++ and Object Pascal.

Lesson 4 Replays

Watch the Lesson 4 replay videos on YouTube at

Mobile School Lessons Registration

Registration and course information for all six lessons can be found at

http://forms.embarcadero.com/RADSummerSchool2014

Developer Direct Mobile School YouTube Playlist

You will find all of the Developer Direct Mobile School lesson replays (usually appearing within 24 hours of the actual lesson) using the following YouTube playlist:

https://www.youtube.com/playlist?list=PLwUPJvR9mZHhLj-gegxc0KpGE0wL2zVBo


posted @ Wed, 16 Jul 2014 00:56:24 +0000 by David Intersimone


June 2014 BOGO Promo Redemption Info

I have heard some reports that some people are confused or don't understand what the June Buy One Get One offer was or how to redeem it. It's really pretty simple. The offer was a free second tool of equal or lesser value with purchase of qualifying RAD Studio, Delphi and C++Builder XE6 products. Here are some steps to help you redeem if you purchased during the offer period.

Step 1 - Check if you are eligible. If you purchased a Delphi, C++Builder or RAD Studio XE6 product between May 26, 2014 and June 30, 2014 then check the list of qualifying products at http://www.embarcadero.com/bogo-terms to see if the product you purchased qualifies to get a free additional tool. You will see that some products like Starter, Academic, Recharge and Multi-Packs didn't qualify.

Step 2 - Install and register your XE6 product. The free product is issued to the same named user as the paid product so you have to register your paid product first.

Step 3 - Choose your free product from the redemption page. Click here for the redemption page. Enter your registered XE6 serial number and choose your free products.

You'll get your free product serial number emailed to the email address on the account where your XE6 tool is registered and you'll get a download link for the software.

We're giving some extra days after the July 15 deadline to redeem. Be sure you do it within the next week.

Here are some potential issues and how to avoid them:

  • If it won't let you redeem because you haven't installed and registered your XE6 product yet, install and register your XE6 product and then come back to the page to redeem
  • Don't choose a C++Builder or RAD Studio Add-On Pack as your free item if you own Delphi. Don't choose a "Professional edition Add-On Pack" if you don't have a Professional edition tool to add it to. Just be sure to choose an additional tool that logically makes sense.
  • If it won't let you redeem because you logged into the redemption page with a different user account than you used to register the product, then make sure you log into the redemption page with the same account that you used to register your XE6 product.
  • If it says your purchase was made outside the offer period then check to see if you did purchase outside the date range and if that is the case, you are unfortunately not eligible for this offer.

If your purchase didn't qualify for this offer, you are still likely eligible to download the free Bonus Pack items including the FireMonkey and VCL Premium Style Packs from http://cc.embarcadero.com/reg/rad_studio.


posted @ Tue, 15 Jul 2014 10:03:00 +0000 by Tim Del Chiaro


Developer Direct 2014 Mobile School: Lesson 3 Slides and Replays

Monday, July 14, 2014: Lesson 3 - Accessing Local Storage and Data

In this lesson, we explore local storage covering a range of options including using INI files and local document storage. This lesson will also show how to use FireDAC database access components to connect to and use local SQLite, InterBase IBLite and IBToGo. You will understand the core concepts when writing and reading from disk on iOS and Android.

Lesson 3 Slides

You can download the slides (PPTX and PDF) slides for the Lesson 3 (Monday, July 14, 2014) Developer Direct 2014 Mobile School at

http://cc.embarcadero.com/item/29905

Download size is 6.2mb.

This will allow you to follow along during the course lessons for both C++ and Object Pascal.

Lesson 3 Replays

Watch the Lesson 3 replay videos on YouTube at

Mobile School Lessons Registration

Registration and course information for all six lessons can be found at

http://forms.embarcadero.com/RADSummerSchool2014

Developer Direct Mobile School YouTube Playlist

You will find all of the Developer Direct Mobile School lesson replays (usually appearing within 24 hours of the actual lesson) using the following YouTube playlist:

https://www.youtube.com/playlist?list=PLwUPJvR9mZHhLj-gegxc0KpGE0wL2zVBo


posted @ Mon, 14 Jul 2014 14:52:00 +0000 by David Intersimone


Skill Sprint: Android Voice – Speech Recognition and TTS

For my Developer Skill Sprint I was originally scheduled to show how to do a Google Glass Voice Trigger. That is pretty cool because it allows you to launch a Google Glass app with your voice, but I decided to …

Read more »


posted @ Fri, 11 Jul 2014 12:19:16 +0000 by Jim McKeeth


Memo showing console exit

Sometime we need to show command line operations in our applications.

This is possible using windows pipes. Below a unit implementing a memo that gets a bat file exit:


unit UnMemoConsole;

// Code adapted from msdn:
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms682499%28v=vs.85%29.aspx

interface

uses
System.Classes,
System.SysUtils,
Vcl.Forms,
Vcl.StdCtrls,
Winapi.Windows;

const
BUFFER_SIZE = 4096;

type
TMemoThread = class(TThread)
private
Memo: TMemo;
Pipe: THandle;
pi: TProcessInformation;
S: string;
procedure UpdateMemo;
procedure ReadFromPipe;
protected
procedure Execute; override;
public
constructor Create(CreateSuspended: Boolean; pMemo: TMemo; pPipe: THandle;
ProcessInformation: TProcessInformation);
end;

TMemoConsole = class
private
pipe_stdout_read: THandle;
pipe_stdout_write: THandle;
pipe_stdin_read: THandle;
pipe_stdin_write: THandle;
sa: TSecurityAttributes;
si: TStartUpInfo;
pi: TProcessInformation;
Cmdline: array [0 .. 255] of char;
Memo: TMemo;
MemoThread: TMemoThread;
procedure CreateProcessCmd;
procedure WriteToPipe(Command: string);
public
constructor Create(pMemo: TMemo);
destructor Destroy; override;
procedure ExecuteBat(S:string);
end;

implementation

{ MemoThread }

constructor TMemoThread.Create(CreateSuspended: Boolean; pMemo: TMemo;
pPipe: THandle; ProcessInformation: TProcessInformation);
begin
FreeOnTerminate := True;
Memo := pMemo;
Pipe := pPipe;
pi := ProcessInformation;
inherited Create(CreateSuspended);
end;

procedure TMemoThread.Execute;
begin
ReadFromPipe;
end;

procedure TMemoThread.ReadFromPipe;
var
Buffer: array [0 .. BUFFER_SIZE - 1] of Byte;
E: TEncoding;
BytesRead: Cardinal;
I: Integer;
BufferStr, Tmp: string;
List: TArray;
bSuccess: Boolean;
begin
E := TEncoding.GetEncoding(850);
while True do
begin
bSuccess := ReadFile(Pipe, Buffer[0], BUFFER_SIZE, BytesRead, nil);

if (not bSuccess) or (BytesRead = 0) then
break;

BufferStr := BufferStr + E.GetString(BytesOf(@Buffer[0], BytesRead));
BufferStr := BufferStr.Replace(#$A, ”);

if BufferStr[BufferStr.Length - 1] = #$D then
begin
Tmp := BufferStr;
BufferStr := ”
end
else
begin
Tmp := BufferStr.Substring(0, BufferStr.LastIndexOf(#$D));
BufferStr := BufferStr.Substring(BufferStr.LastIndexOf(#$D) + 1);
end;

List := Tmp.Split([#$D]);

for I := Low(List) to High(List) do
begin
S := List[I];
Synchronize(UpdateMemo);
end;
end;

S := BufferStr;
Synchronize(UpdateMemo);

end;

procedure TMemoThread.UpdateMemo;
begin
Memo.Lines.Add(S);
end;

{ TMemoConsole }

constructor TMemoConsole.Create(pMemo: TMemo);
begin
Memo := pMemo;
CreateProcessCmd;
end;

procedure TMemoConsole.CreateProcessCmd;
begin
// Create pipe
sa.nLength := sizeof(TSecurityAttributes);
sa.bInheritHandle := True;
sa.lpSecurityDescriptor := nil;

// Create pipe for cmd stdout
if not CreatePipe(pipe_stdout_read, pipe_stdout_write, @sa, 0) then
Memo.Lines.Add(’Error creating stdout pipe: ‘ +
SysErrorMessage(GetLastError));

// Ensure the read handle to the pipe for STDOUT is not inherited.
if not SetHandleInformation(pipe_stdout_read, HANDLE_FLAG_INHERIT, 0) then
Memo.Lines.Add(’Error setting inheritable stdout read: ‘ +
SysErrorMessage(GetLastError));

// Create a pipe for the child process’s STDIN.
if not CreatePipe(pipe_stdin_read, pipe_stdin_write, @sa, 0) then
Memo.Lines.Add(’Error creating stdin pipe: ‘ +
SysErrorMessage(GetLastError));

// Ensure the write handle to the pipe for STDIN is not inherited.
if not SetHandleInformation(pipe_stdin_write, HANDLE_FLAG_INHERIT, 0) then
Memo.Lines.Add(’Error setting inheritable stdin write: ‘ +
SysErrorMessage(GetLastError));

// Initialize vars to create process
FillChar(si, sizeof(si), #0);
si.cb := sizeof(si);
si.hStdError := pipe_stdout_write;
si.hStdOutput := pipe_stdout_write;
si.hStdInput := pipe_stdin_read;
si.dwFlags := STARTF_USESTDHANDLES or STARTF_USESHOWWINDOW;
si.wShowWindow := SW_HIDE;

FillChar(pi, sizeof(pi), #0);
Cmdline := ‘cmd.exe’;

if not CreateProcess(nil, // No module name (use command line)
@Cmdline[0], // Command line
nil, // Process handle not inheritable
nil, // Thread handle not inheritable
True, // handles are inherited
0, // No creation flags
nil, // Use parent’s environment block
nil, // Use parent’s starting directory
si, // Pointer to STARTUPINFO structure
pi) // Pointer to PROCESS_INFORMATION structure
then
Memo.Lines.Add(SysErrorMessage(GetLastError));
end;

destructor TMemoConsole.Destroy;
begin
// Close process and thread handles.
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
inherited;
end;

procedure TMemoConsole.ExecuteBat(S: string);
begin
MemoThread := TMemoThread.Create(False,Memo,pipe_stdout_read,pi);
WriteToPipe(S);
end;

procedure TMemoConsole.WriteToPipe(Command: string);
var
dwWritten: Cardinal;
chBuf: array [0 .. BUFFER_SIZE - 1] of Byte;
B: TBytes;
bSuccess: Boolean;
E: TEncoding;
begin
E := TEncoding.GetEncoding(850);
FillChar(chBuf, BUFFER_SIZE, 0);
B := E.GetBytes(Command + #$D#$A#0);
Move(B[0], chBuf, Length(B));
bSuccess := WriteFile(pipe_stdin_write, chBuf, Length(B), dwWritten, nil);
if not bSuccess then
Memo.Lines.Add(’Error writting to pipe’ + SysErrorMessage(GetLastError));
end;

end.

In order to use the component you can write something like this:


var
MemoConsole : TMemoConsole;
begin
MemoConsole := TMemoConsole.Create(MeConsoleOutPut);
MemoConsole.ExecuteBat(MeCommands.Lines.Text);
end;


posted @ Fri, 11 Jul 2014 08:24:50 +0000 by rubenpozo


Updated InterBase roadmap

The InterBase Roadmap for 2014 and beyond is now available on the Embarcadero developer network website.

The roadmap highlights some of the exciting things the InterBase team has been working on recently along with what is planned this year and beyond. While the roadmap highlights a part of what is cooking in the labs, I just want to add that it is not a complete list of what is being worked on and everything is not set in stone.

The official document is located here http://edn.embarcadero.com/article/43963


posted @ Thu, 10 Jul 2014 19:52:20 +0000 by Stephen Ball


Developer Direct 2014 Mobile School: Lesson 2 Slides, Projects and Replays

Wednesday, July 9, 2014: Lesson 2 - Turning up the Style and Data!

In lesson 2, we explore how to style controls in your iOS and Android application, start to work with data and manage the link between user interface and model/data. This session will also explore more components and discover the concept of Interfaces and learn how they help you make your code multi-platform ready. Then, we will look at how to use Interfaces in our applications to write code that will work on multiple devices.

Lesson 2 Slides

You can download the Lesson 2 slides (PPTX and PDF) and Marine Adventures projects for Lesson 2 (Wednesday, July 9, 2014) Developer Direct 2014 Mobile School at

http://cc.embarcadero.com/item/29902

Download size is 4.8mb.

This will allow you to follow along during the course lessons for both C++ and Object Pascal.

Lesson 2 Replays

Watch the Lesson 2 replay videos on YouTube at

Mobile School Lessons Registration

Registration and course information for all six lessons can be found at

http://forms.embarcadero.com/RADSummerSchool2014

Developer Direct Mobile School YouTube Playlist

You will find all of the Developer Direct Mobile School lesson replays (usually appearing within 24 hours of the actual lesson) using the following YouTube playlist:

https://www.youtube.com/playlist?list=PLwUPJvR9mZHhLj-gegxc0KpGE0wL2zVBo


posted @ Wed, 09 Jul 2014 15:31:48 +0000 by David Intersimone


Integrate more iOS with an Objective-C Call in your Delphi App - Session Replay Available

Jacob Thurman from TwoDesk Software did a great developer skill sprint session on "Integrating more iOS with an Objective-C Call in your Delphi App" last week. You can access the replay by clicking on the image below.


posted @ Tue, 08 Jul 2014 18:18:27 +0000 by sarinadupont


Server Response from: BLOGS1