Jump to content

dummzeuch

Members
  • Content Count

    2639
  • Joined

  • Last visited

  • Days Won

    91

Everything posted by dummzeuch

  1. 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.
  2. 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".
  3. 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.
  4. 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.
  5. 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?
  6. I was about to answer, but have decided that it is pointless to keep this thread alive.
  7. 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).
  8. 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.
  9. 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.
  10. So basically, the answer is "No".
  11. 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)
  12. 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.
  13. That's one option, yes, but then I would have to implement the stack functionality myself.
  14. TStack<T> does not have a List property (at least in Delphi 10.2)
  15. dummzeuch

    Function with 2 return values ?

    I can declare a method parameter of some interface type and pass any class to it that implements the methods that interface defines, independently of any inheritance. If I use an abstract class as type for that parameter, I can only pass classes that descend from that abstract class.
  16. dummzeuch

    Function with 2 return values ?

    No, that's not the same. To use an abstract class, your implementing class must inherit from it. A pure interface does not require that.
  17. dummzeuch

    ANN: Better Translation Manager released

    brc32 (part of Delphi) should be able to do that. There are probably quite a few other tools. On the other hand: Why do you need to do that after the exe has finished building? If your files already exist at that point, why not simply add them using the {$R filename.res} directive in the source code?
  18. dummzeuch

    Function with 2 return values ?

    My problem with interfaces and their implementation in a class is that you have to type everything twice (copy, of course). I wish there was some hybrid kind of class that simply adds reference counting on top of normal class functionality. Basically the compiler could autogenerate an interface declaration for the public methods of a class and modify the constructors to return that interface instead of the class. Hm, didn't we have reference counted classes in the ARC compiler?
  19. dummzeuch

    ANN: Better Translation Manager released

    If you happen to use dxgettext, there is the assemble tool for that. But given the topic you're posting under, you probably don't use it.
  20. No, but that's in Europe, so you can't compare salaries easily to US salaries, even if you convert EUR to US$. Looks a bit on the low side to me too though, especially for Rome, but I am not that familiar with salaries and cost of living in Italy either.
  21. Which will make it more difficult for us Delphi developers as there will be even more false positives with virus scanners.
  22. And just to be sure: Always close the current project before opening a new one. That should remove the package and then reload it when the new project is opened.
  23. dummzeuch

    custom fonts and sizes showmessage()

    Of course there are several reasons why one would prefer to use ShowMessage: It's a standard dialog form so the user will recognise it immediately and know how to use it If the user skins his Windows installation, the dialog will automatically be skinned too If the way Windows shows these dialogs changes, your own dialog will automatically change too Changing the standard ShowMessage dialog in any way (different font etc.) will negate these advantages. The same applies to building a custom form. Having said that: I too have created a dialog that replaces ShowMessage. The main reason was that I wanted to center that dialog on the parent form (or at least the main form) rather than the current monitor. (If anybody is interested: It's in w_dzDialog, which is part of my dzlib.)
  24. dummzeuch

    Grep Results dialog..

    Now close the window and save the desktop again.
  25. dummzeuch

    Grep Results dialog..

    Actually that might be due to the IDE rereading the desktop when you open a new project. Did you save the desktop after you placed the Grep Result window? (It works fine for me in Delphi 2007, XE2 and 10.2. I don't use Delphi 11.)
×