Jump to content

Alexander Elagin

Members
  • Content Count

    141
  • Joined

  • Last visited

  • Days Won

    4

Alexander Elagin last won the day on October 30 2019

Alexander Elagin had the most liked content!

Community Reputation

97 Excellent

1 Follower

About Alexander Elagin

  • Birthday September 20

Technical Information

  • Delphi-Version
    Delphi 10.1 Berlin

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Alexander Elagin

    50 Years of Pascal

    I remember compiling a (then) large FoxPro program with a text windows interface on PC XT. It even would not link at all - the linker crashed after a half of an hour - unless I replaced the linker with another (probably Watcom but I do not remember the detail) which could finally produce a working executable in just 40 minutes of heavy work. Those were the days...
  2. Alexander Elagin

    Problems making a calculator with DELPHI in RAD STUDIO. (Tan, Cos, Sin)

    Mainly for the historical reasons. Turbo Pascal back in 1980's implemented a set of mathematical functions as a part of its standard (default) library which was implicitly used by any project (and still is in Delphi). This set included among others sin, cos, arctan but not tan, because it is simply sinus divided by cosinus. Now, decades later, Delphi significally extended the function list, which are now implemented in a separate unit System.Math. But the original functions are still available by default without using this module.
  3. Alexander Elagin

    Problems making a calculator with DELPHI in RAD STUDIO. (Tan, Cos, Sin)

    In Delphi, trigonometric functions (along with other mathematic routines) are implemented in the module (unit) System.Math. Do not forget to add this unit manually to the uses section of your module where you use them: uses System.SysUtils, (...other units), System.Math;
  4. Alexander Elagin

    Inherited on Properties and co.

    In fact, this was a pretty common trick when implementing ccustom lists before generics.
  5. Alexander Elagin

    Inherited on Properties and co.

    Because Data property is re-introduced with a new signature, thus it is necessary to explicitly use the inherited property and not the new one.
  6. Alexander Elagin

    Inherited on Properties and co.

    From the very beginning, i.e Delphi 1. What's the problem?
  7. Alexander Elagin

    Uniqueness and Security of domain name

    I do not know how secure it is, but function NetWkstaGetInfo can provide some information about the domain. There is also some code on the StackOverflow .
  8. Alexander Elagin

    I got bitten by an interface!

    The third one is QueryInterface: .... protected function QueryInterface({$IFDEF FPC}constref{$ELSE}const{$ENDIF} IID: TGUID; out Obj): HResult; stdcall; function _AddRef: Integer; stdcall; function _Release: Integer; stdcall; .... function TMyClass.QueryInterface({$IFDEF FPC}constref{$ELSE}const{$ENDIF} IID: TGUID; out Obj): HResult; stdcall; begin if GetInterface(IID, Obj) then Result := S_OK else Result := E_NOINTERFACE; end; function TMyClass._AddRef: Integer; stdcall; begin Result := -1; end; function TMyClass._Release: Integer; stdcall; begin Result := -1; end; Implement these three functions and you have a nice class with interfaces and without any reference counting.
  9. Alexander Elagin

    I got bitten by an interface!

    Or better inherit from TSingletonImplementation (I wonder who decided to give the base non-ARC interfaced object this misleading name...)
  10. Alexander Elagin

    Customizing source editor

    I use a custom colour scheme based on the Solarized Dark from Notepad++:
  11. Alexander Elagin

    Example of wasteful, innefficient string manipulation

    If you want to get the most of FastMM (different configurations for debug/release, fine tuning of settings) you still need the standalone version. The bundled one is a "good middle ground" but there always are options to get more...
  12. Alexander Elagin

    TeeChart with vertical bar?

    TeeChart Pro has TColorLineTool exactly for this purpose (in TeeTools.pas). I have no idea whether it is in the bundled Embarcadero edition of TeeChart or not.
  13. Alexander Elagin

    gem found in vcl.forms

    This function exists also in 10.1, but for obvious reasons there is no trace of this code in Delphi XE. Somebody probably used some black magic to force scaling engine into the two decades old and pretty stable code of the Forms unit, but had to put duct tape here and there to make it work. No doubt that the IDE theming used even more glue and tape, that's why the themed IDE is a slow monster.
  14. Alexander Elagin

    Hex2Binary

    FreePascal version of the same function in mode O1 (quick optimization): function foo(I: Integer): Integer; begin case I of 0: Exit(random(255)); 1: Exit(3); 2: Exit(4); 3: Exit(5); 4: Exit(6); 5: Exit(7); else Exit(0); end; end; FPC_Test.lpr:50 begin 00000001000018C0 55 push %rbp 00000001000018C1 4889e5 mov %rsp,%rbp 00000001000018C4 488d6424d0 lea -0x30(%rsp),%rsp 00000001000018C9 894df8 mov %ecx,-0x8(%rbp) FPC_Test.lpr:51 case I of 00000001000018CC 89c8 mov %ecx,%eax 00000001000018CE 85c9 test %ecx,%ecx 00000001000018D0 0f8c6e000000 jl 0x100001944 <FOO+132> 00000001000018D6 85c0 test %eax,%eax 00000001000018D8 741e je 0x1000018f8 <FOO+56> 00000001000018DA 83e801 sub $0x1,%eax 00000001000018DD 7429 je 0x100001908 <FOO+72> 00000001000018DF 83e801 sub $0x1,%eax 00000001000018E2 7430 je 0x100001914 <FOO+84> 00000001000018E4 83e801 sub $0x1,%eax 00000001000018E7 7437 je 0x100001920 <FOO+96> 00000001000018E9 83e801 sub $0x1,%eax 00000001000018EC 743e je 0x10000192c <FOO+108> 00000001000018EE 83e801 sub $0x1,%eax 00000001000018F1 7445 je 0x100001938 <FOO+120> 00000001000018F3 eb4f jmp 0x100001944 <FOO+132> 00000001000018F5 0f1f00 nopl (%rax) FPC_Test.lpr:52 0: Exit(random(255)); 00000001000018F8 b9ff000000 mov $0xff,%ecx 00000001000018FD e8bed70000 callq 0x10000f0c0 <SYSTEM_$$_RANDOM$LONGINT$$LONGINT> 0000000100001902 8945f4 mov %eax,-0xc(%rbp) 0000000100001905 eb45 jmp 0x10000194c <FOO+140> 0000000100001907 90 nop FPC_Test.lpr:53 1: Exit(3); 0000000100001908 c745f403000000 movl $0x3,-0xc(%rbp) 000000010000190F eb3b jmp 0x10000194c <FOO+140> 0000000100001911 0f1f00 nopl (%rax) FPC_Test.lpr:54 2: Exit(4); 0000000100001914 c745f404000000 movl $0x4,-0xc(%rbp) 000000010000191B eb2f jmp 0x10000194c <FOO+140> 000000010000191D 0f1f00 nopl (%rax) FPC_Test.lpr:55 3: Exit(5); 0000000100001920 c745f405000000 movl $0x5,-0xc(%rbp) 0000000100001927 eb23 jmp 0x10000194c <FOO+140> 0000000100001929 0f1f00 nopl (%rax) FPC_Test.lpr:56 4: Exit(6); 000000010000192C c745f406000000 movl $0x6,-0xc(%rbp) 0000000100001933 eb17 jmp 0x10000194c <FOO+140> 0000000100001935 0f1f00 nopl (%rax) FPC_Test.lpr:57 5: Exit(7); 0000000100001938 c745f407000000 movl $0x7,-0xc(%rbp) 000000010000193F eb0b jmp 0x10000194c <FOO+140> 0000000100001941 0f1f00 nopl (%rax) FPC_Test.lpr:59 Exit(0); 0000000100001944 c745f400000000 movl $0x0,-0xc(%rbp) 000000010000194B 90 nop FPC_Test.lpr:61 end; 000000010000194C 8b45f4 mov -0xc(%rbp),%eax 000000010000194F 90 nop 0000000100001950 488d6500 lea 0x0(%rbp),%rsp 0000000100001954 5d pop %rbp 0000000100001955 c3 retq Judge it yourself
  15. Alexander Elagin

    FireDAC Add On discountinued? (Good by Embarcadero?)

    UniDAC has a nice feature called Unified SQL (https://www.devart.com/unidac/docs/unisql.htm) which can be used to automatically preprocess SQL statements based on macros and conditionals. Maybe this can help you.
×