Jump to content

Clément

Members
  • Content Count

    365
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Clément

  1. TStringList has a Direct access of O(1), if you are accessing it unsorted, and this is as fast as it gets. But, when used as a dictionary, TStringlist must be sorted, and that's another ball game! When you add an element to a sorted list it goes through binary search ( O log n ) , same happens if you delete. When you need a lookup structure, TDictionary is the way to go as it's always O(1).
  2. Actually both. I needed to write a small interface between SAP (text files with a +/- ten thousand records) and another system that needed to check if a RFID card number was in a list. Depending on some card property (returned by the associated class, I had to call a certain REST API). I was using a simple sorted StringList, when I switched to TDictionary the performance boost was noticeable. Routines dropped from minutes to seconds. I replaced: idx := fCardList.indexof( aCardNumber ); if idx>-1 then lObj := TMyObject( fCardList.Objects[idx] ) with if fCardlist.TryGetValue( aCardNumber, lObj ) then case lObj.RoleType of [..] end; Faster and more readable! It depends. When performance is the key, I usually write a lot of comment to compensate the lack of readability. In those cases I know the routine must be lean and mean I will use the fastest data structure. When the routine is simpler, not called very much, or performance is not an issue then I move to a "more readable" coding approach.
  3. Have you compared your results with: https://github.com/maximmasiutin/FastMM4-AVX ?
  4. Hi, I'm using Delphi Rio to read some rather large log files ( some might have 5Gb). The encoding might be Ansi or UTF8. The log files are created from different systems and each encodes differently. I would like to use TFileStream ( or TBufferedFileStream) to read the file in chunks of 32k, but how can I be sure that an UTF8 character split between chunks will be decoded correctly?
  5. I'm still working on that reading routine . I can't read all 5Gb in memory (even in chunks). That particular file have lines over 64Kb of data without finding a CRLF. And of course my buffer was set to 64Kb! I'd go straight to 1Mb of data to walk back to the last CRLF. I'm not walking back the stream position per se. I'm using the buffer I just read to count the number of chars I need to go back, and set the stream back that amount of bytes. For other large files it works just fine, but there's always "that file" that messes everything.
  6. Hi, You can test with a tool I wrote. The community edition is free: http://www.dhs.com.br/dhsPinger.html
  7. Clément

    Best way to refresh static data

    Hi, Have you measure what is taking a long time? Is it the retrieval time from the SQL Server: Make sure the SQL optimizer is using the expected index. Is it downloading data to local store: Try compress , or is it the local loading time? using IN ( long list ) is not a good option in ANY database. As other suggested, use a proper table to insert the IDs and join with that table. if some SQL server don't support session table you can simulate one by creating physically the table with two columns, one with some user identification ( user name, user login, machine name or machine IP ) and another an ID. But do use a join to retrieve those rows.
  8. Clément

    paste into watch list

    Just tested dragging with Delphi XE. It works! Always learning something new!
  9. Hi, I have a base Frame that I use to derive most of UI. Is there any problem if I use several interfaces in my child frames? For example : TMyCustomerFrame = Class( TBaseFrame, ISupportDataset, ISupportResize, ISupportSelection, ISupportCRUD, .. ) TMySupplierFrame = Class( TBaseFrame, ISupportORM, ISupportResize, ISupportExcel, ISupportDragDrop ) There's one Frame that implements 8 Interfaces. It Works! but ... Is there any limit (Design or concept)? Because so far using Interfaces is helping me a lot and coding got a lot simpler too. Happy New Year! Clément
  10. Yes. I'm redesigning to use their layout control. Most of my frames have standard VCL controls and some components of my own. Layout Control has an Import facility, but I can't use it right now. I have to reformat my frames to minimize rework. I tried importing some simple TFrames and it was easier to restart those from scratch. Some more complex frames got completely messed up. I'm experimenting with some reformatting/realigning to see if the Import result improves. Using their Layout Control is the way to go. Most of my visual problems are solved with it not to mention the component alignment is perfect.
  11. I tried to keep the post as short as possible, but I guess it won't be possible My English is not very technical (or good), I must use some examples to help me explain. The client side platform has "ready to use frames" with editors placed at design time. Some frames are easy to create at runtime, I won't talk about those. Others not so easy (Customer, Orders, Contract, Services, Billing etc). So I derive from the my baseFrame and drop the corresponding controls at Design time. This is almost the only thing I can do. My users have different monitor resolutions, some have some sight problems, and sometimes Windows cannot natively display some information in a way they can read it. So in my application offer them a way to choose their favorite fonts and font sizes (some of them uses Tahoma 20 bold for normal label/editors). For this reason, I must resize the form in order to fit them as "designed". There other factors too, like for example skins (Some customer want me to design skin to match their logo, company colors and stuff ). Anyway, this is strictly handled on the client side. But as any other application there are some restrictions applied to users ( or modules). Fields they can't edit, or fields they can't see. Those are the definitions coming from the server. At server side, there are some "hard validation rules", like for example StartDate must be Less or equal do EndDate. This kind is still hard coded and I guess this falls into your strong binding UI Definition. I try to keep those to a minimum. But there are some soft rules that applies depending on the user ( or module ). For example, I must check if document number is valid when editing data on Module A, but that same document is optional for Module B, so no validation is required. Yet again, this rule can apply to Customer A, but Customer B wants both modules A and B to validate the document number. The way I implemented it all I have to do assign the "IsRequired" for that particular document number field of module A and Module B accordingly to that customer needs. The server side platform (REST API with JSON) is handling complex requests (Definition + Data) only from my client side platform. Third party system integrate with my server platform using another authorization scheme and a different REST API route. No UI Presentation to deal with. So far, no customer requested complex browser features. The mobile side is pretty simple too. Data entry is not practical at all so the UI must be very well thought, objective, touchy, battery and processor friendly. The only thing the app receives is Data, no definition or maybe some soft rules definition to display some nice glyph to the user in the next few months. Mobiles get their own set of "forms". This was a way I found to deal with all this UI presentation logic. This is just an example to help illustrate. I'm sure there are better ways to manage it, that's why I like it here! Always learning a better way to implement things Clément
  12. Hi, It's a n-tier platform to help me build applications faster. I'm using TFrame to handle One thing : Visualization. For example: The ISupportAdjustToFrame will handle special form dimension. This mode doesn't allow the user to resize the form, the form is resized automatically to fit all editors and labels so they are displayed correctly (DPI, User fonts, etc). The ISupportDataset will handle data-aware editors with TDataset / TDatasource. The ISupportGrid will handle Grid, and in this case the form will be sized to a predefined value specified at design or runtime, and the user is allowed to resize up to a constraint limit. I like this solution because I can have a Frame that support Grid and Datasets, and another that support Grid and ORM. ( TFrameGridDataset = TBaseFrame+ISupportDataset + ISupportGrid and TFrameGridORM = TBaseFrame+ISupportORM + ISupportGrid respectivelly). The server side platform is holding part of the visual definition. The client request a "form design definition" and the response will contain the corresponding Frame name along with the visual components definition, all of them will be created at runtime. The client side platform has a few key "Form Containers" that will handle all those interface the frame depends on and display all those controls correctly. This way most definition will happen at server side. It's just a matter of picking the right Frame for the job Clément
  13. Yes, all references to the object are through interfaces. Really cool!
  14. Indeed Pack is the way to go. I guess I'm just biased by my current project.
  15. Have you considered using 2 TList<T> ? One for the actual data and the other as a " T object pool" Before adding a new Item in MainList, check the pool, if it's empty then return a newly created T or get the first (or last ) element. When you're done, move the object back to the Pool list. You will be able to avoid unnecessary allocating and freeing.
  16. Hi, I would check a few things... 1) Does vcl260.bpl exists in that folder? 2) Does it have a "valid size". If it is "zero" then you need to reinstall and may be your antivirus is getting in the way. Disable realtime protection and reinstall. 3) Your path might be corrupted (Not enough space for ex). 4) Somehow the 64bit version of the bpl is being loaded, and fails for obvious reasons. HTH, Clément
  17. Clément

    Debugger in 10.3.3 is useless :'(

    Here is a small example duplicating the exact same behavior of my main project procedure TForm1.FormCreate(Sender: TObject); begin fSomeConnector := TSomeConnectorCls.Create; caption := Format('Result= %d',[fSomeConnector.A1]); // Place a breakpoint here end; the IDE go to uSomeConnectorCls (line 22) : function TSomeConnectorCls.A1: Integer; begin Result := DoInvoke<Integer>('A1',[1,2]); // Press [F7] here end; Watch as the debugger completely ignores DoInvoke<T> and goes straight to DoBuildURI. Proceed with [F7] until DoBuildURI ends... and watch as the IDE goes back to the main form. The result is 11 so DoInvoke is called and executed to the last instruction! I wasn't able to duplicate the invalid entry point at the end of DoBuildURI when comment out of DoInvoke<T> though Undebuggable.zip
  18. Clément

    Debugger in 10.3.3 is useless :'(

    I don't think VM would work for me as I find myself running at least 2 instances of delphi. I don't think my machine can cope with host and VMs. Anyway, goodnews! I manage to isolate the problem in a small sample. Tonight I will do some more testing and I will attach the example. With that small sample, hopefully, you will be able to duplicate that behavior in your setup. I decided to keep 10.3.3. I will need less time modifying this code to something "debuggable" than making my project runs against Tokyo or Berlin. Most of my testing is automated, but some of those test are not compiling either under tokyo or berlin. I don't want to mess with my testing routines and with my already working code. So I will keep my current setup, and find a way around this "bug". Who's to say I would be in multi thread task without using sleep 😂
  19. Clément

    Debugger in 10.3.3 is useless :'(

    The code runs in Berlin and Tokyo ( I'm not crazy, yet! ). Anyway, with both 10.3.2 and 10.3.3 broken I will have to use Tokyo to debug and probably release the application by Dec 15. Under Tokyo the application is not compiling because there's some RTL diferences ( ex: enum exists in Rio but not in Tokyo). I'm fixing such glitches and as soon as I have a running system, I will work on that sample. I installed both 10.3.2 and 10.3.3 twice today, from scratch. Both developed NonDebuggable Agreement
  20. Clément

    Debugger in 10.3.3 is useless :'(

    I'm really worried. I completely removed 10.3 using the uninstaller. Using CCleaner I remove all leftover the uninstaller left. Using registry editor I removed all entries for Rad Studio 20.0 and all 1a.0 . Reinstalled 10.3.3 using the Webinstaller (All those trials are done with Webinstaller). Still no way to debug method with the following signature: function method<T>( const aMethodName : String; const aParams : Array of TValue) : T; What's next? Going ISO installer?
  21. Clément

    Debugger in 10.3.3 is useless :'(

    I completely remove 10.3 (Clean all registry et al) and reinstalled it. I deleted all dsk, dcus, .local but still, no way to debug the DoInvoke. Truly disappointed. I guess I'll have to hunt down all RAD Studio entries in my registry to be able to uninstall it properly. And one weekend is completely lost
  22. Clément

    Debugger in 10.3.3 is useless :'(

    Just installed 10.3.2 and the same debugger behavior is happening. 10.3.3 broke something. Well... tomorrow I will reinstall 10.3.3 from scratch
  23. Clément

    Debugger in 10.3.3 is useless :'(

    Indeed, The method function DoConvertWebAPIResponse<T>(aWebAPIResponse : TJSONValue ) : T; Also shows the same behavior. ( No blue dot, cannot place breakpoint, appears in the call stack and when accessed from the call stack shows a different part of the code. When I trace into some other routines that correctly displays the blue dots, the editor shows a completely wrong line. For example, when I hit [F7] to return to DoConvertWebAPIResponse<T> (which is inaccessible ) the debugger places the editor in middle of the class constructor and the Local Variable window displays the local variables from DoConvertWebAPIResponse. If I remove some of the private variable declaration like for example private fRTC : TRttiContext; fRttiType : TRttiType; fBaseRoute : String; The blue dot moves a little higher. I'm installing 10.3.2. Let's see if it's my Delphi installation that got corrupted and I'll have to do a clear installation, or if it works under 10.3.2 then I'll know for sure something is wrong with 10.3.3. In fact, it's very hard to duplicate. I'm not using IDE Fix pack. I don't think there's a 3rd party package problem/conflict. The 10.3.3 went well. No errors. All packages were loaded during the IDE startup. I compiled most of projects without any problem. I guess I got lucky to spot this issue on that particular project Clément
×