Locus of point of intersection of tangents at $A$ and $B$

Question: From a Point $P$ on $C_1 \equiv x^2+y^2=9$ two tangents are drawn to $C_2 \equiv x^2+y^2=1$ which meets $C_1$  at $A$ and $B$. Find the Locus of point of intersection of tangents at $A$ and $B$ on $C_1$.
My Try: Let $P(3\cos\alpha, 3\sin\alpha)$, $A(3\cos\beta, 3\sin\beta)$ and $B(3cos\gamma, 3sin\gamma)$. Now $PA$ is chord of $C_1$ and tangent to $C_2$ say at point $M$. Since center of two circles is same, let it be $O$.
Now $OM$ is perpendicular to $PA$ at $M$ and since $PA$ is chord of $C_1$, $M$ is Mid Point of $PA$. So coordinates of $M$ is $M(\frac{3\cos\alpha+3\cos\beta}{2},\frac{3\sin\alpha+\sin\beta}{2})$
Now since $M$ lies on $C_2$ we have
$$\left(\frac{3\cos\alpha+3\cos\beta}{2}\right)^2+\left(\frac{3\sin\alpha+3\sin\beta}{2}\right)^2=1$$ Simplifying we get
$$\cos(\alpha-\beta)=\frac{-7}{9} $$ By similar analysis
$$\cos(\alpha-\gamma)=\frac{-7}{9} $$ which means
$$(\alpha-\beta)=2\pi+(\alpha-\gamma) \implies \gamma-\beta=2\pi \tag{1}$$
Now Equations of tangent to $C_1$ at $A$ and $B$ are
$$x\cos\beta+y\sin\beta=3$$ and $$x\cos\gamma+y\sin\gamma=3$$ Their Point of Intersection is
$$(h,k) =\left(\frac{3\cos\left(\frac{\gamma+\beta}{2}\right)}{\cos\left(\frac{\gamma-\beta}{2}\right)},\frac{-3\sin\left(\frac{\gamma+\beta}{2}\right)}{\cos\left(\frac{\gamma-\beta}{2}\right)}\right)$$
Now $$h^2+k^2=\frac{18}{1+cos(\gamma-\beta)}$$ Now using $(1)$ i will get the locus as $$h^2+k^2=9$$ which is the same circle $C_1$. Can i know where i went wrong and any better approaches?
Answer:
We know that the required locus is a circle centered at O(0, 0). We only need to determine it radius.
For a particular case, that circle will go through Q(?, 0) when point P is at (3, 0).
The value of $\beta$ can be found from the brown triangle.
In the green right angled triangle, one angle is $2 \beta$.
The required radius = OQ can then be found.
Comment: very good approach simple and logical
Answer: A syntetic aproach:

Let $I,J$ the tangent points in $C_2$ from $P$. Then $PI=PJ$. Moreover, by Pitagoras applyed to $\triangle PIA$, we have that $PI$ is the same value for all $P\in C_1$. On the other hand, as $OI\perp PA$ and $PA$ is a chord of $C_1$, then $I$ is the midpoint of $PA$. Thus $PA=2PI=2PJ=PB$. So, $PA=PB$ and this common value is the same for all $P$. As $PO=OA$ for all values independent from $P$, all triangles $OAP$ are congruents. In particular $\angle APO$ is independent from $P$.
Next, note that $\angle HAO=90$, cause $HA$ is tangent to $C_1$. Then, $\angle AOH=90-\angle AHO$. On the other hand, $\angle POA=180-2\angle APO=180-\angle  APB=180-\frac{1}{2}\angle AOB=180-\angle AOH$. Then $\angle AOH+\angle POA=90-\angle AHO+180-\angle AOH=270-(\angle AHO+\angle AOH)=270-90=180$. It proves that $H$, $O$ and $P$ are collinear.
Therefore $\angle AOH=\angle OAP+\angle OPA=2 \angle OPA$. But the last is independent of $P$. Thus, $\angle AOH$ not depends on $P$. So, all triangules $\triangle AOH$ are congruents. Therefore $OH$ is independent of $P$. That is, $OH$ has the same value for all $P$. Then, $H$ is in a circunferecence centered in $O$.
Finally, we have $\sin\alpha=1/3$. But $3/OH=\cos\beta=\cos 2\alpha=1-2\sin^2\alpha=1-2/9=7/9$. Then $OH=27/7$.
Conclusion: The focus searched is $x^2+y^2=(27/7)^2$
Answer: Let the point of intersection of the tangents to the circle $x^2+y^2=9$ be $Q(h,k)$. The equation of $AB$, i.e. chord of contact to the larger circle is then $hx+ky=9$. Now if the half angle between the tangents drawn from $P$ is $\alpha$ we have $\cos 2 \alpha = \dfrac{7}{9}$. Then distance of $AB$ from center is $3 \cos 2 \alpha = \dfrac{7}{3}$.
This distance is also obtained as $\dfrac{9}{\sqrt{h^2+k^2}}$
Thus $\dfrac{9}{\sqrt{h^2+k^2}}=\dfrac{7}{3}$ from which we obtain the locus as
$x^2+y^2 = \left(\dfrac{27}{7}\right)^2$


Como fazer Divs quadradas e responsivas

Question: Preciso de elementos quadrados e que tenham a altura e largura responsivos. Mas como crio uma altura responsiva que seja sempre igual a largura em %?
Obrigado!
Comment: Seja mais claro, ofereça mais detalhes, da forma que está se torna uma questão ampla... Coloque um exemplo do que pretende... Boa sorte
Answer: Tem um exemplo aqui: http://carlosmaniero.blogspot.com.br/2013/08/criando-quadrados-responsivos.html
OBS: Estou colocando aqui o exemplo do site para que em caso do site sair do ar o exemplo ficará aqui para pesquisas futuras.
Créditos para Carlos Maniero.

body{
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
/* Gera um quadrado responsivo. */
.square{
    width: 48%;
    height: 0; /* A mágica está aqui */
    padding-bottom: 48%; /* ... e está aqui */
    margin: 1%;
    float: left;
    position: relative;
}

/*
    Veja mais sobre como centralizar o texto no box aqui:
    http://css-tricks.com/centering-in-the-unknown/
*/
.block{
  position: absolute;
  text-align: center;
  background: #1a1a1a;
  width: 100%;
  height: 100%;
}

.block:before {
  content: '';
  display: inline-block;
  height: 100%;
  vertical-align: middle;
  margin-right: -0.25em;
 }

.centered {
  display: inline-block;
  vertical-align: middle;
  width: 80%;
  background: #222;
  color: #FFF;
 }

Box 1

Não importa quanto texto eu coloque aqui. Ele vai ficar centralizado

Só o título

Answer: Bom, respondendo minha propria pergunta para terceiros que no futuro passem pela mesma duvida. Sim, a resposta acima esta correta. Padding sempre é relativa a largura, dessa forma colocando padding-bottom no lugar da altura, e dando-lhe um valor igual ao valor do width em porcentagem, você cria uma altura e altura iguais e responsivas. O problema com essa solução é que por vezes precisamos da altura (height) definidas para o elemento, para algum calculo para seus elementos filhos, tipo um height: 100%. A solução para isso então, é usar a medida VW, que é baseada sempre na largura do viewport. Logo, você colocando widht: valorVW e height: valorVW, você define uma altura ao elemento, e sua largura e altura serão sempre iguais e responsivas!

Como fazer Divs quadradas e responsivas


Erasing last element of vector containter

Question: I've got some problem with segmentation fault while I want to remove element from vector container which is the latest one pushed in.
vector<client> :: iterator it;

for(it=ktab->begin(); it!=ktab->end(); ){
    if(it->KEY_w==key_w) ktab->erase( it );
    ++it;
}

How to cope with this problem?
Comment: Use the erase-remove idiom. No need to worry about iterator invalidation.
Answer: With ktab->erase(it) you, obviously, invalidate it. In the statement immediately after it you increment the already invalid it. You probably want to use something along the lines of
ktab->erase(std::remove_if(ktab->begin(), ktab->end(),
                           [=](client const& c){ return c.KEY_w == key_w; }),
            ktab->end());

Note that the solution using std::remove_if() moves each element at most once. The other solutions may have a quadratic number of moves.
Answer: vector<client> :: iterator it;

for(it=ktab->begin(); it!=ktab->end(); ){
    if(it->KEY_w==key_w) it = ktab->erase( it );
    else  ++it;
}

Though in such situations it is better to use member function erase with standard algorithm std::remove_it
Comment: This solution is the best for me. I can't use remove_if because my code is much more complex.
Answer: When you delete the element through its iterator, the iterator becomes invalid. That is the reason why erase returns the first iterator after the deleted element. You can fix your code like this:
for(it=ktab->begin(); it!=ktab->end(); ){
    if(it->KEY_w==key_w) {
        it = ktab->erase( it );
    } else {
        ++it;
    }
}

Answer: Try it this way
for(it=ktab->begin(); it!=ktab->end(); ){
    if(it->KEY_w==key_w)
    {
       it = ktab->erase( it );
    }
    else
    {
       ++it;
    }
}

Iterators are invalidated after you call erase, but erase also returns a valid iterator that references the item after the one you just erased. Storing this return value in your iterator ensures the iterator in your loop remains valid.


Divide Selection by X in Excel VBA

Question: This will probably be a softball but how can I divide the selection by a certain amount?  In this case: 2.204623 ?  I know you can use "PasteSpecial" but I'm trying to figure out how to just have a selection and then assign a hotkey to do it (macro).
Sub Makemt()
 Dim Cell As Range
 Dim div_mt As Long

 div_kg = 2.204623

 For Each Cell In Selection
 Selection `here I would divide by div_mt

 Next

End Sub

I could not figure out how to blend the ability to pasteSpecial divide in which a selected range.
  Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlDivide, SkipBlanks _
        :=False, Transpose:=False

Comment: The `2.204623` would need to be in a cell to use the paste special.
Comment: is it not simply cell = cell/2.204623
Comment: as long as the number is in a cell yes.
Comment: Would it work if I have a named range where the 2.204623 is ?
So "selection" / named range ?
Answer: If each cell in range is to be divided
Sub Makemt()
 Dim Cell As Range
 Dim div_mt As Double

 div_kg = 2.204623

 For Each Cell In Selection

    If IsNumeric(Cell.Value) Then
        Cell = Cell/ div_kg
    End If

 Next Cell

End Sub

Edit: Taking note of @ScottCraner's note on numeric value in cell
Answer: You can avoid the loop and the number in a cell with:
Sub Makemt()
 Dim div_mt As Double
 div_mt = 2.204623

 Selection.Value = Selection.Parent.Evaluate("INDEX(" & Selection.Address & "/" & div_mt & ",)")

End Sub

If your value is in a cell then use this:
Sub Makemt()

Worksheets("Sheet1").Range("K11").Copy
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlDivide, SkipBlanks _
    :=False, Transpose:=False

End Sub

K11 on Sheet1 would be the cell in which the value is found.
Comment: I don't know if there's a thing you can't answer Scott! Thank you!  The first part works perfectly.

Divide Selection by X in Excel VBA


Livewire property not showing when refreshing

Question: I'm doing a simple comment section for posts in a Laravel Livewire application and it should be able to live update when a new comment is made. However, when I comment something in a post, I got the Following error:

Undefined array key "class". With the error being thrown at: public/index.php

$response = $kernel->handle(
    //Right here
    $request = Request::capture()

)->send();

In the laravel.log I got the following markup:
Undefined array key "class" {"userId":1,"exception":"[object] (ErrorException(code: 0): Undefined array key \"class\" at vendor\\livewire\\livewire\\src\\HydrationMiddleware\\HydratePublicProperties.php:155)

In my code, I have a Timeline livewire component, which calls a foreach loop for posts.
//timeline component
@foreach ($this->posts as $post)
    <livewire:post :post="$post" wire:key="post-{{$post->id}}" />
@endforeach

That calls another loop for comments.
//post component
@foreach($this->comments as $comment)
    <livewire:comment.view :comment="$comment" wire:key="comment-{{$comment->id}}" />
@endforeach

And it looks like this inside the comment.view component:
//comment component

{{$comment->user->name}}

{{$comment->body}}

Controllers:
Comment.view
class View extends Component
{
    public Comment $comment;

    public function mount(Comment $comment = null) {
        $this->comment = $comment;
    }

    public function render()
    {
        return view('livewire.comment.view');
    }
}

Post.view
class Post extends Component
{
    public Item $post;

    protected $listeners = [
        'comment::created' => '$refresh'
    ];

    public function mount(Item $post = null) {
        $this->$post = $post;
    }

    public function render()
    {
        return view('livewire.post');
    }

    public function getCommentsProperty() {
        $comments = $this->post->comments;

        return $comments;
    }
}

The comments are being shown when I first open the browser, I only got this error after trying to create a new comment, which is actually being created and shows off when I F5 the browser after the error log.
Have already tried placing the all comments in the timeline component and refreshed it, making it work nicely. It only happens when I use it inside post.view component.
Comment: I think you can tell this is a Livewire exception. However, it seems that the serialized property isn't complete. Perhaps try if eager loading the user directly on the comment, it "saves" better into the Livewire dataset? `$comment->load('user')`
Answer: Got by this changing the place where i setted the attributte. The mount() function only runs once, and whenever I send an event for it to refresh, it won't run. Instead, I should define the comments attribute that the comment.view receives in the render() method. Just like this
Before:
public function mount(Comment $comment = null)
{
    $this->$comment = $comment;
}

After:
public function render(Comment $comment)
{
    $this->$comment = $comment;

    return view('livewire.comment.view');
}

Also, I've done a misstype writing $this->comment instead of $this->$comment


Question about a proof: $U$ maximal among non-finitely generated ideals of $R$, then $U$ is a prime ideal.

Question: Question: The following problem has been asked and answered many times on MSE, but there was one proof I had a question about (though I can't find the proof now).  The question is:
Let $R$ be a commutative ring with $1$ and let $U$ be maximal among non-finitely generated ideals of $R$.  Prove $U$ is a prime ideal.
The proof I saw went like this: "Suppose $U$ is not prime.  Then, there exists $a,b\in R$ such that $a,b\notin U, ab\in U$.  Consider ideal $J$ defined to be $J=U+(a)$.  Since $U$ is not finitely generated, neither is $J$.  Also, $J$ is proper in $R$, because if $J=R$, then $a\in U$, a contradiction.  So, $J$ is a proper ideal strictly greater than $U$ that is not finitely generated.  A contradiction, so $U$ is prime"
I had two questions about the proof.  First, why would $J$ necessarily be an ideal, and second, how does $J\neq R\implies a\in U$?
Thank you!
Comment: Since $U$ and $(a)$ are both ideals, so is their sum; you should be able to prove that. The second is, I think, a typo: you get $b\in U$ if $J=R$: for $1\in J$, so $1=u+ra$ for some $u\in U$ and $r\in R$. Multiplying by $b$ you get $b = ub+rab\in U$, since $ub\in U$ and $ab\in U$ hence $rab\in U$.
Comment: No, you can still proceed to conclude that $J\neq R$. I'd be more wary about the claim that $J$ must be non-finitely generated, as it is perfectly possible for a finitely generated ideal to contain a non-finitely generated ideal.
Comment: Ah, so because of that, this proof is broken, right?  I don't think there would be a way to save it from there.
Comment: There is a typo, but the argument is severely broken and the proof is wrong. To begin with, $U+(a)$ must *necessarily* be finitely generated, since it's an ideal that properly contains $U$.
Answer: To answer your questions:

If $I$ and $J$ are ideals, then so is $I+J= \{x+y\mid x\in I, y\in J\}$. Indeed, it is nonempty since $I$ and $J$ are nonempty; if $x_1,x_2\in I$ and $y_1,y_2\in J$, then $(x_1+y_1)-(x_2+y_2) = (x_1-x_2) + (y_1-y_2)\in I+J$, so $I+J$ is an additive subgroup. And given $x\in I$, $y\in J$, and $r\in R$, we have $r(x+y) = (rx)+(ry) \in I+J$. This also works in a noncommutative ring (and for one sided ideals), as you also have $(x+y)r = (xr) + (yr)\in I+J$. For the case at hand, $U$ is an ideal and $(a)$ is an ideal, so $U+(a)$ is necessarily an ideal.

In fact, $I+J$ is the smallest ideal that contains both $I$ and $J$.

This is, I suspect, a typo. Suppose that $ab\in U$. If $a\in U$, we are done. If $a\notin U$, then we look at $J$. If $J=R$, then $1\in J= U+(a)$, so there exists $u\in U$, $r\in R$ such that $1=u+ra$. Multiplying by $b$ we get $b = ub + r(ab)$. Since $u,ab\in U$, then $ub+r(ab)\in U$, and so we get that $b\in U$, and we are done. Thus, we are reduced to the case where $J\neq R$, $a\notin U$.

In this case, $J$ is a proper ideal that properly contains $U$. Now, we need to show that $J$ is non-finitely generated to reach a contradiction. I think this proof is a little too cavalier in the assertion that this is clear, though. It is clear that if $J$ is finitely generated, then you can find a finite set of elements $u_1,\ldots,u_n\in U$ such that $u_1,\ldots,u_n,a$ together generate $J$, but it is not clear to me that this implies that $U$ would then be finitely generated...
Comment: @user7238: Yes, I don't see how to conclude it easily; as I said, if you assume $J$ is finitely generated, you get a family $u_1+r_1a,\ldots,u_n+r_na$ of elements that generate, which means $u_1,\ldots,u_n,a$ generate $J$, but this does not mean that $u_1,\ldots,u_n$ necessarily generate $U$ (which would contradict that $U$ is finitely generated). I don't think you can just say "it is not finitely generated, because $U$ is not finitely generated." You need to *prove* it is not finitley generated, and I don't see how the fact that $U$ Is not gives it to you here.
Comment: @ArturoMagidin Besides, who wrote the argument seems to ignore the fact that a non finitely generated ideal *must* be proper.
Comment: Actually, it is *obvious* that $J$ is finitely generated, because it properly contains $U$.
Comment: @egreg: If you are trying to reach a contradiction from the assumption that $ab\in U$ but $a\notin U$ and $b\notin U$, then you would want to prove that $J$ is an element strictly larger than $U$ in the set in which $U$ Is maximal, so of course one possibility would be to argue that $J$ is non-finitely generated. In fact that is what I am saying: that you need to *prove* it is not finitely generated to reach a contradiction, not just say it off-handedly.
Comment: That's right, but the argument starts off by saying that $J$ is not finitely generated, which is exactly the opposite from what follows from the assumptions.
Comment: @egreg: I think the argument pretends that it is easy to conclude that $J$ Is not finitely genrated from the fact that it contains the non-finitely generated ideal $U$; but that is not a valid implication.  After all, the whole ring is a finitely generated ideal that contains the non-finitely generated ideal $U$.
Comment: Ah, okay, so the proof essentially brushes off and claims that $J$ is not finitely generated, but this would need to be shown.  I know egreg said this "might" be able to be done, but I'm not seeing how we could get to that conclusion here, so maybe it is just completely broken (more than it already is) after all.
Comment: I see, that makes sense, thank you!
Answer: There is a typo, that is $J$ is proper because $b\notin J$ (not $a$). However the "proof" is completely wrong.
Indeed, it follows from maximality of $U$ that $J=U+(a)$ is finitely generated, because it properly contains $U$. One might prove that it is not finitely generated in order to find a contradiction, but the given argument fails to address this.


Centering the ion-title using position:absolute

Question: I'm a beginner in Ionic Framework. Recently I have built a page with a swipe-back-button on the left of the navigation bar. This shifts the title a bit to the right: (I have added a red background to the title to illustrate this)
Not using position: absolute:

To center the title, I added the following css code:
ion-title {
  font-weight: bold;
  position: absolute;
  top: 0;
  left: 0;
  padding: 0 90px 1px;
  width: 100%;
  height: 100%;
  text-align: center;
  background-color: red;
}

It works:
Using position: absolute:

The problem is that the title now "covers" the swipe-back button, making it impossible to click on the button.
Any solutions? Thank you in advance.
Comment: have you tried giving the back button an absolute position instead? or with your current solution, have you looked into z-indexes?
Comment: Problem solved. Thank you so much.
Answer: Try to add position:relative and some z-index value to your back button...
I have created a working snippet to illustrate your problem

div {
  position: relative;
}

ion-title {
  font-weight: bold;
  position: absolute;
  top: 0;
  left: 0;
  padding: 0 90px 1px;
  width: 100%;
  height: 100%;
  text-align: center;
  background-color: red;
  box-sizing: border-box;
}

button {
  width: 20px;
  height: 20px;
  background: green;
  position: relative;
  z-index: 99;
}

  <button></button>
  <ion-title>About</ion-title>

Comment: Works like a charm! I didn't know I could adjust the z like this. Thank you so much.


Solution of the quasilinear equation $p - z q + z = 0$ with initial data curve

Question: Hello ı cant write like maths notation hear sorry for that.
Find the solution of the initial value problem for the quasilinear equation
$p - z q + z = 0$ for the initial data curve
$\Gamma: x_{0} = 0, y_{0} = s, z_{0} = -2s, −\infty \leq s \leq \infty $
I found $c_{1} = (e^x).z $
But ı dont know is it true or not and ı couldn't continue from this part. Can u help me ?
Answer: $$z_x-zz_y=-z$$
You correctly found a first characteristic equation :
$$ze^x=c_1$$
A second characteristic equation is :
$$z-y=c_2$$
The general solution is :
$$ze^x=F(z-y)\quad\implies\quad z=e^{-x}F(z-y)$$
Condition :
$$z(0,y)=-2y=e^0F(-2y-y)=F(-3y)$$
The function $F$ is determined :
$$F(X)=\frac23 X$$
We put in into the general solution where $X=z-y$
$$ze^x=\frac23 (z-y)$$
Solving for $z$ :
$$z(x,y)=\frac{-2y}{3e^x-2}$$


If x and y are real numbers such that $y-x>1$ then there is an integer m such that $x\leq m\leq y$

Question: As a homework a proof is needed using Archimedes and integer function
For $x, y ∈ \mathbb{R}$
If $y-x > 1$ then $∃ m ∈ Z:  x\leq m\leq y$$
I've found this If x and y are real numbers such that y-x>1 then there is an integer z such that x<=z<=y
but does not seem exactly what i'm looking for.
Answer: Let $m$ be the biggest integer that $m\leq y$. Then $y-m<1$, so $$x+1-m<y-m<1$$ and thus $x<m$.
Comment: you didn't use the integer function?
Comment: Actually I did, namely $m =[y]$ and we know $y-1<[y]\leq y$ is true for each $y$.
Comment: Clear enough, thanks
Answer: We corrected this in class, and proved it as follow:
$y-x > 1$
$y > x+1$
$[y] > [x+1]$
$[y] > [x] + 1$
And we know that $y-1 \lt [y] \leq y \lt [y] +1$
$\implies y\ge[y]$
Also we know that $x-1 \lt [x] \leq x \lt [x] +1$
$\implies [x]+1\gt x$
So
$y\ge[y] > [x] + 1\gt x$
Therefor
$\exists m \in \{[y], [x]+1\}:y \ge m \gt x$


Fundamental theorem of calculus with chain rule

Question: I'm trying to prove that if we define
$$F(x) =\int_{g(x)}^{h(x)} f(t) dt$$
If $f$ is continous in $x_0$, $g(x)$, $h(x)$ are differentiable in $x_0$, and the range of a neighbourhood of $h(x_0)$ and $g(x_0)$ is included in the domain of $f$ then
$F'(x_0)=f(h(x_0))h'(x_0)-f(g(x_0))g'(x_0)$
I tried to divide the proof in
$g(x_0)<h(x_0)$, $h(x_0)<g(x_0)$ and $g(x_0)=h(x_0)$
When $g(x_0)<h(x_0)$, what I did is define
$$M(y) = \int _a^y f(t) dt$$
$$N(y) = \int_y^a f(t) dt$$
And I have proven that if $f$ is continous in $x_0$:
$$M'(x_0)=f(x_0)$$
$$N'(x_0)=-f(x_0)$$
As $F(x) = M(h(x)) + N(g(x)) $ when $g(x)<h(x)$ and this holds in a neighbourhood of $x_0$, $(x_0-ε,x_0+ε)$ as $g$ and $h$ are continous in $x_0$, it follows that $$F'(x_0)=f(h(x_0))h'(x_0)-f(g(x_0))g'(x_0)$$
Similarly we prove the case when $h(x_0)<g(x_0)$, using that $$F(x) =\int_{g(x)}^{h(x)} f(t) dt =-\int_{h(x)}^{g(x)} f(t) dt$$
The problem comes when $g(x_0)=h(x_0)$, using $$F(x_0)= \int_{g(x_0)}^{g(x_0)} f(t) dt = 0$$
as I don't know what happen in a neighbourhood of $x_0$
I tried to do $$F'(x_0)=\lim_{h\to 0}\frac{F(x_0+h)-F(x_0)}{h}=\lim_{h\to 0}\frac{F(x_0+h)}{h}$$
but I didn't get anything and I don't know what else should I do.

Edit:
I change the way to prove it and, with the same inicial conditions, I define
$$M(y) = \int _a^y f(t) dt$$
We also have that if $f$ is continous in $x_0$, then:
$$M'(x_0)=f(x_0)$$
Now we have $F(x_0)=M(h(x_0))-M(g(x_0))$ and this holds for all 3 cases, so:
$$F'(x_0)=f(h(x_0))h'(x_0)-f(g(x_0))g'(x_0)$$
Comment: What are you allowed to use here? Are you allowed to use the ordinary fundamental theorem of calculus? It's easy if you use an antiderivative $G$ of $f$, because $F(x) =G(h(x)) - G(g(x)) $, and you can just use the chain rule.
Comment: Do you mean using what I defined as M(x) to say F(x) = M(h(x)) - M(g(x))???   It may work, but what if  "a" isn't in the domain of F, i.e. the least value in the domain of F is g(x)???
Comment: Why not set $a=g(x_0)$? And if you have defined the integral when $h(x_0),$ and $=.$
Comment: I used what I said in my comment before and that formula work for all 3 cases so it's better than all what I have done. What I finally do is say $a\leq min({g(x_0),h(x_0)}) $. So it could always be equal, and I think I can't just write $a= min({g(x_0),f(x_0)}) $ because I want a to be constant, not variable, so I want it to be the same value in a neighbourhood of $x_0$ not to change the formula so I can differentiate it.
Answer: I think the overuse of $\newcommand{d}{\,\mathrm d}x_0$ in the proof is problematic.
You shouldn't be looking at $f(x_0)$ at all;
$F'(x_0)$ can be equal to the desired formula even if $f(x_0)$ is undefined,
and conversely $f$ might be continuous at $x_0$ and yet
$F(x_0)$ is undefined (and therefore $F'(x_0)$ also is undefined).
For example, let $f(x) = \sqrt{1 - x^2},$ which is defined only on $[-1,1].$
Let $g(x) = x + 1$ and $h(x) = x + 2$.
Then $F'(x_0)=f(h(x_0))h'(x_0)-f(g(x_0))g'(x_0)$ when $x_0 = -\frac32,$ although
$f(x_0)$ is undefined;
but if $x_0 = \frac12,$ then $f$ is continuous at $x_0,$ and $g$ and $h$ both are differentiable at $x_0,$ but $f$ is undefined in the neighborhoods of $g(x_0)$
and $h(x_0),$ so $F(x_0)$ and $F'(x_0)$ are undefined.
Rather than looking at $f$ at $x_0,$ you need to be concerned with $f$ at $g(x_0),$ at $h(x_0),$ and at values in between in order for $F(x_0)$ even to be defined, and you should be concerned about neighborhoods of $g(x_0)$ and $h(x_0)$ in order to ensure that $F'(x_0)$ is defined.
One way to do this (but not necessarily the only way) is to require that $f$ be continuous on an open interval $I$ that includes both $g(x_0)$ and $h(x_0).$
As before, let $g(x)$ and $h(x)$ be differentiable at $x_0$ and define $F$ by
$$F(x) = \int_{g(x)}^{h(x)} f(t) \d t.$$
You could then proceed as follows:
Let $a \in I.$ Then
$$ \int_{g(x)}^{h(x)} f(t) \d t =
\int_a^{h(x)} f(t) \d t - \int_a^{g(x)} f(t) \d t. $$
Note that as long as we define this notation for definite integrals in the usual way so that $\int_a^b f(t) \d t = -\int_b^a f(t) \d t,$
the equation above is true no matter the order in which $g(x),$ $h(x),$ and $a$ appear on the number line.
Let $$ S(v) = \int_a^v f(t)\d t. $$
Then $S'(v) = f(v).$

Also,
$$ S(h(x)) = \int_a^{h(x)} f(t) \d t $$
and
$$ S(g(x)) = \int_a^{g(x)} f(t) \d t.$$
It follows that
$$ F(x) =  S(h(x)) - S(g(x)) $$
and therefore
\begin{align}
F'(x_0) &= \left.\frac{\d}{\d x} S(h(x))\right|_{x=x_0}
 - \left.\frac{\d}{\d x} S(g(x))\right|_{x=x_0} \\
 &=  S'(h(x_0)) h'(x_0) - S'(g(x_0)) g'(x_0) \\
 &=  f(h(x_0)) h'(x_0) - f(g(x_0)) g'(x_0),
\end{align}
which was what we wanted to prove.

A note on the conditions of the theorem:
In most treatments of the Fundamental Theorem of Calculus
there is a "First Fundamental Theorem" and a "Second Fundamental Theorem." We use both of them in the proof above.
The Second Fundamental Theorem is invoked in order to be able to differentiate the function $S$ at $g(x_0)$ and at $h(x_0).$
This requires $f$ to be continuous in neighborhoods of $g(x_0)$ and $h(x_0).$
Note that in the statement of the Second Fundamental Theorem (at least as shown in the link above, and in many other places) it is not necessary that $a \leq v$ in order to be able to differentiate $S$ at $v.$ If your version of the Second Fundamental Theorem requires that $a \leq v$ then the proof will be slightly more complicated; a good first step would be to prove the usual version of the theorem first, because it is generally useful.
Once you have done that, you no longer have to worry about the relative order of $a,$ $g(x_0),$ and $h(x_0)$ on the number line. You can put $a$ between $g(x_0)$ and $h(x_0)$ if you like.
The First Fundamental Theorem is invoked implicitly in order to guarantee that the integrals in
$$ \int_{g(x)}^{h(x)} f(t) \d t =
\int_a^{h(x)} f(t) \d t - \int_a^{g(x)} f(t) \d t $$
can all be evaluated when $x = x_0.$ This requires $f$ to be continuous on the three closed intervals whose endpoints are pairs of numbers from the list $a,$ $g(x_0),$ and $h(x_0).$
In particular, for the first integral we want $f$ to be continuous on the closed interval whose endpoints are $g(x_0)$ and $h(x_0).$
Combine that with the fact that $f$ is continuous in neighborhoods of $g(x_0)$ and $h(x_0),$ and we have the fact that $f$ is continuous on some open interval including $g(x_0)$ and $h(x_0).$
If we just place $a$ somewhere in that interval, we also ensure that $f$ is continuous on the other two closed intervals we need.

Additional notes:
Since one of the necessary conditions is that $f$ be continuous on an open interval $I$ such that $g(x_0)\in I$ and $h(x_0)\in I,$
it is always possible to find a number $a\in I$ such that
$a < g(x_0)$ and $a < h(x_0).$
If you must use a definition of the definite integral notation
$\int_a^b f(t)\d t$ that is valid only when $a \leq b,$
you will need one of the conditions of the theorem to be
$g(x) \leq h(x)$ for $x$ in some neighborhood of $x_0,$
and therefore you will be able to choose $a$ such that
$a < g(x_0)\leq h(x_0)$ and all the integrals are defined according to this particularly narrow definition of the definite integral.
It is easy to do this: since you know $f$ must be continuous in some neighborhood of $x_0$, choose $\epsilon>0$ such that
$(x_0 - \epsilon, x_0 + \epsilon)$ is a neighborhood on which $f$ is continuous, and set
$a = x_0 - \frac\epsilon2$ (or any other number in the interval
$(x_0 - \epsilon, x_0)$).
If you want to be able to handle the case where $g(x_0) > h(x_0),$ however, I think it is hard to avoid using the typical definition of the definite integral, according to which
$\int_b^a f(t)\d t = -\int_a^b f(t)\d t$.
That is, I think it would be hard to define the integral in such a way that this equation was not true and yet the theorem was true.
But if you have accepted the usual definition, you can choose $a$ anywhere in the interval $I$ and continue to use all the integrals shown in the proof above.
So I think a concern over the choice of $a$ within the interval $I$ is uncalled for if you also expect the theorem to be true in the case where $g(x_0) > h(x_0).$ That's why I made no effort to make $a < \min\{g(x_0), h(x_0)\},$
although it is easy to enforce that condition on $a$ if you want.
Comment: Ok, if I want that formula to be true when $f$ is continous at $x_0$ I need to add for example that the range of neighbourhoods of $g(x_0)$ and $h(x_0)$ must be included in the domain of $f$. And in that case I can take $a\leq min({inf(G)}, inf{H}) $ being G and H neighbourhoods of $g(x_0)$ and $h(x_0)$ so that a would be always in the domain of $f$.
Comment: Oh sorry, I deleted my last comment to change it. I said f to be continous in $x_0$ because the Second Fundamental Theorem is true in that case. What I proved is that if $F(x)=\int_{x}^{a} f(t) dt$ defined for an interval [b, a] and f is continous at $x_0$ then $F'(x_0)=-f(x_0)$. So in my first attempt to prove this I combined that formula with the one that says that if $G(x)=\int_{a}^{x} f(t) dt$ defined for an interval [a, b] and f is continous at $x_0$ then $G'(x_0)=-f(x_0)$. And in my recent attempt I'm trying to use what you've said but taking care that $a\leq g(x_0)$ and $a \leq h(x_0)$
Comment: OK, I think I see one of the points of confusion. When you write $F(x) = \int_x^a f(t)dt$ you're defining $F$ similarly (though not quite the same) as the way the symbol $F$ is used in the Second Fundamental Theorem. But in the theorem you have to prove, $F$ is defined in a very different way. Don't redefine $F$ inside your proof; introduce a different name when you need another function. That's why I wrote $S$ rather than $F$ in $S(v) = \int_a^v f(t)\,\mathrm d t.$
Comment: Ok, I edited my question with my new prove. But I'm still taking $a$ less than the neighbourhood of g(x₀) and h(x₀). So should I try  to prove that both Fundamental Theorem of Calculus holds for every interval [b, c] where $b\leq a \leq c$ ??? So that I can take any $a$ in the interval to prove this theorem


What is the datatypes for large files in mysql database using php?

Question: I have code which lets the user to download files in the database on certain datatype and the download php code will let user to download the files.
In my sql section, I have put the mime datatype as varchar(20), size as bigint(20) and data as longblob. But when I click the download button, it says the file is corrupt but manually when I check out the detailsin database, the details are stored.

So do you think there is an error on the datatype or do I have to change the download.php or upload.php?
Download.php Looks like this:
if(isset($_GET['id'])) {
// Get the ID
$id = ($_GET['id']);

// Make sure the ID is in fact a valid ID
if($id <= 0) {
    die('The ID is invalid!');
}
else {
    // Connect to the database
    $dbLink = new mysqli('server', 'databaseuser', 'password', 'databasename');
    if(mysqli_connect_errno()) {
        die("MySQL connection failed: ". mysqli_connect_error());
    }

    // Fetch the file information
    $query = "
        SELECT `mime`, `name`, `size`, `data`
        FROM `files`
        WHERE `id` = {$id}";
    $result = $dbLink->query($query);

    if($result) {
        // Make sure the result is valid
        if($result->num_rows == 1) {
        // Get the row
            $row = mysqli_fetch_assoc($result);

            // Print headers
            header("Content-Type: ". $row['mime']);
            header("Content-Length: ". $row['size']);
            header("Content-Disposition: attachment; filename=". $row['name']);

            // Print data
            echo $row['data'];
        }
        else {
            echo 'Error! No files exists with that ID.';
        }

    }
    else {
        echo "Error! Query failed:
{$dbLink->error}
";
    }
    @mysqli_close($dbLink);
}
}
  else {
   echo 'Error! No ID was passed.';
  }
 ?>

Upload.php looks like this:
 <?php
 // Check if a file has been uploaded
  if(isset($_FILES['uploaded_file'])) {
// Make sure the file was sent without errors
if($_FILES['uploaded_file']['error'] == 0) {
    // Connect to the database
    $dbLink = new mysqli('server', 'databaseuser', 'password', 'databasename');
    if(mysqli_connect_errno()) {
        die("MySQL connection failed: ". mysqli_connect_error());
    }

    // Gather all required data
    $name = $dbLink->real_escape_string($_FILES['uploaded_file']['name']);
    $mime = $dbLink->real_escape_string($_FILES['uploaded_file']['type']);
    $data = $dbLink->real_escape_string(file_get_contents($_FILES  ['uploaded_file']      ['tmp_name']));
    $size = intval($_FILES['uploaded_file']['size']);

    // Create the SQL query
    $query = "
        INSERT INTO `files` (
            `name`, `mime`, `size`, `data`, `created`
        )
        VALUES (
            '{$name}', '{$mime}', {$size}, '{$data}', NOW()
        )";

    // Execute the query
    $result = $dbLink->query($query);

    // Check if it was successfull
    if($result) {
        echo 'Success! Your file was successfully added!';
    }
    else {
        echo 'Error! Failed to insert the file'
           . "
{$dbLink->error}
";
    }
}
else {
    echo 'An error accured while the file was being uploaded. '
       . 'Error code: '. intval($_FILES['uploaded_file']['error']);
}

// Close the mysql connection
$dbLink->close();
 }
  else {
echo 'Error! A file was not sent!';
  }

   // Echo a link back to the main page
   echo '
Click here to go back
';
   ?>

Comment: Please show the relevant download/upload PHP code.
Comment: And in what ways is the result different from the original data? Have you tried to compare the two resulting files, maybe with a hex editor?
Comment: @AirThomas, Check out the code. I have uploaded both of the files.
Comment: @deceze, there is only result. The database stores all the files appropriately, it has data type, correct size, name and everything. However when I click the download button and try to download, some time is shows me only half of the picture and for pdf and doc files, it just says error.
Answer: As a general rule, files should be stored in the filesystem or a shared storage system like S3 or NFS, and the file path/URL stored as a string. Storing the actual files presents a variety of issues - much more work on the DB than necessary, unpleasantness in backing up, etc.
Comment: This is the best solution, even if it doesn't directly answer the question as posed.
Comment: @ceejayoz, I have edited my previous questions and I have gave the two files download.php and upload.php where upload will help to upload the file first and download will download the file and database type will store the datatype. Can you please look over the code to see if I am missing anything or not.


Verificar se usuário é administrador - WORDPRESS php

Question: /* VERIFICA LOGIN ON ------------------------*/
    global $current_user;

    $current_user = wp_get_current_user();
    $user_info = get_userdata($current_user->ID);

    $first_name = $user_info->first_name;
    $user_email = $user_info->user_email;
    $meta_value = $user_info->$meta_value;

    if (in_array("administrator", $meta_value)) {

echo "é administrador"; } else {

        echo "não é administrador";

     } ?>

mas não sei onde está o erro.
Answer: Se você quiser verificar se o usuário atual é adiministrador, você pode usar a função current_user_can('administrator') que vai retornar true caso o usuário seja um adiministrador.
Answer: A resposta do Gabriel é correta. Eu queria só fazer um comentário (mas não tenho pontos suficientes para tal):
Como este é um fórum para desenvolvedores, faz sentido colocar o link e explicar a função, até para que possam utilizar com outros roles (e capabilities).
Documentação da função: https://codex.wordpress.org/Function_Reference/current_user_can
Forma de utilização da função:
<?php current_user_can( $capability , $object_id ); ?>

Onde $capability pode ser o role (função que exerce - administrator, subscriber) ou uma capability (função que realiza - publish_posts, activate_plugins). E o $object_id é opcional e só recomendado quando verificando meta capabilities.
Exemplos:
if( current_user_can('administrator') ) {
    //ações a tomar se usuário é adiministrador
}

$ativador_de_plugin = current_user_can('activate_plugins');


Is there a way to convert a list of integers to a single variable?

Question: I'd like to convert a list of integers to a singe variable.
I tried this (found on another question):
r = len(message) -1
res = 0
for n in message:
  res += n * 10 ** r
  r -= 1

This does not work for me at all.
I basically need this:
message = [17, 71, 34, 83, 81]

(This can vary in length as I use a variable to change each one)
To convert into this:
new_message = 1771348381

Answer: A combination of join, map and str will do.
message = [17, 71, 34, 83, 81]
new_message = int(''.join(map(str, message)))
# 1771348381


Confused on marking figured bass for modulating sequence

Question: I started writing down the figured bass of an anime theme, and for a particular passage, I am confused on how to accurately write the figured bass progression. I have recreated the bare progressions excerpt below:

From what I have learned after pouring through the Internet and my old Harmony and voice leading textbook, I believe from measure (mm) 4, the key goes from g minor to the eventual D Major through the III7 as a altered common chord (with the C#). What follows in mm 5-7 is a descending sequence of 5ths that eventually ends in the D Major.
Is my analysis correct? And if so, how should I best write out the figured bass accurately?
Answer: Your chord analysis is good. Here's my version, which is fundamentally the same. The common chord you refer to is an applied dominant, labeled V/v (read: "five of (minor) five")
<code>X: 1
T: Anime Theme Analysis
M: 4/4
L: 1/4
K: Gmin
V:RH
V:LH clef=bass
[V:RH]"g min:" y [B,E]4 | [CF]4 | [B,E]4 | [A,D]4 | [^C=E]4 | [FA]2 [DB]2 | [EC']2 [^C']2 | [D']4
[V:LH] y [C,G,C]4 | [D,D]2 D,/2C,/2A,,/2C,/2 | [C,G,C]4 | [B,,B,]4 | [A,,A,]4 | [D,A,]2 [G,,D,G,]2 | [C,C]2 [A,,^C]2 | [D,A,]4
s: iv7 | v7 | iv7 | III7 | V/v | v i | iv V/v | v
</code>
Just know, this is a Roman numeral analysis, not figured bass. Figured bass includes only the intervals above the bass and is not explicit about the name or function of the chord.


Erro PLS-00103 ao tentar compilar um Package

Question: estou tentando compilar o package abaixo e está sendo retornado o erro: Erro(9,3): PLS-00103: Encontrado o símbolo "BEGIN" quando um dos seguintes símbolos era esperado:     idioma
CREATE OR REPLACE PACKAGE PCK_TB_ESTADO
IS
  PROCEDURE PRC_INSERE
  (P_NM_REDE_FUNCIONARIO IN TB_FUNCIONARIO.NM_REDE_FUNCIONARIO%TYPE,
  P_DS_ESTADO IN TB_ESTADO.DS_ESTADO%TYPE,
  P_ID_UF IN TB_ESTADO.ID_UF,
  P_MENS OUT VARCHAR2)
  IS
  BEGIN
    CREATE SEQUENCE SEQ_ESTADO
      MINVALUE 1
      MAXVALUE 99
      START WITH 1
      INCREMENT BY 1;
    INSERT INTO TB_ESTADO
    VALUES (SEQ_ESTADO.NEXTVAL,P_DS_ESTADO,P_ID_UF,SYSDATE,P_NM_REDE_FUNCIONARIO);
    COMMIT;
    EXCEPTION
      WHEN DUP_VAL_ON_INDEX THEN
        ROLLBACK;
        P_MENS := 'Você tentou executar um comando INSERT ou UPDATE que criou um valor duplicado em um campo restrito por um index único.';
      WHEN OTHERS THEN
        ROLLBACK;
        P_MENS := 'Erro.';
  END;
END PCK_TB_ESTADO;

Answer: Packages no Oracle são divididos em especificação (specification) e implementação (body).
A implementação das procedures e funções, além de declarações de variáveis, devem ser feitas usando o comando CREATE PACKAGE BODY.
Um exemplo, extraído de outra documentação:
CREATE OR REPLACE PACKAGE Emp_package AS
    TYPE Emp_data_type IS RECORD (
        Emp_number NUMBER,
        Hire_date  VARCHAR2(12),
        Emp_name   VARCHAR2(10));
    PROCEDURE Get_emp_data
        (Emp_data IN OUT Emp_data_type);
END;

CREATE OR REPLACE PACKAGE BODY Emp_package AS
    PROCEDURE Get_emp_data
        (Emp_data IN OUT Emp_data_type) IS
   BEGIN
       SELECT Empno, Ename, TO_CHAR(Hiredate, 'DD/MON/YY')
           INTO Emp_data
           FROM Emp_tab
           WHERE Empno = Emp_data.Emp_number;
   END;
END;

Notas sobre a procedure da pergunta
A criação de uma sequência de auto-incremento dentro da procedure provavelmente não vai surtir o efeito que você quer por dois motivos:

Um objeto não pode ser usado no mesmo bloco que foi criado, pois o Oracle faz a criação de uma forma transacional. Pelo menos nas versões que eu uso, esse código não vai nem compilar. Porém, você pode usar o comando EXECUTE IMMEDIATE para forçar a execução e alteração imediata.
Mesmo criando o SEQUENCE com sucesso, ele sempre iria iniciar com o mesmo valor. Por que simplesmente não o cria juntamente com a tabela, uma única vez?


Take input of date in format mm/dd/yyyy and split into 3 separate variables?

Question: I'm trying to figure out how to do some date validation. I need to be able to take an input from user in the form of mm/dd/yyyy and do various calculations with it to determine validity. However, I can't figure out how to split the date into three variables day,month,year after I got the input. I've played around with getline and get functions but I can't figure it out. Thanks for any help in advance from a newbie. PS I don't want to use any built in date validation functions.
int main()
{
    char fill = '/';
    string entered_date;
    int entered_month;
    int entered_year;
    int entered_day;

    cout << "Enter a date (mm/dd/yyyy): " << endl;
    cin >> entered_date;
    //getline(month, 2, '/');  < fix me

    //cout << entered_month << "/" << entered_day << "/"
    //  << entered_year << endl;
    system("Pause");

}

Answer: You can use scanf in such a case, as it provides much more functionality than cin.
int mm, dd, yyyy;
scanf("%d/%d/%d", &mm, &dd, &yyyy);

This should hopefully do the trick.
EDIT: Another way to do so would be to take the entire input in the form of a string, and then find substrings and validate each part.
string date;
cin >> date;
string delimiter = "/";
auto start = date.begin(); // iterator at beginning of string
auto finish = date.find(delimiter); // gives position of first occurrence of delimiter
if (finish == date.npos) // find returned the end of string
  // delimiter does not exist in string.
else
  int month = stoi(date.substr(0, finish)); // Extracts month part from date string
date = date.substr(finish+1); // Removes the month part from the date string
// Understand this piece and write further ahead.

If you know your input will be correct, then use the first part as it will be much faster. If there are chances of incorrect input, use the second as it will be more robust.
Comment: I was thinking about that too but what if the format of the date is invalid? He wants to validate the date as far as I got that
Comment: Edited it to make it useful for date validation.
Comment: when i use int instead of auto i get warning
Answer: The simplest way is to use std::string::substr, and then call stoi:
#include <string>
#include <iostream>

using namespace std;

int main()
{
    char fill = '/';
    string entered_date;
    int entered_month;
    int entered_year;
    int entered_day;

    cout << "Enter a date (mm/dd/yyyy): " << endl;
    cin >> entered_date;
    entered_month = stoi(entered_date.substr(0,2));
    entered_day = stoi(entered_date.substr(3,2));
    entered_year = stoi(entered_date.substr(6));
}

Live example: http://ideone.com/PWyh8J


How do you select in-line text with Jquery?

Question: How can I select the text infront of the unordered list below?

   How can I remove this text?

Link

I tried doing something like this:
$('ul.bar').previousSibling().remove();

But I think that would only work with another element, and I'm not entirely sure how to go about selecting text that isn't contained inside tags.
Answer: Is the solution you're looking for.
$('.foo').contents().filter(function(){
    return (this.nodeType == 3);
}).remove();

Demo here

The nodeType property returns the node type, as a number, of the
  specified node.
  If the node is a text node, the nodeType property will return 3.

Non jQuery version:
Get the Parent Node. Get all the Children nodes of the Parent. Convert the collection of Nodes to an array. Loop through the array. Check the nodeType on every iteration. If the nodeType === 3 then it's a text node. Then delete it.
Array.prototype.slice.call(document.getElementById('parent_node_id_here').childNodes, 0).forEach(function (value) {
    if (value.nodeType === 3) {
        value.remove();
    }
});

Comment: Good one! I was going to hack it with: `$('.foo').html($('.bar'));`  But your  answer is exactly what he's asking for
Answer: $(".foo").contents().get(0).remove()

or without jquery
document.getElementsByClassName("foo")[0].childNodes[0].remove()

Answer: Try
$(".foo").replaceWith($.parseHTML($(".foo").html()).slice(1));

$(".foo").replaceWith($.parseHTML($(".foo").html()).slice(1));

   How can I remove this text?

Link


Ping not working in network namespace

Question: If I do:
sudo ip link add l4 type veth
sudo ip addr add "188.8.131.52/24" dev l4
ping 220.127.116.11
PING 126.96.36.199 (188.8.131.52) 56(84) bytes of data.
64 bytes from 18.104.22.168: icmp_seq=1 ttl=64 time=0.023 ms
64 bytes from 184.108.40.206: icmp_seq=2 ttl=64 time=0.102 ms

ping is working
but in namespace:
sudo ip netns add test
sudo ip netns exec test ip link add l5 type veth
sudo ip netns exec test ip addr add "220.127.116.11/24" dev l5
sudo ip netns exec test ping 126.96.36.199
PING 22.214.171.124 (220.127.116.11) 56(84) bytes of data.
^C
--- 18.104.22.168 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2034ms

ping is failing.
Why this difference?
How to make ping work in namespace?
Answer: TL;DR: the issue is not related to network namespaces, nor veth interfaces, but to the local routing between two local IPs going through the lo interface.

Here's a simplified version, not requiring a veth interface (nor any interface other than the loopback interface) to reproduce the problem:
# ip address add 192.0.2.2/32 dev lo
# ping -c2 192.0.2.2
PING 192.0.2.2 (192.0.2.2) 56(84) bytes of data.
64 bytes from 192.0.2.2: icmp_seq=1 ttl=64 time=0.162 ms
64 bytes from 192.0.2.2: icmp_seq=2 ttl=64 time=0.108 ms

--- 192.0.2.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1061ms
rtt min/avg/max/mdev = 0.108/0.135/0.162/0.027 ms

# ip netns add test
# ip -netns test address add 192.0.2.3/32 dev lo
# ip netns exec test ping -c2 192.0.2.3
PING 192.0.2.3 (192.0.2.3) 56(84) bytes of data.

--- 192.0.2.3 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1027ms

# ip -netns test link set dev lo up
# ip netns exec test ping -c2 192.0.2.3
PING 192.0.2.3 (192.0.2.3) 56(84) bytes of data.
64 bytes from 192.0.2.3: icmp_seq=1 ttl=64 time=0.037 ms
64 bytes from 192.0.2.3: icmp_seq=2 ttl=64 time=0.069 ms

--- 192.0.2.3 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 0.037/0.053/0.069/0.016 ms

Choosing an entirely non-adequate interface (Intermediate Functional Block) will do the same:
# ip -netns test link set dev lo down # previous state
# ip -netns test link add name test0 type ifb
# ip -netns test address add 192.0.2.4/32 dev test0
# ip -netns test route get 192.0.2.4
local 192.0.2.4 dev lo src 192.0.2.4 uid 0
    cache <local>
# ip netns exec test ping -c2 192.0.2.4
PING 192.0.2.4 (192.0.2.4) 56(84) bytes of data.

--- 192.0.2.4 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1006ms

# ip -netns test link set dev lo up
# ip netns exec test ping -c2 192.0.2.4
PING 192.0.2.4 (192.0.2.4) 56(84) bytes of data.
64 bytes from 192.0.2.4: icmp_seq=1 ttl=64 time=0.025 ms
64 bytes from 192.0.2.4: icmp_seq=2 ttl=64 time=0.054 ms

--- 192.0.2.4 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1015ms
rtt min/avg/max/mdev = 0.025/0.039/0.054/0.015 ms

The explanation is simple: By default when any IP assigned to any interface (even an entirely non-adequate interface, or also an interface in down state) tries to reach any same or other IP assigned to any same or other interface, with both IPs belonging to the same host, the route is using the lo interface, this goes along with the weak host model used on Linux. It doesn't matter what the interface is intended for: it won't be used at all. What matters is that the lo interface is up. When a new network namespace is created, it's automatically receiving the lo interface, but in down state. For any local traffic to succeed in this network namespace, the lo interface has to be brought up.
Common misuse: assigning an IP to a tun/tap interface (the network packets, be they IP or anything else, must be handled by the application behind, not the kernel). While pinging the IP from the host will work as explaned above, this won't help solve any work and will hinder correct usage.
Now if the intended goal was to route between initial namespace and the test namespace, here's a working example with a pair of veth interfaces:
# ip link add name vethtotest0 type veth peer netns test name vethtoinit0
# ip link set dev vethtotest0 up
# ip -netns test link set dev vethtoinit0 up
# ip address add 198.51.100.1/24 dev vethtotest0
# ip -netns test address add 198.51.100.2/24 dev vethtoinit0
# ip netns exec test ping 198.51.100.1
# ip netns exec test ping -c2 198.51.100.1
PING 198.51.100.1 (198.51.100.1) 56(84) bytes of data.
64 bytes from 198.51.100.1: icmp_seq=1 ttl=64 time=0.171 ms
64 bytes from 198.51.100.1: icmp_seq=2 ttl=64 time=0.101 ms

--- 198.51.100.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1055ms
rtt min/avg/max/mdev = 0.101/0.136/0.171/0.035 ms

Still for the ping to 198.51.100.2 to succeed inside the test namespace, the lo interface must be up. It's not needed for the previous test since the route is through vethtoinit0.

Ping not working in network namespace


Inferring A given C and chain ABC

Question: We have a claimed causal chain $A\to B\to C$. We know that $P(C) < 0.01$ and we know that $P(B|A) > 0.9$ and $P(C|B) > 0.9,$ how can we find $P(A)?$
We might lack information here but can we approximate it?
Comment: I am treating this like a https://stats.stackexchange.com/questions/tagged/self-study problem. Maybe it is? Anyway, the answer doesn't depend on whether it's easily or difficultly solved. It's either solvable or not, and if not you can pinpoint what one or two features are missing to enable solving it.
Comment: Causality is not a necessary condition to attempt this problem. Are you aware of how Bayes' rule relates total and conditional probabilities? If you use Bayes you can either solve this or prove that it's unsolvable with the information given.
Comment: yes I know Bayes and conditional probability but I don't think it's easily solvable with basic laws
Comment: $A \rightarrow B \rightarrow C $ is not equivalent to $A \subset B \subset C$, correct? Does it imply anything else than $P(B \mid A) \approx 1$ and $P(C\mid B) \approx 1$ ? From the information provided, it is impossible to establish a lower bound for $A$ other than 0.
Comment: Consider the simplified problem: , $P(B\mid A ) > 0.9$, $P(B) < 0.01$. Then $P(B) = P(A)P(B\mid A)+ P(A^c)P(B\mid A^c)$ and so $P(A) = \frac{P(B) - P(A^c)P(B\mid A^c)}{P(B\mid A)} < \frac{0.01 - P(B\mid A^c)}{0.9}$.
Answer: The question is a bit confusing because of the lack of distinction between events and random variables. I'll assume that $A, B, C$ are Bernoulli random variables, and that all the probabilities concern success events like $P(C=1)<0.01$, and so on.
With this interpretation, we can use the information you gave to obtain a statement on $P(A=1)$. Clearly, if $A=1$, the event $C=1$ if very likely because $P(B=1\mid A=1) > 0.9$, and $P(C=1 \mid B=1) > 0.9$, meaning that $P(C=1 \mid A=1) > 0.9^2$.
Assuming the most extreme case of $P(C=1 \mid A=0) = 0$, we would still need $P(A=1) < \frac{0.01}{0.9^2}$ to be able to achieve $P(C=1) < 0.01$ (this is a necessary, not a sufficient criterion).
If $P(C=1 \mid A=0)$ was greater than $0$, $P(A=1)$ would have to be even lower.

Inferring A given C and chain ABC


Which average would make the most sense (mean, mode, median)?

Question: I have musical data, for tuning information for notes of an instrument.
For each note played, I have the cents away from in tune (-50.0 - 50.0). I'd like to display the average each note was out of tune. I'm not sure which would make the most sense (eg. mean, mode, median) for this scenario.
Any tips for determining the best solution? The goal is to inform the user what their tuning tendencies are. Is there something else I should be using instead of the above options?
Comment: It depends on whether you want to indicate that they have bias (e.g. they generally tend to tune to too high a pitch, or generally too low) or dispersion (they are not very good at getting the correct pitch).
Answer: I'm not sure that there is a mathematical answer to this question, as each statistic has their use. But, for what it is worth, here is my opinion on each three:
1) Tried and true, the mean is what people think of when they hear the word "average". Not a lot can go wrong with this statistic unless someone adds a note so severely out of tune that it isn't even the right note anymore.
2) Mode is almost certainly useless for you unless you plan on "bucketing" your results into small cent intervals, and even then you would do better to provide the entire histogram rather than just the mode.
3) The median is an excellent way of providing midpoint data, and it will help suppress outliers. I think it is fair to say, in general, that "natural" data won't have a mean and median that differ too greatly from one another, so this should also be acceptable. It is however not as well known as the mean, and so your users might not be expecting it, especially if you call it an "average".


Unable to Connect to AWS RDS using endpoint

Question: We have two RDS running on AWS. On is a production database and the other is a development database. Both servers were working correctly until we decided to upgrade the production server from a db.t2.micro to a db.t3.medium. After upgrading none of the connections to the database are working.
The development database is working correctly still and we can still connect correctly to that database. We have checked that the endpoint still matches the settings in the configuration files. We have checked the security settings and have it set that any ip or host can connect. Every time we try to connect we get a timeout error, so incorrect credentials don't seem to be the problem. We are able to make a connect via ip address but not using the endpoint. We have checked the settings between the two databases are they are identical except for the size and the name.
Comment: When you do an nslookup do you get the expected IP? I suggest you have someone independently check your configuration, as based on what you've said it should probably work. It will be something small and simple, but probably difficult to find.
Comment: The problem ended up being a problem with a load balancer that had been setup
Comment: Please answer your own question with a more detailed answer, and then 24 hours later accept the answer. This will help others in future.
Answer: When restoring from snapshot, the user interface does not allow putting the database into a secondary vpc. So if you have "upgraded" by restoring from snapshot, your Rds database may be in the wrong vpc network and therefore not have a route to get to from your server.
You need to modify the vpc rds is launched into in this case.


Extracting data from a single variable to multi variable- multi observations by symbols and text. [{..]}

Question: I have a CSV, extracted from an HTML site, many columns hold a lot of information in one cell. for example- this text is from one cell. It holds the name of 3 companies:
[{"company":"Orange","location":"","url":"https://www.xyz","positions":[{"title":"CEO","subtitle":"honelulu","description":"","duration":"Dec 2021 - Present 7 months"}] ,"industry":"Non-profit Organizations"},{"company":"Fig","location":"","url":"https://www.xyz2","positions":[{"title":"Business Development Manager","subtitle":"Fig","duration":"Feb 2019 Dec 2021 2 years 11 months",}],},
{"company":"Papaya","location":"","url":"https://www.xyz3","positions":[{"title":"Business Development Manager","subtitle":"Pragaya","description":"","duration":"Jan 2018 Oct 2018 10 months",}],"industry":"High Tech"},}]

I would like to extract each company into a different row, with the user name, position, duration and industry in different columns.

I also have other date in other columns that I wish would stay the same.

Any ideas for a simple way to do this?
Answer: This tidyr approach with extract works for a start:
library(dplyr)
library(tidyr)
data.frame(dat) %>%
  # simplify:
  mutate(dat = gsub('["\\]\\[}{]', '', dat, perl = TRUE)) %>%
  # separate:
  separate_rows(dat, sep = '(?<!^)(?=company)') %>%
  # extract:
  extract(dat, "company", "company:([^,]+).*", remove = FALSE) %>%
  extract(dat, "user_name", ".*url:([^,]+).*", remove = FALSE) %>%
  extract(dat, "position", ".*\\btitle:([^,]+)", remove = FALSE)
# A tibble: 3 × 5
  industry                 duration                              position                     user_name        company
  <chr>                    <chr>                                 <chr>                        <chr>            <chr>
1 Non-profit Organizations "Dec 2021 - Present 7 months "        CEO                          https://www.xyz  Orange
2 NA                       "Feb 2019 Dec 2021 2 years 11 months" Business Development Manager https://www.xyz2 Fig
3 High Tech                "Jan 2018 Oct 2018 10 months"         Business Development Manager https://www.xyz3 Papaya

Data:
dat <- '{"company":"Orange","location":"","url":"https://www.xyz","positions":[{"title":"CEO","subtitle":"honelulu","description":"","duration":"Dec 2021 - Present 7 months"}] ,"industry":"Non-profit Organizations"},{"company":"Fig","location":"","url":"https://www.xyz2","positions":[{"title":"Business Development Manager","subtitle":"Fig","duration":"Feb 2019 Dec 2021 2 years 11 months",}],},{"company":"Papaya","location":"","url":"https://www.xyz3","positions":[{"title":"Business Development Manager","subtitle":"Pragaya","description":"","duration":"Jan 2018 Oct 2018 10 months",}],"industry":"High Tech"},}]'

See also Use tidyr's function `extract` with optional capture group for a more elegant solution


Knapsack Problem using Dynamic Programming: Mathematical Equation

Question: I am trying to understand the knapsack problem from the book:
Algorithm Design
I can't understand the following equation. This provides solution to knapsack problem in the context of Dynamic programming. So we have S small problems. But I can't understand what is meant by max S summation of weight over subscript j.
Some body please guide me.
Zulfi.
Answer: It means the maximum value of the sum of weights of items in $S$, considering all possible choices of $S$ that satisfy the two specified restrictions.  It can also be written as $$\max\left\{\sum_{j\in S} w_j: S\subseteq\{1,\dots,i\} \text{ and } \sum_{j\in S} w_j\le w\right\}.$$


GROUP BY but ignore nulls unless no not-nulls

Question: (I'm simplifying my data for sake of explanation)
I have a denormalized table (basically the result of a join between 3 different tables) like this:
driver_uuid | vehicle_uuid | document_uuid

A driver has many vehicles,
A driver has many documents,
A vehicle has many documents
I want to run a query where there is a row for each unique driver/vehicle pair.
I tried just doing
SELECT * FROM driver_vehicle_documents
GROUP BY
driver_uuid,
vehicle_uuid

This almost works, but with one problem:
A driver that has 1 or more vehicles will show up one more time than the number of vehicles they have. i.e. a driver that has 1 vehicle will show up twice: once for the driver/vehicle pair, and once for driver/null pair.
We want it so that a driver that has 0 vehicles will show up once. A driver with 1 vehicle will show up once, a driver with 2 vehicles will show up twice, etc.

I know the table design is not ideal for this problem, but the table is used for many different purposes and was designed with those considerations. Changing its design is not feasible at this time.
Answer: On approach is to handle the NULL values separately.  So, basically run your query filtering out NULL values and then add back in the ones you want:
SELECT DISTINCT driver_uuid, vehicle_uuid
FROM driver_vehicle_documents
WHERE vehicle_uuid
UNION ALL
SELECT DISTINCT driver_uuid, NULL
FROM driver_vehicle_documents dvd
WHERE NOT EXISTS (SELECT 1
                  FROM driver_vehicle_documents dvd2
                  WHERE dvd2.driver_uuid = dvd.driver_uuid AND
                        dvd2.vehicle_uuid IS NOT NULL
                 );

Answer: Imagine you have two lists; a list of drivers and a list of vehicles.
You want the complete list of drivers, plus any vehicle records if they exist.
You can accomplish this with a self-outer-join, like this:
SELECT    drivers.driver_uuid,
          vehicles.vehicle_uuid,
          vehicles.document_uuid
FROM      driver_vehicle_documents drivers
LEFT JOIN driver_vehicle_documents vehicles ON  vehicles.driver_uuid = drivers.driver_uuid
                                            AND vehicles.vehicle_uuid IS NOT NULL

The join will only allow records where there is a vehicle ID.  But if none are found, the driver record will still be output (because it's an outer join) and the vehicle and document IDs will just come back as null.
Comment: This worked! Modified it a bit to fit the actual implementation of our table and it worked like a charm. Thanks for the help!
Comment: It's a miracle (I wasn't sure)!
Answer: Seems rather straight forward: filter out null values and do not include the third column
Seems rather straight forward: filter out null values and do not include the third column
SELECT driver_uuid, 0
FROM driver_vehicle_documents
WHERE vehicle_uuid  is null
GROUP BY
    driver_uuid,
    vehicle_uuid

UNION ALL

SELECT driver_uuid, vehicle_uuid
FROM driver_vehicle_documents
WHERE vehicle_uuid  is not null
GROUP BY
    driver_uuid,
    vehicle_uuid


HTML aggility pack wont return div ids from web site

Question: I'm using Google as an example to test and I know that there are divs with ids on the page
If I use xpath "//div"  it returns 14 divs in my collection with no id text
If I use xpath "//div/@id"  it returns 0 divs
What am I doing wrong here? Thanks code is below
Dim l As List(Of String) = New List(Of String)
Dim w As HtmlWeb = New HtmlWeb()
Dim h As HtmlDocument = web.Load("http://www.google.com/")

Dim ht As HtmlNodeCollection = h.DocumentNode.SelectNodes("//div/@id")

For Each x As HtmlNode In ht

    l.Add(x.Id)

Next

Answer: Your XPath expression selects a collection of id attributes rather than a collection of div elements. Change it to this: //div[@id]


Android ListView With Fragment View Not Created

Question: I'm using a ListView in a fragment and I've set every necessary requirement as told by Android, my XML List Code below
<code>    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ListView
        android:id="@id/android:list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#253453">
    </ListView>

</LinearLayout>
</code>
And in my code
<code>   @Override
public View onCreateView(LayoutInflater inflater,
        @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    View android = inflater.inflate(R.layout.pending_frag, container, false);
    context = getActivity().getApplicationContext();
    //ListView list = (ListView)android.findViewById(R.id.list);
    ListView list = getListView();

      trackItems = new ArrayList<TrackItem>();
      listAdapter = new TrackOrderListAdapter(getActivity(), trackItems);
      list.setAdapter(listAdapter); }
</code>
But, I still get this error

08-20 23:26:26.053: E/AndroidRuntime(30334): FATAL EXCEPTION: main
  08-20 23:26:26.053: E/AndroidRuntime(30334): Process:
  com.deliveryscience.track, PID: 30334 08-20 23:26:26.053:
  E/AndroidRuntime(30334): java.lang.IllegalStateException: Content view
  not yet created 08-20 23:26:26.053: E/AndroidRuntime(30334):  at
  android.support.v4.app.ListFragment.ensureList(ListFragment.java:328)
  08-20 23:26:26.053: E/AndroidRuntime(30334):  at
  android.support.v4.app.ListFragment.getListView(ListFragment.java:222)
  08-20 23:26:26.053: E/AndroidRuntime(30334):  at
  com.deliveryscience.track.PendingActivity.onCreateView(PendingActivity.java:51)
  08-20 23:26:26.053: E/AndroidRuntime(30334):  at
  android.support.v4.app.Fragment.performCreateView(Fragment.java:1504)
  08-20 23:26:26.053: E/AndroidRuntime(30334):  at
  android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:942)
  08-20 23:26:26.053: E/AndroidRuntime(30334):  at
  android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1121)
  08-20 23:26:26.053: E/AndroidRuntime(30334):  at
  android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
  08-20 23:26:26.053: E/AndroidRuntime(30334):  at
  android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1484)
  08-20 23:26:26.053: E/AndroidRuntime(30334):  at
  android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:482)
  08-20 23:26:26.053: E/AndroidRuntime(30334):  at
  android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
  08-20 23:26:26.053: E/AndroidRuntime(30334):  at
  android.support.v4.view.ViewPager.populate(ViewPager.java:1073) 08-20
  23:26:26.053: E/AndroidRuntime(30334):    at
  android.support.v4.view.ViewPager.populate(ViewPager.java:919) 08-20
  23:26:26.053: E/AndroidRuntime(30334):    at
  android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441)
Comment: post your whole `pending_frag` xml
Answer: <code> @Override
public View onCreateView(LayoutInflater inflater,
        @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    return inflater.inflate(R.layout.pending_frag, container, false);

}

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onViewCreated(view, savedInstanceState);
    context = getActivity().getApplicationContext();
    //ListView list = (ListView)android.findViewById(R.id.list);
    ListView list = getListView();

    trackItems = new ArrayList<TrackItem>();
    listAdapter = new TrackOrderListAdapter(getActivity(), trackItems);
    list.setAdapter(listAdapter);
}
</code>
You can't really manipulate the view until the views are created.
Comment: I thought as much too @CChi, it was after seeing your code i knew I was doing it wrong. Thanks Anyway


If $\frac{\tan(a+b-c)}{\tan(a-b+c)}=\frac{\tan c}{\tan b}$, then $\sin(b-c)=0$ or $\sin 2a + \sin2b + \sin 2c=0$

Question: If $$\frac{\tan (\alpha + \beta - \gamma )}{\tan (\alpha - \beta + \gamma )}=\frac{\tan \gamma}{\tan \beta}$$
then prove
$$\sin (\beta - \gamma)=0$$
or $$\sin 2\alpha + \sin2\beta + \sin 2\gamma =0$$
here my try goes -
To prove $\sin (\beta - \gamma)=0$, sin x = 0, only when x = 0 or 360 degree, but for the sake of simplicity let's take x = 0, then we've to prove that $\beta - \gamma =0$ or $\beta = \gamma$.
Now,
If $\beta = \alpha$, then first equation will be $\frac{\tan \alpha}{\tan \alpha}= \frac{\tan\gamma}{\tan\beta}$
or $\frac{\tan\gamma}{\tan\beta}=1$
and
$$\frac{\tan x}{\tan y}=1$$, only if $$\tan x = \tan y$$
So, also in this case $\tan \gamma$ must be equal to $\tan \beta$ so, as to prove that $\sin (\beta - \gamma)=0$.
So, how to prove that $\beta = \gamma$?
and how to solve the second part of the question here?
Comment: Hitting the problem with *Mathematica*, the tangent equation reduces to $$\sin(\beta-\gamma)\left(\sin 2\alpha+\sin 2\beta+\sin 2\gamma \right) = 0$$ (There's probably a clever way to get to that. In any case...) The correct conclusion would seem to be that $\sin(\beta-\gamma)= 0$ **OR** (not "and") $\sin 2\alpha+\sin 2\beta + \sin 2\gamma = 0$.
Comment: [*Mathematica*](http://www.wolfram.com/mathematica/) is a powerful computer algebra system that makes trig manipulations like this one fairly trivial. An online counterpart exists as [WolframAlpha](http://wolframalpha.com).
Comment: @blue what's Mathematica?
Comment: Wow that's incredible
Answer: If I add $1$ to both sides of your first equation then exploit sum-to-product formulas, I'll get$$\frac{\sin2\alpha}{\sin(\alpha-\beta+\gamma)\cos(\alpha+\beta-\gamma)}=\frac{2\sin2\alpha}{\sin2\alpha\cos(-2\beta+2\gamma)}=\frac{\sin(\beta+\gamma)}{\sin\beta\cos\gamma}.$$ If I instead subtract $1$ and then re-evaluate, I'll have $$-\frac{\sin(2\gamma-2\beta)}{\cos(\alpha+\beta-\gamma)\sin(\alpha-\beta+\gamma)}=-\frac{\sin(\gamma-\beta)\cos(\gamma-\beta)}{\cos(2\gamma-2\beta)\sin2\alpha}=-\frac{\sin(\beta-\gamma)}{\cos\gamma\sin\beta}.$$
Dividing the two equalities leaves\begin{align}-\frac{\sin2\alpha}{\sin(2\gamma-2\beta)}=\frac{\sin(\beta+\gamma)}{\sin(\gamma-\beta)}\rightarrow-&\sin(\gamma-\beta)\sin2\alpha=2\sin(\beta+\gamma)\sin(\gamma-\beta)\cos(\gamma-\beta)\\
&=\sin(\gamma-\beta)\big(\sin2\gamma+\sin2\beta\,\big),
\end{align}so either $\sin(\gamma-\beta)=0$ or $0=\sin2\alpha+\sin2\beta+\sin2\gamma$.
Comment: $$\frac{\tan x}{\tan y}\pm1=\frac{\sin x\cos y\pm\cos x\sin y}{\cos x\sin y}=\frac{\sin(x\pm y)}{\cos x\sin y}.$$
Answer: Let's define $\mu := \frac12(\beta+\gamma)$ and $\nu:=\frac12(\beta-\gamma)$, so that we have
$$\frac{\tan(\alpha+2\nu)}{\tan(\alpha-2\nu)} = \frac{\tan(\mu-\nu)}{\tan(\mu+\nu)} \quad\to\quad
\frac{\sin(\alpha+2\nu)\cos(\alpha-2\nu)}{\sin(\alpha-2\nu)\cos(\alpha+2\nu)}=\frac{\sin(\mu-\nu)\cos(\mu+\nu)}{\sin(\mu+\nu)\cos(\mu-\nu)}$$
The identity
$$\sin(p\pm q)\cos(p \mp q) = \sin p \cos p \pm \sin q \cos q = \frac12( \sin 2p \pm \sin 2q) \tag{$\star$}$$
gives us
$$\frac{\sin 2\alpha + \sin 4\nu}{\sin 2\alpha - \sin 4 \nu}
= \frac{\sin 2\mu - \sin 2 \nu }{\sin 2 \mu + \sin 2\nu}$$
so that, upon cross-multiplying and combining terms,
$$\begin{align}
0 &= \sin 2\alpha \cdot 2 \sin 2\nu + \sin 4\nu \cdot 2\sin 2\mu \\
&= \sin 2\alpha \cdot 2 \sin 2\nu + 2\sin 2\nu \cos 2\nu \cdot 2\sin 2\mu \\
&= 2\sin 2\nu\left(\; \sin 2\alpha + 2\sin2\mu\cos 2\nu \;\right) \\
&= 2\sin(\beta-\gamma)\left(\; \sin 2\alpha + 2\sin(\beta+\gamma)\cos(\beta-\gamma) \;\right) \\
&= 2\sin(\beta-\gamma)\left(\; \sin 2\alpha + \sin 2 \beta + \sin 2\gamma  \;\right) \qquad\text{(using $(\star)$ again)} \\
\end{align}$$
Therefore,
$$\sin(\beta-\gamma) = 0 \qquad\text{or}\qquad \sin 2\alpha + \sin 2 \beta + \sin 2\gamma = 0$$
$\square$
Comment: You know Wolfram is cooool. I never expected such thing. I'm trying to make my own trignometeric Wolfram which uses AI to solve the problems
Comment: Wolfram *is* cool. (According to legend, Stephen Wolfram started the company just so he could do math with the product. :) A trig AI sounds great ... but Wolfram may be way ahead of you. The Wolfram Language is extensive and powerful, and some aspects of it already use AI. (For instance, there's an `ImageIdentify` function. See [Stephen Wolfram's blog post](http://blog.stephenwolfram.com/2015/05/wolfram-language-artificial-intelligence-the-image-identification-project/) about such stuff.) Of course, that's not to discourage your own work in this area. May you have great success!
Comment: you've understood my way? Is there any way to do in my way?
Answer: $$\dfrac{\tan C}{\tan B}=\dfrac{\tan(A+(B-C))}{\tan(A-(B-C))}$$
$$\iff\dfrac{\sin C\cos B}{\cos C\sin B}=\dfrac{\sin(A+(B-C))\cos(A-(B-C))}{\sin(A-(B-C))\cos(A+(B-C))}$$
Using Componendo et Dividendo,
$$\dfrac{\sin(B+C)}{\sin(B-C)}=\dfrac{\sin2A}{-\sin2(B-C)}$$
$$\implies\sin(B-C)\sin2A=-\sin(B+C)\sin2(B-C)$$
The right hand side can be simplified as
$$=-\sin(B-C)\{2\sin(B+C)\cos(B-C)\}$$
$$=-\sin(B-C)(\sin2B+\sin2C)$$
Comment: I _thought_ the technique I used had a name.
Comment: @AntonioDJC, Are you talking about http://mathworld.wolfram.com/WernerFormulas.html OR http://mathworld.wolfram.com/ProsthaphaeresisFormulas.html
Comment: I was referring to _componendo et dividendo_ (which I remembered vaguely from an unrelated proof).
Comment: @labbhattacharjee How you predicted that - $$\frac{\sin (B + C)}{\sin (B - C)} = \frac{\sin 2A}{-\sin 2 (B - C)  }$$ after Compodendo and Dividendo? It has a lot of Variables and functions, so how you calculated whole in your mind?


Basic algebra square numbers

Question: Hello I'm new to algebra, I can't solve this:
$x+\sqrt{x}=13$
$x+\frac{1}{\sqrt{x}}=?$
can you help
Thank you.
Comment: Is the question asking how to find $x+\frac{1}{\sqrt{x}}$ without computing $\sqrt{x}$?
Answer: rewrite your equation in the form
$$\sqrt{x}=13-x$$ after squaring we get
$$x^2-27x+169=0$$
can you proceed?
Comment: I guess the question is how to find $x+\frac{1}{\sqrt{x}}$ *without* finding $x$.
Comment: but your term containes the variable $x$?
Comment: ... but I guess it can't be done because the answer is $\frac{170-12\sqrt x}{13}$.

Basic algebra square numbers


How to evaluate $\int_0^{\frac{\pi}{2}}\frac{dx}{1+\tan^{2013}x}$

Question: How to evaluate the integral
$$\int_0^{\frac{\pi}{2}}\frac{\mathrm dx}{1+\tan^{2013}x}$$
It is almost impossible to calculate the antiderivative of this function by hand. Are there any tricks?
Comment: Hint: For the part from $\pi/4$ to $\pi/2$, use $\tan(\pi/2-x)=\frac{1}{\tan x}$.
Answer: $$\text{Use }\int_a^bf(x)dx=\int_a^bf(a+b-x)dx$$
Generalization :
$$\text{If }J=\int_a^b\frac{g(x)}{g(x)+g(a+b-x)}dx, J=\int_a^b\frac{g(a+b-x)}{g(x)+g(a+b-x)}dx$$
$$\implies J+J=\int_a^b dx$$ provided $g(x)+g(a+b-x)\ne0$
Here $\displaystyle J=\int_0^{\frac\pi2}\frac{dx}{1+\tan^{2013}x}=\int_0^{\frac\pi2}\frac{\cos^{2013}x}{\sin^{2013}x+\cos^{2013}x}dx$ so $g(x)=\cos^{2013}x$
and in $\displaystyle\left[0,\frac\pi2\right]\sin x,\cos x\ge0\implies \cos^{2013}x+\sin^{2013}x>0$ i.e., $\ne0$
Comment: Thanks. I'll try this first
Comment: @Michael, my pleasure. Please find the edited version
Answer: Use the identity $$\int_{0}^{\pi/2}f(x)\,\,\mathrm{d}x = \int_{0}^{\pi/2}f\left(\frac{\pi}{2} - x\right)\,\,\mathrm{d}x $$
Now define $$g(x) = f(\pi/2 - x) $$ and note that $f(x) + g(x) = 1$. Thus the integral must equal $\pi/4$, check this yourself!
Note that the exponent 2013 is a red herring - this technique works owing to the symmetry of the tangent, and 2013 could be replaced by any real number and the integral would still equal $\pi/4$.
Comment: Very nice trick. Thanks!


Finding deviated time series

Question: I am new to statistics. I have some programming background but am a novice in statistics. I need some help/direction identifying methods/technics to solve below problem.
I have multiple time series, around 100. Each time series potentially have 100K to 1M readings/measurements at equal time intervals. Out of which, all time series are approximately similar (please note approximately similar not necessarily exactly similar) except one which will exhibit approximately similar pattern as others until some time and then starts to deviate. Like shown in the picture below.
In the picture below 1 and 2 are approximately similar time series. Because of large number of readings on a smaller scale, the small differences are not noticeable or not visible. But from my study point of view, I need to find 1 and 2 identical. And notice time series 3, it exhibits same pattern until the time where it is shown in red oval and from there it starts to deviate.

My question is what methods/technics I can use to identify the one time series that is deviating and the point/reading from where it starts to deviate?
Thanks in advance for any help.
Srinivas
Comment: Is cointegration a possible solution for this problem? Need some expert advice.
Comment: After further analysis, it doesn't look like a time series problem. This series has no Trend and Seasonality that are required of a time series to apply time series methods. If not time series methods, are there any other methods/techniques that I can apply?
Answer: One solution is to statistically determine points at which changes occur in the short term mean or variance along each timeseries. Change points from each of the 100 timeseries should occur at similar locations until a timeseries starts to deviate. The R changepoint package implements a number of change point detection methods you could apply to this task.

Finding deviated time series


How do I create a sticky navigation bar in Open Social?

Question: I'm using D8 and working on new theme in Open Social witch uses bootstrap/sass. In my theme I want the navigation bar (in the header region) to be sticky at the top of the screen.
I've made some javascript/sass code but I can't get it to work. This is what I have done so far:
Created a new javascript function in the theme_name.js file:
    //-- Sticky Header
    (function($) {
        Drupal.behaviors.navbar = {
            attach: function (context, settings) {

                var nbar = $('.header');

                if (nbar.length) {
                    var elmHeight = $('.header-top').outerHeight(true);
                    $(window).scroll(function() {

                        var scrolltop = $(window).scrollTop();
                        if (scrolltop > elmHeight) {
                            if (!nbar.hasClass('sticky')) {
                                nbar.addClass('sticky');
                            }

                        } else {
                            nbar.removeClass('sticky');
                        }
                    });
                }
            }
        }
    })();

This is a code snippet from the navbar.scss file:
.navbar-sticky-top {
  @include z-depth-3;
  position: fixed;
  top: 0;
  left: 0;
  z-index: $zindex-navbar-sticky;
}

Code snippet from the index.twig file:

...

This is the content of the region--header.html.twig file:
{% if content %}

      {{ content }}

{% endif %}

What am I missing here?
Answer: Seems like you're over-complicating it by re-writing things that bootstrap already does.  The stock bootstrap theme and most of it's subthemes should have a setting in the theme for setting a fixed nav bar.
See Appearances -> Theme settings -> Components -> Navbar.  There is an option for fixed top navbar.
If that does not do what you want, there is also the Bootstrap Affix plug-in which should be part of the standard drupal bootstrap theme.
See:  This W3school page for details.
Answer: I see that in the latest version of Open Social, the header bar is sticky. So maybe updating to a newer version helps you out!


How can I make controls in WPF stretch to fill available width when HorizontalAlignment and HorizontalContentAlignment don't work?

Question: I'm trying to make a simple WPF app that has sections that fill the available width. Despite trying various ways of stretching the width of elements, containers, and children, nothing is working and I can't figure out why.
Another question said to use uniformgrid which worked well EXCEPT that it set the height of all the elements uniformly which was definitely not what I wanted. I want all of the sections to look like the one in the picture - filled width, height auto based on the content. Here's the basic setup:
<Window x:Class="A_Customizer.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:A_Customizer"
        mc:Ignorable="d"
        Title="MainWindow"
        Background="#FF2B2B2B"
        Width="800"
        >
    <Window.Resources>

        </Style>

        </Style>

    </Window.Resources>
    <Grid Name="mainApp" >

        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <WrapPanel Grid.Row="0" >
            <Button ToolTip="Click to apply the below settings to this Jumpbox" Click="ApplyCustomizations">Customize</Button>
        </WrapPanel>

        <ScrollViewer Grid.Row="1">

            <WrapPanel HorizontalAlignment="Stretch" >
                <GroupBox
                    Background="#FFE2E2E2"
                    BorderBrush="#FF7F7F7F"
                    Margin="10,10,10,10"
                    Name="pathsBox"
                    HorizontalContentAlignment="Stretch"
                    HorizontalAlignment="Stretch"
                    >
                    <GroupBox.Header>
                        <Border Background="#FFAFAFAF" CornerRadius="3">
                            Key Paths
                        </Border>
                    </GroupBox.Header>

                    <StackPanel HorizontalAlignment="Stretch">
                        <Grid Margin="0,10,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="50"/>
                            </Grid.ColumnDefinitions>

                            <TextBox Name="homeFolder" Grid.Column="0" HorizontalAlignment="Stretch"></TextBox>
                            <Button Grid.Column="1" Click="NewQuickPath" ToolTip="Change home folder">
                                <Image Source="images\add_folder.png" Height="25" Cursor="Hand"></Image>
                            </Button>
                        </Grid>

                        <TextBox Name="progFolder" Grid.Column="0" HorizontalAlignment="Stretch"></TextBox>
                    </StackPanel>

                </GroupBox>

                <GroupBox
                    Background="#FFE2E2E2"
                    BorderBrush="#FF7F7F7F"
                    Margin="10,10,10,10"
                    Name="quickBox"
                    Height="auto"
                    HorizontalContentAlignment="Stretch"
                    >
                    <GroupBox.Header>
                        <Border Background="#FFAFAFAF" CornerRadius="3">
                            Quick Access Folders
                        </Border>
                    </GroupBox.Header>

                    <StackPanel HorizontalAlignment="Stretch">
                        <TextBlock TextWrapping="Wrap" Margin="15">
                            There are going to be folders you'll need to access frequently and keeping them pinned on top of the left menu in Explorer is helpful.
                            Select here to add them to the list of folders restored with the "Customize" button. Click any folder to remove it.
                        </TextBlock>

                        <Border CornerRadius="3" Background="#FFF3C7C7" Margin="6" Visibility="Collapsed" Name="quickErr" Tag="err_box">
                            <TextBlock Tag="errMsg" Foreground="#FFFD3434" TextWrapping="Wrap" Margin="6" ></TextBlock>
                        </Border>

                        <UniformGrid Name="quickPathsArea" Columns="1">

                        </UniformGrid>

                        <Grid Margin="0,10,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="50"/>
                            </Grid.ColumnDefinitions>

                            <TextBox  Grid.Column="0" HorizontalAlignment="Stretch"></TextBox>
                            <Button Grid.Column="1" Click="NewQuickPath" ToolTip="Add a new folder">
                                <Image Source="images\add_folder.png" Height="25" Cursor="Hand"></Image>
                            </Button>
                        </Grid>
                    </StackPanel>
                </GroupBox>
</wrappanel>
</scrollviewer>
</grid>

Comment: StackPanel instead of WrapPanel should work
Comment: Thank you, that seems to have done it. If you leave this as an answer, I'll mark it as accepted.
Answer: StackPanel with Orientation="Vertical" (default value) instead of WrapPanel should work: it will allow each child element use full width and as much height as necessary
Comment: This was it. I thought I tried most combinations, but clearly I missed this one.


Vertically and horizontally centering HTML5 Javascript

Question: So  I have this and want to center it vertically and horizontally:

I have tried every solution and none seem to work for me. Do I need to add something into the js?
I'd appreciate any help.
Thanks.
Comment: its javascript for moving/fading text over a background which is  600 x 405
Comment: Are you trying to position a script?
Comment: @gAMBOOKa - the script might be `document.write`-ing something.
Answer: Try:
#hd_type_container {
    position: absolute;
    top: 50%;
    height: 50%;
    width: whatever;
    height: whatever;
    margin-left: -whatever_width_is / 2;
    margin-top: -whatever_height_is / 2;
}

Remember though that absolute or relatively positioned elements are positioned relative to the "closest" parent container that's also absolute or relatively positioned.
In other words, if your div is a child of some other div that's absolutely positioned, you won't be centering to the screen, but centering to the parent div.
Update: Assuming you are trying to make a popup box of some kind, you might also want an overflow: hidden directive too.
Comment: Thanks, but it still wont vertically center. At the moment i have:

Which centers it fine, but vertically even with your code it just wont work. Thanks again.
Comment: sorry I typed margin right instead of margin top, my bad! It works perfectly thanks very much!
Answer:


Prove that if S is a symmetric relation on A and R $\subseteq$ S, then $R^{-1}$ $\subseteq$ S

Question: Let R be a relation on the set A.
pf(contradiction) Assume S is a symmetric relation on A and R $\subseteq$ S. Then (x,y) $\in$ S and (y,x) $\in$ S. Also, (x,y) $\in$ R. Assume $R^{-1} \not \subset$ S. Then (y,x) $\not \in$ S. This is a contradiction. Therefore, if S is a symmetric relation on A and R $\subseteq$ S, then $R^{-1}$ $\subseteq$ S.
This is what I have written. In a subset proof you are suppose to start off by "Let"(by what my high school math teacher says), but I don't know where to use that in the proof. This is what I have come up and was looking for some feedback.
Comment: This result can be proven directly, there is no need for argument by contradiction. It follows pretty easily from the relevant definitions too.
Answer: It's a solid proof.   There's nothing requiring you to start of with "Let ..." other than style; although it is good practice to put definitions before manipulations.   So my suggestion is to move the phrase starting with "Also..." to a bit earlier (and make it a "let" if you wish).
Also, $R^{-1}\not\subset S$ does not mean that every $(y,x)\notin S$, just that some such exist (which is enough).

pf(contradiction)   Assume $S$ is a symmetric relation on $A$ and $R\subseteq S$.   Let $(x,y)\in R$.   Then $(x,y) \in S$, and by symmetry, $(y,x)\in S$.    Assume $R^{−1}\not\subseteq S$.   Then there exists some $(x,y)\in R$ such that $(y,x)\notin S$.   This is a contradiction.   Therefore, if $S$ is a symmetric relation on $A$ and $R\subseteq S$, then $R^{-1}\subseteq S$.
Answer: Shortcut:
A relation $T$ is symmetric if and only if $T^{-1}=T$
Applying that on $S$ we find directly:$$R\subseteq S\implies R^{-1}\subseteq S^{-1}=S$$
Answer: A direct proof from the definitions:
Let $(x,y)\in R$, then, $(x,y)\in S$ (definition of subset).
By $S$ symmetric, $(y,x)\in S$ (definition of symmetric relation).
Also, $(x,y)\in R\Leftrightarrow(y,x)\in R^{-1}$ (just restated definition of inverse relation for clarity).
Therefore $R^{-1}\subseteq S$ (definition of subset, applied to the preceding two lines).
Note, everything in parenthesis can be omitted, I was just pointing out explicitly what the justifications were for each step. You could even omit the line beginning with also, but in my opinion, the proof isn't as clear without that line included.
Edit:
Pedantic version:
Let $(x,y)\in R^{-1}$, then by the definition of inverse relation, $(y,x)\in R$.
Since, by assumption, $R\subseteq S$, $(y,x)\in R\Rightarrow(y,x)\in S$.
Now, by assumption, $S$ is a symmetric relation, thus we have, by definition of symmetric relation, that $(y,x)\in S\Rightarrow(x,y)\in S$.
Thus we have shown that, $(x,y)\in R^{-1}\Rightarrow (x,y)\in S$.
Therefore, by the definition of subset, $R^{-1}\subseteq S$.
QED
Comment: If I was being really pedantic, I would've actually started with an $(x,y)\in R^{-1}$ and then chased it through the corresponding $(y,x)\in R$ to eventually obtain $(x,y)\in S$.
Answer: Your intuition is correct, but when you say:
Then $(x,y) \in S$ and $(y,x) \in S$
that's not very precise: what are $x$ and $y$ here? Consider that $S$ could be the trivial relation $S = \{\}$, which is symmetric; but then it's certainly false that "$(x,y) \in S$ and $(y,x) \in S$" for any $x$ and $y$. Instead, I think you mean:
Then, $(x,y) \in S$ if and only if $(y,x) \in S$.
Next, you say "Also, $(x,y) \in R$"; again this is not precise. Which $x$ and $y$ are you speaking of here? Clearly, we don't know that every pair $(x,y) \in S$ 'also' has $(x,y) \in R$.
So to be clearer, you might say:
For all $(y,x) \in R^{-1}$, $(x,y) \in R$; and since $R \subseteq S$, then $(x,y) \in S$; which then implies $(y,x) \in S$. Therefore for all $(y,x) \in R^{-1}$, $(y,x) \in S$; and so $R^{-1} \subseteq S$.


How to solve the problem of using source mode docker to build project and create Oracle data source failure

Question: Describe the question:
use source mode docker to build project and create Oracle data source failure.
Which version of DolphinScheduler:
-[apache-dolphinscheduler-incubating-1.3.4]
Additional context
Using official documents https://dolphinscheduler.apache.org/zh-cn/docs/1.3.4/user_ doc/docker- deployment.html After the building project is started (recommended) in docker-compose mode, the creation of Oracle11g data source will fail.
Answer: Because of the commercial license, we cannot directly use the driver and client of MySQL and Oracle. If you want to use Oracle, you can build a new image based on our apache/dolphinscheduler image.
Answer: As for MySQL, you need to download mysql-connector-java-5.1.49.jar
Create your Dockerfile
FROM apache/dolphinscheduler:latest
COPY mysql-connector-java-5.1.49.jar /opt/dolphinscheduler/lib
RUN apk add --update --no-cache mysql-client
Build the image
As for Oracle in Datasource, you only need to download the Oracle driver and put it in the /opt/dolphinscheduler/lib directory


vuejs component does not render if I import printjs

Question: I am trying to print pdf file generated of a form, printjs but when I import printjs no vuejs component load at all, the title in the browser show up but component is not rendered.
import printJS from 'printjs'

then later I call the function:
methods: {
    printSlip: function(){
        printJS('docs/printjs.pdf')
    }

when button is clicked:
<input type="submit" v-on:click="printSlip" value="Print" />

Answer: Are you sure that the printjs.pdf file can be found/path is correct?
Do you see some error in the console?


Alexa Skill: Invocation name: How to catch the skill STARTING PHRASE?

Question: I'm working on my coming soon music player skill.
I'd like to have different behaviour following a different skil linvocation, by example:
1. start immediately the audio streaming:
Play MyMusicSkillName

2. just introduce the skill behaviour with a welcome/help message:
Open MyMusicSkillName

My question is:
There is a way to distinguish the invocation VERB, getting the invocation starting phrase (and distinguish in LaunchRequest event)?
Any idea?

See documentation: https://developer.amazon.com/docs/custom-skills/understanding-how-users-invoke-custom-skills.html#invoking-a-skill-with-no-specific-request-no-intent

Ask  Alexa, Ask Daily Horoscopes
Begin  Alexa, Begin Trivia Master
Launch  Alexa, Launch Car Fu
Load  Alexa, Load Daily Horoscopes
Open  Alexa, Open Daily Horoscopes
Play  Alexa, Play Trivia Master
Play the game  Alexa, Play the game Trivia Master
Resume  Alexa, Resume Trivia Master
Run  Alexa, Run Daily Horoscopes
Start  Alexa, Start Daily Horoscopes
Start playing the game  Alexa, Start playing the game
  Trivia Master
Tell  Alexa, Tell Daily Horoscopes
Use  Alexa, Use Daily Horoscopes
Answer: Unfortunately, the LaunchRequest does not provide any way to differentiate how the user opened your skill.
However, you can differentiate between a new user and a user who has used the skill before by saving something in your database such as a last_played audio. Then when you handle the LaunchRequest, you can check that user's ID in your database and if they have a last_played entry, then automatically continue playing. Or if its a new user, then provide an introduction/welcome message.
Returning users who you think want to hear the introduction message by saying "Open" instead of "Play" probably want to be reminded of what to do or what options the skill has, which you should handle in the HelpIntent anyway. So if your skill auto played for them, they should naturally ask a question of your skill that will launch the HelpIntent.
Comment: It's a lacking feature for sure. I work with both Alexa and Lex and it's amazing how different they are. The biggest surprise to me was that every Lex interaction provides exactly what the user input as a value inside the request JSON. Having it is incredibly useful. Why Alexa does not is a mystery to me.
Comment: Yes.Surprisingly, as far as I understand, in Alexa's user utterances in input are not passed through the skill for a free processing; instead user input is able to just 'fire' predetermined fixed intents. That's too limiting and could be just an option, beside the option to process the user utterance with a skill NLP.
Comment: Upvoted. I appreciated your suggestions.
`HelpIntent` management is more a workaround, but ok.
BTW. the lack of the invocation phrase as a request parameter s a "bug". Don't you think?


Order of a group generated by self-inverse elements

Question: Assume $G$ is generated by a finite number of elements which are all self-inverse in $G$. Is it possible to make any assumptions about the order of $G$?
Take for example, $G = \langle a,b\rangle :a^2 = b^2 = e$, is it true that we cannot make any assumption on the order of the element $abab...$ and thus cannot assume the order of G? Am I missing something? Is there a non-trivial condition we might ask for to help us?
Note: to clarify, only the generating elements are self-inverse in G.
Comment: Sorry, I misunderstood your question. You can't say anything about the group. You don't have any restriction for $(ab)^n$, so the group could be infinite.
Comment: No perhaps I worded it badly, I appreciate the answer, thank you
Comment: You can make any **assumptions** you like. I think you want to know what **conclusions** you can draw.
Answer: If a group is generated by a finite number of elements of order $2$ all we can determine is that it has at most countable order, and that its order must be even when finite.
Clearly if the order is finite it must be even, because of Lagrange's theorem.
Notice that the dihedral group $D_{2n}$ is generated by its elements of order $2$, and has order $2n$, so every even order is possible.
Finally notice that since the number of generators is finite, the group must have at most countable order.
Comment: To see an example of an infinite group generated by two elements of order $2$ see here: http://math.stackexchange.com/questions/1425386/a-group-is-generated-by-two-elements-of-order-2-is-infinite-and-non-abelian
Comment: Moreover the symmetric group $S_n$ is generated by $3$ elements of order $2,$ and every countable group is a subgroup of a group generated by $3$ elements of order $2.$