Jump to content

ertank

Members
  • Content Count

    258
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by ertank


  1. Hello,

     

    There is a lot if information missing in your question. At least you didn't share what the error message you are receiving.

    This is only a guess: Are you sure that you need to pass BASE64 data as TBytes to datoteka? My experience is that WSDL import handles Byte -> Base64 encoding for you. In other words, you can try to assign

    uses
      System.IOUtils;
    
    ...
    
    dat_unl.datoteka := TByteDynArray(TFile.ReadAllBytes(filenameedit1.text));

    Above code assumes you have a recent enough Delphi version that has System.IOUtils.TFile.ReadAllBytes()

     

    BTW, you really should secure your created objects in a try..finally block.


  2. Hello,

     

    I am using TNetHTTPClient for reading some REST web service data over HTTPS.

    Some users have multiple web services to read data from.

    Some of these users with multiple web services have frequent checks (check every minute, or even check each 10 seconds).

    So they have several times a day below DNS resolution errors showing up in logs.

    The application also reach the same web service(s) but different end points from its UI part.

    All of these are under exact same domain per web service.

     

    Error sending data: (12007) The server name or address could not be resolved

    Since the application (thread) read some data from the exact same URL one minute ago, I cannot understand why such errors get logged.

    The error also occasionally occurs on the UI part of the application.

     

    My web searches all point to the DNS server problems. Users' DNS servers are fine as per my tests. Though, it is not possible to make a test at the error time.

     

    I am trying to understand why this error happens where domain was resolved one minute ago (or even 10 seconds ago).

     

    Any help is appreciated.

     

    Thanks & Regards,

    Ertan


  3. On 4/29/2024 at 3:48 PM, msi1393 said:

    Hello
    And thank you for your guidance
    I tried every guide I could find but it didn't work.
    Actually, I want to do the following code in Delphi
    that I can use a software implemented with #C
    I am attaching the text file of the class related to the dll created in C#

    Class1.cs

    You do not need to use the DLL. You already have complete DLL code as far as I can tell. I think it is possible to convert that code to Delphi.

    I cannot be sure about the details of C# encryption method. It seems like DES, CBC and PCKS#7 padding. You need to confirm that information.

    Once you have all details, there are several free encryption libraries available for Delphi which can help you do the same directly in your project without any need for a DLL.

    You can install LockBox from GetIt as an example. There are other alternatives and you may want to check some of them.

    In case you are using older versions of Delphi like Delphi 7, you can still build your own DLL using a recent version in case you are not able to use the cryptography library in your Delphi version.

    Nowadays there is a lot of AI use. They can also help you convert that C# code into Delphi. if you choose to do it that way just make sure that final code is actually correct.


  4. I am missing hints displayed when mouse cursor waits on form objects while working on VCL form design. Show designer hints is checked in the options.

    Can anybody reproduce?

     

    There must be something on my daily system. VM test system seems to be working fine. Go figure.


  5. Hello,

     

    I want to conditionally change stock ImageListItemBottomDetail appearance TListViewItem (not the list but a single item) background color at runtime.

    Stylebook - background changes for whole background as far as I can see.

     

    Any help is appreciated.

     

    Thanks & Regards,

    Ertan


  6. Hi,

     

    There is a DLL that has demo project in C#.NET code that I would like to convert into Delphi

     

    public struct AcquirerAmount
    {
        public uint id;
    
        public ulong amount;
    }
    
    
    public struct InposEcrPayment
    {
        public const ushort MAX_ACQUIRER_COUNT = 8;
    
        public ulong totalAmount;
    
        public uint totalCount;
    
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
        public AcquirerAmount[] acquires;
    }

     

    So far I converted above struct as below but data incoming is not correct. I believe that Delphi conversion is not correct.

     

      TInposAcquirerAmount = packed record
        Id: UInt32;
        Amount: UInt64;
      end;
    
      TInposEcrPayment = packed record
        TotalAmount: UInt64;
        TotalCount: UInt32;
        Acquires: Array[0..7] of TInposAcquirerAmount;
      end;

     

    Any help is appreciated.

     

    Thanks & Regards,

    Ertan

     


  7. 2 hours ago, Dave Nottage said:

    Note that I have not tested the code above - I am just going by the documentation (which I linked to) 

    I tested it on Android 12 and and it is working just fine.

    Original SO answer was missing the case match of the function and its declaration type which I should be careful for the next time.

    Thanks for the help.

     

    • Like 1

  8. Hello,

     

    Android has 24H/12H hour display format setting.

    I wanted to format my time values displayed as in system settings but I couldn't find how to read that specific is24HourFormat value.

    Delphi TFormatSettings does not include that information.

    There are earlier SO threads like this one. But that code gives me

    Invoke error: method not found.

     

    I also tried to import "android/icu/text/DateFormat" that I found in another SO answer and the app crashes without any error displayed.

     

    What would be the correct way to read that system setting?

     

    Thanks & Regards,

    Ertan

     


  9. On 9/26/2024 at 2:14 PM, dmitrybv said:

    Is it possible that rsvars.bat does not set all the necessary environment variables for MSBuild to work correctly

    When I was adding Delphi 12.2 in our build server I remember below value was missing in rsvars.bat

    BDSLIB=C:\Delphi12.2\lib

    You need to point it to your correct directory.

    • Thanks 1

  10. 9 hours ago, Nektarios said:

    All the videos, tutorials, books are assuming that there is a database file created in Microsoft Access or something like that. I don't want that. I want the user to create and manipulate the data by using my app only.

    If you want to prevent others accessing the data input in the application, you can encrypt a SQLite3 database and data will not be able to read by other software unless your encryption key and method is found.

    https://docwiki.embarcadero.com/CodeExamples/Sydney/en/FireDAC.SQLite_Encryption_Sample

     

    There are a lot to consider for saving data to disk file or reading from it. A database system already handles these for you.


  11. Below works for me without any exception. I see "All good" message and debugging shows data is actually in LResult variable.

    uses
      System.Net.HttpClient,
      System.Net.HttpClientComponent;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      LHttp: TNetHTTPClient;
      LResponse: IHTTPResponse;
      LResult: string;
    begin
      LHttp := TNetHTTPClient.Create(Self);
      try
        try
          LResponse := LHttp.Get('https://www.google.com/index.html');
        except
          on E: Exception do
          begin
            ShowMessage('Cannot communicate' + sLineBreak + E.Message);
            Exit();
          end;
        end;
    
        if (LResponse.StatusCode < 200) or (LResponse.StatusCode > 299) then
        begin
          ShowMessage('Error status received');
          Exit();
        end;
    
        LResult := LResponse.ContentAsString();
        ShowMessage('All good');
      finally
        LHttp.Free();
      end;
    end;

    You may want to test this code in a new project.

     

    If you do not get exception for google, but some other URL. You need to be sure that you are not downloading something binary.

    There are binary contents that can be retrieved using GET and these cannot be simply read as string.

    For example, I download my application update setup executables using GET into a TStream.


  12. Hi,

     

    I do not see any problem that may raise such an error in the shared code.

     

    You might want to check other events assigned to f_NetHTTPRequest. Exception may be raising in them.

    If you are sure that TIndigoHttp.GetText() is where the error occurs then which line is it?

    What is the computer codepage that you are making tests.

     

    BTW, your request might complete without exception. But response received might be an error.

    I would check if "f_StatusCode" is in successful response range. In my own code I check it to be ">= 200" and "<= 299"

×