-
Content Count
198 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Alexander Elagin
-
Problems making a calculator with DELPHI in RAD STUDIO. (Tan, Cos, Sin)
Alexander Elagin replied to DesadaptadoDimensional's topic in General Help
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; -
Inherited on Properties and co.
Alexander Elagin replied to Attila Kovacs's topic in RTL and Delphi Object Pascal
In fact, this was a pretty common trick when implementing ccustom lists before generics. -
Inherited on Properties and co.
Alexander Elagin replied to Attila Kovacs's topic in RTL and Delphi Object Pascal
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. -
Inherited on Properties and co.
Alexander Elagin replied to Attila Kovacs's topic in RTL and Delphi Object Pascal
From the very beginning, i.e Delphi 1. What's the problem? -
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 .
-
I got bitten by an interface!
Alexander Elagin replied to Clément's topic in Algorithms, Data Structures and Class Design
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. -
I got bitten by an interface!
Alexander Elagin replied to Clément's topic in Algorithms, Data Structures and Class Design
Or better inherit from TSingletonImplementation (I wonder who decided to give the base non-ARC interfaced object this misleading name...) -
Customizing source editor
Alexander Elagin replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
I use a custom colour scheme based on the Solarized Dark from Notepad++: -
Example of wasteful, innefficient string manipulation
Alexander Elagin replied to Mike Torrettinni's topic in General Help
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... -
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.
-
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.
-
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
-
FireDAC Add On discountinued? (Good by Embarcadero?)
Alexander Elagin replied to Juan C.Cilleruelo's topic in General Help
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.- 24 replies
-
- firedac add on
- discountinued
-
(and 1 more)
Tagged with:
-
Copies four characters from the BinaryValues constant array item at index HexDigitValue to the location pointed by Ptr.
-
FireDAC Add On discountinued? (Good by Embarcadero?)
Alexander Elagin replied to Juan C.Cilleruelo's topic in General Help
Use UniDAC, which is not too expensive and is a good independent alternative to FireDAC. It also supports Lazarus and older versions of Delphi. Switching from FireDAC is not difficult. https://www.devart.com/unidac/- 24 replies
-
- firedac add on
- discountinued
-
(and 1 more)
Tagged with:
-
"Delphi GUI programming with FireMonkey" is now available!
Alexander Elagin replied to Andrea Magni's topic in Tips / Blogs / Tutorials / Videos
Reading it now. Finally a nice and clear introduction to FMX - I wish this were part of the documentation from the first introduction of this framework, instead of a dry list of obscure classes present in the official docs today. Thank you for the excellent book! -
An XML DOM with just 8 bytes per node
Alexander Elagin replied to Erik@Grijjy's topic in Tips / Blogs / Tutorials / Videos
No, it is not. -
I don't understand this CONST record argument behavior
Alexander Elagin replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Yes, but the point was that one has to use the collection's Count property for indexing and never the Length of the internal array, as the array may have more elements (preallocated for possible expansion) than the real number of elements in the collection. -
Soap Server and client downloading files
Alexander Elagin replied to alnickels's topic in Network, Cloud and Web
Convert the binary data to base64-encoded string and return it to the client which can decode it back to binary. In my experience, passing 2-5 megabytes this way does not cause any problems. -
Project With Same Source, Windows 7 Ok, Windows 10 Invalid Date Format
Alexander Elagin replied to stacker_liew's topic in General Help
There are two great functions in the DateUtils module: DateToISO8601 and ISO8601ToDate. They can save a lot of pain when it is needed to store date/time in text files. -
Anybody up for an ethics question?
Alexander Elagin replied to David Schwartz's topic in General Help
If the manager assumes the responsibility, then just have a written document signed by him - be it a specification or a simple memo. If things go wrong, you'll have you covered. -
It is strange that 10.4 does not show access violation here while the error is obvious: c1 := 'A'; p := PChar(c1); // wrong explicit conversion: widechar to integer to pointer. // Now p is a pointer to the memory location at the address 0x00000041 - that is, the value of Ord(A) showmessage(p^); // here p^ points to memory location at 0x00000041, obviously not was meant by the author
-
So if I am the Primary Contact (as I paid the bill myself) I still have to assign myself somewhere as an Authorized Contact? Damn, the Embarcadero's sales model does not change with years, they are targeting businesses, not developers. And don't remind me about all this reseller-only distribution and obligatory quote request for updates ☠️...
-
Same here.
-
The interfaces in Delphi are bad?
Alexander Elagin replied to Jacek Laskowski's topic in RTL and Delphi Object Pascal
I guess yes (the {$INTERFACES} directive is local) but honestly I have not tried it myself because it is incompatible with Delphi code