Jump to content

chkaufmann

Members
  • Content Count

    145
  • Joined

  • Last visited

Posts posted by chkaufmann


  1. 2 hours ago, FPiette said:

    Why do you think you need 64-bit application? Do you have memory size issue (Like very large images to process)?

    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


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


  3. On 8/29/2022 at 7:34 PM, Remy Lebeau said:

    The extra bytes are for a hidden pointer to a System.TMonitor instance (not to be confused with Vcl.Forms.TMonitor).  Every TObject instance has an optional TMonitor instance associated with it.  The actual TMonitor instance is created the 1st time it is accessed, but the parent TObject's InstanceSize includes space for a pointer to the TMonitor instance.

    AFAIK, yes.

    Read the TMonitor documentation, and also see What is TMonitor in Delphi System unit good for?

    You could, yes.  You would simply call TMonitor.Enter(obj) and TMonitor.Exit(obj) where needed.

    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.


  4. 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


  5. 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


  6. 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


  7. Hi,

     

    on my computer I have Kaspersky install by default and I cannot change that. I cannot even change any of the settigs, it's all under control of the system administrators.

     

    They already added my major application (EXE file) as exception under "Trusted applications" but I still have the feeling it takes forever after compiling until linking is done and my application started.

     

    Personally I would like to stop Kaspersky completely, but no chance for that. So is there another setting that should be changed on a developer machine?

     

    Regards

    Christian


  8. I use a TIdHTTPServer and have problems with decoding GET variables. 

     

    The url in the browser looks like this (contains cyrillic characters):
    image.png.b1ad1d5052948e3b928a803bbd7d8b4e.png

     

    Then in the RequestInfo the UnparsedParam and the QueryParams have the value  'search=%D0%90%D0%BD%D1%82%D0%BE%D0%BD&language=ru'

    In DecodeAndSetParams this is parsed but I don't get the correct results:
    image.png.1b6881a4b6da03334c3f22b7a464460f.png

     

    The request comes from the browser and I didn't change any properties. So I'm not sure how to proceed. I think Indy uses the wrong encoding but I'm not aware, where I can change that? And will all browser use the same encoding? Or do I have to Parse the QueryParams myself?

     

    Christian

     


  9. Ok, the request that comes with this malformed Content-Disposition is created by another Delphi application where I use Indy components. The code looks like this:

    mPartStream    := TIdMultiPartFormDataStream.Create;
    postDataStream := mPartStream;
    FHttp.Request.ContentType := mPartStream.RequestContentType;
    for ix := 0 to FPostNames.Count -1 do begin
      if FPostFiles[ix].IsNull
        then mPartStream.AddFormField(FPostNames[ix], FPostValues[ix], 'UTF-8').ContentTransfer := '8bit'
        else mPartStream.AddFile(FPostNames[ix], FPostFiles[ix].PathName, FPostContentTypes[ix]);
    end;

    FPostFiles[ix].PathName is the Windows path of a file. Should I encode it on my side? Or do I have to set another parameter to ensure correct encoding?

     

    Christian


  10. Hi,

     

    I use ExtractHeaderFields() from Web.HttpApp when I parse a post upload. 

     

    With the following value for "Content" (containing special german characters) this function fails:

    'form-data; name="File1"; filename="Test1MitäÄ-Umlaut.pdf"'

     

    I get this error:

    System.SysUtils    33477 TEncoding.GetString
    System.NetEncoding  1007 TURLEncoding.Decode
    Web.HTTPApp         2108 ExtractHeaderFields

    Now I'm not sure if the input is wrong or if I have to use a different function to parse the content of this header (Content-Disposition:).

     

    Thanks for any help.

     

    Christian


  11. I'm still working with Delphi 10.4.2 and I noticed, that there are two processes DelphiLSP.exe and both take a lot of memory. In addition there is bds.exe which isn't small either.

    Is this "by default" or can I change that with changing any of my options?

     

    Christian


  12. Thanks for all hints.

     

    I created a subclass of TMenuItem and did an override of the AdvancedDrawItem method. In addition I set Enabled=False. Themes are not support, but I don't have that anyway in my application. But so far it looks fine:

     

    image.png.85e305eb60284384f5e4bd8438c7874a.png

     

    procedure TMenuGroupItem.AdvancedDrawItem(ACanvas: TCanvas; ARect: TRect; State: TOwnerDrawState; TopLevel: Boolean);
    begin
      ACanvas.Brush.Color := TColors.Silver.Lighten(50);
      ACanvas.FillRect(ARect);
      ACanvas.Font.Color := TColors.SysWindowText;
      ACanvas.TextRect(ARect, ARect.Left + 3, ARect.Top + 3, StripHotkey(Caption));
    end;

     

    Christian

    • Like 4

  13. Ok I added a disabled item ("Bearbeiten") in this case, but it's still aligned with all other items. And setting the Break property just adds a vertical line on the left side:

    image.png.2bf5325de0cf88703226ffba6fb8a0a7.png

     

    So what do I have to do to align the "Bearbeiten" Text at the left and to change the text color/background?

     

    Christian


  14. Hi,

     

    I would like to add group headers in a TPopupmenu. So I can create things like this:

    image.jpeg.becb1592fae1300aa731486b365c475c.jpeg

     

    Are there any properties I didn't find yet in the standard VCL? Or can I do that with some additional methods in a TPopupMenu subclass?

     

    Christian

×