Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 06/16/21 in all areas

  1. 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) 😉
  2. 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!
  3. Hans J. Ellingsgaard

    FireDAC: Need help understanding "ConnectedStoredUsage"

    It works fine the opposite way - active at designtime and closed at runtime. I guess that most users use it that way. I allways make shure that all my queries are closed at programstart, and then open them via code.
  4. SwiftExpat

    How should I do SysPathInit?

    Another way to solve the problem, when you need to add / modify to path, order is likely important. Just run the command in python: import sys sys.path.insert(0, 'path/to/script') The engine has a property, PythonEngine.InitScript: PythonEngine.InitScript.Add('import sys'); PythonEngine.InitScript.Add('sys.path.insert(0, 'path/to/script')'); The benefit is when you attempt to run / unit test in python and need to modify the path. And if you use PyScripter as your python dev tool the approach will be reusable.
  5. pyscripter

    Xdata Rest server request & Python4Delphi

    I said "after loading" loosely speaking and not "in the OnAfterLoad event". Indeed you can only call Py_Begin_Allow_Threads after the engine is initialized. I have not tested, but you can set AutoFinalize to False and in the OnBeforeUnload do Py_End_Allow_Threads; Finalize; Also probably, skipping the above when the application closes down may not be necessary.
  6. Rollo62

    Android Service

    Usual timer do not work in mobile services. For such hardware related system, I would also consider to use a real device, forget the emulator. Only real hardware will show you real problems with the app. Try to use the latest Delphi version, 10.2.3 is already centuries behind, and its already tough to get 10.3.3 running with current devices.
  7. A few months ago I replaced all RTL collections (apart from TStringList) with spring4d 2.0 collections and I saw noticeably smaller binaries (exe/bpl) and faster overall application performance. Spring4D collections are just so much nicer to use, being interface based is a plus for me, and the LINQ like functionality makes it really easy to do sorting, filtering, projections etc - if only Delphi had lambdas so the predicates etc were not so damned verbose! I'm extremely thankful for the work @Stefan Glienke has put into Spring4D 👍
  8. My dzlib has TFilesystem.CopyFileWithProgress in unit u_dzFileUtils. It's a wrapper around the WinAPI function CopyFileEx. I also seem to remember such a functionality in the jcl.
  9. https://delphisorcery.blogspot.com/2021/06/introducing-springbenchmark-port-of.html
  10. Isn't that basically the same message as the one that Herb Sutter presented years ago (2007)? “Machine Architecture: Things Your Programming Language Never Told You” Slides: https://nwcpp.org/talks/2007/Machine_Architecture_-_NWCPP.pdf
  11. I can save you 70 minutes there. The key point of Chandlers Efficiency talk is "Cache locality is very important". The remaining 60 minutes are just circus IMO.
×