Jump to content

dummzeuch

Members
  • Content Count

    2650
  • Joined

  • Last visited

  • Days Won

    92

Posts posted by dummzeuch


  1. If you are maintaining a library, component or plugin for various Delphi versions you will sooner or later hit a point where it becomes necessary to have different code for some of them.

    Some examples are:

    • The constants faTemporary and faSymlink are only declared in Delphi 2009 and later, so you have to declare them yourself for older versions.
    • Some Open Tools API function have bugs in some versions so you have to implement a workaround.
    • Some classes or functions have been added to later versions of the RTL so you need to implement them yourself for older versions, but you don’t want to use these implementations for newer versions

    The traditional way of masking code for some Delphi versions is using the VERxxx symbols which the compiler defines, where xxx is the compiler version multiplied by 10.

     

    Note that the compiler versions started with Turbo Pascal, not with ...

     

    https://blog.dummzeuch.de/2018/12/02/conditional-compilation-for-various-delphi-versions/

    • Like 1

  2. I have just uploaded the second beta version of GExperts 1.3.12 for Delphi 10.3 Rio.

    NOTE: This is still a BETA!

    Also note that this is for Delphi 10.3 Rio only. It won’t work with any other versions.

    Beware of bugs, e.g. the Goto-Dialog enhancements still cause redraw problems if theming is enabled. But many bugs from the first beta have been fixed.

    Please report any bugs on SourceForge.

    Also note, that I have not yet tested the installer as I don’t have a fresh Delphi 10.3 installation for that test.

     

    https://blog.dummzeuch.de/2018/12/01/gexperts-1-3-12-beta-2-for-delphi-10-3-rio-available/

    • Like 2
    • Thanks 2

  3. There have been multiple bug reports regarding the stand alone Experts Manager that comes with GExperts. They all have in common that they fail with the error

    Expertmanager: ExpertManager.exe – System Error
    The program can’t start because vclactnband250.bpl is missing from your computer. Try reinstalling the program to fix this problem.

    Or similar messages giving a different package or a different version of the package.

    So, what is the cause?

    In short, you have most likely used the wrong GExperts installer. You must always use the one for the Delphi version you have installed. E.g. the current beta version for Delphi 10.3 Rio does not work for any of the older versions.

     

    Technically this is what happens


  4. Yes, I knew. And since the IDE hijacks drag&drop of files on some of its (and some plugin's) dialogs, I'm not very pleased with this. (e.g. Try to drag a file onto the GExperts "PE Information Expert". It works fine in the stand alone version, but when it's open in the IDE the file doesn't get opened in the PEIE but in the stupid hex editor.

     

    </rambling>


  5. The quality of the online documentation for Delphi at docwiki.embarcadero.com has improved significantly since the time when Borland fired all their help authors, so it is actually worth looking at when you want to know anything.

    I see links to topics in that documentation in blog posts and in online forums (e.g. DelphiPraxis [German] [English]), but they always link to a specific version of that documentation (e.g. the one for Delphi 10.1 Berlin). I am sure most posters would like to link to the latest version rather than a specific version but don’t know how to do that or that it is even possible.

    The good news is: It is possible [...]

     

    https://blog.dummzeuch.de/2018/11/30/linking-to-the-current-delphi-documentation/

    • Like 3
    • Thanks 1

  6. On 11/29/2018 at 9:28 AM, Rollo62 said:

    But on desktop there is the title line at the bottom too (not sure on mobile), but still scroling is necessary.

    Yes, that title is visible at the bottom, if the windows is wide enough (mine isn't). On mobile it is not there.

     

    (I hate those dynamic layouts, they are always just not good enough. I had to tweak the Wordpress theme on my own blog to look the way I want it to look on my usual browser window width (960 pixels = 1920/2).)


  7. On mobile it is difficult to get to the title of a post once it has moved out of the screen. One has to scroll all the way up to the top, because mobile browsers don't show the title bar. Basically the same is also true for desktop browsers since these moved the tabs or the menu into the title bar. Is there any option to have it shown permanently on the top of the page?

     

    Why is that a problem? I enter DP through the "unread posts" page and then open those posts in new tabs. Then I close the first tab and go through the ones I opened. Usually the title is not visible there.

    • Like 1

  8. When searching for "windows fastest way to check if a file exists" I get lots of hits that claim there is no API for it and one should use GetFileAttributes or FindFirst instead. But there is PathFileExistsA which according to the description does exactly that: Check if a file exists. It has been around since Windows 2000.

     

    Yet, FileExists in System.Sysutils still uses GetFileAttributes.

     

    Am I missing something? Is maybe GetFileAttributes actually faster than PathFileExistsA ?

    • Like 1

  9. (This is a different set of files, so this result can't be directly compared to the above.)

     

    It turns out that I wasn't doing anything wrong. It's not the loading and inserting that takes so long but building the list of files to load:

     

    loaded 1649 files
    found 188045 words
     

    searching time 2121 ms
    processing time 275 ms
    loading time 83 ms
    inserting time 10 ms
    sorting time 462 ms
    total time 2859 ms

     

    Thanks for listening. I think I'll just go down into the cellar to weep. 😉

    • Like 1
    • Thanks 1

  10. Hm, I must be doing something wrong:

     

    Initialize with:

    StopWatch := TStopWatch.Create;

     

    Start with:

    StopWatch.Start;

     

    Stop with:

    StopWatch.Stop;

     

    Continue with:

    StopWatch.Start;

     

    Get the total elapsed time in ms:

    Res := StopWatch.ElapsedMilliseconds;

     

    But the times don't add up. I looks as if the total elapsed time is only the time since the last call to Start.

     

     


  11. It seems that I have to use something different from GetTickCount. If I try to distinguish between loading the a file and inserting its entries into the result list, the resolution isn't high enough and I end up with a total loading time of 109 ms and total inserting time of 15 ms. Obviously those don't add up to 4 seconds.

    OK, I need that high performance timer code I have got somewhere ..

     

    @Primož Gabrijelčič since loading takes 4 seconds I don't think spending any time trying to speed up sorting will help any.


  12. Just did some timing:

    First try:

    Loading 2796 files with 1000377 lines in total

    loading takes 4125 ms

    sorting takes 375 ms

     

    Second try (the same files, possibly now in the file system cache)

    loading takes 4204 ms

    sorting takes 359 ms

     

    Third try (the same files, possibly now in the file system cache)

    loading takes 4235 ms

    sorting takes 359 ms

     

    Timing was done with GetTickCount.

     

    So it seems that the bottleneck is not sorting but loading the files or adding the entries to the result list.


  13. 1 hour ago, ByteJuggler said:

    I suspect you're running into something which had me gnashing my teeth in the past...  TStringList isn't the most predictable in terms of performance particularly when you set the Sorted property to True ahead of populating it...

    I'm not doing that.

     

    7 hours ago, dummzeuch said:

    So far I use a stringlist to store the result, with a shared PChar for each file name stored in the Objects property. Reading the files is done with a temporary stringlist and LoadFromFile. I then add the strings one by one to the result using AddObject. In the last step I sort the whole list. 

     

    The temporary string lists have not set Sorted to true, the files just happen to be sorted already (because they are in fact created with SaveToFile of a sorted string list in a different program).


  14. 5 hours ago, Uwe Raabe said:

    Can you elaborate on this a bit:

    • What is the sort used for (iterating and/or searching)?
    • How do you sort duplicates from different files?

    It's used for (incremental) filtering, e.g. I type "bl" and get two entries with "bla", one from file foo, the other from file bar. And of course additional entries that match "bl", like "blub" or "blood":

     

    filter:

    bl

     

    Result:

    bla -> foo

    bla -> bar

    blub -> spacebar

    blood -> human

     

    Because they are different entries. There are no duplicates within the same file, but there may be duplicates from different files. I want to display both.


  15. I've got a bunch of text files, up to a few hundred, each containing up to a few thousand lines, but some only maybe ten. Each line contains a single word, the lines are sorted, and the words are unique within the file (but not unique over all files).

    I need to read those files and add them to an in memory structure where they should be sorted and each entry should have a reference back to the file name it came from. This list should still contain the duplicates, so there could be multiple entries of "bla", one from file "foo", another from file "bar" etc.

     

    So far I use a stringlist to store the result, with a shared PChar for each file name stored in the Objects property. Reading the files is done with a temporary stringlist and LoadFromFile. I then add the strings one by one to the result using AddObject. In the last step I sort the whole list.

     

    This works, but it takes several seconds (which feels like eternity), even when read from a SSD. This is a problem because it happens frequently and the files are always different (no caching possible).

     

    So, what can be done to speed this up?

    I don't think that inserting into a sorted result list would be faster than adding unsorted and sorting at the end.

    Would setting the Objects properties first and then using AddStrings for each file be faster?

     

    I guess I should do some timing to find the bottleneck(s).


  16. On 11/24/2018 at 2:57 PM, Arnaud Bouchez said:

    Of course, the "Pro" and "Architect" features are missing (like FireDAC, DataSnap or RADServer).

    That should probably be >"Enterprise" and "Architect" features are missing<, because CE is supposed to have the same feature set as Professional.

×