How to use units in delphi project group
I have a group of projects with 3 projects (standAlone, ISAPI, module for apache), until now they all have the same file.pas and when modifying code and compiling the .exe, the .dll and .so are updated.
I want to add another unit (.pas file) to better organize classes and make it easier to navigate through the project code.
My question is, should I add the new file.pas to the three projects or only to the standAlone? (use RAD Studio 10.2)
See also questions close to this topic
How to proceed when passing a Record vs Passing a class to a procedure
Lets say i have a class called TProgramSettings which looks like this:
TProgramSettings = class flags: UInt32; ... end; PProgramSettings = ^TProgramSettings;
So I initialize my program like this:
var MyProgramSettings: TProgramSettings; begin MyProgramSettings := TProgramSettings.Create; MyProgramSettings.Flags := 0; ApplySettings(@MyProgramSettings);
And the procedure ApplySettings looks like this:
procedure ApplySettings(ProgramSettings: PProgramSettings); var MyObject : TCustomObject; begin MyObject := TCustomObject.Create; MyObject.Settings.Flags := ProgramSettings^.Flags; ... end;
Right now my code looks like this, however I wonder if there is any better way to do it? Am I breaking Object Pascal/Delphi code conventions? Would it be better to just make TProgramSettings a record? I really dont understand the difference between Records and Classes, all I know is that classes must be initialized. In the case I make TProgramSettings a record from what I've read I shouldn't pass a pointer to it since the record points to the same addres in memory and doesn't need to be referenced like the class. How should I go about it? Any help would be aprreciated :)
Google Speech gRPC sync request returns partial result
I am trying to call Google Speech API using gRPC from a Delphi 10.2.3 win32 application. Using Grijjy's serialization code and http/2 client (which is based on nghttp2.dll), I can succesfully make a call to the Speech API gRPC endpoint for synchroneous requests (/Recognize).
When I send a small audio file (Googles sample file audio.wav, containing "How old is the Brooklyn Bridge"), everything seems to be OK, except that only the first two words are returned ("how old").
I studied documentation (as found here), I checked status codes (200 OK), I tried other audio files (same results, only first words).
The fact that for several files the first few words are recognized correctly, including confidence factor, make me think that I am on the right track regarding serialization/deserialization, sending request headers, processing response etc.
Also tested using Using the REST API. Then everything works OK, so the issue must be gRPC-specific. (Using REST is not an option for me as that does not support streaming recognition)
So, for now, I do not know how to proceed.
Any ideas how to solve this are highly appreciated.
Windows 10: How make screenshot without show the Form on capture?
On Windows 7 this is possible only disabiling the aero theme and set
Alphablendproperty of Form to True. Already on Windows 10 this approach not works, then to not show the Form on screenshot i'm using Magnification library, that works fine but this uses a function (
MagSetImageScalingCallback) that is deprecated from Windows 7 and can be removed in a next update of Windows.
I found a video on Youtube showing how disable aero theme on Windows 10, killing dwm.exe and suspending winlogon.exe, the trouble is that this approach uses two separated executables.
I want know if someone know of some other approach that can work more near like like worked on Windows 7?
Thank you in advance.
My software is a remote acess support and i want lock the user (with this "Form locker") while i'm working (and seeing) behind of this Form.
Building Delphi project from Visual Studio Code
I have already set up build and debug environment for Object Pascal inside Visual Studio Code via FPC and GDB, but I just made build process work for programs containing only 1 .pas file via
"command": "fpc", "args": [ "-g", "-Px86_64", "helloWorld.pas" ],
Now, I need to build quite big Delphi project group (something like solution?) and it contains main project file .groupproj.
Is there a way to build the .groupproj via FPC somehow?
Or at least some workaround like conversion to .lpi and then build via FPC?
Or at least call Delphi compiler/builder from VS Code and build the whole project group via it? (but I don't like this option, because I prefer to not use Delphi)
Is it possible to download files created on Stypi and in the same format?
I'm looking for a tool for programming in real time with my partners and Stypi seems very nice but the download option would be amazing.