Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 04/26/25 in all areas

  1. 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
  2. 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:
  3. FYI: https://probablydance.com/2018/06/16/fibonacci-hashing-the-optimization-that-the-world-forgot-or-a-better-alternative-to-integer-modulo/ -tee-
  4. Maybe Delphi is the last refuge of Python 2 diehards?
  5. You are not going to get a notification if you use startActivity(), you need to use startActivityForResult().
  6. That makes a lot more sense. Assumed it was common knowledge? I'm not so sure. I think there's still a big underbelly of Delphi coders that don't get this.
  7. If you plan to buy a mac (mini), please note: the simulator only works on ARM processors. All new macs use ARM now, but if you buy an old one, be sure to avoid Intel. The first Mac Mini with M1 (arm) processor was released in 2020.
  8. 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.
  9. 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.
  10. This way is reliable and works
  11. I mean, you work with strings and do TEncoding.ASCII.GetBytes
  12. I don't see this as helpful to anyone. Use bytes to represent bytes. Use strings to represent text. Don't use ANSI strings.
  13. 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?
  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.....
×