Jump to content

DelphiUdIT

Members
  • Content Count

    593
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by DelphiUdIT

  1. May be you can write the function in this way ? function cntCaseTbl(Z: Int64): Int64; begin if z >= 0 then Result := Trunc(Log10(z))+1; else Result := 0; //This should be, otherwise the result will be random value end;
  2. DelphiUdIT

    Windows XP App

    If you are FTDI chips in use you have only one way to work on XP: you must use the VCP drivers of FTDI (Virtual Com Port) that simulates the standard Windows com serial port. The drivers should be signed with version prior 2.12.24 !!! You'll find the drivers for XP in this page: All VCP FTDI drivers version for all version of SO Of course you can use the driver on XP if the FT4232 chip is supported ..... In your TCOMPort component use COMx, I mean the COM port listed in the device manager of windows. Hope this help. Bye
  3. DelphiUdIT

    Windows XP App

    Of course, he MUST have "grep" ... he has Delphi 10.4
  4. DelphiUdIT

    Windows XP App

    That function is called for example by the library used with FTDI USB to RS232 / RS485 peripherals. If someone has integrated FTDI peripheral functionality as a COM (serial) component that function may be called. But from what I know, the drivers for those devices no longer load in XP. The serial devices of the FTDI are in very common use.
  5. Remember that in the new Intel hybrid architectures (such as Alder Lake) not all cores are usable, or rather not all cores have the same processing "power" (eg. P-Core and E-Core).
  6. Look at this code and run it (VCL Applicaton with a Form, a Button with OnClick Event and a custom class) unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type TDoSomething = class Danger: string; constructor create; function Ghost: boolean; end; type { TForm1 } TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private public end; var Form1: TForm1; DoSomething: TDoSomething; implementation {$R *.dfm} constructor TDoSomething.create; begin //FROM HERE I NEVER GO THERE .... AND IF I GO THERE BY WRONG, CLOSE THE PROGRAM !!! ExitProcess(0); end; function TDoSomething.Ghost: boolean; begin try result := true; ShowMessage('Here I am, I am a ghost'); except result := false; end; end; procedure TForm1.Button1Click(Sender: TObject); begin if DoSomething.Ghost then //<------- DoSomething is NIL !! ShowMessage('OK, executed') else ShowMessage('KO, some errors append'); end; end. The class is not instantiated, but the GHOST function is executed. Am I missing something? I trust in my abysmal ignorance, because otherwise much more than a certainty collapses ... In tens of years of programming I have never dared to write anything like this, taking some concepts for granted. Aside from the fact that the program doesn't make much sense (good programming rules would also like a "if Assigned(DoSomething) then" before using it), such code cannot run ... at runtime I would expect an error. Hope someone can explain this. Bye
  7. @Dalija Thanks for your article. You have cleared up more than a few doubts.
  8. This is new to me ... a non-instantiated object that "executes" a method .... Yes, of course an exception is thrown: it must be like this because a string needs to have memory allocated. Anyway, thanks for the explanation. I thought that without an "instance" a method could not be executed, or rather that an exception was thrown. You never stop learning. <---- I mean I never stop learning (EDIT) Bye
  9. In general, when I create a new class, a new feature or other, I always think about the possibility that the class is derived (inheritance, polymorphism) and therefore writing a code like the one indicated I would not write it even if it were possible without side effects. Bye
  10. In the latest daily repository available (today 02/21/2022), compiling for Linux64 there are two "probable" bugs: 1) In the file OverbyetIcsSslX509certs.pas on line 1836 the definition of the TMsCertTools class is missing. Solved like this: {$ IFDEF MSWINDOWS} FNewSslCert: = TMsCertTools.Create (self); {V8.67 was TSslCertTools} {$ ELSE} FNewSslCert: = TSSlCertTools.Create (self); {$ ENDIF} 2) In the file OverbyteIcsMailQueue.pas on line 2182 the definition of SetEndofFile is missing (in Linux it does not exist), replaced as follows: {$ IFDEF MSWINDOWS} SetEndOfFile (FHandle); // truncate file size {$ ELSE} ftruncate (FHandle, Count); // truncate file size {$ ENDIF} Inserted in the uses the unit Posix.UniStd Changes not tested yet, but the build is done. PS: I will send you a postcard as soon as possible Bye
  11. DelphiUdIT

    Bug - Linux 64 Compiled

    Sorry, I didn't realize the question was for me ... No, I only compiled for Linux. I wanted to see if everything was standing with Linux because I should start with a project with which the ICS components would suit me. But I haven't done anything yet "run" ... I don't know when I'll start, and I'm not a master in Linux programming. Bye
  12. DelphiUdIT

    Bug - Linux 64 Compiled

    Ok, take care about the new line inserted "ftruncate (FHandle, Count)": It may be that the line is also "ftruncate (FHandle, FLen)", I don't know which of the two variables is correct to be used.. {$ IFDEF MSWINDOWS} SetEndOfFile (FHandle); // truncate file size {$ ELSE} ftruncate (FHandle, Count); // <- ftruncate (FHandle, FLen); ???? {$ ENDIF} Bye
  13. You can create applications of various types, each with its own characteristics: - a Windows service, this is an application with no user interface that runs as a service; - a console application, also an application without a graphical interface, runs on the command line. All these have the access point in the .dpr file, but the path develops in a different way than in a graphic application (typically with a Form). Bye
  14. DelphiUdIT

    enable/disable the internet connection?

    I think the arguments we are discussing are a bit confusing: the title of the topic was "enable / disable the internet connection" and not how, why and when to update Windows. Now we are talking about all but nothing .... Bye
  15. DelphiUdIT

    enable/disable the internet connection?

    With that policy, the automatic update is not operational. It can be done manually. Function on versions of Windows 10 Professional and above, does not work on Windows 10 Home, at least on the latest releases.
  16. DelphiUdIT

    enable/disable the internet connection?

    There is another solution, use the 'route' shell command to temporarily change the gateway and isolate the PC. Other ways I doubt there are without a dedicated driver (network filter). TCP packets, and worse still UDP packets, cannot be filtered at the user level without a system filter. Bye
  17. DelphiUdIT

    Rest in peace dear Danny Thorpe

    RIP, one of the geniuses who created Delphi, VCL, Kylix. Truly an immense loss.
  18. DelphiUdIT

    How do *you* test ?

    I normally derive new code from existing projects. Basically I have a production of very similar projects. When instead I restart from a whole new project, I initially build a mini graphical interface with minimal functionality. Then the core of the project with the various modules. I normally focus on a functional group of methods that I test as I build them both in terms of performance (execution times with variations, possible bottlenecks) and erroneous results. I always use High, Low HighBound, Count, ..... and never numeric expressions to access the indexed data, therefore errors for "out of bound" accesses are normally never present. Compilations and builds are done very frequently. After I have a stable core, I move on to the UI part ... which is the longest and most laborious part normally. Of course at the start of the project the use of some PAPER and some brainstorm is fundamental. The tests are done frequently, it is true that perhaps the development time is longer, but in the end the results are almost always OK, without the need for major modifications
  19. I came across this page by chance which I think is relevant to the topic in question: https://www.ibm.com/support/pages/genuuid-can-generate-more-random-uuid Bye
  20. DelphiUdIT

    how to cosume grpc in delphi vcl client?

    May be this can help you: Delphi port for GRPC Bye
  21. DelphiUdIT

    How to Get Android Phone Battery Percentage in Delphi 10.4

    Look at https://titanwolf.org/Network/Articles/Article?AID=24615291-66fa-41b6-a245-e98230db0210#gsc.tab=0 I try to assemble it and is working. I cannot try in Andorid system now. Hope is working. EDIT: I was able to test it with an Android 11 phone and it works flawlessly. Bye
  22. DelphiUdIT

    TBluetoothLE in Windows 10

    Everything good. Everything works under both Windows and Android (but probably also under MACOS and IOS). The problem I encountered in my last post stemmed from my VERY BAD programming: I assumed that the services were listed in order as the device proposed them (which is true with the original EMB file but not with the changes made). Congratulations @mikerabat, I think EMB will use some of your code in the next versions. Bye
  23. DelphiUdIT

    TBluetoothLE in Windows 10

    I try your last implementation, but with the original Delphi file all is working, while with your solution only one service is found. I'll try to debug whats wrong next week. And, 👍 YES with your solution seems that devices should not be paired anymore. Good work. Bye
  24. DelphiUdIT

    TBluetoothLE in Windows 10

    The WIN32 apis for BlueTooth are system based and are present in: rtl/net/System.Bluetooth rtl/net/System.Bluetooth.Components All systems supported by Delphi have BLE (IOS does not have the classic BlueTooth). I use FMX with BLE because I usually make apps for Android too. Some difference with use of BLE is that with Windows the devices must be paired almost one time to be used with BLE. Bye.
  25. DelphiUdIT

    TBluetoothLE in Windows 10

    I don't know the WinRT API and have never developed a UWP application. I would have created an external timer (a normal TTimer) and called the CancelDiscovery function without "touching" the BLE timer. In normal WIN32 api I do this and I have no problems whatsoever. Bye.
×