Jump to content

Stéphane Wierzbicki

Members
  • Content Count

    230
  • Joined

  • Last visited

Posts posted by Stéphane Wierzbicki


  1. Hello, 

     

    Does Indy support SSH? I need to connect to an SFTP server. I don't need SFTP (FTP over SSH) as it is different than FTPS (FTP over SSL/TLS).

     

    If so, is there simple example available? 

    If not, is there any free library available? 

     

    Thank you! 


  2. Hello,

     

    Does anyone know how to store a TFDMemtable with its indexes?

     

    TFDMemtable.SaveToFile does not save indexes, I tried different formats ( sfXM,sfBinary,sfJSON).

    I've also tried to either add indexes with TFDMemtable.IndexDefs or with TFDMemtable.Indexes

     

    StoreItems is set to [siData, siDelta, siMeta].

     

    I'm clueless. Any idea?

     

     


  3. Hello,

     

    Anyone knows how I can delete an archive Item using TZipFile class ? 

    I found a TZipFileHelper class helper on the net. It is useless since we cannot access TZipFile private members anymore.

     

    procedure TZipFileHelper.Delete(FileName: string);
    var
      i, j: Integer;
      StartOffset, EndOffset, Size: UInt32;
      Header: TZipHeader;
      Buf: TBytes;
    begin
      i := IndexOf(FileName);
      if i <> -1 then begin
        // Find extents for existing file in the file stream
        StartOffset := Self.FFiles[i].LocalHeaderOffset;
        EndOffset := Self.FEndFileData;
        for j := 0 to Self.FFiles.Count - 1 do begin
          if (Self.FFiles[j].LocalHeaderOffset > StartOffset) and
             (Self.FFiles[j].LocalHeaderOffset <= EndOffset) then
            EndOffset := Self.FFiles[j].LocalHeaderOffset;
        end;
        Size := EndOffset - StartOffset;
        // Update central directory header data
        Self.FFiles.Delete(i);
        for j := 0 to Self.FFiles.Count - 1 do begin
          Header := Self.FFiles[j];
          if Header.LocalHeaderOffset > StartOffset then begin
            Header.LocalHeaderOffset := Header.LocalHeaderOffset - Size;
            Self.FFiles[j] := Header;
          end;
        end;
        // Remove existing file stream
        SetLength(Buf, Self.FEndFileData - EndOffset);
        Self.FStream.Position := EndOffset;
        if Length(Buf) > 0 then
          Self.FStream.Read(Buf[0], Length(Buf));
        Self.FStream.Size := StartOffset;
        if Length(Buf) > 0 then
          Self.FStream.Write(Buf[0], Length(Buf));
        Self.FEndFileData := Self.FStream.Position;
      end;
    end;

     

     

    ps: I'm using Delphi RIO


  4. 1 hour ago, Stefan Glienke said:

    How can a name collision between TTMSLoggerLogLevel.Exception and Sytem.SysUtils.Exceptions be an IDEFixPack issue?

    It has even been reported already: https://www.tmssoftware.com/site/forum/forum_posts.asp?TID=8402&amp;title=enumeration-names

    As written in my second post, the compiler error was caused by a name collision. Maybe my post was too confusing....

    "Building changed files" bug still persist until I remove IDE FixPack.  

     


  5.  

    Hi,

     

    I cannot get this procedure TPerson.LoadSettings(const aJsonString: String). Is there any reason why self instance is not updated with new value ?

     

    Is their any workaround or should I create a LoadSettings method outside TPerson ?

     

    program Project1;
    {$APPTYPE CONSOLE}
    {$R *.res}
    
    uses
      System.SysUtils,
      REST.JSON,
      Unit1 in 'Unit1.pas';
    
    var Person:TPerson;
        jsonstr:string;
    begin
      try
        Person:=TPerson.Create;
        try
           person.Name := 'Hello';
           jsonstr:=  Person.SaveSettings;
           writeln(jsonstr); //write {"name":"hello"}
           person.Name := 'hi';
           Person.LoadSettings(jsonstr);
           writeln(person.Name);    //write hi instead of Hello
           readln;
        finally
          Person.Free;
        end;
      except
        on E: Exception do
          Writeln(E.ClassName, ': ', E.Message);
      end;
    end.

     

    unit Unit1;
    
    interface
    
    type
      TPerson = class(TObject)
    
      private
        FName: string;
      public
        procedure LoadSettings(const aJsonString: String);
        function SaveSettings: string;
        property Name: string read FName write FName;
      end;
    
    implementation
    
    uses REST.JSON;
    
    procedure TPerson.LoadSettings(const aJsonString: String);
    begin
      self := TJSon.JsonToObject<TPerson>(aJsonString);
    end;
    
    function TPerson.SaveSettings: string;
    begin
      result := TJSon.ObjectToJsonString(self);
    end;
    
    end.

    Ps: I'm using Delphi RIO Updt 2


  6. Hi,

     

    I'm worried with latest Rad Studio 10.3.2 version. I have applied  Building Changed Files Patch but my modified pascal files (not saved) are no more taken on compiltion

     

    More, I'm suddenly getting weird erros that prevent me building my project... :

     

    [dcc32 Error] ETL.pas(360): E2005 'Exception' is not a type identifier on exception blocks...

    image.thumb.png.03b446c622001e246eb0f7dd8be0a956.png

     

    or

     

    [dcc32 Error] ETL.pas(450): E2029 '.' expected but ';' found

    image.thumb.png.ae5ea3c4f5c2bdd3812e2c02b3c4ada7.png

     

    Am I the only one suffering from this?

     

    Regards

     

     

     


  7. Hello Uwe,

     

    I there a way to stop displaying MMX code explorer after 2 F12 ?

    How to reproduce:

     

    Create a new VCL application

    Code editor will be displayed

    Press F12 to see the Form designer

    Press F12 to toggle to code editor

     

    Actually : code editor and MMX code explorer will show

    Expected; only code editor should be displayed (MMX code explorer should appears only if it was previously opened)

     

    Ps: I'm using the latest beta version 2345 + RIO 10.3.2


  8. 5 minutes ago, David Heffernan said:

    Why would any professional programmer be using getit anyway? As I understand it, it is suitable for hobbyists and no more. 

    You need GetIt if you want to easily download the Android Sdk/Ndk

     

    GetIt is down for many days now... 

     

    Ps: I know that I can download sdk and ndk from Google Servers directly but hey, I thousands Euro on Delphi... 

     

     

×