Jump to content

marcocir

Members
  • Content Count

    36
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by marcocir


  1. Hi all.

     

    After successfully installing CEF4Delphi on Delphi 12.1, same package in Delphi 11.3 raised an error at startup.

    Now, every attempt to reinstall it on Delphi 11.3 results in the same error, specifically during the installation of the design-time BPL.

     

    Clip4.thumb.png.cfdb36224779d4fe3c456bc9124fa288.png

     

    Any help?
    Thanks
    Marco

     

     


  2. Hi,
    in my main VM I've had 10.3, 10.4.2 and 11.3 versions of Delphi Professional coexist without a problem for years.

    I've just deinstalled 10.3 version and this is what I get if I try to execute Delphi 10.4.2 or 11.3 version too (same errors).

    Both newer versions abort immediately, so I can't access IDE, getit and so on.

    I wonder if someone has a workaround to let me fix this.

    Thanks in advance for your help

    Marco

     

    Screen9.jpg

    Screen10.jpg


  3. 1 hour ago, Remy Lebeau said:

    Not a good idea to send JSON in the query parameters.  But, I suppose it is not forbidden either, so I should probably update TIdHTTPServer to handle that more cleanly, like sending a "414 URI Too Long " response instead of raising an exception.  TIdHTTPServer already has a MaximumHeaderLineCount property (which raises an exception instead of sending a "431 Request Header Fields Too Large" response).  I could add new MaximumUriLength and MaximumHeaderLineLength properties.

     

    :classic_cool:


  4. 16 hours ago, Alexander Sviridenkov said:

    You can create explicit IOHandler, set it as IOHandler for client component and set MaxLineLength property for IOHandler instance.

     Hi Alexander.

    I tried to do the same before asking here, without being able to identify exactly which is the "client component" where to set my IoHandler, thanks!

    Marco


  5. 17 hours ago, Remy Lebeau said:

    How is your client sending the JSON request, exactly?  What does the raw request look like?  Indy's TIdHTTPServer (which TIdHTTPWebBrokerBridge uses internally) does not read body content line-by-line, only the request line and headers are read as lines, so you should not be getting a MaxLineLength error under normal conditions if the JSON is in the request body.  Is the client sending the JSON in the URL query parameters instead, perhaps?

     

    Exactly, and thanks, perhaps.. I was trying to use query parameters to send the JSON payload. ;(

    Once, not without some initial trouble, I switched to a post call, sending JSON in the body, the error disappeared.

    Thank you all.

    Marco


  6. Hi All.

    I have a Delphi 10.4 web broker application that raises this exception receiving a request with a json text > 16K bytes (default max line length).

    I failed to find a simple way to set idIOHanlder MaxLineLength property to a higher value, so I wonder if someone can help me to find a solution that let my web broker API server accept calls with a larger json text attached, thanks a lot.

    Marco


  7. Thank you all,
    Scrcpy is really an amazing piece of software, not only a screen mirroring, but a great solution to connect to, and use from your PC, an Android device.
    I only wonder if there is a way to automatically reconnect the device via wi-fi without have first to reconnect it , every time,  via USB to the PC (this is a configuration - remoting an Android tablet on a PC or Mac - that should be used daily by my customers, and tell them that every morning they have to connect first the tablet to the USB cable is not the optimum)

    Marco


  8. Hi all.
    I'm looking for a simple Windows software capable to show the screen of an Android device connected to the same wifi of my PC.
    Many times I've seen this type of software used in videos and during Delphi conferences by the speakers, to show to the audience the IDE of Delphi *and* an Android App running on the device at the same time, but I can't remember their names.

    Marco


  9. Hi Arnaud, and thanks.
    I don't know if that change happened, but, as said by David, stack overflow error was there for a problem in my code: the (evil) static array had a size change when I ported the source from Delphi 10.2 to 10.3 , so the overflow problem with the stack, my bad.

     


  10. Thank you  Bernhard.
    No, I couldn't use the external libraries either way.
    Having to use the a different version of Python from any other that was eventually registered, I set the DLL's path on the OnBeforeLoad event of the Engine. 
    The problem was only with Python external libraries
    Anyway, I found a solution.

     

    1) Follow this StackOverflow answers:
    https://stackoverflow.com/questions/49737721/adding-packages-to-python-embedded-installation-for-windows


    2) I fixed the error, and succesfully imported and used numpy and matplotlib with the embedded version of Python adding

    lib\site-packages

     

    entry to pythonXX._pth file, inside embedded python folder.

    Now I have a zip file that I can expand on a generic PC and run my P4D application with numpy and matplotlib plots (as SVG) 😉 

     

     

     

     

     

    • Like 1

  11. Hi all.

    I have a Delphi P4D Windows application that I would to distribute as a single zip file.

    I use an embedded 3.8.9 64 bit version of Python in a \python folder of my application , where I have installed numpy and matplotlib, libraries that my app needs to use as well.

    If I try to copy the whole application folder, with \python subfolder, in another PC, and run the code where Python try to import numpy, I always get a ModuleNotFoundError : No module named 'numpy'  (matplotlib is the next import module in the script, but Python script aborts on numpy import line, I think).
    If I don't try yo import and use these libraries my application runs just fine from the zip file.
    I've used Google to search for a hack but no solution seems to help: someone could suggest how to add Numpy (and MatPlotLib, I think this should be the same) to that zip file, so my customer can simply de-zip my installation file and use my Delphi application?
    Thanks!

     

    • Like 1

  12. 1 minute ago, David Heffernan said:

    Answer likely to be found in the source code

    Uhmmmm, I agree, but I have compiled the same exact source code, using same Delphi Compiler options.

    I don't know if it's normal that mov eax,.... instruction at offset $4 is of different length.
    Ok.., It's enough, thank you all. 😉

     

     


  13. 1 hour ago, David Heffernan said:

    It is removed from the stack when the method returns. I don't think you've got to the bottom of the issue yet.

    Yes David, I'm here to learn, if possible.

    My code is buggy, no problem, and static arrays are horrible in this context.

    So same exact code, compiled in 10.2.3 version continues to run without problems, and compiled with 10.3.3 version continues to crash with stack overflow error: work to do this summer.

    This runs (10.2.3):

     

    Clip1.thumb.png.f8b180367127e4309af11012076483c7.png

     

    This crashes (10.3.3):

     

    Clip1.thumb.jpg.af71f8afa65dc4fd402c6d8c147a9550.jpg

    Thanks for your great help.


  14. 32 minutes ago, Kas Ob. said:

    Also one thing to remember, Stack Overflow exception doesn't always means an recursive had gone uncontrolled, to explain how stack overflow being raised you need to know about stack protection first.

     

    Thanks Kas, another thing to remember! 😉

     


  15. 12 minutes ago, David Heffernan said:

    It's a fixed length array, so it's a value type. Which means that when you pass it as a value argument, it travels via the stack. If it were a dynamic array then it would be passed as a pointer to the first element.

     

    Not that strange really. Changing from 32 to 64 bit is significant. You've been getting lucky up until now. All that copying of huge objects must cost a lot of time and make for inefficient memory usage.

     

    Thanks David, I completely agree, not a great example of optimization here, but bet it that this method had no problems (lucky me, ok) till now.

    I have, also, to dig on why the first 562k (...) moved on the stack, now are not unloaded from the stack when the method returns.

     


  16. 1 hour ago, Arnaud Bouchez said:

     

    So to fix it:

    0) read more about how records and static arrays are used by Delphi, especially about memory allocation and parameter passing

    1) use const to avoid a temporary copy on the local stack
    2) don't use fixed size arrays for TProgrammaCalcio but a dynamic array allocated on heap

    3) TPanel may also be somewhat big - consider using classes and not records to use the heap instead of the stack

    4) If you are sure that heap allocation is a bottleneck (I doubt it here), you may create a temporary TPanel within the main TfrmFixedCalcio instance and reuse it

     

     

    Ooops, I didn't see that you integrated your answer...


  17. Arnaud, now I hope I get the point.
    Yes it is a static array of 305k (32bit) or 562k (64bit).

    Two passes and we are over the 1MB upper limit. 

    First, my bad, I was convinced that passing an array that way was exactly as passing it like with a var parameter (a pointer, so, no copy of the whole array on the stack). But this is an array of a complex record, with strings, so maybe this is the falling point.
    Second, I have to understand why on the heart the stack isn't unloaded from the first 562k when my method returns. Sure, maybe I have to re-read some basics, sorry


    David, you are right, but the start of this story is that the exact same code compiled to 64 bit, since 2014 , from Delphi 10.1 to 10.3.2, without any stack overflow error (and this is a strange thing ;( ).


  18. Ok, I've traced the problem to the asm lines of disassembly windows:

     

    Clip2.thumb.jpg.5fdd659dbda6386ae562200433f1d32b.jpg

     

    The stack error is down to the selected line, where, if I've well understood that code, the generated asm tries to move stuff on the stack (rsp), in that loop (jnbe),  till it gets the max stack size permitted (?), 1 mb for my app.
    What's the meaning of that code fragment (that I can't see in the 32 bit prolog asm)?

    Thanks a lot!

     

     


  19. Thanks Arnaud.

    There is a reason why TProgrammaCalcio is not passed as const: I have to update Selezionato (Programma[iProx].Selezionato := 1).

    The question is always there: maybe it wasn't clear, but my problem isn't the speed of the code, but that 64 bit prolog asm (and not the 32 bit equivalent) seems to recall something endless and the application explodes in a stack overflow error. You are right: that method could be a bit (or a lot ) optimized, but now it can't because the simply execution of the begin line crashes the application!

    My asm knowledge is not so strong, so this post... 
    p.s think that many of those panels and layouts were added as a trick to fix some fmx... 2014/2015 problems 😉 


     

     


     

    Clip1.jpg


  20. Hi everybody.
    I have a problem trying to compile a 64 bit Firemonkey Windows application in Delphi 10.3.3, app that used to compile, both 32 and 64 bits, without problems in Delphi 10.1,  10.2, 10.3.1 and 10.3.2.
    The first screen of disassembly window is the code generated by the Delphi 10.3.3 compiler, targeting Windows 32 bit in the IDE, for the begin line (577) of the AddProgrammaCompleto method (screen rendering of many fmx panels, layouts, ecc.).
     

    begin-32bit.thumb.png.7afa5b3763be93b4c532c847f89a7208.png

     

    The second one is what compiler generates for the same line of code with target Windows 64 bit: as you can see there are differences, of course, but this code, the second time that is executed, ends in a stack overflow error (recursive calling itself?), letting the 64 bit version of my application unusable.

     

    begin-64bit.thumb.png.28094079d777e146daf1b1a8ba0f898b.png

    My code is exactly the same, this is a simple rebuild switching from 32 to 64 bit.
    I'd need your help to understand if this simply a bug of the 10.3.3 64 bit windows compiler (and if there is something that I can try to "fix" it in your opinion) or if there is something in my code that, now, is bad for that compiler.

    Thanks

    N.B. Hope this is the right place for this type of problem
     


  21. On 5/7/2021 at 1:59 AM, pyscripter said:
    
    function  TPythonGUIInputOutput.ReceiveData : AnsiString;
    Var
      S : string;
    begin
      if Assigned( FOnReceiveData ) then
        Result := inherited ReceiveData
      else
      begin
        InputQuery( 'Query from Python', 'Enter text', S);
        Result := AnsiString(S);
      end;
    end;

    You can handle the OnReceiveData event and respond in whatever way you like.

    Perfect, thank you! (and also thanks for P4D, finally I'm learning another language 😉 )

     


  22. Yes Franz, I'm asking on how to modify the generic text (title and caption of the edit) in the VCL input dialog that Dephi puts in front of my users when Pithon code executes a INPUT command.

    It should be so much better to not have that completely generic dialog, to use (it's seems strange to me the actual behavior of P4D in that functionality)

    Thanks

     


  23. Hi all.

    I wonder if there is a way to get a request of input in Python, showing as a VCL InputQuery box in Delphi but *without* the ugly standard title and text "Query from Python" and "Enter Text"..?
    Or an alternative path to route a request of input from python to Delphi?

    Any help is appreciated, thanks.

    Marco

     

    Clip2.jpg

×