Understanding mod_expires apache module [closed]

Working with htaccess is a new capitol for me. I have already read about mod_expires here https://httpd.apache.org/docs/current/mod/mod_expires.htm, but I’m stil confused.

I have the next code from stack overflow:

ExpiresActive On ExpiresByType image/jpg "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/gif "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType text/css "access 1 month" ExpiresByType text/html "access 1 month" ExpiresByType application/pdf "access 1 month" ExpiresByType text/x-javascript "access 1 month" ExpiresByType image/x-icon "access 1 year" ExpiresDefault "access plus 2 months" 

My questions are:

  1. I suppose the line ExpiresByType image/jpg "access 1 year" tells the client (browser) to download the file and keep it for one year. And when the client accesses the same page from my website, the jpg image won’t be downloaded from my website. It will be read from his computer (where the browser saved first time). After one year, the browser automatically deletes the file and, once the client access my website, it will download again, for another year. If the client cleans his browser history after 2 months, then the browser will download it again even if a year hasn’t passed. Do I miss something ?

  2. What cache availability should I set for each file type ? It depends on the file ? What should I consider when set the expiration time ?

  3. What’s the difference between "access 1 year" and "access plus 1 year" ?

  4. Does ExpiresDefault rule works for php files too ? I mean, if I have a contact.php file with some content and I modify the content of contact.php, because of ExpiresDefault rule, the content won’t change to the user ?

  5. Do search engine spiders listen for this cache rules or they download the files each time they crawling my website ?

  6. Is it true that ExpiresDefault is for the files I don’t set using ExpiresByType ? If the answer is yes, what are the other types ? What types of files are included here ?

  7. Do I understand correct that Header set Cache-Control "max-age=290304000, public" is the maximum time allowed for a file to be cached ? If the answer is yes, then means that "access 999 years" will take no effect as long 290304000 is the limit. True or false ?

Understanding the mechanics of a satyr’s mirthful leap

I apologize if this question has been asked in this form or another, but I am still having an issue calculating how to utilize a satyr’s mirthful leap, and how it would affect the character moving forward, focusing on the math and stats. For this question, I’ll use the DndBeyond stat block’s 12 Strength as a fair basis and perfect rolls for maximum distance.

The satyr’s mirthful leap is stated as follows:

Whenever you make a long or high jump, you can roll a d8 and add the number rolled to the number of feet you cover, even when making a standing jump. This extra distance costs movement as normal.

while the calculation for long jump states:

When you make a long jump, you cover a number of feet up to your Strength score if you move at least 10 feet on foot immediately before the jump. When you make a standing long jump, you can leap only half that distance. Either way, each foot you clear on the jump costs a foot of movement.

So adding everything together as I understand it, a satyr can either clear a 20ft chasm with a 10 ft leap (12ft for strength and 8 for their ability), leaving them 5 ft extra in case something goes wrong, OR can clear a 13ft chasm ([12/2]+8) without a running start. This means the satyr has the ability to use nearly all his movement in one long jump, correct?

If that is the case, then:

  1. If your satyr had to cross a terrain during 1 round by leaping from platform to platform (say to cross a river, or avoid the many pit traps in a sealed hallway), how would the mirthful leap be applied? Without a running start, would each leap be up to 13ft? Would that only apply to the first jump? Or would the mirthful leap of the prior jump be considered a running start for the next, allowing them to jump to the next platform up to 20ft away?
  2. Would this not make modifiers like Boots of Striding (tripling jumping distance up to character speed) useless?

Understanding the importance of Gunicorn and Nginx for Django web development

I’m entirely uninitiated to the world of web development, and only have a tentative grasp on Django and web development through the test server it works through.

From the guide I’m reading, the author turns to using Nginx once he starts working on site deployment, because Django is "not designed for real-life workloads." What does that mean, and why doesn’t it? In terms of justification for using Gunicorn, the author remarks:

Do you know why the Django mascot is a pony? The story is that Django comes with so many things you want: an ORM, all sorts of middleware, the admin site…​ "What else do you want, a pony?" Well, Gunicorn stands for "Green Unicorn", which I guess is what you’d want next if you already had a pony…​

Well and good, but I don’t really know what the two are doing for the server. I know for web developers this is like asking what multiplication is to a maths professor, so please excuse the naivety. In your please keep in mind I have almost no knowledge of web development other than what I’ve thus far learned from this guide, doing my best to understand as much as I can for the previously entirely uninitiated (I’m from a computational programming background).

Understanding Logging Priority & Options in Oracle DB

From my understanding once we switch on database logging, the entire DB goes into logging mode and generates redo logs.

I want to categorically exclude/include some tables/tablespaces from this logging as they are not required for recovery incase of failures.

Is there any priority on the logging options and to exclude certain tables/tablespaces from logging so as to reduce some of the traffic going to redo logs.

Understanding JOIN Syntax

Given:

postgres=# \d foo                 Table "public.foo"  Column |  Type   | Collation | Nullable | Default  --------+---------+-----------+----------+---------  a      | integer |           | not null |   b      | text    |           | not null |  Indexes:     "foo_pkey" PRIMARY KEY, btree (a)  postgres=# \d bar                 Table "public.bar"  Column |  Type   | Collation | Nullable | Default  --------+---------+-----------+----------+---------  a      | integer |           | not null |   b      | text    |           | not null |  Indexes:     "bar_pkey" PRIMARY KEY, btree (a)  postgres=# select * from foo;  a |  b   ---+-----  1 | one (1 row)  postgres=# select * from bar;  a |  b   ---+-----  2 | two (1 row) 

I then join‘d using the following JOIN syntax:

postgres=# select * from foo, bar;  a |  b  | a |  b   ---+-----+---+-----  1 | one | 2 | two (1 row) 

Then, I compared it to full outer join:

postgres=# select * from foo full outer join bar using (a);  a |  b  |  b   ---+-----+-----  1 | one |   2 |     | two (2 rows) 

and cross join:

postgres=# select * from foo cross join bar;  a |  b  | a |  b   ---+-----+---+-----  1 | one | 2 | two (1 row) 

Is it always true that the from a, b, c will produce a cross join?

Understanding CSP: report shows blocked that shouldn’t have been blocked

I’m having trouble making sense of some reported CSP violations that don’t seem to actually be violations according to the CSP standard. I have not managed to reproduce the violations in my own browser, and based on my own testing I believe that the block is the result of a non-compliant browser. That seems like a bold assertion, but based on all the documentation I’ve read and my tests it’s the only thing that makes sense.

Here is (more or less) what the CSP is:

frame-ancestors [list-of-urls]; default-src https: data: blob: 'unsafe-inline' 'unsafe-eval' [list-of-more-urls]; report-uri [my-reporting-endpoint] 

The problem is that I’m getting some violations sent to my reporting endpoint. Here is an example violation report:

{"csp-report":{     "document-uri":"[REDACTED]",     "referrer":"[REDACTED]",     "violated-directive":"script-src-elem",     "effective-directive":"script-src-elem",     "original-policy":"[SEE ABOVE]",     "disposition":"enforce",     "blocked-uri":"https://example.com/example.js",     "status-code":0,     "script-sample":"" }} 

The context would be that the page in question had a <script src="https://example.com/example.js"></script> on it somewhere.

To be clear, https://example.com is not in the list of allowed URLs under default-src. However, that shouldn’t really matter. Here are all the relevant facts that lead me to believe this is being caused by a non-compliant browser that someone is using:

  1. There is no script-src-elem defined so it should fall back on the default-src for the list of allowed URLs.
  2. default-src includes the https: schema, which means that all urls with an https scheme will be allowed. The blocked URL definitely uses HTTPS
  3. This source agrees that the scheme source (https) will automatically allow any https resources. Therefore this should be allowed even though example.com is not in the list of allowed URLs.
  4. The official CSP docs also agree, showing that scheme matching happens first and can allow a URL even before the list of allowed URLs is checked.
  5. Therefore, if you include the https: scheme in your default-src, your CSP will match <script src="https://anything.com"> even if not specifically in the list of allowed URLs
  6. In my own testing I found the above to be true.

Despite all of this, I have sporadic reports of CSP violations even though it shouldn’t. Note that I’m unable to replicate this exactly because the pages in question have changed, and I don’t have easy control over them. The only thing I can think of is that some of my users have a browser that isn’t properly adhering to the CSP standard, and are rejecting the URL since it is not on the list of allowed URLs, rather than allowing it based on its scheme.

Is this the best explanation, or am I missing something about my CSP? (and yes, I know that this CSP is not a very strict one).

Understanding growth function of closed intervals in $\mathbb{R}$

I as studying VCdimensions and growth functions and found the following example on Wikipedia:

The domain is the real like $ \mathbb{R}$ . The set H contains all the real intervals, i.e., all sets of form $ \{c \in [x_1, x_2] | x \in \mathbb{R}\}$ for some $ x_{0, 1} \in \mathbb{R}$ .

For any set C of m real numbers, the intersection $ H \cap C$ contains all runs of between 0 and m consecutive elements of C. The number of such runs of $ {m+1 \choose 2} + 1$ , so Growth(H, m) = $ {m+1 \choose 2} + 1$ .

Can anyone please explain to me what does the term "all runs of between 0 and m" refer to here and why the growth function is $ {m+1 \choose 2} + 1$ and not $ {m+1 \choose 2}$ ?

Thank you very much!

Not understanding this way of proving undecidability of the termination problem

I am reading some slides on Algorithm to understand why termination is an undecidable problem. The slides say the following:

– Assume termination(P) always terminates and returns true iff P always terminates on all input data;

– The following program yields a contradiction

while termination(P) skip;  

But I do not see what kind of contradiction there. Any idea?

Understanding the Transition points of a BST

I’m trying to understand the definition of Transition point of a BST, as given in Demaine, Erik D., et al. "Dynamic optimality-almost." SIAM Journal on Computing 37.1 (2007): 240-251

Define the transition point for [a node] y at time i to be the minimum-depth node z in the BST Ti such that the path from z to the root of Ti includes a node from the left region of y and a node from the right region of y.

with

Define the *left region of [a node] y to consist of y itself plus all nodes in y’s left subtree. Define the right region of [a node] y to consist of all nodes in y’s right subtree


I’m having trouble understanding how a path from a node to the root can pass through both the left and the right subtrees of a given node.
Since each node forks the tree, a path (towards the root) comes either from the left or right subtree.
Also, in this picture from the notes of a Demaine’s course the transition point Z is drawn above the node y (i.e. closer to the root than y):

Transition point from the notes

I understand that the left region of a node includes the node itself but this seems to reduce the definition to "the root of the right region".
Now, the right region may not even exist, an apparently that’s a minor technical flaw.
Clearly, I must be missing something with my understanding of the transition point definition.

What’s wrong with my interpretation?


Example

For example, given the following tree

A BST

For the nodes B, D, G, H, I there is no definition of the transition point (because there is no right region in the first place), assuming I understood the linked answer correctly.

The left and right regions of the remaining nodes (F, E, C and A) should be these ones

Regions of the nodes F, E, C and A

With the left region in blue and the right region in red.

Now, since the path from transition point to the root must include a node from both regions (of a given node y) and since these regions’ nodes are, by construction, at least as deep in the tree as y (i.e. at the same distance from the root as y or farther away), the transition point cannot be above y (when drawn in a picture of the tree).

Finally, for a path (to the root) to cross both regions it must originate in the right region and pass through y.
That’s the only way I can imagine such a path. Then, since the transition point must be of minimal depth, the root of the right region seems to be the only candidate.

In the picture below the light-green arrows depict the path from the Transition point to the root. The transition point is the node close to the rounded end of the array. The dark-green stars mark the node in the left and right regions (of a given node) the path goes through.

The TPs and their paths

So, in this example, the transition points should be C, E, H, J.

But I’m sure something’s off, it would be great to have the correct transition point worked out for one node of the tree in the example.

Difficulty understanding the use of arbitrary function for the worst case running time of an algorithm

In CLRS the author said

"Technically, it is an abuse to say that the running time of insertion sort is $ O(n^2)$ , since for a given $ n$ , the actual running time varies, depending on the particular input of size $ n$ . When we say “the running time is $ O(n^2)$ ,” we mean that there is a function $ f(n)$ that is $ O(n^2)$ such that for any value of $ n$ , no matter what particular input of size $ n$ is chosen, the running time on that input is bounded from above by the value $ f(n)$ . Equivalently, we mean that the worst-case running time is $ O(n^2)$ . "

What I have difficulties understanding is why did the author talked about an arbitrary function $ f(n)$ instead of directly $ n^2$ .

I mean why didn’t the author wrote

"When we say “the running time is $ O(n^2)$ ,” we mean that for any value of $ n$ , no matter what particular input of size $ n$ is chosen, the running time on that input is bounded from above by the value $ cn^2$ for some +ve $ c$ and sufficiently large n. Equivalently, we mean that the worst-case running time is $ O(n^2)$ ".

I have very limited understanding of this subject so please forgive me if my question is too basic.