Jump to content

chkaufmann

Members
  • Content Count

    145
  • Joined

  • Last visited

Posts posted by chkaufmann


  1. For a HTTP Post request I create a TIdMultiPartFormDataStream and then I use AddFormField() to put my values. Now I noticed, that "=" is replaced by "=3D" and Content-Transfer-Encoding is set to "quoted-printable".

     

    Using the $_POST[] variable in my PHP script, the 3D remains and I get wrong results. Now I'm not sure where I should change that? Should the request be without Content-Transfer-Encoding? or with a different one?

    Or should I change my PHP script and expect a "quoted-printable" string? I didn't find any information for PHP if I can get the Content-Transfer-Encoding from somewhere. I always thought PHP does handle such things automatically.

     

    Christian


  2. Yes, that's what I need. Convert \n and \t to chr(10) and chr(9).

     

    Treating the string as array is this fine? Or is there a faster way to do it? Something like this


     

      n := ASource.Length;
      SetLength(Result, n);
      ix1 := 1;
      ix2 := 1;
      while ix1 <= n do begin
        if ASource[ix1] = '\' then begin
          Inc(ix1);
          case ASource[ix1] of
            't': Result[ix2] := chr(9);
            'n': Result[ix2] := chr(10);
            '\': Result[ix2] := '\';
          end;
        end
        else 
          Result[ix2] := ASource[ix1];
        Inc(ix1);
        Inc(ix2);
      end; 
      if ix1 <> ix2
        then SetLength(Result, ix2 - 1);

     

    Christian


  3. 2 hours ago, edwinyzh said:

    PS, I've never used any db components from DevArt, but I own another product of them, and I believe they provide good quality products.

    Yes Devart db components are reliable and stable. I use UniDac since years and it works with no problems with Firebird, MS SQL, Postgresql and Oracle.

     

    Christian


  4. Hi,

     

    I try to create an Android app. My device is not listed under "Target" so I found this page:
    http://docwiki.embarcadero.com/RADStudio/Rio/en/Installing_the_USB_Driver_for_Your_Android_Device

     

    I have the driver downloaded. However if I try to update it in the Device Manager it's not recognized and if I load the android_winusb.inf file explicitly I get an error (no compatible driver found). I'm using a Lenovo laptop with Win7 installed. My device is a Samsung A3 and in the Windows file explorer it's listed correctly. But in driver details I can see that it is still using a Microsoft Driver 6.1.7601.18738.

     

    How can I solve this problem?

     

    Christian


  5. That was my idea as well. I did some more research in the internet and Maybe I will use an IOmniFuture<T>. But I have to test this first. Not sure if the OnTerminated event is called everytime and if the CancellationToken is already signaled if all references to it are released. Otherwise it will be easier to create my own call back object/interface.


  6. I have a controller for "remote files". If the file is not yet on the local disk, I download it in the background (using a IOmniBackgroundWorker) and then call an event when the file is available. 

    procedure TMyController.GetFile(const AFilename: String; AOnFileAvailable: TNotifyEvent);
    begin
      ...
    end;

    AOnFileAvailable is a method of a form which loads the file to display it. Now it may happen that the form will be closed before the download is finished and in this case a call to AOnFileAvailable will cause an access violation.

     

    My question: What is the common pattern to solve this issue? I was thinking about passing an object/interface instead of the event so the form can set it to invalid before it's destroyed. But maybe this is solved using existing code from the OmniThread Library?

     

    Christian


  7. 1 hour ago, Holger Flick said:

    Especially as the error seems to be only appearing in certain situations, and it seems to be avoidable if you compile without the IDE.

    Well, for me this kind of solutions are fine in the world of "Open Source Tools", but not when I'm forced to pay a subscription fee. 

     

    In our case the compiler not even shows us the exact location. I just get the error "[dcc32 Fatal Error] F2084 Internal Error: DBG1226" during compilation, well in fact during linking. And the only QC report with this error I found is the one listed above.

     

    So in the end I don't know where to search the error in a project with several hundred thousand lines of code. I use generic functions in different places, but having these removed is a "showstopper" for me.

     

    Christian


  8. Hi,

     

    we already missed 10.3, now 10.3.1 is available but we can still not move to the new version because IDE compiler errors are still not fixed. Our major project is quite large but what we found is, that this issue is probably the problem we have:

    https://quality.embarcadero.com/browse/RSP-22307

     

    What is the best way to get this fixed now? It's unresolved since 4 months now and having such a "show stopper" all the new fancy features in the IDE are just useless when such basics like the compiler don't work.

     

    Christian


  9. I had to set the Accept-Language header, now it works, at least with Russian names.

     

    I wasn't aware of the TIdLog components. Good to know because my simple test did not work with Thai and Hebrew names, but I have to investigate there further first because when I paste these characters to the source code file, they look different even though my source file is UTF-8.

     

    Christian


  10. Hi,

     

    if I enter the following url in my browser, I get a result file with the name "Müller" translated to russian characters:

     

    https://translate.googleapis.com/translate_a/single?client=gtx&amp;sl=de&amp;tl=ru&amp;dt=t&amp;q=Müller

     

    I tried to implement that with TIdHTTP, but something is missing and I don't find the problem. Here is my code:

    var
      data  : String;
      http  : TIdHTTP;
      sslIO : TIdSSLIOHandlerSocketOpenSSL;
      tmp   : TStringStream;
      url   : String;
    begin
      http := TIdHTTP.Create(nil);
      http.HTTPOptions := http.HTTPOptions + [hoNoProtocolErrorException, hoWantProtocolErrorContent];
    
      sslIO := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
      sslIO.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2];
      sslIO.SSLOptions.Mode        := sslmUnassigned;
      sslIO.SSLOptions.VerifyMode  := [];
      sslIO.SSLOptions.VerifyDepth := 0;
      http.IOHandler := sslIO;
    
      url := TIdUri.UrlEncode('https://translate.googleapis.com/translate_a/single?client=gtx&sl=de&tl=ru&dt=t&q=Müller');
      tmp := TStringStream.Create;
      http.Get(url, tmp);
      data := tmp.DataString;
    
      tmp.Free;
      http.Free;
    
    end;
    

    I expect to get the following string (like in the browser):

     

    [[["мельник","Müller",null,null,0]],null,"de"]

     

    Can somebody tell me what is wrong in my code?

     

    Christian

×