A.M. Hoornweg
Members-
Content Count
473 -
Joined
-
Last visited
-
Days Won
9
Everything posted by A.M. Hoornweg
-
The best way to handle undo and redo.
A.M. Hoornweg replied to skyzoframe[hun]'s topic in Algorithms, Data Structures and Class Design
Certainly not! But if the Delphi object represents a document or record in a database, backing up old versions on disk is often possible. A colleague of mine has written a reporting tool that does precisely this. -
The best way to handle undo and redo.
A.M. Hoornweg replied to skyzoframe[hun]'s topic in Algorithms, Data Structures and Class Design
A classical way to achieve undo/redo is if your object can serialize itself, for example using XML or Json. That way you can keep the last xxx modified versions of the object in a temporary folder on disk. -
I am using this open source library to connect to MongoDB. It works quite well but it's a bit bare-bones: https://github.com/grijjy/DelphiMongoDB I've forked it and added some more functionality that I needed myself. https://github.com/tuurke63/DelphiMongoDB
-
Reduce storage space for floating point range
A.M. Hoornweg replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
My recommendation: treat your data as integers, using an implit divisor multiplier of 1000. Your highest value 200000 is hexadecimal $30D40 and as you can see by the number of digits, that will fit in 5 nibbles ( two and a half bytes). Now all you need is a class that will correctly manage a tArray<byte> to read and write individual float values. -
Reduce storage space for floating point range
A.M. Hoornweg replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
Cool ! One learns something new every day -
Reduce storage space for floating point range
A.M. Hoornweg replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
If these are measurements of a road, then do you really need 3 fractional decimals at all? I mean, a single car driving over it would probably change the fractional part already. Are the readings a 2-dimensional map of deformation/wear/potholes of the road, like an image? If so, then a lossy data reduction algorithm similar to JPG would shrink the data enormously whilst keeping the essence intact. -
Hello all, I have the impression that Delphi's SHL operator only handles 32 bits even when compiling for 64-bit. Does anybody have an alternative routine that handles 64 bits? function bit(idx,value: uint64): Boolean; begin Result := ((1 shl idx) and value) <> 0; end; procedure test; var i:uint64; b:boolean; begin i:=$ffffffff00000000; b:=bit(33,i); // Should return TRUE but returns FALSE end;
-
64 bit shift operations?
A.M. Hoornweg replied to A.M. Hoornweg's topic in RTL and Delphi Object Pascal
It has the 32 LSB's set to zero. Bits 32...63 are set to one and I'm testing bit 33. -
64 bit shift operations?
A.M. Hoornweg replied to A.M. Hoornweg's topic in RTL and Delphi Object Pascal
Thank you all! It works now. -
Lazarus / LCL comes to mind. It is not for mobile (yet) but it wouldn't really surprise me if that comes someday.
-
Do you need an ARM64 compiler for Windows?
A.M. Hoornweg replied to Lars Fosdal's topic in Cross-platform
(https://blogs.windows.com/windowsdeveloper/2022/05/24/create-next-generation-experiences-at-scale-with-windows/) ... a comprehensive end-to-end Arm-native toolchain for Arm native apps, including: Full Visual Studio 2022 & VSCode Visual C++" If by "end-to-end" they mean everything from input to output then the compiler should emit native code. -
some dxgettext improvements
A.M. Hoornweg replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
Ah, so you have write access to the repository? Great! I am attaching the file here for you to look at. My changes can be found by searching for {$ifdef unicode}. Without those changes, *.po files are loaded in the wrong code page and saving *.mo files produces corrupted files. POUtils.pas -
some dxgettext improvements
A.M. Hoornweg replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
I've found out that unit "/dxgettext/itetools/common/POUtils.pas" has severe unicode issues. The unit was written for an ANSI version of Delphi. I've fixed these bugs, do you happen to know how I can make the bugfixed unit find its way back to the original repository ? FYI: I plan to use this unit to translate existing *.po files of mine using a REST translation service which I subscribed to. -
Rounded polygon
A.M. Hoornweg replied to A.M. Hoornweg's topic in Algorithms, Data Structures and Class Design
Very interesting, thanks for the link! -
Rounded polygon
A.M. Hoornweg replied to A.M. Hoornweg's topic in Algorithms, Data Structures and Class Design
@vfbb: thanks for the example, I'll look into it! -
Rounded polygon
A.M. Hoornweg replied to A.M. Hoornweg's topic in Algorithms, Data Structures and Class Design
Such rounded edges "miss" the points of the polygon, they deviate before hitting the point. -
Rounded polygon
A.M. Hoornweg replied to A.M. Hoornweg's topic in Algorithms, Data Structures and Class Design
It's not trivial at all. I've downloaded a random contour map from the internet and attach it here. This is a map of a terrain, consisting of polygons that describe points of equal altitude above sea level. So there's a polygon describing an altitude of 350 metres, another one that corresponds to 360 metres, another one for 370 metres etcetera. The problem: The polygons may never intersect (any point of the topography has only one altitude). If an automated routine is to be used to create smooth connections between points of a polygon, it is necessary to avoid "wild deflections" that would make these lines cross adjacent polygons. A human being would have no problem drawing such connections by hand, intuitively. But an algorithm ? -
How to set "WelcomePageFile" property in *.dproj?
A.M. Hoornweg posted a topic in Delphi IDE and APIs
Hello all, Not everyone may know this, but Delphi allows you to specify a per-project "welcome page" in the *.dproj file. The referenced html file will automatically be opened in your default browser whenever you open the Delphi project in the IDE. I find this very practical because it can be used as a "sticky note", to show the developer some information about the project and its current status. <Delphi.Personality> <Source> </Source> <Excluded_Packages> </Excluded_Packages> <WelcomePageFile Path="index.html"/> </Delphi.Personality> But... I've forgotten where in the Delphi IDE the setting is to specify this welcome page. I currently resort to editing the *.dproj file manually in an external editor and I hate doing that. Does anyone know where to find this setting? I must be getting old ... -
How to set "WelcomePageFile" property in *.dproj?
A.M. Hoornweg replied to A.M. Hoornweg's topic in Delphi IDE and APIs
Duh... I always thought all options stored in the *.dproj could be reached with ctrl-shift-F11 but for some reason they made an exception for this setting. Thanks! -
Hello all, I have the problem that tMainmenu often fails to re-scale properly if I drag a window from a low-dpi screen to a high-dpi screen. This happens especially if it is a complex menu and it happens with or without a tVirtualImageList attached. The problem occurs on both Windows 10 and 11 (but more frequent on Windows 11). The compiler I use is Delphi 11.1 Alexandria. I am looking for workaround, is there a way to manually re-initialize or re-build the tMainmenu after scaling ?
-
I don't know, i'll check it out tomorrow.
-
I managed to create a workaround for this. See code below. The mainmenu of the form can be re-initialized by calling "menu.rebuild" . It works best if this is done ~100 ms after the form is re-scaled to the new dpi. type tMenuItemHack = class helper for tMenuItem procedure RebuildMenu; end; tMainmenuHack = class helper for tMainmenu procedure Rebuild; end; procedure tMenuItemHack.RebuildMenu; begin menuchanged(True); //"Protected" method end; procedure tMainmenuHack.Rebuild; var cnt: Integer; item: tMenuItem; begin cnt := items.Count; if cnt > 0 then begin item := items[cnt-1]; item.RebuildMenu;// trigger "menuchanged(True)" on rightmost item (minimize flicker) end; end;
-
EULA declined installing 11.1 with Network Named license
A.M. Hoornweg replied to Lachlan Gemmell's topic in General Help
I develop under Windows 10, but I have a build machine that's still running Windows 7. It will be migrated to Windows 10 in the near future. -
EULA declined installing 11.1 with Network Named license
A.M. Hoornweg replied to Lachlan Gemmell's topic in General Help
Can confirm 100%. The ISO installer works and the web installer doesn't on Windows 7. In my case it indeed complained about a https connection failing. Don't forget to enable GetIt afer using the ISO installer ("getitcmd.exe -c=useonline"). -
Hello World, I see that the Delphi IDE now supports a whole slew of encodings including binary, is that new? I stumbled upon this completely by accident. And what's binary supposed to mean?