Delphi Cookbook – 2nd Edition

Delphi Cookbook 2nd Edition

Starting from today my Delphi Cookbook 2nd edition is available to buy. The first edition got a lot of interest and appreciation comments. Delphi Cookbook is a best sellers for PacktPub (my editor) in its category, the editor decided to ask me a 2nd edition. So here it is!

What’s new

The problem with each “2nd” edition is: “What I can expect if I already bought the 1st one?”. This edition contains all the recipes from the 1st edition updated to the new Delphi 10.1 Berlin, plus a lot (ca 150 pages) of brand new contents. There is also a brand new chapter about less-known RTL classes. Also some “old” recipes has been completely rewritten because some techniques has been superseded by the newer Delphi versions. So, if you liked the 1st edition, you should find something interesting also in the 2nd one. The 2nd edition contains 470 pages compared to the 328 of the 1st edition.

Topics of the book

  • Understand the basics of professionals Delphi programming
  • Become a Delphi language Ninja
  • Knowing the new RTL classes to work with HTTP/S, Net encodings, event bus, compression etc.
  • Develop visually stunning applications using FireMonkey
  • Deploy LiveBinding effectively with the right OOP approach
  • The thousand faces of multithreading: syncronization tecniques in the real world
  • The Parallel Programming Library: Tasks, Futures parallel For
  • Create server-side programs to serve RESTful web services and provide data to your mobile apps
  • Use well-defined GUI design patterns to build mobile applications that provide a great user experience
  • Build mobile apps that read data from a remote server efficiently
  • Using sensors and network in mobile apps
  • Call the platform native API on Android and iOS even for an unpublished API
  • Manage software customization for your customer by making better use of an extended RTTI
  • Implement the most popular design pattern without wasting too much time on debugging and bug fixing

Some considerations

Delphi Cookbook 2nd edition, just like to 1st one, 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.

Where to buy

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

PacktPub (Official book page)

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

Amazon

Delphi Cookbook 2nd Edition on Amazon

 

Table of contents

Chapter 1: DELPHI BASICS

  • Change your application look&feel with VCL styles and no code
  • Changing the style of your application at run time
  • Customizing TDBGrid
  • Using owner draw combos and listboxes
  • How to make an owner draw control aware of the VCL styles
  • Creating a stack of embedded forms
  • Manipulating JSON
  • Manipulating and transform XML documents
  • I/O in the 21th century: knowing the streams
  • Creating a Windows service
  • Associating a file extension with your application on Windows
  • Be coerent with the Windows look&feel using TTaskDialog

Chapter 2: BECOME A DELPHI LANGUAGE NINJA

  • Fun with anonimous 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

Chapter 3: KNOWING YOUR FRIENDS: THE DELPHI RTL

  • Check strings with regular expressions
  • Consuming RESTful services using native HTTP(S) client libraries
  • Cope with the encoded Internet world using System.NetEncodings
  • Save space using System.Zip
  • Decouple your code using a cross platform publish/subscribe mechanism

Chapter 4: 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
  • Reinvent your GUI a.k.a Mastering Firemonkey controls, shapes and effects

Chapter 5: THE THOUSAND FACES OF MULTITHREADING

  • Synchronizing shared resources with TMonitor
  • Talking with main thread using a thread safe queue
  • Synchronizing multiple threads using TEvent
  • Displaying a measure on 2D graph like an oscilloscope
  • Using the Parallel Programming Library in the real world: Tasks
  • Using the Parallel Programming Library in the real world: Futures
  • Using the Parallel Programming Library in the real world: Parallel For/Join

Chapter 6: PUT DELPHI ON THE SERVER

  • Developing web client JavaScript applications with WebBroker on the server
  • Converting a console service application to 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 application using UDP
  • Using AppTethering to create companion app
  • Creating DataSnap Apache modules
  • Creating WebBroker Apache modules
  • Using native HTTP(S) client libraries

Chapter 7: RIDE THE MOBILE REVOLUTION WITH FIREMONKEY

  • Taking a photo, applying effects, and sharing it
  • Using ListView to show and search local data
  • Using SQLite databases to handle a to-do list
  • Do not block the main thread!
  • Using a styled TListView to handle long list of data
  • Customizing the TListView
  • Taking a photo and location and sending it to a server continuously
  • Talking with the backend
  • Making a phone call from your app!
  • Tracking the application’s lifecycle

Chapter 8: USING SPECIFIC PLATFORM FEATURES

  • Using Android SDK Java classes
  • Using iOS SDK classes
  • Displaying PDF files in your app
  • Sending Android intents
  • Letting your phone talk: using the Android TextToSpeech engine
  • Using Java classes in Android apps with Java2OP
  • Do it in background, the right way: Android services

Events

In the next months there will be some events regarding the book.

  1. A one day workshop, held in Rome and Milan, about selected recipes of the books with additional contents and other “live” considerations.
  2. Some blog post about contents that not fitted (by time and other contraints) in the book. Most of them will be about the server side development and will involve Redis and other open source projects.
  3. Oct 6,7 2016 PacktPub will be one of the sponsor of ITDevCon 2016. During that event there will be some surprises for the attendants offered by the Delphi Cookbook “series” (yes, 2 is a series 🙂 ) editor.

 

Conclusions

As usual, writing a tech book is an hard task. 470 pages are more than I was thinking at the day 0. However, I’m quite (not completely, as usual) satisfied about the work. I really hope that you will enjoy the content at least as much I enjoy the writing.

ITDevCon 2016 – Call4Paper

ITDevCon2016 logo
UPDATE:

ITDevCon2016 will be held next Oct 6th, 7th in Rome (Italy).

The post has been updated as well.

Dear potential ITDevCon speaker,

As every year (but 2015), I’m building the agenda for next ITDevCon that will be held next October 6th, 7th in Rome (Italy), in a new location, the bit Time group headquarter!

This will be the 7th conference edition and will be organized by bit Time Professionals, part of the bit Time Group.

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

Send your Call4Paper to d.teti@bittime.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 Jul 31st, 2016 but if you have *VERY* interesting topic to propose, propose it… I’ll try to arrange the schedule and fit it in the agenda.

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
  • IoT (Internet of Things) solutions
  • FireMonkey platform
  • MacOSX development
  • Android development
  • iOS development
  • Windows development
  • Mobile development (Android and/or iOS)
  • Develop UIs for different devices (smartphones, tablets, TV, watch etc)
  • LiveBindings ®
  • Delphi best practices
  • Design Patterns
  • Open Source Delphi Frameworks (Spring4d, DelphiMVCFramework etc)
  • Arduino, Raspberry Pi or others similar system
  • Web Application with Delphi
  • Integration with external systems
  • 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 and Anonymous Methods
  • RESTful interfaces design and development
  • Architectures
  • Cool (dev) things that you are doing or that you did in the recent past

Target audience

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

The conference web site is http://www.itdevcon.it

Up to May 31st you can get the ticket at the discounted early bird or 249.00 Euro. After that day the normal ticket price will be 349.00 Euro. Get it!

The ticket includes:

  • 2 conference days
  • Lunches
  • Coffee Breaks
  • Gadgets

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

As usual one of the most important part of ITDevCon will be the networking between attendees. I know about great collaboration born during ITDevCon. Be there and don’t miss this social opportunity!

Thank you and…  see you at ITDevCon 2016.

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.

 

Mar., 22nd 2016: “Refactoring legacy code to design patterns”

On Mar,22nd 2016 I’ll talk about refactoring during a programmed skill sprint with the title: Refactoring legacy code to design patterns.

After a short theoretical introduction, there will be a live demo showing the power of refactoring and the power of the refactoring engine built in into the RAD Studio IDE. At the end of the session will be given some reference to the most important books about refactoring (IMHO).

Register here: https://www.embarcadero.com/landing-pages/skill-sprints

 

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

Echoes From The Past: Message Master For Delphi a.k.a. MM4D

Some years ago, at the Delphi 6/7 timeframe I was working on a client/server program with c.a. 400 forms and 200 units. At that time I needed a simple way to localize in Italian (in primis) and in other languages, all the  standard dialogs (ShowMessage, InputBox, InputQuery etc.). Moreover, I would have liked to give a unique style to them. In addition, I needed to localize that dialogs. Moreover I needed a simple way to show a program of a background operation using a not modal dialog with a simple pattern like the following:

  ...
  ShowStatusPos(STATUS_CAPTION, Point(50, 50), True);
  try
    for i := 1 to 100 do
    begin
      SetupQuery(LMyDataset, i);
      LMyDataset.Open;
      while not LMyDataset.Eof do
      begin
        //do something
        UpdateStatus(i, Format(STATUS_CAPTION + ' %2d%%', [i]));
        LMyDataset.Next;
      end;
      LMyDataset.Close;
    end;
  finally
    CloseStatus;
  end;
  ...

So, after some tests I wrote Message Master for Delphi. MM4D is a smal library which supports all of these features, or at least these features were supported at that time. Indeed, since then I saw many (really many) 3rd-party Delphi/C++Builder written programs which actually use MM4D. However, since then I didn’t supported that library anymore. Now, more or less, 15 years after, a user wrote to my about MM4D support in Delphi 10 Seattle. So, I decided to update the code to let it compile on Delphi 10 Seattle. So, now it is currently supported (even if I dont plan to improve it in any way in the short term). However if someone use it or want to use it and update/upgrade/improve, here’s the github reporitories. I hope I have done something good for all the old time users.

Message Master For Delphi
https://github.com/danieleteti/mm4delphi

In the repositories there is a demo to show all the features of MM4D and there is also a small tool called UnitsAdded.exe which can be used to add the MM4D features to a project automatically (search for Dialogs.pas and, if exists, add MessDlgs after it).
MM4Delphi uses the good XiControls (included). So, still thank you to Eugene Genev for his XiControls.

DelphiMVCFramework at the 10° Delphi Meetup in Dresden , Germany

Mathias Pannier did a nice talk at the 10° Delphi Meetup in Dresden, Germany. You can find his review with the slide (both in english) in his blog.

Mathias contacted me about some specific questions the audience did.

Here’s my replies.

  • Is it possible to have a [MapperJSONSer(‘first_name’)] attribute for DataSet fields?
    • Not currently. It quite simple to implement but now this feature is available only for objects using RTTI attributes. Maybe in the near future this will be extended also to dataset serialition.
  • Is it possible to implement a custom renderer for example for xml output?
    • Sure! DMVCFramework is really opened to extensions. You can implement renders for every format you like, you are not tied to the built in.
  • Which Delphi edition is required? Starter, Professional, Enterprise, Ultimate?
    • DMVCFramework requires Professional version, because WebBroker is available from that version upwards.
  • Did You have any performance comparison?
    • Yes, it is not a complete test, is just a rough test between DMVCFramework and nodejs. DMVCFramework is not running into Apache or IIS, but is using its INDY default web server so the actual performance using a real webserver are far better.

dmvcframework_nodejs_preliminary_test

I’m planning to do more tests and as sson I’ll do them, will be published here and in the facebook group.

  • What about documentation?
    • The framework is quite intuitive, so after read this presentation (ITDevCon2013) you can go though all the samples (which covers all the features) and you will be up&running in in an hour or so.
    • However, some volenterous users, are starting to work on a more structured documentation. There will be a markdown generated site which will provide tutorial and devguide.

 

Still thank you to all the people which actively partecipating in this project.

 

Stay tuned.

 

 

Delphi Cookbook 2nd edition has been announced

Just after 1 year and half from the 1st edition, the 2nd edition of Delphi Cookbook has been announced. The first edition got a lot of interest and appreciation comments, so the editor decided to ask me a 2nd edition. So here it is! It is still in work-in-progress but the work is going smooth. In a month or two will start the review phase and then the book should be officially presented.

However, if you are interested, the book is already available in preorder.

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

B04677_MockupCover_Cookbook

I want to thank you all for the success which Delphi Cookbook gets, and I hope that this 2nd edition will gets the same (or, why not, better) appreciation.

Stay tuned

DT

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)