Jump to content

Henk Post

Members
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

3 Neutral

Technical Information

  • Delphi-Version
    Delphi 10.4 Sydney

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Henk Post

    Transform string into TDateTime

    Otherwise you neglect the date part calculated in the previous line.
  2. I use ECNativeMap. It is quite cheap and before buying you can ask for a full working trial version.
  3. Henk Post

    Why is TList freed in this code?

    The dic[‘aaa’] and l2 are the same object already. Hence, the assignment is not needed at all. But the direct assignment (formerly known as “AddOrSetValue” in this case will set the value. This is done by removing (and destroying) the old value and after that add the new one... Thus the l2 is “cleared” (destroyed).
  4. The first approach ensures a single caption and defvalue for each value of tprojecttype due to the array structure. With the list approach you could add multiple entries for one value of tprojecttype. You could replace the TList with a TDictionary. This way you can easily access the strings attached to the specific value of TProjectType. A third solution that I prefer is the use of a record helper for TProjectType. Then you can use ptMain.Caption and ptSub.DefValue. The additional strings are closely connected to TProjectType.
  5. it seems that you need an implementation of the abstract data type “priority queue” with operations like: - create - change key (decrease and/or increase) - insect - delete (only item with min key or any item?) - findmin The “best” implementation depends on the number of times each operation is called. Furthermore, if you know something about the range of the possible keys you might use that information to speedup your implementation. Within the area of shortest path calculations where the arc costs are integers bounded by a constant C you might use the Bucket implementation of Dial. In case of non-integer keys or when you encounter multiple empty buckets you can search for multilevel bucket implementations or buckets that contant a range of keys. Again, since there are a lot of possible implementations I can’t provide an answer. But you might search for shortest path implementations a lot of the literature is about a priority queue. Just one other idea derived from shortest path algorithms on large scale graphs (10M nodes) usually visit often only a few nodes (~10K). Then it might make sense to not create a priority queue that reserves memory for the keys of nodes. A better idea might be to implement an ISet, which easily can be done using a dictionary.
×