Jump to content

Dany Marmur

  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Dany Marmur

  1. Dany Marmur

    TSplitView Inheritence

    I would like to agree so much with @Der schöne Günther. I have Visual Code open on my DFMs constantly policing theIDE. Would be nice if the IDE would handle reloads from disk better, but i would not put my moneys on it.
  2. Dany Marmur

    Remote control of Word no longer working

    Yes, as @David Heffernan says. You parse the files using your own code or a 3rd party library. There are expensive .NET solutions out there for a lot of functionality. Me, i prefer native-delphi code, especially server-side, so i use some 3rd party solution for reading doc and pdf and my own parser/patcher for docx/xlsx files. Check out https://docs.microsoft.com/en-us/office/open-xml/open-xml-sdk for inspiration. Somewhere there is a tool to inspect the underlying xml protocols of a doxc file. Very useful even if you are not using microsofts tools. Also scalabium, http://www.scalabium.com/. IMHO (humbly) the application <=> Word automation stuff can break for a host of reasons, so for anything other than hobby projects i choose another solution. HTH
  3. Dany Marmur

    Remote control of Word no longer working

    This may come across as a non-answer. I would strongly recommend not to use OLE. Rather checkout all the non-GUI solutions to massage docx-files. It is possible with most formats. I have written my own parser, but i seem to remember there are solutions out there. HTH.
  4. Dany Marmur

    Rx10.4 new feature blogs

    No. I know. It is about our livelihoods. About years invested in code and all. Frustrating. Indeed.
  5. Dany Marmur

    Rx10.4 new feature blogs

    @Rollo62, please; Inhale... count to 10. Exhale. Repeat.
  6. The Delphi world contains a lot of database-solutions. One school of them are the TDataSet-based libraries, components and classes. If you are using TDataSet-based cached Lookups in a more "modern Delphi" you can easily speed up lookup handling. I'm posting this because when i googled in order to fix a couple of thing in my current project, i did not find much, almost nothing on this. This can save HUGE amounts of processor cycles if: You use "VCL Lookups" (they are not strictly VCL, but that is the term for example in DevExpress* forums) and have a lot of value-rows and a lot of lookup values. You use a component that cannot use lookup values and therefore need to "expand" the lookup values with their actual looked up "listfield" value. * I use the DevExpress PivotGrid a lot. The "QuantumGrid" has a "SortByDisplayText" property for sorting on lookup values. But the PivotGrid does not. So for the data fed to a PivotGrid i see to it to use "VCLLookups" so that the PivotGrid handles looked-up values rather than their IDs... as if they where text. This is the only way to get columns/rows sorted the way the users want. In a scenario with 100K rows and 80K lookup values having a character length of 256, this decreased the time needed to load the PivotGrid with data (for each fetch the lookup values is "expanded"). In some scenarios (like the one i describe above) the time needed for the operation (and that is the time the user has to wait) decreased from 120 to 6,5 seconds. The reason being the "LookupCache" in Data.DB uses an O(1) algo on a Variant. Let's change that like so: 1. The treading "lightly" approach is to override you TDataSet-based class, mine is called TkbmMemTable: ... interface ... // Faster lookups TDictionaryLookupList = class(TLookupList) private FDict: TDictionary<Variant, Variant>; public constructor Create; override; destructor Destroy; override; procedure Add(const AKey, AValue: Variant); override; procedure Clear; override; function ValueOfKey(const AKey: Variant): Variant; override; end; TkbmMemTableEx = class(TkbmMemTable) protected function GetLookupListClass(Field: TField): TLookupListClass; override; end; ... implementation ... function TkbmMemTable.GetLookupListClass(Field: TField): TLookupListClass; begin Result := TDictionaryLookupList; end; ... { TDictionaryLookupList } procedure TDictionaryLookupList.Add(const AKey, AValue: Variant); begin if not VarIsNull(AKey) then FDict.Add(AKey, AValue); end; procedure TDictionaryLookupList.Clear; begin FDict.Clear; end; constructor TDictionaryLookupList.Create; begin inherited; FDict := TDictionary<Variant, Variant>.Create; end; destructor TDictionaryLookupList.Destroy; begin if FDict <> nil then Clear; FDict.Free; end; function TDictionaryLookupList.ValueOfKey(const AKey: Variant): Variant; begin if (not VarIsNull(AKey)) and (not FDict.TryGetValue(AKey, Result)) then Result := Null; end; I am NOT "indexing" on Variant here. The TDictionary<Variant, ....> will convert variants to strings because the Dictionarys keys are hashed. I do not think that any database solution will yield a value when the key is null. But please comment if you are aware of such a scenario. 2. The "One Dict to rule them all" approach: Instead of having each flavour of TDataSet kick in the new LookupList you can substitute the vanilla one for our dictionary based one for the entire application: .... initialization DefaultLookupListClass := TDictionaryLookupList; This will see to it that any TDataSet that does not have it's own lookuplist will use the dictionary one. This approach can be tested in almost any application in under an hour. It would be interesting to receive a comment or two if it affected the performance of your application. Please note: This is only useful for lookup fields that have the "LookupCache" flag set. HTH, /Dany Disclaimer one: I did not look at lookups on segmented indices. Disclaimer two: All coding is done under the responsibility of the coder, not the author of this article.
  7. Dany Marmur

    Speed up TDataSet Lookups

    Ah, then let's hope someone with fresh experience of the TDBGrid chimes in. I have not used it in ... well ... 15 years or so.
  8. Dany Marmur

    Speed up TDataSet Lookups

    @Jacek Laskowski, i'm having problems reading the text in the screenshot. I suspect the setup of the LookupFireld. Start afresh with Lookups that works w/o any additions and apply the 2nd version. Or are you trying FredS's approach? I'm sorry that i cannot be of more help.
  9. Dany Marmur

    Delphi Rio IDE hangs again and again

    I do feel like Lorenzo B. Seattle has been completely unusable. I went and bought some parts and put together a gaming PC two months ago and switched to Hyper-V. Much better when it comes to excessive repainting in the IDE but still it sucks to have to restart the IDE several times a day. I have looked at DX skins, i have lowered the number of visual inheritance levels, i have broken huge parts out to frames, i have turned off live bindings, i have manually edited desktop setting files to reduce repainting between debug-edit cycles. And so on and so forth. One part of this problem is the repainting and refreshing of forms, and it seems that DevExpress skinning and some other concepts (the ribbon with all it's collections) increases the woes. I realised that upgrading to Rio would not help. Now i'm hoping for 10.4 but since IDE/RAD/Forms handling is not mentioned anywhere specifically i do not have high hopes. However - there is a "Language Server" mentioned. Perhaps i can edit code in VC and do the "RAD" in the IDE. The IDE, however, is not good at loading files that changed on disk. I do like to use Visual Code though. It's almost ironical to read Lars saying that he moved from "visual" to "dynamic" coding. I went the other way around actually with this new project because i wanted to benefit from all the designers and stuff VCL/DX has. Well, i'm very happy with the project per se but the IDE is killing me softly.
  10. Dany Marmur

    Fonts & ligatures

    I feel so old now...
  11. https://docs.microsoft.com/en-gb/windows/win32/procthread/environment-variables
  12. Dany Marmur

    Function with just underscore _() seems to be valid

    Never saw Brainfuck. Methinks it's kinda cool. Take Neil Stephenson's Diamond Age and you should be able to express the princess educational story's in Brainfuck. At least the ones with the mice and the chain. Also, we could introduce another variable naming conv; if an identifier start with _, the values assigned to it will be multiplied with the number of _ before the first non _ character. Then the code snippet above would yield something other than 0. Let's stop here.
  13. Dany Marmur

    Where did I come from

    @Kas Ob., ah, i see!
  14. Dany Marmur

    Where did I come from

    @Kas Ob. why would you need the component property (Tag) in this case? IMHO keeping the sentry as form-member or as-component-member-accessed-by-form do not usually provide any benefits. You are welcome to expand on your idea. /D
  15. Dany Marmur

    Google Geocoding

    Thank you, vfbb! I see. I'm a windoze-vcl guy when it comes to Delphi 🙂
  16. Dany Marmur

    Where did I come from

    As Gunter says, is a quite common practice. Another way is to use sentries, a form field that will tell to skip updates. From the one place: ... Inc(FInUpdatingTable); try ... finally Dec(FInUpdateingTable); ... In the other place if FInUpdatingTable > 0 then exit; You can use a boolean, but using an integer is common because it can handle multiple levels. Do not forget the try ... finally even if it looks like nothing could happen. HTH
  17. Dany Marmur

    Google Geocoding

    Neat! But why "FMX"? At a quick glance it looks like it would work in a VCL project too. No?
  18. Dany Marmur

    Structure Panel empty - how to get Embarcadero support?

    @PeterPanettone, it's not an answer. It s just a way of letting off steam and at the same time respecting the people in my immediate vicinity (avoiding to hit someone who is not culpable). The number of times we can suggest to Emba how to do extracurricular stuff better are infinite! Seriously; i am sad i could not be of help.
  19. Dany Marmur

    looking for a lo-fi Delphi Style

    @David Schwartz, your topic is IMHO not Delphi related at all, but very pertinent, important and even somewhat novel. I have the same basic problem. Repeatedly. Over and over again. IMHO there might be a market for an "FX filter" to "mockify" an "app-screenshot"... Good idea! I would imagine that skilled FX algo-designers could come up with something working. "if (edge = straight) then apply random-scetch" else...."
  20. A challenge... event to native speakers! https://www.theguardian.com/books/2020/jan/27/brexit-50p-coin-boycott-philip-pullman-oxford-comma *lol*
  21. I almost know one language, my mother tongue. I have a knowledge of English. In my own opinion it is usable. I can diddle with at least 4 more languages. I know of maybe 30 more. I will continue to learn English. I do not have the capacity to learn more languages in my current context. Sorry 🙂
  22. I should apologise too. My way of saying "this is an english forum" was apparently considered funny only by myself. @Isaac Badru good luck with you coding!
  23. Desculpa. Nao habla Portugeze, me.
  24. Dany Marmur

    FireBird tool, Coworker doing this, 2.0 just released

    I have been waiting for this! Downloading |\-/|\-/|... Thanks for the heads-up!