## 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):

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

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

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.

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.

## Is my understanding of strictness correct in this proof of a foldl rule?

Exercise G in Chapter 6 of Richard Bird’s Thinking Functionally with Haskell asks the reader to prove

foldl f e . concat  =  foldl (foldl f) e 

given the rule

foldl f e (xs ++ ys)  =  foldl f (foldl f e xs) ys 

There’s no mention whether the given rule applies to infinite lists, nor does the answer in the book mention infinite lists. If my reasoning is correct, they are indeed both valid for infinite lists, provided f is strict.

The undefined case for the given rule requires this additional proof:

-- f is strict  ⟹  foldl f is strict  (i.e., foldl f undefined = undefined)        foldl f undefined xs       =        undefined xs  -- case undefined       foldl f undefined undefined         undefined undefined --   =  {foldl.0}                        =  {?}       undefined                           undefined  -- case []       foldl f undefined []                undefined [] --   =  {foldl.1}                        =  {?}       undefined                           undefined  -- case (x:xs)       foldl f undefined (x:xs)            undefined (x:xs) --   =  {foldl.2}                        =  {?}       foldl f (f undefined x) xs          undefined --   =  {f is strict}       foldl f (undefined x) xs --   =  {?}       foldl f undefined xs --   =  {induction}       undefined xs --   =  {?}       undefined 

As an aside, my proof for the dual of the above rule for foldr:

-- f x is strict  ⟹  foldr f is strict  (i.e., foldr f undefined = undefined)        foldr f undefined xs       =        undefined xs  -- case undefined       foldr f undefined undefined         undefined undefined --   =  {foldr.0}                        =  {?}       undefined                           undefined  -- case []       foldr f undefined []                undefined [] --   =  {foldr.1}                        =  {?}       undefined                           undefined  -- case (x:xs)      foldr f undefined (x:xs)             undefined (x:xs) --  =  {foldr.2}                         =  {?}      f x (foldr f undefined xs)           undefined --  =  {induction}      f x (undefined xs) --  =  {?}      f x undefined                      --  =  {f x is strict}      undefined 

The given rule:

-- f is strict  ⟹  foldl f e (xs ++ ys)  =  foldl f (foldl f e xs) ys        foldl f e (xs ++ ys)       =        foldl f (foldl f e xs) ys  -- case undefined       foldl f e (undefined ++ ys)         foldl f (foldl f e undefined) ys --   =  {++.0}                           =  {foldl.0}       foldl f e undefined                 foldl f undefined ys --   =  {foldl.0}                        =  {f is strict  ⟹  foldl f is strict}       undefined                           undefined ys --                                       =  {?}                                           undefined  -- case []      foldl f e ([] ++ ys)                 foldl f (foldl f e []) ys --  =  {++.1}                            =  {foldl.1}      foldl f e ys                         foldl f e ys  -- case (x:xs)      foldl f e ((x:xs) ++ ys)             foldl f (foldl f e (x:xs)) ys --  =  {++.2}                            =  {foldl.2}      foldl f e (x : (xs ++ ys))           foldl f (foldl f (f e x) xs) ys --  =  {foldl.2}                         =  {induction}      foldl f (f e x) (xs ++ ys)           foldl f (f e x) (xs ++ ys) 

My solution to the exercise:

-- f is strict  ⟹  foldl f e . concat  =  foldl (foldl f) e        foldl f e (concat xs)       =       foldl (foldl f) e xs  -- case undefined       foldl f e (concat undefined)        foldl (foldl f) e undefined --   =  {concat.0}                       =  {foldl.0}       foldl f e undefined                 undefined --   =  {foldl.0}       undefined  -- case []       foldl f e (concat [])               foldl (foldl f) e [] --   =  {concat.1}                       =  {foldl.1}       foldl f e []                        e --   =  {foldl.1}       e  -- case (x:xs)       foldl f e (concat (x:xs))           foldl (foldl f) e (x:xs) --   =  {concat.2}                       =  {foldl.2}       foldl f e (x ++ concat xs)          foldl (foldl f) (foldl f e x) xs --   =  {f is strict  ⟹  foldl f e (xs ++ ys)  =  foldl f (foldl f e xs) ys}       foldl f (foldl f e x) (concat xs) --   =  {induction}       foldl (foldl f) (foldl f e x) xs 

Does this work? If so, is it often the case that rules restricted to finite lists can be made to work for all lists given additional strictness requirements like this?

There are several lines above with {?} given as my reasoning. They could be replaced by {undefined x = undefined}, but I am just guessing there. If that is true, how could it be justified?

## Understanding Antivirus Sandbox limitations

The most advanced antiviruses fight against malware with different techniques, like signature-based detection and heuristic analysis. In case those two are bypassed by the malware, there is still the Sandbox environment which executes the malware in a safe environment in order to detect suspicious behaviours.

Let us now suppose that a malware in some way fools the AV Sandbox avoiding runnig the malicious code.

At this stage, is the malware the winner by executing the malicious code in the system?

Is the AV capable of doing something outside the Sandbox, or it is impossible to detect the malware at this stage??

## Understanding the proof of “DFS of undirected graph $G$, yields either tree edge or back edge” better with graph for each statement in proof

I was going through the edge classification section by $$\text{DFS}$$ algorithm on an undirected graph from the text Introduction to Algorithms by Cormen et. al. where I came across the following proof. I was having a little difficulty in understanding the steps of the proof and hence I made an attempt to understand it fully by accompanying each statement in the proof with a possible graph of the situation.

Theorem 22.10 : In a depth-first search of an un-directed graph $$G$$, every edge of $$G$$ is either a tree edge or a back edge.

Proof:

1. Let $$(u , v)$$ be an arbitrary edge of $$G$$, and suppose without loss of generality that $$d[u] < d[v]$$. Then, $$v$$ must be discovered and finished before we finish $$u$$ (while $$u$$ is gray), since $$v$$ is on $$u$$‘s adjacency list.

2. If the edge $$(u, v)$$ is explored first in the direction from $$u$$ to $$v$$ , then $$v$$ is undiscovered (white) until that time.

Figure 1 : Situation in point 2. DFS starts from ‘u’, ‘u’ is grayed and DFS then looks along the red arrow to ‘v’

1. Otherwise we would have explored this edge already in the direction from $$v$$ to $$u$$. Thus, $$(u, v)$$ becomes a tree edge.

Figure 2 : Situation in point 3. DFS starts from ‘u’, ‘u’ is grayed, then discoveres ‘w’ and ‘w’ is grayed and then again discovers ‘v’ DFS then looks along the red arrow to ‘u’ , the green pointer explains the rest

1. If $$(u, v)$$ is explored first in the direction from $$v$$ to $$u$$, then $$(u, v)$$ is a back edge, since $$u$$ is still gray at the time the edge is first explored.

Figure 3 : Situation in point 4. DFS starts from ‘u’, ‘u’ is grayed, then discoveres ‘w’ and ‘w’ is grayed and then again discovers ‘v’ DFS then looks along the red arrow to ‘u’ , ‘u’ is already grayed so the edge becomes a back edge, indicated by the green pointer

Could anyone confirm if I am on the right track or if not please rectify me.

[My question might seem similar to this or this but neither of them seemed to help me]