-
Content Count
2268 -
Joined
-
Last visited
-
Days Won
46
Everything posted by Fr0sT.Brutal
-
This proves once again my position: don't mess with local time wherever possible 🙂
-
NTP retrieves base time and has nothing to do with timezones. As general advice, it's wise to get rid of local timestamps everywhere but user display and use GMT (that is, 0 timezone; it's also frequently referred to as UTC but they're a bit different; nevertheless, in most cases they could be considered identical)
-
Then it will be wise to address the code they're actually using. Nevertheless, don't hesitate taking some things from current RTL (as Linux appeared in 10.x, no need in dragging 20-year-old legacy and bothering about compatibility).
-
Parsing Text search expression
Fr0sT.Brutal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Just don't forget to foresee cases when someone would wish to search for "or" (as a word) 🙂 Minimalistic free-form searches are cool (imagine if Google required us to write "word='foo' or word='bar" instead of "foo bar") but slightly more complex to implement with all edge cases. That's why Google uses specific symbols for logical operations -
multi-threading question
Fr0sT.Brutal replied to David Schwartz's topic in RTL and Delphi Object Pascal
No need in pool or something extra. Just create new threads, set their OnTerminate event and increase counter. In OnTerminate handler do what you need for single thread finish, decrease counter and when it reaches do overall finish. -
I too always paid great respect to Jedi team for such a huge code base but the lib is so monolithic that I've never used it except for some little inspirations and, of course, great header translations. Probably JVCL could make me take this move but times when I played with thousands of visual components are gone, now I'm happy with only std ones & VTV. I know plenty of people that tend to say "What, Jedi? These millions of units and stuff? Oh, forget it, I'd better write that function myself".
-
Parsing Text search expression
Fr0sT.Brutal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Then SQL parsers won't help you much or you'll have to manually mix what they consider variables and string literals into one category. -
Can somebody help me to translate a short Delphi console app to C++ Builder?
Fr0sT.Brutal replied to TurboMagic's topic in General Help
Quite rude David, he's doing opensource -
Should a TDataSet allow changing the .SQL property while being open?
Fr0sT.Brutal replied to aehimself's topic in Databases
#3. Auto-close (and auto-reopen too) is not obvious and may lead to unpredictable cases. -
Parsing Text search expression
Fr0sT.Brutal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
There are plenty of open-source parsers available. - ZeosDBO has powerful engine in \src\core\ (units ZExpression.pas, ZExprParser.pas, ZExprToken.pas, ZTokenizer.pas), you could take any part of it and customize to your needs - IBExpress from std lib has RAD\source\IBX\IBX.IBScript.pas with the parser as well, just as FireDAC in RAD\source\data\firedac\FireDAC.Stan.Expr.pas for expressions and FireDAC.Comp.Script.pas for scripts - Template engine from DVDChief also has expression parser - and so on Moreover, with such simple tokens you can easily write it yourself Btw, I don't realize what "testing" and "text" are in your example. Variables? Or just single words to search for, with quotes removed for simplicity (a la Google)? That's a nice task to solve, huh. Depending on maximum nesting level allowed it could require some discrete maths. -
A user friendly way of showing location permissions settings on Android
Fr0sT.Brutal replied to Dave Nottage's topic in General Help
The abyss of Dark patterns awaits you -
Is there a Delphi library that does AMQP 1.0?
Fr0sT.Brutal replied to jeroenp's topic in Network, Cloud and Web
Antiviruses will be happy to thrill upon such apps 😉 -
Refactoring Enum to string using enum helpers
Fr0sT.Brutal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
No surprise that speed is the same... #1 and #2 are virtually the same, and they have one bitwise operation+one if+jump. #3 is just read from address. I always prefer #3 because compiler will control if number of elements change. Sometimes, if needed, I use combined #3 approach (array[TEnum] = (cS1, cS2...)). -
Const Records and Class/Property Attributes (decoration)
Fr0sT.Brutal replied to mvanrijnen's topic in Algorithms, Data Structures and Class Design
Yep, sure. I use this trick for some lookup tables that must be constant but can't be defined in code. I fill them via pointer at unit init -
Const Records and Class/Property Attributes (decoration)
Fr0sT.Brutal replied to mvanrijnen's topic in Algorithms, Data Structures and Class Design
I'm not sure what do you mean by read-only memory but this works: const b: byte = 1; procedure TForm1.Button2Click(Sender: TObject); begin pbyte(@b)^ := 2; end; -
Const Records and Class/Property Attributes (decoration)
Fr0sT.Brutal replied to mvanrijnen's topic in Algorithms, Data Structures and Class Design
Well, any typed const could be modified by pointer seems you recall ancient times when this was true indeed -
Const Records and Class/Property Attributes (decoration)
Fr0sT.Brutal replied to mvanrijnen's topic in Algorithms, Data Structures and Class Design
Nope. It's a constant that couldn't be changed. But it is typed. Alas, structured constants could only be defined in this form so cannot be used in expressions where "pure" constants required. From the compiler POV, true constants of simple types don't exist somewhere in code, their value is just substituted in-place. Typed constants, OTOH, are like read-only vars - they sit in memory and have their address. -
Get rectangle of the button that was pushed on another form...
Fr0sT.Brutal replied to RTollison's topic in General Help
Well... Regarding mouse reposition: taking coordinates before showing the popup of course. Regarding everything else: IDK what COBOL apps look like and IMHO it's senseless to keep theorizing without topic starter and additional input. Anyway the issue seems to me not worthy such strong efforts. -
The BEST template engine for generating webpages on the server side?
Fr0sT.Brutal replied to Edwin Yip's topic in Tips / Blogs / Tutorials / Videos
They have pretty good help file and rich set of functions. Worth a try. Yes it seems abandoned but it's opensource with friendly license. -
The BEST template engine for generating webpages on the server side?
Fr0sT.Brutal replied to Edwin Yip's topic in Tips / Blogs / Tutorials / Videos
Oh yep. I fixed that in my fork, here's the diff (IDK if it will apply onto initial file) TemplateEngine.pas | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/TemplateEngine.pas b/TemplateEngine.pas index aa8bb38..11a59ef 100644 --- a/TemplateEngine.pas +++ b/TemplateEngine.pas @@ -31,6 +31,7 @@ unit TemplateEngine; {$B-} //Boolean short-circuit evaluation {$O+} //Optimization on {$R-} //Range checking off +{$HIGHCHARUNICODE ON} {.$DEFINE SMARTYDEBUG} interface @@ -2307,7 +2308,7 @@ begin '>': Result := Result + '>'; '''': Result := Result + '''; '"': Result := Result + '"'; - { #160: Result := Result + ' '; + #160: Result := Result + ' '; #161: Result := Result + '¡'; #162: Result := Result + '¢'; #163: Result := Result + '£'; @@ -2555,7 +2556,7 @@ begin #9827: Result := Result + '♣'; #9829: Result := Result + '♥'; #9830: Result := Result + '♦'; -} else + else Result := Result + Ch; end; end; With the commit message "! Fixed compiling HTMLEncodeEntities under XE2, uncommented stuff. Dumb compiler behavior when in considers char constants ANSI" 😄 -
Get rectangle of the button that was pushed on another form...
Fr0sT.Brutal replied to RTollison's topic in General Help
Of course you're right but I guess the assumption "mouse is still over a button being clicked" is pretty enough for the purposes of positioning a popup window. Implementation complexity/feature importance ratio seems very good. -
The BEST template engine for generating webpages on the server side?
Fr0sT.Brutal replied to Edwin Yip's topic in Tips / Blogs / Tutorials / Videos
I use http://dvdchief.com/delphi with success. It's double-licensed GPL/MPL and have conditionals, expressions and loops. I also made some cosmetic modifications -
Hmm, I can't realize what puzzles you. Anyway you start from TJSONObject . Then grab its values one by one and check whether they're TJSONObject , TJSONArray or something else (using "is" operator).
-
Get rectangle of the button that was pushed on another form...
Fr0sT.Brutal replied to RTollison's topic in General Help
Why not try GetMousePos? -
If a window is dummy, it won't receive many messages. You can check it by logging every entrance to windowproc. I hope you alloc a window in the context of main thread? Window handles belong to thread that created them. Anyway do you also have timer inside worker thread? Or it is living in main thread and queries thread's status to display?