Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 04/05/25 in Posts

  1. Remy Lebeau

    Best way of handling Exceptions

    I (relunctantly) agree with ChatGPT on this one - you should not modify the original exception, but instead you should raise a new exception that captures the original exception into the new exception's InnerException property. However, the way that ChatGPT demonstrates this is wrong: Firstly, SysUtils.Exception does not have a public SetInnerException() method. ChatGPT suggests defining a new class, but then doesn't use that class. And that class is just trying to replicate a feature that already exists natively in SysUtils.Exception. Second, ChatGPT's approach does not release ownership of the original Exception, so the try..except will still try to free it when the except block exits, leaving the new Exception holding a dangling InnerException pointer to a now-dead Exception. The correct way to capture an InnerException is to use the SysUtils.Exception.RaiseOuterException() method, eg: try sqhpartyroles.sql := fsqlhandle.buildsql; sqhpartyroles.executesql; except Exception.RaiseOuterException(Exception.CreateFmt('error from sql %s', [sqhpartyroles.sql])); end; (I don't like this syntax, but it is what it is...) Higher up the call chain, you can then catch the new Exception and traverse its InnerException chain if you want to report/log all of the individual error messages, eg procedure MyForm.Application1Exception(Sender: TObject; E: Exception); begin repeat // use E as needed, then... E := E.InnerException; until E = nil; end;
  2. Don't forget the difference between a user trying to get work done in an application vs a developer playing/scrolling around. I find a modern styled application can be easier for a user to read and follow as they work on the content shown in the application. Some appreciate being able to adjust things to their taste - especially older workers desiring larger fonts and more contrast. Users rarely dynamically resize forms these days - either it is full screen or snapped to half a screen or some other region. I have gotten distracted working on things that seemed important - speed while users really wanted predictability. For example a form frozen for 4 seconds feels worse to a user than an active form showing progress that takes 15 seconds. When developing I might scroll through 1000's of records while a user is more likely to search and display 10-100 records and examine them when actually doing work.
  3. Joseph MItzen

    Absolute Database question

    They can't... Donald Trump imposed a 15% tariff on English Wednesday (the United Kingdom announced they would challenge this via the World Trade Organization). Gemini translated it as... "Hello, I'm sure much has already been said here about Absolute Database and its practical application. It's not about ABS being a fast database, but rather about it being a desktop database that was written in Delphi itself and can be easily integrated into your Delphi project. A desktop database is generally only operated with a maximum of 2 users. I use it for demo projects that I can conveniently pass on for people to try out my projects. ABS is also very good for applications where I only use the data privately." I'm still not sure what the advantage of ABS is over SQLite and DuckDB unless you just want to use something written in Delphi, but there you go.
  4. Tommi Prami

    Rapid.Generics revamp

    Could you please make the benchmark results like in the original version has. And possibly add the original into the mix, so can see how much the bugfixes ads overhear, correctness sometimes sadly has some penalty 😉 But anyhow, would be good addition.
  5. Geoffrey Smith

    AI Examples

    I have a project that I originally started for a presentation at the ADUG 2023 Symposium, which was on AI and ChatGPT. Since then I have continued to improve it and added more features to it. One of the goals of this project is to provide a library to Delphi Developers that enables them to easily use various AI models / engines that are currently available. Currently this is mostly done through calling various different REST API's that different companies provide, although another goal is to enable models to be used locally where practical. Features include: - Voice Recognition - Text to Speech - Image Generation - Face Detection - Large Language Models (LLM) like GPT. I have created various example programs that exercise the different API's as well. Today, OpenAI released some new features and API's. I have since added support for Dall-e-3 and the Text to Speech engine so far. To find out more have a look at https://github.com/geoffsmith82/Symposium2023
×