Jump to content

chkaufmann

Members
  • Content Count

    158
  • Joined

  • Last visited

Everything posted by chkaufmann

  1. 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
  2. chkaufmann

    Find usage of indexed default property

    Thanks, good idea. I forgot that one.
  3. 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.
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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.
  13. chkaufmann

    32bit vs 64bit

    We are in the discussion if we should switch our application from 32bit to 64bit. Basically it seems to work fine under 64bit, however I'm not sure, if there may be some problems regarding resource usage. Our main customer runs the application on an RDP Terminal Server. So my concern is, if this is relevant because a 64bit application always uses more RAM compared to the 32bit version. Christian
  14. A TObject has an InstanceSize of 8 bytes. I searched the internet to understand why. 4 bytes would make sence (pointer to the classtype or whatever). All I find are old postings about this change back in 2009, but is this still valid for the current version? And if the second pointer is available for object locking, can somebody point me to an explanation for this. To be honest, I did not really understand how this works. Currently I use a "Spring.Lock" in all my objects for thread synchronization, but maybe this is not necessary and I could use the built in lock feature of TObject? Christian
  15. chkaufmann

    New TForm - Defaults

    When I create a new form (File - New - VCL Form) font and size is always like this: Font.Height = -11 Font.Name = 'Tahoma' but I would like to have it like this: Font.Height = -12 Font.Name = 'Segoe UI' Is there a simple way to achieve this? I remember, that I saw a sample with an IDE expert for this, but is there no way to set this default in the IDE or "per project"? Christian
  16. chkaufmann

    32bit vs 64bit

    I have no memory issues anymore since I solved these with other changes in the code. Maybe I'm too old, but personally I think, because there is need to change I would stay with 32bit. But others in our team think we should change to 64bit because this is the technology of today. Therefore I try to collect objective arguments (pros and cons). Christian
  17. And what about using a TLightweightMREW for each of my objects compared to TMonitor and Spring.Lock? I probably need this to have a reentrant version of the lock: https://www.thedelphigeek.com/2021/02/readers-writ-47358-48721-45511-46172.html Christian
  18. When I read https://www.delphitools.info/2013/06/06/tmonitor-vs-trtlcriticalsection/, then I should not use TMonitor. Is this still the case? Is there another simpler solution to lock an object in order to avoid that multiple threads change an internal value. Locktime will be very short and conflicts probably happen very rarely.
  19. I have to solve some "out of memory" problems during an import in my application. My application is still 32bit and when I check the memory in the process explorer, it's not 100% clear for me, which values are critical. Here are my questions: - What is an easy way to see the number of objects of each class during debugging? Do I have to build something on my own? Can I get this info for records as well? - Is it worth to switch the application to 64bit? - For 32bit, which values in the Process Explorer are critical and what are the maximum values during runtime that will be save? Thanks for any hints and tips here. Christian
  20. chkaufmann

    Memory Management with many objects

    Thanks, this works. But for objects only. Is there a general way to count the number of a "record" instance as well? Christian
  21. Hi, I use FastMM5 in a unit for logging, however I don't want this unit/code to be compiled into my IDE package. Is there a predefined constant for an IFDEF to see if my unit is compiled in an application or into a package? Or do I have to create my own constant for this? Christian
  22. chkaufmann

    Memory Management with many objects

    I wanted to try your code, but I just realized that madCodeHook unit is not part of madExcept. So is there another way or code sample to hook these functions globaly? Christian
  23. chkaufmann

    Conditional Define for Packages

    This is not what I need. I need a constant so I can exclude code (and put some dummy code) when the unit goes to the package. Christian
  24. I create a handler where I want to subscribe / unsubscribe consumers: type TBSEvent<T> = reference to procedure(const obj: T); IBSRemoteMessageController = interface ['{1C7ECC50-3CA2-41A0-B230-0E9FE4CF9BE4}'] procedure Subscribe(AHandler: TBSEvent<IBSRemoteMessage>); procedure Unsubscribe(AHandler: TBSEvent<IBSRemoteMessage>); end; Now in my implementation of IBSRemoteMessageController I keep a list of these events. Unfortunately it looks like when I try to Unsubscribe() I get a different pointer even if I pass the same method. The only solution I see here is, that I return a key with the Subscribe() method and then pass this key to Unsubscribe(). Or is there a different solution for this problem? Regards Christian
  25. chkaufmann

    THTTPCommandType - PATCH

    I'm about to build a REST API using a TIdHTTPServer. Now even in the latest version of Indy the command PATCH is not listed in THTTPCommandType. Is there a reason for that? Or should a just use PUT for all update requests? To be honest when I read in the internet about the differences for PUT, PATCH and POST there are no unique opinions. So maybe I just use POST do add items and PUT for any updates (partial and complete). Regards Christian
×