Here you go — DeHL 0.8

DeHL

This is going to be a short one. After months of no releases, here it is: DeHL 0.8 (see changelog for the list of changes on this release). As I mentioned previously, this release will only work on Delphi 2010, since the number of changes required to support serialization was quite big.

I must confess, this is the first time in my programming career that I had to interact with serialization (excluding the times when the frameworks do that for you). I had to learn quite a bit and changed my internal design three times.

So, here’s an example how to serialize a TFormatSettings structure into binary format:

var
  LBinFile: TFileStream;
  LBinSerializer: TBinarySerializer<TFormatSettings>;
  LSettings: TFormatSettings;
begin
  { Obtain current thread's format settings }
  GetFormatSettings(GetThreadLocale(), LSettings);

  { Create a serializer and a file stream }
  LBinSerializer := TBinarySerializer<TFormatSettings>.Create();
  LBinFile := TFileStream.Create('dump_obj.bin', fmCreate);

  { Serialize the structure }
  try
    LBinSerializer.Serialize(LSettings, LBinFile);
  finally
    LBinFile.Free;
    LBinSerializer.Free;
  end;
end;

… and here’s an example how to deserialize it:

var
  LBinFile: TFileStream;
  LBinSerializer: TBinarySerializer<TFormatSettings>;
  LSettings: TFormatSettings;
begin
  { Create a serializer and a file stream }
  LBinSerializer := TBinarySerializer<TFormatSettings>.Create();
  LBinFile := TFileStream.Create('dump_obj.bin', fmOpenRead);

  { Deserialize the structure }
  try
    LBinSerializer.Deserialize(LSettings, LBinFile);
  finally
    LBinFile.Free;
    LBinSerializer.Free;
  end;
end;

Note: I have written quite a few unit tests to support the new changes, but most certainly there are hidden bugs. If you find one please report it here.

Other Note: I exhausted my idea jar regarding new features. If you have an idea please do not hesitate to drop me a comment or an email.

Have Fun!

1 2

54 Responses to 'Here you go — DeHL 0.8'

  1. Anonymous says:

    Very interesting.
    How do you handle graph of object?
    Suppose that a object (O) to be serialized contains a reference to a contained object (C).
    If c has a property that refers to its container object, how it will be serialized?

    Eg.
    var
    O : TClassO;

    O.c := TClassC.Create;

  2. (sorry I pressed the wrog keyboard button)


    O.c.Parent := O;

    Stefano

  3. alex says:

    Each object (actually “referenced type” as there can be pointers to records or dyn arrays) get an unique ID that is used when the same ref is found the second time.

  4. geskill says:

    I’m getting the following error: “The entity FItemClass of type TCollectionItemClass does not define any serialization/deserialization method!”. I tested my really big settings class on it, but as you see in the error – it don’t works. Furthermore i miss detailed information and samples what your code can and cannot do. For example i use many TCollection’s to save my settings, looks like your code cannot handle this :( maybe you can improve this for the future or maybe i do something wrong.

  5. alex says:

    The serializer cannot handle “opaque” data types. For example you cannot serialize a TList class since it contains pointers and there is no knowing what’s behind that pointer. In the same manner it seems that FItemClass is a TCollectionItemClass (TClass) type and that is not handled yet (forgot actually). But in any case there is a small chance you can get some complicated data type and serialize it successfully, and there’s no need to actually.

  6. Cleber says:

    Hi, I have the following problem, when i try to deserialize, it trows an exception of RTTI, at this line LType := FContext.FindType(AName); on method GetClassByQualifiedName, I use packages loaded in run time, could you help me?!, ps: I tried to serialize an object, and it have only strings and integers on it.

  7. alex says:

    @Cleber
    Is the class “internal”? GetClassByQualifiedName will fail if the identified class is not public (in interface section).

  8. I need to to thank you for this very good read!! I certainly enjoyed every little
    bit of it. I have got you bookmarked to look at
    new things you post…

  9. wonderful issues altogether, you simply won a emblem new reader.

    What would you recommend about your submit that you just made a few days
    in the past? Any certain?

  10. I’ve been surfing online more than 2 hours today, yet I never found any interesting article like yours.
    It’s pretty worth enough for me. In my opinion, if all site owners and bloggers made
    good content as you did, the net will be a lot more useful than ever before.

  11. Hello, yes this article is really nice and I have
    learned lot of things from it about blogging.
    thanks.

  12. This page definitely has all of the info I wanted about this subject and didn’t know who to
    ask.

  13. quick money says:

    I’ve been browsing online more than three hours today,
    yet I never found any interesting article
    like yours. It’s pretty worth enough for me. In my
    opinion, if all site owners and bloggers made
    good content as you did, the internet will be a lot more useful than ever before.

  14. Right here is the perfect web site for anybody who really wants to
    understand this topic. You realize a whole lot its almost tough
    to argue with you (not that I really will need to…HaHa).
    You certainly put a new spin on a subject that’s been discussed
    for decades. Great stuff, just wonderful!

  15. I have learn a few just right stuff here. Certainly worth bookmarking for revisiting.

    I wonder how so much effort you place to make this sort of
    great informative web site.

  16. Hi mates, its impressive post about educationand completely explained, keep it
    up all the time.

  17. A motivating discussion is definitely worth
    comment. There’s no doubt that that you need to publish more about
    this topic, it may not be a taboo matter but generally
    people don’t discuss such topics. To the next!
    Kind regards!!

  18. I read this paragraph fully on the topic of the comparison of newest and earlier technologies, it’s remarkable article.

  19. It’s hard to come by knowledgeable people on this subject, but you sound like
    you know what you’re talking about! Thanks

  20. Thanks for finally writing about >Here you go – DeHL 0.8 | YAPB <Loved it!

  21. Thanks in support of sharing such a good opinion, paragraph
    is good, thats why i have read it entirely

  22. Hi everyone, it’s my first pay a visit at
    this website, and piece of writing is truly fruitful designed for me, keep up
    posting these types of articles.

  23. I think that is one of the such a lot significant information for me.

    And i am glad reading your article. But want to remark
    on few general issues, The site style is ideal, the articles is in point of fact excellent :
    D. Good process, cheers

  24. Hey! This is kind of off topic but I need some advice from an established blog.
    Is it very hard to set up your own blog? I’m not very techincal but I can figure things out pretty quick.
    I’m thinking about setting up my own but I’m not sure where
    to start. Do you have any ideas or suggestions?
    Cheers

  25. I used to be suggested this website via my cousin.
    I’m not sure whether this submit is written by means of him as no one else recognize such designated about
    my problem. You’re incredible! Thanks!

  26. Just wish to say your article is as astonishing. The clearness in your post is just excellent and
    i can assume you are an expert on this subject. Well with your permission let me to grab your feed to keep up to date with forthcoming post.
    Thanks a million and please carry on the enjoyable work.

  27. Please let me know if you’re looking for a article author for your site.
    You have some really great posts and I think I would be a good asset.

    If you ever want to take some of the load off, I’d really
    like to write some content for your blog in exchange for a link back to mine.
    Please shoot me an e-mail if interested. Cheers!

  28. I am in fact happy to glance at this blog posts which includes
    tons of useful facts, thanks for providing such information.

  29. What i don’t understood is in truth how
    you’re now not actually a lot more smartly-appreciated than you may be now.
    You are so intelligent. You realize therefore significantly in the case of this topic,
    made me personally believe it from numerous various angles.
    Its like men and women don’t seem to be fascinated unless it’s something to do
    with Woman gaga! Your own stuffs nice. At all times maintain it up!

  30. I write a comment whenever I appreciate a post on a site or
    if I have something to add to the discussion. It’s a result of the fire communicated in the article I looked
    at. And on this article Here you go – DeHL 0.8 | YAPB. I was
    moved enough to drop a thought :) I actually do have a
    couple of questions for you if you do not mind.
    Could it be only me or does it look like like some of these comments come across like they are coming
    from brain dead people? :-P And, if you are posting at additional
    online social sites, I would like to follow anything new you have to post.
    Would you list all of your social pages like your twitter feed, Facebook page
    or linkedin profile?

  31. Aw, this was a very good post. Spending some time and actual
    effort to make a good article… but what can I say… I hesitate a whole lot and don’t manage
    to get nearly anything done.

  32. This is my first time go to see at here and i am really happy to read everthing
    at alone place.

  33. When I originally left a comment I seem to have clicked the
    -Notify me when new comments are added- checkbox and from now on each time
    a comment is added I receive 4 emails with the same comment.
    There has to be an easy method you are able to remove me from that service?
    Thanks!

  34. Hello! Do you use Twitter? I’d like to follow you if that would be
    ok. I’m absolutely enjoying your blog and look forward to new updates.

  35. Greetings from Colorado! I’m bored to tears at work so I
    decided to browse your website on my iphone during lunch break.
    I love the knowledge you provide here and can’t wait to take a
    look when I get home. I’m surprised at how quick your blog loaded on my
    phone .. I’m not even using WIFI, just 3G .. Anyhow, good site!

  36. Incredible quest there. What occurred after? Good
    luck!

  37. Hi, its nice article concerning media print, we all know media is a
    impressive source of information.

  38. Hi would you mind letting me know which hosting company you’re using?
    I’ve loaded your blog in 3 completely different browsers and I must
    say this blog loads a lot faster then most. Can you suggest a good web hosting provider at a honest price?

    Thank you, I appreciate it!

  39. First of all I would like to say awesome blog! I had a quick question in which I’d like to ask if you do not
    mind. I was interested to find out how you center
    yourself and clear your head prior to writing. I’ve
    had trouble clearing my mind in getting my ideas out there.

    I do take pleasure in writing but it just seems like the first 10 to 15 minutes are generally wasted simply just trying to
    figure out how to begin. Any recommendations or tips? Cheers!

  40. Magnificent beat ! I would like to apprentice while you amend your website, how could i subscribe for
    a blog website? The account helped me a acceptable deal.
    I had been a little bit acquainted of this your broadcast provided bright clear idea

  41. Valuable information. Fortunate me I found your site accidentally, and I’m stunned why
    this twist of fate didn’t took place earlier!
    I bookmarked it.

  42. Link exchange is nothing else but it is simply placing the other person’s blog link
    on your page at suitable place and other person will also do similar
    for you.

  43. Hey there, You have done an incredible job. I’ll definitely
    digg it and personally suggest to my friends. I’m confident
    they will be benefited from this website.

  44. I do consider all of the ideas you’ve offered for your
    post. They’re very convincing and can definitely work.

    Still, the posts are too short for beginners.
    May just you please lengthen them a little from next time?
    Thank you for the post.

  45. yahoo says:

    fantastic submit, very informative. I wonder why the other specialists of this sector don’t realize this.
    You should continue your writing. I’m sure, you’ve a huge readers’ base already!

  46. Shantae says:

    January has enormous potential to bring cool and constant snow and ice-not witnessed since the late 1970’s.
    You have to sign a deal with the service company for four weeks, for experiencing this service.

  47. Brian says:

    Semnul de întrebare este excelent pentru a găsi spllellings opțiuni pentru
    cuvinte . E ca mersul pe bicicletă ; sa nu
    uiti niciodata cum sa o faca . Nu sunt nici pro speciale trucuri SEO trebuie să nu faci
    .

  48. Hi! Do you know if they make any plugins to protect against hackers?
    I’m kinda paranoid about losing everything I’ve worked hard on. Any recommendations?

  49. Appreciating the time and energy you put into your website and in depth information you
    present. It’s good to come across a blog every once in a while
    that isn’t the same out of date rehashed information. Excellent read!
    I’ve bookmarked your site and I’m including your RSS feeds to my Google account.

  50. 2- An increase in one’s body. This specific unique weight reduction supplementation is made from all-natural
    herbs. Red hot peppers or capsicum have been known to facilitate weight loss
    for some time time.

1 2

Leave a Reply

Your email address will not be published.