Replace or Update a Table Row – based on the presence of a matching row item

Unfortunately I know next to nothing about php coding that contains some sql code. The examples I have seen online do not seem to match the same syntax that I inherited with this code, which is making this task confusing for me.

I have a database table called "effort" that contains two columns:

Column 1 = ad  Column 2 = theEffort 


 This line of code below works, and it will populate the table with the proper values for both the "ad" and "theEffort" 

$  sql = "INSERT INTO effort SET ad='$  ad', theEffort='$  theEffort'"; 


 But I do not want the table to grow over time and contain redundant rows pertaining to the same ad. Each "ad" in this table should be unique. But each "ad" could have 5 different effort values, e.g., "theEffort" can be "easy", "medium", "difficult", "impossible".

The "ad" is 13 digit number, i.e. SFAD_000001234

Does anybody know how to modify my code above using similar syntax so that it would first check to see if the "ad" exists in the database table called "effort". And if so, instead of entering a new row it would update "theEffort" to the new value. And if the "ad" did not exist in any table row within the "effort" database then it would execute the INSERT INTO function, i.e., insert both the "ad" and "theEffort" as a new table row.

Thank you in advance, -Jeff

select partially matching filenames

I have two lists of files with slightly different naming conventions

files1 = {"DTideal_circ_def=000um_astX=000um_astY=410um.png","DTideal_circ_def=050um_defX=000um_defY=010um.png"}  files2={"DT120_blur7_Defoc=000um_AstigX=000um_AstigY=410um.png", "DT120_blur7_Defoc=000um_AstigX=460um_AstigY=310um.png", "DT120_blur7_Defoc=000um_AstigX=460um_AstigY=360um.png", "DT120_blur7_Defoc=000um_AstigX=460um_AstigY=410um.png", "DT120_blur7_Defoc=000um_AstigX=460um_AstigY=460um.png", "DT120_blur7_Defoc=050um_AstigX=000um_AstigY=010um.png", "DT120_blur7_Defoc=050um_AstigX=000um_AstigY=060um.png", "DT120_blur7_Defoc=050um_AstigX=000um_AstigY=110um.png", "DT120_blur7_Defoc=050um_AstigX=000um_AstigY=160um.png", "DT120_blur7_Defoc=050um_AstigX=000um_AstigY=210um.png", "DT120_blur7_Defoc=050um_AstigX=000um_AstigY=260um.png"} 

I need to create pairs of files the paremeters of which are matching, i.e. to get

{{"DTideal_circ_def=000um_astX=000um_astY=410um.png","DT120_blur7_Defoc=000um_AstigX=000um_AstigY=410um.png"}, {"DTideal_circ_def=050um_defX=000um_defY=010um.png","DT120_blur7_Defoc=050um_AstigX=000um_AstigY=010um.png"}} 

Matching TWF to GWF DPR output with magic item

I’m new to D&D. I currently have one character built: a human fighter. I’ve given him the Two-Weapon Fighting (TWF) fighting style, as it sits nicely with his character. I’m currently at Level 3, and intend to take the Dual Wielder feat at Level 4.

I note that past Level 5, TWF starts to fall behind the Great Weapon Fighting (GWF) fighting style for damage output per round. This doesn’t bother me too much but I’d like to keep up with the rest of my group. I have just been granted a wish by drawing the wish card from the Deck of Many Things, and I would like to use it to bridge the gap between the two styles regarding DPR.

I’m thinking of wishing for a pair of magic longswords with a damage modifier that increases per level. I ran over the idea with the DM and he agrees it’s a reasonable wish, as I’d like to continue with the character. I am really interested in knowing how I could make this modifier match the DPR from GWF, and I don’t want to create anything that will be overpowered in the early stages or underpowered further down the line.

Matching several indexes

I have a large set of data in which I need to compare several samples in different tests and under varying conditions. I am looking for a way to pair and analyze these easily. As an example, lets say I have Samples (S) a, b, and c, which undergo tests (T) 1 and 2, under conditions (C) x, y and z, which output results (R) R1 and R2.

S   T   C   R1  R2 a   1   x   2.9 a   1   y   2.6 a   1   z   8.7 a   2   x   9.4 0.372 a   2   y   8.1 0.208 a   2   z   7.6 0.154 b   1   x   7.5 b   1   y   7.3 b   1   z   1.7 b   2   x   3.9 0.213 b   2   y   7.9 0.435 b   2   z   2.5 0.294 c   1   x   6.2 c   1   y   1.8 c   1   z   6.3 c   2   x   1.5 0.246 c   2   y   6.0 0.496 c   2   z   1.7 0.167 

The tests have different outputs, and I need to apply specific functions depending on the test. Such as:

Test1[a,b] = R1a/R1b Test2[a,b] = R1a/R2a - R1b/R2b 

The tests should only be applied to samples with matching conditions, but each sample should be paired. So a result would be:

S1  S2  T   C   R a   b   1   x   2.9/7.5 a   c   1   x   2.9/6.2 a   b   2   x   9.4/0.372-3.9/0.213 a   c   2   x   9.4/0.372-1.5/0.246 a   b   1   y   2.6/7.3 ... 

I’ve been trying to get this right for a while and just end up confusing myself. Anyone have a solution or suggestions? If you want an easily copyable format of the example:

{{S,T,C,R1,R2},{a,1,x,2.9},{a,1,y,2.6},{a,1,z,8.7},{a,2,x,9.4,0.372},{a,2,y,8.1,0.208},{a,2,z,7.6,0.154},{b,1,x,7.5},{b,1,y,7.3},{b,1,z,1.7},{b,2,x,3.9,0.213},{b,2,y,7.9,0.435},{b,2,z,2.5,0.294},{c,1,x,6.2},{c,1,y,1.8},{c,1,z,6.3},{c,2,x,1.5,0.246},{c,2,y,6.,0.496},{c,2,z,1.7,0.167}}

Must I two-weapon fight with different weapon types or can they be matching?

I think I’m clear on two-weapon fighting (thanks to Two-Weapon Fighting & Bonus Action in 5e) except for one thing. The PHB says (p. 195):

When you take the Attack action and attack with a light melee weapon that you’re holding in one hand, you can use a bonus action to attack with a different light melee weapon that you’re holding in the other hand. [emphasis mine]

Does a “different” weapon mean a different type of weapon, or just a different physical instance of a weapon? In other words, can I fight with two shortswords (one in each hand), or would I have to use a dagger or some other type of light weapon in my off hand?

No route was found matching the URL and request method. I don’t understand where the problem is

When I send parameters, I get this: No route was found matching the URL and request method.

/**   * Add json data on plugin.  *   * */ add_action('rest_api_init', 'register_api_hooks'); function register_api_hooks() {   register_rest_route(     'passwordless_register/v0', '/register/(?P<name>[a-zA-Z0-9-]+)/(?P<email>[a-zA-Z0-9-]+)/?aam-jwt=(?P<token>[a-zA-Z0-9-]+)',     array(       'methods'  => 'POST',       'callback' => 'wc_rest_user_endpoint_handler',     )   ); }  /**  * Register a new user  *  * @param  WP_REST_Request $  request Full details about the request.  * @return array $  args.  **/ function wc_rest_user_endpoint_handler($  request) {   $  request = new WP_REST_Request( 'POST', 'passwordless_register/v0/register/(?P<name>[a-zA-Z0-9-]+)/(?P<email>[a-zA-Z0-9-]+)/?aam-jwt=(?P<token>[a-zA-Z0-9-]+)' );   $  username = $  request['name'];   $  email = $  request['email'];   $  response = array();   $  error = new WP_Error();   if (empty($  username)) {     $  error->add(400, __("name field 'username' is required.", 'wp-rest-user'), array('status' => 400));     return $  error;   }   if (empty($  email)) {     $  error->add(401, __("Email field 'email' is required.", 'wp-rest-user'), array('status' => 400));     return $  error;   }   $  user_id = username_exists($  username);   if (!$  user_id && email_exists($  email) == false) {       $  password = wp_generate_password( 20, false );     $  user_id = wp_create_user($  username, $  password, $  email);     if (!is_wp_error($  user_id)) {       // Ger User Meta Data (Sensitive, Password included. DO NOT pass to front end.)       $  user = get_user_by('id', $  user_id);       // $  user->set_role($  role);       $  user->set_role('subscriber');       // WooCommerce specific code       if (class_exists('WooCommerce')) {         $  user->set_role('customer');       }       // Ger User Data (Non-Sensitive, Pass to front end.)       wp_nonce_field( 'wpa_passwordless_login_request', 'nonce', false );       $  unique_url = wpa_generate_url( $  email , $  nonce );       $  response['code'] = 200;       $  response['message'] = __("User '" . $  username . "' Registration was Successful", "wp-rest-user");       $  response['mail'] = __("Mail '" . $  email . "' Registration was Successful", "wp-rest-email");       $  response['password'] =  __("Pass '" . $  password . "' Registration was Successful", "wp-rest-pass");       $  response['url'] =  __("Link '" . $  unique_url . "' Registration was Successful", "wp-rest-url");     } else {       return $  user_id;     }   } else {     $  error->add(406, __("Email already exists, please try 'Reset Password'", 'wp-rest-user'), array('status' => 400));     return $  error;   }   return new WP_REST_Response($  response, 123);           } add_action( 'after_setup_theme', 'passwordless_register/v0' ); 

SSL not working fine, Home url not matching with site url wordpress errors

I deployed WordPress through Bitnami so after adding an SSL certification I started getting warnings from my WordPress dashboard of my site URL not matching with Home URL I was directed to my WordPress settings To reset back to https://www.healthviewonfraweb.xyz instead of http but I saw that I could not do that on the my settings, I had to login my Myphpadmin to do it there but WP-OPTION still has the correct URL which is https://www.healthviewonfraweb.xyz but still not reflecting on my WordPress

My problem now is why is the URL on my WordPress General settings is http://www.healthviewonfraweb.xyz/ instead of https://www.healthviewonfraweb.xyz and still cannot be changed from there or why is the site URL on my wp-option not same with the one on my WordPress General settings.

Thank you

Combinatorial Problem similar in nature to a special version of max weighted matching problem

I have a problem and want to know if there is any combinatorial optimization that is similar in nature to this problem or how to solve this special version of the max weight matching problem.

I have a general graph $ G(\mathcal{V},\mathcal{E},\mathcal{W})$ . I want to find a maximum weight matching of the graph $ G$ that must cover a certain subset of vertices and has a specific size. For example, if I have a graph with eight vertices, I want to find a max weighted matching that must cover the subset of vertices $ \mathcal{V}’=\{1,2,3\}$ and the size of the matching is $ \lceil{|\mathcal{V}’|/2}\rceil$ . So one more vertex needs to be chosen that maximizes the weighted matching. How to find the optimal solution in polynomial time if possible?

Why Burrow’s Wheeler Matching (FM-Index) is favored for DNA read matching

I noticed that FM-indexing is a preferred way to match strings in large data sets, and in particular DNA sequencing wiki-article. I know that with this method, it can eliminate space dependencies thanks to compression methods. However, alternatives like Knuth-Morris-Pratt Algorithm or Rabin-karp are highly effective in terms of extra space complexity with $ O(|Pattern| + 1)$ and $ O(1)$ respectively. These, are the complexity that would take if I were to code them so there might be better ways.

Overall, Burrows-Wheeler transform doesn’t do all that much both in terms of time and space. So why is it favored? My current assumption is that it can be modified to do approximate pattern matching. Does that imply Rabin-karp or KMP cannot be modified to efficiently calculate approximate matches?