Jump to content

Skrim

Members
  • Content Count

    47
  • Joined

  • Last visited

Posts posted by Skrim


  1. On 3/17/2024 at 5:31 PM, Remy Lebeau said:

    Depends on the context. The compiler thinks you are using J's value before you have actually assigned any value to J. Sometimes the compile makes a mistake on this, sometimes not, so it may or may not be a false positive. How are you actually using J exactly? Can you show that code? 

    Here is my code, also could it be done easier/more elegant :classic_blush:

     

    //  String 000001203 to 1203

    // Numbers of zeros to the left could be 1..n


    function RemoveZeroLeft(var s : String) : string;
    var
      i, j : integer;
    begin

      for i:=1 to length(s)do
      begin
        if s<>#48 then
        begin
          j:=i;
          break;
        end;
      end;

      result:=copy(s,j,length(s));

    end;


  2. D12

     

    When I doubleclick in Event OnGetEditText to make an event handler in a stringgrid I get this error.

     

    "Property and method MyGridOnGetEditText are not compatible."

     

    The event is empty. It had some code earlier, but that is deleted together with its declaration.

     

    From Delphi Help file
    "You are assigning a method to an event property even though they have incompatible parameter lists. Parameter lists are incompatible if the number of types of parameters are not identical. For a list of compatible methods in this form, see the dropdown list on the Object Inspector Events page."


    Any ideas how to solve this?

     


  3. 4 minutes ago, Uwe Raabe said:

    Many people think that patience is a sign of weakness.
    I think this is a mistake. It is anger that is a sign of
    weakness, whereas patience is a sign of strength

    (Dalai Lama)

    Nice :classic_biggrin: I'll quote that one next time I cannot deliver on time and I'm facing fines (Usd 100 per. customer per day) for not delivering by the deadline.

    • Like 7

  4. 11 minutes ago, Uwe Raabe said:

    Ehm, no!

    Why then isn't GetIt up and running?
    For a company within the IT industry it should be simple enough, right?
    In my industry (finance) we are required to have plans for downtime situations to minimize the damage. Doesn't Embarcadero have plans for such cases? Or is the philosophy, let's just wait and see what happens should something arise :classic_blink:

    • Like 2

  5. Solved.

     

    On those pc's giving an error both libeay32.dll and ssleay32.dll were missing.

     

    Would be nice with a message "Cannot find file xxxx.dll", not just -1 🙂

     


  6. 2 hours ago, Remy Lebeau said:

    What exactly is reporting that error? Can you provide the exact and complete error message? And what does your code look like? 

    The error code is just -1. Nothing more, not very helpful :classic_sad:

    From Windows?


  7. Several clients connect to one remote server/service.

     

    Some clients receive error, most works just fine. Clients are on several dfferent locations. Could it be the clients firewall is blocking sending?

     

    Here is some of my code.

     

    procedure TFormSend.HttpFinish(ASender: TObject);
    begin
      LogMemo.Lines.Add(Format('Finished. Http status code : %d',[(ASender as TxxxxxUpload).ResponseCode]));
      if (ASender as TxxxxxUpload).ResponseCode=201 then
      showmessage('Invoice delivered')
      else
      showmessage('Error : Invoice could not be delivered');
    end;

     

    procedure TMyClient.SendFile;
    var
      tmpstream: TStringStream;
      Params: TIdMultipartFormDataStream;
      FIdSSLIOHandler: TIdSSLIOHandlerSocketOpenSSL;
      FidHttp: TIdHTTP;
      FIdURI: TIdURI;
      FURL: string;
    begin

      HttpStart(Self);
      FResponseCode := 600;
      if DoCheckParams then
      begin
        Params := TIdMultipartFormDataStream.Create;
        FidHttp := TIdHTTP.Create(nil);
        FIdSSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
        FIdURI := TIdURI.Create(FEndPoint);
        tmpstream := TStringStream.Create(Trim(FDocumentID));
        try
          with FidHttp do
          begin
            ReadTimeout := 30000; // 0
            ConnectTimeout := 30000;
            HTTPOptions := [hoKeepOrigProtocol];
            // hoKeepOrigProtocol,hoForceEncodeParams
            HandleRedirects := true;
            RedirectMaximum := 5;
            ProtocolVersion := pv1_1;
            AllowCookies := true;
            OnWork          := WorkEvent;
            OnWorkBegin     := WorkBegin;
            OnWorkEnd       := WorkEnd;
            OnStatus        := StatusEvent;
            with Request do
            begin
              UserAgent := FUserAgent;
              BasicAuthentication := true;
              RawHeaders.FoldLines := false;
              Accept := 'application/xml';
              Connection := 'keep-alive';
            end;
          end;
          with (FIdSSLIOHandler as TIdSSLIOHandlerSocketOpenSSL) do
          begin
            with SSLOptions do
            begin
              Method := sslvTLSv1;
              SSLVersions := [sslvTLSv1];
              Mode := sslmUnassigned;
              VerifyMode := [];
              VerifyDepth := 2;
            end;
            port := 443;
            host := FIdURI.host;
          end;
          FidHttp.IOHandler := FIdSSLIOHandler;
          Params.AddFile('file', FXMLfile, 'application/xml');
          Params.AddFormField('SenderID', FSenderID);
          Params.AddFormField('RecipientID', FRecipientID);
          Params.AddFormField('ChannelID', FChannelID);
          Params.AddFormField('ProcessID', FProcessID);
          Params.AddFormField('DocumentID', '', '', tmpstream).ContentTransfer  := '8bit';
          FIdURI.Username := FUser;
          FIdURI.Password := FPassword;
          FURL := FIdURI.GetFullURI();
          Params.Seek(0, soFromBeginning);
          try
            FidHttp.Post(FURL, Params, FResponse);
            FResponseCode := FidHttp.ResponseCode;
            FResponse.Seek(0, soFromBeginning);
          except
            on E1: EIdHTTPProtocolException do
            begin
              FResponseCode := FidHttp.ResponseCode;
              ErrorEvent(Self,'IdHTTPProtocol Protocol Exception:' + #$D#$A + StringReplace(E1.ErrorMessage, #10, #$D#$A, [rfReplaceAll]));
              ErrorEvent(Self,'IdHTTPProtocol RawHeaders=' + #$D#$A + FidHttp.Request.RawHeaders.Text);
            end;
            on E2: Exception do

            begin
              FResponseCode := FidHttp.ResponseCode;
              ErrorEvent(Self,'IdHTTPProtocol Unknown Exception: ' + E2.Message);
            end;
          end;
        finally
          Params.Free;
          FIdSSLIOHandler.Free;
          FidHttp.Free;
          FIdURI.Free;
          tmpstream.Free;
        end;
      end
      else ErrorEvent(Self,'Some required params are missed');
      HttpFinish(Self);

    end;


  8. I upload Xml files to a remote service using Indy.

     

    Most of the time it's working just fine, but sometimes there is an error returning error code -1.

    (Unknown error?)

     

    When I say "not working" the file connection/transfer is not accepted by the remote service.

     

    It's just on a few pc's it's not working, could it be those pc's are missing required files (dll)?

     

    Using OpenSSL/Indy, what files do I have to distrbute in my Win32 application?

     

    uses

      SysUtils,
      IdIOHandler,
      IdIOHandlerSocket,
      IdSSLOpenSSLHeaders,
      idHTTP,
      IdContext,
      IdLogBase,
      IdLogFile,
      IdSSLOpenSSL,
      IdHTTPHeaderInfo,
      IdMultipartFormData,
      IdURI;

     

     

     


  9. well, the web app is stateless... then each requirement is the only one... no exists "before"... exists "now" and only this.

    for sure, it's not appreciated but is this...

     

    Exactley why I "hate" to do work using a browser. I wold estimate my workload has increased by 30% over the last two or three years because of "The world is moving to the web".

    Even worse, a lot of software companies no longer offer support by phone, you have to talk to a robot or fill in a contact form, lucky you if you get an answer in only 1-2 days :classic_laugh:

     

    I'm so glad my main program is developed in Delphi by myself 🙂


  10. "I want this". Yes, 15 clicks versus 4 clicks is exactly what the enduser wants 🙂

     

    Why do programmers market such stupidity? I thought the whole idea using some software was to make the workload less, not worse.

     

    The list why a browser is less suitable for complex programs is endless.

     

    An example: In a browser based program (salary) I use there is a list (grid) and I want to edit row 25 and 26. I scroll down to row 25 and do my editing and save. Now row 26, but the list has moved back to row 1, scroll down again..... Why not stay in row 25 so I can easily choose row 26. (As it did in the "old" Win 32 program)

     

    Not a problem if you do the task 1-2 times a day, but what if you repeat 50 times a day?

     

    According to the Marketing Department, this is what an enduser wants.

     

     

     

     

     


  11. I read here and there that the industry has moved to the Web (programs running in the browser) and it's a must if you want to stay in the industry and be relevant.

     

    I get it if you are developing personal apps that target smart phones and tablets, but I really don't understand why program/applications for the proffesionals working on an ordinary pc should use a browser.

     

    What I often hear from customers is "It's better". I ask, what is better? The answer is often "eeerrr... eeerrr... not sure" My answer is, the Web is better for the software industry and not neccasarily for the enduser.

     

    I'm also an accountant and I use browser based programs every day in my work, I can sum it up with three words: slow..slow..slow and a LOT of mouse clicks. A task in my main Win32 program takes 4 clicks, in a brower based program I use the same task takes 15 clicks. That program is made by one of the "big players" in it's field.

     

    Please help me understand, what is "better"?

     

    • Thanks 1

  12. 7 hours ago, audi30tdi said:

    @skrim Great! Looks like you is an expert, do you know of links to delphi code also for making the file?? Or maybee you have a small code showing me??

    Sorry, I have no links to code, I wrote mine from scratch. But an xml is just an ordninary text file and you can build it in a memo control and save it to a file from there.

    What is a bit more complex is the "layout" of the ehf. It have to be a valid ehf before it is accepted by an Access Point, can be validated here https://anskaffelser.dev/service/validator/

     

    Also if there is a small amount of ehf files pr. year it will be quite expensive, there is a fee of 8-10.000,- kroner pr. year to the Access Point, if I remember correctly. What is the pupose of your program, "for fun" or business?

     


  13. 11 hours ago, TheOnlyOne said:

    Yes, you are right. It is his company. And I work there. A boss is nothing without employees. And employees tend not to follow the boss when the boss does whatever HE wants with the company..... And as I said, a boss is nothing without employees 🙂

     

    If you would only knew the difference (in efficiency and stability) between procedural and OOP....
    I spent 2 weeks in some super convoluted procedural program they have (an exporter, 8000 lines), to fix 17 bugs. Another 3-4 to fix.
    In the new version, OOP, I rewrote that that exporter in under 60 lines of code.

     

    Every line of code we write, increases the chances to introduce a bug. Procedural code tent to be way way way more "verbose", and separate poorly the program logic....

    You see where I am going with this... right? 

     

    60/8000 how can that be possible 🙂

     

    Sounds like it was a showmessage('Are you sure...'); showmessage('Are you really sure...'); showmessage('Are you absolutely sure...');

     

    I quess both OOP and procedural style can be structured badly.

     

    However, my program started it's life in 2005 and at that time I had no clue what OOP was. I have looked into it, but find it somehow confusing and hard to learn. My program is an accounting suite, I have separated into units where each unit does a specific task and the unit is named accordingly. There are hundreds and hundreds of units, no problem there. You will not be able to write that program in 60 lines or even 60' lines 🙂


  14. There is a field where according to the Help system:

    Indicates the Code Page that the user's system requires in order to run the application

     

    I have never "paid any attention" to this and it's set to Locale ID English(USA). Default?

     

    I'm in Norway and we have a few special characters, but I have never had any problems.

     

    Should I edit it to Norwegian?

     


  15. "... In theory, there's not much required. But it seems every one has had one or two major melt-downs per year. ..."

     

    Really, I have run a Postgres server for 15 years, one "meltdown" only and that was due to Linux.

     

    Not much traffic, storing about 1 million records per year. But still.

     

    More impressive, Dell server with three 15' rpm disks. You do the math :classic_smile: The quality of that server is just fantastic.

    • Like 1
×