All posts by Stephen Ball

Stephen is a Charted IT Professional and the Associate Product Manager for InterBase at Embarcadero. He is also a Product Evangelist for RAD Studio, regularly speaking across EMEA. @DelphiABall

Setting the default XML DOM in Delphi XE7

Managing the default XML DOM

Scanning the whats new in RAD Studio XE7 (Delphi, C++ Builder) it covers the introduction of a new XML Dom (OmniXML) meaning there are now 3 XML DOMS to choose from when setting the default XML DOM.

  • MSXML
  • ADOM
  • OmniXML

The XML Dom defines which engine in essence is used to work with your XML documents.

Should I read on? Well if your using SOAP or XML in your projects, then this could make a difference to your speed and performance of the applications, and it takes seconds to implement.

Continue reading Setting the default XML DOM in Delphi XE7

Castalia IDE Plugin Free with XE7 (ends soon)

One present I’m going to be playing with over Christmas is the Castalia IDE plug in. If you want to know why, check out the 10 minute demo here of some of the cool refactoring and IDE tools that Castalia provides.

Don’t forget if your latest version is XE2 your last chance to qualify for upgrade pricing is now.  http://www.embarcadero.com/radoffer

The Embarcadero sales teams will be in between Christmas and new year so there is still time to code smarter in the new year.

InterBase XE7 now available!

InterBase XE7 – It’s Live!

http://embt.co/IBXE7FirstLook
I am especially proud today to blog about the launch of InterBase XE7! As the Product Manager for InterBase, I have seen the planning, development and delivery of some amazing new developments over this last year or so, and today you can get your hands on them!

InterBase XE7 – Whats new?

In short, the big headline items include

  • Change Views
  • New – 64bit Linux support
  • New – Ubuntu Linux support
  • A number of speed improvements (as you would expect)
  • 64bit transaction ID’s = longer running databases
  • Incremental data dumps for faster backup
  • Additional API support
  • Performance Monitoring updates

Change Views!

InterBase XE7 (codenamed DeltaForce during development) introduces “Change Views“, which is a whole new way to track and manage changes (Delta’s). If you have ever wanted an easy way to identify what delta data is needed to keep your local cache up to date Change Views is for you!

Change views identifies data at the field level with exceptionally low footprint on the database, regardless of 1 or 1000’s of subscribers.

Change views introduces a subscription based model that enables you to create a subscription for Inserts, Updates, Deletes to specific tables either completely or partially. A subscription can contain links to one or more tables.

“Tracking and managing data changes to multiple destinations has never been easier; just subscribe and query with SQL!”

InterBase – the 64bit database for Ubuntu!

InterBase is also now available for Linux 64bit for the first time on RHEL 6 and 7, SUSE 11 and also for the first time official Ubuntu 14 support.

Incremental Data Dumps

A data dump is a read only copy of the database. For XE7 they are suggested as the best way to backup the database due to their speed at getting the copy updated to reflect the live version quickly, managed by delta change tracking.  This can either be done via the command line using gbak, via IBConsole of via a new services API. If your using Change Views, then you should use Incremental Data Dumps to ensure subscription tracking is maintained.

64bit Transaction ID’s

One great thing about InterBase is that its an embeddable database, i.e. you can install it silently in part of your application. In the past, for exceptionally heavy users with 10’s of 10,000’s of transactions a day you used to be looking to schedule monthly backup and restore’s to ensure you didn’t run out of transaction ID’s at peak time. With XE7, transaction ID’s are now 64bit in size meaning that even if you were using 10,000 transactions a second, you can run for 150+ years (just a tad longer!)

Updated InterBase Documentation

InterBase has long been one of the best documented products at Embarcadero and along with the traditional InterBase documentation http://docs.embarcadero.com/products/interbase, InterBase XE7 also has its own docwiki site with detailed notes about the new product features http://docwiki.embarcadero.com/InterBase/XE7/en/Main_Page

Find out more….

Join me for the webinar tomorrow, or register to get the replays.
http://embt.co/IBXE7FirstLook

I will look to get more blog posts done on the new features soon.

InterBase XE7 – First Look Events!!

InterBase XE7 First look live and online!

Starting with the InterBase Product Address at CodeRage 9 news about the new edition of InterBase has been slowly spreading.

InterBase project DeltaForce, named due to its new patent pending technology for tracking and querying of deltas, is a highly scalable, low footprint answer to a number of distributed data set questions.

I’m really excited about what we have coming up in the InterBase XE7 preview events.  I will be hitting the road over the coming weeks in person to present and talk to developers, system architects etc about what InterBase DeltaForce (XE7) can help you achieve and how it can dramatically assist you throughout the product life cycle.

InterBase XE7 First Look – LIVE!

I will be in the following cities over the next few weeks for live preview workshops

InterBase XE7 First Look – Webinar

If your unable to attend one of the live events, then a global live webinar, repeated in 3 time zones, will be going out Thursday 4th December.InterBase XE7 First Look

  • 6AM San Francisco / 9AM New York / 2PM London
  • 11AM San Francisco / 2PM New York / 7PM London

5PM San Francisco / 5-Dec 10AM Tokyo / 5-Dec 12PM Sydney
http://embt.co/IBXE7FirstLook

Can’t wait?

If you are a current InterBase customer, then we still have space on the beta for those of you who really can’t wait. Register now and get priority access to explore InterBase DeltaForce now!

To keep up on on the latest, please follow @InterBase on twitter.

IBLite example from CodeRage 9

The Object Pascal programming source code for the IBLite example from CodeRage 9 that I demo’ed is now available from Embarcadero’s Code Central http://cc.embarcadero.com/item/30035

The C++ programming version demo’ed requires the data module from the Object Pascal code, so once I’ve cleaned that up I’ll post that as well.

The IBLite example code works on Windows, Mac OS X, iOS and Android.  The session replays are available online via the CodeRage website. – More on the InterBase sessions in my previous post

 

InterBase CodeRage 28th-30th November

CodeRage 9Register NOW and join me live at #CodeRage!

CodeRage is a fantastic Object Pascal programming and C++ Programming event – highly recommended for any developer, and best of all – REGISTRATION IS FREE!!

Missed it or got a meeting? – Don’t worry, register and you can still get to see the replays!

My two InterBase CodeRage Sessions!

I will be presenting two InterBase CodeRage sessions on Thursday 30th November 2014

  • the InterBase Keynote (8am Pacific / 4pm UK / 5pm CET) where we will be revealing some of the exciting new developments we are working on with InterBase with project DeltaForce!
  • I will also be talking about InterBase’s free edition that can be used on Windows, Mac OS X, Android and iOS – IBLite in the session Embedding local and remote data access into your applications with IBLite (3pm – C++ & 6pm – Object Pascal)

For times and details of all sessions visit the CodeRage website – See you there!!

 

Adding VCL Styles at runtime

VCL Styles

An example before & after

Screen Shot 2014-10-22 at 06.09.20VCL Styles at run time

VCL Styles provide a great way to update the look and feel of your VCL applications.  VCL Styles can be easily added into an application before you compile through  project options > appearance options.

Adding VCL Styles to Project : Options : Appearance
Adding VCL Styles via Project : Options : Appearance

While you can add VCL Styles into the application binary this way, they will increase the size of the application. If you want to avoid this, (or maybe run a mix of compiled in and dynamically loaded) you can distribute styles along side your application.

By default, VCL Styles are located at the following file path when installing your IDE.

C:\Users\Public\Documents\Embarcadero\Studio\15.0\Styles

A full overview of them is available on docwiki  http://docwiki.embarcadero.com/RADStudio/XE7/en/VCL_Styles_Overview

TStyleManager

Styles are managed via TStyleManager, a class located in unit VCL.Themes.

TStyleManager is a sealed class with a number of class methods that allow you to interact with the global application settings for the styles.

Some key properties on TStyleManager

  • TStyleManager.StyleNames – an array of the styles available in the application.
  • TStyleManager.SetStyle(StyleName : string) – the call to set the application style to a new style

Using these basic methods, its possible to implement code that loops the styles in the application and makes them available to a menu that can then be used at run time to choose which style is selected.

  • TStyleManager.IsValidStyle(FileName: string) – checks a file is a valid style
  • TStyleManager.LoadFromFile(FileName : string) – loads a style up from file.

With the additional file based calls its possible to check for style files and load those into your application as well.  – So lets do that!

VCL Styles code example

The MastApp demo that is installed by default with RAD Studio has an example of using TStyleManager. You can find the demo at:

C:\Users\Public\Documents\Embarcadero\Studio\15.0\Samples\Object Pascal\Database\IBX\IBMastApp

This demo uses 2 code parts and 1 design time selection element to provide styles in the demo.

Part 1 – Compiling VCL Styles into your application.

Open the project and then choose Project > Options and go to appearance. As above, select a couple of styles and run the application. You will then see the Styles menu is updated to show these styles.

The initial code to build the menu loops the StyleNames, creates a menu item for each style, adds then links to an OnClick event to change the style.

Part 2 – Building the style list menu

procedure TMainForm.FormCreate(Sender: TObject);
var
 Style: String;
 Item: TMenuItem;
begin
 //Add child menu items based on available styles.
 for Style in TStyleManager.StyleNames do
 begin
   Item := TMenuItem.Create(StyleMenu);
   Item.Caption := Style;
   Item.OnClick := StyleClick;
   if TStyleManager.ActiveStyle.Name = Style then
     Item.Checked := true;
   StyleMenu.Add(Item);
 end;
end;

Step 3 – OnClick event for the Style selected.

procedure TMainForm.StyleClick(Sender: TObject);
var
 StyleName: String;
 i: Integer;
begin
 //get style name
 StyleName :=   StringReplace(TMenuItem(Sender).Caption, '&', '',
 [rfReplaceAll, rfIgnoreCase]);
 //set active style
 TStyleManager.SetStyle(StyleName);
 //check the currently selected menu item
 (Sender as TMenuItem).Checked := true;
 //uncheck all other style menu items
 for I := 0 to StyleMenu.Count -1 do begin
   if not StyleMenu.Items[i].Equals(Sender) then
     StyleMenu.Items[i].Checked := false;
 end;

end;

So: We have styles working, but you can also load them from file with very little change to the application.

Loading Styles from file and displaying them in the list of styles

VCL Styles can be loaded at run time easily using TStyleManager.LoadFromFile

Using the existing demo, its possible to have it check for a styles sub folder and read any file in there to see if its a valid style.  To do this, we just need to use FindFirst, iterate the returned files and then if they are valid (something we can use TStyleManager.IsValidStyle to determine) load the files.

So the updated code looks something like this block below where we first build the path to check for VCL Style files; then check the folder exists, and if it does check each file to see if its a valid VCL Style (before loading it).  Secondly, using a TStringList the styles loaded are sorted and then the sorted list is used now to build a menu for selecting the styles.

procedure TMainForm.FormCreate(Sender: TObject);
var
 Style: String;
 Item: TMenuItem;
 i: integer;
 searchResults : TSearchRec;
 SearchDir: string;
 SLStyles: TStringList;
begin
 SearchDir := ExtractFilePath(ParamStr(0))  
                 +'styles'+ PathDelim;
 if DirectoryExists(SearchDir) then begin
   if FindFirst(SearchDir+'*.*',  
                faAnyFile - faDirectory,
                searchResults) = 0 then
   repeat
     try
       if TStyleManager.IsValidStyle(
            SearchDir+searchResults.Name) then
          TStyleManager.LoadFromFile(
             SearchDir+searchResults.Name);
     except
       // Who cares.. try the next one.
     end;
   until FindNext(searchResults) <> 0;
 end;
 // Sort the styles using a StringList 
 SLStyles := TStringList.Create;
 try
   SLStyles.Duplicates := TDuplicates.dupIgnore;
   for Style in TStyleManager.StyleNames do
     SLStyles.Add(Style);
   SLStyles.Sort;

   PMStyles.Items.Clear;
   // build menu from sorted list of styles
   for Style in SLStyles do begin
     Item := TMenuItem.Create(StyleMenu);   
     Item.Caption := Style; 
     Item.OnClick := StyleClick; 
     if TStyleManager.ActiveStyle.Name=Style then 
       Item.Checked := true; 
     StyleMenu.Add(Item);
   end;
 finally
   SLStyles.Free;
 end;
end;

Thats it! You can now create a sub folder for VCL styles that you ship along side your application or deploy at a later point.

For C++ use the same classes and units, just with the C++ Loops and constructs. more on VCL Styles with C++ can be found on docwiki