Jump to content

David Heffernan

Members
  • Content Count

    3701
  • Joined

  • Last visited

  • Days Won

    185

Everything posted by David Heffernan

  1. Any data structure that encodes depth in a static name is surely the wrong solution. Have you read any books on data structures?
  2. What you really want is to separate the iteration over the data structure from the action that you perform on each item. Otherwise you end up with massive duplication of code. Also, this data structure seems pretty unlikely to be the right way to represent any data structure I can imagine.
  3. David Heffernan

    Overload methods or use unique names?

    How do you know that?
  4. David Heffernan

    IDE Screenshot too large?

    https://devblogs.microsoft.com/oldnewthing/20150304-00/?p=44543 https://devblogs.microsoft.com/oldnewthing/20120326-00/?p=8003
  5. David Heffernan

    Give a form its own icon on its task bar button?

    Assign to the form's Icon.
  6. David Heffernan

    Where do I declare a function inline ?

    As it stands, in your code it will only be inlined in the code in the same unit as the implementation, and only for calls in functions declared after the inline method implementation. You can check this yourself by inspecting the disassembly of calling code.
  7. David Heffernan

    Best practices for handling a Stalled thread

    If you want to terminate the process, terminate the process. Ignore the threads. System will tidy up all the resources, including the threads. Let it do it though, don't you try. ExitProcess does the job.
  8. David Heffernan

    Best practices for handling a Stalled thread

    Not so. You are just as likely to have subsequent errors as the shutdown code in the main thread runs.
  9. David Heffernan

    Best practices for handling a Stalled thread

    I would handle this by using screenshot code that did not hang.
  10. Hmm I did misunderstand. Somewhat tricky algorithm to write down. You need a cursor starting at each end and when they meet you are done. And you reorder the list which may very well be undesirable.
  11. You don't understand. Moving an item to the end leads to all items between that point and the end being moved down. It's perfectly possible to implement this without a realloc and without the dire performance traits of your chosen method. And if your array is huge and push the boundaries of available memory as you suggest, then your algorithm is unspeakably dire.
  12. No, that is not fastest. It can be done with at most N item moves where N is the final coun of the list.
  13. David Heffernan

    Open Url From Current Line

    I doub you'll find a single book written in the past 25 years that would advocate nesting over early return. All the most respected experts agree on this and have done for years. Which books are you reading?
  14. We are all given a finite time here. Why would we spend it optimising something that wasn't a bottleneck. Imagine measuring, identifying the bottleneck, optimising, and the observing real discernible performance benefits? How great does that feel? Conversely, imagine expending time on work that yields no benefit. And worse, you likely end up with code that is harder to read and maintain. Usually this just results in bugs. Think of it, you spend valuable time making your program worse. You may as well just go to the pub and leave the code alone. You have a good time, and your program is better. Win win.
  15. What evidence do you have that this task is a bottleneck?
  16. David Heffernan

    Blogged : Introducing DPM - a Package Manager for Delphi

    In my world I need to build against multiple different versions of the same library. This is not an obscure requirement. It happens pretty much anytime you maintain development and release branches. When you maintain legacy versions. This is a mainstream scenario in any professional programming setup. Global settings are simply incompatible with that.
  17. David Heffernan

    can you reference unit name in code?

    Actually, I think that might be right, there is a section in the map file that lists the units in the order they are initialized. Also, there are tons of questions on this topic on SO.
  18. David Heffernan

    Overload methods or use unique names?

    I do, sometimes, use overloaded methods. You are simply not going to learn anything by asking people to tell you how the decisions to make when they don't have the necessary information to make them. You need to understand concepts but you just seem to ask us to tell you what to do in a specific case.
  19. David Heffernan

    Overload methods or use unique names?

    I don't think an answer to that question will help you.
  20. David Heffernan

    can you reference unit name in code?

    Parsing the detailed map file is probably the easiest way to do this is a large project. If you know you have dependencies on initialization order, I'd solve the problem by removing those dependencies.
  21. David Heffernan

    Overload methods or use unique names?

    It's not an effective way to learn. A really good book is what you need. In my opinion.
  22. David Heffernan

    Overload methods or use unique names?

    No. The caller has to tell the callee what to do. The callee needs to get the information from somewhere. I wonder, do you have any good books on software design? I really don't think this sort of question has proved fruitful.
  23. David Heffernan

    Closing an external App.

    Window text is simple an attribute owned by the window. Programs can do what they want with it. Top level windows typically display it in the caption. Edit controls display it as the text to be edited.
  24. David Heffernan

    Closing an external App.

    It not the caption. Its the window text. By default the system uses that text as the caption, but it is possible to have windows with no caption, that do have window text.
  25. David Heffernan

    Closing an external App.

    Read the documentation. It's the text of the window. Documentation is always the first port of call. Don't guess. You talk about the name of the application. Well, an application name isn't something well defined in programing terms. There may be conventions that the executable file has a name that matches what you think of the application name. But nothing enforces that. You need to decide on the right way to identify your process. If you try to kill windows with the class name TMainForm then there will be collateral damage. You'll kill my program's main window! So, try to work out how to robustly identify your process.
×