Fast Development Rules! (Part 2)

I received some good feedback on this blog and wanted to share a really cool example from one of our MVPs, Eli from Peacekeeper (www.peacekeeper.com). He recently completed a fairly involved FMX (FireMonkey) application for the Oil and Gas industry in 3 weeks! Here is his summary “I just finished a medium size enterprise app build in Delphi for iOS. It is a mobile forms document solution for a client. It has somewhere around 100-150 fields, 20+ tabs, 5 forms, offline caching, uses XML, JSON, SOAP, LiveBindings, FireDAC, data syncing, signatures, drawing, GPS, and other RAD Studio technologies in around 33,000 LoC. Suffice to say Delphi can move mountains.” This is now a template that he can reuse with lots of other apps for iOS and Android, since it is FMX. He is even willing to share with others and they can choose to use his services as needed. I have managed to build quite a few apps over the years, especially mobile apps, (of course with experienced developers), so I can really appreciate this kind of speed. I wish I had RAD Studio back then. It would have saved me a lot of iterations and anxiety. In the last years, we have done a lot to promote FMX, but I think that we need to do a much better job explaining the power and range of possible solutions that leverages these tools. Eli did not use RAD Server, as he prefered a hosted back-end. But frankly combining the efficiency of our frameworks for front- and back-end development with RAD Server can result in even greater savings or opportunities to make even more money by developers or ISVs. Your typical MBaaS is $50+ per user.  With a 100 users, you will pay for RAD Server in a month and the rest is just the server hosting, which with Linux is trivial. This is a lot of potential ongoing revenue… I understand that some customers just don’t want to deal with AWS or Azure, so we may come up with some RAD Server hosted options as well. I love our cool apps examples, however they sometimes downplay the many great apps that are more utilitarian and may not have amazing front-ends. I think that in these cases FMX shines even more. With the many possible adapters for payments and connectivity to enterprise systems, the speed of development matters even more. For example, there are whole companies that specialize in building SalesForce.com apps. With our tools, you can build a few templates and then your speed to deliver solutions will simply be unbeatable. So much opportunity out there! There are some really good deals out there for RAD Studio - go get the latest! Eli said that we almost got him with the great Architect Promo, and MVP’s are tough to get.
Read More

Making the Huge World of Delphi Small Again

The world of Delphi is HUGE. It love seeing all the different types of apps being built and seeing users all over the world. This week I was in Tokyo for their #0315inTokyo event announcing 10.2 Tokyo coming soon. In a surprising turn of events Eric Bonilha of Digifort from Brazil was in Tokyo on vacation too. He stopped by the Tokyo office of Embarcadero for a quick visit. He showed off the latest version of his Digifort Mobile client and the engineers here showed him some of the things they are working on with BeaconFence for a local museum. A lot of fun. We are all excited for the upcoming 10.2 Tokyo release adding support for Linux! It is happenstance meetings like this that show how global Delphi and Embarcadero really are. Go Delphi!
Read More

Embarcadero Weekly Round-up for Developers – #8/2017

 

 
  Embarcadero Weekly Round-up 8      
 
 
 
 
  Products | Free Tools | Events
 
 
 
 
 
WEEKLY ROUND-UP FOR DEVELOPERS
 
We continue to improve RAD Studio, Delphi, and C++Builder with one central goal in mind: helping you build cross-platform Native Apps faster than ever before and delivering them to the largest audience possible with ease.
 
 
 
 
   
 
 
InterBase 2017 – Now Available
 
InterBase 2017 delivers the fastest version of InterBase yet with new language features, server wide performance monitoring and enhanced transaction handling.
 
Read More!
 
Download InterBase 2017 Now
 
The trial and developer editions of InterBase 2017 are available for free
 
Download the Trial Version
 
Download Free Developer Edition
 
 
 
 
 
 
 
Build IoT enabled apps with RAD Studio
 
ThingConnect IoT device components range from healthcare devices such as heartrate montiors, blood pressure monitors and scales to home automation gadgets like BLE light bulbs, Z-Wave enabled door locks, smart switches, smoke detectors and more.
 
 
Read More!
 
 
Webinar: External BeaconFence Mapping Editor
 
Embarcadero’s BeaconFence technology utilizes its Beacon Fencing Map Editor from the RAD Studio IDE, but is not able to run outside of it. Woll2Woll has created an external mapping editor to create XML mapping files Written 100% with the FireMonkey library – Runs on Windows, iOS, Android, and OSX.
 
Register Now!
16 March 2017
 
 
 
 
 
 
Delphi for Linux Boot Camp Replay
 
Just in case you missed the fantastic Delphi for Linux Boot Camp by Craig Chapman last week, or you want to watch it again, here is the replay that includes Marco Cantu’s Q&A at the end.
 
Read More!
 
Delphi for Linux RTL units
 
This blog post from Marco Cantu focuses solely on the RTL units that are going to be available in Delphi for the Linux platform.
 
 
Read More!
 
 
 
 
 
 
Key Traits of the Coming Delphi For Linux Compiler
 
In case you missed it: Here are some of the key technical elements of Embarcadero’s new Delphi compiler for the Linux platform.
 
 
 
Read More!
 
How to make a RESTful WebBroker app in C++Builder
 
WebBroker (included in Professional edition and up) makes it easy to build a RESTful server. This article shows you how to server data from a database via a REST API with WebBroker and C++Builder.
 
Register Now
 
 
 

Read More

Read More

Delphi for Linux. Revisited. Again.

I have been hoping for a long time that Embarcadero would reintroduce Linux support in Delphi, especially since they've added Mac, iOS and Android support in the mean time, hopefully working out (most of?) the kinks involved in cross platform support in the process. I may have even brought it up once or twice at live events. Well, they finally called my bluff. If you've been following
Read More

Raspberry Pi to Delphi messaging with MQTT

As promised in the blog about building a chat application with MQTT, here is a follow-up article on using the TMS MQTT client, this time to setup messaging between a Raspberry Pi and a Windows PC. The TMS MQTT client fully supports Lazarus and thus also targetting Linux and its variant Raspbian, so we can use the TMS MQTT Client from Raspberry Pi.
For this short demo, we setup Lazarus on Raspberry Pi and installed the TMS MQTT client component in the IDE as well as our free Raspberry Pi hardware lib.

We’ll use the component TMSLCLAdaADC12b to be able to use the 12bit ADC connected via i2c to the Raspberry Pi. The goal of the setup is to read-out noise meter values via the ADC and send the measurements via messaging to the channel /tms/raspi/. A Windows Delphi application will then listen through this same MQTT client to the messages on channel /tms/raspi/ and will display the values in our TMS Instrumentation Workshop component TvrScope. Best of all, with the help of these components, this is not much more than a 15 minute project where most of the time will be spent to properly connect the ADC breakout board via a breadboard to the Raspberry Pi i2c port.

For the code, we use the same setup in the Windows Delphi application as on the Raspberry Pi Lazarus application to connect our client to the Mosquitto test broker:

begin
  TMSMQTTClient1.BrokerHostName := 'test.mosquitto.org';
  TMSMQTTClient1.Connect;
end;

On the Raspberry Pi Lazarus app, we add a timer that will get the ADC value every 200msec and send the value as a message to /tms/raspi/. For reason of simplicity, we’ll send the value as a text message via MQTT. The code to do this is added to the timer OnTimer() event handler:

var
  i: integer;
begin
  // get value from the 4 channel ADC channel 0 to which the analog noise meter output is connected
  i := TMSLCLAdaADC12B1.ReadChannel(0);
  // send the value as text over MQTT
  TMSMQTTClient1.Publish('/tms/raspi/', inttostr(i)); 
end;

To get the i2c communication working on the Raspberry Pi, we open the i2c connection to the ADC in the form’s OnCreate event:

procedure TForm1.FormCreate(Sender: TObject);
begin
  // make sure to start the Raspberry Pi app with sufficient permissions to be able to open access to i2c
  if not TMSLCLAdaADC12B1.Open then
  begin  
    ShowMessage('error opening i2c');
    Exit;
  end;
end;

and we close the port again from the form’s OnClose event:

procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
  TMSLCLAdaADC12B1.Close;
end;

For the Delphi Windows client, here we’ll add an event handler for TMSMQTTClient.OnPublishReceived() that is triggered when a message is received. From this event, we store the received value in a variable containing the last received value LastVal. Here the (positive) value of the ADC is mapped onto the 0 to 100 range:

procedure TForm1.TMSMQTTClient1PublishReceived(ASender: TObject;
  APacketID: Word; ATopic: string; APayload: TArray);
var
  s:string;
begin
  s := TEncoding.UTF8.GetString(APayload);
  LastVal := Round(100 * strtoint(s) / 1024);
end;

To visualize the data, the TMS Instrumentation Workshop TVrScope component is used where we added one channel and automatic display (VrScope.Active = true). This means that at a configured frequency (VrScope.Frequency), this scope component requests the channel value and displays it in the scope. This is done via the TvrScope.OnNeedData() event that is triggered every time the scope advances and needs a new value. Here, the last received value LastVal is returned:

procedure TForm1.VrScope1NeedData(Sender: TObject; Channel: Integer;
  var Value: Integer);
begin
  Value := LastVal;
end;

As a result, here you can see some quickly captured data in our test setup:

In summary, this small demo shows how really quick & easy you can get started using m2m messaging using MQTT with the TMS MQTT Client and this on a wide range of devices, from desktop PC to mobile device, to Linux machine and to Raspberry Pi SBC. We wish you much fun with your projects and we love to hear from all the exciting stuff you create with these building blocks!

Read More

Read More

Cross platform messaging made easy with TMS MQTT

Last week we released a new product, TMS MQTT. MQTT is a standard lightweight machine 2 machine messaging protocol. This enables the instant exchange of binary or text messages between code running on various operating systems. To fully take advantage of this, we developed our TMS MQTT client to work in VCL Windows applications, FMX Windows, macOS, iOS and Android applications and also on Linux desktop or Linux variants such as Raspbian on Raspberry Pi via FPC/Lazarus.

On this 22th birthday of Delphi, I wanted to show you how our TMS MQTT component allows you to develop a messaging application in a real RAD way. I’ll do this by implementing a chat application that allows you to chat between clients running on desktops or mobile devices. This effectively takes less than 40 lines of code using the TMS MQTT component of which 15 lines already go to inserting the chat text left and right in items of an FMX listbox and another +/- 10 lines detecting the origin of the chat text that is received to decide whether to show it left or right in the listbox. So, I’d say only about 15 lines of code effectively concern using the MQTT client to do the messaging.

For this demo, we use the Mosquitto MQTT test broker and connect to it with 2 lines of code:

begin
  TMSMQTTClient1.BrokerHostName := 'test.mosquitto.org';
  TMSMQTTClient1.Connect();
end;

Upon connecting, we subscribe to the topic /tms/chat/ that is the topic that will be used to exchange chat text between multiple clients. This takes 2 lines of code from the TMQTTClient.OnConnectedStatusChanged() event:

procedure TForm1.TMSMQTTClient1ConnectedStatusChanged(ASender: TObject;
  const AConnected: Boolean);
begin
  if AConnected then
    TMSMQTTClient1.Subscribe('/tms/chat/');
end;

To send a message, text entered in a memo control is published on this topic with one line of code:

  TMSMQTTClient1.Publish('/tms/chat/', TMSMQTTClient1.ClientID+'!'+ memo1.Lines.Text);

Here we add the unique ID of the app sending the chat text and the chat text itself.
Finally, incoming chat text on the subscribed topic is received via the TMQTTClient.OnPublishReceived() event. The unique client ID is retrieved to decide whether to put the chat text left or right of the message listbox and this is done via the code:

procedure TForm1.TMSMQTTClient1PublishReceived(ASender: TObject;
  APacketID: Word; ATopic: string; APayload: TArray);
var
  msg,orig: string;
  vp: integer;
  alright: boolean;
begin
  msg := TEncoding.UTF8.GetString(APayload);

  vp := pos('!', msg);

  if vp > 0 then
  begin
    orig := copy(msg,1,vp-1);
    alright := orig  TMSMQTTClient1.ClientID;

    msg := copy(msg, vp + 1, Length(msg));
    AddMessage(msg, alright);
  end;
end;

And then comes the method to allows us to insert either left or right aligned text as items in an FMX listbox:

procedure TForm1.AddMessage(AMessage: string; AlignRight: boolean);
var
  li: Tlistboxitem;
begin
  li := Tlistboxitem.Create(self);
  li.StyledSettings := li.StyledSettings - [TStyledSetting.ssOther];
  li.Text := AMessage;
  li.Height := 22;
    li.VertTextAlign := TTextAlign.taTrailing;

  if AlignRight then
    li.TextAlign := TTextAlign.taTrailing
  else
    li.TextAlign := TTextAlign.taLeading;

  listbox1.AddObject(li);
end;

Compile and run this application on your operating system of choice. In my case, I did setup a small chat between the client compiled for Windows and the client deployed on an iPhone:

You can download the full source code of this FireMonkey application here.

I invite you to explore the numerous exciting capabilities of machine 2 machine messaging. Note that there
are JS libs that facilitate to do MQTT messaging via websockets from a webbrowser. The demo included in the TMS MQTT download is based on messaging between a desktop or mobile client app and a web page application. With the TMS MQTT client, you can also use machine 2 machine messaging from your Raspberry Pi and send this way various sensor data captured by the Raspberry Pi to desktop or mobile apps. In a follow-up blog, we’ll explain and offer such sample project.

I look forward to hear about how you will use MQTT machine 2 machine messaging in your apps or IoT projects!

Read More

Read More