Jump to content

Edwin Yip

Members
  • Content Count

    430
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by Edwin Yip


  1. 1 hour ago, David Schwartz said:

     

    You're saying this is simpler than saying something like:

     

    
    var TAddressList = TList<TAddress>;
    
    // or
    
    var TAddressList = TList<TEyObjectList>;

     

    I don't understand the last paragraph at all. What are you referring to?

     

    Hi David, for simple use cases, the generic collections are simpler.

     

    However, please consider situations where you need to add a bunch of methods such as CopyFromLeft, CopyFromRight, Each, GetPropertyValuesByNameAsCSV,  and so on, to the enhanced list class.

    In this case I have two options, and I'll outline the pros and cons:

    • Inherit from the generic TObjectList<>
      • Pros:
        • Can eliminate some of the typecasting, but not all, without techniques such as Curiously Recurring Generic Pattern the OP is presenting. 
      • Cons:
        • From time to time, the compiler emits strange internal error and I'll have to restart the IDE.
        • bloated EXE sizes.
    • Inherit from the non-generic TObjectList
      • Pros:
        • No strange compiler errors.
        • No strange bloated EXE sizes.
      • Cons:
        • In order to eliminate all typecasting for the list users, you'll have to make a derived class for each object. 

     

    That being said, I might be wrong, but my gut feeling is using the non-generic TList/TObjectList is more comfortable, especially without the need to constantly restart the IDE.

     

    By IList, sorry for not being clearer, it's from Spring4D which is excellent, so it just occurred to me. I should have said TList<>.

    • Thanks 1

  2. This is a good technique, but speaking of generic collections, honestly, after using it in several projects, now except for dictionaries, I've gone back to using the non-generic collections from `System.Contnrs`.

    In order to make it comfortable using the object lists, all I have to do is to override the `Items` property for a specific class, like this:

      TAddressList = class(TEyObjectList) // TEyObjectList is an enhanced descendent of TObjectList
      protected
        function GetItem(Index: Integer): TAddress;
        procedure SetItem(Index: Integer; aObj: TAddress);
      public
        property Items[Index: Integer]: TAddress read GetItem write SetItem; default;
      end;

    Making such derived class is a 10-seconds operation with the help of MMX's class templates and Find-and-Replace.

     

    Maybe it's just me, but I really don't find too much cases where a `IList` can serve both the objects and string items (for example) well.

    Maybe for library writers it's good to have a collection to rule them all, but for users of libraries, specificity is a good thing.

    Another burden is the lame support of generics of the Delphi compiler...


  3. So after:

    1. I failed to upgrade LS Speller to support Unicode Delphi,
    2. found that the TMS one from 2017 is not fast enough for me,
    3. none of the above mentioned Hunspell wrapper has a dialog which directly operates on TRichEdit/TMemo

    In the end I found on Torry.net another hunspell wrapper originally written by Stefan Ascher, and have upgraded to support Unicode Delphi.

    Check my new post if you are interested:

     

    • Like 1

  4. Very helpful and quite complete list and details about spell check libraries by Darian, thanks for sharing!

     

    I use the LS Spell Checker mentioned above in a project written in D7 (and contributed fixes back to Luzius the author in the past).

    Now I need a unicode version (for D2009 and above).

    I tried to modify it and it seems to be tricky since it mostly deals with character strings.

    So I wonder, if anyone has a unicode version of it and can you share it with the rest of us?

    And happy new year to every one in the forum!


  5. @Ann Lynnworth, I'm not encourage nor pushing you to work on CJK words support in your FTS library, because I honestly think SQLite FTS is excellent already, even without Chinese word support built in, it allows me to supply call back procedures to overcome that, if I want to, thanks to the excellent works by authors of both SQLite and mORMot.

     

    But since you are interested, here are some points that might be of helpful:

    • No, spaces used in Chinese writings are not for delimiting words, it's impossible to just use spaces and punctuation to segment Chinese words.
    • Translation shown by services like Google Translate is a result of hard works by CS researchers all around the world in the past 4 or 5 decades. Yes, decades.
    • It's not always feasible for a desktop app to use Google API, even if it provides the word segmentation service (which I don't think so as far as I know). Further more, in case of China, we have the GFW, which makes it impossible to use Google API.
    • The 'cola' translation is not a mistake, but rather a local 'alias' (maybe only limited to that place) to cocaine :D

  6. 1 hour ago, Ann Lynnworth said:

    @Edwin YipCJK Chinese Japanese Korean?

    Do you have a reason to think that CJK in particular would fail while arabic and russian would work? If you do, I can go through the steps to get those translations added into the recipe sample database.

     

     

    Sure, because Chinese, Japanese and Korean have no such a thing as word delimiter :D

    Word segmentation, is a fundamental and professional term in your area, I guess.


  7. 2 hours ago, Ann Lynnworth said:

    Edwin-  thank you.  We will look closer at the SQLite FTS details.  Do you personally use SQLite FTS exclusively with text stored in SQLite?

    Yes.

    Quote

    Can one use the SQLite FTS against, say, data in Oracle or Postgresql ?

    No.

    Re. FTS5 sample compile-able  with Delphi, I know at least mORMot (which I use) and DISQLite have that.

    Hope it helps.


  8. Thanks for the answers Ann. I use mORMot for db connection.

    Just one note - if you take full-text search seriously (I know you do), you cannot ignore SQLite's FTS3/4/5 (with code sponsor from the Google search team) because it's the currently the number one embedded/desktop FTS engine in the world. The features you described seems to be all supported by SQLite FTS as far as I know.


  9. Sorry, but I'm able to help as I don't use it, but may I start a small not-so-off-topic discussion?

    When I first read from your post that winsoft has a WebView2 wrapper which supports old version of Delphi, I was exciting, thought that old Delphi can finally have the "TEdgeBrowser" component introduced in newer Delphi.

    Than I realized that in order to use it, the client PC would have to download a 123 MB WebView2 runtime!

     

    Oh, in that case, I think I'll keep using our good old Cef4Delphi...

     

    I'm puzzled, it seems that TEdgeBrowser also request that 120+ MB WebView2 run-time. I mean, why bother? Why not just use cef4delphi which provides you much more power and flexibility? This is a genuine question.


  10. 1 hour ago, Achim Kalwa said:

    Any special alignments of panels and buttons (Bottom, Right)?

    Can you provide a sample project?

    Yes, the bottom-most panel is alClient, on the second level are a list of row-panels with alTop, and on the third level one is alLeft and another is alClient.

     

    I'll try to get a reproducible sample later after the more important tasks are done... Thanks for your concern.

×