c++ – How does boost sort handle additional memory allocation

According to the documentation of boost::sort (https://www.boost.org/doc/libs/1_75_0/libs/sort/doc/html/index.html) all algorithms uses “additional memory“.

I couldn’t find any information on how this memory is allocated in the documentation.

Does anyone know if it is heap-allocated during each sort operation, is it stack-space, or does boost::sort utilize some static internal memory buffer (like std::stable_sort)?

If heap-allocated, is it possible to pass a pre-allocated buffer to the sort operations in order to gain control over memory allocations?

coding style – How should you program your C++ application to handle signals STOP CONT HUP INT TERM KILL USR1 USR2, etc?


I have been expanding a download library, in which I want to store its progress by writing the accumulated bytes to a database before its overarching application gets killed, either through error or shutdown or whatever. I had inquired about whether its destructor would be run when I close an application. I did not get a clear answer however, and said it was heavily dependent upon the signal being sent, and was linked to this library here: https://www.cplusplus.com/reference/cstdlib/atexit/


I went to my task manager and quickly wrote down all the signals I could send an application, them being:

  • STOP – Suspend
  • CONT – Continue
  • HUP – Hangup
  • INT – Interrupt
  • TERM – Terminate
  • KILL – Kill
  • USR1 – User 1
  • USR2 – User 2
  1. Are these signals synonymous with the signals found here https://unix.stackexchange.com/a/317496/79280
    and from typing man 7 signal? If so, why are these ones most likely picked specifically to be included in my task manager, omitting the others?
  2. Broadly speaking, how do each one of these signals interact with your application?
  3. Of these signals, which will call a destructor?
  4. When programming for them, do the libraries such as https://www.cplusplus.com/reference/cstdlib/atexit/ exist only in std::lib, or does Qt, Boost, etc have their own implementations and means of dealing with such?
  5. Are there any signals here which you can not program for? Why or Why not?
  6. Is there any literature, or standards, or coding styles which account for how one should treat these signals inside your program?


Is MySQL more scalable than PostgreSQL due to the difference in how they handle connections?

I’m trying to decide if either MySQL or PostgreSQL would be more suitable for an application that will get hit by potentially thousands of simultaneous requests at a time.

During research, one fact that stands out is that PostgreSQL forks a new process for each connection, whereas MySQL creates a new thread to handle each connection.

  • Does this mean that MySQL is more efficient than PostgreSQL at handling many concurrent connections?

  • How much of an impact does this difference have on how well both systems scale? Is it something that I should worry about to begin with?

jquery – plugins handle are not showing

I have many plugins on my website including woocomerce plugin but when I check page source of my site the script handle of many plugins are not appearing including wocoomerce, I checked one of the plugin code and I found the handle is actually defined on their code but still it not appearing on front

For eg.

 wp_enqueue_script('woof_front', WOOF_LINK . 'js/front.js', array('jquery'), WOOF_VERSION);

is printing like this

<script src='https://scrrccsite.com/wp-content/plugins/woocommerce-products-filter/js/front.js?ver=1.2.4'></script>

c++ – Why I couldn’t handle an exception thrown from a destructor outside of it?

I’ve read in C++ primer 5th edition ch18 on Exception Handling that a destructor usually should not throw an exception like STL containers and if it should, that thrown expression should be wrapped in a try-catch block (a catch must handle that exception).

  • I’ve tried this for understanding purpose:

      struct Foo{
              std::cout << "Foo()n";
              std::cout << "~Foo()n";
              throw "exception thrown from Foo::~Foo()n";
              std::cout << "Back in Foo::~Foo()n";
      int main(){
              Foo f{};
              Foo* pFoo = new Foo{};
              delete pFoo; // normally exception caught here nad handled by the following catch
          catch(char const* const& cp){
              std::cout << cp << 'n';
          std::cout << 'n';
  • IMHO Foo‘s Destructor should not here throw that exception because a handler outside that Destructor can never catch that exception; because destructor is invoked whenever an object goes out of scope and a try-catch block is always inside a block, in other words the destructor is called after a try-catch blcok.

  • But as we know we can call a destructor prematurely for example calling it explicitly or deleting a pointer of a class/struct type that points to a valid dynamic memory. So in this case we can call that destructor inside a try-block which normally can be handled by the corresponding handler.

  • But my program always calls terminate() (as a sign of unhandled exception) and I get the warning:

warning: throw will always call 'terminate' (-wterminate).

  • AS you can see I am invoking the Foo destructor inside try-block in main: delete Foo. The same I can do if I wrote: f.~Foo();.

  • So can someone explain the reason behind that? Thank you!

How do you handle a difficult DM in D&D?

I am currently in a long-running game with friends and family. The question is, what do you do about an inconsistent and abusive GM?

Recently mid-session, there was a routine turn of combat played out similarly to any other combat we have done in the past. During this one, however, arbitrarily the DM decided to change already ruled upon and established ways in which we did combat. When it was pointed out to the DM that a ruling had already been made by them in the past that contradicts their ruling now, and that we had been playing this way for the entire campaign, he refused to hear it.

This was then followed up by a simple statement of "We can discuss it later, lets continue" from the player. But when that was said, the DM took a harsh "How Dare You" type of stance, loudly berated the player for suggesting that it could be discussed at a later time, proclaimed that there would be no discussion as it was "already had", and made it clear no questions were to be raised on their rulings.

The player and DM then proceeded into a circular "I don’t want to stop gameplay, we’ll talk later." followed by "We will not talk later, you are ruining this whole session by questioning me" argument that effectively killed the entire night.

In this instance I do not know how things should proceed. Should we inform the player that regardless of inconsistency and contradiction to previous rules they have to deal with the DM’s decisions and the fact that they won’t discuss anything further at a later time, or should we confront the DM letting them know that they don’t have to bend to player requests/questions, but losing it over the "audacity" of someone saying they will talk about a ruling later is pretty crazy.

I know in D&D that the DM is ultimately the decision maker, but is it ok for them to change their own rulings arbitrarily, and to tell players they aren’t allowed to discuss it?

This is not a campaign we can simply walk away from as it is a family event, but how do we address a DM like this IF we should address it at all?

SO I guess the question is: "Can a DM arbitrarily make a different ruling on something they have previously already made a decision on, and how should it be handled if they refuse to discuss any of their decisions?"

8 – Custom entity field UI “EntityDisplay entities can only handle fieldable entity types.”

I’ve created custom entity using drupal console and added my required properties using base field definitions.

Everything was working well in that I could add and view the entities until I changed a setting in the field UI for one of the properties on that entity type.

When I try and view an entity now I get the following error message.

InvalidArgumentException: EntityDisplay entities can only handle fieldable entity types. in DrupalCoreEntityEntityDisplayBase->__construct() (line 126 of core/lib/Drupal/Core/Entity/EntityDisplayBase.php). 

I thought all the properties on my entity would be manageable in the field UI, I can see them and make changes in the UI but as soon as I do it breaks.

architecture – Monorepo, or how to handle two application modules in one project

The problem:
There are two application, which have many common parts.

Desire: reuse common code between application.

Question: what is the best way to achieve this?

Simply create two application modules in project and share common code between them in lib modules?

Monorepo? What is monorepo for Android projects?

backup – How to handle hidden files and folders (which begin with a period/dot) when backing up Android to a Windows NTFS volume?

Over on Superuser, I asked about whether or not it’s okay to have filenames and/or folder names that begin with a period (dot) on a Windows NTFS volume.

The immediate response I received was to avoid doing this.

What’s an effective way to backup Android hidden files and folders (which begin with a period) onto a Windows NTFS volume?

The person answering my question on Superuser recommended renaming the files on Android, if possible. Well, that’s certainly possible. It involves these steps:

  1. Finding every file/folder that begins with a period
  2. Making a copy of each file/folder found
  3. Renaming each file/folder copied to a unique name that does not begin with a period
  4. Backing up the copies (most likely via FTP)
  5. Deleting all the copies

Ugh. Is there a better way to accomplish this task? And if not, is there a way to automate all this work?