What mechanic would be used for taking an opponents weapon from it’s sheath on his belt in combat?

Here is the scenario.

I am attacking a fighter with a crossbow. I run out of bolts and am unnamed as he charges at me with a spear. My opponent has a short sword on his belt. He misses with his initial spear attack and its my turn.

I want to take his sword from it’s sheath and if possible attack him with it. What process or series of checks need to be made for this to work?

Mass update all cells in a column with a substring of it’s original value

I need to trim the last seven characters off of all the cells in a column.

This query returns the results that I need

SELECT test_date, SUBSTRING(test_date FROM 1 FOR CHAR_LENGTH(test_date) - 7) as test from results; 

I now need to take the computed result from the substring and replace the original values.

Here’s what the data looks like, if it helps.

Data Table

Do you include the constitution modifier to your starting HP if it’s negative?

When I was creating my Bard with a standard array, I considered making constitution my lowest.

I know that starting HP = the highest number of your class’ hit dice + CON mod (so 8 + CON for a Bard)

But I’m wondering if that formula still applies if the modifier is negative. My friend says it doesn’t, and I’ve tried looking it up, but all I get is if it affects your HP leveling up, not your staring HP

How to explode single string IF it’s used in shortcode

I have a shortcode that works to display posts from specific categories, or a single post based on the post slug. I’m having trouble figuring out how to get it to display multiple posts based on their slugs though. I know I need to use explode, but I can’t seem to get it right.

Here’s the current working code:

add_shortcode( 'latest_post', 'latest_post_query_shortcode' ); function latest_post_query_shortcode(  $  atts ) {     ob_start();     $  atts = shortcode_atts( array(             'posts_per_page' => '',             'category' => '',             'offset' => '',             'post' => '',     ), $  atts );      $  args = array(             'post_type'     => 'post',             'post_status'   => 'publish',             'posts_per_page'=> $  atts['posts_per_page'],             'offset'             => $  atts['offset'],         );              // Add category if not empty     if ( ! empty ( $  atts['category'] ) ) {         $  args['tax_query']  = array(                  array(                     'taxonomy'  => 'category',                     'field'     => 'slug',                     'terms' => $  atts['category'],                 ),              );           }          // Add post if not empty     if ( ! empty ( $  atts['post'] ) ) {         $  args['name']  = $  atts['post'];     }         $  string = '';              // The Query     $  query = new WP_Query( $  args );       // The Loop     if ( $  query->have_posts() ) { ?>         <section class="recent-posts clear">         <?php while ( $  query->have_posts() ) : $  query->the_post() ; ?>             <article id="post-<?php the_ID(); ?>" <?php post_class( 'left' ); ?>>                  <?  echo '<a href="' . get_permalink( $  _post->ID ) . '" title="' . esc_attr( $  _post->post_title ) . '">';                     echo get_the_post_thumbnail( $  _post->ID, 'large' );                     echo '</a>';                     echo '<h2><a href="' . get_permalink( $  _post->ID ) . '" title="' . esc_attr( $  _post->post_title ) . '">';                     echo get_the_title( $  _post->ID);                     echo '</a></h2>';                  ?>             </article>         <?php endwhile;          wp_reset_postdata();?>           </section>                   <?php          $  clean = ob_get_clean();         return $  clean;           } } 

I tried adding:

'name' => explode( ', ', $  post), 


$  args = array( 

but that didn’t return anything when I tried specifying two slugs, for example: [latest_post post="almond-cake, coconut-pie"] (If I use either one of those, it works, but not both.)

Additionally once I added the explode, it game me this warning everywhere else the shortcode was used:

Warning: trim() expects parameter 1 to be string, array given…

Is this the correct “standard form” of nonlinear programming (optimization) problem and if it is why it’s in this form?

Rather a simple question I guess, though makes me wonder. The standard form I’ve found in the book (and on wiki) is something like this:

$ min f(x)$

$ s.t.$

$ h_i(x) = 0$

$ g_i(x) <= 0$

Is this considered a “standard form” for nonlinear optimization problems? And if it is why it’s defined like this? Why it has to be exactly the min of the function and why constraints have to be either equal or less than 0 or equal to 0? I couldn’t find any answer why it is as it is actually. Is there some important thing why it couldn’t be max actually for example?

How do I code access to the built-in UI of a CPT when it’s placed as submenu of another CPT that is protected by role?

I am toying around with WordPress capabilities, and having some difficulty understanding where I am going wrong. Right now, I have an admin menu that appears for all administrators with STUDENTS as a submenu of SCHOOL: each of those link to http://example.com/wp-admin/edit.php?post_type=student. (When the user is in the HEADMASTER role, the link to the built-in UI for TEACHER appears and SCHOOL mimics its link). So far, all is well.

The bump in the road is when a non-HEADMASTER administrator clicks either SCHOOL or STUDENTS, the error “Sorry, you are not allowed to access this page” appears. (As expected, when that same admin accesses http://example.com/wp-admin/edit.php?post_type=teacher, the errors “You need a higher level of permission” and “Sorry, you are not allowed to edit posts in this post type” appear.) The issue is that the STUDENTS built-in UI is not accessible to all administrators. (As expected, there are no problems for HEADMASTERs.) How can this be resolved in such a way as to give all site admins access to STUDENTS and only HEADMASTERs access to TEACHERS while at the same time preserving the layout and functionality of the admin menu and built-in UI?

What I’ve Tried: When the 'show_in_menu' => 'edit.php?post_type=teacher' line is removed from the STUDENTS CPT, everything works as expected but STUDENTS becomes a top-level menu item instead of SCHOOL. I tried putting TEACHERS as a sub-menu item as STUDENTS, but SCHOOL does not change its link when the user is in the HEADMASTER role (also the ordering of TEACHERS and STUDENTS is backwards). I also tried add_menu_page() for SCHOOL and adding the slug returned for the show_in_menu argument of the TEACHERS and STUDENTS register_post_type args, respectively, but that didn’t work because it created a page instead of forwarding to the appropriate built-in UI.

 class School {     public static function init() {         add_action('init', array(__CLASS__, 'register_cpt'));         add_action('init', array(__CLASS__, 'add_role'));         add_action('admin_menu', array(__CLASS__, 'modify_menu'));     }      public static function register_cpt() {         register_post_type('teacher', array(             'labels' => array(                 'name'          => __('TEACHER'),                 'all_items'     => __('TEACHERS'),                 'menu_name'     => __('SCHOOL'),             ),             'show_ui'           => TRUE,             'capability_type'   => 'educator',             'map_meta_cap'      => TRUE,         ));         register_post_type('student', array(             'labels' => array(                 'name'          => __('STUDENT'),                 'menu_name'     => __('STUDENTS'),             ),             'show_ui'           => TRUE,             'show_in_menu'      => 'edit.php?post_type=teacher',         ));     }      public static function add_role() {         if(get_role('headmaster') === NULL) {             $  caps = array();             foreach(get_role('administrator')->capabilities as $  cap => $  tmp) {                 $  pos = strpos($  cap, 'post');                 if($  pos !== FALSE) {                     $  cap = str_replace('post', 'educator', $  cap);                     $  caps[$  cap] = TRUE;                 }             }             add_role('headmaster', 'HEADMASTER', $  caps);         }     }      public static function modify_menu() {         global $  submenu;         unset($  submenu['edit.php?post_type=teacher'][10]);     } } School::init(); 

Windows wants to install an old version even though i have the latest one, already downloaded it just needs restart, how do i know if it’s safe?

Here is the screenshot of my updates history/status.


Here in this dropbox picture there are 2 comments with all the info.