Der schöne Günther
Members-
Content Count
690 -
Joined
-
Last visited
-
Days Won
12
Everything posted by Der schöne Günther
-
I am astounded at both your claim that throwing exceptions in the constructor should generally be avoided.
-
Essential Delphi Addins survey
Der schöne Günther replied to Jim McKeeth's topic in Delphi Third-Party
Under "File Management & Deployment" -> What is "Delphi Docker"? Is it related to Docker? Where can I find more information? -
Is there a way to check is the "user Idle" (no interaction)
Der schöne Günther replied to Tommi Prami's topic in Windows API
auto close or logout when no mouse activity - VCL - Delphi-PRAXiS [en] (delphipraxis.net) -
Speech to Text for Writing Code.
Der schöne Günther replied to RockWallaby's topic in Delphi IDE and APIs
I have tried the Windows 10 built-in "speech to text" for a disabled person, just for dictating simple texts, and it is absolutely abysmal. Meanwhile, Microsoft has acquired Nuance and its "Dragon" software, but I think its focus is nowhere on writing code by speech. Dragon - The World's #1 Speech Recognition Software | Nuance UK -
I have a stupid question on how to "gracefully" terminate a Windows console application. I am not very familiar with how processes are established, how parent/child relationships are handled, consoles, all that. I might be missing basics. What I am doing: I have a central application with a VCL interface It uses CreateProcess(..) to invisibly spawn some console applications in the background Some are kept running 24/7, some are just started on demand, crunch some data, then terminate These console applications get their stdIn, stdOut and stdErr pipes redirected to some pipes I created in my central applications, so I can easily process their output, and control them (if they get controlled from stdIn). So far, everything worked like a breeze My issue now: I am now integrating another console application that just runs 24/7 and has no way of gracefully shutting it down It will only end on either pressing CTRL+C on a regular terminal, or by sending it a CTRL_BREAK_EVENT from my central application by using GenerateConsoleCtrlEvent. I know that Windows will "clean up" after the process has ended, but I am not sure if this way of shutting the process down is still a bit too "rude" My question: The documentation of the GenerateConsoleCtrlEvent function states "All console processes have a default handler function that calls the ExitProcess function." The documentation on ExitProcess gets into more detail of what it actually does, but I have a hard time understanding the implications. After sending the CTRL_BREAK_EVENT to the console application, my application will still give it a few hundred milliseconds to power down until it will resort to TerminateProcess but never has to, because the console application will finish within less than 5 ms. I am just unsure whether I am doing it right or maybe there is a better way of "gracefully" shutting down a console application that does not handle CTRL+C at all.
-
What do you think of "Local Global variables"
Der schöne Günther replied to Tommi Prami's topic in RTL and Delphi Object Pascal
I think that is the whole point of these nested methods, that they can access all the local variables that were defined before them? I never use them. I have only seen them in some legacy code of ours, and in all cases it made a tangled mess of spaghetti even worse 🍝 I'm sure someone can find a valid use case, though. -
I remember this being the first question I posted, back in 2013, when I first started with Delphi 🥲 I couldn't believe there was no such thing, so I asked.
-
Waiting for anonymous methods to complete
Der schöne Günther replied to brk303's topic in RTL and Delphi Object Pascal
Another simple option could be creating a System.Threading.ThreadPool, putting tasks in it and just destroying the Threadpool in the destructor of your TSomeClass. The Threadpool destructor will finish all tasks that are queued. -
Does anyone have good routines for parsing ISO8601 date(time) strings
Der schöne Günther replied to Tommi Prami's topic in RTL and Delphi Object Pascal
That is indeed annoying, but we haven't stumbled upon a "real" bug. We are using String/DateTime conversion for Iso8601 from the System.DateUtils all the time. -
Disabled floating point exceptions are problematic for DLLs
Der schöne Günther replied to A.M. Hoornweg's topic in Delphi IDE and APIs
Strictly speaking, this is not exclusively related to Delphi 12, your DLLs would have suffered the same, if they were called from another non-Delphi application. I believe that if your code relies on a certain FPU behaviour, it should either fail-fast by aborting if the FPU is not set correctly, or temporarily alter it, and then restore it to the previous state via try..finally. In any case, that would be your DLL would have to be changed. -
Good delphi learning sites for new team member
Der schöne Günther replied to mvanrijnen's topic in Tips / Blogs / Tutorials / Videos
That's a super interesting concept, but the content appears to be around 15 years of age. -
Delphi - Direct2D - Paintbox drawing is flickering
Der schöne Günther replied to Achille PACE's topic in VCL
I am not familiar with Direct2D, but confused nonetheless - Wouldn't you need a HWND to paint into? And a TPaintBox is not a window control, it's a simple TGraphicControl descendant - Meaning you may probably paint onto your form or into that very panel, but I fail to see how a Paintbox is even remotely helpful. Thanks for updating the code snippet. Didn't know you can also create a TDirect2DCanvas pointing to a Canvas, instead of a HWND. -
State of an uninitialised variables..
Der schöne Günther replied to Ian Branch's topic in Tips / Blogs / Tutorials / Videos
Yes, but we're just mere humans, and we don't even have a compiler that will help us by generating a warning. Even the gods from Embarcaddero occasionally trip over this, here is an example straight from the RTL itself: https://quality.embarcadero.com/browse/RSP-18300 -
State of an uninitialised variables..
Der schöne Günther replied to Ian Branch's topic in Tips / Blogs / Tutorials / Videos
I wouldn't really call those features - Rather oddities, quirks or flat-out defects 😬 You can hardly blame yourself for not expecting something like that. -
Real time desktop colors change like filters
Der schöne Günther replied to William23668's topic in Windows API
This surely isn't trivial. I once was about to make small tool for inverting the colors of windows that did not support a "dark theme" but I never really got started with it. It seems that you can use the (now deprecated) Magnification API to (selectively) transform colors or run filters on the whole screen (or just selected parts of it like rectangle areas or selected HWNDs): Magnification API overview (Applying Color Effects)| Microsoft Learn There is also its successor, the Desktop Duplication API - Win32 apps | Microsoft Learn which I had only used for grabbing screen data, not manipulating it. So I cannot say if it's a feasible solution for manipulating the colors. -
State of an uninitialised variables..
Der schöne Günther replied to Ian Branch's topic in Tips / Blogs / Tutorials / Videos
Although he explicitly said local variable, it could probably have been something like this: program Project1; function getText(const txt: String): String; begin // Incorrectly assumes "Result" got // initialized to an empty string Result := Result + txt; end; begin var text: String; text := getText('This should not be visible'); text := getText('Hello'); // Outputs "This should not be visibleHello" WriteLn(text); end. -
But what's new? And why is the .iso just 730 Megabytes? 🤔
-
DelphiLint v1.0.0 released!
Der schöne Günther replied to Elliot Hillary's topic in Delphi Third-Party
I have a stupid question about Does that mean it runs entirely self-dependent, and I do not need a license for SonarQube? -
My point is that it was not necessary to add this in the first place. Without knowing better, they got talked into changing a working part of the RTL, adding new bugs and breaking existing code.
-
Stuff like that makes me lose all hope. They still don't appear to have at least a minimal test coverage for the standard library. It was already reported and is allegedly fixed in "RAD Studio 12 Athens Patch 1" See: [RSP-43463] JSON serialization error with scientific double notation - Embarcadero Technologies -- Also, I have absolutely no clue why they decided to add this in the first place. The JSON specifications are crystal clear: https://ecma-international.org/publications-and-standards/standards/ecma-404/ See also: RFC 8259 - The JavaScript Object Notation (JSON) Data Interchange Format (ietf.org)
-
It sounds like you are trying to add an exception logging mechanism to your application. Would you like some help? All jokes aside, if that's the case, then you should really investigate proper stack tracing and exception logging mechanisms. In case (for whatever reason), you really just like to add the current line number into a string, then have a look at: https://stackoverflow.com/q/7214213
-
Well, that de-escalated quickly.
-
Delphi and "Use only memory safe languages"
Der schöne Günther replied to Die Holländer's topic in General Help
For those who still can't get enough, here is a very recent article from none other than Herb Sutter, of course with emphasis on C++ C++ safety, in context – Sutter’s Mill (herbsutter.com) -
So what I gather from this thread is The IDE supports placing frames at design time. While that enables sharing or referencing components like ImageLists, it may come with additional challenges (and bugs) The VCL both supports placing and re-parenting frames and forms at runtime. There is virtually no difference between these two Correct?
-
There is a Delphi plugin for SonarCube which only does very basic analysis. It could probably be extended. https://github.com/Embarcadero/SonarDelphi Apart from that, I am not aware of anything else.