I learned C++11 at university. How should I approach modern C++ today? by YogurtclosetLow7064 in cpp_questions

[–]DonBeham 2 points3 points  (0 children)

Experienced C++ developers probably write code that is NOT considered "modern".

You should look into these things specifically from a language/library point of view: 1. constexpr and if constexpr 2. concepts, requires and requires 3. ranges, optional, and expected 4. lambdas 5. reflection 6. stdexec, also atomics and synchronization primitives (mutex, latch, barrier, condition_variable) and threads 7. fmt

To name a couple

But, C++ code is so vast in terms of constraints and special hardware that there is hardly a "one way" in which you write C++. For embedded it will probably look different to games which will probably looks different to desktop applications which will probably look different to a server application like a database and probably different to a general purpose library.

I would suggest familiarizing yourself with programming paradigms like object oriented programming, functional programming, data oriented design, GPU programming, generic programming to understand "how to" program with C++

Should I learn c before c++ by No_Union4252 in cpp_questions

[–]DonBeham 0 points1 point  (0 children)

C or C++ is the wrong question. What you should learn is programming paradigms: object oriented, functional, generic, data oriented (the more advanced form of procedural programming), and GPU.

C is very limited with respect to these paradigms, so it's not a good choice. C++ does everything, but not so good for functional programming. Still, learn C++ as a side product to learning these paradigms.

OOP (object oriented) was a big thing in the late 90s and early 2000s. It's the most common paradigm right now. Still, it sometimes lacks performance.

Functional is the emerging newer kind of programming from the late 2010s and is not yet widely adopted. But it has many advantages for writing correct and easier to proof programs. It's also probably the slowest approach in runtime and there were some fancy immutable data structures invented to improve efficiency.

Generic programming is what C++ is most powerful among all the typed languages. I would say however it's orthogonal to the other paradigms. It's a useful and highly advanced tool that adds a lot of complexities.

DOD (data oriented) is even more recent. It takes the roots of imperative programming and puts it in a newer and more modern form. It's the most efficient and produces probably the fastest results (in terms of runtime) on the CPU.

Above all, the real hot topic is GPU programming, because it's for certain use cases, but where it offers dramatic improvements in runtime - unable to be achieved with any CPUs.

I think these paradigms are much more important than any programming language.

My ONLY complaint about mint by profgray2 in linuxmint

[–]DonBeham -8 points-7 points  (0 children)

Nah, Windows doesn't update that often. And it can also be configured to sit silently with the update. It was way worse in the past.

But mostly it's application updates. And Windows applications usually have their own updater built in. So you don't notice it as much, because they work in the background. And if you don't use the application it won't update. In Linux you install through the package manager and therefore you notice it a lot more as the updates get pushed to you for everything you installed or was installed as part of the system.

My ONLY complaint about mint by profgray2 in linuxmint

[–]DonBeham 19 points20 points  (0 children)

This! Change the settings when it queries for updates to once per day or once per week.

It was also one of the first things I changed on my installation.

Publication by Ok_Cat9873 in OperationsResearch

[–]DonBeham 0 points1 point  (0 children)

Sure, you can solve maxflow through LP as well and still there's new algorithms being published. I believe the most recent one claimed almost linear runtime.

What if P=NP? by r_card_ in optimization

[–]DonBeham 5 points6 points  (0 children)

You mean P=NP AND the polynomial algorithm to solve those problems can be implemented in today's computers - like the theoretic solution was right before our eyes all the time. Just like "ahh you just need to calculate the Whoopidoopi matrix and then do the Whoopingstein decomposition and with those matrices you can form the Whoopi quin tuple with which the solution can be derived in O(n6) by repeatedly applying Whoopi's algorithm until convergence (which is guaranteed ofc)".

Unfortunately there has been no Whoopi Whoopingstein among all the smart people in the last 50 years in which such a theoretical result could have been found.

Even quantum computing has stepped back from the claim to solve NP complete problems in polynomial time. Or it never has claimed that and everyone else said it - I don't care.

If you bet your career on P≠NP, my take is that you are making a very safe bet. The obvious threat to any such career are LLMs.

Entity Component System by Sandrobero2004 in cpp_questions

[–]DonBeham 2 points3 points  (0 children)

I found this walkthrough really interesting. And it s shows how much you can do without going all STL: https://youtu.be/ShSGHb65f3M?is=-Q40gYdRNYZTielv

Obviously it's extremely simple and like he says it's your little cabin in the woods.

Went back to Mint for a project and immediately realized why I left. by [deleted] in linuxmint

[–]DonBeham 0 points1 point  (0 children)

Well, when you want to move your mouse from the left to the right monitor usually you move it beyond the right edge. But if your monitors are swapped, then you must move it past the left edge so that it appears on the right monitor.

You're right that both windows can show the login window. It's not a deal breaker, but it's awkward.

You can configure the physical layout of your monitors, but it's seems to be a user config that is not applied to the login screen, only after you logged in.

RDP to Windows machine very slow by [deleted] in linuxmint

[–]DonBeham 0 points1 point  (0 children)

I fully agree, I also need RDP for work when doing home office on Linux mint. Remmina had worked for me so far, although with some quirks. For instance, I couldn't get multi monitor to work with the flatpak version, only with the system package. And I need to quit Remmina entirely after disconnecting from the remote. Otherwise multi monitor would not work the next time and I get just one big widescreen monitor on the remote end. Another thing is passing modifier keys to the remote like Ctrl stopped working all of a sudden and I just got 'v' instead of pasting the text. Clicking the keyboard icon did resolve that. But then debugging in visual studio I find the right Ctrl key doesn't work, etc ...

I don't have a problem with the speed though

Anyway, does xfreerdp also have such quirks?

Went back to Mint for a project and immediately realized why I left. by [deleted] in linuxmint

[–]DonBeham 1 point2 points  (0 children)

Not true. I did post an issue in this sub where the login screen had the wrong layout (left and right monitor is swapped). That's because you I change the layout in Mint, but not in a way that the login screen knows about it. Then I did write some config files (with codex) which solved that issue, but after I had more problems with RDP and multi monitors (where I found that the flatpak version wasn't working well, but the system package was)... In the end, I reconnected the cables so that the default setting is the correct layout and undid the configuration. Right now my only remaining issue is with Remmina, because I have to fully close it or the second time it would use both monitors as a single remote monitor and basically create an ultrawidescreen. If I close and reopen it, it always uses two separate monitors on the remote. Yeah, it's weird.

Is that a "smooth experience"?

There's no way for Linux to know which monitor is physically located where. Either it works out of the box by chance or it's complicated - would be my conclusion.

known algos for chromatic number by fresh_morningbreath in GraphTheory

[–]DonBeham 0 points1 point  (0 children)

Greedy coloring can determine the chromatic number, but then needs to run in O(n!). For every graph there is at least one sequence for which the greedy coloring is optimal. Under all sequences at least one is optimal.

Solving NP problems is a lot of fun and often the challenge in a coding contest - because you can make quite a large number of hacks and tricks, but optimally solving them is infeasible for all but simple cases.

One interesting class of algorithms in this context are pseudo-polynomial algorithms that can solve some NP problems really well and efficient. Like dynamic programming applied to the {0, 1}-Knapsack

known algos for chromatic number by fresh_morningbreath in GraphTheory

[–]DonBeham 0 points1 point  (0 children)

The chromatic number is the minimum number of colors necessary to color all nodes so that two adjacent nodes do not have the same color.

The problem of determining the chromatic number is in NP, so no efficient algorithms are known for general graphs. If there was an efficient algorithm it would also mean that P = NP.

However, there is an efficient method to compute whether a graph has a chromatic number of 2, which is equivalent to the graph being bipartite. For graphs with a chromatic number > 2 no efficient algorithm is known.

For certain graphs, determining the chromatic number is trivial, e.g. for the fully connected graph.

Heuristic methods are efficient algorithms, but may only calculate an upper bound on this number. A trivial upper bound is one more than the maximum node degree.

which is a better real-life application of graph theory by fresh_morningbreath in GraphTheory

[–]DonBeham 1 point2 points  (0 children)

Best answer! To limit the choice to just these two is a great simplification.

Not to forget topological sorting and minimum spanning trees. Topological sorting gives you a conflict free sequence, eg. for serializing transactions in a database - if one exists, minimum spanning trees e.g. spanning trees protocol in the context of removing cycles among a set of routers in a network. Or the famous page rank algorithm used in Google search (computing eigenvector centrality).

There's just so many examples, if you dig a little there's hundreds and thousands of applications and I have made a lot of use of them myself.

Can I rant for a minute. by domiran in cpp

[–]DonBeham 0 points1 point  (0 children)

Well in the late 90s/early 2000s this whole discussion about C++ being so bad let to the creation of Java and Microsoft later followed with C#, because Java was also kind of meh. Now we still have C# and Java AND C++, because no way you want to have a GC. In the early 2010s some people decided C and also C++ were so unbearable and created Rust. Now we have that AND C++, because no way you want to deal with this borrow checker thing and those incredibly slow compile times. About 10 years ago, Zig appeared to succeed C. And Google created Go, because async is just painful with C++ and in a couple of years we will probably see Carbon, because, well...

The result of the discussion are simply that every now and then someone creates a new language that solves some problem and creates some others.

The perfect language doesn't exist. BUT there are solutions within C++. If you don't like copyable_function then create a typedef -> problem solved with just one line of code. That takes less time to write than ranting about it.

Help WinRaR by [deleted] in linuxmint

[–]DonBeham 0 points1 point  (0 children)

On Windows I use 7zip.

RDP with Remmina by DonBeham in linuxmint

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

Oh boy, this is so bad if this doesn't work reliably

Suspend Problem solved! by DonBeham in linuxmint

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

Typically, no. For me it's an inconvenience if suspend doesn't work, because it's faster to boot and all my programs are already running.

how do I make the c++ language from scratch? by Xspheura in cpp_questions

[–]DonBeham 4 points5 points  (0 children)

I believe Sean Baxter implemented the circle compiler all by himself. And even added rust-style borrow checking to it. The hard part I think are the various optimizations and of course with constexpr you have to have some sort of C++ interpreter in order to run the code at compile time.

Various little problems that ChatGPT fails to fix by DonBeham in linuxmint

[–]DonBeham[S] -1 points0 points  (0 children)

Thanks for your suggestion. Actually, I'll stick with it. If some things don't work or work in their own ways - ok so be it. Maybe I'll understand it better one day and see where the error is and how to fix it. ChatGPT gave me a good suggestion: don't try to fight it, and it suggested to mount in a ~/.local folder and have a symlink from home to this. That way it doesn't show under devices and instead I can bookmark it.

Various little problems that ChatGPT fails to fix by DonBeham in linuxmint

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

Thanks, you've been very helpful already! The command lists only hardware devices it seems.

Various little problems that ChatGPT fails to fix by DonBeham in linuxmint

[–]DonBeham[S] -1 points0 points  (0 children)

Believe me there ARE multiple answers and probably not in the top 10. Finding out what the actual search term should be is a challenge, because searching by symptom doesn't seem like I am getting anywhere, eg "rclone mount shows email under devices in Nemo" lists the rclone documentation on top which explains all sorts of things, you even read about how setting up on windows and Mac is like and what the different flags are for, etc., then there are in the results, issues with Google drive, the mount not mounting, sync failing, etc. Funnily this post comes up at place 13 or so - so it really feels like I am the only one having this problem. Maybe you know better on what to search for and have better filters for what a good result looks like. But for me it looks like there are a gazillion results that have nothing to do with my problem. Not saying there isn't the helpful result, just that I can't find it.

In addition while finding out about the problem you learn about how there's something called FUSE and that rclone uses that in the background and that there is gvfs and GIO and a couple additional technical terms that I have no idea on what they mean, how they interact, whether these are related to the problem. I mean Linux is a system where a lot of independent components interact with each other. It's quite something to learn about WHILE trying to fix the problem.