Jump to content

Fr0sT.Brutal

Members
  • Content Count

    2268
  • Joined

  • Last visited

  • Days Won

    46

Everything posted by Fr0sT.Brutal

  1. Fr0sT.Brutal

    How to get the actual UTC time??

    This proves once again my position: don't mess with local time wherever possible 🙂
  2. Fr0sT.Brutal

    How to get the actual UTC time??

    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)
  3. Fr0sT.Brutal

    JCL support for Linux64 compiler

    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).
  4. Fr0sT.Brutal

    Parsing Text search expression

    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
  5. Fr0sT.Brutal

    multi-threading question

    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.
  6. Fr0sT.Brutal

    JCL support for Linux64 compiler

    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".
  7. Fr0sT.Brutal

    Parsing Text search expression

    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.
  8. Quite rude David, he's doing opensource
  9. #3. Auto-close (and auto-reopen too) is not obvious and may lead to unpredictable cases.
  10. Fr0sT.Brutal

    Parsing Text search expression

    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.
  11. The abyss of Dark patterns awaits you
  12. Antiviruses will be happy to thrill upon such apps 😉
  13. 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&#2 approach (array[TEnum] = (cS1, cS2...)).
  14. 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
  15. 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;
  16. Well, any typed const could be modified by pointer seems you recall ancient times when this was true indeed
  17. 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.
  18. 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.
  19. 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.
  20. 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 + '&iexcl'; #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" 😄
  21. 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.
  22. 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
  23. Fr0sT.Brutal

    JSON parsing question

    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).
  24. Fr0sT.Brutal

    AllocHwnd + TTimer = lag?

    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?
×