Jump to content

Alexander Elagin

Members
  • Content Count

    198
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Alexander Elagin

  1. Alexander Elagin

    Record operator overloading error

    It compiles successfully if the error line is fixed like this: if (not a) or True then or this (I do not know the original intent of the statement): if not (a or True) then
  2. Alexander Elagin

    "CAN" bus advice

    I have used devices from Kvaser, IXXAT and some others. Kvaser has a superb support library (CANLib SDK) which includes Delphi interface module, their software model is very simple and elegant. IXXAT also used to have one, but I have not touched it since version 2.18 as the later versions of their VCI interface were incompatible with 2.x branch. Kvaser drivers implement virtual CAN channels which helps debugging when no real hardware is available.
  3. Alexander Elagin

    Help needed for importing a WSDL

    There are two pairs of methods which differ only in register (getDocumentData / GetDocumentData and getDocumentStatus / GetDocumentStatus), that's why the imported module does not compile. Simply change these definitions like this, marking them as overloaded: function getDocumentStatus(const parameters: getDocumentStatus2): getDocumentStatusResponse2; stdcall; overload; and the unit will at least compile successfully. I have no idea if it will work as intended - hopefully yes because the parameters differ. As for the "cannot unwrap" note, this is pretty normal. This means that the importer could not extract individual parameters and imported them instead together as a class, this usually does not cause problems. Just take care with memory management.
  4. Alexander Elagin

    Trouble with testing dates

    Almost correct... you missed "T" character between the date and time parts: 2023-06-22 17:44:23.456 should be 2023-06-22T17:44:23.456 to represent a valid ISO 8601 date. (And probably a timezone but it is usually not required)
  5. Alexander Elagin

    memory paging or segmentation

    Because you have this declaration: ballpointer: PChar; PChar is an alias for PWideChar. WideChar is 2 bytes long. When pointer arithmetics is used, all operations take into account the real size of the data type the pointer points to. Thus, this statement: ballpointer := ballpointer+1; is in fact compiled and executed as ballpointer := ballpointer + 1*SizeOf(WideChar); and you have your pointer correctly pointing to the next WideChar in memory. This is really easy to check with a simplest program: program Project1; {$APPTYPE CONSOLE} uses SysUtils; var P: PChar; begin GetMem(P, 20); WriteLn(Format('P = %8x', [NativeUInt(P)])); P := P + 1; WriteLn(Format('P = %8x', [NativeUInt(P)])); ReadLn; end. You'll see that second value printed is greater than the first by 2 in any modern Delphi version. (Yes, I know there is a memory leak but this is just a demonstration).
  6. Alexander Elagin

    IsValidDate fails after the Year 9999

    Quoting the aforementioned RFC 2550:
  7. Alexander Elagin

    IsValidDate fails after the Year 9999

    There is a nice RFC 2550 dealing with dates up to year 10E30 and beyond (dated 1 April 1999 )
  8. Alexander Elagin

    moving a class implementation from desktop to server

    Just be sure that you never ever implement any business logic in visual form units (you know, those OnClick handlers...). Everything must be implemented in non-visual classes (including datamodules) not depending on any VCL units. Forms must be used only to call that functionality and display the results, if any. Thus you will finally get a nice set of units which can be further used anywhere, be it a UI-less server, console application, VCL or FMX.
  9. Alexander Elagin

    Function with 2 return values ?

    Yes, surely. And it is possible to inherit an interfaced class not from TInterfacedObject, but from TSingletonImplementation which IS the base interfaced class without refcounting.
  10. Alexander Elagin

    Function with 2 return values ?

    BTW, FreePascal has non-refcounted interfaces (CORBA/Java interfaces): https://www.freepascal.org/docs-html/prog/progsu37.html#x44-430001.2.37
  11. Alexander Elagin

    Web-fonts v Desktop-fonts

    There is a nice example in the InnoSetup documentation:
  12. Alexander Elagin

    Action after all form destroy in project

    Finalization sections are executed in the reverse order to initialization, so the first unit to initialize will be the last one to finalize. From the documentation: The Finalization Section The finalization section is optional and can appear only in units that have an initialization section. The finalization section begins with the reserved word finalization and continues until the end of the unit. It contains statements that are executed when the main program terminates (unless the Halt procedure is used to terminate the program). Use the finalization section to free resources that are allocated in the initialization section. Finalization sections are executed in the opposite order from initialization sections. For example, if your application initializes units A, B, and C, in that order, it will finalize them in the order C, B, and A. Once a unit's initialization code starts to execute, the corresponding finalization section is guaranteed to execute when the application shuts down. The finalization section must therefore be able to handle incompletely initialized data, since, if a runtime error occurs, the initialization code might not execute completely.
  13. Alexander Elagin

    Action after all form destroy in project

    A more or less easy solution would be to add the destructor call to the finalization section of Unit3: .... initialization tsTest := TStringList.Create; // or wherever it must be created finalization tsTest.Free end. And make sure that Unit3 is added to the project file before any form units: program Project1; uses VCL.Forms, Unit3 in 'Unit3.pas', Unit1 in 'Unit1.pas', {Form1} .... Not guaranteed but will probably work.
  14. Alexander Elagin

    Getters & Settters??

    It just means that you have to write the missing constructor for the TTracksAddEditForm: constructor TTracksAddEditForm.Create(AOwner: TComponent; const AsMode: string; AiAlbum: integer; const AsTrack: string); begin inherited Create(AOwner); sMode := AsMode; iAlbum := AiAlbum; sTrack := AsTrack; end;
  15. Alexander Elagin

    Delphi or Lazarus/Free Pascal

    I was wrong ;-( There are in fact options to fold and unfold: Alt-Shift-1 to Alt-Shift-9 fold blocks of appropriate level, Alt-Shift-0 unfolds all.
  16. Alexander Elagin

    Delphi or Lazarus/Free Pascal

    Got it. Then alas, I do not think there is such option in Lazarus. I have never used it in Delphi, but it all depends on one's personal preferences and development style.
  17. Alexander Elagin

    Delphi or Lazarus/Free Pascal

    Just a plus sign near the left gutter, it also displays the foldable block.
  18. Alexander Elagin

    Delphi or Lazarus/Free Pascal

    Why? In Lazarus 2.0.10 everything folds nicely (both standalone procedures and methods):
  19. And after a few versions and much ranting the classic undocked layout had been reintroduced. Let's hope the same can happen again because I hate this new docked IDE where I cannot have several forms and code editor visible at once.
  20. Alexander Elagin

    IfThen Oddity...

    Oxygene from RemObjects makes it look pascalish enough: var lDescriptiveText := if x < 10 then 'less than ten' else 'ten or more'; https://docs.elementscompiler.com/Oxygene/Expressions/If/
  21. Alexander Elagin

    Write blob field to database from client

    A generic TStream has no idea how to store data, it is just an abstract class. Therefore any data written to it after this code snippet: are simply discarded. I'd replace the first line with this: ms := TMemoryStream.Create; The variable declaration can remain the same.
  22. Alexander Elagin

    Developer Express gave up on FMX

    After a bit of googling I got the following information regarding DevExpress. 1. While the management and a group of developers are located in USA, almost all development and support team are in Russia (namely, in Tula, Kaluga and St.Peterburg). A rather old article in Russian briefly introduces the company: https://habr.com/ru/company/developersoft/blog/104047/ 2. From this page we can find out the web address of the russian branch: https://www.developersoft.ru Exploring this site (description, portfolio, history...) it is easy to see that this is really the other face of DevExpress, or at least the company which does all the work. 3. And now the most interesting statement from the mentioned page: That is, the Company is suspending all hiring and operations indefinitely as of March 2, 2022. 4. Conclusion. Given the current political and economical situation (first of all, blocking of virtually all payments between Russia and the western world, meaning that the developers cannot be paid) it means that either DevExpress management has to be able to relocate the development and support team somewhere outside the russian borders, or it has to hire an absolutely new team as a replacement, or cease any development until all this madness ends. All the information is from the internet, I'd prefer not to trust it 100%, but unfortunately it seems too matching to be true.
  23. Syntax diagrams are easier to read and understand than BNF or ABNF and they look good in any documentation , but BNF is better suited for automated parsing and validation.
  24. Alexander Elagin

    Delphi 5 - VirtualTreeView

    VTSourceOnly.4.2.30.zip : https://drive.google.com/file/d/19VQ2v-_Zef26zZB3U1go1MmHS_k8uWaC/view?usp=sharing VirtualTreeviewSetup.4.8.7.exe: https://drive.google.com/file/d/1bMgUg15T0ho5yUv1gVxh4NUhzuyJocxl/view?usp=sharing
  25. Alexander Elagin

    Delphi 5 - VirtualTreeView

    I have a zipped Virtual Treeview archive from 2004, it contains packages for Delphi 4 - Delphi 9 (2005?). If anybody is interested, I can share it. Also found the installer for VTV 4.8.7, dated 15.12.2010.
×