Comments on “Which combinatorial problem is similar to this problem?”

Regarding the post Which combinatorial problem is similar to this problem?, it is quite hard to believe that, in the absence of information on the cost function, there is no algorithm better than exhaustive search to tackle this apparently easy-to-understand problem. I surfed the Internet and found something called the Weighted Constraint Satisfaction Problem, and I wonder whether this can be of any use in this case.

Any advise would be much appreciated.

WordPress Custom Avatar in comments

I have built my own frontend user avatar upload script. Now the avatars show fine in the user section in admin and in the top panel. However I can’t seem to get them showing in the comments and author sections of the site.

I use the following get_avatar code

add_filter ('get_avatar', function($  avatar_html, $  id_or_email, $  size, $  default, $  alt) { $  avatar = get_user_meta($  id_or_email,'avatar',true); if( $  avatar ) {     return '<img src="'.$  avatar.'" width="96" height="96" alt="Avatar" class="img-fluid rounded-circle" id="wad_profile_avatar" />'; } else {     return $  avatar_html; } 

}, 10, 5);

Any ideas how I can get it to show in comments also?

I am unable to understand the logic behind the code (I’ve added exact queries as comments in the code)

Our local ninja Naruto is learning to make shadow-clones of himself and is facing a dilemma. He only has a limited amount of energy (e) to spare that he must entirely distribute among all of his clones. Moreover, each clone requires at least a certain amount of energy to function (m) . Your job is to count the number of different ways he can create shadow clones. Example:

e=7;m=2

ans = 4

The following possibilities occur: Make 1 clone with 7 energy

Make 2 clones with 2, 5 energy

Make 2 clones with 3, 4 energy

Make 3 clones with 2, 2, 3 energy.

Note: <2, 5> is the same as <5, 2>. Make sure the ways are not counted multiple times because of different ordering.

Answer

int count(int n, int k){     if((n<k)||(k<1)) return 0;     else if ((n==k)||(k==1)) return 1;     else return count(n-1,k-1)+ count(n-k,k);   // logic behind this? }  int main() {     int e,m;            // e is total energy and m is min energy per clone     scanf("%d %d", &e, &m);     int max_clones= e/m;     int i,ans=0;     for(i=1;i<=max_clones;i++){         int available = e - ((m-1)*i);   // why is it (m-1)*i instead of m*i         ans += count(available, i);     }     return 0; } 

Multiple blog comments to 1 url

Hi,
I have a list of auto approve urls that have my link posted on it 1 time. And I would like to re-use the list to comment with the same links 1 more time.

But when i try and re-post the same link, i get the message “link already present”.

I checked the option, Options > Scheduled Posting >  “allow posting on same site again

But still no luck, has anyone got any ideas on how to enable this please?

Understanding lexical grammar for multi-line comments in JavaCC

I’m struggling to understand why this piece of lexical grammar works for multi-line comments in JavaCC (posted here):

 "/*" (~["*"])* "*" (~["*","/"] (~["*"])* "*" | "*")* "/" 

As I read it, the parser scans the input /*, and then zero or more optional occurrences of * can appear, followed by a *, and then zero or more optional occurrences of * and /, then zero or more occurrences of * followed by * or *, ended by a /. Specifically, this part boggles my mind:

 (~["*","/"] (~["*"])* "*" | "*")* 

I’d appreciate some help understanding this.

WP Comments with CSS Counters

I’d like to use CSS counters on WP comments, like this:

1 (first comment) 1.1 (reply 1) 1.2 (reply 2) 1.2.1 (first reply to 2) 1.2.2 (second reply to 2) 1.3 (reply 3)  2 (second comment) 2.1 (reply 1)... 

I’m struggling to understand how to set the counters, then reset the counters based on the nesting involved in WP comments. I’m using ::before to display the counters, which works fine…I just can’t get the numbering right. Can anybody help me understand the nesting, and how to do counters like 1.2.2?

Comments on my custom post type

I have a custom post type gig and added the supports Comments but it doesn’t show any comment input at all.

$  args = [     "label" => __( "Gigs", "understrap" ),     "labels" => $  labels,     "description" => "",     "public" => true,     "publicly_queryable" => true,     "show_ui" => true,     "delete_with_user" => false,     "show_in_rest" => true,     "rest_base" => "",     "rest_controller_class" => "WP_REST_Posts_Controller",     "has_archive" => false,     "show_in_menu" => true,     "show_in_nav_menus" => true,     "delete_with_user" => false,     "exclude_from_search" => false,     "capability_type" => "post",     "map_meta_cap" => true,     "hierarchical" => false,     "rewrite" => [ "slug" => "gig", "with_front" => true ],     "query_var" => true,     "supports" => [ "title", "editor", "thumbnail", "comments" ], ]; 

For testing purposes, I’ve only added the following php code in my template:

<?php     comments_template(); ?> 

This is the output:

<div class="comments-area" id="comments">  </div> 

Just an empty comments-area div.

What am I doing wrong over here? The comments work on the post type post.

Possible options of minimizing duplicate comments?

Are there any solutions that combine or group similar comments? Any plugins, 3rd parties or anything that takes community comments and compress what has been already said?

Barring that, what would it takes to create something that consolidate comments with the same messages (under youtube video or Reddit post, for example)?