Jump to content

shineworld

Members
  • Content Count

    280
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by shineworld

  1. shineworld

    ANN: New Opencv v. 4.6 C++ API wrapper

    I was not able to run pre-made samples. They are 32-bit not 64-bit and library README.MD say that only 64-bit are possibile. I've tried to activate 64-bit platform in samples project but only 32-bit it is possible.
  2. In the company, when we switched from SVN to GIT, it was hard, initially just using console commands. Then we started using TortoiseGIT and a way opened up. Everything runs smoothly. Collaborative work got easier, like tracking changes, versions, etc. At this point, I honestly don't regret SVN at all...
  3. Take care: You can have a Python embed version OUT of path which works but if you have the same version of Python installed normally your embedded version pip list will reach ALSO a cached path (from the normally installed Python version) in %APPDATA%\Python\Python<version>\site-packages. This does not overload your native Python embed local packages, just add others to pip visibility.
  4. shineworld

    How many people use Delphi?

    Win11/Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz Max 1.99 GHz (Max limited because a notebook)/4-cores/8-threads/16GB/RAD10.4/Release/<below data> D:\spritz_bench>spritz_bench.exe spritz prng: 149.50 MiB/s D:\spritz_bench>spritz_bench.64.exe spritz prng: 191.12 MiB/s
  5. shineworld

    How many people use Delphi?

    I wrote "it's fast" not "it's the fastest". In some things it is the same as C++, in others, it is slightly slower but not as bad. I work on very large projects, the last one being about 19 million lines of code, where there is a lot of math and UI. I don't regret C++, I've tried translating parts from Delphi to Visual Studio C++ and then embedded as a DLL with no significant gains, but resulting in longer development times and adding debugging difficulties. I use C and C++ a lot in the linux environment for embedded boards in ARM architecture, even if I have never seriously dealt with the freepascal counterpart, as in that environment you would navigate by sight.
  6. shineworld

    Python over Delphi

    you can't compare Python vs Delphi but think of Python with Delphi 🙂
  7. shineworld

    How many people use Delphi?

    Delphi is not DEAD is a very very OOP-powerful language. It is fast. It is simple and concise. It is robust and safe. It is productive (few lines of code compared to C++, Java, etc). If completely customizable, you can modify any unit of any library (with sources) to do customized things. Projects code has high longevity (I've moved old projects of 2007 to the latest versions with very few changes). Support many platforms (I will hope in the future full direct support of Linux also for arm processors). Long life to the Delphi!
  8. shineworld

    Python over Delphi

    For me the better solution is 1. To use Python on Delphi, to access the immense packages library of Python overall in math things. 2. Use Delphi to create new very fast modules, and packages, for Python, for example to move threaded things on Delphi where Python thread are very funny. 3. Use Delphi VCL/FMX to create robust Python UI and programs. Delphi compiled code is one of more fast in the market. Python covers a lot of scientific fields. Use either and you will be a winner.
  9. Hi all, I would like to add, to a python4delphi module, a getter method which return a 'dict'. For example: > import pycnccore1 as pyc >cnc_core = pyc.CNCCore() >print(cnc_core.paths) {'user_path': 'c:\\xyz', 'machine_path': 'd:\\machine_test', and so on} I don't know how to create a Delphi type to contain the dictionary and convert it to a Python dict as a result of the getter method. function TPyCNCCore.GetPaths(AContext: Pointer): PPyObject; begin Adjust(@Self); var PathDict: <i_do_not_know>; PathDict.Append('user_path', Self.UserPathString); PathDict.Append('machine_path', Self.MachinePathString); ... and so on ... Result := GetPythonEngine.VariantAsPyObject(PathDict); end; class procedure TPyCNCCore.RegisterGetSets(PythonType: TPythonType); begin inherited; with PythonType do begin PythonType.AddGetSet('paths', @TPyCNCCore.GetPaths, nil, 'Returns the used paths', nil); end; end; Thanks in advance for your suggestions Silverio
  10. shineworld

    Create a property get of 'dict' type

    Ah ok, I completely misrepresented your previous sugestions. So it would make more sense to do a normal GetPath(name) method that returns the value instead of returning a dictionary with all the variables 🙂 It makes sense Thanks for the suggestion
  11. shineworld

    Create a property get of 'dict' type

    In other projects, I've used the automatic conversion of Delphi classes to related Python wrapper classes. In this project, I would like manually create the python module classes using low-level python implementation. Looking at P4D WrapFireDac.pas code I saw a way to manually create a dictionary. Seems to work but is hard to know when to apply Py_XDecRef.... function TPyCNCCore.GetPaths(AContext: Pointer): PPyObject; var Key: PPyObject; Value: PPyObject; PathsDict: PPyObject; Engine: TPythonEngine; procedure AddItem(const K, V: string); begin Key := Engine.VariantAsPyObject(Variant(K)); Value := Engine.VariantAsPyObject(Variant(V)); Engine.PyDict_SetItem(PathsDict, Key, Value); Engine.Py_XDecRef(Key); Engine.Py_XDecRef(Value); end; begin Adjust(@Self); Engine := GetPythonEngine; PathsDict := Engine.PyDict_New; AddItem('MachineBackupPath', Self.FCNCManager.MachineBackupPath); AddItem('MachineCustomizePath', Self.FCNCManager.MachineCustomizePath); AddItem('MachineMacrosPath', Self.FCNCManager.MachineMacrosPath); AddItem('MachineMediaPath', Self.FCNCManager.MachineMediaPath); AddItem('MachinePath', Self.FCNCManager.MachinePath); AddItem('MachineRunPath', Self.FCNCManager.MachineRunPath); AddItem('MachineVmPath', Self.FCNCManager.MachineVmPath); AddItem('SamplesPath', Self.FCNCManager.SamplesPath); AddItem('UserDataPath', Self.FCNCManager.UserDataPath); Result := PathsDict; end; I don't know if this is the right way to 'return' a dict in a getter method.. In my ignorance of the subject, I am navigating by sight. Should be cool a direct way to convert a TDictionary to Python dict.
  12. shineworld

    Working with PDF files??

    Check also https://www.tmssoftware.com/site/blog.asp?post=1091 or import Adobe Reader ActiveX: Just 1 minutes to integrate Reader in an empty delphi application
  13. shineworld

    [Very unsure] Indy vs sgcIndy

    To propagate open-source state, on an inherited library, project must be under LGPL.
  14. Hi all, First of all, I apologise if what is required is poorly described, but unfortunately I know very little about networks and their knowledge. But let's get down to facts. In an industrial machine control application, I have inserted a server, a TCP/IP server based on JSON messages, which allows the connection of several clients at the same time and enables motor movement commands to be executed or information to be retrieved from the system. A client programme connects to the server and from then on can do anything with the device it has connected to. At this point, security problems arise, especially for the operator standing at the machine, since a malicious client intruding into the network could trigger dangerous operations for the operator standing near the machine and unaware that someone unauthorised has taken control of it remotely. Now I have been asked to add a security layer, but as a complete ignoramus on the subject, I deal mainly with compilers of languages and UI environments and not with networks, I was wondering how to add a system of certification and authorisation of the client to the server connection. For the client I use python while the server is done with Indy 10 using TIdTCPServer. Thank you in advance for any suggestions and help. Best regards Silverio
  15. shineworld

    Protected TCP/IP Client/Server connection

    I will try to learn how to add TLS in TIdTCPServer and TIdTCPClient 🙂
  16. shineworld

    Protected TCP/IP Client/Server connection

    The API Server (based on TCP/IP JSON requests) permits commands as {"cmd":"start.axis.movement"} so a TCP/IP client can connect to API Server, ask for an axis motor to start. At moment any TCP/IP client, eg: Telnet, can ask for an API Server connection and is not safe for machine operator. I would like to permit connection ONLY on trusted client applications (I my case a python program or a Delphi program which run in office). And I would like that client/api messages are crypted during transport so none can intercept and learn what commands are used. I can crypt/decript JSON messages to obfuscate them using for eg: bluefish or similar but I can't avoid a not trusted/client connection.
  17. shineworld

    FMX Style Designer in Syndey

    Hi all. Usually I use FMX styles as they are for Firemonkey applications. I need to check a style contents with the designer (I do that with VCL styles), but I'm not able to find FMX Style Designer in Tools menu. Searching with Google seems that FMX Style Designer is available since XE but I cannot find it. Have you any idea about ?
  18. shineworld

    FMX Style Designer in Syndey

    Sorry all, found it... is in TStyleBook component properties...
  19. shineworld

    How to deploy third-party python modules, like Pyvista?

    The readme is in Italian language but can be simply tranlsated with google: After pip installation with > python get-pip.py it is necessary to rename python<version>._pth to python<version>._pth-disabled or delete it so you can install packages with pip. readme.txt
  20. shineworld

    How to deploy third-party python modules, like Pyvista?

    The embedded python is not in the Windows path so he can't reach the %USERDATA%\Programs\Python\<embedded_python_path>\Scripts\pip. You can also remove pip during installation when finisched to install all the offline packages 🙂
  21. shineworld

    How to deploy third-party python modules, like Pyvista?

    These are 3 scripts (windows) that I use to: 1] create requirements.txt file of pip installed packages 2] download whl packages from requirements.txt 3] install the whl packages (offline) A resulting requirements.txt looks like: cffi==1.15.1 cnc-api-client-core==1.3.1 contourpy==1.0.6 cryptography==38.0.4 cycler==0.11.0 delphifmx==0.1.51 delphivcl==0.1.40 fonttools==4.38.0 kiwisolver==1.4.4 lxml==4.9.2 matplotlib==3.6.2 numpy==1.23.4 opcua==0.98.13 opencv-contrib-python==4.6.0.66 packaging==21.3 pbr==5.11.0 Pillow==9.3.0 pip==22.3.1 pybind11==2.10.1 pycparser==2.21 pyparsing==3.0.9 PySide6==6.4.0.1 PySide6-Addons==6.4.0.1 PySide6-Essentials==6.4.0.1 PySimpleGUI==4.60.4 python-dateutil==2.8.2 pytz==2022.7 scipy==1.9.3 screeninfo==0.8.1 setuptools==65.5.1 shiboken6==6.4.0.1 six==1.16.0 skia-python==87.5 tendo==0.3.0 wheel==0.38.3 Inno Setup script install Python embd and packages in this way; [Run] Filename: {userpf}\{#MyAppName}.python\python.64.exe; Parameters: "-y"; WorkingDir: {userpf}\{#MyAppName}.python; StatusMsg: Unpack Python files...; Flags: runhidden Filename: {userpf}\{#MyAppName}.python\python.exe; Parameters: "-m pip install --no-index --find-links offline-packages --force-reinstall --requirement requirements.txt"; WorkingDir: {userpf}\{#MyAppName}.python; StatusMsg: Install Python Offline Packages...; Flags: runhidden #endif python-create-requirements.bat python-offline-download.bat python-offline-install.bat
  22. shineworld

    How to deploy third-party python modules, like Pyvista?

    That's what I do: 1) download python embd version. 2) added pip 3) make a backup of this point 4) used pio to install any package 5) used pip to create a requirement.txt of installed packages with version 6) used wheel to download whl of packages from requirements.txt 7) zipped python embd of point 3 8) used innosetup to install my exe + python embed + whl packages 9) during install placed exe in programs,l paced and extracted python in USERAPPDATA and then with script installed offline pip and whl packages. In this mode it's simple to upgrade packages with more fresh without touch python things and end user can install python and packages without a internet connection.
  23. shineworld

    Cyber security Question

    I don't know if can be valid for you, but in my Python programs I use Cython to transform the scripts (*.py files) into C code then compiled natively and transformed into pyd or .so so as to reduce the possibility of editing them. Just keep a single "main_dummy.py" that instantiates a class in a "main.pyd" which is followed by all cythonized scripts.
  24. Is Windows UI API SDK (WIN32) thread safe, eg EDIT, COMBOBOX, etc ? I missed that... Sorry
  25. I began with pure C + Win32 SDK + Petzold book (https://www.charlespetzold.com/pw5/index.html) but 1st edition 🙂 when you have to manage manually the events loop...
×