Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation since 04/13/25 in all areas

  1. Hi everyone, I wanted to share some practical benchmark results from testing Delphi 12.3 under Parallels Desktop (Windows 11 ARM) on my new Mac Studio M4 Max. I'm working on a large ERP project (around 1 million lines of code) using components from Fast Report, TMS Software, and DevExpress. Here’s a direct comparison between three systems I’ve tested: Build config Intel i5-12500 (Win11, 32 GB) Mac Mini M4 Pro (24 GB) Mac Studio M4 Max (36 GB) --------------------------------------------------------------------------------------------------------------- Win64 Clean + Build 32 sec 26 sec 24 sec Win64 Clean + Compile 21 sec 18 sec 17 sec Win32 Clean + Build 23 sec 19 sec 17 sec Win32 Clean + Compile 16 sec 14 sec 13 sec All tests were run in Parallels Desktop 20, with each Mac VM configured optimally (RAM and CPU cores adjusted per machine). The Intel system was running native Windows 11 Pro with 32 GB RAM. Windows 11 ARM inside Parallels ran Delphi 12.3 without any issues. Key impressions: Mac Studio M4 Max delivers excellent performance even under virtualization. Parallels Desktop is extremely stable — no issues with Firebird or IBExpert either. For large Delphi projects, it’s a very viable setup for professional development. Best regards, Bojan
  2. Hi, I'd like to share a post. It addressed a byte loss issue captured from a discussion. // Compile with code page 936 program Problem; const strPublicKey: RawByteString = #$30#$3C#$30#$0D#$06#$09#$2A#$86#$48#$86#$F7#$0D#$01#$01#$01#$05 + #$00#$03#$2B#$00#$30#$28#$02#$21#$00#$A4#$65#$B8#$CD#$B4#$29#$A9 + #$64#$1A#$C5#$80#$55#$22#$1B#$BB#$C5#$98#$36#$B9#$23#$0C#$CA#$D4 + #$A8#$B8#$7C#$E6#$32#$E3#$89#$3D#$77#$02#$03#$01#$00#$01; begin Writeln(Length(strPublicKey)); // expected 62 got 58 - why? Readln; end. https://devjetsoftware.com/delphi/byte-loss-in-string-literal-concatenation/
  3. Carlo Barazzetta

    TTaskDialogs not working with Delphi Styles

    My Styled Dialogs uses internally my StyledButtons that are full VCL Styles compatible. You can also use dialogs with animations using Skia4Delphi: https://ethea.it/docs/styledcomponents/TStyledTaskDialog.html
  4. FYI: https://probablydance.com/2018/06/16/fibonacci-hashing-the-optimization-that-the-world-forgot-or-a-better-alternative-to-integer-modulo/ -tee-
  5. Dave Nottage

    iOS Selectors in Delphi

    OK, so after a bit of wailing and gnashing of teeth, I've come up with something more simplified - hopefully as much as possible. The attached code is just for iOS, however hopefully it meets these basic requirements: Requests permissions that allow creation of an album that can be accessed by the app If permissions are too limited, or denied, prompts the user to change the app settings, which is the only way to make subsequent changes if the permissions are not granted. If the prompt is declined, a value is set in the user defaults, so that the user is not prompted again. If they wanted to grant access again later, either this would need to be coded in the app, or they would need to do a manual change Once permissions are granted, the Create/Find Album button becomes enabled, and clicking that either locates the existing album, or fires off a change request to add the album Once the album has been created or found, the Save Image button becomes enabled. Tapping it fires off a request to save the image in the TImage component to the album Notes: The attached demo does not have any dependencies other than what comes with Delphi, and the units provided with it. It contains a "re-import" of the Photos framework with the newer classes, methods etc. It assumes that the device has iOS 14+, so the code would need to be modified to support older versions Feel free to ask about whatever I may have missed 🙂 The plan is to eventually update Kastri with the new import, and include some of the code in the demo as well. SaveImageDemo.zip
  6. What is wrong with the world of Delphi programmers that in 2025 there are still people who can't understand the difference between text and bytes? The article you link to goes on and on about text but your data is bytes. Why not just use the correct data type?
  7. havrlisan

    When LSP fails

    In this post, I'll share all the workarounds I use when LSP fails, which have greatly helped me during coding. Hopefully, you'll find them useful before Embarcadero completely fixes the LSP Server, which I'm sure will be soon. I'll also mention GExperts throughout this post, as it includes some useful features that can speed up using the tools listed below. Delphi Uses Helper Link: https://delphisorcery.blogspot.com/2021/03/introducing-delphi-uses-helper.html Feature: proper replacement for the Find Unit... refactor (Ctrl+Shift+A) feature. Description This has been by far the most helpful plugin. It's as simple as typing the name of a type and pressing Ctrl+Shift+A to find the unit where it's declared. When the window pops up, you can press Enter to add the unit to the uses section (use the left/right arrows to switch between interface and implementation sections), or press Shift+Enter to open the unit and jump to the line where the type is declared. GExperts bonus: The IDE already has a similar feature under the Refactor menu with the same shortcut, Ctrl+Shift+A, but it doesn’t work well and is certainly not as fast as Delphi Uses Helper. However, sometimes the default feature will trigger instead of the plugin (e.g., when pressing the shortcut without any text at the caret position). To remove the default shortcut, use GExperts' IDE Menu Shortcuts: find the shortcut under Refactor > Find Unit... (it should be the last one), and assign it to another key. MMX - Show Related Classes Link: https://www.mmx-delphi.de/ Feature: shows ancestor class, implemented interfaces, and sibling classes for a given class. Description Want to quickly navigate to a class’s ancestor or interface, or find out which siblings it has? This feature gives you exactly that, neatly and efficiently. To use it, right-click and go to MMX Commands > Navigate and Move > Show Related Classes. Or even better, map a shortcut by going to MMX > Properties > Key Bindings and finding Show Related Classes. I’ve personally mapped it to Shift+Alt+3. MMX - Open Unit... Link: https://www.mmx-delphi.de/ Feature: displays searchable units based on set configuration. Description Quickly displays all units based on your configuration. The configuration allows for adding units from the currently opened project or project group, and the following paths: Project Search path, IDE Library path, and IDE Browsing path. Find Original Symbol Feature: additional help navigating to a unit, type, or method. Description Using Find Declaration (Ctrl+Click) is known to fail occasionally, especially on bigger projects. What I've found helpful at times is to try using the Find Original Symbol that's located under the Search > Find Symbols menu item. I've personally mapped the Find Declaration to Ctrl+< and the Find Original Symbol to Ctrl+Shift+< through the GExperts IDE Menu Shortcuts, and I spam them when needed. It does help sometimes. Add a shortcut to the Reload LSP Server menu item Link: https://github.com/havrlisan/zx-idetools/blob/main/Source/Zx.IT.KeyBinding.ReloadLSPServer.pas Description In Delphi 12.1, a menu item Reload LSP Server was added under the Tools menu. Before that, you could add a custom tool to manually kill the LSP, and the IDE would restart it automatically. Unfortunately, they didn't add a shortcut for the menu item, so your options are limited to mouse clicks or to clicking Alt > T > accelerated key. Note that the accelerated key will be automatically assigned, and it depends on your menu items under the Tools menu, which sucks because that's the most changeable menu (because of custom tools, or third-party plugins). Usually, I'd use GExperts IDE Menu Shortcuts to manually add the shortcut, but the Reload LSP Server menu item doesn't show up there. After some debugging, I realized that the menu item in question isn't registered on IDE startup, but is loaded sometime after all other packages are loaded. My best guess is that the GExperts remembers the menu items when loaded, and doesn't re-fetch them afterward (I'm too lazy to search through the source code, sorry). So I decided to implement an IDE notifier that listens to a "ProjectGroupOpen" notification and then tries to find the Reload LSP Server menu item and assigns the shortcut to it. I've set the default shortcut to Alt+Shift+W, but the code is quite simple and is easily portable to a package of your own. That's all I've got so far. If you have some other features or tips, feel free to share them in this post!
  8. Few notes. First, when using free AI variants, your code will end up in the AI training data. And I wouldn't trust paid versions either. You need to be very careful that you don't give AI access to sensitive code that contains data which should not end up there. It is also very easy to do that by accident and it is prudent to run AI interactions in restricted environment like VM where you will have only non sensitive code. Next, anything that AI gives out needs to be carefully reviewed by human. AI often hallucinates and sometimes those hallucinations are not as obvious. This is especially important for code which requires some detailed explanations about how it works and why or some reasoning only person who wrote the code can answer (or the reasons are written in some other documents like specifications or design). Similar goes to writing tests with AI help. One of the huge problems with AI usage, is that with time, reviewing its output becomes a mundane task and this is where mistakes can more easily creep in.
  9. You are not going to get a notification if you use startActivity(), you need to use startActivityForResult().
  10. Yes. It was a bit surprised that, when CnPack published the Chinese Translation, advwang mentioned he had reported the issue (RSP-20624) back in 2018. The issue was closed as 'Work as Designed', with a suggestion to add a warning in cases of potential data loss. He also said Eurekalog 7.0 used this approach in their shellcode but fixed with byte array later. btw. I added this paragraph to the introduction: and improve the Conclusion section: Revisiting the Original Program section:
  11. I forgot to mention that, in the original case, the proper solution is to use a byte array —I’d assumed this was common knowledge, but I should have spelled it out. As I wrote at the beginning: I simply documented the journey, shared it, and hope it helps someone. At the very least, the exercise deepened my understanding of character encoding and how dcc handles string literals. In the end, it’s just an article. If you skimmed it, read the conclusion, and found nothing useful -- no worries, and thanks for taking a look.
  12. My point is that it's behaviour that you don't ever need to know because the correct way to handle byte data is as, well, bytes and not text. So for sure there's an algorithm, but it's not one that anyone actually needs to know.
  13. No. You have no way of knowing what the caller has put on the stack (or in the registers), what the called method does with it, what it returns and how. You can probably make it work for very simple delegate types (TNotifyEvent for example) but I think it would be better to find a less fragile solution.
  14. Of course there ARE times when the use of ANSI strings makes sense. One example is when sending data to/from an external device down an RS232 port where the external device uses a protocol based on simple ANSI text. We have many real world cases such as this (eg Eurotherm temperature controllers). The key point that @David Heffernan makes is that you should choose your types carefully to closely (or exactly!) reflect your needs. Time spent thinking carefully about your type selection will save you time in the long run.....
  15. alejandro.sawers

    iOS Selectors in Delphi

    I might do that, explaining the best I can what happened here. And about the demo, yes it is really good but overkill for my use case, but now I know the imports I need are in the Kastri repo, on the DW.iOSapi.Photos unit, so I can use just the bits related to permission checking and requesting. But... - PHPhotoLibrary.requestAuthorization asks for full-access, so aware users will see the inconsistency between the request and the purpose (save a single image) and will deny. I can always ask them again to give the previously denied permission explaining what's happening, but still feels hacky. Someone at Apple forgot a couple things about consistency when designed this. - On iOS 14+ we finally have ways to request and check write-only access to the photo library via authorizationStatusForAccessLevel and requestAuthorizationForAccessLevel. These are missing from Kastri but are trivial to import, except for requestAuthorizationForAccessLevel which asks for a "void (^)(PHAuthorizationStatus status)" parameter as the handler. That thing looks scary.
  16. dummzeuch

    When LSP fails

    In addition to allowing to change keyboard shortcuts, GExperts has the Uses Clause Manager which on the Identifier tab offers similar functionality as the Delphi Uses Helper. The UI is very different though, but it also finds partial matches (but not typos).
  17. Sherlock

    Styling message boxes

    Except carrying the rig around. *SCNR*
  18. Angus Robertson

    TWSocket,,,

    I've just got this working with new types Socket_Address = record { V9.5 used to store an IPv4 or IPv6 address } Sockaddr: PSockAddrIn6; SockaddrLength: Integer; end; TSocketAddress = Socket_Address; CSADDR_INFO = record { V9.5 used to connection IP information } LocalAddr: TSocketAddress; { family, address and port } RemoteAddr: TSocketAddress; iSocketType: Integer; { SOCK_STREAM or SOCK_DGRAM } iProtocol: Integer; { IPPROTO_TCP or IPPROTO_UDP } Buffer: array[0..64] of Byte; { space for PSockAddrIn6 records } end; TCSAddrInfo = CSADDR_INFO; Need to ensure it handles all ways of connecting, and update a sample to show the result, hopefully later today. Angus
  19. It apparently is: It does not happen on my laptop with a single HD screen. Nor on my desktop when I turn off the 4K monitor or alternatively the HD monitor. And after starting Delphi once with only the HD monitor connected, it no longer happens with both monitors. Sounds like an easily reproducible problem, doesn't it?
  20. I don't have any of the mentioned above IDEs, but i see a problem or two .. well more than that a lot, but will talk about your exact problem first 1) The directives are wrong and mixed, and here how they should look like function TRandom.Next(Bits: Integer): UInt32; begin {$IFOPT R+} {$DEFINE HasRangeChecks} {$ENDIF} {$IFOPT Q+} {$DEFINE HasOverflowChecks} {$ENDIF} {$RANGECHECKS OFF} {$OVERFLOWCHECKS OFF} FSeed := (FSeed * CMultiplier + CIncrement); Result := UInt32(FSeed shr (64 - Bits)); // Use the highest bits; Lower bits have lower period. {$IFDEF HasRangeChecks} {$RANGECHECKS ON} {$ENDIF} {$IFDEF HasOverflowChecks} {$OVERFLOWCHECKS ON} {$ENDIF} end; Because we have two overflow check can be triggered here, not one !, Integer overflow range overflow come from multiplication and form truncation while mixing signed and unsigned, both need to be disabled, also the R+ for the range while wrongly was Q. 2) I tried this small test procedure RunTest; var Rand: IRandom; A, B, C: BigInteger; begin Rand := TRandom.Create($FF00FE01FD02FC03); // sooner ! Trigger overflow check at TRandomBase.NextBytes //Rand := TRandom.Create($FF00FF01FF02FF03); // Trigger overflow check at TRandom.Next A.Create(1024, Rand); B.Create(1024, Rand); C := A * C; Writeln('A = ' + A.ToHexString); Writeln('B = ' + B.ToHexString); Writeln('C = ' + C.ToHexString); end; And we have another place that has an overflow, but the fix is easy (again sign bit!!) procedure TRandomBase.NextBytes(var Bytes: array of Byte); var Head, Tail: Integer; N, {Rnd,} I: Integer; Rnd : UInt32; // <--- fix overflow begin Didn't go through more tests or any deeper in digging into the source. Now to the other problems 3) This pseudorandom number generator is not cryptographically secure , it has very small duration and depend on single modular operation which is 2^(64-Bits)= 2^k, this can't be considered secure it is as predictable as it can be by design, but choosing 2^k make brute force algorithm for it way much faster ! 4) I don't understand from where the assumption of only 48 bits are only used, this is strange and out of the context or this family of PRNG, may be i missed something with Bits, but will not dig deeper in it. 5) the core problem is depending on Int64, this is signed and by using signed we lose a bit and confuse the compiler and math, while gains nothing in return, this family of PRNG which call LCG https://en.wikipedia.org/wiki/Linear_congruential_generator doesn't handle signed numbers, and doesn't need as it is by definition, so using Int64 should be replaced with UInt64 for the constants, and the algorithm too. 6) tried to figure out this code You are going with Karatsuba https://en.wikipedia.org/wiki/Karatsuba_algorithm , nice it is the right way when you are in the corner, also much cleaner for limbs, yet the last masking is again wrong assuming (you are following the original code) it can or should be signed operation, this should be changed to unsigned, and return the sign bit to the fold, as it is by design is using the highest 32 bit, by losing the sign, where entropy is lost, we left with 31 bit randomness. About learning and implementing RSA, yes do it and you will learn much, and i wish you good luck, also a suggestion : why not read more about CSPRNG and implement one ,a cryptographically secure (CS) one, there is one i liked very much due it speed and portability, it is based on CHAHCA with reduced rounds called ChaCha8, it use the same permutation as ChaCha20 but with 8 rounds, it is secure and small as it can be, and used in Go Lang applications extensively, anyway it is not so important and most important thing is understanding is that security is like a chain and the chain is weak as its weakest link, randomness is always the most crucial link that when break (insecure) it will render everything built on it insecure, and last suggestion if you are going to use you own implementation of RSA in production for clients then test it then test it and test it again and think a lot before using your own implementation, it is not recommended by anyone ( as i think you read again and again, things like don't implement your own...), but you should learn it inside out, so go with it.
  21. Dalija Prasnikar

    Moving from W10 -> W11

    I would go back to Vista or Win 7 in blink of an eye. I would be thrilled if I could have stayed on Win 10, too. Windows 11 is by far the worst Windows version ever (and I could not believe this was possible after Windows 8). There are zero new features I want to have and they messed up everything else. For start half of the things no longer cannot be configured. Taskbar height is too big, colors and icons are awful, Windows theme even worse (selection colors, checkboxes, and similar), you need ten clicks more to do things, fonts are total nightmare and cannot be uninstalled. Whoever designed that Cascadia Mono font needs to be tarred and feathered. It is absolutely illegible and half of the websites are using is as the default monospace font. And this is just scratching the surface...
  22. Thank you! I would never do that. Disagreement does not imply lack of respect. It was not meant to bother you. This is why I also put a smiley at the end of my sentence. The point was to bring attention to your posts which are hard to read because of your AI usage. AI can be helpful, especially for communication and I know people who are able to communicate their thoughts better with the help of AI. However, that involves using AI very lightly and mostly for translating and fixing text they actually wrote. When you give AI more freedom to write things for you, the effects will commonly be the opposite. I am finding your posts where you used AI extremely hard to read. They are long and unnecessarily wordy. Another problem (not that relevant here and now) is that when one can clearly recognize something being AI generated more than having some light AI touches, one cannot be sure whether you are actually discussing something with a person or merely an AI. Are the points and arguments used really the ones that the person has tried to make or it is just something AI put there? It is hard to have a conversation in such situations. Nobody is trying to prevent anyone from using AI. You are free to use it all you like. I am not sure what you mean by spying or using third party tools. I am neither spying on you, nor I am using any tools for AI detection. As a Stack Overflow moderator, I have seen first hand the huge amount of damage AI can cause. The amount of posted AI answers there (where vast majority of them are completely incorrect AI slop) is not measured in thousands. It is measured in tens and hundreds of thousands. There are users who posted hundreds and even thousands AI answers. Imagine how much more of such posts would be there if AI would be allowed there. The site would be overflowed with AI. The only reason why AI is forbidden there is to preserve the site as repository of knowledge and a place where you can go and get help from actual experts in their field. Unfortunately, the only means moderators have to fight such influx of AI answers is to remove all and every one where some AI usage is detected (even when it is used merely for translating). We cannot easily distinguish between post which were fully AI generated and ones that were merely improved by AI. On the scale of Stack Overflow, with only handful of moderators removing AI, we cannot judge the correctness of each and every answer. Unfortunately, it would. You cannot add feature without removing the time needed to do implement said feature, from something else. That means less improvements in already used frameworks (VCL and FMX), less bug fixes, less IDE improvements. Embarcadero is not Microsoft, nor Apple, nor Google. They need to pick what they will do carefully to maximize benefits to all customers, which means focusing on the things that cannot be easily provided by 3rd party.
  23. Miguel Moreno

    fmxLinux missing?

    For Delphi / RAD Studio version 12.3, the original solution provided by Jim:  C:\> getitcmd -i=fmxlinux-12-1.78 works "out of the box" with no issues !! ( --> no "patch" needed as in 12.2 ) You can use this solution to get "FMX Linux" until they reach a final agreement with Kryukov's state ...
  24. AI is just a tool. It has its uses. It's not going to do everything. Yes it's over hyped. But that does not mean it has no value. As usual the value lies somewhere in between what the hypers and the doubters say.
×