Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 02/01/23 in all areas

  1. Brandon Staggs

    Some more fun with ChatGPT and Delphi

    That's the problem. And ChaptGPT doesn't know what it does not know, which makes it even worse. ChatGPT is very confident in its answers even when it is egregiously wrong. But even worse is when it is confidently wrong in a subtle way. It's fun, perhaps interesting, but not useful. We already have college students surprised when they turn in work written by ChatGPT and get failing grades. These students (and people like them) are what scare me. They trust ChatGPT when they should not.
  2. Sure: Everything was better in the past
  3. tinyBigGAMES

    SDL3 for Pascal

    SDL3 for Pascal If you want to get your hands dirty and directly use the new SDL3, I got you covered. 😎 Add SDL3 to your uses statement and it will be linked into your executable with direct access, no DLLs to maintain. You also get miniaudio (for audio), Nuklear (for GUI), pl_mpeg (for video) and stb (for images & fonts) and more. Added a contrib folder and accepting PRs, if you wish to add a contribution. To start the ball rolling, I added ziparc archive utility for making standard password protected zip archives, using zlib/minzip from SDL3pas only. Enjoy! https://github.com/tinyBigGAMES/SDL3
  4. I just spent some time testing ChatGPTs ability to "understand" and explain Delphi source code. The results were actually quite good. I asked ChatGPT "what’s wrong with the following Delphi code?" function IsoStringToDateTime(const ISODateTime: string): TDateTime; const ISOShortLen = 19; ISOFullLen = 23; var y, m, d, h, n, s, z: Word; begin // ISODateTime should be in one of these formats: // YYYY-MM-DDTHH:NN:SS, YYYY-MM-DD HH:NN:SS // YYYY-MM-DDTHH:NN:SS.ZZZ, YYYY-MM-DD HH:NN:SS.ZZZ if (Length(ISODateTime) <> ISOShortLen) and (Length(ISODateTime) <> ISOFullLen) then raise EConvertError.Create('Invalid ISO date time string: ' + ISODateTime); y := SysUtils.StrToInt(Copy(ISODateTime, 1, 4)); m := SysUtils.StrToInt(Copy(ISODateTime, 6, 2)); d := SysUtils.StrToInt(Copy(ISODateTime, 9, 2)); h := SysUtils.StrToInt(Copy(ISODateTime, 12, 2)); n := SysUtils.StrToInt(Copy(ISODateTime, 15, 2)); s := SysUtils.StrToInt(Copy(ISODateTime, 18, 2)); z := StrToIntDef(Copy(ISODateTime, 21, 3), 0); // Optional Result := EncodeDate(y, m, d) + EncodeTime(h, n, s, z); end; and also "What does the following Delphi function do?" function FileSizeToHumanReadableString(_FileSize: Int64): string; begin if _FileSize > 5 * OneExbiByte then Result := Format(_('%.2f EiB'), [_FileSize / OneExbiByte]) else if _FileSize > 5 * OnePebiByte then Result := Format(_('%.2f PiB'), [_FileSize / OnePebiByte]) else if _FileSize > 5 * OneTebiByte then Result := Format(_('%.2f TiB'), [_FileSize / OneTebiByte]) else if _FileSize > 5 * OneGibiByte then Result := Format(_('%.2f GiB'), [_FileSize / OneGibiByte]) else if _FileSize > 5 * OneMebiByte then Result := Format(_('%.2f MiB'), [_FileSize / OneMebiByte]) else if _FileSize > 5 * OneKibiByte then Result := Format(_('%.2f KiB'), [_FileSize / OneKibiByte]) else Result := Format(_('%d Bytes'), [_FileSize]); end; The answers will surprise you. And these were the shocking answers. The answers were actually quite interesting.
  5. Dalija Prasnikar

    try... finally on Mac

    This issue happens on all LLVM backed compilers because LLVM is not capable of catching hardware exceptions unless exception happens within another function. You find more information on my blog post https://dalijap.blogspot.com/2018/10/catch-me-if-you-can.html I never got around to write the sequel, but the implications is that literally anything that all exception handling implicit or explicit is broken in such situations. The solution is that you either wrap your code in separate function that will not have any exception handling within, and then the caller will be able to catch and handle raised exceptions. Another way of solving issues is to avoid code that can trigger such hardware exception and raise Delphi exception if code does not satisfy some requirement as explained in https://docwiki.embarcadero.com/RADStudio/en/Migrating_Delphi_Code_to_Mobile_from_Desktop#Use_a_Function_Call_in_a_try-except_Block_to_Prevent_Uncaught_Hardware_Exceptions So in the context of your example, you should either check whether object is nil before trying to use it (this would actually be general advice, as accessing nil object, depending on the code, on Windows does not guarantee that you will get AV). Note. I don't know what exactly following quote from documentation about macOS means: "structured exception handling (__try/__except) is not available". Linked page talks about hardware exceptions, but I am not sure whether there are some other implications here besides what I said in context of LLVM. At the moment I don't have my development environment set up in a way that would allow me to verify behavior on Mac. While bugs are always possibility, RTL appropriately handles hardware exceptions in cross-platform code. I removed wrong duplicates and added appropriate one.
  6. DelphiMT

    try... finally on Mac

    I feel for you. I think a big part of the problem is that we lost a lot the developer community when Google shut down Google+ -- there was a pretty active Delphi group there, and while this forum is great, I don't think it has the reach of the old Google+ group. You might try posting on Reddit and Discord as well -- there's got to be someone out there who has solved this problem. I had a similar experience when making an Android app that uses Bluetooth -- much of the Delphi documentation was out-of-date, Stack Overflow wasn't very helpful, and a lot has changed in how you use Bluetooth in recent versions of Android. I do not envy the RAD Studio developers trying to maintain and keep up with 4 different platforms.
  7. Brandon Staggs

    try... finally on Mac

    Also, a rant: I feel like a trailblazing pioneer on the frontier of some unexplored land. Searching this issue out has led me to one and only one thread where someone brought this up on Stack Overflow, and that thread was incorrectly marked as a duplicate (neither of the linked answers are relevant to the question in the slightest). The comments on the SO post are a bunch of people piling on about the cause of the exception and not addressing the question that was asked. Am I the only one actually trying to use Delphi to build a non-trivial MacOS application based on an existing code base?
  8. Maybe a little offtopic, but ...
  9. Sherlock

    IEC 62304 Medical software standard

    Only if and when Sennheiser chooses to call them hearing aids themselves, but then they might get questions from other folks too. So I'm sure they will avoid using the term wherever they can....at least until they have all the necessary documentation. I mean 849 bucks is a steep price for ear buds, but quite competitive for mid-level hearing aids.
  10. Actually it's probably not that much work to create a package generator - the hardest part will be creating the definition schema. Something like this (YAML) schemaVersion: 0.1 package: name: VSoft.MessagingR compilerVersions: XE2-11 libSuffix: %compilerVersion% packagesFolder: .\packages folder-template: Rad Studio %ProductVersion% %CodeName% platforms : Win32, Win64 files: - .\src\VSoft.Messaging.pas - .\src\VSoft.Messaging.Internal.pas - .\src\VSoft.Messaging.Dispatchers.pas - .\src\VSoft.Messaging.Channel.pas requires: - rtl compilerOptions : | {$R *.res} {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} {$ALIGN 8} {$ASSERTIONS ON} {$BOOLEVAL OFF} {$DEBUGINFO ON} {$EXTENDEDSYNTAX ON} {$IMPORTEDDATA ON} {$IOCHECKS ON} {$LOCALSYMBOLS ON} {$LONGSTRINGS ON} {$OPENSTRINGS ON} {$OPTIMIZATION OFF} {$OVERFLOWCHECKS OFF} {$RANGECHECKS OFF} {$REFERENCEINFO ON} {$SAFEDIVIDE OFF} {$STACKFRAMES ON} {$TYPEDADDRESS OFF} {$VARSTRINGCHECKS ON} {$WRITEABLECONST OFF} {$MINENUMSIZE 1} {$IMAGEBASE $400000} {$DEFINE DEBUG} {$ENDIF IMPLICITBUILDING} {$DESCRIPTION 'VSoft.Messaging Runtime for %ProductVersion%'} {$LIBSUFFIX '%LIBSUFFIX%'} {$RUNONLY} {$IMPLICITBUILD OFF} The idea being there would be a bunch of built in variables like CompilerVersion, ProductVersion etc that can be sprinkled in the template and then replaced when the dproj/dpk files are generated. Obviously there is more to add to the above, like output folders, configs etc.. but it should be pretty simple to build on it. I'll make a start and chuck it up on github, open to suggestions on the definition schema. I'll probably use https://github.com/neslib/Neslib.Yaml for the yaml parser (haven't tried it yet though).
  11. The most important part is, that ChatGPT was trained with data from the past. There is no continuous aggregation of knowledge or something. So all answers, how accurate or fascinating they may be, are based on "old" data.
  12. We're using it but I wrote a custom wrapper because the one that comes with Delphi is not sufficient. One thing to keep in mind is that Edge is somewhat of a moving target. An update late last year changed how they process query strings on local file paths and completely broke how we were using it and since we use the evergreen, we had to scramble to get out an update to restore the functionality.
  13. I think Albert was slightly wrong ( only in that case ... and with his cosmological constant ). We have already a world full of idiots, but unfortunately the technology has not yet surpassed our human interactions yet, to help us out of desaster. Maybe that is the whole problem
  14. Lars Fosdal

    Convert Png To ico fmx delphi

    IcoFX is my goto tool for Icons. But, I have to admit I use the last free version: 1.6.4
  15. Patrick PREMARTIN

    Embarcadero Toaster - Notification Window Caption in Win10

    Hi For those how haven't seen it, the solution is to call PlatformInitialize on your TNotificationCenter component some times before sending any notification like in FormCreate event. Windows will have time to see the shortcut file linked to the registry key and the notification and so not display the registry key name but the EXE file name instead. This problem is just a simple delay in Windows between creating files and seeing them in other API... If you have previous Delphi releases, without PlatformInitialize method, you can create a shortcut to your program in the user startup menu program folder. It should work.
  16. Now I finally have an excuse to live a long and healthy life 🙂
  17. Der schöne Günther

    Are you using the Edge browser control in production and which one ?

    I think Embarcaderos wrapper does not throw any exceptions or displays error messages if it doesn't find the runtime, but I recall seeing an event that lets you check if loading was successful or not. Whether Edge is installed or not does not matter. You have to ship the WebView2 runtime. It is available as a standalone installer. It took me a few minutes to understand how to use TEdgeBrowser (or TWebBrowser), that the runtime must be installed and your Delphi app will need a "WebView2Loader.dll", but after that, I never had to tweak it again. We started shipping it even when TEdgeBrowser/WebView2 was still in preview.
×