Migration to github for all my open source projects… done!

Since when Google announced that Google Code will be closed I did start to plan the migration of all my open source projects. Now, the migration is terminated.

In the next days, I’ll add all the contributors too, so that the development can go forward as usual.

These are the projects

  • DelphiMVCFramework
    • if you are reading my Delphi Cookbook, please use this new repository instead of the old SVN one, reported in the book.
  • DORM, the Delphi ORM
  • DelphiRedisClient
  • DelphiDIContainer
  • DelphiSTOMPClient

All the repositories are available on my personal github page https://github.com/danieleteti and, as usual all contributions are welcome.

Enjoy.

 

DelphiPodcastIT episode 2 – Interview about DelphiMVCFramework

DelphiPodcastIT
DelphiPodcastIT and DelphiMVCFramework

In the 2nd episode of DelphiPodcastIT (Delphi podcast in italian language by Marco Breveglieri) there is a my interview about the past, the present and the future of DelphiMVCFramework with a lot of technical contents. The interview itself is quite long, just like a micro training on DelphiMVCFramework.

Enjoy the listening (only in italian, sorry)

http://www.delphipodcast.com/Episode/2/applicazioni-restful-con-dmvcframework

 

P.S. bit Time Professionals offers specific training, consultancy and development about DelphiMVCFramework (besides to Delphi, web development, mobile development, Android, C++ Builder, PHP, Lua, nodejs, Python and embedded)

My “Delphi Cookbook” has been published

Almost an year ago I started to write a book about Delphi for Packt Publishing. Today that book has been published.

Delphi Cookbook Cover
Delphi Cookbook Cover

This book is a cookbook! That’s it, in 328 pages you will find useful (I hope) “recipes” for your day-by-day Delphi job.

Topics of the book

  • Create visually stunning applications using FireMonkey
  • Effectively use LiveBindings with the right OOP approach
  • Create server-side programs to serve RESTful web services and provide data to your mobile apps
  • Develop mobile apps for Android and iOS using well-defined GUI design patterns for a great user experience
  • Build efficient mobile apps that read data from a remote server
  • Call the platform-native API on Android and iOS even for an unpublished API
  • Use extended RTTI to better manage the software customization for your customer
  • Leverage the most popular design patterns for a better design without wasting too much time debugging

It is not an introductory book, you will not find any “Introduction to the Object Pascal language”, however the majority of the chapters are not too complex and can be grasped also by the new Delphi programmers.

The book is available for sale on the editor website and on Amazon.

Official book page at PacktPub

https://www.packtpub.com/application-development/delphi-cookbook

Book at Amazon

http://www.amazon.com/Delphi-XE6-Cookbook-Daniele-Teti/dp/1783559586

— Table of Contents —

Chapter 1: Delphi Basics

Changing your application’s look and feel with VCL styles and no code

Changing the style of your VCL application at runtime

Customizing TDBGrid

Using the owner’s draw combos and listboxes

Creating a stack of embedded forms

Manipulating JSON

Manipulating and transforming XML documents

I/O in the twenty-first century – knowing streams

Putting your VCL application in the tray

Creating a Windows service

Associating a file extension with your application on Windows

Chapter 2: Become a Delphi Language Ninja

Fun with anonymous methods – using higher-order functions

Writing enumerable types

RTTI to the rescue – configuring your class at runtime

Duck typing using RTTI

Creating helpers for your classes

Checking strings with regular expressions

Chapter 3: Going Cross Platform with FireMonkey

Giving a new appearance to the standard FireMonkey

controls using styles

Creating a styled TListBox

Impressing your clients with animations

Using master/details with LiveBindings

Showing complex vector shapes using paths

Using FireMonkey in a VCL application

Chapter 4: The Thousand Faces of Multithreading

Synchronizing shared resources with TMonitor

Talking with the main thread using a thread-safe queue

Synchronizing multiple threads using TEvent

Displaying a measure on a 2D graph like an oscilloscope

Chapter 5: Putting Delphi on the Server

Web client JavaScript application with WebBroker on the server

Converting a console service application to a Windows service

Serializing a dataset to JSON and back

Serializing objects to JSON and back using RTTI

Sending a POST HTTP request encoding parameters

Implementing a RESTful interface using WebBroker

Controlling remote applications using UDP

Using App Tethering to create a companion app

Creating DataSnap Apache modules

Chapter 6: Riding the Mobile Revolution with FireMonkey

Taking a photo, applying effects, and sharing it

Using listview to show and search local data

Do not block the main thread!

Using SQLite databases to handle a to-do list

Using a styled TListView to handle a long list of data

Taking a photo and location and sending it to a server continuously

Talking to the backend

Making a phone call from your app!

Tracking the application’s life cycle

Chapter 7: Using Specific Platform Features

Using Android SDK Java classes

Using iOS Objective-C SDK classes

Displaying PDF files in your app

Sending Android intents

Letting your phone talk – using the Android TextToSpeech engine

I hope you enjoy the reading!

–Daniele

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).

March 2014 news about “DelphiMVCFramework”

In the last months DMVCFramework has been used in many projects. Some fixes and some new features has been added.

Tomorrow will start the 4th training from the Jan 1st 2014 on DMVCFramework… WOW!

The best selling training is “Developing Web Client applications using AngularJS and DelphiMVCFramework” (a slightly modified version of this classic training http://www.bittime.it/sviluppare_applicazioni_web_usando_angularjs_con_delphi_back_end).

Tomorrow the training will be in italian, however is very popular also the english version.

However, back to the project, there is a first attempt to add some documentations on the project.

So far there are a lot of samples and all the unit tests, however there was a lack on the “classic” documentations. So, I’m happy to say that in the SVN trunk you can find my presentation held at the last ITDevCon2013 in Verona, IT.

If you are using DMVC framework I’ll be glad to have 2 lines of description about your project (numbers not functionalities insights) to put a success case page on the project website.

Here’s the direct link to the documentations: https://delphimvcframework.googlecode.com/svn/trunk/docs/DelphiMVCFramework.pdf

This is the main DelphiMVCFramework project website: https://code.google.com/p/delphimvcframework/

Stay tuned

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

DelphiMVCFramework is now Open Source!

delphimvcframework

Yes, just after 1 year of development, and a couple of big projects developed with it, the DelphiMVCFramework has been published as OpenSource.

The project is on google code svn https://code.google.com/p/delphimvcframework/

I’ll talk about it at ITDevCon2013 (http://www.itdevcon.it)

In the trunk there are many samples and I’m planning to put many others.

Main DMVCFramework features

  • RESTful (RMM Level 3) compliant
  • Server side generated pages using eLua (Embedded Lua)
  • Messaging extension using STOMP (tested with Apache Apollo and Apache ActiveMQ)
  • Can be used in load balanced environment using memcached (memcached.org)
  • Fancy URL with parameter mappings
  • Integrated RESTClient
  • Works with XE4 and XE5 (tested, but should works also on XE3 and XE2)
  • Experimental support for IOCP
  • Simple, but very very simple, to use…

It contains also a lot of indipendent code that can be used in other kind of projects.

These are the most notable:

  • Mapper (convert JSON <=> Object, ObjectList <=> JSONArray, ObjectLists <=> DataSets)
  • LuaBinding (integrate Lua script into Delphi native code)
  • LuaTextFilter (convert eLua into plain Lua executable script just like JSP)
Currently DMVCFramework use Embarcadero WebBroker framework, but is not tied to it. I’m working on a version that use IOCP (that is 10 times faster than plain WebBroker) and other web libraries for Delphi.
Code is enough stable and is already used in big production system.
WARNING!
There are a couple of bugs that affect WebBroker and so, DMVCFramework.
In our system, I’ve applied some patches to solve these problems. If you need those patches, ask me (I cannot publish the full code because it is Embarcadero licensed code).
The bugs are:
And another bug that affect also DataSnap and TIdHTTPWebBrokerBridge based projects.
Code is tested on XE4 and XE5 but should works also on XE3 and XE2.