Der schöne Günther
Members-
Content Count
691 -
Joined
-
Last visited
-
Days Won
12
Everything posted by Der schöne Günther
-
Need a "Delphi programming guideline"
Der schöne Günther replied to TheOnlyOne's topic in General Help
There is a "style guide" which focuses on Delphi-relative conventions like that weird "F" prefix for field names and such: Delphi’s Object Pascal Style Guide - RAD Studio (embarcadero.com) Embarcadero does not provide official guidelines on how to write good and re-usable code in general. At some point, probably most of us have dealt with with ancient Pascal spaghetti code that is almost impossible to understand. I feel your pain. If your colleagues are stuck one or two decades ago and refuse to study further, I doubt an "official" guide from the vendor of your IDE is going to change much. -
What are the correct settings for "Code inlining control"?
Der schöne Günther posted a topic in RTL and Delphi Object Pascal
Under Project > Options > Building > Delphi Compiler > Compiling we have the project-widde option Code inlining control. It can also be set in code with something like {$INLINE ON|OFF|AUTO}. How inlining works and when the compiler cannot inline methods is explained in Delphi's Docwiki under Calling Procedures and Functions. It states that the default project setting is that inlining is set to ON which I found to be correct. However, the Help page Compiling states that OFF is the default setting. I am not sure what is the right choice for debug and for release builds. Wouldn't it be Set Inlining to OFF for all debug builds Set Inlining to AUTO for all release builds Or is there no universal recommendation and it depends on the project and its requirements? Many thanks in advance. -
The StackTrace property is just a placeholder, it is always empty. There is no built-in way to get the stacktrace. Hard to believe, but here is what the official documentation says: System.SysUtils.Exception.StackTrace - RAD Studio API Documentation (embarcadero.com) A few years ago, I used the Jedi Code library. After that, I completely removed the JCL from our products and since then, I am just using the "FastMM_FullDebugMode.dll" which exports a few handy methods that will give you the stack trace as a string list.
-
Vonoroi / Fortunes algorithm
Der schöne Günther replied to cwangdk's topic in Algorithms, Data Structures and Class Design
If you already have code that outputs a bitmap, wouldn't the easiest solution be swapping out the canvas with an "svg canvas" and keeping the drawing code? Quickly Create SVG (Scalable Vector Graphics) files with SVG Canvas Library for VCL in Delphi And C++Builder (embarcadero.com) Haven't tried anything like this, but maybe this is a feasible option. -
Default(TMyRec) usage
Der schöne Günther replied to Darian Miller's topic in RTL and Delphi Object Pascal
Yes, I do. I expect the compiler to optimise out unnecessary assignments. If it's supposed to be immutable, the record will have private fields and a public constructor you will have to use. Adding a new field to a record later will cause it to be uninitialised, unless you hunt down every instance in your code and add an assignment for the new field manually. Unfortunately, the Delphi compiler isn't even able to emit a warning when an uninitialised record field is used or returned. program Project1; type TRecord = record b: Byte; end; function getRecord(): TRecord; begin // end; var r: TRecord; begin r := getRecord(); WriteLn(r.b); readln; end. -
I am using both mechanisms (depending on whether I am using a Mac or the Windows PC they run on directly) and found it to be of little difference. I am running Delphi 10.0 in a VM with 3 gigabytes of RAM and 2 virtual cores, and Delphi 11.1 in a VM with 4 gigabytes and 3 virtual cores. For me, it's more than sufficient. The VM only does the RAD Studio IDE and Visual Studio Code as the frontend for git. Nothing more.
-
Does Visual Studio's Intellisense fail as often as Delphi's Code Insight?
Der schöne Günther replied to PeaShooter_OMO's topic in Delphi IDE and APIs
It's the LSP. I sometimes do Delphi inside of Visual Studio Code (which is a fantastic editor), and there Delphi's LSP often crashes as well. -
The algorithm is not faulty, the problem is that they always try to get to 100%. At runtime, you can easily set them all at once. Do this by calling BeginUpdate() and EndUpdate() on the column collection. 2022-12-14-12-32-02.mp4 Also, by setting all columns to zero, they will take up their space equally. Here is the checkbox from the video above: procedure TForm2.CheckBox1Click(Sender: TObject); begin const cols = GridPanel1.ColumnCollection; if(Sender as TCheckBox).Checked then begin cols.BeginUpdate(); try for var index := 0 to Pred(cols.Count) do cols[index].Value := 0.0; finally cols.EndUpdate(); end; end else cols[0].Value := 0.0; end;
-
@Stefan Glienkewhere is the most recent download? The page still links to https://files.spring4d.com/TestInsight/1.2.0.0/TestInsightSetup.zip Your comment here states that there is at least a 1.2.0.4. The most recent version I have been able to find was listed at https://bitbucket.org/sglienke/testinsight/wiki/Home and links to https://files.spring4d.com/TestInsight/1.2.0.1/TestInsightSetup.zip
-
Shouldn't var Foo: IFoo := FunctionReturningInterface() suffice? 🤔
-
Attempt to release mutex not owned by caller
Der schöne Günther replied to desert_coffee's topic in RTL and Delphi Object Pascal
Hi there. TMutex.Release() is just calling ReleaseMutex(..) of the regular Win32 API. Here is its documentation: ReleaseMutex function (synchapi.h) - Win32 apps | Microsoft Learn You acquired the mutex directly in the constructor of TLockGuard. You will have to release it from the same thread that acquired it. By the way: In your destructor you are calling _mtx.Release() even if _mtx is nil By the way: Can you post a complete example of how you are using your TLockGuard? For simple cases I have not been able to reproduce your issue. If you are constructing it locally, reference it as an IInterface and do not pass it somewhere else, it should be fine ... I guess. -
Can I develop with Smart App Control activated?
Der schöne Günther replied to MartinPe's topic in General Help
Source: What is Smart App Control? - Microsoft Support -
Do the tests still show up after you have cleared the list? ❌ I think TestInsight will still keep tests in its lists, even if they don't exist anymore.
-
My "Execute" on Thread is not called anymore... I'm staying crazy and dont see the my error
Der schöne Günther replied to programmerdelphi2k's topic in Algorithms, Data Structures and Class Design
Can you post a complete, working example? Your TMythread::Execute() is being called. -
You really need to understand how floating point numbers work on computers. This is not a "bug" Feel free to try this out with other C++ compilers, they won't report zero either. https://onlinegdb.com/c2zTpiuZ_c Since you did redo your post completely: You need to be aware that you are mutating the variable several times comes with a loss of precision every time. It depends on the target platform, compiler optimizations and more. You will have to accept that regular floating point arithmetics are not 100 % precise.
-
I'm no expert on that, but 0x073302E8 is your instruction address. Can't you just start your application in the debugger (press F8) and then use "Go to address" and see where that ends up?
-
See Writing Dynamically Loaded Libraries - RAD Studio (embarcadero.com) Quote (emphasis by me):
-
Are you using range checking in your debug build? Maybe the compiler does different range checking for static and dynamic arrays.
-
Subscribe to a web stream and listen to incoming streams
Der schöne Günther replied to p-samuel's topic in Network, Cloud and Web
In Delphi, you will usually take a StreamReader and use its ReadLine() method which will block. -
https://docwiki.embarcadero.com/RADStudio/en/Installation_Notes#System_Requirements
-
Yes, this is a well known restriction of Chromium. It is so common that it baffles me this is also one of the many things that Embarcaderos wrapper TEdgeBrowser has no easy access to. You will either have to set environment variable you mentioned inside your own process (which should only be a last-resort workaround), start your own process with this command line argument (even worse) or make changes to the edge browser source code, so it will feed the required parameters into AdditionalBrowserArguments. Or use another library that offers more flexibility. That's for sure, but who said those files were writeable?
-
Do you think Embarcadero would let me switch my license from Delphi to C++ builder?
Der schöne Günther replied to Al T's topic in General Help
Why do you need to convert them to another language? Can't you build the C++ stuff as a separate library or process and then use that from your Delphi application? -
Move project to pc with different scaling (100% -> 150%) - Impact on GUI ?
Der schöne Günther replied to CyberPeter's topic in VCL
Not sure what version control system you're using, but you should be able to commit just parts of your changes / revert parts of the changes. I do that all the time, because it happens all the time. You just add a button and the IDE decides it's now time to change a dozen other things within your .dfm file as well... -
TEdgeBrowser - Any successful deployments and updates?
Der schöne Günther replied to David P's topic in VCL
We started doing that even before it was considered "stable" and never had a problem. To be honest, I'm only using it for displaying PDFs and some small live value display, nothing too fancy. I think we just make sure that the WebView2Runtime is installed, and that's it. -
Is loading a resourcestring not threadsafe?
Der schöne Günther replied to Perpeto's topic in RTL and Delphi Object Pascal
I am loading resource strings from several threads and never had a problem. That doesn't mean it's ok to do so, but I never had anything while you make it sound like an AV is guarenteed to happen unless you surround it with critical sections. Can you create a reproducable sample?