Updating the Definition of Limit of a Sequence to take in consideration sequences that are not defined for some finite number of natural numbers

Question: The definition of limit of a sequence I always encounterd was of the form:
DEFINITION: Limit of a Sequence:
Let $\{x_n\}_{n\in\mathbb{N}}$ be some sequence of real numbers, (i.e. $x:\mathbb{N}\to\mathbb{R}$)
We say that:
$lim_{n\to\infty}x_n=L$
if and only if
$\forall 0 < \epsilon \in\mathbb{R} ,\exists N\in\mathbb{N}, \forall N<n\in\mathbb{N}, |x_n - L| < \epsilon $

And the theorem of arithmetic laws for limits of sequences was always of the form:
THEOREM: Limits of Sequences under Arithmetic Operations:
If $\{x_n\}_{n\in\mathbb{N}}$ and $\{y_n\}_{n\in\mathbb{N}}$ are two sequences (i.e. $x$ and $y$ are functions: $x:\mathbb{N}\to\mathbb{R}$ and $y:\mathbb{N}\to\mathbb{R}$) and $X,Y\in\mathbb{R}$ are two real numbers such that $lim_{n\to\infty}x_n=X$ and $lim_{n\to\infty}y_n=Y$ then the following are true:

$lim_{n\to\infty}(x_n+y_n)=X+Y$
$lim_{n\to\infty}(x_n-y_n)=X-Y$
$lim_{n\to\infty}(x_n\times y_n)=X\times Y$
If in addition $\forall n\in\mathbb{N}, y_n \neq 0$ and $Y\neq 0$ then $lim_{n\to\infty}(\frac{x_n}{y_n})=\frac{X}{Y}$

Now the problem is that this definition and theorem does not allow to handle limits such as the one below in a truly rigorous manner:
$lim_{n\to\infty}\frac{n-1}{2n-6} = \frac{1}{2}$
Suppose that we try to solve this limit by using the standard definition and theorem as given above:
Define two sequences (i.e. two functions from $\mathbb{N}$ to $\mathbb{R}$) $\{x_n\}_{n\in\mathbb{N}}$ and $\{y_n\}_{n\in\mathbb{N}}$
such that $\forall n\in\mathbb{N}, x_n \triangleq 1-\frac{1}{n}$ and $\forall n\in\mathbb{N}, y_n \triangleq 2-\frac{6}{n}$ where the symbol $\triangleq$ means "equal by definition". (The sequences are well defined since for all $n\in\mathbb{N}$, the denominator in each of those two sequences does not match $0$).
Now, We can show that for $n = 3$ we have $y_3 = 2-\frac{6}{3}=0$ and that $\forall 4\leq n\in\mathbb{N}, y_n \neq 0$, Also it is clear that $lim_{n\to\infty}x_n=1$ and that $lim_{n\to\infty} y_n = 2 \neq 0$.
Now inorder to claim that $lim_{n\to\infty}\frac{x_n}{y_n}=\frac{1}{2}$ we have to change the condition of part 4. of the theorem (that is $\forall n\in\mathbb{N},y_n\neq 0$), and say that it is enough that almost for all $n\in\mathbb{N}$, we have $y_n \neq 0$, I.e. that is enough that $\exists N\in\mathbb{N},\forall N<n\in\mathbb{N}, y_n \neq 0$ inorder to conclude that (*) $lim_{n\to\infty}\frac{x_n}{y_n}=\frac{1}{2}$.
Now since it can be shown that $\forall 4\leq n\in\mathbb{N}, \frac{n-1}{2n-6} = \frac{x_n}{y_n}$, We can conclude by (*) that
$lim_{n\to\infty}\frac{n-1}{2n-6} = \frac{1}{2}$ as was to be shown.
Now the problem is that the limit $lim_{n\to\infty}\frac{n-1}{2n-6} = \frac{1}{2}$ itself, also does not confine to the original definition of limit of a sequence that requires the sequence to be defined for every natural number $n\in\mathbb{N}$ because for $n=3$ the denominator is $0$.

Now the problem is, in order to tackle limits like this we have to "update" the definition of limit of a sequence so that it will be able to handle rigorously limits of sequences like the one above or limits like this one $lim_{n\to\infty}\frac{3n^2+n-1}{5n^3-2n^2+n-4}$ which may have denominators that are equal to zero for a finite number of natural numbers, and thus the sequence may not be defined for all $n\in\mathbb{N}$.
What definition of limit we should take? Maybe this one?
UPDATED DEFINITION: Limit of a Sequence:
Let $A\in\mathscr{P}(\mathbb{N})$ (the power set of $\mathbb{N}$) be some subset of the natural numbers with cardinality $|A|=\aleph_0$ that satisfies $\exists K\in\mathbb{N},\forall K<n\in\mathbb{N},n\in A$, And let $\{x_n\}_{n\in A}$ be some sequence of real numbers (i.e. $x:A\to\mathbb{R}$),
We say that:
$lim_{A\ni n\to\infty}x_n=L$
if and only if
$\forall 0 < \epsilon \in\mathbb{R} ,\exists N\in\mathbb{N}, \forall N<n\in A, |x_n - L| < \epsilon $
IMPORTANT NOTE: The condition
$\exists K\in\mathbb{N},\forall K<n\in\mathbb{N},n\in A$ must be included, Otherwise we may get a subsequential limit (i.e. limit of some subsequence), and the limit will not be uniquely defined. (take for example the sequence $\{(-1)^n\}$).

This new definition probably will able to tackle this kind of limits rigorously, The only downside is that many theorems that were already proven for the original defintion, Now must be reproved again. Also we must prove that the sets on which the limit will be taken does not matter, In other words, We must prove that the limit is independent on the underlying set. I will state it formally as a theorem which I haven't tried to prove yet:
NEW THEOREM: The limit (if exists) is independent of the underlying set
Let $A_1\in\mathscr{P}(\mathbb{N})$ be some subset of the natural numbers with cardinality $|A_1|=\aleph_0$ that satisfies $\exists K_1\in \mathbb{N}, \forall K_1<n\in \mathbb{N}, n \in A_1$,
Let  $A_2\in\mathscr{P}(\mathbb{N})$ be some subset of the natural numbers with cardinality $|A_2|=\aleph_0$ that satisfies $\exists K_2\in \mathbb{N}, \forall K_2<n\in \mathbb{N}, n \in A_2$,
Let $\{x_n\}_{n\in A_1}$ and $\{y_n\}_{n\in A_2}$ be two sequences such that $\forall n\in A_1 \cap A_2, x_n = y_n$.
And let $L\in\mathbb{R}$ be some real number, Then:
$lim_{A_1\ni n\to\infty}x_n = L $ if and only if $\lim_{A_2\ni n\to \infty}y_n = L$

We can also restate and prove (I haven't proved it yet, But the proof is supposed to be straitforward) the thoerem of arithmetic laws of limits of sequences:
UPDATED THEOREM: Limits of Sequences under Arithmetic Operations:
Let $A\in\mathscr{P}(\mathbb{N})$ be some subset of the natural numbers with cardinality $|A|=\aleph_0$ that satisfies $\exists K\in \mathbb{N}, \forall K<n\in \mathbb{N}, n \in A$,
Let $\{x_n\}_{n\in A}$ and $\{y_n\}_{n\in A}$ be two sequences
(i.e. $x$ and $y$ are functions: $x:A\to\mathbb{R}$ and $y:A\to\mathbb{R}$),
And let $X,Y\in\mathbb{R}$ be two real numbers such that $lim_{A\ni n\to\infty}x_n=X$ and $lim_{A\ni n\to\infty}y_n=Y$ then the following are true:

$lim_{A\ni n\to\infty}(x_n+y_n)=X+Y$
$lim_{A\ni n\to\infty}(x_n-y_n)=X-Y$
$lim_{A\ni n\to\infty}(x_n\times y_n)=X\times Y$
If in addition $\forall n\in A, y_n \neq 0$ and $Y\neq 0$ then $lim_{A\ni n\to\infty}(\frac{x_n}{y_n})=\frac{X}{Y}$

Now, For example, Let's try to prove that $lim_{n\to\infty}\frac{3n^2+n-1}{5n^3-2n^2+n-4} = 0$ by using the new definitions and theorems:
Let $B\in\mathscr{P}(\mathbb{R})$ be defined as $B=\{x\in\mathbb{R}|5x^3-2x^2+x-4=0\}$, By the Fundamental Theorem of Algebra, This set have at most $3$ elements (i.e. $0\leq |B| \leq 3$).
Now, Define $A\in\mathscr{P}(\mathbb{R})$ as $A = \mathbb{N}-B$, It clear that $|A| = \aleph_0$ since $B$ includes only a finite number of elements or none at all.
Also, It is clear that $\exists K\in \mathbb{N},\forall K<n\in \mathbb{N}, n\in A$, (Just take $K=1$ if $B=\emptyset$, or choose any $K\in\mathbb{N}$ that satisfy $max(B)<K$ if $B\neq \emptyset$).
Now, Define two sequences (i.e. two functions from $A$ to $\mathbb{R}$) $\{x_n\}_{n\in A}$ and $\{y_n\}_{n\in A}$
such that $\forall n\in A, x_n \triangleq \frac{3}{n}+\frac{1}{n^2}-\frac{1}{n^3}$ and $\forall n\in A, y_n \triangleq 5 - \frac{2}{n}+\frac{1}{n^2}-\frac{4}{n^3}$. (The sequences are well defined since for all $n\in\mathbb{N}$, the denominator in each of those two sequences does not match $0$).
Now, It is clear that $lim_{A\ni n\to\infty}x_n=0$ and that $lim_{A \ni n\to\infty} y_n = 5 \neq 0$.
Now by using the new form of the theorem of arithmetic laws for limits of sequences, We can conclude that (*) $lim_{A \ni n\to\infty}\frac{x_n}{y_n}=0$.
Now since it can be shown that $\forall n\in A, \frac{3n^2+n-1}{5n^3-2n^2+n-4} = \frac{x_n}{y_n}$, We can conclude by (*) that
$lim_{A \ni n\to\infty}\frac{3n^2+n-1}{5n^3-2n^2+n-4}=0$ as was to be shown. Q.E.D.

Thanks for any ideas, Also suggestions/references for books (or papers/articles) that treat limits in such a manner will be appreciated. Thanks a lot.
Comment: That's a lot of text to deal with a problem whose solution, I think, is hardly worthy of more than a short remark (i.e. "Convergence of sequences is completely determined by any tail-end.") But yes, what you've developed here in detail is one way to formalize this remark. I haven't read all of it but skimming through some of the details, it seems perfectly fine to me. +1
Comment: @user247327 I disagree with the first part: A sequence, as far as I'm concerned, is a total function with domain $\mathbb N$. The latter is, of course, correct. OP essentially made rigorous the fact that, for the question of convergence, it doesn't matter how you expand a partial sequence to a sequence -- the answer is independent of that.
Comment: Just extend the definition of sequence so that it can start not only at zero but at an arbitrar number and show that two such sequences which coincide after some point have the same character. There is no need to over complicate anything.
Comment: Your idea that "Now the problem is, in order to tackle limits like this we have to "update" the definition of limit of a sequence so that it will be able to handle rigorously limits of sequences like the one above or limits like this one $lim_{n→∞} \frac{3n^2+n−1}{5n^3−2n^2+n−4}
which may have denominators that are equal to zero for a finite number of natural numbers, and thus the sequence may not be defined for all
n∈N" is simply not relevant.  There is nothing in the definition of "sequence" or "limit of a sequence" that requires that the sequence be defined for all n.
Comment: @user247327 Indeed, There is nothing in the definition of "sequence" or "limit of sequence" that requries the sequence to be defined for all $n$, But it seems that there is a need that the sequence will be defined on subsets of the natural numbers with cardinality $\aleph_0$ that satisfy $\exists K\in\mathbb{N},\forall K<n\in\mathbb{N}, n\in A$ otherwise we cannot even speek about the notion of limit of a sequence. Also, it must be shown that the limit if it exist is independent of those sets (The NEW THEOREM I formulated above).
Comment: @user247327 This seems to me a better definition that can handle elegantly and rigorously problematic points (for example, points that will cause division by zero or other problems).
Comment: @StefanMesken If you want, Have a look at the answer I gave, I think I was able to formalize this aspect limits a little more.
Answer: I was able to prove that my definitions above are actually equivalent to the original definition of limit of a sequence, And that in order for the original definition of limit of a sequence to actully mean something, The sequences on which the limit is defined must be defined on sets of the form $\mathscr{A}(\mathbb{N})=\{A\in\mathscr{P}(\mathbb{N})|\exists K\in\mathbb{N},\forall K<n\in\mathbb{N},n\in A\}$ (i.e. $\mathscr{A}(\mathbb{N})$ is the set of all subsets of $\mathbb{N}$ that contain a neighborhood of $\infty$ that consists only of natural numbers, which we may call from now on succinctly a natural neighborhood of $\infty$).

NEW DEFINITION (1): Limit of a Sequence
Let $A\in\mathscr{A}(\mathbb{N})$ be some subset of $\mathbb{N}$ that contains a natural neighborhood of $\infty$,
(i.e. $A\in\mathscr{P}(\mathbb{N})$ is some subset of the natural numbers for which
  $\exists K\in \mathbb{N}, \forall K<n\in \mathbb{N}, n \in A$)
And let $\{x_n\}_{n\in A}$ be some sequence of real numbers defined
  on $A$,
(i.e. $x$ is a function $x:A\to\mathbb{R}$),
And let $L\in\mathbb{R}$ be some real number,
We say that:
$lim_{A\ni n\to\infty}x_n=L$
if and only if
$\forall 0 < \epsilon \in\mathbb{R} ,\exists N\in\mathbb{N}, \forall N<n\in A, |x_n - L| < \epsilon $

Now we'll prove the following theorem:

THEOREM (2): The limit (if exists) is independent of the underlying set
Let $A_1\in\mathscr{A}(\mathbb{N})$ be some subset of $\mathbb{N}$ that contains a natural neighborhood of $\infty$,
(i.e. $A_1\in\mathscr{P}(\mathbb{N})$ is some subset of the natural
  numbers for which $\exists K_1\in \mathbb{N}, \forall K_1<n\in\mathbb{N}, n\in A_1$)
Let $A_2\in\mathscr{A}(\mathbb{N})$ be some subset of $\mathbb{N}$ that contains a natural neighborhood of $\infty$,
(i.e. $A_2\in\mathscr{P}(\mathbb{N})$ is some subset of the natural
  numbers for which $\exists K_2\in \mathbb{N}, \forall K_2<n\in\mathbb{N},n\in A_2$)
Let $\{x^1_n\}_{n\in A_1}$ and $\{x^2_n\}_{n\in A_2}$ be two sequences
  defined on $A_1$ and $A_2$ respectively such that $\forall n\in A_1\cap A_2,x^1_n = x^2_n$.
(i.e. $x^1$ and $x^2$ are two functions: $x^1:A_1\to\mathbb{R}$ and
  $x^2:A_2\to\mathbb{R}$),
And let $L\in\mathbb{R}$ be some real number,
Then:
$\lim_{A_1\ni n\to\infty}x^1_n = L $ if and only if $\lim_{A_2\ni n\to\infty}x^2_n = L$

Proof:
Suppose that $\lim_{A_1\ni n\to\infty}x^1_n = L $ and we'll prove that $\lim_{A_2\ni n\to \infty}x^2_n = L$:
Let $0<\epsilon \in \mathbb{R}$ be some positive real number, Then because $\lim_{A_1\ni n\to\infty}x^1_n = L $, We get by Definition (1) that $\exists N_1\in\mathbb{N},\forall N_1<n\in A_1,|x^1_n-L|<\epsilon$.
Now take $N_2 = max(N_1,K_1)$, Because $N_1,K_1\in\mathbb{N}$ we get that $N_2\in\mathbb{N}$ as $N_2$ is the maximum of two natural numbers and thus must be also a natural number.
Now we'll prove that:
$\forall N_2<n\in\ A_2,|x^2_n-L|<\epsilon$
Let
$N_2 < n\in A_2$,
Now since $N_1,K_1 \leq N_2$
 (as $N_2$ is the maximum of both of those two numbers),
 We get that $N_1, K_1<n$,
Also since
$A_2\subseteq \mathbb{N}$
we get that $n\in\mathbb{N}$,
And so $N_1, K_1<n\in \mathbb{N}$,
Now since it known that
$\forall K_1<n\in \mathbb{N},
n \in A_1$,
we get that for this particular $n$, $n\in\ A_1$ and thus
$n\in A_1\cap A_2$,
And we can conclude by the fact
 $\forall n\in A_1 \cap A_2, x^1_n = x^2_n$
that for this particular $n$, (I) $x^1_n=x^2_n$ .
Also since it is known that $\forall N_1<n\in A_1,|x^1_n-L|<\epsilon$
we can conclude that  for this particular $n$, (II) $|x^1_n-L|<\epsilon$, And, Now by substituting (I) into (II) we get that $|x^2_n-L|<\epsilon$.
Thus we have shown that $\forall 0<\epsilon\in\mathbb{R},\exists N_2\in\mathbb{N},\forall N_2<n\in A_2,|x^2_n-L|<\epsilon$ and we can concluded by Definition (1) that $\lim_{A_2\ni n\to \infty}x^2_n = L$ as was to be shown.
The proof of the other direction (i.e. that if $\lim_{A_2\ni n\to \infty}x^2_n = L$ then $\lim_{A_1\ni n\to\infty}x^1_n = L $) is similar and thus will not be shown.
Q.E.D.

Now we'll prove the following immediate corollary of the theorem just proved:

COROLLARY (3): The limit (if exists) for one subset of $\mathbb{N}$ that contains a natural neighborhood of $\infty$, is the
  same for all subsets of the subset that contain a natural neighborhood of $\infty$, And the limit
  (if exists) for one subset of $\mathbb{N}$ that contains a natural neighborhood of $\infty$ is
  the same for all subsets of $\mathbb{N}$ that include the subset
Let $A_1,A_2\in\mathscr{A}(\mathbb{N})$ be some subsets of $\mathbb{N}$ that contain a natural neighborhood of $\infty$,
such that $A_2\subseteq A_1$.
Let $\{x^1_n\}_{n\in A_1}$ and $\{x^2_n\}_{n\in A_2}$ be two sequences
  defined on $A_1$ and $A_2$ respectively such that $\forall n\in A_2, x^1_n = x^2_n$.
And let $L\in\mathbb{R}$ be some real number, Then:
$\lim_{A_1\ni n\to\infty}x^1_n = L $ if and only if $\lim_{A_2\ni n\to\infty}x^2_n = L$

Proof:
Since $A_2\subseteq A_1$, We have that $A_1\cap A_2 = A_2$, And thus we can conclude from the fact $\forall n\in A_2, x^1_n = x^2_n$ that $\forall n\in A_1\cap A_2, x^1_n = x^2_n$, And therfore all the conditions of THEOREM (2) are satisfied and we can conclude that $\lim_{A_1\ni n\to\infty}x^1_n = L $ if and only if $\lim_{A_2\ni n\to \infty}x^2_n = L$ as was to be shown.
Q.E.D.

Now we can state the following theorem which can be proved in a similar way to the original theorem as given in standard anlysis books:

THEOREM (4): Limits of Sequences under Arithmetic Operations:
Let $A_1,A_2\in\mathscr{A}(\mathbb{N})$ be some subsets of $\mathbb{N}$ that contain a natural neighborhood of $\infty$,
Let $\{x_n\}_{n\in A_1}$ and $\{y_n\}_{n\in A_2}$ be two sequences
  defined on $A_1$ and $A_2$ respectively.
And let $X_1,X_2\in\mathbb{R}$ be two real numbers such that
  $lim_{A_1\ni n\to\infty}x^1_n=X_1$ and $lim_{A_2\ni n\to\infty}x^2_n=X_2$ then the following are true:

$lim_{A_1\cap A_2\ni n\to\infty}(x^1_n+x^2_n)=X_1+X_2$
$lim_{A_1\cap A_2\ni n\to\infty}(x^1_n-x^2_n)=X_1-X_2$
$lim_{A_1\cap A_2\ni n\to\infty}(x^1_n\times x^2_n)=X_1\times X_2$
If in addition $\forall n\in A_2, x^2_n \neq 0$ and $X_2\neq 0$ then $lim_{A_1\cap A_2\ni n\to\infty}(\frac{x^1_n}{x^2_n})=\frac{X_1}{X_2}$

Now we'll prove a trivial theorem that claims that if the limit in the definition above exists, then the limit in the original definition given in analysis books exists:

THEOREM (5): If the limit of seqeunce according to DEFNITION (1) exist then the limit of sequence according to the standard definition
  given in standard analisys books also exist and both limits agree
Let $A\in\mathscr{A}(\mathbb{N})$ be some subset of $\mathbb{N}$ that contains a natural neighborhood of $\infty$,
And let $\{x_n\}_{n\in A}$ be some sequence of real numbers defined
  on $A$,
And let $L\in\mathbb{R}$ be some real number,
Then:
If $lim_{A\ni n\to\infty}x_n=L$
Then also $lim_{n\to\infty}x_n=L$

Proof:
We must prove that: $\forall 0 < \epsilon \in\mathbb{R} ,\exists N\in\mathbb{N}, \forall N<n\in \mathbb{N}, |x_n - L| < \epsilon $:
Let $ 0 < \epsilon \in\mathbb{R}$ be some positive real number, Because $A\in\mathscr{A}(\mathbb{N})$ we get that:
(I) $\exists K\in\mathbb{N},\forall K<n\in\mathbb{N},n\in A$,
Now since  $lim_{A\ni n\to\infty}x_n=L$ we get by DEFINITION (1) that
(II) $\exists \hat{N}\in\mathbb{N},\forall \hat{N}<n\in\ A, |x_n-L|<\epsilon$,
Now let $N=max(K,\hat{N})$, Then clearly $N\in\mathbb{N}$ and $K,\hat{N}\leq N$,
Now we'll prove that $\forall N<n\in\mathbb{N},|x_n-L|<\epsilon$:
Let $N<n\in\mathbb{N}$, Then $K<n$ and thus by (I) we get that $n\in A$, And, Now since $\hat{N}<n$ and since we've shown that $n\in A$, By (II) we get that $|x_n-L|<\epsilon$.
Thus we've shown that $\forall 0 < \epsilon \in\mathbb{R} ,\exists N\in\mathbb{N}, \forall N<n\in \mathbb{N}, |x_n - L| < \epsilon $ and we can conclude that $lim_{n\to\infty}x_n = L$ as was to be shown.
Q.E.D.

Now, After all this theory, We can by using THEOREM (4) calculate limits like the ones below more rigorously:
EXAMPLE 1:
Show that $lim_{ n\to\infty}(\frac{n + 1}{n - 1}) = 1$

ANSWER:
By observing that:
$lim_{\mathbb{N}\ni n\to\infty}(1+\frac{1}{n}) = 1$
And that:
$lim_{\mathbb{N}\ni n\to\infty}(1-\frac{1}{n}) = 1$
Since $\mathbb{N}_{\geq 2} \subset \mathbb{N}$, We can conclude by COROLLARY (3) that:
$lim_{\mathbb{N}_{\geq 2}\ni n\to\infty}(1-\frac{1}{n}) = 1 \neq 0$,
Also since $\forall n\in\mathbb{N}_{\geq 2}, 1-\frac{1}{n} \neq 0$, We can conclude by PART 4. OF THEOREM (4) that $lim_{ n\in\mathbb{N}\cap\mathbb{N}_{\geq 2}\ni n\to\infty} \frac{1+\frac{1}{n}}{1-\frac{1}{n}} = \frac{1}{1} = 1$, But since $\mathbb{N}_{\geq 2} \subset \mathbb{N}$ we can conclude that $\mathbb{N}\cap\mathbb{N}_{\geq 2}=\mathbb{N}_{\geq 2}$, And thus:
$lim_{\mathbb{N}_{\geq 2}\ni n\to\infty} \frac{1+\frac{1}{n}}{1-\frac{1}{n}} = 1$,
But since $\forall n\in\mathbb{N}_{\geq 2},  \frac{1+\frac{1}{n}}{1-\frac{1}{n}} = \frac{n+1}{n-1}$ We can conclude that:
$lim_{\mathbb{N}_{\geq 2}\ni n\to\infty} \frac{n+1}{n-1} = 1$, And now by using THEOREM (5) we get that $lim_{n\to\infty} \frac{n+1}{n-1} = 1$ as was to be shown.

EXAMPLE 2:
Show that $lim_{n\to\infty}\frac{3n^2+n-1}{5n^3-2n^2+n-4} = 0$

ANSWER:
Let $B\in\mathscr{P}(\mathbb{R})$ be defined as $B=\{x\in\mathbb{R}|5x^3-2x^2+x-4=0\}$, By the Fundamental Theorem of Algebra, This set have at most $3$ elements (i.e. $0\leq |B| \leq 3$).
Now, Define $A\in\mathscr{P}(\mathbb{R})$ as $A = \mathbb{N}-B$, It is clear that $\exists K\in \mathbb{N},\forall K<n\in \mathbb{N}, n\in A$, since $B$ includes only a finite number of elements or none at all.
(Just take $K=1$ if $B=\emptyset$, or choose any $K\in\mathbb{N}$ that satisfy $max(B)<K$ if $B\neq \emptyset$), And thus $A\in\mathscr{A}(\mathbb{N})$.
Now, Define two sequences $\{x_n\}_{n\in A}$ and $\{y_n\}_{n\in A}$
such that $\forall n\in A, x_n \triangleq \frac{3}{n}+\frac{1}{n^2}-\frac{1}{n^3}$ and $\forall n\in A, y_n \triangleq 5 - \frac{2}{n}+\frac{1}{n^2}-\frac{4}{n^3}$. (The sequences are well defined since for all $n\in\mathbb{N}$, the denominator in each of those two sequences does not match $0$).
Now, It is clear that $lim_{A\ni n\to\infty}x_n=0$ and that $lim_{A \ni n\to\infty} y_n = 5 \neq 0$.
Also, by definition of the set $A$, we have that $\forall n\in A, y_n\neq 0$.
And thus, By using PART 4. OF THEOREM (4), We can conclude that $lim_{A\cap A \ni n\to\infty}\frac{x_n}{y_n}=0$, But since $A \cap A = A$ we can conclude that (*) $lim_{A \ni n\to\infty}\frac{x_n}{y_n}=0$
Now since it can be shown that $\forall n\in A, \frac{3n^2+n-1}{5n^3-2n^2+n-4} = \frac{x_n}{y_n}$, We can conclude by (*) that
$lim_{A \ni n\to\infty}\frac{3n^2+n-1}{5n^3-2n^2+n-4}=0$ and by using THEOREM (5) we can conclude that $lim_{n\to\infty}\frac{3n^2+n-1}{5n^3-2n^2+n-4}=0$ as was to be shown.
Answer: When we speak about the limit of a sequence, only terms $u_n $ with $n $ enough great will be taken into account. The nature of a sequence and its limit (if it exists) do not change if we modify a finite number of terms.
In the first theorem, the property 4 should be
If for $n $ large enough, $y_n\ne 0$ and $y_\to Y\ne 0$ then
$x_n/y_n\to X/Y $.


How can I deliver closed captions in a live RTMP stream?

Question: In Adobe Media Server 5.0.1, Adobe introduced support for embedding EIA-608/708 closed captioning data inside a video stream for delivery to a client.
To obtain these captions, AMS can extract data from the ATSC Picture User Data, a timed text track, or AMF message sent alongside the video stream.
While this is great in theory, I'm having a difficult time figuring out how one would actually make it work in practice -- namely, what live media encoders will actually preserve ATSC captioning data and pass it along to the server (or pass caption data as an AMF message in the RTMP stream).
What solutions are folks actually using to caption live webcasts?
Answer: The Elemental Live and the Inlet Spinnaker/Cisco Media Processor encoders are currently being used in live production to do this. They use OnCuePoint and/or onCaptionInfo to deliver captions in the RTMP streams.
Comment: Welcome to SO!  When answering a question, it is always a good idea to provide links (if any) to supporting data/examples for the OP.  Are there any to be had for this?


View won't render any content/teaser, only shows fields

Question: I'm having a couple of articles which I want to display in a view. So I've set up a new view and made the following setting there:
Format: Unordered List | [default settings]
Show: Content | Full Content

All other settings remain untouched as default.
In the views-preview it is displayed nicely, but the whole view doesn't show up on the page when browsing to the path.
I've also tried
Show: Content | Teaser
Show: Rendered entity | Full Content

with no luck.
Only if I set the view to
Show: Fields

the view is displayed.
The article node pages are being displayed without a problem.
I'm working with views for years now, and never had such a problem.
Any ideas where the problem is?
Thanks, Marc
Comment: Can you check if you have any custom views template which is causing this issue?
Comment: Bharat: I'm not using any views template overrides.
Comment: Do you have any template for full content  view mode? Can you try to change the view mode from full content to teaser or something else?
Comment: Do you mean in the node's display settings? Yes, there is a display for full and teaser, each has fields to display.
Answer: check if this view did not get somehow to disabled list... go views list it's divided into Enabled and Disabled lists check there...
Comment: Forey Vitaliy: Its active. It even shows the views title, but no content on the page.


Partial Sum Not Equal to Sum Of n terms

Question: I was watching some lessons on Khan Acacemy and there was a section on partial sums https://www.khanacademy.org/math/ap-calculus-bc/bc-series-new/bc-10-1/v/term-from-partial-sum
It was stated that given $S=\sum_{n=1}^{\infty}a_{n} $,
The partial sum defined as $S_{n}=\frac{n^{2}-3}{n^{3}+4}$
Will give the the sum of 1 through n terms of $a_{n}$
$S_{n}=a_{1}+a_{2}+...+a_{n-1}+a_{n}=\frac{n^{2}-3}{n^{3}+4}$
$\sum_{n=1}^{6}a_{n}=a_{1}+a_{2}+a_{3}+a_{4}+a_{5}+a_{6}=S_{6}$
$S_{6}= \frac{6^2-3}{6^3+4}=\frac{33}{220} = \sum_{n=1}^{6}a_{n}=\frac{33}{220}$
The problem I have is that when I try to test these methods out on another problem, we reach a false conclusion.
Given the following problem:
The nth partial sum of the series $\sum_{n=1}^{\infty}a_{n}$ is given by $S_{n} = \frac{n+1}{n+10}$
Write a rule for $a_{n}$
The approach taken is $a_{n} = S_{n} - S_{n-1} = \frac{9}{n²+19n+90}$
So if $\sum_{1}^{\infty}\frac{9}{n^2+19n+90}$, then I expected
$\sum_{1}^{6}a_n = S_{6}$
but...
$\sum_{1}^{6}\frac{9}{n^2+19n+90} ≠ \frac{(6)+1}{(6)+10}$
$.3375 ≠ .4375$
I've reduced this down to.
1) The false conclusion reached via testing is correct and the given partial sum rule rule is wrong.
2) I misunderstood what was asserted about comparing $S_{n}$ to $\sum_{1}^{n}$ and I'm testing a broken assumption.
3) The partial sum rule is correct and I messed up a step somewhere
What is wrong here, and why?
Comment: Note that if you calculate $\sum_{k=1}^6 (S_k - S_{k-1})$, this is actually equal to
$$
(S_{1} - S_{0}) +
(S_{2} - S_{1}) +
(S_{3} - S_{2}) + \ldots
+
(S_{5} - S_{4}) +
(S_{6} - S_{5})
$$
which is $S_6 - S_0 \neq S_6$
Answer: Note that $a_n=S_n-S_{n-1}$ only for $n\ge2$ since $S_p$ is defined only for $p\ge1$. Further, $a_1=S_1=2/11$. This$$a_n=\begin{cases}\frac9{(n+9)(n+10)},&n>1\\\frac2{11},&n=1\end{cases}$$and$$S_6=2/11+\sum_{n=2}^6\frac9{n^2+19n+90}=\frac7{16}$$which resolves the disparity.
Comment: Thanks for the concise explanation!
Comment: @NickFleischhauer You are welcome. If you are satisfied with my answer, consider accepting it by pressing the 'tick' mark on the left.
Comment: I know this is like a super duper old post, but I just realized that I never clicked the 'tick' to accept your answer. I've done that now!
Comment: Ok, thanks. @Nick
Answer: $$S_n:=\sum_{k=1}^n a_k$$
and
$$S_n-S_{n-1}=a_n$$
only hold for $n>1$. For $n=1$, we simply have
$$S_1=a_1.$$
With your second example,
$$a_n=\frac9{(n+9)(n+10)}$$ but $$a_1=\frac{1+1}{1+10}\ne\frac9{(1+9)(1+10)}.$$

Said differently,
$$S_n=\frac{n+1}{n+10}$$ cannot hold with $n=0$, because the sum is void and
$$S_0=0.$$

Partial Sum Not Equal to Sum Of n terms


Pull data from MySQL into JSONArray (with PDO!)

Question: I was reading something on the Internet and many people say that it's recommended to switch to PDO from old mysql (and mysqli) extensions.
I'm new with this PDO, I learned something about it.
For my problem I tried to search stackoverflow, Google, etc, but it didn't helped me.
Original script with mysqli :
<code>$data = mysqli_query($con, "SELECT x1, x2, x3, x4 FROM Table1 WHERE x1 = $variable1");
$row = mysqli_fetch_row($data);
$result_data = array(
  'data1' => $row[0],
  'data2' => $row[1]
 );

echo json_encode($result_data);
</code>
This code outputs something like this :
<code>{"data1", 1, "data2", 2}
</code>
I tried to change it with this PDO code :
<code> $STH = $DBH->prepare("SELECT x1, x2, x3, x4 FROM Table1 WHERE x1 = ?");
 $STH->bindParam(1, $variable1);
 $STH->execute();
 $row = $STH->fetchAll();

 $result_data = array(
    'data1' => $row[0],
    'data2' => $row[1],
 );

  echo json_encode($result_data);
</code>
This back me something very strange like
<code>{"data1", 1, 2, 1, "data2", 1, "data2"}, data1 null, data2 null
</code>
It should back like with original mysqli script...
I tried with multiple fetch modes like assoc, num, column, what I was found on Internet, but result was very similar and I always get this error :

Notice:Undefined offset: 1 in

What can be the problem, how to fix it?
Answer: <code> $STH = $DBH->prepare("SELECT x1 data1, x2 data2 FROM Table1 WHERE x1 = ?");
 $STH->execute([$variable1]);
 echo json_encode($STH->fetchAll(PDO::FETCH_ASSOC));
</code>


Why is $P$ diagonizable?

Question: $$
   \begin{bmatrix}
     1 & 1 & 1\\
     0 & -1 & -2\\
     0 & 0 & 1\\
    \end{bmatrix}\\
$$
Since $P$ is upper triangular, the eigenvalues are $1$, $1$ and $-1$.
So the eigenspace of $E(-1)$ is necessarily one-dimensional.
Calculations give that an eigenvector for the eigenvalue $1$ is $(0, 1, -1)$. It does not have two distinct eigenvectors.
Have I missed something?
Help is greatly appreciated.
Comment: Also $\;(1,-1,1)\;$ is an eigenvector for the eigenvalue $\;1\;$ ....and please do try to learn the easy directions to correctly type mathematics in this site.
Comment: I think you missed a free variable in your eigenspace for1
Answer: I don't know what "calculations" you're referring to, but the eigenspace associated with the eigenvalue $1$ is $E(1)=\operatorname{Ker}(P-I_3)$, and
$$P-I_3=\begin{pmatrix}0&1&1\\0&-2&-2\\0&0&0\end{pmatrix}$$
the rank of which is clearly $1$ hence, by the rank–nullity theorem,
$$\dim E(1)=3-1=2=\text{multiplicity of the eigenvalue $1$}.$$
Answer: $P$ is diagonalizable $\iff$ $P=V.D.V^{-1}$ where $V$ is the transpose of the EigenVectors matrix, $D$ is the diagonal matrix of eigenvalues and $\det(V)\neq0$ (non-singular).
Eigenvalues associated with $P$ are $(-1,1,1)$ and Eigenvectors $\{(-1, 2, 0), (0, -1, 1), (1, 0, 0)\}$. Note that eigenvalue $\lambda=1$ has two associated vectors
Then transpose Eigenvectors matrix is:
$V^{T} = \begin{pmatrix}-1&0& 1 \\ 2&-1&0  \\ 0&1&0\end{pmatrix}$ whichs is non-singular.
$D = V^{-1}PV = \begin{pmatrix}-1&0&0 \\ 0&1&0  \\ 0&0&1\end{pmatrix}$ as you can see eigenvalues are located in the diagonal
Then we know that $P$ can be expressed as $P = VDV^{-1}$

Why is $P$ diagonizable?


understanding weird output of printf function

Question: According to me
int a=0;
printf("%d",a);

works same as
char *ptr="%d"

ptr points to % and then ptr reads the whole string from % and 4 bytes  are read from memory.
Now consider the below code
printf("%d"+1,a);  //value of a=0

is same as
char *ptr="%d"
ptr+=1;

ptr now points to d and so string from d is printed
Now
printf(1+"Alex"); //prints lex

ptr points l and prints string from there on....
Now what will happen in the following cases?It appears to be out of my scope.

printf("%",a);
printf("%%%%");
printf("%%d",a);
Answer: printf("%",a); does not have a valid conversion specifier, so it is covered by:
§188.8.131.52

9 If a conversion specification is invalid, the behavior is
  undefined. If any argument is not the correct type for the
  corresponding conversion specification, the behavior is undefined.

printf("%%%%"); will simply print %%, since %% is a conversion specifier. See the printf man pages.

%
A '%' is written. No argument is converted. The complete conversion
  specification is '%%'.

As mentioned in the comments, printf("%%d",a); is probably not undefined behavior. %% becomes % and the a is ignored.
§184.108.40.206

2 The fprintf function writes output to the stream pointed to by stream,
  under control of the string pointed to by format that specifies how
  subsequent arguments are converted for output. If there are
  insufficient arguments for the format, the behavior is undefined. If
  the format is exhausted while arguments remain, the excess arguments
  are evaluated (as always) but are otherwise ignored. The fprintf
  function returns when the end of the format string is encountered.
Comment: wHat i feel for printf("%%%%");
compiler notices 1st % it went past it.....then it noticed 2nd % instead of format specifier so it printed it......now it went to 3rd % and after it went past it to notice whether there is any format specifier but it didn't notice it..... so 4th % was printed....Am i rit?
Answer: I hope that this quote from the C Standard will help you

8 The conversion specifiers and their meanings are:
% A % character is written. No argument is converted. The complete
conversion specification shall be %%.

For example
printf("%%%%");

will output
%%


facet's get_time keeps failing

Question: I have spend like one out in this example, and everytime I get the error Unable to read cin with an ios_base::iostate equal to failbit from this code:
#include "dates.h"

#include <iostream>
#include <ctime>
#include <locale>
#include <sstream>
#include <iterator>

using namespace std;

void trasnlateDate(istream&in, ostream&out){
    const time_get<char>& dateReader = use_facet<time_get<char> >(in.getloc());
    ios_base::iostate state = static_cast<ios_base::iostate>(0);
    istreambuf_iterator<char> end;

    tm t;

    dateReader.get_date(in, end, in, state, &t);

    if(state == static_cast<ios_base::iostate>(0) || state == ios_base::eofbit){
        const time_put<char>& dateWriter = use_facet<time_put<char> >(out.getloc());
        char fmt[] = "%x";
        if(dateWriter.put(out, out, out.fill(), &t, &fmt[0], &fmt[2]).failed())
            cerr << "unable to write to output stream.\n";
    }else{
        cerr << "Unable to read cin.\n";
    }
}

int main(){
    locale::global(locale(""));
    cin.imbue(locale("en_US.utf8"));
    cout.imbue(locale("de_DE.utf8"));
    trasnlateDate(cin, cout);
}

as always, gcc 4.4.3 in Ubuntu 10.4 x64
Comment: You can use `ios_base::goodbit` (or `ios::goodbit`) instead of `state == static_cast(0)`… despite being named "bit", it's a misnomer and `goodbit` is zero.
Comment: So… what input did you give it through `cin`?
Answer: I ran your sample code on a box, and until I entered the input 02/02/2005, it failed just like you said.
It looks like those leading zeros in month and day fields are necessary.
Comment: +1. According to http://www.opengroup.org/onlinepubs/9699919799/functions/strptime.html, to which the C++ Standard refers, they should not be necessary. Bug in GCC I guess. I can't report it because I can't reproduce it; I'm on Darwin…

facet's get_time keeps failing


show-csv returning no results in Aviarc

Question: I'm using show-csv to serve the results of a report to the user. When I run this query directly against the database, it returns the correct results:
SELECT *
FROM ticket
WHERE date_raised >= '2011-01-01'
AND date_raised <= '2011-06-30'
AND severity = 3
ORDER BY problem_no

But when run the query based on parameters it executes and gives me a file with no results:
<show-csv query="get-range-csv" filename="{$query.filename}">
    <param name="start-date" value="{$query.start-date}" />
    <param name="end-date" value="{$query.end-date}" />
    <param name="severity" value="{$query.severity}" />
</show-csv>

SELECT *
FROM ticket
WHERE date_raised >= {$start-date}
AND date_raised <= {$end-date}
AND severity = {$severity}
ORDER BY problem_no

Relevant screen code:
<container position="relative" height="46">
    <container left="0">
        <text-static left="0" width="80" text="Start date:" />
        <date-select field="query.start_date" left="80" />
    </container>
    <container left="210">
        <text-static left="0" width="70" text="End date:" />
        <date-select field="query.end_date" left="70" />
    </container>
</container>

Any ideas why I'm not getting any results from ?
I've run this through the debugger and the query dataset variables are set correctly when  runs.
Answer: It looks like the problem is that the screen is using start_date and end_date (with underscores) whereas the show-csv command is using start-date and end-date (with dashes).

show-csv returning no results in Aviarc


Modeling, Measuring, and Maximizing "Mixedness"

Question: Possible key-terms: combinatorial optimization techniques; simulated annealing; genetic algorithms; Kirkman's schoolgirl problem; Steiner triple systems; orthogonal regrouping.

Background: My class has $10$ students and $3$ tables; naturally, the students are distributed with $3, 3,$ and $4$ seated at the individual tables. On the second day of class, students sat in the same seats as on day one; I asked them to reseat themselves so that they could sit with new people.
Since there are $4$ students at one table and only $3$ total tables, we know by the pigeonhole principle that at least one pair of students will still be seated together after the reseating. In fact, such a reseating (only one pair of students still seated together) is attainable: the students quickly achieved as much!
Foreground: What are the natural notions of mixedness that one uses in similar scenarios for subsequent days? Asking with greater generality, suppose that there are $N$ students with their seats distributed among $k$ tables, each of which contains (on all days) $n_1, \ldots, n_k$ students, respectively, where $\sum n_i = N$.
(In the background case: $N = 10; n_1 = 3, n_2 = 3, n_3 = 4$.)

Question: What sort of literature exists on measuring how mixed up a seating arrangement is (as compared to all previous days), and how does one maximize the mixedness moving forward?

If necessary, I am okay with certain assumptions on the $n_i$; surely they should all be positive, and, at least initially, I am okay with them being assumed equal. (Though this will only be possible if $k$ divides $N$, which is not the case in my class!)
References addressing the general problem or solutions for particular cases (e.g., $10$ students at $3$ tables) would all be welcomed.
Comment: I gave a fairly practical answer to a similar question here: http://math.stackexchange.com/questions/1190591/combining-kindergardeners-in-fair-cookie-baking-groups-kirkmans-schoolgirl-p/1190729#1190729
Comment: Per your request: I think the answer lies in ergodic theory. You can search ArXiv for papers if you think someone has thought of this.
Comment: @Tad Though you refer to them as standard combinatorial optimization techniques, I have no familiarity with simulated annealing or genetic algorithms. A similar post analysis here, if you have the time and energy, would be great! (As far as the number at each table: It would be best if the students who were at the 4-table changed a fair amount, too...)
Answer: This definitely sounds like a variation on Kirkman's schoolgirl problem; the original problem had $N = 15$, $n_{1}=\dots=n_{5}=3$, and it was desired that, for seven days in succession, no two girls were "seated at the same table" twice.  For general $N = 3k+3$ (all table sizes $=3$, successive $(1/2)(N-1)$ days), solutions are given by Steiner triple systems admitting a parallelism; similar problems have been looked at for table size 4.
If you are just looking at two days, you can think of having a complete graph on $N$ vertices; now color edges red when kids sit at a table together on the first day, you will get complete graphs of size $n_{1}, \ldots, n_{k}$.  For the second day, you want to embed these subgraphs again, reusing as few edges as possible. I'm guessing you will always be able to obtain the theoretical minimum using a greedy algorithm.
Comment: Just looked up some things, it seems like some similar work has been done under the banner of "Orthogonal Regrouping", specifically in terms of classroom groups and maximizing student interaction.  All references seem to point to equal table sizes, however.  They are either trying to maximize the number of days until you have to repeat a pair of students at a table, or minimize the number of days until every pair of students have worked together.


Can this Helmholtz PDE with Robin boundary conditions be solved analytically?

Question: Consider the following Helmholtz problem in the infinite triangle $y>0,\;x>y$ with parameters $Q<0$, $0\le P<|Q|$.
$$\left\{\begin{align}
&\psi^{(2,0)}(x,y)+\psi^{(0,2)}(x,y)+E\psi(x,y)=0,\\
&\psi^{(0,1)}(x,0)-\frac Q2\psi(x,0)=0,\\
&\psi^{(1,0)}(x,x)-\psi^{(0,1)}(x,x)-\frac P{\sqrt2}\psi(x,x)=0\\
&|\psi(x,y)|<\infty.
\end{align}\right.\tag1
$$
I'm mainly interested in the solution with lowest $E$. In the case of $P=0$ it's easy to see that
$$\psi_0(x,y)=\exp\left(\frac Q2 (x+y)\right)\tag2$$
with eigenvalue
$$E=-\frac{Q^2}2\tag3$$
solves the problem. But what about $P>0$? Can $(1)$ still be solved analytically (i.e. in terms of elementary or special functions)? If not, can the solution be given in the form of an integral or a series with explicitly specified terms?
Answer: It appears that simple product of solutions for the cases of $P=0$ and of $Q=0$ gives the full solution of $(1)$. So, if we let
$$\psi(x,y)=\exp(Ax+By),$$
by analogy with $(2)$, and then solve the boundary conditions containing $P$ and $Q$ for $A$ and $B$, we'll get:
\begin{align}
A&=\frac Q2+\frac P{\sqrt2},\\
B&=\frac Q2.
\end{align}
The eigenvalue will then be
$$E=-\frac{P^2+PQ\sqrt2+Q^2}2.$$
And the final eigenfunction is
$$\psi(x,y)=\exp\left(\frac P{\sqrt2}x+\frac Q2(x+y)\right).$$


Awk script vs shell command - different results?

Question: First thing - sorry for a bit misleading title, not sure how to describe this yet.
Basically, I have a list of keywords and I want to fetch the number of documents google returns per query. I have created the following awk script:
{
    x = ""
    for(i=1;i<=NF;i++) {
        if(i==NF) {
            x = x $i
        } else {
            x = x $i "+"
        }
    }
    tab = "777" # id of an existing chrome tab as reported by 'chrome-cli list tabs'
    system("chrome-cli open http://www.google.com/search?hl=en\\&q="x" -t " tab)
    system("chrome-cli source -t " tab " | grep '
About .* results<nobr>' | head -1 | sed -e 's/.*>About \(.*\) results<nobr>.*/\1/' | awk '{print $1\"\t"x"\"}' >> freq.log " );
    system("cat freq.log" );
    system("sleep 0.5");
}

What happens here is that I firstly replace all spaces with + signs, execute chrome-cli command to open chrome at that particular window, download source code and parse the number between "About" and "results" strings out and append the result to freq.log. This, however, outputs the following string into the file (for term alarm):
"})();</script><div alarm"

When I execute the same command from iOS terminal, I get a correct number (returns 127.000.000):
chrome-cli source -t 777 | grep  '
About .* results<nobr>' | head -1 | sed -e 's/.*>About \(.*\) results<nobr>.*/\1/'

So my problem basically is that while everything works correctly from the terminal, as soon as I move my code to awk and execute it using a call to system, something breaks and regex doesn't work anymore.
Comment: Possibly, you get different data.
Comment: Using `system()` in awk is dangerous -- security-bugs-level dangerous. Whereas in shell with a variable `$var` you can run `some-command "$var"` and be *absolutely certain* that for any possible value that variable may have -- even if maliciously crafted -- it can't be parsed as anything but an argument, when you use string concatenation to form a shell command it's intrinsically able to escape its quoting and become syntax. Consider a `tab` literal value of `$(rm -rf ~)'$(rm -rf ~)'` as an instructive example -- one form or the other will fire no matter the surrounding quoting type.
Comment: See the warning [in the Python subprocess documentation](https://docs.python.org/2/library/subprocess.html#frequently-used-arguments) about `shell=True` -- the exposure you have here is effectively identical.
Answer: You've properly escaped " in your system commands, but it looks like you haven't escaped the \ in your sed command.  By the time it reaches sed, \( is being seen as a plain (.
Try changing your system statements to print and you'll see what I mean.
Worst case scenario, you can bundle the series of system commands into a shell script and have awk call it instead... but in that case, you might as well entirely use shell scripting instead of awk.


Imagem nao rotaciona

Question: Possuo uma galeria de imagens da seguinte forma:
https://i.stack.imgur.com/Tgb4r.jpg
Porém se perceberem a imagem "CastanhaF" esta virada para direita, ela foi postada reta no servidor porem está virando sozinha ao executar a página.
Estou usando o seguinte código HTML:

Código CSS:
* {
    box-sizing: border-box;
}

.linha {
    display: flex;
    flex-wrap: wrap;
    padding: 0 4px;
}

/* Create four equal columns that sits next to each other */
.coluna {
    flex: 25%;
    max-width: 25%;
    padding: 0 4px;
}

    .coluna img {
        margin-top: 8px;
        vertical-align: middle;
    }

/* Responsive layout - makes a two column-layout instead of four columns */
@media screen and (max-width: 800px) {
    .coluna {
        flex: 50%;
        max-width: 50%;
    }
}

/* Responsive layout - makes the two columns stack on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
    .coluna {
        flex: 100%;
        max-width: 100%;
    }
}

No Html da referida imagem eu tentei colocar a propriedade transform: rotate(90deg) aparentemente deu certo, porem como eu redimensiono a tela para uma tela maior a imagem começa a fica em cima de outra, como posso resolver isso ?
Comment: Com CSS a única forma de resolver é fazendo gambiarra, o correto é saber pq a imagem está vindo Rotacionada do banco...
Comment: Não está vindo do banco, está fixa dentro de uma pasta e nessa pasta ela está reta....
Answer: Defina seu CSS como:
#tamanho{
    height: 100%;
    width: 100%;
}

e sua tag img com o id="tamanho":

Comment: ela rotaciona porém "quebra" como disse no post, ficando dessa maneira: https://imgur.com/a/pmvlV3r
Comment: removo o rotate?
Comment: Sim, remove.. teria como enviar o projeto zipado? fica mais fácil para editar..

Imagem nao rotaciona


Find the center of mass R:

Question: Let R be a solid with a constant density, determined by the three inequalities
$
5-x^2-y^2 \geq z,  x^2+y^2-(z+1)^2 \leq 0 ,  z \geq 0
$
Find the center of mass of R.
Can anyone tell me how to integral over that domain?
Comment: You might want to consider cylindrical coordinates. This is going to take a triple integral, which usually acts like nested integrals where the bounds are related to the variables of the next integral. In this case you want to integrate the density (d) over a series of regions. But putting those regions in cylindrical (or possibly spherical) coordinates could help make the bounds come out more clearly.
Answer: EDIT: Misread the question, my bad.  The below is for finding the mass.
Consider a transform to cylindrical coordinates. (x,y,z) goes to (r, $\theta$, z).
So now our relations are: $ 5 - r^2 \geq z, r^2 - (z+1)^2 \leq 0, z \geq 0$
Thus, we need to determine what the bounds for r are. The bounds for $\theta$ are 0 to $2*\pi$ because we have circular symmetry.
We can conclude that $r \leq z+1$ because z must be non-negative. By substitution,
$r \leq 5 - r^2 +1 = 6 - r^2$ Since $r^2 +r \leq 6$ we must conclude (by quadratic formula) that $r \leq 2$.
Let P be the density.
Now we need $\int_0^{2*\pi} \! \int_0^2 \! \int_0^{r-1} \! P \, \mathrm{d}z \, \mathrm{d}r \, \mathrm{d}\theta$. Since P is not dependent on anything, we get $\int_0^{2*\pi} \! \int_0^2 \! P*(r-1) \, \mathrm{d}r \, \mathrm{d}\theta$ = $\int_0^{2*\pi} \! P*(\frac{r^2 , 2} - r)\, \mathrm{d}\theta = 2*\pi * P*(\frac{r^2 , 2} - r)$
Comment: Don't forget the Jacobian $r$ in the integral.
Answer: Since we have a constant density it will not come into the centre of mass calculation and we may take it as $1$.
By drawing a diagram you can see that to integrate in cylindrical coordinates we will have to split the integral into two parts:
$$0\le r\le1\,,\ 0\le z\le 5-r^2\quad\hbox{and}\quad
  1\le r\le2\,,\ r-1\le z\le 5-r^2\ .$$
So, calculate the mass
$$M=\int_0^{2\pi}\int_0^1\int_0^{5-r^2} r\,dz\,dr\,d\theta+
  \int_0^{2\pi}\int_1^2\int_{r-1}^{5-r^2} r\,dz\,dr\,d\theta\ ,$$
and then the $z$-coordinate of the centre of mass is
$$\overline z=\frac{1}{M}\Bigl(\int_0^{2\pi}\int_0^1\int_0^{5-r^2} zr\,dz\,dr\,d\theta+
  \int_0^{2\pi}\int_1^2\int_{r-1}^{5-r^2} zr\,dz\,dr\,d\theta\Bigr)\ .$$
If you carefully consider the shape of the solid, you should be able to write down $\overline x$ and $\overline y$ without calculation.
Comment: That is a very clear explanation.

Find the center of mass R:


PHP isset not working after jQuery Post

Question: I'm trying to make a voting system where users can vote as many times as they want, and it will update the vote # (without refreshing) every time they click the vote button.
My problem is that when I try to do a $.post call (I've tried the other methods to), the variable isn't getting set (I think), SO nothings getting queried to my database whenever I click.
Here's the code:
List.php
<?php

    //Require login file -- Fatal error if not found
    require_once('login.php');

    //Connect w/ MySQL database  [login variables]
    $con = new mysqli($hn, $un, $pw, $db);

    //If connection error -> kill application and display error
    if ($con->connect_error) die('Connect Error (' . $con->connect_error . ') '. $con->connect_error);

    if (isset($_POST)) {

    }

    //heading
    echo <<<_END
        <!DOCTYPE html>

            <title>Testing</title>

            <link type="text/css" rel="stylesheet" href="Style.css">

            <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/rateYo/2.0.1/jquery.rateyo.min.css">

_END;

    //retrieve databse items
    $query = "SELECT * FROM items ORDER BY difficulty DESC";
    $result = $con->query($query);
    if (!$result) die($con->error);

    $rows = $result->num_rows;

    //display items
    for ($j = 0; $j < $rows; ++$j) {
        $result->data_seek($j);
        $row = $result->fetch_array(MYSQLI_ASSOC);

        //random color
        $rand = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
        $color = '#'.$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)];

        echo '

'.$row['goal'].'
';
        echo '
'.$row['votes'].' votes up
';
        echo '
Difficulty: '.$row['difficulty'].'

';

    }

    echo <<<_END

_END;

    //closing tags
    echo <<<_END

_END;

    //close connection
    $result->close();
    $con->close();

    function get_post($conn, $var) {
        return $conn->real_escape_string($_POST[$var]);
    }

?>

ajaxvote.php
 <?php
require_once('login.php');

  //Connect w/ MySQL database  [login variables]
  $con = new mysqli($hn, $un, $pw, $db);

  //If connection error -> kill application and display error
  if ($con->connect_error) die('Connect Error (' . $con->connect_errno . ') '. $con->connect_error);

  if (isset($_POST['postid'])) {
    $postId = $con->real_escape_string($_POST['postid']);

    echo '';

    # query into db table to know current voting score
    $query = "SELECT votes FROM items WHERE id = '$postId' LIMIT 1";
    $result = $con->query($query);
    if(!$result) echo "INSERT failed: $query
" . $con->error . "

";

    # increase or dicrease voting score
    if ($con->fetch_array($result)) {
      $data = $con->fetch_array($result);
      $vote = ++$data['votes'];

      # update new voting score
      $con->query("UPDATE items SET votes = '$vote' WHERE id = '$postId' ");

    }
  }

$con->close();
?>

Answer: I think the issue is that you are calling method fetch_array twice and the results is one row, each subsequent call to fetch_array will return the next row, get rid of fetch_array() in condition and try checking the number of results
# increase or dicrease voting score
if ($result->num_rows) {
  $data = $con->fetch_array($result);
  $vote = ++$data['votes'];

  # update new voting score
  $con->query("UPDATE items SET votes = '$vote' WHERE id = '$postId' ");

}

I hope this helps.
Comment: I appreciate the attempt, but I think the problem is that `if (isset($_POST['postid']))` is evaluating to false... I just don't know why.
Answer: Alright so I figured out the problem.
if ($con->fetch_array($result)) {
  $data = $con->fetch_array($result);

should be
if ($result->num_rows) {
  $data = $result->fetch_array(MYSQLI_ASSOC);

partial credit to @juliusbin for editing the if parameter
The other problem was that 1. I was not calling the fetch_array method on a query I was calling it on the connection itself and 2. I was passing the result to fetch array instead of telling it what type of an array I wanted.
This, kids, is why you don't blindly follow online coding tutorials.

PHP isset not working after jQuery Post


Cannot import certificates for EDGE while REGIONAL is active

Question: I am trying to use a certificate issued in eu-central-1 for my apigateway which is regional and works in the same region.
My terraform code is as follows:
//ACM Certificate

provider "aws" {
  region = "eu-central-1"
  alias = "eu-central-1"
}

resource "aws_acm_certificate" "certificate" {
  provider = "aws.eu-central-1"
  domain_name       = "*.kumite.xyz"
  validation_method = "EMAIL"
}

//Apigateway

resource "aws_api_gateway_rest_api" "kumite_writer_api" {
  name = "kumite_writer_api"
  endpoint_configuration {
    types = ["REGIONAL"]
  }
}

resource "aws_api_gateway_domain_name" "domain_name" {
  certificate_arn = aws_acm_certificate.certificate.arn
  domain_name     = "recorder.kumite.xyz"
  endpoint_configuration {
    types = ["REGIONAL"]
  }
}

Unfortunately, I constantly get this error:

Error: Error creating API Gateway Domain Name: BadRequestException: Cannot import certificates for EDGE while REGIONAL is active.

What I am missing here? I think my ApiGateway is not EDGE but REGIONAL so cannot find sense to the error...
Answer: Change certificate_arn to regional_certificate_arn.
From documentation (emphasis mine):

When referencing an AWS-managed certificate, the following arguments are supported:

certificate_arn - (Optional) The ARN for an AWS-managed certificate. AWS Certificate Manager is the only supported source. Used when an edge-optimized domain name is desired. Conflicts with certificate_name, certificate_body, certificate_chain, certificate_private_key, regional_certificate_arn, and regional_certificate_name.
regional_certificate_arn - (Optional) The ARN for an AWS-managed certificate. AWS Certificate Manager is the only supported source. Used when a regional domain name is desired. Conflicts with certificate_arn, certificate_name, certificate_body, certificate_chain, and certificate_private_key.
Comment: hey @kgadek. Thanks for the answer! Can you also link the documentation?
Comment: It's the same for CloudFormation too: CertificateArn -> RegionalCertificateArn
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html
Comment: Added. For reference: currently aws provider version 3.7.0, terraform version 0.13.3.


Keydown event: problems with '@'

Question: This is the problem: I need to intercept the char @, but with jQuery and keydown event I get only the code 17.
How can I get the real code (192) with the property event.altKey = true?
This is my code. It is connected to an input field:
$(this).keydown(function(e) {
   var keycode = (e.keyCode ? e.keyCode : e.which);

   alert(e.keyCode + " - " + e.which + " - alt:" + e.altKey + " - shift:" + e.shiftKey + " - ctrl:" + e.ctrlKey);
});

This alert always shows 17 (ctrl / alt). How can I resolve this problem?
Comment: What are you trying to accomplis? Is this an input field?
Comment: Because you're alerting (blocking) on `keydown` and therefore you won't register the second key.
Comment: yes, it is connected to an input field. but i don't know how to intercept the key i need '@'...
Answer: This worked for me:  http://jsbin.com/ohucuj/edit#preview
$(function() {
  $("#thingToTest").keydown(function(e) {
    var keycode = (e.keyCode ? e.keyCode : e.which);
    if (e.shiftKey && e.which == 50) {
      $("#message").html("You pressed SHIFT+2 or @ !!!");
    }else{
      $("#message").html(e.keyCode + " - " + e.which + " - alt:" + e.altKey + " - shift:" + e.shiftKey + " - ctrl:" + e.ctrlKey);
    }
  });
});

Just test for the Shift key and the 2 key.
Comment: I'm on mac, and I use alt + 2.
Comment: I tested that with my mac, it works the same. Guess I don't use alt
Answer: I don't know what 192 id, but I found that @ is nr 64.
You can capture that with keypress event like,
$("#textfield").keypress(function(e)

if (e.which == 64)
{
    console.log('you typed "@" symbol!');
}

});

Keydown event: problems with '@'


Expected Value: Animal Cages

Question: The Happy Animals Kennel has $18$ cages in a row. They allocate these cages at random to $6$ dogs, $6$ cats, and $6$ pot-bellied pigs (with one animal per cage). All arrangements are equally likely.
Let $A$ be the number of times in the row of cages that two animals of the same species are adjacent. For example, in the arrangement DCPCDPPPDCDPCDCCPD (where D=dog, C=cat, and P=pig), we have $A=3$.
What is the expected value of $A$?
UPDATE: Oops, I forgot to include what I've got so far!  It would be almost impossible to list all of the possibilities and expected value is a new topic for me, so I'm fuzzy on the topic.
Answer: We use the Linearity of Expectations.  For $i\in \{1,\cdots,17\}$ let $X_i$ be the indicator variable telling you whether Cage $i$ contains the same animal as Cage $i+1$ (thus $X_i=1$ if the two animals match, and $0$ otherwise).  Then $E[X_i]=\frac 5{17}$ and the answer you want is $$E=E\left[\sum X_i\right]=\sum E[X_i]=17\times \frac 5{17}=5$$
Comment: Thanks for answering, lulu!
Comment: Nice approach. Nice ref! (+1)
Answer: Suppose we have  three types of animals, $A,B$  and $C.$ Construct the
generating function of strings over this alphabet classified according
to the last letter with adjacent equal letters marked. We get
$$F_A(z) - a = va F_A(z) + a F_B(z) + a F_C(z)$$
and
$$F_B(z) - b = b F_A(z) + vb F_B(z) + b F_C(z)$$
and finally
$$F_C(z) - c = c F_A(z) + c F_B(z) + vc F_C(z).$$
We are interested in
$$Q_{A,B,C} (z) =
\left.\frac{\partial}{\partial v} F_{A,B,C}(z)\right|_{v=1}.$$
We get
$$Q_A(z) = \left.aF_A(z)\right|_{v=1} + aQ_A(z)
+ a Q_B(z) + a Q_C(z).$$
and two more that are cyclic iterates. We require
$$P(z) = Q_A(z) + Q_B(z) + Q_C(z)$$
which yields by adding the cyclic iterates
$$P(z) = \frac{a^2+b^2+c^2}{1-a-b-c} + (a+b+c) P(z)$$
or
$$P(z) = \frac{a^2+b^2+c^2}{(1-a-b-c)^2}.$$
To extract the coefficient on this restrict to the number
of animals of each type being equal say $M$ to get
$$\left([a^{M-2} b^M c^M] +
[a^M b^{M-2} c^M] +
[a^M b^M c^{M-2}] \right)
\sum_{q=0}^\infty (q+1) (a+b+c)^q
\\ = 3\times (3M-1) \times {3M-2\choose M, M, M-2}.$$
With $M=6$  i.e. six animals of  each type the  expectation thus works
out to
$$\bbox[5px,border:2px solid #00A000]{
{18\choose 6,6,6}^{-1}
\times 3 \times 17 \times {16\choose 6,6,4}
= 5.}$$
The generic formula is
$${3M\choose M,M,M}^{-1} \times 3\times (3M-1)\times
{3M-2\choose M,M,M-2}
\\ = \frac{1}{3M} \times 3 \times M (M-1)$$
or
$$\bbox[5px,border:2px solid #00A000]{
M-1.}$$
Remark. Observe that we did not  in fact need to solve any systems
of equations.
Comment: Interesting approach! (+1)

Expected Value: Animal Cages


float2Int behavior for border case

Question: float2Int seems to overflow somewhere between 2^^62 and 2^^63 for 64-bit machines (I tried it on intel iMac with GHC 7.6.1). I just noticed this issue when trying to check the maxBound for Int. float2Int is implemented as a primop float2Int# in GHC.
GHCi Prompt output is below - maxBound::Int is 2^^63 on my intel mac. I also tried casting 2^^63 to Float, and then reducing the values a bit to see if the overflow goes away (to account for small rounding errors if any). It doesn't:
λ: maxBound :: Int
9223372036854775807
λ: GHC.Float.float2Int $ 2^^63 -- overflows
-9223372036854775808
λ: GHC.Float.float2Int $ (9223372036854775807::Float) -- now try actual value of 2^^63
-9223372036854775808
λ: GHC.Float.float2Int $ (9223372036854000000::Float)  -- reduce it a bit
-9223372036854775808
λ: minBound :: Int -- overflow value is same as minBound::Int
-9223372036854775808
λ: GHC.Float.float2Int $  2^^62 + 2^^61 -- works fine here
6917529027641081856

Is this overflow on 64-bit Int boundary an expected behavior? It seems to work fine until 2^^62, and overflows somewhere between 2^^62 and 2^^63. I looked up GHC trac to see if there were any reported bugs, and didn't find any. I didn't find any posts on SO either about this one.
Comment: A number theorist once said to me that people feel that big numbers are like small numbers, only bigger, but that they really really aren't.
Answer: This is all correct behavior.  First, lets clear up a minor detail:

maxBound::Int is 2^^63 on my intel mac

No, it should be (2^63) - 1.  That minus one is very important so float2Int (2^^63) should overflow.
Now how about your reductions?  Consider this:
Prelude GHC.Float.RealFracMethods> let a = 9223372036854775807::Float
Prelude GHC.Float.RealFracMethods> let b = 9223372036854000000::Float
Prelude GHC.Float.RealFracMethods> a == b
True

Floats are approximations and your reduction has not cause a material change in the Float.  The inputs so far are all equal to 2^63.
Finally,
> 2^^62 + 2^^61 < (2^^63 :: Float)
True

With your last test you found a number that, when cast as a Float, is represented as something less than 2^63, thus within the range of a 64 bit Int and resulting in your expected value.
Comment: @thomas-m-dubuisson, good point about using float equality to check for rounding error.

float2Int behavior for border case


Formatar valor para data

Question: Preciso formatar um valor para data... eu busco pelo link do valor seguinte:

20181107

No caso seria 07/11/2018, hoje. Preciso pegar esse valor e formatar no formato 2018-11-07, tentei da seguinte forma:
date('Y-m-d', strtotime('20181107'));

Porém, em alguns casos ele coloca o dia no lugar do mês, ai queria uma solução pra isso ou apenas um código que inserisse um hífen apos 4 dígitos e após 6 dígitos, seria mais simples também.
Comment: Pode dizer em que casos acontece de colocar o dia no lugar do mês? Não consegui reproduzir.
Comment: "Colocar o dia no lugar do mês"... Quem faz isso? O PHP ou o retorno da url?
Comment: Talvez não se aplique ao seu caso (não queira usar por diversos motivos), mas se tiver de lidar com datas frequentemente, talvez valha a pena dar uma olhada na biblioteca [Carbon](https://carbon.nesbot.com/docs/). Inclusive ela é a lib padrão adotada pelo Laravel.
Comment: Isso ? [Como inverter datas no PHP, independente do formato?](https://pt.stackoverflow.com/q/21774/91)
Answer: Você pode utilizar a função createFromFormat do objeto DateTime:
<?php
    echo DateTime::createFromFormat('Ymd', '20181107')->format('Y-m-d');
?>

Desta forma você consegue definir o formato de entrada, e na função format, você define o formato de saída.
Veja funcionando no Ideone.
Você também pode ver mais sobre o createFromFormat aqui.
Answer: Nicholas,
Você pode utilizar um substring comum para fazer isso, se seu caso é só formatação da string, segue abaixo:
substr("20181107",0,4)."-".substr("20181107",4,2)."-".substr("20181107",6,2)

Comment: @NicholasRuschelKrüger coloquei o código em javascript, desculpa! kkkk
ajustei para php, abs!
Comment: Chegou a testar isso que me mandou?
Comment: @NicholasRuschelKrüger Você testou e não deu certo?
Answer: Já foi respondido, mas se você preferir a maneira procedural, pode fazer assim:
$date = date_create_from_format('Ymd', '20180120');
echo date_format($date, 'Y-m-d');

As funções date_create_from_format e date_format correspondem a DateTime::createFromFormat e DateTime::format, respectivamente.

Formatar valor para data


Java checar, mostrar os valores registrados no banco de dados MySQL

Question: Preciso de ajuda estou fazendo um jogo em java e preciso de todos os registros e arquivos e etc dos player na minha tabela porem não consigo conectar com o banco de dados e muito menos verificar e exibir os valores
Ps: o tutorial do sun.java de DriverConnector não me ajudou voçês poderiam?
PSS: (executar queryes e checar as integers)
Comment: Acho que podias adicionar mais informação a tua pergunta, estás a falar num jogo desktop certo? (pois nao vais poder responder devido a reputação penso eu)
Comment: Sim Porem é completamente em java 2D mais eu só preciso criar ...                                                            int teste1 =  SELECT * player_data where uuid='japkdawdfa-dawdadd' Algo desse tipo dai em uso um void pra isso colocando entre parateses o uuid dele ou sei lá mais é daquilo que estou travado
Comment: Eu estava a preparar uma resposta mas ja que podes responder, respondo por aqui. **Usas o netbeans?** se sim já pensaste na possibilidade de usar o **Hibernate** é extremamente simples fazer a comunicação como essas query's simples
Answer: Neste site tem tudo o que você vai precisar para trabalhar com JDBC
Caelum - Bancos de dados e JDBC
Exemplo:
<code>// pega a conexão e o Statement
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/seubanco", "user", "password");
PreparedStatement stmt = con.prepareStatement("select * from contatos");

// executa um select
ResultSet rs = stmt.executeQuery();

// itera no ResultSet
while (rs.next()) {
  String nome = rs.getString("nome");
  String email = rs.getString("email")

  System.out.println(nome + " :: " + email);
}

stmt.close();
con.close();
</code>
Comment: vlw, só o primeiro que eu cliquei parece perfeito, mto obrigado..
Comment: Legal. Não esqueça de marcar a resposta como "correta".
Comment: @NilsonUehara recomendo adicionar o pedaço do código descrito no seu link aqui na resposta, porque se por algum motivo o link não estiver mais disponível a sua resposta continuará útil para todos =)
Comment: @iTSangar bem lembrado. Trecho de código adicionado.
Comment: Mais como eu crio uma connection com minha database?
Comment: @Lucas Pelo jeito você não leu o artigo desde o início, pois lá ele ensina passo-a-passo como fazer isso... de qualquer forma eu alterei o meu exemplo... veja lá.


OpenLDAP memberof overlay error: memberof_value_modify err=32

Question: I enabled the refint and memberof overlay with OpenLDAP 2.4.57, but when I create a groupOfNames I get a memberof_value_modify .. failed err=32 error. I also have syncprov enabled with a spare.
What am I doing wrong?
group addition
$ ldapadd -W -x -D cn=admin,dc=mydomain,dc=tld << EOF
dn: cn=mygroup,ou=groups,dc=mydomain,dc=tld
objectClass: top
objectClass: groupOfNames
cn: mygroup
member: cn=myüser,ou=members,dc=mydomain,dc=tld
EOF

error log
slapd: conn=132979 op=1: memberof_value_modify DN="cn=myüser,ou=members,dc=mydomain,dc=tld" add memberOf="cn=mygroup,ou=groups,dc=mydomain,dc=tld" failed err=32
slapd: <= bdb_equality_candidates: (memberOf) not indexed

configuration
$ sudo ldapsearch -Y EXTERNAL -H ldapi:/// -b cn=module{0},cn=config
dn: cn=module{0},cn=config
objectClass: olcModuleList
cn: module{0}
olcModulePath: /usr/lib/ldap
olcModuleLoad: {0}back_hdb
olcModuleLoad: {1}syncprov
olcModuleLoad: {2}memberof
olcModuleLoad: {3}refint

$ sudo ldapsearch -Y EXTERNAL -H ldapi:/// -b olcOverlay={0}memberof,olcDatabase={1}hdb,cn=config
dn: olcOverlay={0}memberof,olcDatabase={1}hdb,cn=config
objectClass: olcConfig
objectClass: olcMemberOf
objectClass: olcOverlayConfig
objectClass: top
olcOverlay: memberof
olcMemberOfDangling: ignore
olcMemberOfRefInt: TRUE
olcMemberOfGroupOC: groupOfNames
olcMemberOfMemberAD: member
olcMemberOfMemberOfAD:: bWVtYmVyT2Yg

$ sudo ldapsearch -Y EXTERNAL -H ldapi:/// -b olcOverlay={2}refint,olcDatabase={1}hdb,cn=config
dn: olcOverlay={2}refint,olcDatabase={1}hdb,cn=config
objectClass: olcConfig
objectClass: olcOverlayConfig
objectClass: olcRefintConfig
objectClass: top
olcOverlay: {2}refint
olcRefintAttribute: memberof member manager owner

Answer: Error 32 means no such object
The dn of my node was base64 encoded because it contained an accent.
With another object with a clear DN everything works fine.
$ ldapsearch -W -x -D cn=admin,dc=mydomain,dc=tld -b ou=members,dc=mydomain,dc=tld sn=Doe
dn:: Y249bXn8c2VyLG91PW1lbWJlcnMsZGM9bXlkb21haW4sZGM9dGxk
objectClass: top
objectClass: person
objectClass: inetOrgPerso
sn: Doe
givenName: John
uid: john.doe

It is the behavior defined in the RFC2849 says:
  4)  Any dn or rdn that contains characters other than those
      defined as "SAFE-UTF8-CHAR", or begins with a character other
      than those defined as "SAFE-INIT-UTF8-CHAR", above, MUST be
      base-64 encoded.  Other values MAY be base-64 encoded.  Any
      value that contains characters other than those defined as
      "SAFE-CHAR", or begins with a character other than those
      defined as "SAFE-INIT-CHAR", above, MUST be base-64 encoded.
      Other values MAY be base-64 encoded.

Everything works fine with the encoded version of the dn:
$ ldapadd -W -x -D cn=admin,dc=mydomain,dc=tld << EOF
dn: cn=mygroup,ou=groups,dc=mydomain,dc=tld
objectClass: top
objectClass: groupOfNames
cn: mygroup
member:: Y249bXn8c2VyLG91PW1lbWJlcnMsZGM9bXlkb21haW4sZGM9dGxk
EOF


How to render inside a paragraph template a specific view mode for that paragragh

Question: You may say that I should just change the display settings but in my use case I need to include 2 view modes inside one template as the mobile and desktop version of the output require very different HTML.
Is there a way to do this or do I require some preprocess function to do this?
Thanks
Answer: You could try using Twig Tweak module
{{ drupal_entity('paragraph', NUMERIC_ID, VIEWMODE_MACHINE_NAME) }}
Also see the cheat sheet  for Twig tweak, it really is a great module for frontend work!
Comment: If you are using the paragraph.html.twig template, you can use {{ paragraph.id() }} - it's described in the code documentation of that template file.
Comment: thank you very much, Do you know how to get the numeric ID of the paragraph?
Answer: This question is linked from this question. Since that question is closed, I'll answer here since I recently found something that's working (in case someone else is directed here and needs help).
My setup is like this:
Paragraph field > Paragraph Field > Some Field
I wanted to get the value of 'Some Field'. Here's how I did that:
content.field_paragraph.0['#paragraph'].getFields()['field_content_some_field'].getValue()[0]['value']

This code goes in the paragraph--some-paragraph-name.html.twig.
Hope this is able to help someone.


Add an attribute to $variables from a Controller

Question: I need to add an attribute to the body tag from a controller. Adding a body tag with hook_preprocess_HOOK() is not a problem.
/**
 * Implements hook_preprocess_HOOK().
 */
function MY_MODULE_preprocess_html(&$variables) {
  if (\Drupal::routeMatch()->getRouteName() == 'my.route') {
    $variables['attributes']['class'][] = 'my-class';
  }
}

However, I only want to add the attribute when the node object, which is already in the controller, meets a second condition which is:
if ((\Drupal::routeMatch()->getRouteName() == 'my.route') && ($this->moderationInformation->hasPendingRevision($node))) {}

I don't have $variables in the controller so how can this be done?
Comment: You didn't provide any details about the custom route, but since it points to a controller displaying a node object it should contain the node as a route parameter, see https://drupal.stackexchange.com/questions/220301/how-do-i-add-a-node-id-as-class-to-the-body-tag
Comment: It turns out we didn't have to add a body tag, which allowed for a this simple addition to the build:
    `$build += [
      '#type' => 'container',
      '#attributes' => ['class' => 'my-class'],
    ];`

Leaving the question open for now since I would still like to know how to add a body tag from the controller. Remember that we're on the controller here. A hook won't help in this case.
Comment: To further clarify, we're in the controller, which is on a route, obviously. A preprocess hook won't help because although the route has the node object, we're not on a node.
Answer: Rendered output from a controller or other page elements like blocks or menus don't have direct access to the variables of a page/html preprocess hook. You can however attach metadata to the render array which then bubbles up to the page level when rendered, for example html_head or css libraries. In your case one possible way would be to attach a placeholder to the render array of the controller, which then replaces a placeholder class in the body tag. But I still would prefer to get the node via the route parameter, see the linked topic in the first comment.
A code example how to replace a body tag class from a controller. First add a placeholder class in the preprocess hook:
/**
 * Implements hook_preprocess_HOOK() for html.html.twig.
 */
function mymodule_preprocess_html(&$variables) {
  $variables['attributes']['class'][] = 'body-placeholder-class';
}

And then attach a placeholder to the build array to replace this class from the controller:
$build['#attached'] = [
  'placeholders' => [
    'body-placeholder-class' => [
      '#markup' => 'class-replaced-by-controller',
    ],
  ],
];
return $build;


How can factor-levels be automatically chosen in R to maximize the number of positive coefficients in a regression model?

Question: I am performing simple (first-order terms) linear regression on data having several categorical variables (i.e. factors), and it is often desired that for each factor, one of the levels should add nothing to the regressand, and the other levels should add positive values to the regressand.  When I perform a regression analyses, however, I often get a lot of negative coefficients.
Is there a non-manual way of choosing which levels of a factor should be used as regressor variables in order to maximize the number of positive coefficients in the equation?  In other words, how can I get R to do this (somewhat tedious) task for me?
Comment: Find the factor with the smallest coefficient, make it the new base level, and re-run the regression (or just modify all related coefficients if all you want is their estimates).
Comment: @Seb (About the flag you raised) I believe this question should stay here because there is some statistical background.
Comment: i think this rather is a programming related question. whuber did give a noteworthy attempt.
Answer: Thanks to whuber's comment, and Seb's answer, I have put together the following function which I believe does what I want.  Hopefully it will be useful to someone.  Comments are welcome.
<code># take a dataframe, and re-level it such that the levels of the factors are
# assigned positive coefficients by lm()
# NOTE: this currently only works for model-forms that don't include
#       interaction terms.
auto_relevel <- function(df, model_form)
{
    # get list of categorical variables in df
    catvar_indices <- get_catvar_indices(df)

    # loop over categorical variables
    df_colnames <- attr(df, 'names')
    model_form_zeroicept <- paste(model_form, "- 1")
    for (i in catvar_indices) {
        catvar_name = df_colnames[i]
        all_levels = attr(df[[i]], "levels")
        temp_model <- lm(model_form_zeroicept, data=df)

        # If at least one of the levels' coefficients is less than zero, then
        # choose the one w/min coeff to be the new base-level

        # put a space after catvar_name so that it doesn't match longer level-names
        catvar_name <- paste(catvar_name, " ", sep="")
        factors <- grep(catvar_name, names(coef(temp_model)))
        coeffs <- coef(temp_model)[factors]
        # remove NA's from coeffs
        coeffs2 <- coeffs[! is.na(coeffs)]

        if (any(coeffs2 < 0)) {
            # find out where this factor is in *all_levels*
            chosen_level_name <- names(coeffs2)[which(coeffs2==min(coeffs2))]
            stripped_level_name <- unlist(strsplit(chosen_level_name," "))[2] # strip factor name
            # add an initial space (to match all_levels)
            stripped_level_name <- paste(" ", stripped_level_name, sep="")
            min_level_index <- which(all_levels == stripped_level_name)
            df[[i]] <- relevel(df[[i]], ref=min_level_index)
        }
    }

    return(df)
}
</code>
Answer: Here is an attampt of doing what you wanted.
<code> # Setting up some sample data
 require(dummies)
 df <- data.frame(categorial=rep(c(1,2,3), each=20), x=rnorm(60))
 flevels <- dummy(df$categorial)
 df$categorial <- factor(df$categorial)

 df$y=20 + df$x*3 + flevels%*%c(3,1,2) + rnorm(60)*2
</code>
I use a regression in order to obtain the minimum factor level and then reorder:
<code> # Now we start with trying to find the minimum cateogry. However, note that this does not work in every context!
 summary(helpreg <- lm(y~x+factor(categorial) - 1, data=df))

     Coefficients:
                         Estimate Std. Error t value Pr(>|t|)
     x                     2.9944     0.2334   12.83   <2e-16 ***
     factor(categorial)1  22.9640     0.4472   51.35   <2e-16 ***
     factor(categorial)2  21.0720     0.4390   48.00   <2e-16 ***
     factor(categorial)3  22.1300     0.4364   50.71   <2e-16 ***
</code>
Then I start to sort out the minimum:
<code> factors <- grep('categorial', names(coef(helpreg))) # --- replace categorial with your variable name

 minimumf <- which(coef(helpreg)[factors]==min(coef(helpreg)[factors]))
</code>
This is then releveled
<code> df$categorial <- relevel(df$categorial, ref=minimumf)
</code>
And in my case it works - probably it works for you as well....
<code> summary(lm(y~x+factor(categorial), data=df))

                           Estimate Std. Error t value Pr(>|t|)
       (Intercept)          21.0720     0.4390  48.003  < 2e-16 ***
       x                     2.9944     0.2334  12.828  < 2e-16 ***
       factor(categorial)1   1.8920     0.6341   2.984  0.00421 **
       factor(categorial)3   1.0580     0.6193   1.708  0.09310 .
</code>
Comments of course highly appreciated!
Comment: This seems to work well for data having a single categorical variable (except in the case of identical minimum coefficients) -- will this extend to cases where there are more than one categorical variable, by just releveling one variable at a time?
Comment: I think it should work - at least if they are orthogonal onto each other... the problem is that my approach with the auxiliary regression is not probable anymore due to singularities. therefore you need to run 2 regressions in advance. seperating factors will not work if the two categorial variables are correlated. i will think about an approach where both categorials are included.
Comment: Another issue I noticed with your example is that it only considers the non-base levels, since it derives the list of levels from names(coef(helpreg)), and helpreg doesn't include the base levels.
Comment: @Mark, I'm sorry but I don't quite understand your issue. I explicitly excluded the intercept (`-1`) therefore all levels *should* be included. the first regression output above features all 3 variables (but no intercept). or didn't I get your point right?
Comment: see my answer below, and how I use the `all_levels` vector.
Comment: I do not see why there is any problem with non-orthogonal categorical variables.  You should be able to make this change simultaneously in all of them.  There *will* be problems when the model includes interactions, but the question specifically rules out that contingency ("zero-order terms").
Comment: @whuber, maybe it warrants a different question, but do you have ideas on how one might approach this with a first-order model?
Comment: To answer that, Mark, I would need an explanation of what you mean by "first-order model."
Comment: I should have called it a model containing second-order interaction terms.  I mean a linear model whose terms include each level of each factor, as well as each pairwise combination of levels between differing factors.


How to Mark the Fretboard without damaging the guitar?

Question: I want to mark the fretboard, so that I can easily identify the notes of the scale. For example, I want to mark the notes of the C scale on the fretboard so that I can easily play it without trying to remember each note. How can I do this without damaging the fretboard? (for example, would putting a sticker on the fret damage the wood?)
P.S. For those who are interested, I ended up marking the fretboard with some pieces of tape. I marked the pentatonic scale and after I got the hang of things I removed the markings. (Of course I was able to only mark a scale with a specific root, but once I know one, it's the same pattern pushed along the fretboard). I didn't remove everything though, I still have the roots marked. I will remove them after I know them by heart. I didn't see any visible damage to the fretboard, but I took the risk because the guitar wasn't all that expensive and it wouldn't make sense to keep a nice guitar that I didn't know how to play.
Comment: I agree that the real solution here is to simply learn the neck of the guitar better, but maybe your guitar simply doesn't have enough in the way of markings? You can get additional [inlay stickers](https://www.inlaysticker.com/) designed for just this situation.
Answer: Simple. Don't do it. There are markings on the fingerboard that are there to help with ALL scales, not just C. It's the same syndrome as when learners write the note names on piano keys. Learning their positions is far better and not that difficult. And then you can use any guitar...  And why does everybody (else) seem to be driven to use C major as a start place on guitar. Maybe that'll spawn an interesting question!!
Answer: There are a lot of ways to learn the notes, but marking up your guitar is bad idea.

Find some blank fretboard charts, print some out, and mark up the paper instead.
Start learning to play scales. Most importantly, say/sing the notes as you play them.
When you play scales or melodies or whatever, try playing in different positions and directions. For instance, try playing on one string only. Or try playing the same thing in two different positions by shifting up the neck. Try playing diagonally up the neck rather just in the boxed scale pattern. Mix it up and, again, say and play the notes.
Use an app or something to quiz you. Musictheory.net / Tenuto have fretboard quizzing.
Even without an instrument or app of any kind you can work through any of the above mentally by visualizing it. It's a nice way to waste a few minutes while standing in line or commuting.
Answer: I'm 100% with Tim on this. It is a bad idea, as it will damage the wood of the fretboard, and doesn't teach you how guitars work at all.
That said, if you have to mark the neck for some reason, don't put any markers on the fretboard. Instead, put them on the edge (many guitars have fret dots here anyway) - you will see them when you look down at the guitar. The neck is likely to be lacquered, so will cope with sticky labels a little better. If you leave stickers on for a long time, you will still see damage though.
Comment: The glue from "permanent" stickers, generally vinyl ones, can contain a solvent in them that can affect lacquered fingerboards.  The newer guitars generally don't have true lacquer on them, but a plastic or resin base finish that is more resistant.
Answer: I agree that finger marking isn't the best way to go when learning your scales, but here is some more information:
The CAGED system of fingering has major scale patterns that use one finger per fret, making it fairly easy to look at the pattern on the page and replicate the pattern on the finger board. When using this system it is unnecessary to learn the note names first, as you play the scale by the relative whole and half steps, based around chord shapes.
Putting markings on your fingerboard to help with this, if you feel it is necessary, depends on what kind of fingerboard you have. It is common to use stickers or tape on violin finger boards, which is often untreated ebony, and I have put guide stickers on a guitar for a student that was having trouble identifying where to put his fingers on the frets.
Lacquered fingerboards (usually the light colored ones, such as maple) can be marked with painter's tape or automotive vinyl striping tape. Anything that is specifically non-residue temporary tape can work.  Anything else and you risk discoloring or damaging the lacquer.
Untreated hardwood finger boards such as rosewood or ebony can also be marked with the non-residue tapes. You can find violin finger board marking tape for sale that can be cut into small squares.
I have also found that the glue from paper based stickers (like student reward stickers, color dots, paper stars etc.) can be removed easily with lemon oil and won't leave a mark if not left on for too long.
Do not use plastic based stickers, vinyl electrical tape, duct tape or any sticker or tape that is intended to be permanent. Again, you can discolor the wood, the glue creeps out and makes a sticky mess, and the clean up is a chore and potentially damaging.
If you aren't sure that your marking method is safe for your instrument, you should ask your local guitar technician or luthier.
Comment: I think pointing out to a student that the guitar will be permanently damaged is a good dissuader! Let's keep it that way!
Answer: Despite all the naysayers here, it's perfectly fine to mark the fretboard with color-paper sticky dots or bits of narrow sticky colored tape.  These items are applied to small children's  violin & cello fingerboards all the time.  They come off clean, with at most a bit of residue which can be rubbed off gently.
So unless your fretboard is made of balsa wood (JOKE!), grab some small sticky colored dots at your favorite stationer's (or Staples) and have at it.
Comment: You may have noticed that violins and cellos etc., have no markings at all on their fingerboards. I guess you have. Guitars are very different, in that there are already markings there on purpose. So, whilst I can understand that it is a help to beginners to have marks on the former instruments, please convince me of the mileage in doing the same for already marked instruments. -1.
Comment: @Tim well, inlaid single and double dots are not as informative as placing 6 red dots under the 6 strings onto the frets which comprise a given chord, for one example.
Comment: Informative, possibly. Educational, never! Especially when there is a maximum of only two frets between markers anyway. The object is to learn where the notes are. I don't believe that looking for red dots for notes teaches much at all - and the OP was asking about scales.On guitar that's a whiole new can of worms, as there are often two or more ways to play a particular scale, so does one add a plethora of red dots? It's like piano - D is *always*  between the 2 blacks. Why bother marking it? Unmarked 'boards are rather different, especially for beginners,but dots still need finger-tweaking.
Answer: Here's five options:
1) Take off the strings and use extra sticky 'full-stick' post-it notes.
2) Buy a guitar neck, lets say a broken strat neck, on ebay for $20 and mark it up anyway you like.
3) Google images ... get a picture of a neck, Photoshop the notes, print it out, 300% if you like, and put it on the wall because you want to eventually get it without having to see the fingerboard facing up.
4) No neck at all. Loose leaf paper. Draw the lines. Sometimes scales, sometimes fifths, sometimes thirds, whatever, doesn't matter mix it up, roll dice, etc. ... 'flash card' method.
5) Tune the B and E to C and F and see how the circle of fifths easily lays onto the board. The strings high toward low, F toward E are fifths, the other way fourths. So every other string going lower is a letter higher ... F (1st), G (3rd), A (5th), B (7th...a seven string guitar) ... C(2nd), D(4th), E(6th).
Then see the notes by number - the note position in the scale (C major to start):
F(4)
C(1)
G(5)
D(2)
A(6)
E(3)
B(7)
So the numerical pattern of fifths by note position is 4152637 ... I call that the 'number circle of fifths'.
On the first fret it's now:
F#(#4)
C#(#1)
G#(#5)
D#(#2)
A#(#6)
E#(#3)
B#(#7)
or
G♭(♭5)
D♭(♭2)
A♭(♭6)
E♭(♭3)
B♭(♭7)
F♭(♭4) = E
C♭(♭8) = B
This lets you see the intervals ... make a major chord shape ... 1 3 5 ... same all over the fingerboard ... a single patter instead of five different patters because the two high strings were adjusted to make the strings all fifths/fourths.
This doesn't have to be permanent ... this 'all fourths' is great for learning and composing ... not for open chords, strumming.
No shortage of pros who say they should've learned it this way. Far easier to switch from a manual to automatic car.
Comment: Not when it decides it wants to be in a certain gear, and that's not what **I** want!
Answer: For anyone looking for opinions on this, here is mine:
· I think it is really useful to look at the fretboard and be able to find the notes at a glance as when looking at a piano keyboard. Probably most guitarist learn the notes on the fretboard based on patterns (CAGED, scales, etc.). That is perfectly fine, but for me it is not intuitive enough.
· Marking the notes of C major scale seems to be a logical way to be able to find each note  as easy as in a piano. The perfect option for me would be custom placed dot inlays marking the C major notes all over the fretboard instead of just frets 3,5,7,9,12,15... Those latter ones can be still found in the neck side. A luthier or someone a bit skilled should be able to do this:

. Also buying a super cheap guitar to try what works for you can be interesting before damaging a good instrument.
· As others commented here 4ths tuning is also interesting to make the fretboard more intuitive, so that any interval/chord/arpeggio/scale pattern can be used all over the fretboard. The disadvantages of this tuning are loosing open chords and barre chords and of course dealing with a guitar repertorie 99% based on standard tuning.
· Also interesting, hybrid tuning:

. Appart from the custom frets used on the video, that tuning can also be achieved by tuning the 4 lower strings to Eb, Ab, Db and Gb, and fretting them on the 1st fret with a banjo capo (leaving B and E strings unfretted), so that open position gives E,A,D,G,B,E but still keeping all 4ths tuning. (Not my idea, check the 1st comment on the video link).
Answer: Besides on old lap steels and violins, I don't see that done a lot. You should have fret position markers on the fretboard than on the sides, which should do a lot to orient you. I do suggest you map it out on paper or other means, rather than on the fretboard.
Answer: Marking the fretboard is not a problem ... if following a good procedure and using quality products.
[NO] – DON'T USE READY-MADE STICKERS FROM EBAY
Most fretboard stickers bought online are not the best solution. They use strong, generic sticker adhesive.
[YES] – USE INDUSTRY-TESTED, LOW-TAC, THIN-LINE MASKING TAPE
But if you use industry-grade, well-tested thin-line masking tape, which leaves absolutely NO RESIDUE when removed, then you have a neat solution that helps you navigate the complicated world of the guitar fretboard.
So, get thin-line masking tape used to protect delicate surfaces during painting work. Thin-line tape is 8mm wide. You can get it in good hardware stores. Write down on tape each note of the corresponding fret and string, put in position and repeat for each fret. Low-tac masking tape uses a special, non-permanent type of adhesive that leaves ZERO residue. I tested some tapes on very delicate paper surfaces, which are more sensitive than fretboard, and it leaves no residue. Some masking tape strip may begin peeling off by itself, so just replace it with a new one, or, when you learn the positions.
So yes, it's doable, it's not a bad idea at all, just use proper tools made exactly for the delicate materials.
Answer: Suggesting that marking a fretboard in anyway is somehow damaging to either the instrument or the provincial methods of teaching music is a bit of crap. It does suggest however, that one might have either the wrong instrument, or the wrong teacher. Both of which are not good. Kinda like finding your way through Paris without a map. You could get around, but it would take you forever and you still wouldn't learn French. What exactly is the opposition to faster simplified methods of memorization? Visual methods? They don't make us stupid. They make us less likely to need any one teacher. A good thing especially since many teachers and many methods are typically a better form.


hyperbolic spaces and fractals

Question: Is there a relation between hyperbolic spaces and fractals?
In group theory, if we take the Cayley graph of a free group on two generators, we get a fractal quaternary tree, which I'd like to think as embedded in some hyperbolic space.
Mathematically I don't know how to define this idea, as it is somewhat vague and qualitative, but I'm believing that there is a relationship between the notion of hyperbolicity and fractals. Any help?
Comment: Curious: None if the answers, including the accepted one, got to the heart if the matter.
Comment: See http://www.hiddendimension.com/fractalmath/tessellationfractals.html.
Comment: Google 'quasi-fuchsian limit curve'
Answer: This is not a proper answer, is as vague as also in the question but hopefully impacts what you are attempting to say. At any rate I hope it survives down-votings.
Take a circular disk and let its  boundary length increase indefinitely. The surface area in the neighborhood of boundary increases and spreads to the center by deformation compatibility definable by von Kármán compatibility relation ( i.e, it pulls in extra  surface material towards its center to create a warped Pringles chip for example.
$$\frac{\partial ^2\epsilon_{\theta}}  {dr^2}+..+..{}\approx -K $$
[ If border material is contracted on the other hand, the shape becomes like a bowl or dish.
]
Extra membrane energy /surface area created  is constant for a soap film of minimal area as surface tension. So it can be the case of varying mean curvature $H \ne 0 $ that varies in a particular way to result in constant $ K<0. $
At first by addition of areas at circumference the disk has reduced or negative Gauss curvature $K$ somewhat like:

Pringles Chip with the saddle point at center and everywhere else and then

we have by exaggerating the same growth further on...

Sea Coral shapes like those made/ demonstrated  by Prof. Daina Taimina by a process of introducing extra area at disk boundary with more loop areas continuously introduced due to extra area input the  circumference.

which finally tend to, if allowed such an appellation, deeper warped "Koch surfaces":

In 3D Koch snowflake Fractal the area enclosed by the boundary is finite but boundary length approaches infinity. Fibonacci surface Fractals also can be found surfing the net. The first two

KochSurfaceGrowth
$$ Pringle Chip \rightarrow CrochetedCoral \rightarrow  3D\,KochSnowflake $$
These three shapes can be defined to have constant $K<0$. Imo it is a pity of hyperbolic geometry that none of the above has a mathematical description with a parameterization as of today. This aspect seems not been adequately researched or perhaps not published.
Comment: your answer is very nice, but would you kindly explain a bit more about what you mentioned as `deformation compatibility definable by Gauss-Codazzi.`
Comment: Actually apologies, I was referring more exactly to Von Karman relation that shows how extra/ reduced areas create new geometries with changed K by surface strains alone.
Answer: A regular pattern in the hyperbolic plane will appear self-similar and fractal in common models of the hyperbolic plane. You'd see copies of the same theme repeated at different scales. So there is at least some relation here.
To make things less vague, you'd first have to define the term "fractal". On this topic, Wikipedia currently writes (text by Akarpe):

There is some disagreement amongst authorities about how the concept of a fractal should be formally defined. […] The general consensus is that theoretical fractals are infinitely self-similar, iterated, and detailed mathematical constructs having fractal dimensions […].

While I confirmed self-similarity, I'm less sure regarding "iterated". You could say that you start with one tile of the pattern, and then at each iteration you add the tiles directly adjacent to those you already have. That would give you an iterated construction, but contrary to what most fractals do it would leave the parts you already have unmodified, there is no refinement happening there. It would indeed be interesting to see whether you could compute a fractal dimension from this process. If I find the time, I may make some experiments regarding this, but don't count on it.
The characteristics section lists some characteristics, quoting Fractal Geometry: Mathematical Foundations and Applications by Falconer. Many of these are met by models of hyperbolic patterns.
Answer: One way more suitable is to think of it in this way:
$\mathbb{H}^n$ cannot be Isometrically (distance-preservingly) immersed $\mathbb{R}^n$ due to Hilbert's Immersion Theorem
And every Hyperbolic manifold of dimension $n$ is isometric to $\mathbb{H}^n$, in order for it to fit in $\mathbb{R}^n$, one requires a conformal model where angles remain the same, only distance gets shortened as we tend towards infinity (the boundary)
And it is the the boundary where we find the Fractal, as the Limiting set for such this projection
It is best imagined in terms of a projection of some struture drawn on a hyperboloid, onto the $\mathbb{R}^n$, and since the higher the object is from the plane over the hyperboloid, the furthest it'd be projected down the plane; therefore if the source of light (projection point) is just at the level set where the struture ends, then ideally the projection would tend to infinity. Therefore you abstractly create a new kind of projection, where further the projection are, smaller the projection would be. That's how you get the fractal in the boundary; since they've now become infinitesimally small.

hyperbolic spaces and fractals