Jump to content

Berocoder

Members
  • Content Count

    45
  • Joined

  • Last visited

Community Reputation

9 Neutral

About Berocoder

  • Birthday 05/16/1965

Technical Information

  • Delphi-Version
    Delphi 10.4 Sydney

Recent Profile Visitors

966 profile views
  1. It is correct. Deleted is not the same as destroyed. A BoldObject is usually persisted in a database. Summary of lifecycle of such object: Some code ask for the object. It is loaded from database to memory. A new instance in memory is created. It can now be used as any normal object. Some code call Delete method. The flag above BoldObjectIsDeleted is now true Some code Synchronize memory with database. Objects that are changed will update rows in database. Objects that are deleted in memory will also be deleted in database. The object will now be destroyed
  2. Yes, BoldObjectIsDeleted is true when object is deleted in memory but remain in database. On next sync memory to database it will be removed from database as well. But how that works is unrelated to question in this case.
  3. This is the code for Supports method. I know the name is bad, SysUtils.Supports is different. But we use this on thousands of places. Too late to change now. Now I also use Pascal Analyzer. That give a warning STW10 Out parameter is read before set (STW10) This section lists out parameters that are read before set in the procedure. https://www.peganza.com/PALHelp/clip0211.png And yes it is correct. First line TObject(ResObj) := nil; Read the out parameter before set it. ResObj have no class in parameter. Reason is that we want to send any subclass derived from TBoldObject. If I set type to TObject that would not work any more. Any suggestion how I can remove the warning and still preserve the implementation ? {: Casting between two objects derived from two different classes Resobj must inherit from aObject @param aObject The object to cast from @param aClass The class to cast to @ResObj The resulting object @return True if successful otherwise false} function Supports(const aObject: TObject; const aClass: TClass; out ResObj): Boolean; overload; begin TObject(ResObj) := nil; if aObject is aClass then begin if not ((aObject is TBoldObject) and (aObject as TBoldObject).BoldObjectIsDeleted) then TObject(ResObj) := aObject; end; result := TObject(ResObj) <> nil; end; Example of usage var myInvoice: TInvoice; // This inherit TBoldObject if Supports(myclass.somelink, TInvoice, myInvoice) begin // code that use myInvoice end;
  4. Berocoder

    Show Cyclic Dependencies

    I try to use Unit Dependency Analyzer. The target is to cut compile time by find cyclic dependencies in a big project where Unit A use Unit B. And Unit B use Unit A. I have attached a screenshot. How do I read that ? I see for example that AttracsCustomsSpanFetch uses AttracsSystemsGlobals in Implementation section. I see nothing wrong with that. But AttracsSystemsGlobals use BusinessClasses in interface section. And BusinessClasses uses AttracsSystemsGlobals in implementation section. I marked it with red and green. So that is a cyclic dependency, right ? But the dialog show nothing that differ the two cases above. Or did I miss something ?
  5. Berocoder

    New Delphi job opportunity

    Internally we didn't agree on that sentence. Anyway a new guy start next week and another one in August. Many complain that there is no jobs for Delphi. At the same time some employers leave Delphi as it is hard to find developers. It don't make sense for me 😊
  6. https://ihateregex.io/ Is good regex resource
  7. New job opportunity if you are experienced. Prefered location is Kokkola Finland but remote work is accepted. https://attracs.teamtailor.com/jobs/1660578-delphi-developer/45cf12cb-1f96-4e93-94c1-8b96c6a45ade
  8. Berocoder

    Send attachment to Slack

    How can I add a large text-file as an attachment to a Slackpost? A working example would be great. I use SDriver https://github.com/andrea-magni/SDriver and the included demo works fine to send some strings. What I did so far https://gist.github.com/bero/e675bdf38c6e884be7e08377d6d52009
  9. Berocoder

    Connect to Google Cloud?

    Ok thanks for the feedback. So back to the original question 😊 What is the best or most convenient path to connect and use Google Cloud logging from Delphi? I want to avoid dependencies to third-party components and dll-files if it is possible. But it is not a requirement. Roland
  10. Berocoder

    Connect to Google Cloud?

    I refer to builtin https://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_an_HTTP_Client Regards Roland
  11. Berocoder

    Connect to Google Cloud?

    Ok I have never used https in Delphi. Just so I understand you correct. Delphi httpclient use openssl? No need to deploy additional dll with exe-file? Where can I find an example of this? The application is deployed on Windows Server 2012 Regards Roland
  12. Berocoder

    Connect to Google Cloud?

    I am not sure how complicated it would be to use https://docwiki.embarcadero.com/Libraries/Sydney/en/System.Net.HttpClient instead. Grijjy use a dll for SSL. HttpClient use what is available in OS.
  13. Berocoder

    Connect to Google Cloud?

    Thanks I also found that. I am not found of deploy a dll-file beside the exe- file
  14. I want to use Google Cloud logging from Delphi. From https://cloud.google.com/apis/docs/client-libraries-explained While you can use Google Cloud APIs by making direct HTTP requests to the server (or RPC calls where available), we provide client library code for all our Cloud APIs that makes it easier to access them from your favorite languages Of course Delphi is not represented. Any hints on how I can use cloud for logging? It also mention that https://www.fluentd.org can be used from any language. But I still want samples how to use all this in practice. Any help appreciated!
×