How do I make my terms for each product display via foreach loop? (woocommerce)

This is my current loop to display my products via woocommerce. When I do print_r($ category_array); It returns the array, but when I try to use a function to call it so I can do what I want to with the data, it makes and my entire screen doesn’t display after the loop. Maybe it’s a mistake in my function? Still very new to woocommerce and wp_loops. Thank you

            <?php             // WP_Query arguments             $  args = array(                 'p'                      => 'product',                 'post_type'              => array( 'product' ),                 'order'                  => 'ASC',                 'post_per_page' => 20,             );              // The Query             $  query = new WP_Query( $  args );              // The Loop             if ( $  query->have_posts() ) {                 while ( $  query->have_posts() ) {                     $  query->the_post();                     function filter_categories($  categories) {                             foreach ($  categories as $  category) {                                 echo $  category->name;                             }                     }                       ?>                     <div class="row">                         <div class="col-2">                             <?php echo the_post_thumbnail(get_the_ID(), 'thumbnail'); ?>                         </div>                         <div class="col-7">                             <a href="<?= get_permalink(); ?>"><?= the_title()?></a>                             <br/>                             <?php                             $  category_array = get_the_terms(get_the_ID(), 'product_cat');                             filter_categories($  category_array);                             ?>                         </div>                         <div class="col-3 text-right ">Price</div>                     </div>                     <?php                 }             } else {                 // no posts found             }              // Restore original Post Data             wp_reset_postdata();             ?> 

What does “(any sword)” mean in terms of Magic Items?

In the Dungeon Master’s Guide section for Magic Items (Chapter 7), a lot of items have a requirement that says (any ___), specifically weapons and maybe armor if I remember correctly. For example, Flame Tongue says: “Weapon (any sword)”. Is this just to classify what the Item can be, or can you use another Magic Item in this place? Personally, I think a Vicious, Flame Tongue, Dragon Slayer, Vorpal Sword would be dope, but I’m not sure if that would work.

Is it poor practice to host multiple web applications on the same domain, in terms of cookies?

In my web application, I have a single API backend and two frontends written as single page applications. To simplify deployment, I’d like to serve the API on /api, the admin dashboard on /admin, and the end user frontend on /user (or something similar), all on the same domain.

I want to use cookies for handling sessions, for both the end-user and admin apps. Is this a good idea? As I understand it, cookie usage is restricted by their domain. Would it make it simpler for an attacker to steal admin-session cookies from someone logged into both frontends? Or, should I use different domains for the admin and user frontends (admin.mydomain.com and user.mydomain.com)?

Can’t display multiple terms with get_the_terms

I am trying to display the terms (from a custom taxonomy) of a single post, but I can’t display more than one term. When I try to display all the terms using a foreach loop, it doesn’t display anything.

Here is one of my attempts :

<?php   $  terms = get_the_terms($  post->ID, 'auteur');  if ($  terms && !is_wp_error($  terms)) {     foreach($  terms as $  term) {         echo $  term->name ;     } }           ?> 

It doesn’t display anything. But the same code without foreach loop displays (as expected) one term :

<?php   $  terms = get_the_terms($  post->ID, 'auteur');     echo $  term->name ;      ?> 

I imagine that I’m missing an evident mistake (I’m a beginner), but I can’t understand what is wrong with the foreach loop…

Thank you !

Terms for different models of sum types

There seem to be at least a couple different possible ways of modeling sum types in a type system, but I haven’t been able to find consistent terms for referring to them:

  1. A sum type is formed from a set of "data constructors", which are function-like entities that notionally map values of a summand type to values of the sum type. This is the model adopted by e.g. Haskell and the various flavors of ML.

  2. A sum type is formed directly from the underlying summand types, with no data constructors, and as a consequence the sum type is a supertype of the summands (or at least behaves very much like one). This model seems to be much less common, but it’s the model adopted by Ceylon, and by C++’s std::variant.

Note that this is separate from the distinction between discriminated and non-discriminated unions: both models permit the sum type to be discriminated (although only if the summands are disjoint, in the case of #2).

Are there settled terms for distinguishing these two models?

Is there a difference between “one round” and “until the end of your turn” in terms of duration?

I’m mainly concerned about the effects that last “one round” and “until the end of turn” (like Stone Bones ToB p.84 and Inferno Blade ToB p. 54, respectively). My guess is that “until end of turn” effects end after you’ve taken your “standard” actions (one swift action, one move action, one standard action, or whatever the duration equivalent would be, like a full-round action), so the reactions you take on that round are not affected by that effect. On the contrary “one round” effects would be in effect until it’s that PC’s turn again.

However, my DM insists that both effects would last until that PC’s turn comes again, having no distinction, even if it has different wording. So, really, what’s a round and what’s a turn in this case? Are they the same?

Asymptotic of divide-and-conquer type recurrence with non-constant weight repartition between subproblems and lower order fudge terms

While trying to analyse the runtime of an algorithm, I arrive to a recurrence of the following type :

$ $ \begin{cases} T(n) = \Theta(1), & \text{for small enough $ n$ ;}\ T(n) \leq T(a_n n + h(n)) + T((1-a_n)n+h(n)) + f(n), & \text{for larger $ n$ .} \end{cases}$ $ Where:

  • $ a_n$ is unknown and can depend on $ n$ but is bounded by two constants $ 0<c_1\leq a_n \leq c_2 < 1$ .
  • $ h(n)$ is some “fudge term” which is negligeable compared to $ n$ (say $ O(n^\epsilon)$ for $ 0\leq \epsilon < 1$ ).

If $ a_n$ was a constant, then I could use the Akra-Bazzi method to get a result. On the other hand, if the fudge term didn’t exist, then some type of recursion-tree analysis would be straight-forward.

To make things a bit more concrete, here is the recurrence I want to get the asymptotic growth of:

$ $ \begin{cases} T(n) = 1, & \text{for n = 1;}\ T(n) \leq T(a_n n + \sqrt n) + T((1-a_n)n+\sqrt n) + n, & \text{for $ n \geq 2$ } \end{cases}$ $ Where $ \frac{1}{4} \leq a_n \leq \frac{3}{4}$ for all $ n\geq 1$ .

I tried various guesses on upper bounds or transformations. Everything tells me this should work out to $ O(n\log(n))$ and I can argue informaly that it does (although I might be wrong). But I can only prove $ O(n^{1+\epsilon})$ (for any $ \epsilon>0$ ), and this feels like something that some generalization of the Master theorem à la Akra-Bazzi should be able to take care of.

Any suggestions on how to tackle this type of recurrence?

Please explain me this question in very simple terms

Consider the following snapshot of a system running n processes. Process i is holding Xi instances of a resource R, 1 <= i <= n. currently, all instances of R are occupied. Further, for all i, process i has placed a request for an additional Yi instance while holding the Xi instances it already has. There are exactly two processes p and q such that Yp = Yq = 0. Which one of the following can serve as a necessary condition to guarantee that the system is not approaching a deadlock? (A) min (Xp, Xq) < max (Yk) where k != p and k != q (B) Xp + Xq >= min (Yk) where k != p and k != q (C) max (Xp, Xq) > 1 (D) min (Xp, Xq) > 1