Jump to content

Vandrovnik

Members
  • Content Count

    523
  • Joined

  • Last visited

  • Days Won

    6

Posts posted by Vandrovnik


  1. tDictionary alone will not allow you to store more values for the same key (it seems you need it: "I get all values of (TKey1 = 1) for the data. ").

    You could use two dictionaries:

    tDictionary<tKey1, tObjectList>

    tDictionary<tKey2, tObjectList>

     

    In these object lists, there will be all objects with corresponding values of the tKey1, resp. tKey2.

     


  2. You mean something like this?

    type tSledovaniVykonuSeznamVysledku=class(tObjectList<tSledovaniVykonuVysledky>)
    ...  
     var Cmp: IComparer<tSledovaniVykonuVysledky>;
     begin
     Cmp:=tDelegatedComparer<tSledovaniVykonuVysledky>.Create(
      function(const Left, Right: tSledovaniVykonuVysledky): Integer
       begin
       result:=CompareStr(Left.Nazev, Right.Nazev);
      end);
     Sort(Cmp);

     


  3. Hello,

     

    Please can you advise a profiler for Win32/Win64 applications (made in Delphi)? Free, when possible (I do not need the profiler often).

    What I have found using Google was expensive or quite outdated or buggy.

    Kind regards,

     

    Karel

     


  4. 7 minutes ago, David Schwartz said:

    This is running inside a VM and I cannot install Delphi in it, so the debugger cannot be used.

    What about remote debugging?


  5. This compiles, but I have not tested, whether it works as expected 🙂


     

         ToField<T> = class(tObject)
          private
           fData : T;
          protected
           procedure SetFromVariant(const aValue : Variant);
         end;
    
    
    procedure ToField<T>.SetFromVariant(const aValue: Variant);
     var val: TValue;
     begin
     val := TValue.FromVariant(aValue);
     fData := val.AsType<T>;
    end;
    

     

    • Thanks 2

  6. 2 hours ago, Cristian Peța said:

    I don't understand. Have you reproduced this on your machine? Then you can debug and see the call stack.

    If not, then as @Lars Fosdal said: get MadExcept or EurekaLog and don't waste your time.

    I dot't know how EurekaLog is but with MadExcept you need only to install it and check the checkbox that you want it in your app. That's all. Then you will have a full call stack to see where this happens in your code.

    But he wrote that error happens in external .dll when he opens a query, not in his code.

    • Like 1

  7. Installing components after each IDE update is a pain for me, so I created a .bat script, which recompiles all components (Win32 runtime, Win64 runtime, Win32 design time). It writes a list of created .bpl files to a text file.

     

    The only manual part then is to add them to the IDE: Component, Install packages, Add, paste the path to the .bpls. I still did not try to add all bpls in one step, may be it works :-), but I enter them one by one.


  8. I guess in the IDE, you draw for example 12 px box, but whole IDE is scaled by Windows, so that it is displayed as 24 px (example).

    In running application, if your application is HDPI enabled, than Windows does not do the scaling. So original checkbox is drawn 24 px, because it is able to do it by itself, but your component is drawn 12 px, because it does not calculate proper size.

    • Like 2

  9. I think till now they store database password in plain text in a config file and now they want something better, so that their users cannot read password from it. If they store password xored with a secret key, it would help against "normal" users. If they do not want to store that secret key in .exe, they can generate it on the fly - for example, using a random number generator set to a specific seed and obtaining generated values. It will not be hacker-proof, but it will be curious-user-proof, which is probably good enough for a legacy application.

×