Jump to content

Fr0sT.Brutal

Members
  • Content Count

    2268
  • Joined

  • Last visited

  • Days Won

    46

Everything posted by Fr0sT.Brutal

  1. Fr0sT.Brutal

    7zip (LZMA) compression

    https://github.com/ccy/lzmasdk/tree/57cdd679924d4dc2747a1cdbbe1134e277a9d28a/Delphi
  2. Fr0sT.Brutal

    IsZero or SameValue

    Comparing with tolerance is the only way of comparing floats isn't it? I wrote a little test procedure RunCompare(Epsilon: Double); const Base: Double = 0.1; var i: Integer; res: Double; begin res := 0; for i := 0 to MaxInt do begin if CompareValue(res, Base*i, Epsilon) <> EqualsValue then begin WriteLn( Format('Epsilon is %.17f: deviation at step %d', [Epsilon, i]) ); Exit; end; res := res + Base; end; end; procedure TestCompare; var i: Integer; EpsilonDiv: Int64; begin RunCompare(0); EpsilonDiv := Trunc(10E16); for i := 0 to 16 do begin RunCompare(1/EpsilonDiv); EpsilonDiv := EpsilonDiv div 10; end; end; it outputs Epsilon is 0,00000000000000000: deviation at step 8 Epsilon is 0,00000000000000001: deviation at step 3 Epsilon is 0,00000000000000010: deviation at step 8 Epsilon is 0,00000000000000100: deviation at step 29 Epsilon is 0,00000000000001000: deviation at step 73 Epsilon is 0,00000000000010000: deviation at step 262 Epsilon is 0,00000000000100000: deviation at step 928 Epsilon is 0,00000000001000000: deviation at step 2512 Epsilon is 0,00000000010000000: deviation at step 7415 Epsilon is 0,00000000100000000: deviation at step 23039 Epsilon is 0,00000001000000000: deviation at step 75679 Epsilon is 0,00000010000000000: deviation at step 261471 Epsilon is 0,00000100000000000: deviation at step 942813 Epsilon is 0,00001000000000000: deviation at step 2489005 Epsilon is 0,00010000000000000: deviation at step 7379011 Epsilon is 0,00100000000000000: deviation at step 23073610 Epsilon is 0,01000000000000000: deviation at step 76188297 Epsilon is 0,10000000000000001: deviation at step 264487878 0 is the value auto-calculated from both operands. As you can see, this epsilon starts to fail already after 8th step. So it seems one should provide explicit sane Epsilon for each Same|CompareValue call to be sure the desired result is achieved
  3. Fr0sT.Brutal

    Function with 2 return values ?

    Obviously for those applications that don't require ref count. And it could simplify importing interfaces from DLLs
  4. Fr0sT.Brutal

    Function with 2 return values ?

    Well, they could change things to this: IPureInterface = interface end; IRefCountInterface = interface(IPureInterface) ... end; IUnknown = IRefCountInterface; and leave implicit default inheritance from IRefCountInterface.
  5. Fr0sT.Brutal

    Function with 2 return values ?

    Analogy: one person could have blacksmith, cooker and plumber skills (implement these interfaces) and he could easily pass professional requirements (type check) because sets of skills are defined globally (interfaces declaration). So when somebody looks for a cooker (method with parameter of that interface) the person is allowed. Contrary, another person is blacksmith just because his father was blacksmith and taught him (inheritance). He can add some skills (implement new set of methods) but they will be personal and won't pass professional requirements (type check).
  6. Fr0sT.Brutal

    ANN: Better Translation Manager released

    Adding to binary is an x-platform way but if targeting only Windows, isn't it better to use UpdateResource ? And what's the sense of signing a file and then struggling with the signature instead of signing the prepared binary with all modules included?
  7. Fr0sT.Brutal

    Function with 2 return values ?

    We could if Delphi supported multiple inheritance or mixins. But now - no, they're not much more than usual classes.
  8. Fr0sT.Brutal

    Function with 2 return values ?

    And I wish there were pure interfaces without that refcount boilerplate. Two completely different models (required set of methods and refcounting) were mixed into one type.
  9. Fr0sT.Brutal

    ANN: Better Translation Manager released

    That was my question as well but from what Anders said I understood that language resources are built on the basis of compiled exe. Anyway the build script (topic starter is using build scripts isn't he?) could run two passes so the issue is solved.
  10. Fr0sT.Brutal

    Find, Replace and Save

    Break the task into steps. Implement all the steps you can. Ask for hints on the steps you can't.
  11. Fr0sT.Brutal

    Compare two TIntegerDynArray

    Guys you're saving on matches. CompareMem will eat all these nano-optimizations.
  12. Fr0sT.Brutal

    ANN: Better Translation Manager released

    Ah, that scheme. I was thinking about text files. Anyway resources could be added at post-build stage and application could extract them at 1st run and then relaunch. However, I agree this is the task for installer
  13. Fr0sT.Brutal

    Function with 2 return values ?

    With changeable bits. I think it perfectly maps to Generics 😄
  14. Fr0sT.Brutal

    Function with 2 return values ?

    Guys don't you argue what's better - pliers or screwdriver?
  15. Fr0sT.Brutal

    ANN: Better Translation Manager released

    Why not just include language files inside exe?
  16. Launch that demo under coverage tool and control it via any kind of IPC.
  17. Fr0sT.Brutal

    How to display one of several web pages at one URL

    Well, with a script you can do it. Just fetch page content, split to head|body and assign them to document.head|body.innerHTML. But you'll have to estimate all hacking possibilities and block them.
  18. Fr0sT.Brutal

    FTP - Problems sind update to Alexandria

    Typical issue Server is incorrectly configured reporting its internal IP to external client. If touching the server is not an option at all, look for client option to ignore that IP in PASV and always use main server address for connection. You may also change the command to EPSV which is more modern kind of making data connection that doesn't require server IP at all.
  19. Fr0sT.Brutal

    Converting C++ API Post Request into Delphi Code

    Universal solution: examine dumps of both requests and look for differences
  20. Fr0sT.Brutal

    How to display one of several web pages at one URL

    Of course you can but how you suppose to inject website's common scripts and UI? And why would you have to change HEAD - custom scripts?
  21. Fr0sT.Brutal

    How to display one of several web pages at one URL

    It seems similar to usual single-page app so what's your question? Just make sure the page won't be cached
  22. Fr0sT.Brutal

    FTP - Problems sind update to Alexandria

    Have you looked for log usage in Indy docs? Usually such client classes have some logger property; however I've no idea with Indy. Do Indy versions in working and failing app versions differ? Anyway logging should decrease the guess area as now it's too broad. Maybe Indy in D11 asks for active data connection by default which is blocked by firewall.
  23. Why not just install packages without that awkward obscure wrapper ?
×