Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 05/12/23 in Posts

  1. Stefan Glienke

    How can I allocate memory without raising exceptions ?

    So you are saying that your app is already using more than 2GB (or more, large address aware and all that) and might not have enough space for allocating a simple string to store a file path in... But at the same time you are talking about using a form and showing information there... and where do you think the VCL (I am assuming you are using the VCL and not creating your form by directly accessing the winapi) takes its memory from? And worrying about the performance impact of try while scanning directories on the file system? Sorry, but this all makes absolutely no sense.
  2. Ali Dehban

    ChatGPT plug-in for RAD Studio.

    Hello, everybuddy. Recently I made a plug-in for Delphi to use ChatGPT inside the IDE. The main service is ChatGPT but it's actually multi-AI support, you can get responses from three different sources, compare and decide. I hope this can be helpful and accelerate your work. Repository: https://github.com/AliDehbansiahkarbon/ChatGPTWizard Key features: - Free text question form. - Dockable question form. - Inline questions(in the editor). - Context menu options to help you to find bugs, write tests, optimize code, add comments, etc... - Class view. - Predefined Questions for class view. - History to save your tokens on OpenAI ! - Fuzzy string match searches in the history. - Animated letters(Like the website). - Proxy server options. - Supports Writesonic AI (https://writesonic.com) - Support YouChat (https://you.com) Short Video 1: Short Video 2 - Inline Questions: Full Video (ver. 2.0):
  3. For anyone interested I have solved my problem. I have an abstract base class (called TThreadStateMachine) that I use to derive classes for code units that run in their own threads and are state machine based control. The base class has a virtual function that forms the basic periodic tick of the derived class state machine. The TThreadDataInterface_TS template class is used to provide thread safe communications to / from the state machine. The problem comes when the derived classes, based on TThreadStateMachine are destroyed. The C++ standard ensures that the derived class destructor is called BEFORE the base class destructor. But because the base class was still running it's own thread it was (sometimes) causing the derived class state machine to "Tick" even when parts of it have been destroyed. My solution to this was to create a new base class function AbortThread() and make sure I call this in the derived class destructor before doing any further destruction. Now it passes many many iterations of a unit test creating and destroying without an error. I believe all is good now. One mystery may never be solved.:Why dic my poor original implementation never seem to cause a problem on Linux / GNU C++ ?
  4. We sometimes provide discounts for HelpNDoc but none are available or planed at the moment. That being said, try contacting us mentioning this thread and we'll see what we can do: https://www.helpndoc.com/contact/ 😉
  5. Dalija Prasnikar

    Loop a Delay in a thread??

    Counting is hard
  6. Avoiding tries is weird style. Avoiding tries because of some perf impact you've once read about somewhere is much weirder. The really time critical parts should avoid tries indeed but that starts to play difference for millions ops/sec. My advice is to give up bothering about these nano things. If you really strive to achieve visually try-less code, just wrap AllocMem in try-except and hide the function somewhere deeply in utils unit. Anyway RTL has lots of tries inside
  7. Stefan Glienke

    How can I allocate memory without raising exceptions ?

    If it's just a string variable you don't need to heap alloc anything - either use a const if you already know the exact content or use a preallocated buffer.
  8. Patrick PREMARTIN

    Something like SimpleNote with an API?

    I don't know any app/software in this area. If the user is the only user of the program, if there are no update of notes somewhere after publishing them on too different devices before synchronisation, perhaps you can use a local server on your desktop computer and apps that synchronize (or send notes) to it ? AppTethering components could help on a local network (home or office). MQTT is a solution : you send something in a queue an all "client" programs read what is in the list, but you should encrypt the content is you use something public. Perhaps a Firebase (or other cloud thing) database can be a solution too. If you already have a website (I'm sure you have), you can also try something like my "Planning API" project ? - a web API server : a list of simple PHP script with no database to manage the CRUD operation, storing datas as JSON files in a subdirectory, change API keys and put it on a website (in a "complex" directory name) - a Delphi FMX client app : it gets the datas from the server on startup, display them and send the changes to it by clicking a "synchronize" button. In this project, all datas are stored on the server. A web connection is needed, but you can change the client app to have a "add note" feature without Internet and send them by clicking the button when a connexion is available. https://github.com/DeveloppeurPascal/Planning-API On the "liste de courses" project I have a real synchronization process and API : a web server (PHP and WebBroker available), a client app (Delphi FMX) which store datas locally and synchronize only changes. Each device have all datas, stored in a SQLite local database. The synchronization API works with a "changed level" on each record. The current program store a true/false, an integer and a label. You can edit the code to store only a text if you want. The server can be published on a web site (for the PHP), on a server (Internet or local) (with WebBroker) or simply on your desktop. Synchronization can be done manually like it's coded or with a timer. https://github.com/DeveloppeurPascal/Liste-de-courses I think the "liste de courses" project is the best start to adapt something if you try to code your need.
  9. Attila Kovacs

    Record as result for BackgroundWorker

    r := AWorkItem.Result.ToRecord<TPrepareesult>;
×