Der schöne Günther
Members-
Content Count
693 -
Joined
-
Last visited
-
Days Won
12
Everything posted by Der schöne Günther
-
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.
-
Can you shed some light on what a "SubForm" is? I am working with frames all the time. The IDE will show the wrong frames and throw error messages if you are opening project groups where the name of a frame class is not unique throughout all projects in that group. The IDE will often randomly redundantly copy parts of a frame on its container's .dfm file (even entire image lists). You will have to use your versioning system and watch carefully to commit only the parts you changed yourself, and not the random insertions by the IDE.
-
I am bewildered by two consecutive dots CLIENT_CODE..AsString
-
Delphi and "Use only memory safe languages"
Der schöne Günther replied to Die Holländer's topic in General Help
and ... Rust which is often quoted in relation to memory-safety. Linux: It has been a (small) part of the Linux kernel since 6.1 Rust — The Linux Kernel documentation Windows: -
Delphi and "Use only memory safe languages"
Der schöne Günther replied to Die Holländer's topic in General Help
For those interested, here is the very recent Secure by Design: Google's Perspective on Memory Safety (research.google) (March, 4th) -
Your life will be much easier if you rely on Strings and Chars for text manipulation, not bytes. Convert to bytes when your text manipulation is done, not before that.
-
I am not familiar with Moodle, but I'd probably just roll my own. Take an Indy Http server, handle GET, PUT, POST requests, done. You're in full control. I never had the need for any of these 3rd party frameworks (I'm sure they're great, though).
-
Delphi and "Use only memory safe languages"
Der schöne Günther replied to Die Holländer's topic in General Help
Can't add to "How does this compare to Delphi" but here's three interesting standpoints why companies have come to enjoy the memory safety of Rust: Mozilla Source: Implications of Rewriting a Browser Component in Rust - Mozilla Hacks - the Web developer blog Microsoft Source: Why Rust for safe systems programming | MSRC Blog | Microsoft Security Response Center Google Source: Google Online Security Blog: Memory Safe Languages in Android 13 (googleblog.com) -
That is because Win+D does not minimise windows. It brings the desktop window to the foreground. You can validate this by pressing Win+D again which will send the desktop to the back again, and all windows are just like before. What for Win+M? This will actively minimise the windows, and this should get handled by the OnMinimize event.
-
I am running a http server locally. I am connecting to it from the very same process. I am very puzzled by the time it takes. To me, it seems that resolving the name "localhost" takes 2 seconds before it times out and defaults to "127.0.0.1": Time taken for http://127.0.0.1: 42 ms Time taken for http://localhost/: 2008 ms Time taken for http://localhost/: 3 ms This is the full source code: program Project1; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, System.Net.HttpClient, System.Diagnostics, IdContext, IdHTTPServer, IdCustomHTTPServer; type TServerClientTest = class private var client: THTTPClient; server: TIdHttpServer; private procedure handleServer( AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo ); public constructor Create(); destructor Destroy(); override; procedure Test(const url: String); end; constructor TServerClientTest.Create(); begin inherited Create(); server := TIdHTTPServer.Create(nil); server.Bindings.Add().Port := 80; server.OnCommandGet := handleServer; client := THTTPClient.Create(); end; destructor TServerClientTest.Destroy; begin server.Free(); client.Free(); inherited; end; procedure TServerClientTest.handleServer( AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo ); begin AResponseInfo.ContentText := '<html><body><h1>Hello World</h1></body></html>'; AResponseInfo.WriteHeader(); AResponseInfo.WriteContent(); end; procedure TServerClientTest.Test(const url: String); var stopWatch: TStopwatch; begin stopWatch := TStopwatch.StartNew(); try server.Active := True; client.Get(url); finally stopWatch.Stop(); end; WriteLn( String.Format('Time taken for %s: %.0f ms', [url, stopWatch.Elapsed.TotalMilliseconds])); end; var serverClientTest: TServerClientTest; begin serverClientTest := TServerClientTest.Create(); try serverClientTest.Test('http://127.0.0.1'); serverClientTest.Test('http://localhost/'); serverClientTest.Test('http://localhost/'); finally serverClientTest.Destroy(); end; ReadLn; end. Does anybody have an idea why this is?
-
FYI - Several Embarcadero services are currently unavailable
Der schöne Günther replied to Keesver's topic in General Help
That is one of the reasons why you should, at least for closed-source development environments, always have a backup/snapshot of your full dev environment/build system that is proven to work offline (or already is offline). If one day, Embarcaderos servers don't come back again, and only then you start wondering what to do, it's already too late. -
D12 - No more "unknown custom attributes"
Der schöne Günther replied to Attila Kovacs's topic in Delphi IDE and APIs
I have been doing Delphi for more than ten years now, and I didn't even know this existed. Looks like a full compilation, but without the linking. "Syntax Check" for my current project took about 30 seconds, which is less than half of what a full build takes. Thank you! -
D12 - No more "unknown custom attributes"
Der schöne Günther replied to Attila Kovacs's topic in Delphi IDE and APIs
I am sure I remember something like this, back in Delphi 10.0 or even XE7. The compiler will only check the attributes if the source code file (the binary .dcu it ends up in) gets rebuilt. So if you just change something about the attributes but nothing else, it will not trigger a warning. If you do a full rebuild, it will always trigger the correct warning. I think I never bothered to file a bug report. -
How do I terminate a thread that doesn't have an Execute method ?
Der schöne Günther replied to dormky's topic in Algorithms, Data Structures and Class Design
Did you read my post? If you don't like the Sleep(..), have the timer trigger an Event and have the thread wait for the event. -
How do I terminate a thread that doesn't have an Execute method ?
Der schöne Günther replied to dormky's topic in Algorithms, Data Structures and Class Design
You say you need it to wake up at fixed intervals. That is exactly what Sleep(..) is for. Keep in mind that 10 milliseconds is a very, very short interval. If we are talking about Windows, then accuracy that low is not guaranteed. As far as I know, it has been improved in recent Windows versions, but generally, you cannot rely on the thread waking up again in exactly 10 milliseconds If you want the thread to wait for something else, you use an Event. You can have the thread wait for an event which is triggered from (for example) your main thread. See System.SyncObjs.pas for event classes. -
Thread Destroy with no corresponding Thread Create?
Der schöne Günther replied to alogrep's topic in VCL
In all cases? What are those cases? Can you provide a minimal example (that actually compiles) with all your test cases? -
Sounds like you're trying to write an app such as this here:
-
No, it doesn't. What makes you think so?
-
İs possible same pointer size for Win32/Win64?
Der schöne Günther replied to kosovali's topic in Algorithms, Data Structures and Class Design
Isn't that like ... the whole point of Win32/Win64? 🤔 Recommended read: Embarcadero: 64-bit Windows Data Types Compared to 32-bit Windows Data Types -
Favorite feature(s) of other editors that Delphi does not offer
Der schöne Günther replied to dummzeuch's topic in Delphi IDE and APIs
One of my favourite was when an editor (obviously not RAD Studio) suggested me to rename a function slightly, so that it would become clearer that the data is processed in a specific way. Meanwhile, Delphis compiler won't even tell you when you're accidentally reading uninitialized values from records. -
How to read an .ini file of unknown encoding a FormatSettings?
Der schöne Günther replied to Tom F's topic in FMX
I made the same mistake some time back, but why don't you keep reading the existing local file as you always have? The local format settings or encodings surely have not changed? Then, save it to a new file with fixed encoding and date/time (and float!) format and finally delete the old file. At each startup, your app can first look for the "old" file format, and then the new one. -
DUnitX passed in params are confusing
Der schöne Günther replied to JamieMi's topic in RTL and Delphi Object Pascal
Keep in mind that while you *can* write DUnitX tests like this, you don’t *have* to. You can still just have a method and define the parameters in there. To be honest, this is what I mostly do as well. The attributes are nice when you have a test where you always expect the same behaviour, and you just want to test it with a bunch of different input values. (Can’t comment on the negative/positive testing. I mostly write tests for my very own stuff, and I’m probably horrible at it) -
We use DUnitX and it discovers all our silly mistakes before release
Der schöne Günther replied to Lars Fosdal's topic in DUnitX
It's certainly not going to be trivial, but surely worth it. Been there, done that. A highly recommended read on the matter is "Working effectively with Legacy Code"