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!

How to serialize a TList of objects with Delphi

Some weeks ago a customer asked to me if it is possibile serialize a TList of objects. “Hey, you should use a TObjectList for this”, I said, but he absolutely needs (I dont know why) of a TList.

This is the (simple) sample code tested with Delphi XE2 Update4. Enjoy.


unit Unit4;

interface

uses
  Winapi.Windows,
  Winapi.Messages,
  System.SysUtils,
  System.Variants,
  System.Classes,
  Vcl.Graphics,
  Vcl.Controls,
  Vcl.Forms,
  Vcl.Dialogs,
  Vcl.StdCtrls;

type
  TForm4 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  TPerson = class
  private
    FName: String;
    procedure SetName(const Value: String);
  published
    property Name: String read FName write SetName;
  end;

var
  Form4: TForm4;

implementation


uses
  Contnrs,
  dbxjson,
  dbxjsonreflect;

{$R *.dfm}

procedure TForm4.Button1Click(Sender: TObject);
var
  list: TList;
  m: TJSONMarshal;
  json: TJSONObject;
  p1: TPerson;
  p2: TPerson;
begin
  p1 := TPerson.Create;
  p2 := TPerson.Create;
  try
    p1.Name := 'Daniele Teti';
    p2.Name := 'Peter Parker';
    list := TList.Create;
    try
      list.Add(p1);
      list.Add(p2);

      m := TJSONMarshal.Create;
      try
        // Register a specific converter for field FList
        m.RegisterConverter(TList, 'FList', function(Data: TObject; Field: String): TListOfObjects
          var
            l: TList;
            j: integer;
          begin
            l := Data as TList;
            SetLength(Result, l.Count);
            for j := 0 to l.Count - 1 do
              Result[j] := TObject(l[j]); // HardCast from pointer
          end);

        json := m.Marshal(list) as TJSONObject;
        try
          Memo1.Lines.Text := json.tostring;
        finally
          json.free;
        end;
      finally
        m.free;
      end;
    finally
      list.free;
    end;
  finally
    p1.free;
    p2.free;
  end;
end;

{ TPerson }

procedure TPerson.SetName(const Value: String);
begin
  FName := Value;
end;

end.

The output is, as expected, the following:

{"type":"System.Classes.TList","id":1,"fields":{"FList":[{"type":"Unit4.TPerson","id":2,"fields":{"FName":"Daniele Teti"}},{"type":"Unit4.TPerson","id":3,"fields":{"FName":"Peter Parker"}}],"FCount":2,"FCapacity":4}}

ITDevCon2012 – Call4Papers

ITDevCon2012

Dear potential ITDevCon speaker,

I’m building the agenda for next ITDevCon 2012 that will be held October 25th,26th in Verona (Italy), the same location of the past year.

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 July 31st, 2012.

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 Delphi
  • FireMonkey
  • iOS development (iPhone, iPad, iPod Touch)
  • MacOSX development
  • Android clients for Delphi servers
  • Windows 8
  • Delphi best practices
  • Design Patterns
  • DataSnap
  • “Unusual” Delphi markets
  • TDD and Unit Tests
  • Agile methodologies
  • Dependency Injection
  • ORM
  • Software engineering
  • “Hands on” sessions for the most used Delphi frameworks (e.g. Delphi Spring Framework, OTL etc)
  • Mobile
  • HTML5/SVG/WebGL and Delphi
  • OOD/OOP
  • Web development with Delphi
  • Real OOP Delphi applications developments
  • Delphi fundamentals/advanced
  • Metaprogramming
  • Games
  • SOA/ROA
  • Architectures

Target audience

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

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

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

Thanks and see you at ITDevCon 2012.

P.S. This year, ITDevCon will be even more amazing! Stay tuned!

dorm, “The Delphi ORM” and Spring for Delphi Framework

Great news for all the dorm and Spring4D users!

As you probably know, finally has been announced the official Spring framework for Delphi.

There is a lot of good technology in Spring4D!

So, I’m glad to announce that in a future version (hopefully, the next one) dorm, “The Delphi ORM” will use Spring4D and will become the ORM part of Spring4D.

So, dorm will be part of the Spring4D framework.

More info to come, so stay tuned.

Delphi MVC Web Framework – “Hello World”

This is the first “Hello World” for my Delphi MVC Web Framework.

program DelphiMVCWebFramework;

{$APPTYPE CONSOLE}

uses
  System.SysUtils,
  MVCEngine in 'MVCEngine.pas',
  BaseController in 'BaseController.pas';

var
  mvc: TWebMVCEngine;
begin
  mvc := TWebMVCEngine.Create;
  mvc.AddRoute('/', procedure(Context: TWebContext)
    begin
      Context.Write('Hello World');
    end).Start(8080);
  ReadLn;
  mvc.Free;
end.

Features list (some of them are in the internal roadmap)

  • Completely MVC
  • Addressable with servername/controllername/actionname?par1&par2
  • Addressable with servername/controllername/actionname/par1/par2
  • Can also use anonymous methods as actions for very simple app (in the sample)
  • Really RESTful (Level 3 of the Richardson Maturity Model)
  • Fully integrable into WebBroker and DataSnap
  • Supports multiple resource rapresentations
  • Completely customizable routing using internal formatting or regex
  • Inspired to ASP.NET, Sinatra, Java Spring MVC, Java Restlet
  • Scriptable views support (Pascal, Razor, Lua)
  • Component based
  • Session support
  • ORM support using dorm
  • Classic TDataSet support
  • State server to support real loadbalancing using reverse proxy
  • Can be deployed as standalone (in the example), ISAPI dll and Windows Service
  • Fully support https
  • More to come…
  • This framework is still under development.

    Are you interested in? 🙂

    UPDATE:

    The project is open source and you can fint it here

    https://code.google.com/p/delphimvcframework/

#1 “dorm, the Delphi ORM” bullettin

This is the first post regarding a fast update on the last changes to the dorm project in terms of management and code.

  • Welcome to 2 new contributors: mrbar2000 and magnomp (this is the full list http://code.google.com/p/delphi-orm/people/list)
  • Added a PersistentStrategy for SQLite.
  • New Google Group related to dorm. Post your questions, comments and request here!
  • Added support for Generics Collections. No more needs of TdormCollection. You classes are completely decoupled from the framework.
  • A brand new mapping strategy is under development. There will be “3 levels” of mapping: Config File, RTTI Attributes and “Conventions Over Configuration” (CoC) (do you wanna check the code in dev branch? Click here)
  • Added more unittests
  • Roadmap updated
  • Initial support for MS SQLServer in a development branch (Thanks to Claudio Regonat)
There are plenty of new features still to come. Stay tuned!

Do you wanna see an enormous potential tool? Here’s the pascal for Java and Android

Yes, this is very cool. I’m not a Java hater, in terms of language (and I dont want to start a language-war), but some Java features, IMHO, are a bit uncomfortable for me.
However, Java is very powerful and there are an enormous amount of good open source project for Java. So, seeing java libraries used in simil-pascal code (is not Delphi’s Pascal, but enough similar), is nice. In this way, you can use all the java libraries in Pascal!
I’d like to have this integration in Delphi IDE too with a good designer for Android activities.

I’m testing Oxygene for Java (form RemObjects) for a couple of things, specifically Android related.
This is my first console project in Oxygene for Java, just to see some code.

Oxygene for Java - Simple console app using specific Java libraries
Oxygene for Java – Simple console app using specific Java libraries

 

IMHO there is an enormous potential for the Delphi developer and for all the developers that need a unique language to do server, mobile and native ultra fast app.

I dream to have this technology into the Delphi IDE.

Duck Typing in Delphi

During a new dorm feature development, I’m faced a nice problem:

I want to have a generic access to a “kind” of list

Let’s say:

procedure DoSomething(Obj: TMyListType);
begin
...
end;

But, I want to have that generic access without a Layer Supertype object, because I need to be able to use objects from other libraries or 3rd party. In this case traditional polimorphism is not usable, so I’ve opted for an interface…

procedure DoSomething(MyIntf: IMyListInterface);
begin
...
end;

Cool, but I want to have that access without any change to that object. So implement an interface is not a viable solution. This is particulary true because the generics data structure in Delphi do not implement an interface. Will be nice to have a fully interfaced list and dictionaries in a future Delphi version.

So, how I could implement a generic access to a generic list?

procedure DoSomething(MySomething: ???);
begin
...
end;

However, operations on that list are few and well known, so I’ve opted for a “DuckTyping“.

Introducing the duck
Introducing the duck

The name of the concept refers to the duck test, attributed to James Whitcomb Riley, which may be phrased as follows:

“When I see a bird that walks like a duck and swims like a duck and quacks like a duck, I call that bird a duck.”

So, in my case, I’ve created an Adapter object wich adapts the external interface (few, well know operations) to the “duck” inside it.

The adapter is useful because I can use the compiler checking that the RAW RTTI access doesn’t allow.

Write an “RTTI adapter” using the new Delphi RTTI, is very simple. This is the code of the class TDuckTypedList that allow to use any object as a “list”. How I can define that the object is actually a list?

The criteria is:

If the object has
– An “Add” method with one parameter of type TObject (or descendant);
– A “Count” property;
– A “GetItem” method that have an integer parameter and return an object;
– A “Clear” method;
then, that object is a list.

So I can write the following:

DuckObject := TDuckTypedList.Create(Coll);  //the adapter
for x := 0 to DuckObject.Count - 1 do
  DoSomething(DuckObject.GetItem(x));  

I’ve done some speed tests comparing this way to the classic static way, and the speed is almost the same because the RTTI lookup is cached in the constructor of the adapter. So, so far so good.

This solution is already in use inside the dorm code in a feature branch.

Full code is available in the dorm SVN

Any comments?

ITDevCon 2011, recap

Last Friday ended the third edition of ITDevCon, the European Conference on Delphi and its related technologies.
ITDevCon this year was even bigger and funny.
There have been more present, more sponsors, more speakers, more topics and a lot of people with the desire to learn new things and improve their every day work.

A special thanks goes to all the speakers who participated and the sponsors who have contributed their support to make this conference a major event for the European community Delphi.

I hope that the content and the organization is liked to you at least half of how much it is liked to me.
We are organizing slides, videos and examples for each speech to put it all on-line available to participants at the conference as soon as possible. You will receive an email informing you of how to download all the material available.
In the coming days, on the conference website (www.itdevcon.it) we will post all the pictures we have done in these three days.

If you have any photos that you want to see published, send them to me, we’ll publish it on the official website.

Some friends (and speakers) already blogged about the conference:

DavidI
http://blogs.embarcadero.com/davidi/2011/10/24/41413

Paweł Głowacki
http://blogs.embarcadero.com/pawelglowacki/2011/10/30/39392

Primoz Gabrijelcic
http://www.thedelphigeek.com/2011/10/itdevcon-2011recap.html

Marco Cantù
http://blog.marcocantu.com/blog/itdevcon2011_summary.html

And now, Daniele Teti :-)

ASAP I’ll publish the slides of every speeches.

If you want to see the tweet about the conference, you can go here.

Here’s some photos from the conference.

During the “Country Evening” some of us have been singing with the good “Tex Roses” friend (an italian country band). Probably there are at least 15 video documenting my “performance”!

Here’s the video recorded by Primož (the Delphi Geek)

I thank again all those who have spoken and all those who have attended to ITDevCon.
See you next year.

– Daniele

App Android ITDevCon2011 disponibile sul Market (ITALIAN)

Manca solo una settima all’inizio di ITDevCon2011. Per permettere a tutti gli iscritti (e far decidere chi è ancora indeciso) di sfruttare al meglio i due giorni di intensa formazione, abbiamo appena pubblicato l’applicazione ITDevCON2011 sul’Android Market.
Trevete il programma completo della conferenza, i profili degli speaker e informazioni sugli sponsor.
Inoltre, potrete definire i vostri speech preferiti in modo da essere avvisati subito prima dell’inizio dello speech.
Potrete votare e commentare ogni speech. Potete commentare da subito inserendo le vostre aspettative per lo speech o alcune delucidazioni sul contenuto. Il voto invece sarà possibile solo a speech avvenuto.

Dal punto di vista tecnico, questa applicazione Android utilizza un servizio REST scritto con Delphi utilizzando DataSnap e i Mobile DataSnap connectors per Android.
Per chi fosse interessato al “Making”, durante la conferenza potrà assistere allo speech di Salvatore Sparacino che illustrerà i vari step dello sviluppo e le soluzioni tecnologiche adottate.
Per definire il vostro profilo, votare e commentare, dovrete utilizzare il codice fornito al momento dell’iscrizione. Se non siete partecipanti, o ancora non vi è arrivato il codice di accesso, potete utilizzare l’applicazione come “anomymous”. In questo caso non potrete salvare i vostri speech preferiti Né votare o commentare.

Dashboard

La time table
Speaker details
Dettagli dello speaker (in questo screenshot, DavidI)

Il link da dove installare l’applicazione è il seguente:
https://market.android.com/details?id=it.bittime.itdevcon2011

Happy ITDevCon2011