Jump to content

Sonjli

Members
  • Content Count

    94
  • Joined

  • Last visited

Posts posted by Sonjli


  1. 50 minutes ago, Stefan Glienke said:

    Nice, never heard of it before but I enjoy looking at libraries that have Spring as their dependency :classic_cool:  I submitted some improvement suggestions in the area we discussed here.

    Very strange you never heard about FidoLib: the best library after the invention of programming (and Sprign4d, for sure :classic_tongue:)

    jokes apart, Thanks for your help!

    • Haha 1

  2. 5 minutes ago, Stefan Glienke said:

    It is because the compiler does not keep typeinfo of types that are only used as generic parameters in generic types in the public typeinfo list (which is what FindType with a qualified name iterates).

    If you had included the code for that Unmarshal I could probably give more advice on how to implement it best given that you seem to have support for spring collections in there

    Yes. The code is in FidoLib (I collaborate in the project).

    The file is this: https://github.com/mirko-bianco/FidoLib/blob/develop/source/Json/Fido.JSON.Marshalling.pas

    • Like 1

  3. 16 hours ago, Stefan Glienke said:

    Why look up the type by full-qualified name in the first place? Every spring collection has the ElementType property that returns a PTypeInfo.

    This was not the point, for me. I just would like to know why the RTTI doesn't know nothing about IScarafuglio until it is declared.

    Anyway I am looking for the use of that prop in my code.


  4. Hello. In this source

    unit Unit2;
    
    interface
    
    uses
      Winapi.Windows,
      Winapi.Messages,
      System.SysUtils,
      System.Variants,
      System.Classes,
      Vcl.Graphics,
      Vcl.Controls,
      Vcl.Forms,
      Vcl.Dialogs,
      Vcl.StdCtrls,
      Spring.Collections;
    
    type
      IScarafuglio = interface(IInvokable)
        ['{8E5CC1F0-8759-4965-BF83-0C2DC5E1153C}']
        function Nome: string;
        function cognome: string;
        function Eta: Integer;
      end;
    
      IPippo = interface(IInvokable)
        ['{C6B11B79-F08C-47D0-9E21-EBE4788E43E1}']
        function PlutoList: IReadOnlyList<IScarafuglio>;
      end;
    
      TForm2 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm2.Button1Click(Sender: TObject);
    var
      a: IPippo;
    begin
      // Use the RTTI in Unmarshal
      a := Unmarshal<IPippo>(
        '''
        {
          "PlutoList": [
            {
            "Nome": "Eddy",
            "cognome": "Mazzarini",
            "Eta": 22
            },
            {
            "Nome": "Luca",
            "cognome": "Vecchiato",
            "Eta": 56
            }
          ]
        }
        '''
        );
    
      ShowMessage(a.PlutoList[1].Nome); // AV because IScarafuglio instance is nil
    end;
    
    end.

    the interface IScarafuglio is never found with

    Context.FindType('Unit2.IScarafuglio');

    The result i always nil.

    But if I add a simple field or anything else that reference the IScarafuglio in interface, then everything is fine:

     

    unit Unit2;
    
    interface
    
    uses
      Winapi.Windows,
      Winapi.Messages,
      System.SysUtils,
      System.Variants,
      System.Classes,
      Vcl.Graphics,
      Vcl.Controls,
      Vcl.Forms,
      Vcl.Dialogs,
      Vcl.StdCtrls,
      Spring.Collections;
    
    type
      IScarafuglio = interface(IInvokable)
        ['{8E5CC1F0-8759-4965-BF83-0C2DC5E1153C}']
        function Nome: string;
        function cognome: string;
        function Eta: Integer;
      end;
    
      IPippo = interface(IInvokable)
        ['{C6B11B79-F08C-47D0-9E21-EBE4788E43E1}']
        function PlutoList: IReadOnlyList<IScarafuglio>;
      end;
    
      TForm2 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
        XYZ: IScarafuglio; // From now everything is fine and RTTI "know" who IScarafuglio is... 
      public
        { Public declarations }
      end;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm2.Button1Click(Sender: TObject);
    var
      a: IPippo;
    begin
      // Use the RTTI in Unmarshal
      a := Unmarshal<IPippo>(
        '''
        {
          "PlutoList": [
            {
            "Nome": "Eddy",
            "cognome": "Mazzarini",
            "Eta": 22
            },
            {
            "Nome": "Luca",
            "cognome": "Vecchiato",
            "Eta": 56
            }
          ]
        }
        '''
        );
    
      ShowMessage(a.PlutoList[1].Nome); // WORKING!!!
    end;
    
    end.

    Why this behaviour?

     

    Thanks


  5. 48 minutes ago, weirdo12 said:

     

    Why do you need to use the mydb schema name?

     

     

    I use a multi database framework that need to do its queries using the schema name. It supposes that I can have many dbs and that I can mix tables in SQL, like all schema-based db does (SQLServer, Oracle, etc.)
    example:

    select dbusers.dbo.users.name, dbauth.dbo.athentications.read, etc.


  6. Hello,

    I am trying to execute this SQL with FireDAC in D12 ent:

    create table if not exists mydb.mytable (name varchar(100) unique not null);

    With FDConnection.ExecSQL(...);

    These are the params I pass to the connection:

    DriverID=SQLite
    Database=mydatabase.db
    MetaDefCatalog=mydb
    CreateDatabase=True
    

    As I read in Embarcadero docs:

    https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Connect_to_SQLite_database_(FireDAC)

    image.thumb.png.1cdcef02ed2e60f065a297e6bea3a15c.png

     

    Well, the SQL with the "mydb" alias does not work. If I use "MAIN" (look at next sql) then it works, whatever "MetaDefCatalog" value I set!

    create table if not exists MAIN.mytable (name varchar(100) unique not null); -- <-- WORKS!
    
    create table if not exists mytable (name varchar(100) unique not null); -- <-- WORKS!
    
    create table if not exists mydb.mytable (name varchar(100) unique not null); -- <-- DOESN'T WORK!

     

    Thanks,

    Eddy


  7. Hello,

    I have a Firebird table with hundred millions of record as time series. For example:

    DateTime: 01-01-2023-10:00

    Data: Some fields with amazing data 🙂

     

    Now I have to made some analysis on them and I am looking for a good system to extract data and build some "datamart" or snapshots or whatever you want.

    I was looking for Apache Hadhoop that looks great for my scope, but I have not experience and I'd prefer some Delphi-istic solution.

     

    Great ideas appreciated,

    Thanks


  8. Hi,

    Embarcadero will probably no more support the .net formatter, so the GExperts one is the best on the market. I am studying it and looks very good, with some small lacks.

     

    Method params

    Is it possible for the formatter to format method parameters one per line? The Delphi default formatter can do this.

    Example:

    // not formatted
    procedure myproc(const a: string; b: integer);
    
    // formatted one per line
    procedure myproc(
      const a: string; 
      b: integer);

    Blank lines

    Is it possible to remove these lines?

    // not formatted
    procedure myproc(const a: string; b: integer)
    
    var
      a: integer;
    begin
    
    end;
    
    // formatted, the blank line remains
    procedure myproc(const a: string; b: integer)
    !!! <----
    var
      a: integer;
    begin
    
    end;

     

    Thanks

     

    (more to come... :classic_tongue:)


  9. 2 minutes ago, Stefan Glienke said:

    LSP has an official protocol though I don't know exactly which version and which subset Embarcadero supports - but it's enough to let you use it in VS Code.

    Thank you. My question is more stupid and generic. I am not specifically interested with LSP...

    How can I run my Process with "children" processes as the IDE does with LSP?

    I am usual to run tasks or threads but I don't see them in Windows "Task manager" :classic_dry:


  10. Premise: this is a question on "how to" and not specifically about the IDE.

    I see that IDE runs some separated processes of the LSP server.

    776406372_Schermatadel2023-11-0814-39-20.png.39f79e90a17eeed70e0c56a0e231e936.png

    - How is this made?

    - How can IDE "talk" with these sub-processes?

    - I can also kill these processes and the system continues and also re-run them, how can it be?

     

    Thanks in advance


  11. I understand. I opened a .style (thanks, I didn't know now they are text...) and found the "target". It is clear.

    So this means that is always better to keep separated TStyleBook for different platforms or maybe always to have separated platforms in a TStyleBook.

    This also means that "default" platform is pretty useless... do you agree with me?


  12. Hi,

    I search for this topic all along the forum without success, so I ask here hoping someone answer me...

    1. I make a simple one form application in FMX (HD form, not 3D)
    2. I add TStyleBook
    3. Set the UseStyleManager := True
    4. Download a style from GetIt (for me "Stellar")
    5. Double click on SB
    6. Open the style editor
    7. Load the (Android) stellar style
    8. First question: The stellar style has a file .style for every platform, why? I want one style for all platforms
    9. I copy and paste the Android platform style to the default style and delete the android one
      1. Here for many times, when I close and reopen the project the IDE says "Android style not found"... why?
    10. I start the app in Win32: every form is perfectly styled
    11. I start the app in Android: all messed up
      1. No controls at all or, sometimes, default android style, why?
    12. If I re-add the android platform to style then Android goes well
    13. Windows platform uses the "windows" style if present, else the "default" style
    14. Android platform uses the "android" style if present or nothing. The default style is not taken at all

    I have D11.3, Android 11/12/13 on some oppo phones.

    That is.

     

    This is a stackoverflow thread from the well known Dalija Prasnikar mvp:

     

    https://stackoverflow.com/questions/61534033/what-is-the-purpose-of-the-default-platform-marker-in-the-list-of-tstylebook-s

     

    Thanks for any help

    Eddy

     


  13. Hello,

    I need to override the constructor of the main form of my FMX application.

    The problem is that the mechanism that fmx uses to select the main form is very strange and the constructor of the main form is never called.

     

    Anyone knows why this behaviour?

     

    Thanks!

    Eddy


  14. On 12/14/2022 at 6:24 PM, RDP1974 said:

    hi,

    I have many 4.0 industry software made in D11x and MySQL

    in Firedac I use libmysql.dll from the MySQL folder, this should be inserted in TFDPhysical vendorlib property

    under Windows Server 2016, 2019, 2022 works fine

    you have to setup microsoft visual c runtime before https://learn.microsoft.com/it-it/cpp/windows/latest-supported-vc-redist?view=msvc-170

     

     

    Hi, Thanks.

    Did you try to download the 7z archive and run the executable at Win64? It is not running on any machine. I did the VC2015 setup and set the VendorLib, too, but nothing changes. Win32 is ok, Win64 give the error:

    [FireDAC][Phys][MySQL]-314. Cannot load vendor library [libmysql.dll]. The specified module could not be found. Check [libmysql.dll], which is located in one of the PATH directories or in application EXE directory.


  15. Hello,

    I attach a stupid D11.2 project with FD on MySQL compiled in 32 and 64 bit windows.

    Simple connection to mysql using libmysql.dll 32 and 64.

    With 32 everything is ok, with 64 it is not working.

    Before you ask:

    - FDDrivers.ini is located only in one place with nothing inside (it is the base embarcadero file)

    - In the source you can see my connection params

    - I don't use TFDPhys... because I want my exe to use local (same exe path) DLLs

    - I followed Embarcadero guidelines (vs2015 runtime, etc.)

    - I tryed with libmysql.dll from 8.x and 5.x (also the 5.7.29 as Embarcadero says), but same bad results

     

    Link to archive: https://we.tl/t-8ydNpkhi5u

    (If link is gone, tell me!)

     

    Any idea?

     

    Thanks


  16. Ok Uwe. If you don't want to want to solve this simple issue for a poor, poor programmer, I'll do it myself :classic_biggrin:

    Seriously, I understand. So I found a configuration for the standard formatter I share for others if they find it useful:

    image.png.0040c0b531bba52ff9c2ae2e93fd1ef2.png

    This solve my terrible (:classic_tongue:) problem wtih MMX.

     

    Thanks Uwe

     

×