plugin development – How to do action just when checkbox field is checked in my checkout page?

I’m working in a custom function for my checkout page in woocommerce.
And I want to present an additional fee when my checkbox(woocm17) is checked, but i don’t know how to do it.
I have my code working, but it always adds the custom fee with no conditions.
My code is:

add_action( 'woocommerce_cart_totals_after_shipping' , 'cat_cart_count' );
add_action( 'woocommerce_review_order_after_shipping' , 'cat_cart_count' );
add_action( 'woocommerce_cart_calculate_fees','endo_handling_fee' );


function cat_cart_count( $cat_name ) {
    $cat_count = 0;    

    foreach(WC()->cart->get_cart() as $cart_item)  
        if( has_term( $cat_name, 'product_cat', $cart_item('product_id')))
            $cat_count += $cart_item('quantity');           
    return  $cat_count;
}
function endo_handling_fee() {
     global $woocommerce;
     if ( is_admin() && ! defined( 'DOING_AJAX' ) )
          return;
     $fee = 5.60 * cat_cart_count(223); ;
     $woocommerce->cart->add_fee( 'Servicio Enllantaje', $fee, false, 'standard' ); 
}


I’m starting with this kind language.
I hope one of you could help me to solve this 🙂

bitcoincore development – What is the motivation behind Russell Yanofsky’s work to separate Bitcoin Core into independent node, wallet and GUI processes?

There are benefits to both users and developers to having Bitcoin Core split into separate node, wallet and GUI processes.

As Alyssa Hertig outlines here the benefit to users will be being able to run the Bitcoin Core node on a different machine to the Bitcoin Core wallet rather than being forced to run them on the same machine. A user could leave a node running continuously in the background but start and stop the wallet and the GUI as needed. It also opens up the prospect of using a different (i.e. not the Bitcoin Core) GUI or wallet with the Bitcoin Core node.

For Bitcoin Core developers, Yanofsky highlights maintainability and security as the key advantages.

Process separation will make Bitcoin Core more easily maintainable as it defines interfaces at process boundaries. Different parts of the code can interact by calling each other instead of sharing state. This helps code review by making it easier to identify dependencies between parts of the code. Defining boundaries in the codebase will also make code review more scalable as reviewers will just need to understand part of the codebase well rather than needing to understand interdependencies across the whole codebase.

From a security perspective, the wallet and node code could run with different privileges and vulnerabilities should be harder to exploit given they will be limited to a single process. Inter-process communication (IPC) makes new debugging tools available such as the IPC_DEBUG environment variable to log all IPC calls.

There are some potential disadvantages that Yanofsky highlights. Inter-process communication is generally slower. IPC code can be tricky to write and may have bugs. Bad interfaces and unnecessary layers of abstraction can make it harder to implement new features. Features such as SPV (Simplified Payment Verification) that cross process boundaries will likely be more difficult to build.

Overall it seems clear the advantages outweigh the disadvantages. At the time of writing (August 2020) there are four remaining PRs to be reviewed and merged into Bitcoin Core and then Bitcoin Core should be multiprocess!

For more details on the process separation project see here.

plugin development – Enqueue script globally

I’m not aware of any other way but to use both add_action lines, for a single function.

Example:

function my_enqueue_sripts_function_name(){
    
    // your enqueue logic here
    
}
add_action('wp_enqueue_scripts',    'my_enqueue_sripts_function_name' );
add_action('admin_enqueue_scripts', 'my_enqueue_sripts_function_name' );

There’s no rule that forbids you from adding the same function on multiple hooks.

Furthermore, if you need to know which action called the function, from within the function, you can use current_action() or current_filter()

TuchaKube: reliable Kubernetes clusters for software development and construction of high-load information systems | Proxies-free

TuchaKube: reliable Kubernetes clusters for software development and construction of high-load information systems

TuchaKube is a container infrastructure and CI/CD process automation service, based on Kubernetes clusters. The platform is suitable for developing software products and building high-loaded information systems.

The service provides automatic launch of processes such as building, compiling, testing, packaging, containerization, and publishing of applications in both test and production environments. Among the working features are collecting and storing statistical data, monitoring, clustering, horizontal scaling, and much more. And the main feature of the service is the automation of CI/CD processes with the help of Tucha DevOps engineers.

We invite you to test the features of TuchaKube! If you have a need and a real task, we are ready to do a pilot project for you and provide test resources for a period of up to 30 days.

To learn more about the platform, contact us, or send a request to order the service on the Tucha website: https://tucha.cloud/en/services/tuchakube.

 

3d – how can i separate a network function so i can run it each frame?. c++ game development

full disclosure: i am not a very experienced C++ developer so i think i am asking something basic.

i have this snippet of code that start my client:

{
    printf("nconnecting client (insecure)n");

    double time = 100.0;
    const double deltaTime = 0.01f;
    ClientServerConfig config;

    uint64_t clientId = 0;
    random_bytes((uint8_t*)&clientId, 8);
    printf("client id is %.16" PRIx64 "n", clientId);

    ClientServerConfig config;

    Client client(GetDefaultAllocator(), Address("0.0.0.0"), config, adapter, time);
    Address serverAddress("127.0.0.1", ServerPort);

    if (argc == 2)
    {
        Address commandLineAddress(argv);
        if (commandLineAddress.IsValid())
        {
            if (commandLineAddress.GetPort() == 0)
                commandLineAddress.SetPort(ServerPort);
            serverAddress = commandLineAddress;
        }
    }

    uint8_t privateKey(KeyBytes);
    memset(privateKey, 0, KeyBytes);

    client.InsecureConnect(privateKey, clientId, serverAddress);

    char addressString(256);
    client.GetAddress().ToString(addressString, sizeof(addressString));
    printf("client address is %sn", addressString);

    const double deltaTime = 0.01f;

    signal(SIGINT, interrupt_handler);

    while (!quit)
    {
        
        client.SendPackets();

        client.ReceivePackets();

        if (client.IsDisconnected())
            break;

        time += deltaTime;

        client.AdvanceTime(time);

        if (client.ConnectionFailed())
            break;

        yojimbo_sleep(deltaTime);
    }

    client.Disconnect();

    return 0;
}

but i need this part to be a separate function:

    while (!quit)
{
    
    client.SendPackets();

    client.ReceivePackets();

    if (client.IsDisconnected())
        break;

    time += deltaTime;

    client.AdvanceTime(time);

    if (client.ConnectionFailed())
        break;

    yojimbo_sleep(deltaTime);
}

because this is the actual function that keeps the client connected to the server.

my question is, how can i separate the main function that creates the actual client, and save it as a global value?

as you can see snippet 2 needs client but i cannot just copy or create client because i get the following errors:enter image description here
enter image description here

and here is how the class is made:
enter image description here

the thing is i need the separate the function so i can run it each frame but i don’t know how i can save client as a global value.

thanks in advance.

theme development – When I save changes for css and js in my WP localhost env windows 10 the changes don’t take effects immediately!

Hey guys I am developing a wp theme, and I am using for localhost server XAMPP and Wampserver.So anytime I save my changes specially for css and js it doesn’t take effects immediately! sometimes it can takes up to 24h for the changes to take effects, how can I solve this issue, it really slowdown my work???

campaign development – System for really large group one-shot?

Every year, my youth group pulls an all-nighter.

Given that we do these in church and at night, with a group of 15-20 people, I think this would be the perfect environment to do a group Murder Mystery campaign, where I’d introduce some sort of moral debate – for example, have an Angels & Demons sort of plot, with several religious members being killed, and, in your search for the killer, you have to look into their motivations and debate the sins of the church itself.

I have some experience with D&D but I really don’t know of any other formats, much less ones that would work with a group this big (in terms of logistics, it doesn’t make sense for people to have to create very complex characters or work with a lot of rules). I also like the idea of a LARP, because it would make more sense for the people who’ve never played any RPGs.

Does anyone have an idea of where I could start looking for something like this?

web development – Licencing java web application hosted on client machine

Currently I have the requirement to provide licencing for our web application that will be hosted on the client server,

The approach I thought about is as follows

When the user buys a licence we require his first-name, last-name, email, company name.

We generate a JSON representation of the imputed data, and encrypt it with a SHA-256 algorithm which will be the user key.

We insert the key, empty mac address, and expiration date to our centralized licence server.

The file with the uncrypted information(in JSON format) will be provided to the user.

At first start, if the key doesn’t have a mac address assigned we assign one, this way we will enforce the 1 machine per key usage.

At every start of the server we will encrypt the file contents to SHA-256 and send them to the centralized server with the MAC address of the client-machine.

What is your opinion on this approach ?

Is this solution suitable, or do I have to come with another strategy of implementation ?

Edit Woocommerce Pricing Formula – WordPress Development Stack Exchange

I need to edit the way woocommerce calculates the price on a client’s website. It’s a site that allows customers to purchase products on credit by choosing the number of months they wish to make payment. However, in the cart, if the customer selects 2 or more of the quantity of the product they wish to purchase, the total amount of the products appears in the “Price” column of the cart instead of the unit price of that product. I would like to edit it such that the unit price shows in the price column no matter the quantity selected and then the total amount can then show in the total and subtotal columns. I have tried editing the woocommerce cart file and a couple of others but nothing seems to work. This is the site: www.appliancepointgh.com
Any help on how i can do this would be deeply appreciated.

themes – .htaccess edits – WordPress Development Stack Exchange

WordPress newbie here, apologies if things don’t make sense.

I bought a premium theme and uploaded/installed it to WordPress. Surely enough, after doing so, I found out that I was supposed to add the following values to .htaccess:

php_value post_max_size 64M
php_value upload_max_filesize 64M
php_value max_file_uploads 128M
php_value max_input_vars 5000

The authors are very adamant to do this BEFORE installing and activating the theme, but that’s already too late in my case.

What’s the appropriate course of action here, deactivate and delete the theme in question in order to add those lines to .htaccess?