Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Clément last won the day on August 26 2019

Clément had the most liked content!

Community Reputation

92 Excellent

Technical Information

  • Delphi-Version
    Delphi 10.4 Sydney

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Clément

    Synedit Help

    Thank your for the code. It will help
  2. Clément

    Synedit Help

    In my case the schema can change (user can add columns, change columns types, new index etc). Once the data is changed, the corresponding schema info is marked as obsolete and the a new query is done to retrieve data.
  3. Clément

    Synedit Help

    This is exactly what I would like to do. Very nice! Are you parsing the whole SQL text with each keypress? In my project the database schema is "loaded on demand" in a background thread. Queries/Scripts/Batchmove runs in that background thread. And I store the metadata also in that thread. That's why I need to get call the completion form when receiving the message. Here's a screen shot.
  4. Clément

    Synedit Help

    Hi! I'm using Synedit to built a small SQL editor, but I need to change some default behavior. 1) I need to trigger Auto-completion when a '.' is typed, but I don't want to display the Completion Form base on a timer interval. Since the data is obtained asynchronously, I want to fill and display the completion form after receiving a specific custom message (WM_GETCOMPLETIONDATA). When handling the message, I will fill the list and display the form. Is there a way to call the completion form on demand? (the filling and displaying follows...) 2) I need to fill the autocompletion list based on the previous token value. The user can type a SQL select as select c.| from categories c (The '|' is the current cursor position). As the user types the '.', I would like to fill the completion list with all the columns from categories table. As '.' is typed, I can get the previous token ( which is "c" in this case), and do some parsing to discover "c" is in fact an alias for "Categories", send a custom message (WM_GETCOMPLETIONDATA) and when receiving the data, I can fill the completion form with all fields from categories table. It seems to me that SynEditProposal.OnExecute is the correct event to handle all the parsing. Is there a better one? TIA, Clément
  5. Not a fancy solution, but have you considered using a List? You can load all your types ( or only the required ones) with a simple loop. lPrjList := TList<TProjectType>.Create; lPrjList.AddRange([ ptMain, ptExternal, ptDivision, ptBranch ]); You can set the "list" with the types you need and pass it as required. Anyway, you no longer would require to check your code for "case" or keep track of "projecttype" changes. Just let the "process" add the required project type in the list and a routine would deal with what's inside. If you need some extra boost, you could link each projectType to a specific method to get called ( or a Class, or an interface ) by using a dictionary (or another more suitable data structure). Anyway, my $0.02
  6. Clément

    Delphi compatibility with Windows 11?

    What makes sense to me is to let hardware deal with hardware attack. Blocking hardware attack with software will almost always slow thing down a lot. But, once you get non-updatable hardware attacked the last solution would be to add new non-updatable hardware to avoid that attack. Now you have two problems. Windows 11 would be a lot of fun to hack. Can MS deliver Windows 11 all over the world before TPM v2.0 is completelly hacked? And then what? Tell everybody to get a new hardware with v2.1?. IMHO TPM should be optional, if you require more safety, you can buy a secure mobo with an updatable TPM support module. This update should be done offline with a special software.
  7. Thanks Remy! That was it!
  8. Hi, I using D10.4.2 and ICS 8.65. I need to write a small UDP windows service. I'm using 2 x TWSocket . One is created at the very begining and set to listening. The other is created at runtime when required and the data is sent and destroyed. When I start the service: Netstat reports UDP 9000 listening. Wireshark reports data is sent and received. When data is received some processing is done and a file must be created. The device is returning data, as reported by wireshark too.. but DataAvailable event is not fired. If i build the very same project in a form it all just works. But it must run as a service. This is the Thread.Execute code: procedure TdhsDiscoverThread.Execute; var lMsg : TMsg; begin fdhsDiscover := TdhsDiscover.Create(nil); try fdhsDiscover.MultiThreaded := True; fdhsDiscover.SetConnectionSettings(fPort,fIdentification,fIsServer); fdhsDiscover.SetNotificationType(fNotificationType,fBaseMessage,fNotificationHandle); fdhsDiscover.ListenStart; while GetMessage(lMsg,0,0,0) do begin if lMsg.message = _UM_Discover+fBaseMessage then begin case lMsg.lParam of _UP_DISCOVER_PARAM_ServerSettings : fdhsDiscover.FindServer; end; end; end; fdhsDiscover.ListenStop; finally fdhsDiscover.Free; end; end; netstat is reporting: UDP *:* Any ideas?
  9. No coffee addict option? This survey made me feel alone.
  10. IsInRangeEx is using Cardinals as parameters. The ideia is to use the unsigned type. In the example Cardinal( 5 - 10 ) = 4294967291 as expected. IsInRangeEx will not accept negative numbers... Using in extreme cases like: IsInRangeEx(cardinal(-2),Cardinal(-3),Cardinal(-1)) will also work. IsInRangeEx2 will work with negative numbers. I cannot see the overflows 😞
  11. I love these topics. Under 64 bits: Math.InRange: 859 IsInRange: 858 If: 860 IsInRangeEx: 858 IsInRangeEx2: 858 Under 32bits: Math.InRange: 1288 IsInRange: 906 If: 906 IsInRangeEx: 858 IsInRangeEx2: 858 The code for IsInRangeEx and isInRangeEx2: function IsInRangeEx(const AValue, AMin, AMax: Cardinal): Boolean; inline; begin Result := (AValue - AMin) <= (aMax - aMin); end; function IsInRangeEx2(const AValue, AMin, AMax: Integer): Boolean; inline; begin Result := ((AValue-AMax)*(aValue-AMin) <= 0); end;
  12. Clément

    Transforming Data (Pivot ?)

    DxPivotGrid should give you the expected results. It's a matter of setting accordingly the rows , columns and values. The trick is to transform the "Operational data" to "Pivotable data". Having "true" in pivot table is not meaningfull.. but display 75% Oil Ok will indicate something is wrong and your user will figure out what's ( or where it's) wrong by drilling down.
  13. Clément

    I will be less active for a few weeks

    I'm glad you're back! Still no vaccine for me. I'm too young . I hope by Aug or Sept I'll get my double dose.
  14. Hi , I'm using 10.4.2 and it works as expected Althought it's not selecting the first option, apparently it selects the closest match, in this case, the cursor remains over "Load" til I type "e" then it moves to "loaded" Are you using some IDE plugin? (I'm using Delphi as it came in the world! ) Clément
  15. Clément

    Min & Max