Jump to content

chkaufmann

Members
  • Content Count

    145
  • Joined

  • Last visited

Everything posted by chkaufmann

  1. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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.
  8. 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
  9. 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
  10. 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
  11. chkaufmann

    Record as result for BackgroundWorker

    oops, that's embarrassing, thanks! Christian
  12. 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
  13. chkaufmann

    Close application during form create??

    I use ExitProcess(AExitCode). Christian
  14. In my interface I have the following property: IBSEntityProvider = interface function GetItems(AItemId: Integer): IBSEntity; property Items[AItemId: Integer]: IBSEntity read GetItems; default; end; Now I need to know, where this is used in my application. For a method I can use grep or, if the method has a common name, I put a "deprecated" in the method declaration and use the list of warnings. In this case here, it doesn't work. But maybe somebody has another trick for this problem. Christian
  15. chkaufmann

    Find usage of indexed default property

    Thanks, good idea. I forgot that one.
  16. chkaufmann

    Find usage of indexed default property

    This is a solution, but I have too many places where I use the property. So this is not an option in this case.
  17. chkaufmann

    View program flow and calls to help understand code?

    You may add debug messages in your code (see OutputDebugString). Personally I wrote a wrapper arround this method and with each call I add an id. At the start of my application I set a list of ids and then only messages with these ids are sent to the event log: procedure TBSDebug.Message(const AMessage: String; ALogId: Integer); begin if FLogIds.Contains(ALogId) then OutputDebugString(PChar(AMessage)); end; Christian
  18. In my application I get this error: exception class : EAccessViolation exception message : Access violation at address 035CD729 in module 'Logo12.exe'. Read of address 00000000. thread $343c: 035cd729 +0d Logo12.exe Vcl.Edge 1679 +1 TCustomEdgeBrowser.ProcessHResult 035cc712 +52 Logo12.exe Vcl.Edge 1028 +2 TCustomEdgeBrowser.CreateCoreWebView2ControllerCompleted 035d03e9 +11 Logo12.exe Vcl.Edge 828 +1 {Vcl.Edge}Callback`2.CreateAs[3]$ActRec<System.HRESULT,Winapi.WebView2.ICoreWebView2Controller,Winapi.WebView2.ICoreWebView2CreateCoreWebView2ControllerCompletedHandler>.$0$Body 75725c2b +0b user32.dll DispatchMessageW 006cb497 +f3 Logo12.exe Vcl.Forms 11336 +23 TApplication.ProcessMessage 006cb4da +0a Logo12.exe Vcl.Forms 11366 +1 TApplication.HandleMessage 006cb819 +d1 Logo12.exe Vcl.Forms 11505 +27 TApplication.Run Depending on the displayed data I create controls dynamically and for me this looks like my TEdgeBrowser control gets a message after it was already destroyed. How can I ensure this doesn't happen? I tried to call Stop and the CloseBrowserProcess methods, but both don't work. Christian
  19. chkaufmann

    TEdgeBrowser - Problem on destroy

    I could isolate the problem a bit more. Basically it happens when I try to destroy the TEdgeBrowser component during the time when the ICoreWebView2 object is in creation process. This runs async and the message when the setup has finished comes to late. Now my quick and dirty solution before I destroy my TEdgebrowser is this: while (Browser.BrowserControlState = TCustomEdgeBrowser.TBrowserControlState.Creating) do Application.ProcessMessages; Browser.Free; It works, but I don't like it since there are a lot of things that may happen in ProcessMessages. I cannot post the whole code since this is an interaction between two components in an application at very different places. I try to describe it. - I have two TVirtualTree controls, one to navigate the objects, the other to edit attributes. - When the inplace editor for an URL is closed, I call Browser.Navigate with the new URL - When the user changes to a different object (click in the tree for navigation), the Browser will be destroy because this object may not need a browser. - Now the click in the object tree triggers an EndEdit in the edit tree (causes Browser.Navigate) in a moment when the object change process didn't start yet I was thinking of creating a delayed Navigate method in the Browser using a special message so I post that message in the queue. So the Navigate will not happen before the object change click message has finished. Regards Christian
  20. chkaufmann

    FTP - Problems sind update to Alexandria

    I recompiled the application with Sydney and now I get the same error with the customers server. Here is the full log: Stat Connected. Recv 21.11.2022 20:49:55: 220 Microsoft FTP Service<EOL> Sent 21.11.2022 20:49:55: HOST 1.1.1.1<EOL> Recv 21.11.2022 20:49:55: 504 Server cannot accept argument.<EOL> Sent 21.11.2022 20:49:55: USER testftp<EOL> Recv 21.11.2022 20:49:56: 331 Password required<EOL> Sent 21.11.2022 20:49:56: PASS ********<EOL> Recv 21.11.2022 20:49:56: 230 User logged in.<EOL> Sent 21.11.2022 20:49:56: FEAT<EOL> Recv 21.11.2022 20:49:56: 211-Extended features supported:<EOL> LANG EN*<EOL> UTF8<EOL> AUTH TLS;TLS-C;SSL;TLS-P;<EOL> PBSZ<EOL> PROT C;P;<EOL> CCC<EOL> HOST<EOL> SIZE<EOL> MDTM<EOL> REST STREAM<EOL>211 END<EOL> Sent 21.11.2022 20:49:56: OPTS UTF8 ON<EOL> Recv 21.11.2022 20:49:56: 200 OPTS UTF8 command successful - UTF8 encoding now ON.<EOL> Sent 21.11.2022 20:49:56: TYPE I<EOL> Recv 21.11.2022 20:49:56: 200 Type set to I.<EOL> Sent 21.11.2022 20:49:56: SYST<EOL> Recv 21.11.2022 20:49:56: 215 Windows_NT<EOL> Sent 21.11.2022 20:49:56: TYPE I<EOL> Recv 21.11.2022 20:49:56: 200 Type set to I.<EOL> Sent 21.11.2022 20:49:56: CWD /testsplash<EOL> Recv 21.11.2022 20:49:56: 250 CWD command successful.<EOL> Sent 21.11.2022 20:49:56: PASV<EOL> Recv 21.11.2022 20:49:56: 227 Entering Passive Mode (10,0,19,1,240,228).<EOL> Sent 21.11.2022 20:49:56: STOR MM_LiveResultFtpTest.txt<EOL> Recv 21.11.2022 20:50:17: 150 Opening BINARY mode data connection.<EOL> Stat Disconnected. In InternalPut it runs fine until the call LPasvCl.Connect; Then there is a timeout and the upload fails. When I use Filezilla I get the same message, but for some reason the upload works in a second try: Command: STOR meet_live_ftp_Fail_Sydney.log Response: 150 Opening BINARY mode data connection. Error: Connection timed out after 20 seconds of inactivity Error: File transfer failed Status: Connecting to 91.217.122.30:21... Status: Connection established, waiting for welcome message... Status: Plain FTP is insecure. Please switch to FTP over TLS. Status: Logged in Status: Retrieving directory listing of "/testsplash"... Status: Directory listing of "/testsplash" successful Now it's always difficult to explain to a customer, that this is a server side problem. So I would like to have a solution, that could handle this kind of problems like Filezilla. Regards Christian
  21. chkaufmann

    FTP - Problems sind update to Alexandria

    They use plain FTP. And about logging, maybe a stupid question: Do I have to build this on my own? I can find the TIdLogBase / TIdLogFile classes, but I don't find examples where I can activate logging for FTP. Christian
  22. Hi, for my REST Api I create a key with timestamp in the client application. On the server I check if the key is valid and if it's not expired. The problem here seems to be, that some client computers, who send valid requests, don't have the clock correctly set and I have differences of several minutes in the timestamps. Should I allow a bigger differences for expiration times? Right now I test with 30 seconds. Or is there another trick to solve this problem? Regards Christian
  23. chkaufmann

    REST Api Key - Expiration

    I was thinking of something like that. Get the server timestamp and then keep the difference in the application. But why could it be dangerous to send the server timestamp in an API Request? Christian
  24. I run a Rest API and I need to monitor the number of requests per user in different intervals (5sec, 1min, 1hour, 1day). Before I try to build my own structure, is there a common way to do this? Since there may be several 100 users online at the same time, using a log table and an SQL database is not an option (too slow). And keeping a list of all requests of the last 24 hours in memory isn't either because there are some users with several 10'000 requests per day. Regards Christian
  25. Yes, for logging this is not a problem. But if I want to add limits to number of requests I have to check all four values. This means four SQL select on the log table for each request and this is not cheap anymore because most of the REST responses I build with data from objects already kept in memory. Therefore I need an in memory data structure with this info for each user.
×