Pre-Fix Order Numbers by User Role

I currently have orders set with the pre-fix "W" for Wholesale orders to differentiate them from Retail orders. However, we have a few different wholesale roles and I would like to be able to differentiate those orders with a pre-fix as well. Is there a way to code a special pre-fix based on user role? The role in particular would be for a wholesale role labeled as employee. Since Employee falls under the Wholesale Role, it is getting the W prefix to their orders. I would like all other wholesale orders to have the W prefix, Employee orders to have an E prefix, and all retail orders to have no prefix (remain as-is).

Here is the snippet that works for wholesale orders to have the W prefix:

add_filter( 'woocommerce_order_number', 'change_woocommerce_order_number' ); function change_woocommerce_order_number( $  order_id ) {       $  prefix = 'W'; //The Prefix      $  order_type = get_post_meta( $  order_id, '_wwpp_order_type',true); //get Wholesale Order Type           if ($  order_type == 'wholesale') {         $  new_order_id = $  prefix . $  order_id;         return $  new_order_id;     }           return $  order_id; } 

Getting Mathematica to solve a system of two second order nonlinear ordinary differential equations

I tried solving a system of two second order nonlinear ordinary differential equations using the DSolve command. First, I tried like this:

eqns = {A''[x] == 2/B[x]*A'[x]*B'[x],     B''[x] + 1/B[x]*(A'[x])^2 - 1/B[x]*(B'[x])^2 == 0}; sol = DSolve[eqns, {A, B}, x] 

However, as Mathematica didn’t (couldn’t?) solve this, I transformed it into a system of four first order equations:

eqns = {c'[x] == 2/B[x]*c[x]*d[x],     d'[x] + 1/B[x]*(c[x])^2 - 1/B[x]*(d[x])^2 == 0, c[x] == A'[x],     d[x] == B'[x], c[0] == 1, d[0] == 1, A[0] == 1, B[0] == 1}; sol = DSolve[eqns, {A, B, c, d}, x] 

This still doesn’t work. Weirdly enough, I don’t even get an error message.

I only included the boundary conditions thinking that they may be helpful, but they aren’t part of my original problem.

Your help would be greatly appreciated:)

Postgresql: sort by value position in array column, then by secondary order

I’m not quite sure what the best way to phrase this is…

So in my DB there is pillars text array which is basically an enum where providers ordered what values meant the most to their business, from most important to providing that value for their clients, to least important.

I’m using PostGIS to query providers in a specific area, and want to return providers ordered first by the pillar that a client selected they were looking for, then by closest location.

so if the pillars all have values ['a', 'b', 'c', 'd'], in any order depending on what providers selected, and the client selected pillar c

the results of the query would preferably return any/all providers that have pillar c at array index 0 first, ordered by distance to geopoint, then by providers that have pillar c at array index 1 second ordered by distance to client geopoint, then idx 2, then idx 3

I’m really only looking for the top 3 results in all cases, and providers with pillar c at idx 1 would only be needed if there were less than 3 results for index 0

Is this possible to pull off in a single query? or should I just run it with a where clause and check the results length until I have 3 results?

The pillars column is indexed with a gin index btw

Aura of the Guardian and Damage order of operations

The Oath of Redemption Paladin subclass gets the following feature at 7th level (XGtE, 39):

you can shield your allies from harm at the cost of your own health. When a creature within 10 feet of you takes damage, you can use your reaction to magically take that damage, instead of that creature taking it. This feature doesn’t transfer any other effects that might accompany the damage, and this damage can’t be reduced in any way.

It is clear that the Paladin cannot reduce the damage they take but it is unclear whether the damage the the initial target would have taken could be reduced. Is the rule that the damage cannot be reduced from its original damage roll or that it cannot be reduced from what the target would have taken?

For example:

Farla the fighter has the feat Heavy Armor Master which grants:

While you are wearing heavy armor, bludgeoning, piercing, and slashing damage that you take from nonmagical weapons is reduced by 3.

Farla is under the effect of Warding Bond which grants her resistance to all damage.

Farla is hit by a Storm Giant’s greatsword which rolls 30 damage.

Heavy Armor Master reduces this to 27 which is then reduced to 13 by resistance. Unfortunately Farla only has 10 hp remaining so Psi the Paladin uses Aura of the Guardian to take the damage instead.

How much damage does Psi take?

How does the timing of Order Domain’s Voice of Authority work?

The Order Domain cleric from Tasha’s Cauldron of Everything has the Voice of Authority feature. Part of that feature states:

If you cast a spell with a spell slot of 1st level or higher and target an ally with the spell, that ally can use their reaction immediately after the spell to make one weapon attack against a creature of your choice that you can see.

Immediately after the spell _____ ? Is cast? Targets the ally? Affects the ally? Ends?

For spells like healing word, the intent seems simple. The spell is instantaneous, so:

  1. You cast healing word, targeting your ally.
  2. Your ally is healed.
  3. You use Voice of Authority. Your ally uses their reaction to make an attack.

For spells like dawn, things get a little more complicated. For simplicity, I’ll assume that all creatures within the area count as targets. It seems like the initial cast of a duration spell would work like this:

  1. You cast dawn, which includes one ally in the area.
  2. Your ally rolls their save and takes damage.
  3. You use Voice of Authority. Your ally uses their reaction to make an attack.

But if you maintain concentration, the spell continues:

  1. Your ally (the same one as above) takes their normal turn in initiative.
  2. Your ally ends their turn.
  3. Your ally is still within dawn, so they are targeted/affected (?) by the spell again.
  4. Your ally rolls their save and takes damage.
  5. (?) You use Voice of Authority. Your ally uses their reaction to make an attack.

Voice of Authority restricts you to only one ally affected, but (potentially?) doesn’t restrict that one ally to more than one attack.

For some additional weirdness, allies could be targeted/affected only on subsequent turns:

  1. You cast dawn, which includes no allies in the area.
  2. Your ally takes their normal turn in initiative, during which they enter the area.
  3. Your ally ends their turn in the area.
  4. Your ally is targeted/affected (?) by the spell for the first time.
  5. Your ally rolls their save and takes damage.
  6. (?) You now use Voice of Authority. Your ally uses their reaction to make an attack.

My question is: how does the timing of Order Domain’s Voice of Authority work, particularly for area spells with a duration? I expect to be using this class feature at a table that sticks closely to RAW, so it would be helpful to know what the rules say precisely. If the rules are unclear or undesirable, then tested rulings are also welcome.

Does the optimized column order for a PostgreSQL table always have variable length types at the end?

There’s a popular and seemingly authoritative blog post called On Rocks and Sand on how to optimize PostgreSQL tables for size to eliminate internal padding by re-ordering their column length. They explain how variable-length types incur some extra padding if they’re not at the end of the table:

This means we can chain variable length columns all day long without introducing padding except at the right boundary. Consequently, we can deduce that variable length columns introduce no bloat so long as they’re at the end of a column listing.

And at the end of the post, to summarize:

Sort the columns by their type length as defined in pg_type.

There’s a library that integrates with Ruby’s ActiveRecord to automatically re-order columns to reduce padding called pg_column_byte_packer. You can see the README in that repo cites the above blog post and in general does the same thing that the blog post describes.

However, the pg_column_byte_packer does not return results consistent with the blog post it cites. The blog post pulls from from PostgreSQL’s internal pg_type.typelen which puts variable-length columns always at the end via an alignment of -1. pg_column_byte_packer gives them an alignment of 3.

pg_column_byte_packer has an explanatory comment:

    # These types generally have an alignment of 4 (as designated by pg_type     # having a typalign value of 'i', but they're special in that small values     # have an optimized storage layout. Beyond the optimized storage layout, though,     # these small values also are not required to respect the alignment the type     # would otherwise have. Specifically, values with a size of at most 127 bytes     # aren't aligned. That 127 byte cap, however, includes an overhead byte to store     # the length, and so in reality the max is 126 bytes. Interestingly TOASTable     # values are also treated that way, but we don't have a good way of knowing which     # values those will be.     #     # See: `fill_val()` in src/backend/access/common/heaptuple.c (in the conditional     # `else if (att->attlen == -1)` branch.     #     # When no limit modifier has been applied we don't have a good heuristic for     # determining which columns are likely to be long or short, so we currently     # just slot them all after the columns we believe will always be long. 

The comment appears to be not wrong as text columns do have a pg_type.typalign of 4 but they’ve also got a pg_type.typlen of -1 which the blog post argues gets the most optimal packing when at the end of the table.

So in the case of a table that has a four byte alignment column, a text column, and a two byte alignment column, pg_column_byte_packer will put the text columns right in between the two. They’ve even got a unit test to assert that this always happens.

My question here is: what order of columns actually packs for minimal space? The comment from pg_column_byte_packer appears to be not wrong as text columns do have a pg_type.typalign of 4, but they’ve also got a pg_type.typlen of -1.

If I ready a action (spell) in response to a companion’s attack, what is a fair GM rulling over the order of events?

In our campaign, I have a cleric who wished to use Ready an Action as his move. His idea behind this was that he wanted to ready Guiding Bolt and the condition he set was that, when one of the player (fighter) attacked a creature (one of 2 trolls), he would release the bolt beforehand. Therefore the figther would have advantage on her attack if the Guiding Bolt hit first.

I ruled that the fighter hit first, but I’m not so sure now – and feel like I was unfair in my ruling, maybe.

I can see both points of view:

  1. If I was the cleric readying my spell, I would cast the spell as soon as I noticed my fighter’s companion intention to attack a creature.

  2. But, also if I’m the fighter and I’m 5′ away from a creature, maybe my attack would land first, before the Guiding Bolt.

I would like some RAW guidance on this please. But, if not explicitly available, then a response with lived experience of a GM on a similar ruling to do with resolving oder of events.

Which class should an armored Wizard multi-class with, and in what order?

For a Wizard who plans to be in battle, what factors should be considered when deciding between taking a level or two of Fighter or of Cleric, and when?

Fighter 1 would give the heavy armor proficiency and the proficiency on CON saves, and seems like a good way to go.

Cleric 1 would also give heavy armor proficiency, proficiency on WIS saves, and progresses the spell slots. L1 Cleric healing (and other) spells could be cast from higher level slots making this a nice “bonus” set of spells to have available.

I realize there are trade-offs and it’s not a factual question to ask which is better, but are there factors I’m failing to take into consideration?

Is there an argument for taking the first level of Wizard first? It seems like you lose out on more than you gain that way.

(If it matters, we’ll start playing at Level 3)

When and why did the order of ability scores change in D&D?

In OD&D, the order in which abilities were presented and listed was: Strength, Intelligence, Wisdom, Constitution, Dexterity, Charisma. Today, the broadly accepted order is Strength, Dexterity, Constitution, Intelligence, Wisdom, and Charisma. When did this generally accepted order change and are there any sources–or logical theories–indicating why the abilities were in that original order and why they changed?

Adding Tracking Details for Advanced Shipment Tracking Plugin without order details in complete order email

I am using Advanced Shipment Tracking plugin from Zorem and I want to include only tracking information in complete order email without order details but I can not separate them while editing "astra/woocommerce/emails/customer-completed-order.php." but they both are under the action " do_action( ‘woocommerce_email_order_details’, $ order, $ sent_to_admin, $ plain_text, $ email );" I wanted to know how can I just keep the tracking info without order details. Thanks