mod rewrite – Apache recursive rewriting rules

I’m writing a PHP CMS and, for each page, I can have a subpage, and a page number, and a language switch, and a previous version.
Then, I can edit a page, or call a special page.

Examples :

http://example.com/info => http://example.com/index.php?page=info
http://example.com/info/versions => http://example.com/index.php?page=info&sub=versions
http://example.com/info/versions/2 => http://example.com/index.php?page=info&sub=versions&p=2
http://example.com/info/versions/2/EN => http://example.com/index.php?page=info&sub=versions&p=2&lang=EN
http://example.com/info/EN => http://example.com/index.php?page=info&lang=EN

I’m using these URL rewriting rules :

RewriteEngine on
RewriteRule ^((a-z0-9_-)+)$ ./index.php?page=$1 (L)
RewriteRule ^((a-z0-9_-)+)/((0-9){12})$ ./index.php?page=$1&bkp=$2 (L)
RewriteRule ^((a-z0-9_-)+)/((A-Z){2})$ ./index.php?page=$1&lang=$2 (L)
RewriteRule ^((a-z0-9_-)+)/((0-9)+)$ ./index.php?page=$1&p=$2 (L)
RewriteRule ^((a-z0-9_-)+)/((0-9)+)/((A-Z){2})$ ./index.php?page=$1&p=$2&lang=$3 (L)
RewriteRule ^((a-z0-9_-)+)/((a-z0-9_-)+)$ ./index.php?page=$1&sub=$2 (L)
RewriteRule ^((a-z0-9_-)+)/((a-z0-9_-)+)/((0-9){12})$ ./index.php?page=$1&sub=$2&bkp=$3 (L)
RewriteRule ^((a-z0-9_-)+)/((a-z0-9_-)+)/((A-Z){2})$ ./index.php?page=$1&sub=$2&lang=$3 (L)
RewriteRule ^((a-z0-9_-)+)/((a-z0-9_-)+)/((0-9)+)$ ./index.php?page=$1&sub=$2&p=$3 (L)
RewriteRule ^((a-z0-9_-)+)/((a-z0-9_-)+)/((0-9)+)/((A-Z){2})$ ./index.php?page=$1&sub=$2&p=$3&lang=$4 (L)
RewriteRule ^@((a-z0-9_-)+)$ ./index.php?edit=$1 (L)
RewriteRule ^@((a-z0-9_-)+)/((A-Z){2})$ ./index.php?edit=$1&lang=$2 (L)
RewriteRule ^!((a-z0-9_-)+)$ ./index.php?special=$1 (L)
RewriteRule ^!((a-z0-9_-)+)/((A-Z){2})$ ./index.php?special=$1&lang=$2 (L)

It works, but it’s creepy, and if I want to add an option, I have to edit my conf file.

So, I want to simplify it.
What I want :

  1. URL with just values, not variables name, separated by a slash.

http://example.com/page/.../...

  1. If the “page” name corresponds to a folder, ignore the folder.

I have a infos folder, but I want to rename my info page (see the example above) into infos (I want to be able to create a page named core without trying to access the core folder).

  1. The variables can be anywhere, except the first one (page) and should match the same regex pattern.

http://example.com/info/versions/EN will become http://example.com/index.php?info&versions&EN, then I’ll deal with the $_GET array with preg_grep.


If the page variable is empty, the home page will be loaded.
If the new rules work, I’ll check $_GET variables format in index.php

For the 1st variable, I want this pattern : (a-z0-9_-@!)+
For the other, I want this one : (A-Za-z0-9)+
I’m trying lots of solutions since 3 days, without succeeding. I don’t know Apache as well as I should so, can you help me ?

mining pools – Who enforces new consensus rules in Bitcoin?

I have been reading at few places that miners will enforce new consensus rules. Examples:

https://twitter.com/BitMEXResearch/status/1391014115968274433

https://twitter.com/ajtowns/status/1390496379487744001

04:20 < AaronvanW> aj: I think “my” type of futures market could be combined with “your” type of futures market? My futures market would inform miners if the market wants them to activate or not, your futures market would inform them (post-activation) if they should enforce or not. I think the second futures market (enforce or not) would be kinda pointless in this context, since the market already told miners to activate (among other reasons), but hey if people want to bet on that they can. (And I think this should address Matt’s point/concern.)

04:32 < AaronvanW> the second futures market would have an asymmetric advantage in favor of enforcing, but I’d say that’s a good thing. (again, I think this futures market would be kinda pointless… just addressing concerns here.)

http://gnusha.org/taproot-activation/2021-05-04.log

According to my understanding:

  1. Devs code implementation for a BIP, followed by reviews and discussions

  2. MASF: Miners are asked to signal readiness, new consensus rules are activated if most miners are ready in time. Blocks that do not follow new consensus rules after activation are rejected by full nodes.

  3. UASF: Miners are informed about a deadline, new consensus rules are activated irrespective of miners readiness if enough miners fail to signal before deadline. Blocks that don’t follow new consensus rules after activation are rejected by full nodes. (In BIP 148 blocks are rejected that do not signal and BIP 8 has a MUST_SIGNAL phase and lockinontimeout)

In both cases, rules are ‘enforced‘ by full nodes.

Are miners “following” the new consensus rules after activation that they agreed to activate and signaled readiness or miners are “enforcing” new consensus rules? If they are enforcing new consensus rules, what is the role of full nodes? And if miners enforce new consensus rules can we consider miners signaling as voting?

Italy to netherland COVID-19 travel rules

I am planning to travel from bergamo to eindhaven with ryan air so I have to carry COVID-19 test if yes then with test pcr or rabid antigen swab??

dnd 5e – Homebrew rules for throwing friendly characters

Taking damage from fall

According to PHB p. 183 Falling

A fall from a great height is one of the most common
hazards facing an adventurer.
At the end of a fall, a creature takes 1d6 bludgeoning
damage for every 10 feet it fell, to a maximum of 20d6.
The creature lands prone, unless it avoids taking
damage from the fall.

The throw depends on whether you can throw that weight for that distance. for example the world record for put shot for men is 23m and then some. Those are very strong men and only 8Kg. throwing a 35Kg halfling would be way harder even for the strongest characters.

In case you manage that, the distance you throw would not be very large. More realistic would be to throw down. In which case it handles like normal fall damage.

If you were somehow able to throw skillfully up and you wouldn’t miss, there would be no fall damage since you direct the throw such that your thrown friend naturally loses momentum around the target.

The check is an athletics check DC according to weight and distance. This check lends itself to imperial system very well.

The DC would be $$ DC = 10+frac{text{weight in lb}}{10} + frac{text{distance in foot}}{10} $$.

So a lvl 1 very strong character with 18 str (+4), proficient in athletics would roll d20+6 and would be able to throw 10lb for 90 feet with DC of $$ DC_{example} = 10 + frac{10}{10} + frac{90}{10} = 20 $$

Reasonable considering the world records for men in put shot.

A fail would mean falling and would depend on the situation but could easily mean no fall damage due to very weak throw.

waf – AWS WAFv2 Custom Rules

I have to implement AWS WAFv2 on my CloudFront applications, I have been looking into the AWS managed/free rulesets, I want to understand what kind of custom rulesets should I implement or are generally used in best practices (Eg. 8Kb ruleset and Blocking request methods like Options, Delete, Put)

Magento2 Apply All Catalog Rules via CLI

In Magento 1, there was a need to Magento run “Apply Catalog Price Rules” via a script on periodic basis to make sure all Catalog Rules have been applied to appropriate products for appropriate customer groups.

How can this be done in Magento2? Is there a need to do it still or is there system event that handles this?

Applying replacement rules to products doesn’t work as expected

I have the following issue: I’d like to apply some replacement rules, for example

rules:={f(x)/t :> ff(x), g(x)/t :> gg(x)}

to an expression, e.g. like this:

(f(x)*g(x)/(t^2))/. rules

Surprisingly, this doesn’t give the expected result

ff(x)*gg(x)

How do I fix this? Sorry if it’s an easy question, I’m still a beginner with Mathematica.

dnd 5e – Levitate rules and speed

This is what the spell description say about Levitate ending

When the spell ends, the target floats gently to the ground if it is still aloft.

This would imply that no matter the height, the target would just fall to the ground and take no damage. This could be intended to work similarly to Feather Fall.

Otherwise, if the spell is still active

You can change the target’s altitude by up to 20 feet in either direction on your turn.

Since one turn is ~6 seconds, and the duration for the spell is “Up to 10 minutes”, if you maintain concentration for 10 minutes, you could move your target 2,000 feet up. Given the limitations of the spell, you should at max be able to move a creature 200 ft per minute, regardless of direction.

Rules (calculated field) engine – Software Engineering Stack Exchange

have a fun problem ahead of me.

So, I have built a solution for my company that basically handles unstructured information. It works like this:

A user creates a Task, the Task is in reality just a collection of Tags. These Tags can hold any type of value.

So, for example, if a user wants to create a Task that holds a string (think Title) and two date fields (think Start Date and Due Date), the user can create a template for this, and then create as many Tasks as they want.

So in this case, the user might see a list that looks like this after they have created some Tasks:

Title Start Date Due Date
Go to Doctor 2001-01-01 2001-02-01
Call boss 2005-01-01 2005-02-01

Now, I want to create a ruleset for the user, for example, create some rules to check that “Due Date” is in the future compared to “Start Date”.

Since the solution has no idea what data is stored, the possibilities are endless.

I do have a pretty good idea of how to create this ruleset but I would love some input before I start.

The way I figure is to build some rules (in reality some type of calculated field) that the user can apply to the Task. For example, a rule that looks like this:
if(InternalFieldA > InternalFieldB)
If the check is true, everything is fine, if the check is false, throw an error.

But I’m not sure what the best approach should be.

Any tips, tricks?

dnd 3.5e – Does the same attribute modifier necessarily count as the same source when adjudicating stacking rules?

the SRD says this about stacking:

Stacking

In most cases, modifiers to a given check or roll stack (combine for a cumulative effect) if they come from different sources and have different types (or no type at all), but do not stack if they have the same type or come from the same source (such as the same spell cast twice in succession). If the modifiers to a particular roll do not stack, only the best bonus and worst penalty applies. Dodge bonuses and circumstance bonuses however, do stack with one another unless otherwise specified.

(emphasis mine).

Does the same attribute modifier necessarily count as the same source?

Case A: for example, would the Wisdom modifier melee bonus damage from the epic prestige class Perfected One (Epic Level Handbook) stack with the Wisdom modifier bonus damage of the Shiba Protector prestige class (Oriental Adventures)?

Case B: would the bonus type make a difference? As an abstract example, would adding the Charisma modifier as a sacred bonus to reflex saving throws from class feature A and a the Charisma modifier as an insight bonus to reflex saving throws from class feature B stack?

Case C: would the kind of enabler matter? For example, if we had the Gauntlets of Heartfelt Blows (adds the Charisma modifier as bonus fire damage to melee attacks) and an imaginary class feature that adds the Charisma modifier to damage – would they stack?