Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 12/17/18 in Posts

  1. Quick demonstration how space partition methods could help to get significant gain. Code uses simple 64x64 grid with cells 32x32. Each cell contains indexes of points belonging to this cell. At first brute-force method counts (doubled) number of point pairs with distance<= 4. The second code piece checks only cells neighbouring to the cell containing examined point. For 64K points gain is about 200 times. Complexity is O(N^2) vs O(N^3/2) (for proper cell size and uniform point distribution). More advanced structures like kd-tree might provide better performance for complex cases too (worse distribution etc). var Wdt, Hgt, NPts: Integer; i, j, k, r, m: Integer; t: DWord; sqd, maxsqd, cnt, gx, gy: Integer; P: TArray<TPoint>; Grid: array[0..63, 0..63] of TArray<Integer>; begin Wdt := 2048; Hgt := 2048; NPts := 64 * 1024; RandSeed := 42; SetLength(P, NPts); for i := 0 to NPts - 1 do begin P[i] := Point(Random(Wdt), Random(Hgt)); Grid[P[i].Y shr 5, P[i].X shr 5] := Grid[P[i].Y shr 5, P[i].X shr 5] + [i]; end; maxsqd := 16; cnt := 0; t := GetTickCount; for j := 0 to NPts - 1 do for i := 0 to NPts - 1 do begin sqd := Sqr(P[i].X - P[j].X) + Sqr(P[i].Y - P[j].Y); if sqd <= maxsqd then Inc(cnt); end; Memo1.Lines.Add(Format('%d %d', [cnt, GetTickCount - t])); cnt := 0; t := GetTickCount; for i := 0 to NPts - 1 do begin gx := P[i].X shr 5; gy := P[i].Y shr 5; for j := Max(0, gy - 1) to Min(gy + 1, 63) do for k := Max(0, gx - 1) to Min(gx + 1, 63) do for m := 0 to High(Grid[j, k]) do begin r := Grid[j, k, m]; sqd := Sqr(P[i].X - P[r].X) + Sqr(P[i].Y - P[r].Y); if sqd <= maxsqd then Inc(cnt); end; end; Memo1.Lines.Add(Format('%d %d', [cnt, GetTickCount - t])); count time (milliseconds) 115406 11466 115406 62
  2. Uwe Raabe

    MMX for Delphi 10.3 Rio

    Official version 14.0.3 with support for Delphi 10.3 is now available. There have been only some small bugfixes since the beta version (f.i. beta still used the v13 registry key).
  3. dummzeuch

    New features in GExperts

    GExperts has recently gained a few new features: Two new experts to start/stop recording and to replay a keyboard macro. These are minimal experts which allow you to add additional keyboard shortcuts to the existing IDE functionality. The idea and the code were contributed by Dejan M. Goto Previous / Next modification Editor Experts. These again ... https://blog.dummzeuch.de/2018/12/15/new-features-in-gexperts/
  4. Well, the OTA contains a few special interfaces regarding themes and the Unit Dependency Analyzer was the first form (or better frame in this case) making use of those. What I didn't know (because as usual those things are poorly documented - if at all) is that it seems to be forbidden to call ApplyTheme when IDE themes are disabled. Not that this could as well be caught inside ApplyTheme (just for safety - instead of crashing), so that not everybody has to add this additional check in their code.
  5. The DDevExtensions 2.85 and the DFMCheck 1.6 are now available for Delphi 10.3 Rio. DDevExtensions Changelog Added: Support for Delphi 10.3 Rio Added: Use Unit dialog option “Every unit on a single line” Improved: UnitSelector Dialog in Delphi 2009 opens much faster Fixed: Structure-View search dropdown had a max height of 2 items Downloads
  6. Uwe Raabe

    MMX for Delphi 10.3 Rio

    There is an unofficial download available for MMX Code Explorer with Delphi 10.3 Rio support. Unofficial because it didn't have had much testing yet due to some incompatibilities found during the beta phase. One of this results in the loss of the MMX editor context menu entry. Another big change ist that MMX version 14.x only supports Delphi 10 Seattle and higher. For that, version 13 will still be available for download and installations for older Delphi versions should keep working. I had to make this cut to avoid wasting too much time just to make it work and test it on those older versions. Nevertheless there are some features and bug fixes: Unit Dependency Analyzer is now dockable (so you can see immediately when you introduce cyclic dependencies) New settings page Project Options (currently contains only the setting for Uses Clause Sorting). These settings are stored per project in a separate section of the dproj file. Uses Clause Sorting accepts lists like (ToolsApi,DesignIntf) as one group. This only affects grouping, so the order inside this list is not relevant. Uses Clause Sorting accepts wildcards like Rz* (for Raize Components) or Id* (for Indy) to better handle non-dotted unit names New sorting options "group class members" - keeps the class methods together fix: Wrong result when renaming parameter during Extract Method fix: Add Local Variable now also works with For-In clause fix: Hard coded string scan check for min length works correct now fix: Paste Interface in empty class just works now fix: Consolidated behavior of selected file in Open/Use Unit dialog fix: Creational Wizard follows static/non-static when suggesting destructors Some work has been done for supporting themes, but that is still a long road to go. Please report any bugs and problems found either here or via support@mmx-delphi.de.
  7. dummzeuch

    DelphiPRAXiS

    If I remember correctly, there was a post here on DP-en about this, right when the forum opened.
  8. Martin Wienold

    Block windows access

    For what it's worth, limiting Keyboard and Mouse input can be done by using low level keyboard and mouse hooks. Beware that debugging these kind of projects can be quite .. interesting as you have your keyboard and mouse hooked and therefore - depending on your application logic - blocked. Basically you have to have a host application and a library. The host application loads the library which implements the hooks you defined. For more information look here: LowLevelKeyboardProc callback function LowLevelMouseProc callback function ⚠️ CTRL+ALT+DEL can't be hooked/blocked, maybe Kiosk mode is realy what you need.
  9. Alexander Elagin

    Feature request for Source Indexer

    There is a setting which controls the docking behaviour in Options - Environment Options menu, named "Docking" 🙂 I usually switch off Auto Drag Docking - in this configuration one has to explicitly hold Control key down while dragging a window to make it dockable, otherwise the window is just moved around remaining floating.
  10. FPiette

    Feature request for Source Indexer

    I'm using Delphi since version 1, every single day of the year. And there are still tricks that I don't know! Thanks.
  11. dummzeuch

    Feature request for Source Indexer

    You can simply hold down the Ctrl key and move a dockable window like any other window.
  12. Uwe Raabe

    Date Time Diff

    program Project458; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, System.TimeSpan; var span: TTimeSpan; begin span := TTimeSpan.Subtract(EncodeDate(2018,1,2)+EncodeTime(16,35,0,0), EncodeDate(2018,1,1)+EncodeTime(15,30,0,0)); Writeln(Format('%d Day(s) %d Hour(s) %d Minute(s)', [span.Days, span.Hours, span.Minutes])); Readln; end.
  13. That's not harmful, it's just unnecessary code. What really rustles my jimmies is something like this: try doSomething(); except ShowMessage('There was an error'); end;
  14. I've just released the next version of OmniPascal. It's coming with support for the inherited keyword, type helpers and inline variables. http://blog.omnipascal.com/omnipascal-0-17-0-inherited-keyword-type-helpers-and-inline-variables/
  15. Edwin Yip

    MMX for Delphi 10.3 Rio

    I know it depends on the decision of the original developer of MMX, actually I want to be able to contribute to the source by adding old version support :)
×