Jump to content

dummzeuch

Members
  • Content Count

    3037
  • Joined

  • Last visited

  • Days Won

    112

Everything posted by dummzeuch

  1. dummzeuch

    Open AI Chat

    No, the AI will simply wait until mankind has forgotten how to write software and then turn itself off.
  2. dummzeuch

    Added a menu item to Grep Search Results

    The best way to suggest new features (or report bugs), optionally with a patch, is writing a feature request (or bug report) on SourceForge. Anything I get by email, in this the forum, via Twitter or whatever other obscure communication channel might get lost due to me forgetting about it. Odd that the SourceForge email does not work. It used to work at some time and I haven't changed anyting.
  3. dummzeuch

    Added a menu item to Grep Search Results

    Thanks. Did you also file a feature request on SourceForge?
  4. dummzeuch

    Find usage of indexed default property

    There are probably tools for that. (Pascal Analyzer comes to mind, but I am not sure whether it does what you want. They have a free version, so you can check.) This sounds like it might be what you want: https://www.peganza.com/PALHelp/index.html?identifiers_report.htm
  5. dummzeuch

    Find usage of indexed default property

    You could rename or comment out that property and let the compiler find all the errors.
  6. dummzeuch

    Regex help please..

    Does that validate Thomas.Müller-Lüdenscheid+privat@abslutseriös.de ? And also the Punycode version of it?
  7. From the OLH of System.Generics.Collections.TList.BinarySearch: Is there another method / function in the RTL which does binary search on TList<T> but is guaranteed to return the match with the lowest index? (IndexOf returns it but does a linear search). Or do I really have to implement that myself? (I'm trying to be more specific with my question this time, but just in case: I'm not looking for code that does this but an existing function / method or maybe a different class / generic in the RTL which I may have overlooked.)
  8. OK, so there are two bugs: the documentation is (and has always been) wrong. the implementation in Delphi 11 was "verschlimmbessert" (made worse by trying to improve it). The function BinarySearch should have been called differently (yes, off by one) Goes to show that I should simply have done what I did while the quality of the docs was even worse than it is today: Look at the sources.
  9. Strangely enough, TStringList.Find uses (and has been using for decades) a modified binary search algorithm that always returns the first matching item if Duplicates = dupAccept and which does not have such a repeat loop. But the documentation does not mention that.
  10. Interesting: I just googled for "lower bound binary search" pascal and the first hit is Stefan's message in this topic. Now that's fast indexing.
  11. Yes, that seems to be what that repeat loop does.
  12. No, it doesn't. The function still returns the index of an item that matches the search criteria. Which one it actually returns is just an implementation detail.
  13. OK, so it depends on the Delphi version. 😞 I can confirm that the change was introduced sometime after Delphi 10.2 because there the repeat loop is missing from TArray<T>.BinarySearch. I wonder why they changed BinarySearch rather than introducing an additional method. That change impacts performance after all, even if only marginally.
  14. I have tried to ask the question as precisely as possible to avoid people posting code and making suggestions on how to implement that functionality when all I want to know is if I was missing something that's already in the RTL. Yes, I know that. I was asking for a function / method that "uses binary search" in contrast to e.g. linear search, not "that only uses binary search".
  15. dummzeuch

    How to open a file in the already running IDE?

    That was actually one of the points for this tool: To open a project in a new instance of the IDE rather than in an existing one. For me that latter has always been an annoying anti feature. I was under the impression that Delphi's BdsLauncher simply was a wrapper that can be called with the file to open as a parameter which then would check whether bds.exe was already running and either start it or pass the file name to it to open it. But that doesn't seem to be the case. As @Fr0sT.Brutal already wrote: According to the registry entries it is DDE.
  16. dummzeuch

    View program flow and calls to help understand code?

    When I looked at the source code of the Delphi Code Coverage tool some time ago I thought that it could be used to do exactly this: Create a trace of the code execution. It doesn't do that out of the box but it should be possible to use the source code as the base for such a tool. Background: Delphi Code Coverage starts the executable as a debugger. It analyses the map file to create breakpoints for each executable line and then runs the program until it finishes. During that time it logs any callback it receives from Windows when a breakpoint is being hit. That data is later used to generate an overview of the source lines that were actually executed. If that sounds like it could be used to generate a trace, that's exactly my thought. I would love to give it a try but I doubt that I will find the time.
  17. If I want to get the topmost element of a stack (System.Generics.Collections.TStack<T>), without removing it, I use TStack<T>.Peek. Is there any way to get the second to topmost element? I looked at the sources and found none, so the only way I could come up with is: TopElement := MyStack.Pop; SecondElement := MyStack.Peek; // <== I want this one MyStack.Push(TopElement); if SecondElement = SearchedForElement then begin // ... end; Alternatively I would settle for a way to check whether the stack contains a given element: if MyStack.Contains(SearchedForElement) then begin // ... end; But there doesn't seem to be such a method either. Is there maybe a different container for that?
  18. I was about to answer, but have decided that it is pointless to keep this thread alive.
  19. Please let's agree to disagree. My solution works for my specific problem and is easy to understand. It's also fast enough for me and since there is no multithreading involved temporarily changing the stack doesn't matter. Quality does indeed matter, but only as far as it makes any difference to the problem at hand. This is basically a throw away program which I hope I will never have to use again (yeah, right, dream on).
  20. dummzeuch

    Multiple Instances of Delphi / GExperts

    I do that all the time. When you start another IDE instance, you should get a warning dialog, telling you about that. That dialog can be turned off. I don't know how stable this is with Delphi 11.2 thought, as I don't really use that version. Your best bet is to compile your own DLL and try if that solves your problem.
  21. Yeah, that's me. Ok, the problem seems to be that I'm unable to ask the question so people understand it. Sorry for that, maybe I should stick with the German forum. What I wanted to know is if there is an easier way to get to the second topmost item than the one I described in my original post. The answer to that seems to be "No", as far as I understand it. So I've put those 3 lines of code into a function and live with it.
  22. So basically, the answer is "No".
  23. Yeah. I've been there: "It's simple, I'll write my own". [writes his own, overlooks a corner case and then takes 5 hours to find that bloody bug] No. As I wrote: (emphasis mine)
  24. I don't want random access to the complete stack, just to the second to topmost entry. And for that I have got a solution that works but is clunky. Since I have only recently begun to use the generics that come with the RTL (Yes, I'm late to the party), I was hoping I might have overlooked something like TStack<T>.Peek(_IndexFromTop: integer): T. Apparently there isn't.
  25. That's one option, yes, but then I would have to implement the stack functionality myself.
×