-
Content Count
2268 -
Joined
-
Last visited
-
Days Won
46
Everything posted by Fr0sT.Brutal
-
Why compiler allows this difference in declaration?
Fr0sT.Brutal replied to Mike Torrettinni's topic in RTL and Delphi Object Pascal
I never saw naming the parameters but saw all these tremenous lists of overloads: one param, two param. three param, ... scary -
Image32 - 2D graphics library (open source freeware)
Fr0sT.Brutal replied to angusj's topic in I made this
Only actual if there ARE pull requests... which is just a few %s of overall users.- 42 replies
-
- graphics
- cross-platform
-
(and 2 more)
Tagged with:
-
StrToFloat () all combinations of decimal separator and lang. settings
Fr0sT.Brutal replied to bernhard_LA's topic in Algorithms, Data Structures and Class Design
Very nice idea for testing BTW - change system settings to something wild and see if software stands it. -
Apply the settings to the App without having to close it
Fr0sT.Brutal replied to Johansy's topic in General Help
CheckSettingsTimerOnTimer: if SettingsFileModifiedDate > LastCheckDate then ReadAndApplySettings -
StrToFloat () all combinations of decimal separator and lang. settings
Fr0sT.Brutal replied to bernhard_LA's topic in Algorithms, Data Structures and Class Design
I'd mark deprecated all functions that use global FormatSettings and this variable itself. Otherwise it's quite hard to track and kill all hidden usages -
Delphi Daily WTF / Antipattern / Stupid code thread
Fr0sT.Brutal replied to Tommi Prami's topic in RTL and Delphi Object Pascal
Once I stumbled upon system ANSI encoding discussion and checked my apps with another ACP set in OS. That was a refreshing experience. -
Delphi Daily WTF / Antipattern / Stupid code thread
Fr0sT.Brutal replied to Tommi Prami's topic in RTL and Delphi Object Pascal
Insignificant difference IMHO -
Delphi Daily WTF / Antipattern / Stupid code thread
Fr0sT.Brutal replied to Tommi Prami's topic in RTL and Delphi Object Pascal
The code is pretty clear (surprise) but could be refactored to a single big "if" making goto's unnecessary if ( ((EditControl is TCustomEdit) and (length(trim((EditControl as TCustomEdit).Text)) < MaxLen)) or ... ) then ... Probably the author wasn't aware of short boolean eval so he didn't use AND operator. -
I used to have enums starting from 1 when I needed 0 value to have "null" meaning so that empty structures would be inited with "null". However, I didn't want that null belong to enum itself. So I did TEnum = (enOne = 1, enTwo, ...) enNull = TEnum(0) However, this is not portable (FPC appears much more strict regarding range checking) and lacks RTTI which I use widely so I changed declarations to TEnumNullable = (enNull, enOne, enTwo, ...) TEnum = enOne..High(TEnumNullable)
-
Parsing Text search expression
Fr0sT.Brutal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
I'm only aware of C having such generators. Nope, it was just a note about something slightly related to the subject 🙂 -
Parsing Text search expression
Fr0sT.Brutal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Yes you're right. Btw RTL has a TParser class but it's intended for reading DFM files. Not a something reusable -
Delphi Daily WTF / Antipattern / Stupid code thread
Fr0sT.Brutal replied to Tommi Prami's topic in RTL and Delphi Object Pascal
try ... except on E: Exception do ... raise E; end Gives scary and mystic AV somewhat later after the problematic line in OS callstack. Real PITA to find and fix. -
Parsing Text search expression
Fr0sT.Brutal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
There are tons of various parsers. The problem is the syntax required - everyone could need a different one. Moreover, the more specific parser is, the more efficient it appears. Sometimes you don't even need to write a parser - just define the grammar and generate parser code from it. Alas, I'm not aware of such possibility for Delphi. -
Solving similar issue in my map control,. I came to 3-level cache: - Hot: Tbitmaps - Medium: PNGImages - Cold: TMemoryStreams Capacity of all levels is limited by memory and GDI handles. Comments in OSM.TileStorage.pas unit explain decisions I made
-
upcoming language enhancements?
Fr0sT.Brutal replied to David Schwartz's topic in RTL and Delphi Object Pascal
Ternary operator is just a sugar for me. I find myself using it pretty rarely because it often grows so much that it starts looking monstrous. Much more useful is || construction from C-like langs that frequently replaces ternary: res = smth ? smth : default and res = smth || default Async/await is what I use everyday, everywhere so they're my favorites. -
Save an image as bitmap, then you'll get an idea how much it takes in memory.
-
StrToFloat () all combinations of decimal separator and lang. settings
Fr0sT.Brutal replied to bernhard_LA's topic in Algorithms, Data Structures and Class Design
You could also prepare input for processing: remove ^[\.,\d], replace , to . and convert invariantly -
Can I use the TidHTTP component for this?
Fr0sT.Brutal replied to alank2's topic in Network, Cloud and Web
It does its job pretty well. I recently implemented a request routine with it and I'm pretty satisfied though some things look overcomplicated (credentials, for example) -
Hmm, I had to add main host override for passive mode to my mod of inet suite for different reason - when connection is secure, TLS session is reused only if host addresses are the same. But connection establishes with hostname and passive mode responds with IP - obviously no match.
-
Repeat
-
BAD advice. Really bad. Global variables are evil. Moreover, this variable won't update on change either. In VCL changes are auto-applied by TForm's internal message handler. FMX doesn't track system changes even on Windows (checked with 10.3). So it's up to you to refresh them. I'd advice you to use your own instance of FmtSett received by TFormatSettings.Create(SysLocale.DefaultLCID) with all Format functions and refresh them periodically or when they're used. Probably there's more clever option but I'm not aware of any.
-
What happens if you explicitly create new TFormatSettings with current locale and call the function with resulting record?
-
Well - yes. T_loc = T_utc + TZ where T_loc and TZ are configurable. So even if T_loc is correct, T_utc will be incorrect with incorrect TZ. What I meant is that TZ change won't affect T_utc. Btw, any time sync utility will likely show that T_utc is wrong in this case.
-
For loop does NOT go to the max
Fr0sT.Brutal replied to Joe Sansalone's topic in Algorithms, Data Structures and Class Design
Ranges of for loop counter are calculated once loop starts and won't change later. You'll either have to add another for loop inside or use another kind of loop (while, until + manual counter check and increment) -
What makes you think timezone plays a role here?