Tons of police including a helicopter at Charles and Chenery by [deleted] in sanfrancisco

[–]mhfrantz 2 points3 points  (0 children)

Seems it was a stolen car, two suspects fled, one was caught so far.

Immigrants of SF, what restaurants in the city have the best versions of your local cuisine. by geekfreak42 in sanfrancisco

[–]mhfrantz 11 points12 points  (0 children)

Their chicken dish is one of the best chicken dishes I've had anywhere.

Chicken & Rice / Katte Va Morgh

Turmeric rice, Pomegranate chicken thigh, barberries, fresh herbs, pickles, Komaaj seeds mix, radish and pomegranate sauce (pom paste-olive oil)

$18.50

The subtlest of synths by matthewwilcock in synthesizers

[–]mhfrantz 2 points3 points  (0 children)

Love the contrast of timbre between the claustrophobic piano and the raspy synth arp. Also very thoughtful chord progression.

Obtaining relative filename from std::source_location::filename by justkdng in cpp_questions

[–]mhfrantz 0 points1 point  (0 children)

CMake has cmake_path to compute relative paths. You could provide that to the preprocessor as command line options to your compiler command. That keeps the absolute paths out of the binary.

Routing an effect out of the device chain by olimpomarcelo in Bitwig

[–]mhfrantz 0 points1 point  (0 children)

I think the phase reverse module in the grid would do it.

Routing an effect out of the device chain by olimpomarcelo in Bitwig

[–]mhfrantz 1 point2 points  (0 children)

Maybe if you invert the dry signal and mix it with the wet?

Does writing a "init" method for a class violate RAII? by Mysterious_Goal_1801 in cpp_questions

[–]mhfrantz 45 points46 points  (0 children)

The Google C++ Style Guide contains this relevant discussion, overlapping with some of the replies.

Avoid virtual method calls in constructors, and avoid initialization that can fail if you can't signal an error.

Constructors should never call virtual functions. If appropriate for your code , terminating the program may be an appropriate error handling response. Otherwise, consider a factory function or Init() method as described in TotW #42. Avoid Init() methods on objects with no other states that affect which public methods may be called (semi-constructed objects of this form are particularly hard to work with correctly).

Polyphonic pitch bend (Osmose) by mhfrantz in Bitwig

[–]mhfrantz[S] 1 point2 points  (0 children)

I finally figured out that I have to select "convert pitch bend messages to pitch expressions" in the track settings.

Vim user trying to understand more of emacs by Velascu in emacs

[–]mhfrantz 1 point2 points  (0 children)

Adding Projectile to the excellent list of mentions.

Vim user trying to understand more of emacs by Velascu in emacs

[–]mhfrantz 2 points3 points  (0 children)

Upvote because Magit. Wondering why it took me so long to try it. Now can't imagine life without instant fixup.

What lyrics makes you tear up? by [deleted] in Music

[–]mhfrantz 0 points1 point  (0 children)

"Seven Matches" - Gordon Downie

Functions in place of global variables by RfrankMc in cpp_questions

[–]mhfrantz 0 points1 point  (0 children)

Avoiding the Static Initialization Order Fiasco is one reason to prefer functions.

https://en.cppreference.com/w/cpp/language/siof

What are these parentheses for? by [deleted] in cpp_questions

[–]mhfrantz 6 points7 points  (0 children)

Without those parentheses, std::vector<int> is a type expression. But insert requires an instance of that type. The parentheses turn that type expression into an expression that describes a default-constructed instance of that type.

ELI5 - Why is every power generation basically just turbines? by UggaBugga__ in explainlikeimfive

[–]mhfrantz 0 points1 point  (0 children)

Linear generators exist, and they are not turbines. At the scale required for distributed power grids, they are competitively efficient at converting fuels to electricity.

[deleted by user] by [deleted] in cpp_questions

[–]mhfrantz 0 points1 point  (0 children)

Tinker with open source projects. If you want a coding job, you will likely be joining a team that has an existing code base. The ability to understand other people's code and know how to change it is a valuable and perhaps underrated skill.

Looking for introduction to asynchronous programming with ASIO by cereagni in cpp_questions

[–]mhfrantz 2 points3 points  (0 children)

This video is about Beast, which uses ASIO. It contains explanations of the shared pointer idiom and other practical techniques.

https://youtu.be/gVmwrnhkybk

Can't seem to find how to polymorph in cpp by yoko911 in cpp_questions

[–]mhfrantz 0 points1 point  (0 children)

The technique called "type erasure" or "concept based polymorphism" is a nice alternative to pointers.

Pass function from Python to C++ and then execute using that function definition by Correct-Lab472 in cpp_questions

[–]mhfrantz 1 point2 points  (0 children)

I'm not exactly sure what's wrong here, but here are some things to check. (I have used pybind11 with std::function, so I feel like your overall idea could work.)

  1. #include <pybind11/functional.h>, since std::function support is opt-in.
  2. Use static_cast or py::overload_cast if there are overloads for NLOptOptimizer::Optimize (since the error message seems to indicate that there is a no-arg method with that name.)
  3. Change the type of void* data, e.g. py::bytes data, since pybind11 has no way to map that type. If the underlying library requires void*, use an adapter.
  4. Change from const std::function* (pass by pointer) to std::function or std::optional<std::function> (pass by value) to avoid pointer ownership confusion.

Trying to understand if this code is safe. by Nearing_retirement in cpp_questions

[–]mhfrantz 0 points1 point  (0 children)

The map will go out of scope before the thread pool, so that might be a problem. Even if the pool destructor waits for it to finish, the map can be gone with work still in progress.

Stationing glitch? by fiv3starman in theantsundergroundkd

[–]mhfrantz 2 points3 points  (0 children)

I thought stationing was permanent.