c ++ – Improvement of the function which replaces all instances of x by y in the chain

I have the following:

namespace utils
    void replace_all(std::string& string, const std::string_view from, const std::string_view to)
        std::size_t start_pos{ 0 };
        while ((start_pos = string.find(from)) != std::string::npos)
            string.replace(start_pos, from.length(), to);
            start_pos += to.length();

    void replace_all(std::string& string, const std::unordered_map& map)
        for (const auto (from, to) : map)
            replace_all(string, from, to);

int main()
    std::unordered_map my_map{ {"this", "that"}, {"hes", "her"}, {"my", "yours"} };
    std::string my_string{ "This is hes chocolate and my aswell" };
    utils::replace_all(my_string,  my_map);
    std::cout << my_string << std::endl;

    return 0;

It works and generates: This is her chocolate and yours aswell as expected.

When analyzing this in msvs 2019 with the C ++ Core guidelines enabled, I do however receive the following warnings:

C:devMyVSProjectsAEAEincludeAEMain.cpp(23): warning C26486: Don't pass a pointer that may be invalid to a function. Parameter 0 '$S1' in call to ' > const ,std::basic_string_view > > const & __ptr64>' may be invalid (lifetime.3).

C:devMyVSProjectsAEAEincludeAEMain.cpp(21): warning C26487: Don't return a pointer '(*(*map))' that may be invalid (lifetime.4).

I would like to remove these warnings and make the code as clean as possible.

magento2 – Magento 2 Replaces a type used in a virtual type

So, I'm trying to replace a class that is used to create a virtual type, which is used as a preference for another class (see Core di.xml below). I also posted the excerpt from my di.xml. Everything compiles well, but it never seems to take over my ruling class. Since this is a preference for a class used as a type for a virtual type used as a preference for another class, I know I am just missing something, but I have never dealt with this complex implementation. Any idea would be appreciated.

My di.xml module

Core di.xml


angular – Class link between ts and html replaces instead of adding

I have encountered some strange angular behavior … I don't know if this has ever happened to one of you.

The binding variable applying traditional binding using the double brace syntax will not work as expected, it will replace the previous classes already associated instead of adding.

Did you know how to concatenate classes instead of replacing existing ones?

As you can see in this example, here it replaces the classes associated with mat-raised-button of material.

Simple test case:



export class AppComponent {
   test = 'myClass';


.myClass {
  background: red;

Stackblitz test case

postfix – permit_mynetworks replaces check_sender_access?

I configure a postfix relay hosted on a cloud provider. I want to allow relay access only to my company's public IP addresses and to a specific list of senders. Here are my main.cf configurations:

mynetworks =
smtpd_recipient_restrictions = permit_mynetworks,
                                check_sender_access hash:/etc/postfix/allowed_senders,

allowed_senders is like this:

name.surname@domain.com OK
john.doe@domain.com OK
andrew.white@domain.com OK

If I keep these parameters, allowed_senders is ignored, whether I put it before or after the permit_mynetworks parameters. If I delete permit_mynetworks, allowed_senders works normally.

So how can I restrict access to this relay by the source IP address and the sender's email address?

Removes or replaces the background of your image. for $ 3

For $ 3, I will remove the background until you choose. For an additional $ 2, I will replace the background with any image you provide me!

by: Harthos
Created: –
Category: Art & Design
Viewed: 229


The folder continues to appear in my public_html directory and replaces the WordPress page structure

My client requires that a page be on /connect, but when accessing the created page, only a parent directory tree is displayed.

After a lot of research, I found that the problem was due to the directory public_html/connect; a completely empty directory other than one .well-known folder. After deleting the folder, the page worked perfectly, but a few days later, the folder came back and broke the page again.

Any advice on where could I start looking for the culprit?

Magento 2.3 replaces the comma in the price with the currency symbol

I want to replace the price point with the currency symbol to display something like this.price format

python – replaces a custom value when a null value is encountered in the Numpy array

I need to replace a custom value when a null value is encountered in the Numpy table
I found something like this, but it gives incorrect results.

def func(string, replace_with):
string(np.where(string == "")) = replace_with
return string


func(np.array(("1","2" ,"", "12", "")),"100")

his gift

('1' '2' '10' '12' '10') 

instead of

('1' '2' '100' '12' '100')

kid theme – Replaces plugin images so that they are not removed when updating the plugin

This is possible?

That's the x on this page. the one to remove the composition filter. This is in plugins / woocommerce-products-filter / img / with the name delete.png


I added a delete.png file in mychildtheme / woocommerce-products-filter / img /, but it did not work.
Is my method supposed to work or is there another way to do it? I really want to change it because it does not fit my theme at all and it looks like it comes from a 2004 computer.

php – Replaces a specific record field in a table

I need help, I have a complete chart of recordings, but I want to know if there is a customer in this table and replace the field of this customer, but I do not know how to do it.
I have the code like that.

while ($clid=$sqlc->fetch_assoc()) {
  if (!in_array($clid("cliente"), $arrayName)) {
   $datos = array(Cliente => $clid("cliente"), Nombre => $clid("nombre"),
   Jan => $val, Feb => $val,Mar => $val,
   Apr => $val,May => $val, Jun => $val, Jul => $val,
   Aug => $val,Sep => $val,Oct => $val,
   Nov => $val, Dec => $val);

   array_push($arrayName, $datos);


How can I do this so that in the rest I ask the customer to search and replace a value from January to December