Jump to content

David Heffernan

Members
  • Content Count

    3586
  • Joined

  • Last visited

  • Days Won

    176

Everything posted by David Heffernan

  1. That's not the right way to solve this. The right way is to iterate over the string once rather than 5-10 times. Why would you want to iterate over the string so many times?
  2. David Heffernan

    Yaml to json simple convert

    It's really way easier in Python. Essentially a two liner, one to parse, and one to dump. That's how I'd do a one time conversion.
  3. David Heffernan

    Modernizing the Dev-C++ IDE

    I don't know about you, but I use the best tool for the job, not the best tool written in Delphi!
  4. David Heffernan

    Modernizing the Dev-C++ IDE

    Does anybody really see Dev C++ as being very useful these days? Unless I am mistaken, there are numerous IDEs now that far exceed what Dev C++ can do. Surely this is just a link about some work done on a legacy Delphi project. I can't believe the intent is to suggest that Dev C++ is relevant to C++ developers today.
  5. Leaving aside the issues that are commented on by other, instead of if Supports(fBaseFrameClass, ISupportTask) then (fBaseFrame as ISupportTask).CheckTask; surely you need var Task: ISupportTask; ... if Supports(fBaseFrame, ISupportTask, Task) then Task.CheckTask; Two changes: Ask the implementing object rather than the class whether or not the interface is supported. Use the three argument overload of Supports so that you can get the interface while you are querying for it.
  6. David Heffernan

    AnsiPos and AnsiString

    Take some time to find/write helper functions to do the sort of processing you need on these byte arrays and your code may even end up easier to read!
  7. David Heffernan

    AnsiPos and AnsiString

    AnsiString is no longer like an array of bytes because of the implicit encoding conversions that happen with that type. If you really have byte array data then perhaps a byte array is what you need.
  8. David Heffernan

    AnsiPos and AnsiString

    Why are you using AnsiString at all? Why aren't you using the string type?
  9. David Heffernan

    Yaml to json simple convert

    Trivial to do in Python. Read the YAML in, then dump to JSON. I'm assuming that this is a one time conversion. Because otherwise you'd use a YAML parser directly and wouldn't convert to JSON.
  10. What Mike is concerned about is that calling Replace is slower than filtering with Pos before calling Replace. In reality he is asking the wrong question. The right solution to the problem (see five year old SO question) is to iterate over the input string once rather than 5-10 times.
  11. Well there's your problem! Run through the string once only and you'll get a huge boost in performance. I described how to do that in my comment to your Q.
  12. Why not achieve faster in all cases then? Does the code that you are looking at, that is a bottleneck, still call StringReplace multiple times per input string, as per the SO question?
  13. If the code is not a bottleneck then surely you'd reach the opposite conclusion.
  14. You really need to learn about the extract method refactoring.
  15. No. I'd consider writing one myself if I found that my program was spending a significant amount of time in an inefficient function. But we've had this discussion before and you don't believe in that approach.
  16. Nothing needs to be fixed. StringReplace is giving correct output, isn't it? You absolutely don't want to be calling Pos inside an efficient implementation of StringReplace. All that you are learning is that StringReplace is not efficiently written. The correct way to deal with that is to find/write and use a more efficient function to replace text. That is of course if this is a bottleneck in your code. Have you checked? BTW, do you really have calls to Pos littered through your code whenever you call StringReplace?
  17. David Heffernan

    32bit bitmap

    Really? I mean true for bmp files but Windows API supports 32 bit bitmaps fine so far as I know.
  18. David Heffernan

    32bit bitmap

    Why don't you want to use a third party component?
  19. David Heffernan

    Prevent External DLL from Exiting Application

    That's what RPyC would gain you
  20. David Heffernan

    Hashing Street Addresses ?

    Two different values can have the same checksum. Read my previous post again. What you are expecting is impossible. I mean it. Impossible.
  21. David Heffernan

    Hashing Street Addresses ?

    What is a signature? All these terms being bandied about!!
  22. David Heffernan

    Hashing Street Addresses ?

    Yeah, that's not a hash. And what you want (known max length) is clearly impossible. If you could store arbitrary data in a lossless way in a data of a fixed length, then well, you can see where I am going.
  23. David Heffernan

    Hashing Street Addresses ?

    OK, maybe I misunderstood. I saw "hashing" and "indexed on", and inferred that you want to use a hashed collection like a dictionary. Hence the need to define data structure and what equality means. But perhaps you want to hash this data for some other reason. What will you do with this hash?
  24. David Heffernan

    Hashing Street Addresses ?

    First of all, don't worry about hashing the data. Work out how to represent the data, what data structure to use. And then define what you mean by equality for this data. Once you have done that, and have a clear specification of that, defining a hash function should be obvious. But if not, we will be able to help at that point. But first you need to define the data structure and the equality operator.
  25. David Heffernan

    Prevent External DLL from Exiting Application

    Any code can terminate the process. The way you avoid this is to ensure that the code you run doesn't lead to fatal errors. In this case it sounds like the issue is that you need to make sure that your environment has the correct packages installed.
×