Jump to content

msd

Members
  • Content Count

    83
  • Joined

  • Last visited

Posts posted by msd


  1. Hello, 

     

    I have one small question for Delphi network experts.

    I need a source for Auth Digest for HikVision devices, and I will post a sample below.

     

    GET /ISAPI/Event/notification/alertStream HTTP/1.1 Authorization: Digest

    username="admin",

    realm="IP Camera(C2183)",

    nonce="4e5468694e7a42694e7a4d364f4449354d7a6b354d54513d",

    uri="/ISAPI/Event/notification/alertStream",

    cnonce="3d183a245b8729121ae4ca3d41b90f18", nc=00000001,

    qop="auth",

    response="f2e0728991bb031f83df557a8"

    Host: 10.6.165.192

     

    Thanks for any help in advance...


  2. Hi there,

    Any known converter from h to pas doesn't work for my very huge h file from the HikVision SDK.
    Does anyone know how to convert this file or have experience converting HikVision SDK h files to Pas?

    I appreciate any information you may have in advance...


  3.   // FileName - full path to executable
      // Params - command line parameters or use empty string
      // Folder - working folder for called program - if empty path will be extracted from FileName
      // WaitUntilTerminated - if true function will wait for process to finish execution
      // WaitUntilIdle - if true function will call WaitForInputIdle function and wait until the specified process has finished processing its initial input and until there is no user input pending
      // RunMinimized - if true process will be run minimized
      // ErrorCode - if function fails this will contain encountered Windows Error Code
    
      function ExecuteProcess(const FileName, Params: string; Folder: string; WaitUntilTerminated, WaitUntilIdle, RunMinimized: boolean; var ErrorCode: integer): boolean;
      var
        CmdLine: string;
        WorkingDirP: PChar;
        StartupInfo: TStartupInfo;
        ProcessInfo: TProcessInformation;
      begin
        Result := true;
        CmdLine := '"' + FileName + '" ' + Params;
        if Folder = '' then
          Folder := ExcludeTrailingPathDelimiter(ExtractFilePath(FileName));
        ZeroMemory(@StartupInfo, SizeOf(StartupInfo));
        StartupInfo.cb := SizeOf(StartupInfo);
        if RunMinimized then
        begin
          StartupInfo.dwFlags := STARTF_USESHOWWINDOW;
          StartupInfo.wShowWindow := SW_SHOWMINIMIZED;
        end;
        if Folder <> '' then
          WorkingDirP := PChar(Folder)
        else
          WorkingDirP := nil;
        if not CreateProcess(nil, PChar(CmdLine), nil, nil, false, 0, nil, WorkingDirP, StartupInfo, ProcessInfo) then
        begin
          Result := false;
          ErrorCode := GetLastError;
          exit;
        end;
        with ProcessInfo do
        begin
          CloseHandle(hThread);
          if WaitUntilIdle then
            WaitForInputIdle(hProcess, INFINITE);
          if WaitUntilTerminated then
            repeat
              Application.ProcessMessages;
            until MsgWaitForMultipleObjects(1, hProcess, false, INFINITE, QS_ALLINPUT) <> WAIT_OBJECT_0 + 1;
          CloseHandle(hProcess);
        end;
      end;

     

      FileName := Server.libPath + 'gbak.exe';
      WorkingFolder := Server.libPath; 
      Parameters := PChar(' -b -par 9 -se ' + PChar(Server.dbHost + ':gds_db') + ' -user SYSDBA -pass masterkey ' + PChar(db.fdbPath + db.fdbFile) + ' stdout > ' + PChar(db.fbkFile));
      OK := ExecuteProcess(FileName, Parameters, WorkingFolder, true, true, true, Error);

     


  4. 13 hours ago, tgbs said:
    
    function RunProcess(CommandLine: String; Var ErrMessage : String; WaitForProcess : Boolean; CreationFlags : Word): Boolean;
    Var
      ResultCode : LongWord;
      StartInfo: TStartUpInfo;
      ProcInfo: TProcessInformation;
    begin
      Result := False;
      ResultCode := 1;
    
      FillChar(StartInfo, SizeOf(TStartUpInfo), #0);
      FillChar(ProcInfo, SizeOf(TProcessInformation), #0);
      StartInfo.cb := SizeOf(TStartUpInfo);
      StartInfo.dwFlags := STARTF_USESHOWWINDOW;
     // StartInfo.wShowWindow := SW_SHOWMINIMIZED;
    
      UniqueString(CommandLine);
    try
      try
        IF NOT CreateProcess(nil, 
                       PChar(CommandLine),
                       nil,               
                       nil,               
                       FALSE,             
                       CreationFlags,     
                       nil,               
                       nil,               
                       StartInfo,         
                       ProcInfo)          
           THEN BEGIN
             ErrMessage := SysErrorMessage(GetLastError);
             Exit;
           END;
      except
        on e : exception do
          begin
            ErrMessage := e.Message + #13#10 + SysErrorMessage(GetLastError);
            Exit;
          end;
      end;
    
      if not WaitForProcess then ResultCode := 0
        else begin
          WaitForSingleObject(ProcInfo.hProcess, INFINITE);
          GetExitCodeProcess(ProcInfo.hProcess, ResultCode);
        end;
    finally
      Result := (ResultCode = 0);
      //--------
      CloseHandle(ProcInfo.hProcess);
      CloseHandle(ProcInfo.hThread);
    end;
    end;

    Set CommandLine to somehing like  @corneliusdavid comment

    This code is OK; I made some modifications, but I have one small problem.

    When I call a command from Windows cmd everything is working fine, but over this function there are no executions; just blink the app, and nothing happens.

    What can be wrong?

    P.S. I chanced working folder to Firebird execution and run as administrator but nothing over the app; over Windows cmd works fine with the same command.


  5. Hello.

     

    I found a few Firebird/Interbase managers have the option to backup databases from a remote server (for example, a Linux server) locally in some directory.

    When I set all properties to FireDAC Firebid Backup Component, everything is working fine. If I choose a remote instance, I don't have any errors, but there is no locally backup file.

     

    Do I miss something?

     

    Thanks for the assistance in advance...


  6. Hello,

     

    I have custom managed type for example:

     

      TvatIndividual = record
        DocumentNumber: string;
        TurnoverDate: TDate;
        PaymentDate: TDate;
        DocumentType: string;
        Year: integer;
        TurnoverDescription: string;
        TurnoverAmount: Currency;

      end;

     

    I need to iterate over this record type and access its fields. For example, if I have 7 items, how can I retrieve the field names and their types using a loop in Delphi?

     

    Thanks in advance!


  7. Hello

     

    I have one XML situation, but I'm new in this world (parsing complex XML in Delphi).

    The XML file is a UBL 2.1 model invoice, and it has more nodes with child nodes, and child nodes have new child nodes, and so on.

    Do I need to make an infinite loop of reading and inspect every node for chield?

    My intention is to not lock structure; there are nodes that are not mandatory, so I just want to parse XML and use that data that is in the converted XML file.

     

    I'll attach sample XML to this message.

     

    Thanks to all of you in advance for any help...

    sample_invoice.xml


  8. Hello developers,

     

    I have one function which is working fine until Delphi 12 but now I get Integer Overflow Exception

     

    procedure CalculateErrorCorrection(dest: integer);
    var
      A: TInt;
      ALength, e, k, t1, t2, t3, LastE: Int64;
    begin
      if (errorLevel < 0) or (errorLevel > 8) then
        errorLevel := 0;
      A := TInt(ERROR_LEVEL[errorLevel]);
      Alength := 2 shl errorLevel;
      for k := 0 to Alength - 1 do
        codewords[dest + k] := 0;
      lastE := Alength - 1;
      for k := 0 to lenCodewords - 1 do
      begin
        t1 := codewords[k] + codewords[dest];
        for e := 0 to LastE do
        begin
          t2 := (t1 * A[lastE - e]) mod _MOD;
          t3 := _MOD - t2;
          if e = LastE then
            codewords[dest + e] := t3 mod _MOD
          else
            codewords[dest + e] := ((codewords[dest + e + 1]) + t3) mod _MOD;
        end;
      end;
      for k := 0 to Alength - 1 do
        codewords[dest + k] := (_MOD - codewords[dest + k]) mod _MOD;
    end;

    it fail at line: t2 := (t1 * A[lastE - e]) mod _MOD;

    every params were integer I change to Int64 but same error is there.

     

    Thanks for the any help in advance...


  9. Hello,

     

    I have a lot of problems with different FormatSetting and Delphi apps; most of them are using dot on numeric keyboards and at the dot at the end of datetime, and I have small problems with the thousand separator.

    Does Delphi support some kind of isolated Format Settings where I can set my custom Date, Time, DateTime, Decima, Thusand separator, and so. on?

    In this scenario, the user can set isolated settings for the app, no matter how Windows works, and the user can use, for example, the pain problem. (dot) on a numeric keyboard.

    Now that I have dbEdit connected to FloatField and the user input is 123.45, it converts to 12345.00. Another problem is 123,345.67. I get invalid floatpoint values.

     

    Thanks for any advice and information in advance.


  10. 52 minutes ago, Kas Ob. said:

    Hi,

    Do it stupid simple, do you need it to be used or modified by users manually ?!!   most likely no..

    So, even for both cases (Yes/No) :

    Name these CheckBoxes with useful and clear names, then use the their names as Ini file Value while use for the Ini file Sections the Form/Frame name ...

    Don't forget to handle missed value with notification or errors or skip silently.... ,

    For saving (or loading)enumerate all the controls in the form/frame and utilize the tag property to indicate the need to be saved/stored in Ini file or not.

     

    Just an idea !

    Hello,

     

    It is just like when I develop my config form, the CheckBox Hint is used for ItemName (because of the multiple same names in the config form), and the parent component name represents the ItemScetion, so this is my scenario now. But it is not only check boxes; there are also edit components (text, number, color, date, time, folder name, etc.).

    This is the main reason why I need some modifications to the base class to make some maintainable code.🙂

    I have a lot of cases in my apps with this, but for some cases, like DataSet, I need to create my class or component because I need at least 10 properties to add to make my development process simpler.

     

    Thanks anyway; any comment is useful in some way.


  11. Hello,

     

    Thanks for the reply.

     

    Here is a closer explanation of one of my ideas.

    I have a config form with a lot of checkboxes, which holds data in an ini file.

    The ini file has sections and values.

    So, I have a standard checkbox with two additional properties: one is IniSection, and the other is IniProperty OK.

    I would like to solve this without new components, but I need to keep this scenario: when I call save or load config dara method and I search iniFile by those 2 new properties from the checkbox,.

     

    I think that now it is a little bit clearer what I want to do with my additional properties.

     

    Thanks again for all the ideas...


  12. Hello Developers,

     

    Is it possible to extend the standard VCL component with some features (properties) without creating a new component?

    For example, I need to add two string properties to the CheckBox component (for auto-saving in an inifile, I need two value properties and a group name), and I think about a new VCL. Does someone have a better idea?

     

    Thanks in advance...


  13. First of all, thanks to all the experts.


    I have a few cases in which FireDAC has a solution (for example, Firebird Backup) that is not supported by UniDAC.

    In one of my projects, UniDAC is working, but FireDAC does backup, restore, upgrade, and small maintenance jobs on the Firebird Database.

     

    At the end of all, I plan to migrate all because I have full FireDAC with Delphi instead of paying for UniDAC as a separate product.

     

    When I read the MichaelIT post, I think that UniDAC is a better solution and has a better approach for the database part of the app in Delphi.


  14. I think about migrating all of our projects to one universal database VCL solution.

     

    As I can see on this forum, FireDAC, there are some changes, one of which is not backward compatibility, and another small but painful change.

    I'm using UniDAC, and it is OK, but it looks like FireDAC has a lot of improvements from version to version.

     

    So, if someone has experience with this topic, please share your ideas, experiences, and real stories.

    P.S. One more question: where is the official FireDAC support forum or website?


  15. Hello to all,

     

    As Tommi says, everything is working fine with Delphi 11.3 and the latest VCL release of all the components that I'm using.

    FastMM 5 was not a problem, and I am sorry for my misunderstanding of this great tool.

     

    Again, Tommi's idea is great. Wait for the new release to show its full power.


    Thanks to all of you again...

     

    • Like 1
×