-
Content Count
2268 -
Joined
-
Last visited
-
Days Won
46
Everything posted by Fr0sT.Brutal
-
How do I delete a row in a database with FireDAC?
Fr0sT.Brutal replied to JohnLM's topic in Databases
And the experience advises not to fall into temptation to use these values as primary keys. In real world everything could change. Literally everything. -
[Warning]: Include file not found: OBSIDIUM_ENC_START in line
Fr0sT.Brutal replied to Stano's topic in MMX Code Explorer
No it's just a surprise expression. Probably leftover of times when MMX was shareware? But now it's senseless IMHO -
What value are you trying to assign? My bet is on non-latin chars which being encoded to UTF8 increase total byte length
-
[Warning]: Include file not found: OBSIDIUM_ENC_START in line
Fr0sT.Brutal replied to Stano's topic in MMX Code Explorer
Encrypting of target binary in an opensource project? -
Validate data against a set of rules
Fr0sT.Brutal replied to karl Jonson's topic in Algorithms, Data Structures and Class Design
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 -
Display of bmp and jpeg images is poorer quality in Windows 11
Fr0sT.Brutal replied to Martin Liddle's topic in General Help
First of all, you have alpha channel converted badly in the 2nd image -
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)
-
@programmerdelphi2k I believe that you have 2 problems now: 1) Too MUCH EXCLAMATIONS!!!! 2) Too much RED color Could you calm down plz.
-
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
-
Multiple Simultaneous Connections with TidFTP
Fr0sT.Brutal replied to Brian Warner's topic in Network, Cloud and Web
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 -
CreateProcess ('curl.exe ' + URL) 🙂
-
I chose resources way. You can edit a file with any editor and then just rebuild.
-
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 🙂
-
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)
-
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.
-
- 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
-
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!
-
Are you aware Lazarus team has newer fork? https://wiki.freepascal.org/Turbopower_Visual_PlanIt
-
How to connect to wss:// server ?
Fr0sT.Brutal replied to wright's topic in ICS - Internet Component Suite
The whole idea of websockets is to have permanent connection so it should use TCP. -
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 "?
-
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
-
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
-
TStack<T>.Peek deeper than the topmost element
Fr0sT.Brutal replied to dummzeuch's topic in RTL and Delphi Object Pascal
@programmerdelphi2k I wonder how much time it will take for you to discover that the code snippets should be posted inside CODE tags -
Overlap JPG photo to oa background transparently
Fr0sT.Brutal replied to Clément's topic in RTL and Delphi Object Pascal
So those who were wearing white T-shirts will wear " custom background " T-Shirts? -
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.