Jump to content

shineworld

Members
  • Content Count

    280
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by shineworld

  1. shineworld

    TTouchKeyboard when in modal dialog

    Doesn't works also when edit fields are focused. Seems that I've to move my TProgramSettingsForm contents, place it in a TFrame and remain in MainForm where TTouchKeyboard is instanced, or perhaps I've to free the TTouchKeyboard from Main form, re-create it in the TProgramSettings modal Form and assign as Parent the container in MainForm so look doesn't change but is in same message pool.
  2. shineworld

    How to compare performance between Delphi versions?

    Do you have the tweaks rules to run Delphi 2006 on W10 ? Would be amazing for me can use that in W10. I've do modify a program which uses pro-cameras with PCI camera board and in this case I need to develop in VM (XP), copy the exe in W10 and try without debug... inserting tons of logs but it is very hard...
  3. shineworld

    How to compare performance between Delphi versions?

    I was used with the development in VMWare VM's with BDS2006 for simple reasons: - BDS2006 doesn't work with W10 (my guest) and I need to run it on XP (host). - Often I need to save the entire VM because the update of 3rd party libraries in time adds incompatibilities to old projects. So I save a full image related to a big project to restore it when I need to re-open and modify that project. I never tried to install RIO or SYDNEY in VM, I don't know if is permitted...
  4. shineworld

    How to compare performance between Delphi versions?

    I run 10.3 at home and 10.4.1 at the office (I'm always working.... but this is another question). At skin 10.3 32-bits exe are a lot slower than 10.4.1, with same libraries (almost all at least) but I will create test units to check better... Either PCs are I7 with 16GB of ram and W10 20H2. Unfortunately, a double SSD corruption, for a damaged motherboard SATA compart, finished my Delphi installations count, so when I'm not at the office, I need to use the old 10.3 in-home laptop. In this case, I need to keep different versions of DFM (incompatible when from Rio I open Sydney modified files).
  5. Hi all, I've migrated my application to the latest Indy10 sources. A very good library, congrats to developers. Now I would like to improve my research devices on the net feature. In few words, my IoT devices implement a UDP service to respond to a broadcast UDP request of identification. When IoT sends a reply to discover software uses the IoT IP address so after I can, for example, use other messages to change the IoT device programmed IP. Actually, the system works BUT depends on what network adapter will route the discover software broadcast message. For example, I've collected the Network Adapters in my system before to send discover UPD packet as a broadcast message: At this point clicking on the Change IP button a form make the broadcast search using this code: procedure TConfiguratorView.SearchClick(Sender: TObject); var S: string; procedure AddInteger(var Buffer: string; Value: Integer); var ValueData: array [0..3] of Byte absolute Value; begin Buffer := Buffer + Char(ValueData[3]); Buffer := Buffer + Char(ValueData[2]); Buffer := Buffer + Char(ValueData[1]); Buffer := Buffer + Char(ValueData[0]); end; begin // shows advice message about network routing question if Sender <> nil then begin case ShowCustomMessage ( _('Info About Search'), _('Select desired option:'), _('Search Message could be routed by OS in a wrong Network Interface so if, after a Search, you don''t find any ' + 'CNC Board try again disabling any Network Interface not connected with the CNC Board.\n\n' + 'PS: If you are in a Virtual Machine the Network Adapter must be in BRIDGED MODE.'), '', [ _('Continue'), _('Abort') ] ) of 101: Exit; end; end; // stores serial number selected if GetActiveQMoveInfo = nil then FSerialNumberSelected := 0 else FSerialNumberSelected := GetActiveQMoveInfo.SerialNumber; // clears qmove list content QMoveListClear; // inits and starts searching phase FUDPServer.Bindings.Clear; with FUDPServer.Bindings.Add do begin IP := '0.0.0.0'; Port := 5001; end; FUDPServer.Active := True; SearchTimer.Interval := SEARCH_TIME; SearchTimer.Enabled := True; // sends broadcast find command if FSerialNumber = 0 then FUDPServer.Broadcast(QMOVE_ETHERNET_HEAD + Char(QMOVE_ETHERNET_VERSION) + QMOVE_EHTERNET_FIND_COMMAND, QMOVE_ETHERNET_SEARCHING_PORT, '', IndyTextEncoding(enc8Bit)) else begin S := ( QMOVE_ETHERNET_HEAD + Char(QMOVE_ETHERNET_VERSION) + QMOVE_EHTERNET_FIND_COMMAND + #226#64 ); AddInteger(S, FSerialNumber); FUDPServer.Broadcast(S, QMOVE_ETHERNET_SEARCHING_PORT, '', IndyTextEncoding(enc8Bit)); FSerialNumber := 0; end; // refreshes objects RefreshObjects; end; When the PC has only one Network Adapter (eg: the LAN) the system work always. When there are more than one Network Adapter depends on where the windows "route" the UDP packets so I need to require to end-user to manually disable temporarily any other Network Adapter (eg: WIFI, VMWare Network Adapters, etc.). There is a way to specify to UDP server to send a broadcast to a specific network adapter (eg: 192.168.x.x) instead to use an unknown default? Thank you in advance for your suggestions Silverio
  6. shineworld

    INDY UDP broadcast to a specific Network

    Sorry I've made a mistake to write a demo code manually. What I have: - A PC with many network adapters (actually there are 4 LAN ports, 1 wifi, and adapters from VMWare and Virtual Box). - The IoT devices will be placed by customers in some of the available Network Adapters (I don't know what and perhaps also the customers don't know exactly what LAN will be). - Any IoT device has a UDP client who listening to a port (1460) for discovery. - Any IoT device has IP/MASK/IP Ports and TCP Clients ports bound to them. - A user starts the IoT device Discovery in all the net. - The Discovery System uses a TIdUPDServer bind to the port 5001 to any net - no net address (0.0.0.0) to receive any UDP packet from any network returning to the 5001 port. At this point, I can call: for I := 0 to FNetworksList.Count - 1 do FUDPServer.Broadcast(S, QMOVE_ETHERNET_SEARCHING_PORT, FNetworksList[I].BroadCastIPForThisNA , IndyTextEncoding(enc8Bit)); The UDP Server sent the UDP discovery packet to any Network Adapter and if in the network adapter there is an IoT device it will respond to discovery software using a UDP packet at port 5001 (where discovery software is listening for any net) using the destination IP (where discovery software lives) contained in the received discovery packet. OK, this works perfectly now. At this point I would like to understand what you wrote: I'm sorry for the question, I'm an occasional user of network things, and I don't have any deep knowledge background in the matter.
  7. shineworld

    INDY UDP broadcast to a specific Network

    I've tried to place some number (IP Broadcast for the network adapter in Binding but I gel always a socket error): // inits and starts searching phase FUDPServer.Active := False; FUDPServer.Bindings.Clear; with FUDPServer.Bindings.Add do begin IP := '192.168.0.255'; Port := 5001; end; with FUDPServer.Bindings.Add do begin IP := '192.168.120.255'; Port := 5001; end; FUDPServer.BroadcastEnabled := True; FUDPServer.Active := True; The resulting approach, at moment, was to define in what network adapter has to perform the scan:
  8. shineworld

    INDY UDP broadcast to a specific Network

    I guess to have solved! I'm very dumb in network things, so I can mistake anything. Calling: FUDPServer.Broadcast(S, QMOVE_ETHERNET_SEARCHING_PORT, '', IndyTextEncoding(enc8Bit)); The library changes the IP destination address ' ' as 255.255.255.255 and uses the default route adapter from the Windows OS list. If I change the ' ' with the Broadcast IP of the desired network adapter then the packet is routed correctly and I can get a reply from devices in that net.
  9. shineworld

    XML Parsing and Processing

    Very interesting project. I will try to move to it !!!
  10. shineworld

    XML Parsing and Processing

    Actually, I use MSXML only for 32-bit applications (never done 64bit at moment) To increase the amount of memory I use FastMM with these options: {$IFDEF USES_EMBEDDED_FASTMM_MEMORY_MANAGER} {$IFDEF USES_FASTMM_OLD} {$SetPEFlags $20} {$DEFINE USES_FASTMM} FastMM4 in 'sources\memory-managers\FastMM4-old\FastMM4.pas', FastMM4Messages in 'sources\memory-managers\FastMM4-old\FastMM4Messages.pas', {$ENDIF} {$IFDEF USES_FASTMM_NEW} {$SetPEFlags $20} {$DEFINE USES_FASTMM} FastMM4 in 'sources\memory-managers\FastMM4-new\FastMM4.pas', FastMM4Messages in 'sources\memory-managers\FastMM4-new\FastMM4Messages.pas', {$ENDIF} {$IFDEF USES_FASTMM_AVX} {$SetPEFlags $20} {$DEFINE USES_FASTMM} FastMM4 in 'sources\memory-managers\FastMM4-AVX\FastMM4.pas', FastMM4Messages in 'sources\memory-managers\FastMM4-AVX\FastMM4Messages.pas', {$ENDIF} {$ENDIF} In this FastMM.inc file I can choose three different FastMM versions. "{$SetPEFlags $20}" extends the 2GB limits of Win32. I don't know if that influence also MSXML but Delphi program memory increases a lot. I use also a lot of attributes (XMLMemento uses them to store data) but I did not reach thousand elements. I'm searching for a good native Delphi library to substitute MSXML and have all in Delphi project...
  11. shineworld

    XML Parsing and Processing

    I'use MSXML for many years and works very fine and fast. However, I've implemented a consumer class to realize a simplified version of Memento and Persistable interfaces. The memento support also XPath search. memento.7z osExceptionUtils.pas osSysUtils.pas
  12. Hi to all. I've yet a lot of D2006 projects that I will not move to Sydney. All of them use Indy 9 as the default installed library. For one project I would like to move to Indy10. In this project, all Indy objects/class will be created at code level (none reference in DFMs). There is a way to keep Indy 9 libraries in the IDE system BUT only for this project use Indy10 sources (for example embedding Indy10 in project sources ) ? Thank you in advance for your replies!
  13. shineworld

    Delphi 2006 Indy9 and Indy10 swtich

    At this point, the last question. Where I can find the latest version of Indy10 compatible with BDS2006? I guess that Indy10 in BDS is very very old 🙂
  14. shineworld

    Keep D2006 vs Sydney aligned

    Hi all. I'm moving a big project from D2006 to Sydney. Required changes are very few after few changes in the original sources D2006 files so I can maintain either version. Why that? D2006 is a killer, all work perfectly and well tested. I can't say this for Sydney which crashes often, overall during debug. The reason to move is to add support of Unicode. The program still remains a 32-bit application. But there is a problem. With source code and very few $DEFINE, I can manage the differences and keep a clean source code. With DFM, unfortunately, I've found some differences, for example in TLabel. In BDS2006 the TLabel is for default Transparent = False so for any DFM there is not this property value. In Sydney, the TLabel is for default Transparent = True so the resulting View is very UGLY and needs to manually fix every time. Other object's properties are different. How to solve this incompatibility? There is a document that describes differences? There is a tool to automate the conversions? I have about 30 views and 40 frames with related DFM...
  15. shineworld

    Keep D2006 vs Sydney aligned

    I guess to re-engineering the software after conversion is finished, using templates, more frames to common UI parts... I was in doubt to move software from D2006 to XE some years ago, then to Rio, and now to Sydney. D2006 is a killer environment, with very very few issues, robust and every EXE produced is working without oddities or bugs. When tried XE I've found a lot of IDE bugs, crashes, etc. Same with Rio and unfortunately also with Sydney which crashes often during development. At this point, I need to move to a UNICODE tool, and overall update a lot of used 3rd party libraries that are very old and not keep steps of time. In these years I have always purchased the outgoing Delphi versions but never used them... When a thing works why change? was the mainline thought.
  16. shineworld

    Keep D2006 vs Sydney aligned

    In D2006 DoubleBuffered is always set to False by default. Switching between TabSheet there is an ugly flashing paint (for eg). I've set programmatically the interesting fields to use DoubleBuffered and flash disappears. I find it bad to program some properties directly on form objects (there are hundreds of objects in a configuration panel someone can be missed). Also events managers, OnClick, Onxxx, are programmatically added to edit fields, and so on. My code is a mix of form designer results and code to simplify the design part.
  17. shineworld

    Keep D2006 vs Sydney aligned

    I've made an UGLY program to open programmatically the DFM and apply changes to TLabel, TPanel, and other objects that changes defaults with some fixed rules linked to my way to design form and seem to works. The UI result is good, also in grids and panels which was been unviewable before. Now all works as aspected! Thank you for your suggestions!
  18. shineworld

    Keep D2006 vs Sydney aligned

    Frames don't use yet a common ancestor... This is a very old project grown a lot in years and suffers from my ignorance about Delphi framework features. Initially converted from an old VB6 program. I've tried the in-code solution and works. I already walk the form components in FormCreate to define some properties. Is ugly, because in view DFM is yet wrong, but during run works. // sets access levels grid AccessLevelsGrid.RowCount := 1 + FSettings.AccessLevelManager.Count; AccessLevelsGrid.DoubleBuffered := True; // assigns run-time events RVSpectraFrame.OnChange := WavelengthChange; RZSpectraFrame.OnChange := WavelengthChange; // sets components double buffered & transparent C := ComponentCount - 1; for I := 0 to C do begin Component := Components[I]; if Component is TCheckBox then begin TCheckBox(Component).DoubleBuffered := True; Continue; end; if Component is TComboBox then begin TComboBox(Component).DoubleBuffered := True; Continue; end; if Component is TEdit then begin TEdit(Component).DoubleBuffered := True; Continue; end; if Component is TPanel then begin TPanel(Component).DoubleBuffered := True; Continue; end; if Component is TTabSheet then begin TTabSheet(Component).DoubleBuffered := True; Continue; end; {$IFDEF VER340} if Component is TLabel then begin TLabel(Component).Transparent := False; Continue; end; {$ENDIF} end; // sets custom descriptions grid elements UserInputDescriptions.RowCount := I_O.MAX_DIGITAL_INPUTS + 1; UserOutputDescriptions.RowCount := I_O.MAX_DIGITAL_OUTPUTS + 1; AnalogInputDescriptions.RowCount := I_O.MAX_ANALOG_INPUTS + 1; AnalogOutputDescriptions.RowCount := I_O.MAX_ANALOG_OUTPUTS + 1; I will try with the Interposer class way...
  19. shineworld

    Quickly zero all local variables?

    I'm used to placing a procedure Init in any record so is simple to set defaults according to data types of records. PCompileArguments = ^TCompileArguments; TCompileArguments = record Mode: TCompileMode; Code: string; X: Extended; Y: Extended; Z: Extended; A: Extended; B: Extended; C: Extended; ToolPathMode: TToolPathMode; Line: Cardinal; FirstCmdId: Cardinal; LastLine: Cardinal; LastCmdId: Cardinal; procedure Assign(Source: PCompileArguments); overload; procedure Assign(Source: TCompileArguments); overload; procedure Init; overload; procedure Init(Mode: TCompileMode; const Code: string; X, Y, Z, A, B, C: Extended; ToolPathMode: TToolPathMode; Line, FirstCmdId, LastLine, LastCmdId: Cardinal); overload; function LoadFromMemento(Memento: IMemento): Boolean; function SaveToMemento(Memento: IMemento): Boolean; end;
  20. shineworld

    AnsiPos and AnsiString

    Hi all. I'm getting crazy with old software (Delphi 2006) port to Sydney about AnsiPos of an AnsiString: function TTCPBin01.GetTargetAnswer: AnsiString; begin Result := FTargetAnswer; end; .. .. if AnsiPos('?y', GetTargetAnswer) <> 0 then begin FErrorCode := sigc_None; FErrorMessage := SignalMessage(FErrorCode); Result := qmct_Prog; end GetTargetAnswer return an AnsiString. Also using AnsiPos to check for a substring in the resulting string the compiler notice me: [dcc32 Warning] osTCPBin01.pas(224): W1057 Implicit string cast from 'AnsiString' to 'string'. Placing the mouse cursor on AnsiPos the HINT some time notice me: function (const SubStr: string; const S: string): Integer; Other times notice me: function (const SubStr: AnsiString; const S: AnsiString): Integer; In either case however the compiler notice Implicit cast... Have you any suggestion about? Best regards Silverio Diquigiovanni
  21. shineworld

    AnsiPos and AnsiString

    You are right! I will move all to arrays of bytes. Unfortunately, a lot of old functions assumed a string as an array of chars sometimes cast to bytes. I need to change the entire set of them, it's the only valid solution.
  22. shineworld

    AnsiPos and AnsiString

    I've moved almost all software from (Ansi)string of BDS2006 to string of Sydney. This is a little part of TCP connection to our embedded boards which uses old (Ansi)string and I just would to keep it as is, because works and is a little bit complicated; access to return strings as array of bytes for many algorithms (crypt, compressing, CRC, hashing, etc.).
  23. shineworld

    Getit update

    Hi all, I'm used with git and take updated 3rd parties repositories. With Sydney I've begun to use GetIt, for eg. with SynEdit. How Getit is supposed to manage the updates ? Looking at the Getit web page synedit is update to 20 december. In my Getit syndey page the date is previous september. Catalog repositories don't have git so I need to uninstall and reinstall the packegs with Getit ?
  24. If you can define a palette of accepted colors you can check the color closer to one of the palette. In past, I've made a program with fixed palette colors and I need to import PNG or other formats and convert them to a palletized bmp. Attached a very old pas file, used in a Borland Builder C++ 3.0, that I've used to reduce any color to a palletized color. Function RecuceColors. Is very old however... my caller: Graphics::TBitmap* __fastcall QImageManager::CreateBitmapPaletteFromBitmap24BPP(Graphics::TBitmap* Bitmap) { if (FPalette != NULL && FPalette->ColorCount != 0) { // creates paletted bitmap Graphics::TBitmap* BitmapPalette = ReduceColors ( Bitmap, rmPalette, dmNearest, FPalette->ColorBits, FPalette->HPalette ); return BitmapPalette; } else return NULL; } ColorFunctions.pas
  25. Oh, world.... I don't know about that... I'm a little bit angrier now. The HASP keys aren't cheap at all (we spend more than $50 each dongle)... 90% of our software is freeware because made for specific hardware to work (we sell hardware, not software). But 10% (customer-specific programs) use HASP dongle to recover a minimal part of development costs...
×