Jump to content

Fr0sT.Brutal

Members
  • Content Count

    2268
  • Joined

  • Last visited

  • Days Won

    46

Everything posted by Fr0sT.Brutal

  1. Fr0sT.Brutal

    How do I delete a row in a database with FireDAC?

    And the experience advises not to fall into temptation to use these values as primary keys. In real world everything could change. Literally everything.
  2. No it's just a surprise expression. Probably leftover of times when MMX was shareware? But now it's senseless IMHO
  3. Fr0sT.Brutal

    FireDac variable column length overflow

    What value are you trying to assign? My bet is on non-latin chars which being encoded to UTF8 increase total byte length
  4. Encrypting of target binary in an opensource project?
  5. I'd look for simple expression parser and executor so that the rules could be defined in plain text (and admin could modify them without rebuilding). Validating at DB side (if you have DB of course) is also an option
  6. Fr0sT.Brutal

    Display of bmp and jpeg images is poorer quality in Windows 11

    First of all, you have alpha channel converted badly in the 2nd image
  7. Fr0sT.Brutal

    DL a file from the web

    In this particular case I just can't understand your requirements. If I hadn't know you by previous posts I'd think you're just trolling. Just go with builtin THTTPClient (using OS facilities for TLS) or Indy (uses OpenSSL). procedure TUpdateThread.Download; var buf: array[0..1023] of Byte; read: DWORD; HFile: HINTERNET; const ErrorPatt = 'Error getting file from %s: %s'; FLAGS = INTERNET_FLAG_NO_CACHE_WRITE or INTERNET_FLAG_RELOAD or INTERNET_FLAG_PRAGMA_NOCACHE or INTERNET_FLAG_NO_COOKIES or INTERNET_FLAG_NO_UI; begin try try FBuffer.Clear; // Init WinInet FHInet := InternetOpen('Foo', INTERNET_OPEN_TYPE_DIRECT, nil, nil, 0); if FHInet = nil then Error(IntToStr(GetLastError) + '. ' + SysErrorMessage(GetLastError)); // Open address HFile := InternetOpenUrl(FHInet, PChar(FURL), nil, 0, FLAGS, 0); if HFile = nil then Error(IntToStr(GetLastError) + '. ' + SysErrorMessage(GetLastError)); // Read the URL while InternetReadFile(HFile, @buf, SizeOf(buf), read) do begin if read = 0 then Break; FBuffer.Write(buf, read); end; FBuffer.Position := 0; finally InternetCloseHandle(HFile); InternetCloseHandle(FHInet); end; end; 32 LOC. Anyway are we struggling for the most compact solution? Then nothing will beat ShellExecute('curl.exe '+URL)
  8. Fr0sT.Brutal

    Find, Replace and Save

    @programmerdelphi2k I believe that you have 2 problems now: 1) Too MUCH EXCLAMATIONS!!!! 2) Too much RED color Could you calm down plz.
  9. Fr0sT.Brutal

    form data store component ?

    While you've found what you were looking for, I suspect you misunderstood "resource" approach. It's not about resourcestrings. It's just one .RC file with single line "StrRes RCData "StrRes.txt"" and one call to TResourceStream at runtime. Elementary but it has advantage of separating form definition from text data which is more convenient for version control
  10. Fr0sT.Brutal

    Multiple Simultaneous Connections with TidFTP

    From the nature of FTP transfers I'm afraid there couldn't be 1 ctrl connection + several data ones. So you'd have to create several fully independent FTP clients
  11. Fr0sT.Brutal

    DL a file from the web

    CreateProcess ('curl.exe ' + URL) 🙂
  12. Fr0sT.Brutal

    form data store component ?

    I chose resources way. You can edit a file with any editor and then just rebuild.
  13. Fr0sT.Brutal

    DL a file from the web

    THTTPClient is the least amount of code. If you're on Windows only, check WinInet https://github.com/Fr0sT-Brutal/Delphi_OSMMap/blob/master/Source/OSM.NetworkRequest.WinInet.pas Low level? This contradicts to "least code". Sockets is the most low level but I doubt you want to deal with them 🙂
  14. Fr0sT.Brutal

    TTreeview to JSON VCL?

    The benefit appears when you want to auto-test the container itself or make another GUI (console, web, etc)... anyway that's just a good practice to divide flies from meatballs (local saying)
  15. Fr0sT.Brutal

    Delphi 11.2 vs 10.4.2 locale issue

    So you actually have 2-char separator which is exactly the case that makes RTL functions behave strangely. In fact, this reveals a bunch of bugs to report to QC, as RTL functions are not ready for such flexible formats. The 11's version of the function is not correct either, it will break on 3-char separator.
  16. Fr0sT.Brutal

    Find, Replace and Save

    - Use base TStream - Read chunk by chunk, replace, write it back - To handle the case of search pattern partially sitting at the end of chunk - the simplest solution: - - Move piece of data with length = Length(SearchPattern)-1 from the end of the chunk to the beginning of buffer - - Read from stream to buffer starting right after that moved piece Of course search pattern must have length less than the buffer has
  17. Fr0sT.Brutal

    Turbopower Visual Planit??

    Okay, I just thought Lazarus version could have got some updates and improvements. TurboPower was an amazing company, they had so much open source components with great docs, and many of them are still actual, >10 years after abandonment!
  18. Fr0sT.Brutal

    Turbopower Visual Planit??

    Are you aware Lazarus team has newer fork? https://wiki.freepascal.org/Turbopower_Visual_PlanIt
  19. Fr0sT.Brutal

    How to connect to wss:// server ?

    The whole idea of websockets is to have permanent connection so it should use TCP.
  20. Fr0sT.Brutal

    Delphi 11.2 vs 10.4.2 locale issue

    No, no, I'd say you rather should never use DateSeparator as it is unreliable (it was bulletproof when only one-char separators were possible and both separators were the same - which is not true anymore). The FormatSettings.ShortDateFormat field is transformed to internal RTL format that will be handled by RTL routines. You should bother with its contents only if you have custom (non-RTL) formatting routines. Well, you should investigate why the 2-char buffer became insufficient for date sep. What result that WinAPI function returns if you call it directly (or just step into call to it from RTL)? And what exactly means " 3rd-party controls handle this incorrectly "?
  21. Fr0sT.Brutal

    Delphi 11.2 vs 10.4.2 locale issue

    Elementary case of breaking things working since W7 and I suppose any Delphi: set OS date format to "dd-MM/yyyy". Result of "DateToStr(Now)" will be "28-11-2022" not "28-11/2022" as everyone could expect
  22. Fr0sT.Brutal

    Delphi 11.2 vs 10.4.2 locale issue

    The reason for "fixing" is that they use slash as "current date separator" special char. When function encounters it, it replaces slash to current DateSeparator. This way date format becomes independent from date separator change so user can just modify date separator to get desired format instead of changing whole date format. Regarding the separator itself, probably it couldn't be retrieved from the system (as https://learn.microsoft.com/en-us/windows/win32/intl/locale-sdate says, this constant is deprecated) so it gets value of slash. BTW, considering this the whole logic of these manipulations seem to break on a format like above. I did some tests and seems SDATE constant is taken from the first separator of a short date format. However it's easy to surprise RTL code easily by defining short date as "dd ,-;MM\:;yyyy". This way even the widened buffer of D11 won't be enough to hold the separator and it will take slash value though actual date format won't contain any slash at all
  23. @programmerdelphi2k I wonder how much time it will take for you to discover that the code snippets should be posted inside CODE tags
  24. So those who were wearing white T-shirts will wear " custom background " T-Shirts?
  25. Fr0sT.Brutal

    7zip (LZMA) compression

    Even that LZMA is not pure, it uses C obj files. Probably you could build LZMA2 objs as well and link them to Delphi app.
×