Watch, Follow, &
Connect with Us

Embarcadero Blogs

Latest Posts


Consistent Data in Distributed Systems

This is a video replay from the DataU online conference. Data types that are not consistent across multiple systems where data movement occurs could result in loss of data or inconsistent data. Learn how to make sure that objects across multiple systems are consistent and that data from one system will fit into another.

Click here to watch 15 more videos from the DataU series.
Click here to learn more about ER/Studio.

Stanley Chan is a Software Consultant and has been supporting database tools at Embarcadero for almost 10 years. He is responsible for communicating and demonstrating the value of Embarcadero tools to current and prospective customers.


posted @ Mon, 22 Dec 2014 22:35:00 +0000 by Tim DelChiaro


Last Minute Christmas Shopping Ideas

If you still have a few people on your Christmas gift list that you just don’t know what to do for, check out the RAD Offer page. You’ll save some serious money, and they will get the best development tool …

Read more »


posted @ Mon, 22 Dec 2014 17:21:50 +0000 by Jim McKeeth


"RasterrainObjPas" - Simple Ray Tracer in Object Pascal

I always wanted to implement a ray tracer in my favourite Object Pascal programming language. The thing is that it is not trivial, especially when you start reading books like "Physically Based Rendering" you realize that implementing a ray tracer might take a lot of time and work.

Recently on YouTube I have come across a serie of 9 episodes "Raytracer from Scratch in C++" by Caleb Piercy. In these shorter and longer movies you can see the process of writing the ray tracer C++ console Windows application that generates a bmp file with a nice image from the very beginning of setting up the project until the fully functional program. Caleb uses a simple code editor and a makefile to build his application.

The original C++ source code of this program is available as open source from Sourceforge. The project is called "rasterrain".

I have decided to give it a try and translate "rasterrain" project to Object Pascal with Delphi XE7.

The first step was to create in C++Builder XE7 a console project and move over to it the original C++ code from SourceForge.

Delphi XE7 (since version XE6) has a dedicated unit called "System.Math.Vectors" that defines classes, routines, types and variables for using vectors and matrixes. Especially useful in the context of implementing a ray tracer is TPoint3D record type that contains the most important linear algebra routines like dotProduct, crossProduct and so on.

The second useful code for implementing a ray tracer are global procedures in the "FMX.Types3D" unit including: RayCastCuboidIntersect, RayCastEllipsoidIntersect, RayCastPlaneIntersect, RayCastTriangleIntersect and RayCastSphereIntersect.

Another very useful type for working with color is the TAlphaColorF record type defined in System.UITypes namespace that stores R,G,B and A information as float values and defines a number of useful operations like adding two colors and so on.

Initially I started from using these prebuilt Delphi types, but quickly realized that it gets complicated not only to translate from C++ to Object Pascal, but also rewriting a lot of code. At the end I have decided to try to mimic C++ code as match as possible in Object Pascal.

The "RasterrainObjPas" is made up of two projects: one multi-device FireMonkey and the second Windows VCL. Both projects are using the same "TSimpleRayTracer" class defined in the "uSimpleRayTracer" unit. The actual ray tracer Object Pascal code does not contain any GUI-specific code and can be used in VCL, FireMonkey or even in a console app. The VCL project can be compiled for Windows only and FireMonkey can be built not only for Windows, but also for Mac, iOS and Android.

Simple Ray Tracer in Object Pascal is available for download from Embarcadero Code Central and the project is called "RasterrainObjPas".

The ray tracer has a very simple interface. The "RGBType" is a platform-agnostic data structure for exchanging color information. The actual color is stored as a record with three float values, for red, green and blue intensities.

type
  RGBType = record
    r, g, b: Double;
  end;
  TSimpleRayTracer = class
  private
    //.. private declaration
  public
    constructor Create(aWidth, aHeight: integer; aAntiAliasingLevel: integer = 1);
    destructor Destroy; override;
    function getWidth: integer;
    function getHeight: integer;
    function getPixelData(x, y: integer): RGBType;
    procedure CalculatePixelColors;
  end;

In the constructor you can specify the size of the image to be generated, including the anti-aliasing level, which is by default "1", which means no anti-aliasing. After constructing an instance of the ray tracer you need to call its "CalculatePixelColors" procedure that calculates colors of every pixel and store them in an internal array of RGB values that can be read using "getPixelData" method that takes x, y coordinates of a pixel and returns "RGBType" value. This can be used to create either a FireMonkey bitmap or a VCL bitmap for display and this is the job of "TRendererFMX" and "TRendererVCL" classes that encapsulate the TSimpleRayTracer class and provide "DoRender" functions that return either a VCL or FireMonkey bitmaps.

Here is the implementation of the FireMonkey "renderer" that converts platform-neutral color information from simple ray tracer class into a FireMonkey bitmap to be displayed in a multi-device application.

unit uRendererFMX;

interface

uses System.UITypes, FMX.Graphics, uSimpleRayTracer;

type
  TRendererFMX = class
  private
    FSimpleRayTracer: TSimpleRayTracer;
    function GetPixelColor(x,y: integer): TAlphaColor;
  public
    constructor Create(aWidth, aHeight: integer; aAntiAlias: integer = 1);
    destructor Destroy; override;
    function DoRender: TBitmap;
 end;

implementation

{ TRendererFMX }

constructor TRendererFMX.Create(aWidth, aHeight: integer; aAntiAlias: integer = 1);
begin
  FSimpleRayTracer := TSimpleRayTracer.Create(aWidth, aHeight, aAntiAlias);
end;

destructor TRendererFMX.Destroy;
begin
  FSimpleRayTracer.Free;
  inherited;
end;

function TRendererFMX.DoRender: TBitmap;
var bmp: TBitmap; data: TBitmapData; w,h,x,y: integer; c: TAlphaColor;
begin
  FSimpleRayTracer.CalculatePixelColors;
  w := FSimpleRayTracer.getWidth;
  h := FSimpleRayTracer.getHeight;
  bmp := TBitmap.Create;
  bmp.Width := w;
  bmp.Height := h;
  bmp.Map(TMapAccess.Write, data);
  try
    for x := 0 to w - 1 do
      for y := 0 to h - 1 do
      begin
        c := GetPixelColor(x, h-y);
        data.SetPixel(x, y, c);
      end;
  finally
    bmp.Unmap(data);
  end;

  Result := bmp;
end;

function TRendererFMX.GetPixelColor(x, y: integer): TAlphaColor;
var c: RGBType; colorF: TAlphaColorF;
begin
  c := FSimpleRayTracer.getPixelData(x, y);
  colorF := TAlphaColorF.Create(c.r, c.g, c.b);
  Result := colorF.ToAlphaColor;
end;

end.

And here is the code in the FireMonkey form that displays the bitmap in an image control and shows how much time it took to generate the image.

uses uRendererFMX, System.Diagnostics;

procedure TFormRenderFMX.btnRenderClick(Sender: TObject);
var sw: TStopwatch; r: TRendererFMX; bmp: TBitmap;
begin
  LabelTime.Text := 'Rendering... Please wait.';
  self.Invalidate;
  Application.ProcessMessages;

  sw := TStopwatch.StartNew;
  r := TRendererFMX.Create(round(Image1.Width), round(Image1.Height), round(TrackBarAntiAliasingLevel.Value));
  bmp := r.DoRender;
  Image1.Bitmap.Assign(bmp);
  sw.Stop;
  LabelTime.Text := IntToStr(sw.ElapsedMilliseconds) + ' msec (' + IntToStr(sw.ElapsedTicks) + ' ticks)';
end;

There is also a track bar on the form to select anti-aliasing. In the original C++ code the value for controlling anti-aliasing is hardcoded to "1", which means that for calculating the color of the pixel there is just one ray used. The higher the "anti-aliasing" level, the more rays are used to calculate color. For example for the value of 2 there are 4 rays used and the resulting color is the average. For the value of 3 there is an internal 3×3 grid, which means 9 rays and so on. The higher the anti-aliasing level, the actual color calculation takes longer, but the quality is better. The image embedded in this post has been rendered with anti-aliasing level 10. Which means there were 100 rays used to calculate every pixel and on my virtual machine it took around 40 seconds.

I’m not going to go deeply into the internals of the actual TSimpleRayTracer class, because its functionality is discussed in a very detailed way in original YouTube episodes "RayTracer from Scratch in C++".

The full source code of Simple Ray Tracer in Object Pascal can downloaded from the Embarcadero CodeCentral.


posted @ Mon, 22 Dec 2014 15:26:50 +0000 by Pawel Glowacki


Get Castalia for Delphi free with purchase of RAD Studio or Delphi XE7 until Dec 31, 2014

Jacob Thurman, from TwoDesk (makers of Castalia), recently demonstrated some of the great editor features of Castalia for Delphi during our most RAD in Action webinar.

The Castalia Suite (a $249 value) is one of the awesome Bonus Pack items (a combined total of over $800 USD in value) that are available to XE7 users who purchase by 31 December 2014.



About Castalia for Delphi
Castalia is a premier code productivity plug-in for Delphi. With code refactoring, structural highlighting, parenthesis matching, flow control, highlighting, and live syntax checking, Castalia makes you more productive than ever. Use project statistics and code analysis to better understand your team productivity and code quality.

This is a repost of some info originally posted in JT's blog.


posted @ Sun, 21 Dec 2014 07:30:00 +0000 by Tim Del Chiaro


Setting up InterBase in the Cloud with AWS

Do you need a low cost, high performance embedded or workgroup database?

Software developers select InterBase because it’s easy to install, has a small footprint, requires no administration and is incredibly scalable and powerful.

InterBase offers database and application development professionals high performance, scalable database technology essential to run business critical applications. Extensive security mechanisms protect data at rest, over-the-wire and in backups. InterBase is easily deployable and supports heterogeneous O/S connectivity for Windows, Linux, Solaris and Mac OS X. And InterBase is one of the most economically priced ANSI-SQL RDBMS systems available on the market today.

Some of the key features of InterBase include:

  • Very small footprint (on disk and in memory)
  • Near zero administration
  • Easy to install, no complex configuration
  • High performance
  • Fully featured, powerful and scalable
  • High security
  • Multiplatform support, with mixed OS environments
  • Recoverability (instantaneous and long term recovery options, journaling)
  • Tight integration with the best of breed application development tools including RAD Studio, Appmethod, Delphi and C++Builder

InterBase is a commercially supported and secure alternative to open source databases.

 

Pre-requisites

[Post Installation Steps]

1) Once you have setup your environment you will need to add a port under your security groups

2) Interbase’s default port is 3052

3) Also allow the IP’s you would need to connect to this AMI (Amazon Machine Image).

4) Now you should be all set in connecting to Interbase in the Cloud


[Quick Tips]

 

Learn more at

http://www.embarcadero.com/products/interbase


posted @ Fri, 19 Dec 2014 17:38:10 +0000 by Anil Mahadev


RAD Studio Case Study - Spikes Security

With RAD Studio, Spikes’ developers can now write from a single code base that it can leverage against all platforms. As a result, they can release product to market faster than any of their competitors.



posted @ Fri, 19 Dec 2014 08:00:00 +0000 by Tim Del Chiaro


VCL Style Enhancements since XE2

Since introducing VCL application styling in XE2, we have added a list of enhancements to VCL styles. In this post, I am going to highlight some of the key enhancements we have made to VCL styles over the last several product releases. All the features listed below are part of RAD Studio XE7.

TControl.StyleElements

The TControl.StyleElements property allows you to adjust the style on each control.

Style Hook Technology

A style hook is a class that provides custom message handling for your custom control and enables the customization of menus such Main Menu, Popup and System Menu. If you have a custom control that needs special visual processing, you can create a style hook class that processes messages by inheriting from Vcl.Themes.TStyleHook.
You can use the Vcl.Themes.TStyleManager class to load, register, and select styles or to get, register, and unregister a style engine.

For example, we added a hook class for popup menus:
TCustomStyleEngine.RegisterSysStyleHook(’#32768′, TSysPopupStyleHook);

Menu Styling including Popup Menus

All the VCL styles have been extended to support TMainMenu, TPopupMenu and System Menu styling.

TMediaPlayer Styling

The VCL styles included with XE7 and the premium VCL styles (part of our bonus pack) have been updated to include matching styling for the VCL TMediaPlayer controls. This means that the play, pause and stop controls now have the same theme as the rest of the styled VCL application.

New Styles

We have added many new styles since first introducing VCL styles in XE2. This includes Windows 8 Modern UI styles, new light and dark styles and also touch friendly styles such as the TabletDark style for running your VCL apps on Windows based tablets like the Samsung Slate and Microsoft Surface Pro 3. We also have a set of premium styles available as part of our bonus pack offering.




posted @ Thu, 18 Dec 2014 16:30:39 +0000 by sarinadupont


How to Connect your Applications to your Data

This is a video replay from the DataU online conference. An Application Programming Interface (API) brings your own applications closer to your critical business data, allowing you to access and control your business glossaries, terms and model data quickly and easily. Using an API can connect your models with your business applications, so that you can align system data with business-critical data.

Click here to watch 15 more videos from the DataU series.
Click here to learn more about ER/Studio.

Torquil Harkness has spent the last 15 years serving customers in various support and management roles and understands how important the customer viewpoint is. For the last year he has been a documentation writer for Embarcadero Technologies, specializing in the ER/Studio family, enjoying the opportunity to create documentation with a customer focus.


posted @ Wed, 17 Dec 2014 22:29:00 +0000 by Tim DelChiaro


Cloud Databases - A Primer

Ever since the era of Cloud Computing featuring SaaS(Software as a Service) pioneered by Salesforce, Databases have not been left behind.

Databases in the Cloud or Cloud Databases are being used synonymously.

Cloud Database as defined by Wikipedia is

"A cloud database is a database that typically runs on a cloud computing platform, such as Amazon EC2, GoGrid, Salesforce, Rackspace, and Microsoft Azure. There are two common deployment models: users can run databases on the cloud independently, using a virtual machine image, or they can purchase access to a database service, maintained by a cloud database provider. Of the databases available on the cloud, some are SQL-based and some use a NoSQL data model."

Enterprises today are looking at cost effective and lower management costs to manage their database environments.

Cloud Databases can help leverage the same.

You may setup Databases within your corporate environment in a private cloud using Virtual Machines

[Source:Midsizeinsider.com]

and if you plan to use a public access,you may use DaaS - Database as a Service.

[Source: Microsoft]

One of the most cloud database environments I have personally had a positive experience is with Microsoft Azure.

Setting up SQL Server Databases have never been easier.

In upcoming posts, we shall explore how to setup a SQL Server VM in the Microsoft Azure Cloud.

Explore some of the tools you can use to benefit connecting to SQL Server Databases in the Cloud.


posted @ Wed, 17 Dec 2014 21:32:15 +0000 by Anil Mahadev


Enhancing the SQL Editing capabilities in ER/Studio

ER/Studio includes a basic ISQL editor, which is ok, but if you want to have feature rich SQL IDE to help write robust SQL then you can choose to integrate with Rapid SQL.

To change the SQL IDE change the path in Tools | Options | Tools within ER/Studio and point it to Rapid SQL:

https://mohammadahmedx.files.wordpress.com/2014/12/tools-options-tools.png

Now any time either of the application wizards generate any SQL code (i.e. compare and merge, generate database), the code will launch in Rapid SQL.

https://mohammadahmedx.files.wordpress.com/2014/12/rapid-sql-code.png

Find out more about Rapid SQL here: http://www.embarcadero.com/products/rapid-sql


posted @ Wed, 17 Dec 2014 12:06:07 +0000 by mohammad


Server Response from: BLOGS1