Jump to content

Shrinavat

Members
  • Content Count

    70
  • Joined

  • Last visited

  • Days Won

    3

Shrinavat last won the day on December 27 2023

Shrinavat had the most liked content!

Community Reputation

16 Good

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thank you for the suggestion! Using a sorted CSV file with a dedicated comparison tool sounds like a very interesting and potentially robust approach. I'll definitely explore this option further. Thanks for sharing the XML example. I'm already familiar with saving the configuration in XML format 🙂. However, my main challenge lies in efficiently comparing two XML files to identify meaningful changes. I'm open to suggestions on how to best approach this comparison aspect. That's an interesting idea using SQLite. My main concern with a database approach is the unknown and variable number of fields. I'm not sure how to design the database structure to accommodate this and still allow for easy comparison between different snapshots. Could you elaborate on how you envision structuring the database to handle this dynamic nature and facilitate efficient comparisons?
  2. Hello everyone, I'm working on a utility that gathers PC configuration information and displays it in a TTree component. I want to be able to save this information to a file so that it can be compared with a similar file created at a later time. This would allow me to detect any changes in the PC's configuration, such as adding or removing hardware components. My main challenge is deciding on the best format to store this data for easy comparison and change detection. I've considered options like JSON, XML, and plain text, but I'm unsure which would be most suitable. A simple line-by-line comparison of a text file might not be reliable, as the order of components could change without signifying an actual configuration change (e.g., reordering hard drives). Could anyone offer advice on the best approach for storing and comparing this type of data? Are there any specific technologies or libraries that would be helpful for this task? Any guidance would be greatly appreciated!
  3. Thanks for the feedback! I ended up implementing a modified ROT13 algorithm with a custom alphabet, as shown in the code below. Initial tests indicate that it meets my requirements effectively. const ALL_CHARACTERS_CONSTANT = '!#$%&()*+,-./:;<=>?@[\]^_`{|}~0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя'; function ROT13Encrypt(const Input: string): string; var idx, newIdx: Integer; halfLength: Integer; begin Result := ''; halfLength := Length(ALL_CHARACTERS_CONSTANT) div 2; for var i := 1 to Length(Input) do begin idx := Pos(Input[i], ALL_CHARACTERS_CONSTANT); if idx > 0 then begin newIdx := ((idx - 1 + halfLength) mod Length(ALL_CHARACTERS_CONSTANT)) + 1; Result := Result + ALL_CHARACTERS_CONSTANT[newIdx]; end else Result := Result + Input[i]; end; end; function ROT13Decrypt(const Input: string): string; begin // ROT13 decryption is the same as encryption in this case Result := ROT13Encrypt(Input); end;
  4. Thank you for your insights. I understand the challenges involved in meeting both requirements simultaneously. I'm willing to remove the constraint that "The obfuscated string must contain only Latin letters and digits." Revised requirements: The obfuscated string can contain any printable characters. The obfuscated string must have the same length as the original string. Strong cryptographic security is not required. The input strings will generally not exceed 30 characters in length. With this revised requirement, are there any suitable algorithms or approaches you could suggest for implementing the obfuscation and deobfuscation functions?
  5. How can I implement functions for basic string obfuscation and deobfuscation in Delphi, where the input string can contain Latin and Cyrillic letters, digits, and special characters !@#$%^&*()_+-=[]{}\|;':",./<>? Requirements: The obfuscated string must contain only Latin letters and digits. The obfuscated string must have the same length as the original string. Strong cryptographic security is not required. I'm looking for a simple solution that can handle a variety of characters and maintain the original string length. Any suggestions or code examples would be greatly appreciated.
  6. The issue stemmed from how variables were captured within the closure passed to Parallel.Async. The loop variable i was not correctly captured, leading to incorrect values being used in the background tasks. The following code demonstrates my working solution: procedure Test; var arr_id: TArray<LongWord>; arr_ip: TArray<string>; procedure CreatePingTask(const id: LongWord; const ip: string); begin Parallel.Async( procedure (const task: IOmniTask) var PingResult: Boolean; begin // background thread // Simulate ping PingResult := Random(2) = 1; // random result for demonstration Sleep(Random(5000)); // simulate ping delay // in the main thread task.Invoke( procedure begin mmoLog.Lines.Add(Format('PingResult=%s, rec_id=%d, rec_ip=%s', [PingResult.ToString, id, ip])); end); end); end; begin arr_id := [1,2,3,4,5,6,7]; arr_ip := ['192.168.16.1','192.168.16.2','192.168.16.3','192.168.16.4','192.168.16.5','192.168.16.6','192.168.16.7']; for var i := Low(arr_id) to High(arr_id) do CreatePingTask(arr_id[i], arr_ip[i]); end; Explanation: To ensure each background task receives the correct ID and IP, we pass them as parameters to the CreatePingTask procedure. This creates a separate copy of the variables for each task. task.Invoke is used to synchronize with the main thread and update the UI with the ping results. This approach ensures that each host is pinged exactly once and the results are processed correctly in the main thread. I'd love to get some expert opinions on my solution. Are there any "gotchas" I should be watching out for?
  7. I'm using the Async abstraction from the OmniThreadLibrary to ping multiple hosts in background threads (one thread per host). In the main thread, I want to perform some actions with the ping results based on the host ID. Here's a simplified version of my code: procedure Test; var arr_id: TArray<LongWord>; arr_ip: TArray<string>; begin arr_id := [1,2,3,4,5,6,7]; arr_ip := ['192.168.16.1','192.168.16.2','192.168.16.3','192.168.16.4','192.168.16.5','192.168.16.6','192.168.16.7']; for var i := Low(arr_id) to High(arr_id) do begin Parallel.Async( procedure (const task: IOmniTask) var PingResult: Boolean; rec_id: LongWord; rec_ip: string; begin // background thread rec_id := arr_id[i]; rec_ip := arr_ip[i]; // PingResult := PingHost(rec_ip); // in the main thread task.Invoke( procedure begin // some actions with ping results based on host ID mmoLog.Lines.Add(Format('rec_id=%d, rec_ip=%s', [rec_id, rec_ip])); end); end); end; end; I'm getting inconsistent results. For example: rec_id=3, rec_ip=192.168.16.3 rec_id=3, rec_ip=192.168.16.3 rec_id=135299280, rec_ip=烬Ŧ rec_id=135299280, rec_ip=烬Ŧ rec_id=135299280, rec_ip=烬Ŧ rec_id=135299280, rec_ip=烬Ŧ rec_id=135299280, rec_ip=烬Ŧ or rec_id=2, rec_ip=192.168.16.2 rec_id=3, rec_ip=192.168.16.3 rec_id=4, rec_ip=192.168.16.4 rec_id=7, rec_ip=192.168.16.7 rec_id=7, rec_ip=192.168.16.7 rec_id=7, rec_ip=192.168.16.7 rec_id=135299280, rec_ip=烬Ŧ Not all IPs are being pinged, and some are pinged multiple times. Also, I get garbage data in some cases. How can I achieve the desired behavior, where each IP is pinged once and the results are processed correctly in the main thread? Alternatively, how can I rewrite the code using TTask?
  8. Shrinavat

    Allow tabs to use custom colors

    Oh, now it's clear. We can't manually set the color of the tabs. How quaint.
  9. Shrinavat

    Allow tabs to use custom colors

    Maybe the 'Allow tabs to use custom colors' option is like the Force in Star Wars - a mystical power that only a few chosen ones can truly understand and control. May the colors be with you, young Padawan. ✨ ...on a more serious note, has anyone cracked the code on how to actually use this mysterious option? Does anyone actually know how to change the tab colors?
  10. What is the purpose of this feature? How can I change the color of the tab in the code editor? I am unable to find an option to modify the color in the tab settings.
  11. Shrinavat

    The GetIt server is back online - With the 12.0 Patch 1

    (deletia)R120.patch1-20240131.zip
  12. Shrinavat

    Delphi 12 Component Palette Panel Shift Issue

    Yes, I have different Desktops. *.DST files do not have component palette properties. Deleting both your own Desktops and the default ones did not affect the offset position of the component palette :-(
  13. Shrinavat

    Delphi 12 Component Palette Panel Shift Issue

    Uninstalling CnPack had no effect, the panel appeared to be offset as well.
  14. Upon each launch of IDE, the Component Palette panel consistently shifts to the right by a specific distance. This behavior requires me to manually drag the panel back to its original position on the left side every time I start Delphi 12. Additionally, I have observed that the "Lock Controls" icon from the "View" toolbar disappears. I have manually added this icon to the toolbar, but it vanishes. It reappears only after selecting the same action through the "Edit|Lock Controls" menu. I have attached a screenshot illustrating the issue. I would like to inquire if there is a solution or workaround to address this problem. Is there a way to lock or fix the position of the Component Palette panel, so it remains in place across Delphi 12 sessions? Additionally, I am curious about where the configuration data for the panel's position is stored. Does Delphi 12 save this information in the registry, a configuration file, or elsewhere?
  15. Shrinavat

    Advise the component for editing tables

    Steema TeeGrid The grid component for Delphi VCL & FMX offers a very fast grid for your RAD Studio projects
×