Jump to content

Berocoder

Members
  • Content Count

    79
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Berocoder

  1. Berocoder

    Use case or if else ?

    I would prefer alternative 2. But you are right that it is error prone on change as it is harder to read. And as David said using enum would be best choice. Currently alternative 1 is used so I think I leave it as is for now 🙂
  2. Berocoder

    Formatting method

    Or Ctrl + Alt + y with MMX formatter installed. It is a bit easier for fingers 😊
  3. Berocoder

    FastMM5. Can't get a log file

    Ok go to FastMM5.pas line 144 {.$Include FastMM5.inc} // Enable to turn on log leaks to file Remove dot and it works 😀
  4. Berocoder

    FastMM5. Can't get a log file

    Thanks for the hint. I had the exact same problem
  5. Berocoder

    FastMM5. Can't get a log file

    Thanks for the hint. I had the exact same problem
  6. Berocoder

    TestInsight usage

    I am a bit confused of TestInsight. I am using version 1.2.0.1 with Delphi 11.2. I have marked my testproject Discover tests find 34 I mark 2 tests and run selected with Shift+Alt+F9 Now the strange case. I mark 2 new tests in skipped and run again with Shift+Alt+F9. The 2 already successful seems to run. Duration change. But not the new tests. I expect to see 4 success and 30 skipped now Now I uncheck the 2 tests at top and leave only 2 selected tests and run with Shift+Alt+F9. It seems to be ignored and none tests was executed. Did I do anything wrong or have I found a bug ? /Roland
  7. Hi, I am using latest delphi with all patches. Delphi 11 Version 28.0.46141.0937 When I debug my application by singlestep code with F7 or F8 sooner or later I cannot continue. IDE is still responsive but programcounter hang and singlestep code have no effect. I have seen this problem before also with previous 10.4. Anyone with similar experience ? What can I do as workaround except to restart my application and try again. It seems to be completely random...
  8. Berocoder

    SingleStep with F7/F8 hang IDE

    32-bit target big VCL desktop application for Windows.
  9. Berocoder

    SingleStep with F7/F8 hang IDE

    Ok, I have a Scroll lock key on my keyboard. I can try that next time it happens. I hope there is a bugreport on this on https://quality.embarcadero.com
  10. Berocoder

    SingleStep with F7/F8 hang IDE

    Ok, but I don't understand what you mean. My F-keys works find outside Delphi in this case. What is a "Lock" key ?
  11. 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;
  12. 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
  13. 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.
  14. 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 ?
  15. 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 😊
  16. https://ihateregex.io/ Is good regex resource
  17. 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
  18. 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!
  19. 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
  20. Berocoder

    Connect to Google Cloud?

    I refer to builtin https://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_an_HTTP_Client Regards Roland
  21. 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
  22. 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.
  23. Berocoder

    Connect to Google Cloud?

    Thanks I also found that. I am not found of deploy a dll-file beside the exe- file
  24. Berocoder

    Conflict with TestInsight

    I think I found some kind of conflict between TestInsight and MMX Explorer. I have installed Delphi 11 in a VmWare WorkStation VM. Installed TestInsight from https://files.spring4d.com/TestInsight/1.2.0.1/TestInsightSetup.zip Run installer and verified it works fine on a test-project Next install MMX Explorer from https://www.mmx-delphi.de/download/338/ Now I run TestInsight on the testproject and it looks like this So it just show an empty window. No result from the tests. I have the same problem in Delphi 10.4.2. I like both plugins and want them to cooperate better. Anyone with similar experience ? Regards Roland Bengtsson
×