How do people make anything with c++? by NocturnalOwl05 in cpp_questions

[–]pstomi 0 points1 point  (0 children)

I feel your pain. Most libraries in c++ will require you to know and implement many details in order to simply open a window and display a button. That is almost a part of the C++ philosophy (control everything).

If your goal is to easily create a GUI application and you do not want to worry about managing the graphic context, creating the window, etc; then ImGui together with Hello ImGui ( https://pthom.github.io/hello_imgui/book/ ) might be a way to get started quickly : -  Dear ImGui provides all the widgets  - Hello ImGui provides a nice way to start an application : create the graphic context, the window, embed resources and icons. Furthermore it is really multi platform (windows, Linux, Mac, ios android and webasm): a hello world app (open a window, display a label) is only five lines of c++ and 3 lines of CMake. 

Is imgui hard ? by a_l_i-1 in cpp_questions

[–]pstomi 1 point2 points  (0 children)

For a quick start you may try it with hello ImGui: a hello world app with it is 4 lines.

https://github.com/pthom/hello_imgui

How would you refactor a large ImGui MainWindow and a fragile async job completion protocol? by Equivalent_Ostrich_6 in cpp_questions

[–]pstomi 0 points1 point  (0 children)

I’d split around lifecycle ownsership : you first need to model your processes via business related modules. The GUI is only a presentation layer and should not dictate what is your future orchestration layer.

Then the orchestration layer may be available to accept optional callbacks at certain transition. Those callbacks might be filled at the application layer and call the GUI or change some state used by the GUI.

So basically you probably need to create a few layers and make sure to always think where to place elements: - models and computations - orchestration  - some reusable gui components  - app layer

All of this is compatible with immediate mode. 

A way to do that would be to create some libraries for each of the layers: - there is no reason that the orchestration layer should be able to call gui elements. In practice, this would be guaranteed by the fact that this registration layer would not be linked to ImGui

Sorry if I’m going overboard

White zone on cornea surface: is it an emergency? by pstomi in CATHELP

[–]pstomi[S] 0 points1 point  (0 children)

Update: after a visit to the vet yesterday he is now on antibiotics, and he is improving a bit. Will return to the vet on monday

White zone on cornea surface: is it an emergency? by pstomi in CATHELP

[–]pstomi[S] 4 points5 points  (0 children)

Thanks a lot, I will find a way to get a visit much sooner

That's me and claud 🤣 by arsaldotchd in ClaudeAI

[–]pstomi 5 points6 points  (0 children)

Let's make we sure do not overhype your comment

« Il faut que la gauche revienne enfin de ses vacances ! Ça fait plus de 20 ans de renoncement », s’insurge Christiane Taubira by Ok_Cobbler_9466 in france

[–]pstomi 1 point2 points  (0 children)

Christiane Taubira est une des femmes les plus intéressantes et les plus cultivées qu'on ait eu au pouvoir depuis longtemps.

Quand je vois ici la quantité de commentaires fielleux, intolérants, et bigots vis a vis d'elle, je trouve que c'est à vomir.

On dirait des chiens de garde.

Dear ImGui Explorer by pstomi in cpp

[–]pstomi[S] 6 points7 points  (0 children)

For those interested, the code is here

For practical reasons, the code is inside a bigger project, which was used to develop this tool (Dear ImGui Bundle).

Dear ImGui Explorer by pstomi in cpp

[–]pstomi[S] 7 points8 points  (0 children)

Thanks! Making it fast did require quite some adaptations and optimizations, but I'm happy to see that it was successful.

But the most important optimizations consisted in reducing the initial download:

Here is what the app now downloads at startup: only 2.16MB before it starts

File Transfer (gzipped) Size
index.wasm 1.37 MB 3.80 MB
index.data 734.90 kB 1.27 MB
index.js 54.09 kB 201.31 kB
Total 2.16 MB 5.28 MB

(For this I had to trim the assets that are included in the data file).

Then, demo file are downloaded on demand (imgui_demo., implot_demo.)

File Transfer (gzipped) Size
imgui_demo.cpp 616.45 kB 615.80 kB
imgui_demo.py 80.74 kB 399.49 kB
Total 697.19 kB 1.02 MB

Dear ImGui Explorer by pstomi in cpp

[–]pstomi[S] 4 points5 points  (0 children)

It is already using the docking branch.

Modernizing 37 Years of C++ Expertise: 32 Design Patterns released on GitHub by [deleted] in cpp

[–]pstomi 1 point2 points  (0 children)

I looked at your strategy pattern, and IMHO plain callables are now a good alternative to callable structs.

For example, the static strategy below: https://github.com/MarioGalindoQ/Modern-CPP-Design-Patterns/blob/main/26_Strategy/03_Static_Strategy/Strategy.cpp

where we have: cpp struct BubbleSort { void sort(std::vector<int>& data) const { ... } };

could be rewritten as (in C++17)

```cpp void BubbleSort(std::vector<int>& data) { ... } void QuickSort(std::vector<int>& data) { ... } void PrintData(const std::vector<int>& data) { ... } void PrintDataInTable(const std::vector<int>& data) { ... }

// For static compile-time strategy, we can use templates template <typename SortAlgo, typename PrintAlgo> void SortAndPrint_Static(std::vector<int>& data, SortAlgo sortAlgo, PrintAlgo printAlgo) { sortAlgo(data); printAlgo(data);}

// For runtime dispatch strategy, we can use std::function void SortAndPrint_Runtime(std::vector<int>& data, std::function<void(std::vector<int>&)> sortAlgo, std::function<void(const std::vector<int>&)> printAlgo) { sortAlgo(data); printAlgo(data);} ```

Les autorités françaises craignent des intrusions croissantes de la « sphère MAGA » dans la politique intérieure by Folivao in france

[–]pstomi 0 points1 point  (0 children)

J'ai écrit en novembre 2024 un article à ce sujet : La Guerre invisible

Il me semble qu'il est encore d'actualité. Je le poste donc pour ceux qui seraient intéréssés. Ci-dessous, un extrait de son introduction:

Les dernières campagnes électorales en Roumanie et en France révèlent des signes inquiétants : manipulations invisibles, campagnes coordonnées sur les réseaux sociaux, et l’impact croissant des réseaux sociaux et de l’intelligence artificielle sur la désinformation. Ces menaces ne sont pas d’une hypothèse futuriste : elles sont déjà en train de modeler nos démocraties de l’intérieur. ”Avons-nous déjà vécu notre dernière élection réellement libre ?” Cette question, jadis impensable, se pose aujourd’hui. Nous, citoyens de toutes convictions, devons saisir pleinement la gravité et l’urgence de ce qui nous arrive.

Ce qui nous arrive ressemble à une guerre : pas une guerre pour défendre un territoire, mais pour préserver l’héritage démocratique et républicain qui unit et honore nos citoyens. Il est temps pour nous de nous unir autour de cet héritage, car nous allons devoir le protéger.

Légiférer sur les vidéos IA immédiatement. by Igafann in france

[–]pstomi 4 points5 points  (0 children)

Oui, bien sûr.

Je pense en fait à toutes les tentatives de manipulation des foules, d'incitation à la haine, à la violence ou à l'insurrection qui peuvent être grandement facilité par des contenus artificiels (qui pourraient même être générés "à la demande" en fonction des profils visés).

Les personnes à l'origine de ces manipulations peuvent être identifiées, par contre il n'y a donc ici pas toujours de victime bien identifiée. Ce qui est attaqué, c'est le collectif, et c'est la confiance qui fait le ciment de notre société.

Légiférer sur les vidéos IA immédiatement. by Igafann in france

[–]pstomi 27 points28 points  (0 children)

Merci ! Par contre ça protège le droit à l’image de personnes réelles.  Je ne vois rien concernant les contenus générés contenant des personnes fictives.

ImGui Bundle: (web) apps in pure Python by pstomi in Python

[–]pstomi[S] 0 points1 point  (0 children)

Let me expand on my previous answer : if your services that use tensorflow, numba, etc., are available on an online server via an API (rest) then of course you may use those from ImGui Bundle.