Delphi Redis Client available through GetIt Package Manager

Delphi Redis Client
Delphi Redis Client Logo

Since some days ago, Delphi Redis Client, the official redis client for Delphi, is available through GetIt.

You can get the library with just a click, now there aren’t reasons to be afraid by Redis utilization 🙂

More info and the (very simple) installation instruction at the dedicated page.

The official repository if on github https://github.com/danieleteti/delphiredisclient

Great success for RAD Studio in one of the most important italian government palaces

This week, in one of the most important government palaces in Italy (I cannot say which one), I did a consultancy about mobile development. The internal dev team is currently using Xamarin and they have a blocking problem with it. In the team there is a friend of mine which called me some days ago to know if I know how to solve their problem using Delphi. I told him that the “blocking” problem could be solved with Delphi. The resultant 2 days of consultancy were been quite hard, but the result has been really rewarding. A long standing problem has been elegantely solved using Delphi in a couple of hours.

The problem was about using HTTP client certificates with iOS in a Microsoft architecture, where each user had its own certificate.

I dont know Xamarine so deeply to say if the problem could be elegantly resolved with it as well, but the team is quite smart and skilled, so I think that they have been tried all the documented solutions to face the problem, but without success.

I want to thank the always helpful Jim McKeeth and the great Diego Navarro from Embarcadero, to have help me about this issue. Thank you guys.

 

DataSnap Filters Compendium Updated to Delphi 10 Seattle

Very quick info.

Not tremendous useful today as when developed (Delphi 2010 time frame) but, if someone is still using my DataSnap Filters Compendium (and I know some users heavily use it), now can find the Delphi 10 Seattle version on github. Currently works all the speed test and the server/client test. Consider this as a very stable beta.

Here’s the project repository

https://github.com/danieleteti/dsfc

Using dynamic arrays and Parallel Programming Library (Part 1)

The Parallel Programming Library introduced in XE7 is one of the  most awaited built-in library for the Delphi and C++Builder RTL, at least for me. I’ve still a nice list waiting for the next versions, but this is another story 🙂

Marco Cantù wrote about dynamic arrays some days ago, another nice feature introduced in Delphi XE7. In the post he talk about an integration between Parallel Programinng Library and dynamic arrays which I shown to the audience in the Milan and Rome XE7 world tour.

I planned to write about Parallel Programming Library in this blog, so why don’t start with that simple example?

Here’s the code.

procedure TFormThreading.Button1Click(Sender: TObject);
var
  tasks: array of ITask;
  value: Integer;
begin
  value := 0;
  tasks := [
  TTask.Create(procedure
    begin
      sleep(1000); // 1 seconds
      TInterlocked.Add(value, 1000);
    end).Start,

  TTask.Create(procedure
    begin
      sleep(3000); // 3 seconds
      TInterlocked.Add(value, 3000);
    end).Start,

  TTask.Create(procedure
    begin
      sleep(5000); // 5 seconds
      TInterlocked.Add(value, 5000);
    end).Start
    ];

  TTask.WaitForAll(tasks);
  ShowMessage('All done: ' + value.ToString);
end;

This code configure and start 3 parallel tasks and wait for their completitions. Then show the result using a ShowMessage.
This code takes 5 second to be executed because the 1st second there are 3 tasks running, from 2nd second to the 3rd second there are 2 tasks running while the last 2 seconds only one task is running. All the internal threads are managed by a thread pool. Hey! This means parallelize!

ITDevCon 2014, Call4Papers

ITDevCon 2014
ITDevCon 2014

Dear potential ITDevCon speaker,

As every year, I’m building the agenda for next ITDevCon that will be held next october 23th, 24th in Milan (Italy), in a new location.

This will be the 6th edition ( we’re getting conference experts J )

The call for papers are officially open right now, so if you want to propose some speeches, I’ll be glad to see it.

As usual, for the Call4Paper I need:

  • Title (for every talk)
  • Abstract (for every talk)
  • Difficulty level (for every talk. Difficulty level is a scale from 1 to 3 with the following mean: introduction, intermediate, advanced)
  • Speaker’s photo
  • Speaker’s profile

I’m looking forward to your proposal. The call4papers ends at Aug 31st, 2014 but if you have *VERY* interesting topic to propose, propose it… I’ll try to arrange the schedule and fit it in the agenda.

Send your proposal to call4paper(at)itdevcon.it.

Proposals will be evaluated and the speakers will be contacted ASAP.

This year topics will be the following:

TOPICS

  • What’s new in the latest Delphi versions

  • FireMonkey platform

  • MacOSX development

  • Android development

  • iOS development

  • Windows development

  • Mobile development (Android+iOS)

  • Develop UIs for different devices (smartphones, tablets, TV, watch etc)

  • BaaS integrations

  • LiveBindings ®

  • Delphi best practices

  • Design Patterns

  • DataSnap

  • DelphiMVCFramework

  • Arduino e/o Raspberry Pi

  • Web Application with Delphi

  • TDD and Unit Tests

  • Agile methodologies

  • ORM and other data access patterns

  • Using NoSQL databases (even to speed up your VCL software)

  • FireDAC

  • UI, UX, optimization for mobile and desktop

  • OOD/OOP

  • Real use cases for extended RTTI, Generics e AnonMethods

  • RESTful interfaces design and development

  • Architectures

Target audience

  • Software architects
  • Software developers
  • Project managers
  • IT managers
  • Trainers

The conference web site is http://www.itdevcon.it (2014 version is still under construction).

Do you want to see a particular topic or have a suggestion for ITDevCon2014? Let me know

Thanks and see you at ITDevCon 2014.

PACKT Publishing Book Review: “Gideros Mobile Game Development”

As you probably know, I did some reviews on PACKT Publishing technical books. Now I did a review on a new book about Gideros Mobile. At bit Time Software we used to create mobile games too and in the last months some of them have been built with Gideros Mobile (we do also training on the Gideros Mobile framework. If you are interested, check the contact me section ad write me an email).

The last game released by bit Time Software, is written with Gideros Mobile and is available for Android and iOS devices. It is called Math Brain HD and it’s free. Here’s the game icon.

Math Brain HD
Math Brain HD

At the last DROIDCON in Turin, IT, we held a speech about the Gideros Mobile framework.

So, being an advanced user, I’ve been really pleased to do this book review for PACKTPUB.

The title of the book is: Gideros Mobile Game Development

The book cover
The book cover

Here you can find the book page on PACKT Publishing web site

http://www.packtpub.com/gideros-mobile-game-development/book

Here’s a bullet list of considerations about the book. These are a sum of feelings, mine and from my colleague at bit Time SoftwareDaniele Spinetti.

Is’s really simple to read, also for non native english people, and the contents are very well organized. When you finish to read the book, you are able to create a good level game, not a trivial one. All the topics related to the complete Gideros Mobile software stack are covered.

During the book, the author incrementally starts to use the most popular plugin for the Gideros Mobile, so you are getting familiar with the “fantastic plugin world” from the start.

IMHO it’s a good book.

However, if you want to find some cons, sometimes seems that it goes into too much details getting too trivial (e.g. zindex).

Sending Android Intents from Delphi (Part 2)

Some months ago I wrote a post with title “Sending Android Intents from Delphi (Part 1)”. In that post I promised to write a 2nd part… here’s it is!

This time I want to play a video deployed with my APK using an external player.

Some informations are available on the Internet, but to correctly know how to play the video I’ve to inspect my Nexus 5 with the LogCat while using the default file manager to start the default video player.

The app main form  is shown below

The main form
The main form

 

I’ve added an mp4 video file using the deployment manager.

This is the code under the button click event

procedure TForm1.Button1Click(Sender: TObject);
var
  Intent: JIntent;
  FileName, DestFileName: string;
  Data: Jnet_Uri;
  CompName: JComponentName;
const
  VIDEO_FILENAME = 'videoviewdemo.mp4';
begin
  FileName := System.IOUtils.TPath.GetDocumentsPath + PathDelim + VIDEO_FILENAME;
  DestFileName := TPath.GetSharedDownloadsPath + PathDelim + VIDEO_FILENAME;
  // Copy the file into a public path (you can use any public path)
  TFile.Copy(FileName, DestFileName, true);
  Data := TJnet_Uri.JavaClass.parse(StringToJString('file://' + DestFileName));
  Intent := TJIntent.Create;
  Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
  if CheckBox1.IsChecked then
  begin
    CompName := TJComponentName.JavaClass.init(StringToJString('android'),
      StringToJString('com.android.internal.app.ResolverActivity'));
    Intent.setComponent(CompName);
  end;
  Intent.setDataAndType(Data, StringToJString('video/mp4'));
  try
    MainActivity.startActivity(Intent);
  except
    on E: Exception do
    begin
      Label1.Text := E.Message;
    end;
  end;
end;

Using the checkbox you can force the OS to show the ResolverActivity.

see you

Sending Android Intents from Delphi (Part 1)

As you probably know, I work for the italian embarcadero representative (www.bittime.it), so last week, I’ve been in Milan (Italy) with the Delphi Product Manager Marco Cantù, to show the new Delphi XE5 for Android (and iOS…).

Users (old and new) were enthusiastics. The Delphi-WAY combined with the Android openness and flexibility, is really a good way to develop mobile apps for the business customers.

So, after the initial demos some users were interested in sending Android Intents from their Delphi app.

I’ve builded some demos about Intents, so I showed those demos to them (in the next weeks there will be many Delphi for Android training in Italy, so I’ve build those demo in advance)

In Delphi XE5 you can call java classes from the Google SDK. So I started investigating hot to do this.

There are a lot of possibilities, and I’m still doing research, but this is a simple Intent send demos.

The Intents demo app
The Intents demo app

 

This is the code under the first button.

procedure THeaderFooterForm.Button1Click(Sender: TObject);
var
  Intent: JIntent;
begin
  // JAVA SDK ANDROID HELP SAYS...
  // String url = "http://www.example.com";
  // Intent i = new Intent(Intent.ACTION_VIEW);
  // i.setData(Uri.parse(url));
  // startActivity(i);

  Intent := TJIntent.Create;
  Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
  Intent.setData(TJnet_Uri.JavaClass.parse
    (StringToJString('http://www.danieleteti.it')));
  MainActivity.startActivity(Intent);
end;

Simple, isn’t it?

With this piece of code, you cann open your device browser to a web site (my blog in the snippet).

Click on the first button and you will be redirected to this blog.

Open browser with intent
Open browser with intent

 

Intents are REALLY powerfull

With the next snippet, you can send piece of data (e.g. text) to other apps. You dont have to know the apps in advance, Android will do the match with the Implicit Intent. (It is similat to the TShowShareSheet action).

procedure THeaderFooterForm.Button2Click(Sender: TObject);
var
  Intent: JIntent;
begin
  // Intent intent = new Intent(Intent.ACTION_SEND);
  // intent.setType("text/plain");
  // intent.putExtra(android.content.Intent.EXTRA_TEXT, "Android Rocks!!!");
  // startActivity(intent);

  Intent := TJIntent.Create;
  Intent.setType(StringToJString('text/plain'));
  Intent.setAction(TJIntent.JavaClass.ACTION_SEND);
  Intent.putExtra(TJIntent.JavaClass.EXTRA_TEXT,
    StringToJString('Delphi Rocks!!!'));
  MainActivity.startActivity(Intent);
end;
Chose wich apps shoud be launched to handle the intent (and the text)
Chose wich apps shoud be launched to handle the intent (and the text)

 

Now, if you choose Twitter, you will get this screen.

Intent handle by twitter app
Intent handle by twitter app

 

I’ve demos about placing a call, sending an SMS, show a PDF file, accessing different kind of storage etc.
In the next part of this mini series I’ll show some other snippets.

There is still many areas to explore…

  • Services
  • BroadcastReceiver
  • Widget
  • Bluetooth
  • I/O
  • …?

I’ll keep you informed…

Book Review: “ZeroMQ” (PACKT Publishing)

Introduction

Some days ago I was contacted by a representative from PACKT Publishing asking me to write a review for their last book about the ZeroMQ library.

ZEROMQ BOOK COVER
ZEROMQ BOOK COVER

In 2009 I was looking for a fast, very fast, messaging system for a complex project and I meet ZeroMQ. At that time there was the 1.x version and I wrote a Delphi wrapper for the C dll that some days later has been included in the official ZeroMQ distribution.

Now, after 4 year since then, I’m using ZeroMQ for a lot of things. I’ve talked about ZeroMQ to the popular ITDevCon (The European Delphi Conference), so I’m very happy to write about ZeroMQ another time.

So, back to the book review…

The book title is simply “ZeroMQ”, but the subtitle explains what you’ll really learn from it: “Use ZeroMQ and learn how to apply different message patterns”.

Yes, this book is really a crash course in ZeroMQ. In about 100 pages, this “small but full of interesting things” book, explains all the most useful message patterns implemented in ZeroMQ. Congrats to Faruk Akgul (the author).

Traditional message queuing systems use a broker. However, ZeroMQ is brokerless. In a brokerless design, applications can directly communicate with each other without any broker in the middle. All the complexity is hidden, and handled, by ZeroMQ. In this situation there isn’t the “single point of failure”. In some cases this architecture cannot be used, but when it can be, you can gain a lot of flexibility, speed with no added complexity.

Let’s give a more  deeper overview for each chapter.

Chapter 1: Getting Started

In this chapter there are some informations about the messaging architectures in general (good for newcomers to the topic) and about ZeroMQ messaging (in particular). Some concepts introduced in this chapter are reused a lot in the rest of the book.

In chapter 1 is introduced the first and the simpler ZeroMQ pattern, the request-replay.

Chapter 2: Introduction to Socket

This chapter starts with a nice introduction to the publish-subscribe pattern and the related filtering (ZeroMQ can filter messages with a very simple “match” pattern). Then, the chapter talks about one of the most interesting patterns when speed is important: the pipeline pattern. While is talking about the pipeline, it explain the ZMQ_PULL and the ZMQ_PUSH socket types. At the end of the chapter, there is an introduction to the Valgrind’s tools suite to detect memory leaks in C/C++ programs. In Delphi can be used FastMM or other similar tools for the same thing.

Chapter 3: Using Socket Topology

In this chapter there is a small introduction to the types of Internet Sockets and TCP. There there is a nice comparison between the “plain” sockets and the ZeroMQ sockets.

At the end, there is an introduction to the CZMQ, a small helper library which lets

C developers to code their ZeroMQ applications easier and shorter. For a Delphi programmer there are a number of ZeroMQ wrapper that makes its use really a snap.

Chapter 4: Advanced Patterns

In this last chapter, are introduced some advanced variation of the previously introduced patterns. Then, there is a nice explanation of some critical situations that could happened in a messaging system. To help the programmer to handle this cases there a number of examples of the ZeroMQ “High Watermark” setting. As very last topic, there is a well known problem, the infamous “slow subscribers in a publish-subscribe pattern”.

Conclusions

The “ZeroMQ” book published by PACKT Publishing is a small but very nice book. Can be very useful to all those people that don’t know about messaging or want add the power of ZeroMQ to their messaging knowledge.

As in every single thing, there are good aspects and bad aspects.

This book is good for an introduction but is not so good for advanced users. There are some other ZeroMQ patterns and features that are not explained at all. However, these patterns are not the most used, or are advanced stuff, so this could not be a big issue.

Considering, the price, the contents and the informative density, is a definitely a good book that can be read, and studied, in few hours and could change your way to do things in everyday programming (messaging are very often not used, or used in a bad way, simply because usually is complex to write and maintain a good messaging system).

One of the more nice features about ZeroMQ is that it can use different transportation protocols. The same library and the same code can be used to do messaging between machines, between processes or between threads in the same process (ipc). As last note, ZeroMQ can handle, without much effort, millions of messages per seconds. If you need speed… consider this.

P.S. I’ll translate and publish on this blog, some of the C examples contained in the book, in Delphi. Stay tuned.

ITDevCon 2012 – RECAP

Last friday is just ended the 4th edition of ITDevCon. This conference is, now, the biggest Delphi conference in Europe, in terms of speakers, speeches and topics… no doubt!

Some numbers:

  • 2 days
  • 31 speeches
  • 15 speakers from all over the world (Italy, USA, Norway, Slovenia, Benelux)
  • 70 attendees c.a. from all over the world (Italy, Germany, Russia etc)
  • 32 prizes offered by our (beloved) sponsors. No one of the attendee went back home without some prize won. In many cases the price of the prize has been even bigger than the price of the ticket!

Some speakers, attendees and other people, have already blogged about the conference and many others have talked about it on twitter and facebook. There’s been a great partecipation… before, during and after the conference.

#itdevcon on twitter: https://twitter.com/search?q=%23ITDevCon&src=hash

http://edn.embarcadero.com/article/42634

http://www.thedelphigeek.com/2012/10/itdevconrecap.html

http://www.thedelphigeek.com/2012/10/itdevcondinner-in-verona.html

http://blogs.embarcadero.com/pawelglowacki/2012/10/28/39863

http://www.thedelphigeek.com/2012/10/itdevcon-photos.html

http://blog.talentgarden.it/2012/07/24/itdevcon-tag-mediapartner-della-conferenza-per-sviluppatori-delphi/

http://www.hubme.in/events/europe/italy/itdevcon-european-delphi-conference-2012-san-giovanni-lupatoto-verona

http://www.marco.breveglieri.name/blog/?tag=itdevcon

http://blog.marcocantu.com/blog/conferences_itdevcon_2012.html

ASAP will be published other photos on Google Picasa.

This year too, ITDevCon has been a great experience.

I want to say THANK YOU to all the speakers, attendees and sponsors. And also to all the great bit Time crew that makes this conference the biggest Delphi conference in Europe. As you may think, I’m very proud of it.

See you next year for ITDevCon 2013!