DelphiUdIT
Members-
Content Count
593 -
Joined
-
Last visited
-
Days Won
11
Everything posted by DelphiUdIT
-
I Broke Delphi ->> Low bound exceeds high bound & Duplicate case label if you swap'em (Case Z of) Table error
DelphiUdIT replied to Al T's topic in Algorithms, Data Structures and Class Design
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; -
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
-
Of course, he MUST have "grep" ... he has Delphi 10.4
-
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.
-
Odd timing when using multiple threads
DelphiUdIT replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
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). -
Class not instantiated ... but method executed
DelphiUdIT posted a topic in Algorithms, Data Structures and Class Design
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 -
Class not instantiated ... but method executed
DelphiUdIT replied to DelphiUdIT's topic in Algorithms, Data Structures and Class Design
@Dalija Thanks for your article. You have cleared up more than a few doubts. -
Class not instantiated ... but method executed
DelphiUdIT replied to DelphiUdIT's topic in Algorithms, Data Structures and Class Design
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 -
Why isn't this dangerous, or is it?
DelphiUdIT replied to Renate Schaaf's topic in Algorithms, Data Structures and Class Design
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 -
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
-
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
-
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
-
Can I change the entry point for a VCL application?
DelphiUdIT replied to JamieR's topic in Algorithms, Data Structures and Class Design
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 -
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
-
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.
-
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
-
RIP, one of the geniuses who created Delphi, VCL, Kylix. Truly an immense loss.
-
How do *you* test ?
DelphiUdIT replied to david_navigator's topic in Algorithms, Data Structures and Class Design
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 -
Is there a Delphi lib that can generate an RFC-4122 UUID?
DelphiUdIT replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
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 -
May be this can help you: Delphi port for GRPC Bye
-
How to Get Android Phone Battery Percentage in Delphi 10.4
DelphiUdIT replied to JDS2018's topic in FMX
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 -
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
-
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
-
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.
-
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.