Edwin Yip
-
Content Count
430 -
Joined
-
Last visited
-
Days Won
3
Posts posted by Edwin Yip
-
-
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.
-
Pros:
-
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.
-
Pros:
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<>.
- 1
-
Inherit from the generic TObjectList<>
-
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...
-
10 hours ago, Erik@Grijjy said:It may not be supported by the very first (few) versions of Delphi that introduced generics, but I have no way to test that.
FYI, XE4 can compile the tests, after removing the inline var statements.
-
This is where GExperts Code Proofreader come to rescue.
I couldn't code without it.
When I encounter situations like what @dummzeuch described, I don't disable it, doing that is like a Chinese old saying:
Quotegive up eating for fear of choking
;)
You can get around it, can't you? For instance, use another var name instead.
- 1
-
HTML Component Library + StyleControls from almdev can do that.
-
Hi Ian,
By "for Unicode" it means it can be compiled and run correctly under Delphi 2009 plus, of course it also works for ANSI.
The repository already contains a libhunspell.dll in the demo subfolder.
Hope it helps.
-
So after:
- I failed to upgrade LS Speller to support Unicode Delphi,
- found that the TMS one from 2017 is not fast enough for me,
- 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:
- 1
-
In case anyone is interested, and better, want to contribute, I've upgraded THunSpell which was originally written by Stefan Ascher to support Unicode Delphi and created a github repository.
Attached Demo screenshot.
- 6
- 1
-
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!
-
The official QOI repo as 3.8K stars, no bad.
-
10 hours ago, angusj said:Hi wuwuxin. Here are several short videos that demonstrate Image32's interactive capabilities...
The Image32-based controls demo is cool! And this seems to be a new feature added most recently.
-
@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
-
Hah, yes, languages in the world are extremely diverse.
Algorithms exist, and open source projects too, some in c and some in golang on github.
AFAIK, there is only one in Pascal: https://github.com/PassByYou888/zChinese, but I don't know how good it's and the size of the files.
-
QuoteI'd say you would be able to verify CJK support for yourself with the free Rubicon Lite edition and the FireDAC bridge to SQLite.
Well, I must say, from your description I already know it most likely doesn't support it, because you didn't know CJK words have no word delimiters ;)
-
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.
-
@Ann Lynnworth, Does it support CJK words? SQLITE FTS does not, and that's my only complain about it.
-
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.
QuoteCan 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.
-
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.
-
Great! Another amazing project by you!
What's the planned supported Delphi versions ;)
-
A few questions if you don't mind.
- How does it compare with SQLite's FTS? ( would appreciate a genuine comparison table).
- Does the db backend support SQLite? Has built-in support (asking this because I don't use FireDAC, ADO nor IBExpress )?
- No support for earlier versions of Delphi prior to XE8?
-
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.
-
-
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.
-
2 hours ago, David Heffernan said:This has always been fine here. How can this be reproduced?
Thanks for the info. I'm not sure (yet). I'll be back with more details...
simple SFTP-like server for Windows?
in General Help
Posted
My experience has shown that FreeSSHd is better than FileZilla.