threads & anonymous methods

February 23rd, 2010

I had a funny idea this weekend, I was looking for a way to multithread a part of my code without having to break my code.
Using an anonymous method the thread is able to access the local variables of the method that executes the thread.
The trick is very simple and allows great flexibility in the code.

type
  TRefProc = reference to procedure;

function Thread(const proc: TRefProc): THandle;
  function run(const proc: TRefProc): Integer; stdcall;
  begin
    proc;
    Result := 0;
  end;
begin
  CreateThread(nil, 0, @run, PPointer(@proc)^, 0, Result);
end;

procedure DoIt;
var
  done: THandle;
begin
  done := CreateEvent(nil, True, False, nil);
  try
    Thread(procedure
    begin
      sleep(2000);
      SetEvent(done);
    end);
    WaitForSingleObject(done, INFINITE);
  finally
    CloseHandle(done);
  end;
end;

About me

February 11th, 2010


I have a good resolution for this new year I will socialize me.

I am 34 years old and live in Metz in France.

I am self taught for nearly 15 years after abandoning my studies in accounting, and after failing the entrance examination of an art school, the world will never know what artist I could be.
I console myself by saying that what I do is also art.

If you like my work, you can follow me on facebooktwitter and buzz of course. If you can not live without me, there is a button “donate” :D


Henri Gourvest

SuperObject v1.2.3

January 12th, 2010

This new version fixes a critical bug that prevents a “currency” to serialize correctly.

http://code.google.com/p/superobject/downloads/list

Delphi on Rails – 1st screencast

November 30th, 2009
This is my first screencast, that shows how to create a controller with DoR.
Using RTTI, it is not necessary to write a lot of code.
DoR also use “Convention over Configuration” design pattern !
This is my first screencast, that shows how to create a controller with DoR.
Using RTTI, it is not necessary to write a lot of code.
DoR also use “Convention over Configuration” design pattern This is my first screencast, that shows how to create a controller with DoR.
Using RTTI, it is not necessary to write a lot of code.
DoR also use “Convention over Configuration” design pattern !

SuperObject v1.2

November 28th, 2009

There is a new release of SO, take a look on changes.

Downloads and SVN repository moved to Google Code.

Delphi on Rails coming …

November 27th, 2009

Hi friends,

I started a new project hosted on google code: Delphi on Rails (DoR).

This project is a web application framework using REST MVC architecture.

It use latest Delphi improvements (RTTI, Generics, Unicode …).

It use open source and cross-platform technologies:

  • scripting:  LUA, the fast and popular script langage.
  • graphic:  CAIRO, is the gnome vector library able to produce PNG, SVG, PDF, PS …

It use my own projects:

  • UIB:  for the interbase/firebird driver.
  • superobject: for JSON parsing and many other things.

Ready for future versions of Delphi:

  • Ready for 64 bits.
  • Ready for cross-plateform.

Are you ready ?

http://www.delphionrails.com

http://code.google.com/p/delphionrails/source/checkout

Séminaires Delphinautes le 26 Novembre à Lyon

October 20th, 2009

Amis francophones, je tiendrais une session à ce séminaire sur le theme:

Développement de serveur d’application/web avec Delphi 2010 (REST, MVC, UIB, RTTI, Firebird, JSON, LUA).

Plus d’informations içi:

http://www.grizzlydev.com/seminaires_delphinautes.13.1.46.html

Venez nombreux

Delphi 2010 JSON & RTTI

October 16th, 2009

Preview of the new Delphi 2010 RTTI support of SuperObject.
To play with it get the latest SVN version.

SevenZip v1.1

April 16th, 2009

A new version is available to use the latest version of sevenzip. Now, only one dll is necessary: 7z.dll. Easy to deploy, easy to use …

JSON – SuperObject v1.1 released

March 7th, 2009

Well, it’s time to release something,
there is now more samples, documentation and a new xml parser.

Change log:
v1.1
+ Double licence MPL or LGPL.
+ Delphi 2009 compatibility & Unicode support.
+ AsString return a string instead of PChar.
+ Escaped and Unascaped JSON serialiser.
+ Missed FormFeed added \f
- Removed @ trick, uses forcepath() method instead.
+ Fixed parse error with uppercase E symbol in numbers.
+ Fixed possible buffer overflow when enlarging array.
+ Added “delete”, “pack”, “insert” methods for arrays and/or objects
+ Multi parametters when calling methods
+ Delphi Enumerator (for obj1 in obj2 do …)
+ Format method ex: obj.format(‘<%name%>%tab[1]%‘)
+ ParseFile and ParseStream methods
+ Parser now understand hexdecimal c syntax ex: \xFF
+ Null Object Design Patern (ex: for obj in values.N['path'] do …)