Jump to content

chkaufmann

Members
  • Content Count

    158
  • Joined

  • Last visited

Everything posted by chkaufmann

  1. Since some years there is the unit IOUtils.pas. There are many duplicated functions: ExtractFileExt() - TPath.GetExtension() ExtractFileName() - TPath.GetFileName() FileAge() - TFile.GetLastWriteTime() My code uses SysUtils.pas in most places, and I'm not sure if I should change this to use the functions from the new unit IOUtils.pas because the others will be deprecated at some point? And is there a comparisation table anywhere? It looks like not all functions work exactly the same way especially when it comes to throw exceptions. Christian
  2. chkaufmann

    Delphi 12.2 Patch 1

    I can't find this one anymore in the portal. Does it mean, it was fixed?
  3. chkaufmann

    Use TIdHTTPServer.Contexts for monitoring

    I try to use my own subclass for TIdServerContext to monitor the requests to my server. Now I sent a simple GET request with Postman to my server and noticed, that two context objects were created, but the OnCommandGet event is only called once. What is the reason for that? Then I plan to iterate all current requests like this: tmpList := IdHTTPServer1.Contexts.LockList; for i := 0 to tmpList.Count -1 do begin tmp := TMyContext(tmpList[i]); // read some info from tmp end; IdHTTPServer1.Contexts.UnLockList; Can I be sure, that all items will be alive. Or is it possible, that one of the context items was freed before I could read info from it? Christian
  4. chkaufmann

    Use TIdHTTPServer.Contexts for monitoring

    You mean get that exception? Maybe it's only when run the code with break points in the debugger. Anyway, it works fine now and get the details for my monitor functionality.
  5. chkaufmann

    Use TIdHTTPServer.Contexts for monitoring

    Thanks for the details. It seems, there are two connections when I send a GET request with postman. But in the first one I end method TIdIOHandler.RaiseConnClosedGracefully. When I test with the Chrome browser, there is only one context / connection. Christian
  6. I have a question regarding memory usage for strings. When I load a big number of persons, there are many hundred with the same name. Is this handled automatically so that there will be only one copy of the string for a certain name or should I write my own code for this? Or does it depend how the strings are loaded and to what kind of variable these are assigned? I didn't find a good source to read about this topic. Any hints for that? Thanks Christian
  7. chkaufmann

    What are the performance profilers for Delphi 12?

    Just a question regarding Nexus Quality Suite: I looked at it some years ago and I noticed, if you have a big project, the performance for Line Timer / Method Timer was not very good when configuring which methods to trace and which not. Was there an improvement in this regard? And by the way: AQTime was a perfect profiler, I really miss it. Then it was aquired by SmartBear and since then it's terrible because the only improvement of the product they made was adding more and more annoying registration code. Christian
  8. chkaufmann

    SFTP Support

    Unfortunately Indy TIdFTP Client does not support SFTP. The discussions about this I found are already some years old. Is there a chance this will be added? And if not, what is a good alternative? I need something that can be fully integrated in my application so that it works for users who can just enter a servername, username and password. Christian
  9. chkaufmann

    Avoid parameter evaluation

    Clipper and I think Smalltalk had anonymous methods as well. And this at the time when Java was not even born. Christian
  10. I have a class TProvider where I create 1-n instances in my application. Now I need a threadvar for each instance. The number of instances will never be more than up to 50 objects. What is a good pattern to create a temporary data block per thread/object? Regards Christian
  11. chkaufmann

    Threadvar "per object"

    The TBSItemProvider objects are used by any thread. And what David writes will work. I was thinking of something like this as well. The question for me is, how to do the cleanup: Either I have to call a function at the end of each thread or is there a global place to do this? Christian
  12. chkaufmann

    Threadvar "per object"

    This is my use case. TBSItemProvider = class(TBSManagedInterface) strict private FNotificationCache : Integer; FNotificationCaches : IBSList<TNotifyCacheItem>; public procedure DisableNotifications; procedure EnableNotifications; end; My application has 1-n objects of type TBSItemProvider. Basically this is used to handle the records of one database table. Normally the provider distributes messages/notifications after each insert/update/delete operation of one item. When a thread changes many items, I call DisableNotifications and in this case, notifications are cached in FNotificationCaches. So this is the reason these two private variables should be "per thread". Christian
  13. chkaufmann

    Sports and Swimming Software

    I would be interested to know if anyone in these forums also deals with software for swimming and sports written in Delphi. Christian
  14. chkaufmann

    Profiler for Delphi

    Thanks for your instructions. I did like this, but when I call map2pdb I get a long list of errors. For example I get many lines like "Debug: Module has no source files: xxxxxxx" where xxxxxxx is the name of a unit, that is part of the project. Then the only thing I can start in VTune is "Hotspots". This runs fine and at the end I get a summary report. But this is not really helpfull since the "Top Hotspots" are Windows calls only. Using the Caller/Callee I can find my units, but when I open I don't see a lot: Percentage is there, CPU Time is zero most of the times and I don't see the number of calls. I used AQTime before, but support and I have no working version anymore. They had a call tree and a graphic where you could easily navigate down all routines. Maybe I just didn't find the correct view in VTune yet. My questions - Should I care about these errors when creating the pdb file? How to understand the error and how to solve it? - Where can I find a good tutorial for VTune in order to get the info I used before with AQTime? Thanks for any help Christian
  15. I'm using Superobjects to handle JSON data. Now I have to handle a result, where there are identifiers with dots: { "splash.annually": "normal" } This library cannot handle this data because it looks at "splash.annually" as path. Can somebody recommend me another library? What I like with Superobjects: It is fast and it offers reference counted object handling using interfaces. Regards Christian
  16. chkaufmann

    Verify certificate with TIdHTTP

    I use TIdHTTP to make REST requests to my server. In order to avoid that somebody can analyze the traffic between my application and the server I would like to verify the certificate. Right now my code looks like this: sslIO := TIdSSLIOHandlerSocketOpenSSL.Create(Self); sslIO.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2]; sslIO.SSLOptions.Mode := sslmUnassigned; sslIO.SSLOptions.VerifyMode := []; sslIO.SSLOptions.VerifyDepth := 0; FHttp.IOHandler := sslIO; I found some examples and tried to add an OnVerifyPeer event. But this event is never called. Are there any more options I have to set? Can somebody point me to a working example? Thanks Regards Christian
  17. chkaufmann

    Verify certificate with TIdHTTP

    Yes. But I just set a break point in DoVerifyPeer without event assigned to OnVerifyPeer. Now I added an event and it works. What I don't understand, how I can verify that it is really the original certificate from my server. The Url is https://www.swimrankings.net/. The event is called two times. Both times AOk=False, once AError is 20, the second time it is 21. When I set AOk to true, the request works, if I do nothing in the event, the request doesn't work at all. With my limited knowledge about encryption I'm a bit lost here. Christian
  18. chkaufmann

    Access violation in library code

    I have an error in my application. It happens from time to time on my server, but I cannot reproduce it. The call stack from madExcept looks like this: exception number : 1 exception class : EAccessViolation exception message : Access violation at address 0040BB2E in module 'Logo12RestAPI.exe'. Read of address FFFFFFF9. thread $1b78 (TIdThreadWithTask): 0040bb2e Logo12RestAPI.exe System 22 @UStrAsg 022e67aa Logo12RestAPI.exe geoRefBOImp 60 {System.Generics.Collections}TDictionary<System.string,mainBO.IBasispunkt>.DoAdd 022e7303 Logo12RestAPI.exe geoRefBOImp 60 {System.Generics.Collections}TDictionary<System.string,mainBO.IBasispunkt>.AddOrSetValue 022e5e1f Logo12RestAPI.exe geoRefBOImp 1580 {BSCollectionsImp}TBSDictionary<System.string,mainBO.IBasispunkt>.SetElements 022d5fa5 Logo12RestAPI.exe geoRefBOImp 1586 TLocation.GetBasispunkt 022d7cff Logo12RestAPI.exe geoRefBOImp 1890 TLocation.Ukm 00411300 Logo12RestAPI.exe System 22 @IntfClear 00411321 Logo12RestAPI.exe System 22 @IntfCopy 00411300 Logo12RestAPI.exe System 22 @IntfClear 02847e35 Logo12RestAPI.exe restAPIServer 1306 TRestAPIGetEntities.Basispunkte Can anybody give me a hint, where the problem could be located? I work with Delphi 11, Version 28.0.44500.8973. Christian
  19. chkaufmann

    Access violation in library code

    No, there is no such check in SetElements. In this case here, these are persistent objects. But I added a TMonitor.Enter / Leave arround the access of TBSDictionary/TDictionary since the code runs in an application with multiple threads and it may happen, that two threads run the method GetBasispunkt for the same object at the same time. Since the error is not reproducable, this may solve the problem.
  20. chkaufmann

    FTP - Problems sind update to Alexandria

    I use the Indy FTP client in my application. Since the update of the compiler to Alexandria 11, Update 1, one of my client gets the following error when the Put() command is called: Opening BINARY mode data connection. I have no idea, how I can fix that because I cannot reproduce it on FTP servers I work with. The strange thing is, it worked fine as long as I compiled my application with Delphi Seattle. Any hints? Christian
  21. chkaufmann

    Problems with Delphi class structure / visibility

    private and protected are "friends" for classes within the same unit. If you don't want that, use "strict private" and "strict protected". For your second problem, you should provide an example. It is not clear to me what doesn't work. And by the way: When you write questions like this in a forum where most of the answers come from volunteers, you probably end up on the ignore list of many of them. Regards Christian
  22. I define a BackgroundWorker like this: FUIWorker := Parallel.BackgroundWorker; FUIWorker .Execute( procedure(const AWorkItem: IOmniWorkItem) var p : TPrepareAusfuehrungen; r : TPrepareResult; begin p := TPrepareAusfuehrungen.Create(AWorkItem.Data.ToRecord<TPrepareSettings>); try r := p.Execute(AWorkItem.CancellationToken); if not AWorkItem.CancellationToken.IsSignalled then AWorkItem.Result := TOmniValue.FromRecord<TPrepareResult>(r); finally p.Free; end; end) .OnRequestDone( procedure(const ASender: IOmniBackgroundWorker; const AWorkItem: IOmniWorkItem) var r : TPrepareResult; begin r := AWorkItem.Data.ToRecord<TPrepareResult>; ...... end); This fails in OnRequestDone with an AV. When I change it so that the result value is just an IInterface it works. So my question is, how can I make it work with a "record" result? Or should I always create an interfaced object for this? Christian
  23. chkaufmann

    Record as result for BackgroundWorker

    oops, that's embarrassing, thanks! Christian
  24. chkaufmann

    Raw Request Logging for TIdHTTPServer

    Hi, I have to log each POST request to my TIdHTTPServer to a file. When I look at TIdHttpRequestInfo I don't find a property with the full data sent to my server. Do I have to combine RawHeaders and PostStream in order to get the full request? Is there something else, where data is written to? Is there a method I didn't see in order to get all this information in one block? Regards Christian
  25. chkaufmann

    Close application during form create??

    I use ExitProcess(AExitCode). Christian
×