Jump to content

shineworld

Members
  • Content Count

    321
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by shineworld

  1. 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
  2. shineworld

    [Very unsure] Indy vs sgcIndy

    To propagate open-source state, on an inherited library, project must be under LGPL.
  3. 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
  4. shineworld

    Protected TCP/IP Client/Server connection

    I will try to learn how to add TLS in TIdTCPServer and TIdTCPClient 🙂
  5. 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.
  6. 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 ?
  7. shineworld

    FMX Style Designer in Syndey

    Sorry all, found it... is in TStyleBook component properties...
  8. 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
  9. 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 🙂
  10. 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
  11. 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.
  12. 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.
  13. Is Windows UI API SDK (WIN32) thread safe, eg EDIT, COMBOBOX, etc ? I missed that... Sorry
  14. 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...
  15. TO BE very SIMPLE, TApplication, with Application instance, is or at least should be a Singleton, because manages the main events loop from Windows. You can't have more than ONE... It's the Windows structure of any application. When you run a program Windows create a process with a main thread which call the delphi main code. This main code create Application object which manage the messages loop (Windows is a messages-based OS) and on this messages loop manager is implemented all VCL framework, etc...
  16. Hi all, what is the fastest way to compare two vars of the TIntegerDynArray type? Thank you in advance for your suggestions.
  17. shineworld

    Compare two TIntegerDynArray

    Sincerely no reason. I just thought that TIntegerDynArray is more performant than a generic. In my defense or fault, I have not been a big user of generics until now.
  18. shineworld

    Compare two TIntegerDynArray

    Some type like this? PS: IsEqualIntegerDynArray placed in method just to test. procedure TGCodeEditor.SetGCodeLinePoints(Value: TIntegerDynArray); function IsEqualIntegerDynArray(const A, B: TIntegerDynArray): Boolean; begin if Length(A) <> Length(B) then Exit(False); Result := CompareMem(@A[0], @B[0], Sizeof(Integer) * Length(A)); end; begin if not IsEqualIntegerDynArray(FGCodeLinePoints, Value) then begin FGCodeLinePoints := Value; Invalidate; end; end;
  19. shineworld

    Compare two TIntegerDynArray

    That is what I've used.... procedure TGCodeEditor.SetGCodeLinePoints(Value: TIntegerDynArray); var F: Boolean; L: Integer; begin F := False; L := Length(Value); if (Length(FGCodeLinePoints) > 0) and (Length(FGCodeLinePoints) = L) then F := CompareMem(@FGCodeLinePoints[0], @Value[0], Sizeof(Integer) * L); FGCodeLinePoints := Value; if not F then Invalidate; end;
  20. shineworld

    Create Python GUI with Delphivlc

    DelphiVCL implements a good subset of VCL objects and related methods/properties/events. You can find full Embarcadero VCL documentation on the net: https://docwiki.embarcadero.com/ To know what objects methods/properties/events are implemented and available in DelphiVCL python unit there are two ways (that I know): 1] Look at sources of P4D in github. 2] Inspect imported module and every class you want to use: Example to inspect VCL objects and Form object: P:\>python Python 3.9.12 (tags/v3.9.12:b28265d, Mar 23 2022, 23:52:46) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import delphivcl as vcl >>> dir(vcl) ['Abort', 'Action', 'ActionList', 'ActivityIndicator', 'Application', 'BaseBindScopeComponent', 'BaseLinkingBindSource', 'BaseObjectBindSource', 'BasicAction', 'BasicBindComponent', 'Bevel', 'BindComponentDelegate', 'BindingsList', 'BitBtn', 'Bitmap', 'BoundLabel', 'Button', 'Canvas', 'CheckBox', 'Collection', 'ColorBox', 'ComboBox', 'Component', 'ContainedAction', 'ContainedActionList', 'ContainedBindComponent', 'Control', 'ControlBar', 'CreateComponent', 'CustomAction', 'CustomActionList', 'CustomActivityIndicator', 'CustomBindingsList', 'CustomControl', 'CustomDrawGrid', 'CustomEdit', 'CustomForm', 'CustomGrid', 'CustomLinkControlToField', 'CustomLinkListControlToField', 'CustomLinkPropertyToField', 'CustomMemo', 'CustomNumberBox', 'CustomPrototypeBindSource', 'CustomStyleServices', 'CustomTabControl', 'CustomToggleSwitch', 'DateTimePicker', 'DelphiDefaultContainer', 'DelphiDefaultIterator', 'DelphiMethod', 'DrawGrid', 'Edit', 'FileOpenDialog', 'Form', 'FreeConsole', 'Graphic', 'GroupBox', 'Header', 'IDABORT', 'IDCANCEL', 'IDCLOSE', 'IDCONTINUE', 'IDHELP', 'IDIGNORE', 'IDNO', 'IDOK', 'IDRETRY', 'IDTRYAGAIN', 'IDYES', 'Icon', 'Image', 'Label', 'LabeledEdit', 'LinkControlDelegate', 'LinkControlToField', 'LinkControlToFieldDelegate', 'LinkListControlToField', 'LinkPropertyToField', 'LinkPropertyToFieldDelegate', 'ListBox', 'MB_ABORTRETRYIGNORE', 'MB_APPLMODAL', 'MB_DEFBUTTON1', 'MB_DEFBUTTON2', 'MB_DEFBUTTON3', 'MB_DEFBUTTON4', 'MB_HELP', 'MB_ICONASTERISK', 'MB_ICONERROR', 'MB_ICONEXCLAMATION', 'MB_ICONHAND', 'MB_ICONINFORMATION', 'MB_ICONQUESTION', 'MB_ICONSTOP', 'MB_ICONWARNING', 'MB_NOFOCUS', 'MB_OK', 'MB_OKCANCEL', 'MB_RETRYCANCEL', 'MB_SYSTEMMODAL', 'MB_TASKMODAL', 'MB_YESNO', 'MB_YESNOCANCEL', 'MainMenu', 'MediaPlayer', 'Memo', 'Menu', 'MenuItem', 'Metafile', 'Monitor', 'Notebook', 'NumberBox', 'Object', 'OpenDialog', 'Page', 'PageControl', 'PaintBox', 'Panel', 'PascalInterface', 'PascalRecord', 'Persistent', 'Picture', 'Point', 'PopupMenu', 'PrototypeBindSource', 'RadioButton', 'RadioGroup', 'Rect', 'Screen', 'ScrollBar', 'Shape', 'ShowMessage', 'Size', 'SpeedButton', 'SpinButton', 'SpinEdit', 'Splitter', 'StaticText', 'StringGrid', 'Strings', 'StyleInfo', 'StyleManager', 'StyleServices', 'TabControl', 'TabSheet', 'Timer', 'ToggleSwitch', 'ToolBar', 'ToolButton', 'TrackBar', 'VarParameter', 'WinControl', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'bkAbort', 'bkAll', 'bkCancel', 'bkClose', 'bkCustom', 'bkHelp', 'bkIgnore', 'bkNo', 'bkOK', 'bkRetry', 'bkYes', 'caFree', 'caHide', 'caMinimize', 'caNone', 'cl3DDkShadow', 'cl3DLight', 'clActiveBorder', 'clActiveCaption', 'clAppWorkSpace', 'clAqua', 'clBackground', 'clBlack', 'clBlue', 'clBtnFace', 'clBtnHighlight', 'clBtnShadow', 'clBtnText', 'clCaptionText', 'clCream', 'clDefault', 'clDkGray', 'clFuchsia', 'clGradientActiveCaption', 'clGradientInactiveCaption', 'clGray', 'clGrayText', 'clGreen', 'clHighlight', 'clHighlightText', 'clHotLight', 'clInactiveBorder', 'clInactiveCaption', 'clInactiveCaptionText', 'clInfoBk', 'clInfoText', 'clLime', 'clLtGray', 'clMaroon', 'clMedGray', 'clMenu', 'clMenuBar', 'clMenuHighlight', 'clMenuText', 'clMoneyGreen', 'clNavy', 'clNone', 'clOlive', 'clPurple', 'clRed', 'clScrollBar', 'clSilver', 'clSkyBlue', 'clTeal', 'clWhite', 'clWindow', 'clWindowFrame', 'clWindowText', 'clYellow', 'fsBorder', 'fsSurface', 'gdFixed', 'gdFocused', 'gdSelected', 'mdNearest', 'mdNull', 'mdPrimary', 'mrAbort', 'mrAll', 'mrCancel', 'mrIgnore', 'mrNo', 'mrNoToAll', 'mrNone', 'mrOk', 'mrRetry', 'mrYes', 'mrYesToAll', 'ssAlt', 'ssCtrl', 'ssDouble', 'ssLeft', 'ssMiddle', 'ssRight', 'ssShift'] >>> form = vcl.Form(None) >>> dir(form) ['Action', 'Active', 'ActiveControl', 'ActiveMDIChild', 'ActiveOleControl', 'AfterConstruction', 'Align', 'AlignDisabled', 'AlignWithMargins', 'AlphaBlend', 'AlphaBlendValue', 'Anchors', 'ArrangeIcons', 'Assign', 'AutoScroll', 'AutoSize', 'BeforeDestruction', 'BeginDrag', 'BeginInvoke', 'BiDiMode', 'BindMethodsToEvents', 'BorderIcons', 'BorderStyle', 'BorderWidth', 'BoundsRect', 'BringToFront', 'Broadcast', 'Brush', 'CPP_ABI_1', 'CPP_ABI_2', 'CPP_ABI_3', 'CanFocus', 'Canvas', 'Caption', 'Cascade', 'CheckNonMainThreadUsage', 'ClassInfo', 'ClassName', 'ClassNameIs', 'ClassParent', 'ClassType', 'CleanupInstance', 'ClientHandle', 'ClientHeight', 'ClientOrigin', 'ClientRect', 'ClientToParent', 'ClientToScreen', 'ClientWidth', 'Close', 'CloseQuery', 'Color', 'ComObject', 'ComponentCount', 'ComponentIndex', 'ComponentState', 'ComponentStyle', 'Components', 'Constraints', 'ContainsControl', 'ControlAtPos', 'ControlCount', 'ControlState', 'ControlStyle', 'Controls', 'Create', 'CreateNew', 'CreateParented', 'CreateParentedControl', 'Ctl3D', 'CurrentPPI', 'Cursor', 'CustomHint', 'CustomTitleBar', 'DefaultHandler', 'DefaultMonitor', 'DefocusControl', 'DesignInfo', 'Designer', 'Destroy', 'DestroyComponents', 'Destroying', 'DisableAlign', 'DisableAutoRange', 'Dispatch', 'DisposeOf', 'Dock', 'DockClientCount', 'DockDrop', 'DockManager', 'DockOrientation', 'DockSite', 'DoubleBuffered', 'DragDrop', 'DragKind', 'DragMode', 'Dragging', 'DrawTextBiDiModeFlags', 'DrawTextBiDiModeFlagsReadingOnly', 'DropTarget', 'EnableAlign', 'EnableAutoRange', 'Enabled', 'EndDrag', 'EndFunctionInvoke', 'EndInvoke', 'Equals', 'ExecuteAction', 'ExplicitHeight', 'ExplicitLeft', 'ExplicitTop', 'ExplicitWidth', 'FieldAddress', 'FindChildControl', 'FindComponent', 'FlipChildren', 'Floating', 'FloatingDockSiteClass', 'FocusControl', 'Focused', 'Font', 'FormState', 'FormStyle', 'Free', 'FreeInstance', 'FreeNotification', 'FreeOnRelease', 'GetChildren', 'GetControlsAlignment', 'GetEnumerator', 'GetFormImage', 'GetHashCode', 'GetInterface', 'GetInterfaceEntry', 'GetInterfaceTable', 'GetNamePath', 'GetParentComponent', 'GetStyleName', 'GetSystemMetrics', 'GetTabControlList', 'GetTabOrderList', 'GetTextBuf', 'GetTextLen', 'GlassFrame', 'Handle', 'HandleAllocated', 'HandleNeeded', 'HasParent', 'Height', 'HelpContext', 'HelpFile', 'HelpKeyword', 'HelpType', 'Hide', 'Hint', 'HorzScrollBar', 'HostDockSite', 'Icon', 'InheritsFrom', 'InitInstance', 'InitiateAction', 'InsertComponent', 'InsertControl', 'InstanceSize', 'Invalidate', 'IsCustomStyleActive', 'IsDrawingLocked', 'IsImplementorOf', 'IsLightStyleColor', 'IsRightToLeft', 'IsShortCut', 'KeyPreview', 'LRDockWidth', 'Left', 'LoadProps', 'LockDrawing', 'MDIChildCount', 'MakeFullyVisible', 'ManualDock', 'ManualFloat', 'Margins', 'Menu', 'MethodAddress', 'MethodName', 'ModalResult', 'Monitor', 'MouseInClient', 'MouseWheelHandler', 'Name', 'NewInstance', 'Next', 'ObjectMenuItem', 'Observers', 'OleFormObject', 'OnActivate', 'OnAfterMonitorDpiChanged', 'OnAlignInsertBefore', 'OnAlignPosition', 'OnBeforeMonitorDpiChanged', 'OnCanResize', 'OnClick', 'OnClose', 'OnCloseQuery', 'OnConstrainedResize', 'OnContextPopup', 'OnCreate', 'OnDblClick', 'OnDeactivate', 'OnDestroy', 'OnDockDrop', 'OnDockOver', 'OnDragDrop', 'OnDragOver', 'OnEndDock', 'OnGesture', 'OnGetSiteInfo', 'OnHelp', 'OnHide', 'OnKeyDown', 'OnKeyPress', 'OnKeyUp', 'OnMouseActivate', 'OnMouseDown', 'OnMouseEnter', 'OnMouseLeave', 'OnMouseMove', 'OnMouseUp', 'OnMouseWheel', 'OnMouseWheelDown', 'OnMouseWheelUp', 'OnPaint', 'OnResize', 'OnShortCut', 'OnShow', 'OnStartDock', 'OnUnDock', 'Owner', 'Padding', 'PaintTo', 'Parent', 'ParentBiDiMode', 'ParentCustomHint', 'ParentDoubleBuffered', 'ParentFont', 'ParentToClient', 'ParentWindow', 'Perform', 'PixelsPerInch', 'PopupMenu', 'PopupMode', 'PopupParent', 'Position', 'PreProcessMessage', 'Previous', 'Print', 'PrintScale', 'QualifiedClassName', 'Realign', 'RecreateAsPopup', 'RedrawDisabled', 'ReferenceInterface', 'Refresh', 'Release', 'RemoveComponent', 'RemoveControl', 'RemoveFreeNotification', 'Repaint', 'ReplaceDockedControl', 'SafeCallException', 'ScaleBy', 'ScaleFactor', 'ScaleForCurrentDPI', 'ScaleForPPI', 'ScaleRectSize', 'ScaleValue', 'Scaled', 'ScreenSnap', 'ScreenToClient', 'ScrollBy', 'ScrollInView', 'SendCancelMode', 'SendToBack', 'SetBounds', 'SetDesignVisible', 'SetFocus', 'SetFocusedControl', 'SetParentComponent', 'SetProps', 'SetSubComponent', 'SetTextBuf', 'Show', 'ShowHint', 'ShowModal', 'Showing', 'SnapBuffer', 'StyleElements', 'StyleName', 'TBDockHeight', 'TabOrder', 'TabStop', 'Tag', 'TaskbarHandler', 'Tile', 'TileMode', 'TipMode', 'ToList', 'ToString', 'ToTuple', 'Top', 'Touch', 'TransparentColor', 'TransparentColorValue', 'UndockHeight', 'UndockWidth', 'UnitName', 'UnitScope', 'UnlockDrawing', 'Update', 'UpdateAction', 'UpdateControlState', 'UpdateDesignerCaption', 'UseDockManager', 'UseRightToLeftAlignment', 'UseRightToLeftReading', 'UseRightToLeftScrollBar', 'VCLComObject', 'VertScrollBar', 'Visible', 'VisibleDockClientCount', 'WantChildKey', 'Width', 'WindowMenu', 'WindowProc', 'WindowState', '__bound__', '__dir__', '__owned__', 'set_PopupParent'] >>>
  21. shineworld

    Zip Compression library

    Sincerely I don't know where to find a more updated code. I use it for years and for what I need works fine so never tried more updated versions.
  22. shineworld

    Zip Compression library

    Without to use 7z.dll there is a pure pascal implementation that I've used and works fine: LZMA.442b.7z
  23. shineworld

    Looking for a localization tool

    In my projects, I use dxgettext with PoEdit pro, which creates an internal net DBase of translated terms, so any old translation, made by me or my colleagues can be fastly re-used. It also permits auto-translations using Microsoft Translation tools, Deepl (if you have a pro account), etc. It has also a free version so end-customers can translate the programs to their native language with total autonomy, because gettext translations are in extern .mo files (but can also be embedded in the EXE if you want).
  24. shineworld

    First Python + DelphiVCL Program

    Good, after a long time stressing this forum, especially the Python4Delphi channel, with lots of rookie requests, I got to a good point with the development of my first Python program. Until a few months ago I had always ignored Python and its possibilities as Delphi has always been a tool with which I create all my works and I have never thought of anything else. When Python4Delphi and DelphiVCL showed up I wondered if I could do something interesting with both and I must admit that although Python was completely new land to me, the fact of sticking with Delphi anyway took away any doubt. .. I had to try. Basically, the program is pure Python (after being compiled with Cython), an embedded version, with the addition of DelphiVCL (I've never used FMX so it's better to start from the VCL that I know very well) and some Python modules made in Delphi where I put the more delicate parts and in use real threads and not "crippled" threads by the GIL. I anticipate, it is nothing transcendental, but as a first Python project, I am satisfied with it. Description of video In this short video, we can see the execution of an external program written in Python for the holding of print markers necessary to calculate the zero machining, the rotation of the piece on the work table, and all the scaling needed to compensate for the error of model printing between CAD and plotter printer. The Python program interacts directly with the CNC that moves the XYZ axes for the final cut through an API Client (cnc_api_client_core in PyPi) to the CNC control software API Server, retrieving information and sending direct commands to the CNC System. Image capture is done using a proprietary IP Camera equipped with LED lighting. The Python program is executed through an embedded version of the language prepared with all the necessary tools and allows two UI, vertical and horizontal, to adapt to all types of monitors. NOTE: The below CNC Control Software is 100% made with Delphi 🙂 Many Thanks to forum people for the support!
  25. shineworld

    First Python + DelphiVCL Program

    Thanks for the suggestion I will go and look at it. There is another aspect behind the scenes about the choice to use Python. In the whole office the only one who uses and knows Delphi and object pascal is me, while my colleagues have been using Python for support projects for a long time already, so creating a framework that is based on Python + extra extensions made ad hoc with Delphi allows me to relieve myself from future work on the Vision compartment to devote myself to something else. This is the reason why, when I can, I prefer to create tools that others use and not take a complete, specific project all the way through. My mathematical background, compared to that of some of the team members, is basic, and they in python will surely be able to solve more elegantly and efficiently cases where my limitations will only get in the way.
×