categories – How to modify the output of wp_terms_checklist when used within the built-in category metabox on edit posts?

On the Edit Screen in the WP Admin there is a meta box for WP’s built-in Category taxonomy. This meta box is built using post_categories_meta_box() (/wp-admin/includes/meta-boxes.php).

This meta box uses wp_popular_terms_checklist( $tax_name ) and wp_terms_checklist( $tax_name ) to output the actual categories (with checkboxes) within the meta box.

wp_terms_checklist() (wp-admin/includes/template.php) uses the Walker_Category_Checklist (/wp-admin/includes/class-walker-category.checklist) to build the categories/checkboxes.

Walker_Category_Checklist inherits from Walker (wp-includes/class-wp-walker.php) just like a number of other WP walkers (Walker_Nav_Menu, Walker_Comment, Walker_Category, etc.).

When extending the Walker_Nav_Menu we can hook into the wp_edit_nav_menu_walker filter and return our custom walker. Is there a way to do this with Walker_Category_Checklist?

===

Update 1:

I see in wp_terms_checklist() there is:

apply_filters( 'wp_terms_checklist_args', $args, $post_id );

I’m thinking that I can hook into this filter, change the walker argument to a custom walker and that this may do the trick?

Modify Apache rewrite rule for Nginx

How to rewrite this Apache rewrite rule for Nginx?

  RewriteCond %{REQUEST_URI} ^/api
  RewriteRule (.*) index.php (L)

I tried this but it doesn’t work, I’m getting HTTP 404 in /var/log/nginx/access.log

location ^/api/(.*)${
rewrite ^/api/(.*)$ /index.php last;
}

unity – Passing properties as arguments such that the resulting class can modify the original

I’m really not experienced with c# so maybe my whole methodology is wrong but here goes.

I’m trying to build a GUI that allows many many parameters to be modified in real time and have a central repository for all those variables. So I am trying to build a wrapper class around the slider so I don’t have to explicitly link it to each property in the parameters class manually, and make it easier to add other generic functionalities like events or whatever.

So right now I have a UI class that holds the sliders, a slider wrapper class that holds some extra functionality, and a central parameters class. The central class shouldn’t have any dependencies of the other two classes.

The UI class instantiates the slider wrapper class, and passes a Unity slider object. That part works fine.
It also passes the property from the central parameter class to which it should be linked. That’s the part I’m stuck on.

UI class:

public class UIParams : MonoBehaviour
{
 
    private GeneralParams _centralParams;   // reference to central parameters class
    private Transform _mainUI;               // reference to main UI panel
    private Transform _panel1;               // reference to sub panel
 
    private MySlider _mySlider1;           // instance of my slider wrapper class
    // more sliders go here
   
    void Start()
   
    {
        //init
        _centralParams = GameObject.FindObjectOfType<GeneralParams>();
        var Panel1 = GameObject.Find("MainUI").transform.Find("Panel1");
 
       
       
        //sliders
        _mySlider1 = new MySlider(
            Panel1.Find("Slider1").GetComponent<Slider>(),  //pass the actual slider to the wrapper
            _centralParams.Parameter_1);                     //pass the central parameters property to the wrapper
       
       
        // more sliders go here
   
    }
 
}

Slider wrapper class:

Code (CSharp):
class MySlider
{
    private Slider _slider;                 // object to hold the slider
    private float _sliderValue;                   // value of the slider
 
    public MySlider(Slider Slider, float CentralParameterProperty)
    {
        _slider = Slider;                                                   // reference to Slider
        _slider.onValueChanged.AddListener(delegate { update();});      // listen for changes to slider, don't want to be checking all the time
        _sliderValue = CentralParameterProperty;                            // set slider to default value in CentralParams. How do I modify that value???
    }
 
    private void update()
    {
        _sliderValue = _slider.value;       // how do I change the original value from Central Params without explicitly linking each property manually?
    }
}

Central parameter class:

Code (CSharp):
public class CentralParams : MonoBehaviour
{
   
    public Action GeneralUpdateEvent;       // tell other classes when an update has occured
   
    (SerializeField)
    private float parameter_1;
    public float Parameter_1
    {
        get => parameter_1;
        set
        {
            parameter_1 = value;
            GeneralUpdate();
        }
    }
   
    // more parameters go here
   
 
    void GeneralUpdate()
    {
        GeneralUpdateEvent?.Invoke();
    }
}

Passing the float CentralParameterProperty into the MySlider instance works to set the default value of the slider. But obviously from that point onwards the slider only modifies the internal variable _sliderValue, not the property of the central class.

Can I set it up so I pass some object from the UI class into the MySlider on instantiation such that the MySlider instance can both get and set the values of the CentralParams property, without explicitly linking to central class within the MySlider class? Or is this just Wong?

Hope that made sense…

nginx – php-fpm “Cannot modify header information” error

I have two docker containers linked by a docker network. One is running nginxinc/nginx-unprivileged and the other is running php:fpm. I have linked them together so that the php:fpm container handles running the php, however when the php tried to update the page I get a header error (shown below).

I saw a suggestion to check the output_buffering parameter inside php.ini, however mine is already set to 4096.

Does anyone have any idea where I may be missing something here?

This is the error I receive in the web browser:

Array ( (fullname) => dsd (suggestion) => da )
Warning: Cannot modify header information - headers already sent by (output started at /usr/share/nginx/html/action.php:17) in /usr/share/nginx/html/action.php on line 33

Here are my dockerfiles:

nginx:

# Rootless Webserver Dockerfile

FROM nginxinc/nginx-unprivileged:1.19-alpine

USER root

# Create a group and user
RUN addgroup -S apache && adduser -S apache -G apache

RUN addgroup nginx www-data

RUN apk add php7 
    php7-fpm 
    php7-mysqlnd 
    nano

USER nginx
COPY webfiles/ /usr/share/nginx/html

USER root
COPY configfiles/nginx.conf     /etc/nginx/nginx.conf
# COPY configfiles/nginx2.conf     /etc/nginx//nginx2.conf
COPY configfiles/php.ini        /etc/php7/php.ini
COPY configfiles/www.conf       /etc/php7/php-fpm.d/www.conf
COPY configfiles/php-fpm.conf   /etc/php7/php-fpm.conf
# COPY configfiles/supervisord.conf /etc/supervisord.conf

# RUN rm -f /usr/share/nginx/html/index.html && 
#   chmod +x /docker-entrypoint.sh

RUN mkdir -p /usr/sbin/php-fpm

EXPOSE 8080

USER nginx

php:

FROM php:fpm

RUN mkdir -p /usr/share/nginx/html
RUN docker-php-ext-install mysqli

COPY index.php /usr/share/nginx/html/index.php
COPY action.php /usr/share/nginx/html/action.php

EXPOSE 9000

And here is my nginx.conf:

server {
        listen       8080 default_server;
        listen       (::):8080 default_server;
        index        index.php;
        server_name  web.cyber.test;
        root         /usr/share/nginx/html;

    error_log /var/log/nginx/error.log;

        # Load configuration files for the default server block.
        # include /etc/nginx/default.d/*.conf;

        location / {
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
        
    location ~ .php$ {
        try_files $uri =404;
        fastcgi_pass 203.0.113.100:9000;
        fastcgi_index index.php;
        # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$fastcgi_script_name;
        include fastcgi_params;
        }

Modify the ip address of a network adapter interface

ifconfig shows a Network Adapter – ens37. I want to modfiy it’s ip address to 192.168.26.1/24
I tried with ifconfig ens37 192.168.26.1 netmask 255.255.255.0 But that throws an error.
Any commands or ways to modify the ip/mask of a network adapter interface.
I am running fedora as a virtual machine on VMWARE.

powershell – How to modify the same attribute of multiple lists with exact schemas in Sharepoint online through coding or ms flow

I have several lists with the same exact schemas in SharePoint Online. How can I do the following?

1- How to add/remove a column to/from all of them?

2- How to add/remove an option to a choice/multichoice column?

I think there should be a way to accomplish this in C#/Python or through Powershell. I prefer coding as it makes life much easier and faster. MS flow is fine.

Please let me know if it would be better to break this question into two seprate questions.

algorithms – How to modify the following Dijkstra/ Uniform-cost search to return the result for all end points?

I know there is a lot of code out there that does this, but in particular, I’m trying to modify the following code to not just return the goal node/ one end point, but all endpoints. How do I go about it? I tried thinking of keeping a seen/visited set, but that seems redundant and kills the whole point of the reached map.

def best_first_search(problem, f):
    "Search nodes with minimum f(node) value first."
    node = Node(problem.initial)
    frontier = PriorityQueue((node), key=f)
    reached = {problem.initial: node}
    while frontier:
        node = frontier.pop()
        if problem.is_goal(node.state):
            return node
        for child in expand(problem, node):
            s = child.state
            if s not in reached or child.path_cost < reached(s).path_cost:
                reached(s) = child
                frontier.add(child)
    return failure

tethering – Modify TetheringConfiguration LEGACY_DHCP_DEFAULT_RANGE in ROM

I would like to modify the LEGACY_DHCP_DEFAULT_RANGE within Android Auto build android-11.0.0_r3, I am unable to locate the file that contains the array of IP Address in build android-9.0.0_r42 the array is in the TetheringConfiguration.java file:

  private static final String[] LEGACY_DHCP_DEFAULT_RANGE = {
    "192.168.42.2", "192.168.42.254", "192.168.43.2", "192.168.43.254",
    "192.168.44.2", "192.168.44.254", "192.168.45.2", "192.168.45.254",
    "192.168.46.2", "192.168.46.254", "192.168.47.2", "192.168.47.254",
    "192.168.48.2", "192.168.48.254", "192.168.49.2", "192.168.49.254",
};

Where is it located for build android-11.0.0_r3?
Any help is greatly appreciated.

magento2 – When I modify the js or html file, is there any way to not compile it?

Set developer mode

bin/magento deploy:mode:set developer

When developing, I make sure full_page cache is off. Usually, I also turn off block and layout cache too

bin/magento cache:disable full_page layout block_html

Usually you should see js or html changes immediately if those are off and developer mode set.

For css/less changes, you should remove static files. In developer mode, all these files are automatically recreated.

rm -rf pub/static/frontend/*

Run those commands from magento2 root folder. Note – do NOT delete pub/static/.htaccess file as it is necessary.