Jump to content

Der schöne Günther

Members
  • Content Count

    645
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by Der schöne Günther

  1. Der schöne Günther

    DelphiLint v1.0.0 released!

    I have a stupid question about Does that mean it runs entirely self-dependent, and I do not need a license for SonarQube?
  2. Der schöne Günther

    FloatToJSON

    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.
  3. Der schöne Günther

    FloatToJSON

    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)
  4. Der schöne Günther

    Embed line number at design time??

    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
  5. Der schöne Günther

    Delphi 12: internal errors

    Well, that de-escalated quickly.
  6. Der schöne Günther

    Delphi and "Use only memory safe languages"

    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)
  7. Der schöne Günther

    TFrame versus SubForm

    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?
  8. Der schöne Günther

    Code Review for Delphi and Pascal

    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.
  9. Der schöne Günther

    TFrame versus SubForm

    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.
  10. Der schöne Günther

    Delphi 12 Watch list

    I am bewildered by two consecutive dots CLIENT_CODE..AsString
  11. Der schöne Günther

    Delphi and "Use only memory safe languages"

    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:
  12. Der schöne Günther

    Delphi and "Use only memory safe languages"

    For those interested, here is the very recent Secure by Design: Google's Perspective on Memory Safety (research.google) (March, 4th)
  13. Der schöne Günther

    Delphi 12 : Encoding Unicode strange behaviour

    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.
  14. Der schöne Günther

    REST Web Service

    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).
  15. Der schöne Günther

    Delphi and "Use only memory safe languages"

    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)
  16. Der schöne Günther

    check if App Minimized

    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.
  17. Der schöne Günther

    Lookup for "localhost" takes 2 seconds

    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?
  18. Der schöne Günther

    FYI - Several Embarcadero services are currently unavailable

    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.
  19. Der schöne Günther

    D12 - No more "unknown custom attributes"

    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!
  20. Der schöne Günther

    D12 - No more "unknown custom attributes"

    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.
  21. 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.
  22. 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.
  23. Der schöne Günther

    Thread Destroy with no corresponding Thread Create?

    In all cases? What are those cases? Can you provide a minimal example (that actually compiles) with all your test cases?
  24. Der schöne Günther

    How can I make TTimer run in the main tread ?

    Sounds like you're trying to write an app such as this here:
  25. Der schöne Günther

    How can I make TTimer run in the main tread ?

    No, it doesn't. What makes you think so?
×