List just subcategory and products of active category page in Woocommerce

Working on a category page – taxonomy-product_cat.php – I want to list all the subcategories of that category page, with all its products. I would think it is simple enough but I cant get it to work.

I can list all categories of the shop with all subcategories and all products – So for example bags would list all products of the whole shop.

Or I can list the subcategories of just the category page – but without the products listed.

How can I list just the subcategories of the category page with their products?

The code I am using that works great, but loops all the categories in the shop, and not just the active category is:

$  args = array('taxonomy' => 'product_cat' ); $  all_categories = get_categories( $  args );  foreach ($  all_categories as $  cat) {     $  category_id = $  cat->term_id;     $  args2 = array('taxonomy' => $  taxonomy,'parent' => $  category_id,'hierarchical' => $  hierarchical, 'orderby' => $  orderby, 'order' => $  order,'hide_empty' => $  empty); $  categories = get_categories( $  args2 );   $  sub_cats = get_categories( $  args2 );             if($  sub_cats) {                 foreach($  sub_cats as $  sub_category) {                     echo "<h2>".$  sub_category->cat_name."</h2>";                      $  args = array( 'post_type' => 'product','product_cat' => $  sub_category->slug, 'orderby' => $  orderby, 'order' => $  order);                             $  loop = new WP_Query( $  args );                                while ( $  loop->have_posts() ) : $  loop->the_post(); global $  product; ?>                               <!--HTML HERE-->                               <?php endwhile;  wp_reset_query();  }}} ?> 

Is it possible to calculate the longest increasing subsequence of an unsorted list

The problem goes like this:

Instance: List with indices and values

Question: Is it possible to calculate the LIS by always taking the next element from the left (without sorting the indices of the instance)?


Index array:…………1 2 3 4 5 6

Indices instance:….1 3 5 2 4 6

Values instance:…..2 4 6 1 3 5

The longest increasing subsequences would now be:

245 246 235 236

145 146 135 136

Does a Pact of the Blade Warlock have their weapon proficiency list increased while their Pact weapon is active?

According to the Warlock class, the Pact of the Blade Boon allows a Warlock to

use your action to create a pact weapon in your empty hand. You can choose the form that this melee weapon takes each time you create it. You are proficient with it while you wield it.

Ordinarily, this would be very simple and straight forward. However, two weapon fighting makes thing interesting. The Players Handbook says

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.

With the goal of using the two weapon fighting rule above, let’s use a short sword as an example. Short swords are martial melee weapons with the light and finesse properties. As such, they can be used for two weapon fighting and Warlocks are not proficient with them.

Now, perhaps I’m over-complicating things a bit…but it seems to me that there are two ways of reading that last sentence in the Pact of the Blade quote from above.

It could mean that because the Warlock has created a short sword as their Pact weapon, that they are proficient with all short swords while they have their Pact weapon in hand. This would, in effect, temporarily add short swords to their weapon proficiency list and allow the Warlock to make a proficient short sword bonus action attack from two weapon fighting.


It could mean that the warlock ONLY has proficiency with their Pact weapon, and if they wanted to make a proficient bonus action attack, they’d have to use a simple weapon in their off-hand.

So, does a Pact of the Blade Warlock have their weapon proficiency list increased while their Pact weapon is active?

Is there an updated (non-Nmap) top 100 or top 1000 common ports list?

I know Nmap has nmap-services file which gives us the list of top 1000 ports/services found on the Internet. But this list seems to be outdated, as the Nmap top 1000 list doesn’t include several services used now-a-days (like 27017/mongoDB, 6379/redis, 11211/memcached, etc). Is there any source other than Nmap, which can provide the updated list of top 1000 common ports/services used in the Internet?