Is $SL(2, \mathbb{R})$ dense in saturated elementarily extensions of the reals?

Question: Suppose $\mathcal{A} = \langle A, <, +, \cdot \rangle$ is a $\aleph_1$-saturated elementarily extension of the real field.
Is $SL(2, \mathbb{R})$ dense in $SL(2,A)$?
In compact groups one can find subgroups with infinitesimal entries, but is it still possible in $SL(2,A)$?
Comment: I don't see how it could possibly be. Let $X$ be any element of $SL(2,A)$ with a non-Archimedean entry (e.g. $\begin{bmatrix}\epsilon & 0\\0 & {1\over\epsilon}\end{bmatrix}$ for $\epsilon$ an infinitesimal). Then unless I'm misunderstanding the topology, there is an open neighborhood of $X$ not containing any "standard" element.
Comment: I think it's quite a reasonable question, and worth leaving up if you're open to it! maybe @NoahSchweber can write his comment as an answer
Comment: @Atticus Stonestrom. Exactly, everywhere there is the Euclidean topology induced by the order
Comment: Your question is phrased as an isolated problem, without any further information or context. This does not match [many users' quality standards](http://goo.gl/mLWc8), so it may attract downvotes, or be closed. To prevent that, please [edit] the question. [This](http://goo.gl/PlJyVQ) will help you recognise and resolve the issues. Concretely: please provide context, and include your work and thoughts on the problem. These changes can help in formulating more appropriate answers.
Comment: Please ask one question at a time.
Comment: @Shaun The second question is precisely context for the first question
Comment: hi Luis. just to make sure, you mean here that the topology on $\operatorname{SL}_2(\mathbb{R})$ is given by the subspace topology as a subspace of $\mathbb{R}^4$?
Comment: I'll concede that, @Luis. I'm sorry.
Comment: You are all right. Stupid question. I'll delete it
Answer: Turning my comment into an answer:
No, it's not. In fact, every "new" element of $SL(2,A)$ will have a neighborhood missing all of $SL(2,\mathbb{R})$ - and this uses merely the non-Archimedeanness of $A$.
Suppose $X\in M_2(A)\setminus M_2(\mathbb{R})$ (so $X$ has at least one non-real entry). Let $\epsilon$ be a "small enough" infinitesimal - specifically, let $\epsilon$ be smaller than (the absolute value of) the difference between each finite non-real entry $x$ of $X$ and the real part of $x$. The ball of radius $\epsilon$ around $X$ contains no elements of $M_2(\mathbb{R})$.
Now just make sure the determinant of $X$ is $1$. For example, fixing an infinitesimal $\delta$ we could use $$\begin{bmatrix}\delta & 0\\0 & {1\over\delta}\end{bmatrix}$$ (we could use $\epsilon=\delta^2$ as our corresponding radius).
EDIT: as Adayah observes, this in fact shows that $SL(2,\mathbb{R})$ is nowhere dense in $SL(2,A)$. As a further point of interest it's not hard to show that $SL(2,\mathbb{R})$ is closed as well (see their answer).
Comment: I don't get the last comment. Your answer shows precisely that $SL(2, \mathbb{R})$ is a proper closed subset of $SL(2, A)$, but doesn't show that it is nowhere dense.
Answer: It's the opposite - $SL(2, \mathbb{R})$ is closed in $SL(2, A)$ and has empty interior, so it is nowhere dense.
To see it is closed, first note that $\mathbb{R}$ is closed in $A$. Indeed: take any $\alpha \in A \setminus \mathbb{R}$. If $\alpha$ is unbounded (greater than $r$ for every $r \in \mathbb{R}$), then $(-\infty, \frac{\alpha}{2})$ or $(\frac{\alpha}{2}, \infty)$ is a neighborhood of $\alpha$ disjoint from $\mathbb{R}$. Otherwise $\alpha = r + \varepsilon$ for some $r \in \mathbb{R}$ and infinitesimal $\varepsilon$, and then $\left( \alpha-\frac{|\varepsilon|}{2}, \alpha+\frac{|\varepsilon|}{2} \right)$ is a neighborhood of $\alpha$ disjoint from $\mathbb{R}$.
It follows that $M_{2 \times 2}(\mathbb{R})$ is closed in $M_{2 \times 2}(A)$, so
$$SL(2, \mathbb{R}) = M_{2 \times 2}(\mathbb{R}) \cap SL(2, A)$$
is closed in $SL(2, A)$.
To see that it has empty interior, take any $\begin{pmatrix} a & b \\ c & d \end{pmatrix} \in SL(2, \mathbb{R})$ and its neighborhood. If $ad \neq 0$, choosing sufficiently small $\delta, \varepsilon \in A \setminus \mathbb{R}$ such that $(a+\varepsilon)(d+\delta) = ad$, we get that $\begin{pmatrix} a+\varepsilon & b \\ c & d+\delta \end{pmatrix}$ is in the neighborhood but not in $SL(2, \mathbb{R})$. If $ad = 0$, then $bc = -1$ and we can apply the same method to $b$ and $c$.


Why is that the Alexander polynomial cannot detect the chirality

Question: In the knot theory lessons (and in wikipedia) it is stated that "The Alexander polynomial cannot detect the chirality", and it may be the case, but what worries me is that it is sometimes deduced right afted showing that $\Delta(K)=\Delta(K^*)$, where $K^*$ is the mirror image of the knot $K$.
But to my logic, it doesn't follow from this, because it can be another property of the Alexander polynomial, for example some structure of its roots or coefficients, that hypothetically can decide that if $\Delta$ has it then $K$ is chiral.
What should be the "proper" explenation of the statement "The Alexander polynomial cannot detect the chirality"?
Comment: See Theorem 2.4 [here](https://arxiv.org/pdf/1608.04453.pdf).
Comment: Your question is unclear. The statement that two integer coefficient polynomials $\Delta_1(t,t^{-1})$ and $\Delta_2(t,t^{-1})$ are *equal* is equivalent to saying that their corresponding coefficients are equal. It follows from this that they have the same roots, and that any other property of these polynomials is identical. Perhaps you seem to have some other notion of *equality* in mind? If so, you should explain what that notion is.
Comment: I mean that it does not follow from the equality of the polynomials, when they are both equal to for example $t^{40}-1+t^{-40}$ maybe you can deduce that they must be chiral
Comment: More accurately, it should be "the Alexander polynomial does not distinguish a knot from its mirror image." That's a good point that the Alexander polynomial might contain information about whether a knot is chiral.
Answer: I consulted KnotInfo to find pairs of knots with the same Alexander polynomial, one with a particular symmetry type and one chiral. An interpretation of the results is that the Alexander polynomial does not detect the symmetry type of a knot.

The knot $8_9$ is fully amphicheiral, and it has the same Alexander polynomial as the chiral knot $11n_{37}$.

The knot $12a_{341}$ is negative amphicheiral, and it has the same Alexander polynomial as the chiral knot $12a_{126}$.

The knot $12a_{427}$ is positive amphicheiral, and it has the same Alexander polynomial as the chiral knot $12a_{189}$.

The knot $5_2$ is reversible, and it has the same Alexander polynomial as the chiral knot $12n_{124}$.

That's not to say the Alexander polynomial contains no information about a knot's symmetry type.  As @plop references in the comments, Theorem 2.4 of this paper has a condition that can sometimes exclude whether a knot is negative amphicheiral.  Recall that the Conway polynomial $\nabla_K(z)$ is related to the Alexander polynomial by $\nabla_K(t^2)=\Delta_K(t)$ (up to the usual factor of $\pm t^{n}$).  If $\nabla_K(z)$ can't factor as $f(z)f(-z)$ for some integer polynomial $f$, then $K$ is not negative amphicheiral (but given the data above, of a chiral knot with the same Alexander polynomial as a negative amphicheiral knot, the converse is not true).

The Jones polynomial has the property that $V(mL;t) = V(L;t^{-1})$, so amphicheiral knots have the same Jones polynomial. Let's do the same exercise for the Jones polynomial to see whether the Jones polynomial detects amphicheirality in general:

$12a_{510}$ is fully amphicheiral, $12a_{821}$ is negative amphicheiral, and $12a_{1231}$ is chiral, but they all have the same Jones polynomial.

$10_{33}$ is fully amphicheiral, $12n_{610}$ is reversible, and $12n_{278}$ is chiral, but they all have the same Jones polynomial.

It turns out there are no examples in the database of a positive amphicheiral knot with the same Jones polynomial as a chiral or reversible knot.

Regarding a comment by @knotter, here are the two mentioned knots:
14n14148:

14n14150:

I had hoped signature or omega signature might say one is not amphicheiral, but they are indistinguishable that way.  It does turn out you can distinguish them with their Alexander modules.  The second Alexander polynomial for the first knot is $1$, but for the second it is $2t^2-6t+2$.  I'm not sure what properties the higher Alexander polynomials have with respect to symmetry.  (I used https://kmill.github.io/knotfolio/ to compute the Alexander module.  You can copy and paste the diagrams into this program to enter the knots.)
It seems interesting that these knots are Conway mutations of each other.  This is more obvious when 14n14148 is in this form:

The Conway mutation has the effect of taking the mirror image of the 6 crossings on the right half of the diagram.
Comment: @Knotter The higher Alexander polynomials can tell them apart, but I'm not sure what that has to say about symmetry.
Comment: A better question might be: why is it that Jones' polynomial can?
Comment: @user43408 I'd say that's just a different question, since they're not too related other than that they are both specializations of the HOMFLY-PT polynomial.  That said, I checked the database and it turned up examples where the Jones polynomial does not contain chirality information (answer updated).
Comment: Knots $14n_{14148}$ and  $14n_{14150}$ have the same the HOMFLY-PT polynomial, but exactly one of them is a positive amphicheiral knot (which one?).
Comment: @Knotter What table are you using? I only have the KnotInfo table on hand, but it could be interesting to try applying some other invariants (like signature) to figure out their symmetry types. (Or maybe it's possible to explicitly do the decomposition like in the Hartley paper mentioned in the sibling question at https://mathoverflow.net/questions/394946)
Comment: It is from the files at http://katlas.org/wiki/The_Take_Home_Database , it will be good to know which invariant tell them apart.


Estilizar overflow hidden

Question: Tenho uma ul que possui "n" lis dispostas verticalmente.
Inicialmente, ela está com estilizar overflow hidden, apenas para uma parte dela, especificamente a partir da segunda li para simular uma select option.
No entanto, quando clico na primeira li, faço estilizar overflow visible e assim as outras lis aparecem.
Gostaria de fazer com que esse overflow visible não aparecesse de uma só vez.
Gostaria de aplicar tanto na abertura quando no fechamento (visible, hidden) um efeito de abrir/fechar como se fosse um rolo.
Será que é possível?
O código é do site neste link.
Comment: Com overflow não é possível, ou vai ficar aberto/visible, ou fechado/hidden. Você vai precisar trabalhar com o height.
Comment: pode dar um exemplo?
Comment: Acho que entendi a pergunta. Tô elaborando uma resposta.
Comment: bacana. Estou na espera.
Comment: Não seria mais fácil usar um plugin pra jQuery pronto, segue um exemplo https://pt.stackoverflow.com/a/242696/3635?
Comment: Sim, de fato é sim. Só que estou com tempo agora e gostaria de ver na prática o que alguns css fazem. Estou dando uma estuda aqui.
Answer: Você vai conseguir o efeito que deseja usando slideDown() (veja as linhas comentadas que foram adicionadas no código JS que manipula a
):
$(".selectOptions .selectOption").click('live', function(e) {

      if(contador % 2 == 0) {
          $(".selectOptions .selectOption").addClass("setaCima").removeClass("setaBaixo");
          $(".selectOptions .selectOption ul").css("overflow", "visible");
          $(".selectOptions .selectOption ul li:not(:first)").css("display","none").slideDown(400);
      } else {
          $(".selectOptions .selectOption").addClass("setaBaixo").removeClass("setaCima");
          $(".selectOptions .selectOption ul li:not(:first)").slideUp(400, function(){
              $(".selectOptions .selectOption ul").css("overflow", "hidden");
          });
      }

        e.stopPropagation();
      contador++;
  });

$(document).ready(function(e) {
  /*Esconde o select*/
  $(".selectOptions select").css("display", "none");

  /*popula as li's*/
  $(".selectOptions select > option").each(function() {
      $(".selectOptions .selectOption ul").append("
"+this.text+"
");
  });

  /*cria um contador para contar as aberturas e fechamentos da ul*/
  contador = 0;

  /*ao clicar na ul, abre/fecha a ul*/
  $(".selectOptions .selectOption").click('live', function(e) {

      if(contador % 2 == 0) {
          $(".selectOptions .selectOption").addClass("setaCima").removeClass("setaBaixo");
          $(".selectOptions .selectOption ul").css("overflow", "visible");
          $(".selectOptions .selectOption ul li:not(:first)").css("display","none").slideDown(400);
      } else {
          $(".selectOptions .selectOption").addClass("setaBaixo").removeClass("setaCima");
          $(".selectOptions .selectOption ul li:not(:first)").slideUp(400, function(){
     $(".selectOptions .selectOption ul").css("overflow", "hidden");
    });
      }

  e.stopPropagation();
      contador++;
  });

 $(document).on('click',function(e){
  if($(".selectOptions .selectOption ul").css("overflow") == "visible"){
   $(".selectOptions .selectOption").trigger("click");
  }
  e.stopPropagation();
 });

  /*ai clicar na li, busca correspondêcia na select option e o checa (marca)*/
   //$(".selectOptions .selectOption ul li:not(:eq(0))").on( 'click',function(evt){
   $( '.selectOptions .selectOption ul li' ).on( 'click', function( evt ){
       /*Joga a li selecionada ao topo da ul*/
    $($(this).closest('ul')).prepend($(this));
     // Armazena nome do mês que quer selecionar
  var li = $(this).attr("id");
  // Guarda em opcao o elemento que retornar do filtro que vai testar entre as
  // options possíveis
  var opcao = $('.selectOptions select option').filter(function() {
   // testa entre as options qual delas tem o mesmo conteúdo que o desejado
   return $(this).attr('value') === li;
  });

  // Redefine o atributo do elemento encontrado pra selecionado.
  opcao.attr('selected', true);

   });

});
@charset "utf-8";
/* CSS Document */
.selectOptions {
 position: relative;
}
.selectOptions select {
 display: none;
}
.selectOptions .selectOption:after {
 position: absolute;
 content: "";
 display: block;
 top: 1px;
 right: 1px;
 width: 33px;
 height: 33px;
 background-image: url(http://www.hotplateprensas.com.br/estilos/_imgs/setaBaixo.jpg);
}
.selectOptions .selectOption.setaBaixo:after {
 background-image: url(http://www.hotplateprensas.com.br/estilos/_imgs/setaBaixo.jpg);
}
.selectOptions .selectOption.setaCima:after {
 background-image: url(http://www.hotplateprensas.com.br/estilos/_imgs/setaCima.jpg);
}
.selectOptions .selectOption,
.selectOptions .selectOption  ul {
 position: relative;
 width: 200px;
 height: 35px;
 background-color: rgba(0,0,0,0.2);
}
.selectOptions .selectOption  ul {
 position: relative;
 overflow: hidden;
 list-style: none;
}
.selectOptions .selectOption  ul li {
 width: 100%;
 height: 31px;
 line-height: 31px;
 cursor: pointer;
 padding: 2px;
 color: rgb(255,255,255);
 background-color: rgb(240,240,240);
 border-bottom: rgba(0,0,0,.1) 1px solid;
}
.selectOptions .selectOption  ul li:hover,
.selectOptions .selectOption  ul >:first-child {
 color: rgb(255,255,255);
 background-color: rgba(0,0,0, .1);
}
.selectOptions .selectOption  ul li:hover + .selectOption:after {
 color: rgba(0,0,0, .1);
 background-color: rgb(255,255,255);
}

      <select name="select" required>
        <option value="1">um</option>
        <option value="2">dois</option>
        <option value="3">Tres</option>
      </select>

Comment: O que é `click('live'`? até aonde sei em jQuery isso não existe, você deve estar falando do `live('click')` e acabou invertendo, de qualquer a função já foi descontinuada e trocada pelo delegate que fica embutindo dentro do `.on()` dentro de uso o contexto na ordem correta.
Comment: @GuilhermeNascimento Realmente não conheço. Eu apenas deixei o código como estava e mexi apenas no que era relevante. Aliás, nem mexi em nada, apenas adicionei 2 linhas :)
Comment: Você pode até me achar um chato, excessivamente detalhista a um ponto de quase paranoia, mas eu sempre vou ser a favor de especular provaveis origens do problema ao invés de apenas tentar entregar uma possivel solução. Programação é assim, as vezes era pra funcionar, mas outro código ali meu conflitou e causou um problema inesperado que ninguém percebeu. Mas é isso ae opinião pessoal mesmo.
Comment: @GuilhermeNascimento Eu entendo. Eu geralmente, quando vejo problemas absurdos no código que não tem a ver com o problema, eu melhoro e dou possíveis dicas. Neste caso aqui, eu nem tinha percebido esse "live", embora ele não cause nenhum efeito no código.
Comment: Mas deixa eu te perguntar 2 coisas: 1) tem como na hora de fechar aplicar o mesmo efeito? 2) E o lance de ao clicar fora (deixar a **ul**), como consigo fechar ela fechar?
Comment: então, é que, ao abrir, blz, o efeito está sendo aplicado. Mas na hora da ul se retrair (overflow:hidden), o efeito não está funcionando
Comment: só mais uma coisa: kkk, desculpe o incômodo. Mas do jeito que está, de fato, ao clicar fora da ul ela se retrai. Mas, se clicar de novo fora de documento ela abre de novo. Só falta isso
Comment: @CarlosRocha Fiddle atualizado: https://jsfiddle.net/vjzogcw9/3/
Comment: Pronto, atualizado também, http://www.hotplateprensas.com.br/estilos/
Comment: Agora, só para não deixar o outro colega no vácuo, amigo, eu vendo do php e sempre tive muiiiiiiita dificuldade com CSS. Então, como você pode ver no link que passei, estou aprendendo a fazer uns estilos da minha forma para aprender mesmo. Pois estou muito cru. Nesse caso, de nada adiantaria pegar coisa pronta. Está certo que adianta o trabalho. Mas no momento estou sem nada para fazer: me entende?
Comment: @CarlosRocha Eu tb não gosto. Evito ao máximo adicionar bibliotecas, só quando não há outro jeito mesmo.
Comment: @CarlosRocha Se quiser aumentar a velocidade do menu, basta trocar o 400 por algo menor, como 200... acho que fica melhor.
Comment: Acho que está legal.Está um pouco parecido com os outros efeitos que estou usando.Mas diz aê: ficou legal? Agora é dar uma estuda legal nas modificações para eu entender bem.
Comment: Outra situação ocorreu: está atualizado lá no site, é que fui colocar em vez de overflow: visibily, overflow:,scrool e alterei a altura para esconder parte das lis . Funcionou beleza. Porém, a seta para cima do scroll, ficou em baixo da seta que já tinha lá. Assim, ela não aparece. Algum recurso?
Comment: @CarlosRocha Adicione o código `$(".selectOptions .selectOption ul").css("width","200px");` quando fechar e `$(".selectOptions .selectOption ul").css("width","217px");` quando abrir.
Comment: Vou precisar fazer algumas contas, pois deste jeito temos 2 problemas, embora o visual ficou fera: 1) caso tenha até 3 opções, por exemplo, não pode ter scrool, precisa ser visibility. E se tiver de 4 para mais ai sim precisa ter scroll
Answer: Ao invés de tentar criar um select customizado do zero, porque não simplesmente usa um select de verdade e customiza ele usando algum plugin para jQuery (já que você está de fato usando jQuery), um exemplo de plugin muito bom é o http://marcj.github.io/jquery-selectBox/
Assim ao invés de ter toda a dificuldade de pegar o valor do seu select com ul e li usando .text() e talvez sendo obrigado a usar $.trim, você pode simplesmente usar $("select").val(); e terá o valor
Veja um exemplo de uso:

$('select.customizado').selectBox();

<link href="https://cdn.rawgit.com/marcj/jquery-selectBox/316c77f1/jquery.selectBox.css" rel="stylesheet"/>

<select class="customizado combo-1">
<option value="foo">Foo</option>
<option value="bar">Bar</option>
<option value="baz">Baz</option>
<option value="foo">Foo</option>
<option value="bar">Bar</option>
<option value="baz">Baz</option>
<option value="foo">Foo</option>
<option value="bar">Bar</option>
<option value="baz">Baz</option>
<option value="foo">Foo</option>
<option value="bar">Bar</option>
<option value="baz">Baz</option>
<option value="foo">Foo</option>
<option value="bar">Bar</option>
<option value="baz">Baz</option>
</select>

<button onclick="console.log($('.combo-1').val());">Troque o valor e clique aqui</button>

<select class="customizado combo-2">
<option value="foobar">Foo bar</option>
<option value="barbaz">Bar baz</option>
<option value="bazfoo">Baz foo</option>
<option value="foobar">Foo bar</option>
<option value="barbaz">Bar baz</option>
<option value="bazfoo">Baz foo</option>
<option value="foobar">Foo bar</option>
<option value="barbaz">Bar baz</option>
<option value="bazfoo">Baz foo</option>
<option value="foobar">Foo bar</option>
<option value="barbaz">Bar baz</option>
<option value="bazfoo">Baz foo</option>
</select>

<button onclick="console.log($('.combo-2').val());">Troque o valor e clique aqui</button>
Answer: @dvdsamm, acho que consegui o efeito final.
Mas alguma coisa não está legal.
Quando fecha a ul, então está havendo um atraso em relação à contração da div pai da ul.
Onde foi que errei?
$(document).ready(function(e) {

  /*popula as li's*/
  $(".selectOptions select > option").each(function() {
      $(".selectOptions .selectOption ul").append("
"+this.text+"
");
  });

  /*cria um contador para contar as aberturas e fechamentos da ul*/
  contador = 0;

  /*ao clicar na ul, abre/fecha a ul*/
  $(".selectOptions .selectOption").click(function(e) {

      quantasLis = $(".selectOptions .selectOption ul li" ).length;

      if(contador % 2 == 0) {

          $(".selectOptions .selectOption").addClass("setaCima").removeClass("setaBaixo");
          $(".selectOptions .selectOption ul li:not(:first)").css("display","none").slideDown(400);

          if(quantasLis > 4) {
              $(".selectOptions .selectOption ul").css("width", "217px");
              $(".selectOptions .selectOption ul").css('height', '175px');
              $(".selectOptions .selectOption ul").css("overflow-y", "scroll") ;
          } else {
              $(".selectOptions .selectOption ul").css("width", "200px");
              $(".selectOptions .selectOption ul").css('height', 'auto');
          }

      } else {

          $(".selectOptions .selectOption").addClass("setaBaixo").removeClass("setaCima");
          $(".selectOptions .selectOption ul").css("width", "200px");
          $(".selectOptions .selectOption ul li:not(:first)").slideUp(400, function(){
              $(".selectOptions .selectOption ul").css("overflow-y", "scroll");
              $(".selectOptions .selectOption ul").css('height', '35px');
          });
      }

      e.stopPropagation();
      contador++;
  });

  $(document).on('click',function(e){
      if($(".selectOptions .selectOption ul").css("overflow") == "visible"){
          $(".selectOptions .selectOption").trigger("click");
      }
      e.stopPropagation();
  });

/*ai clicar na li, busca correspondêcia na select option e o checa (marca)*/
 //$(".selectOptions .selectOption ul li:not(:eq(0))").on( 'click',function(evt){
 $( '.selectOptions .selectOption ul li' ).on( 'click', function( evt ){
     /*Joga a li selecionada ao topo da ul*/
     $($(this).closest('ul')).prepend($(this));
      // Armazena nome do mês que quer selecionar
      var li = $(this).attr("id");
      // Guarda em opcao o elemento que retornar do filtro que vai testar entre as
      // options possíveis
      var opcao = $('.selectOptions select option').filter(function() {
          // testa entre as options qual delas tem o mesmo conteúdo que o desejado
          return $(this).attr('value') === li;
      });

      // Redefine o atributo do elemento encontrado pra selecionado.
      opcao.attr('selected', true);

 });

});

Estilizar overflow hidden


Can we find a subfield $F$ of $\mathbb C$, such that ${ F}^{*p}={ F}^{*}$ for any prime $p\neq 5$ and ${F}^{*5}\neq F^{*}$?

Question: We know for field $\mathbb R$, ${\mathbb R}^{*p}={\mathbb R}^{*}$, for any prime $p\neq 2$ and ${\mathbb R}^{*2}\neq {\mathbb R}^{*}$. (${\mathbb R}^{*}$  is the multiplicative group of $\mathbb R$.) Can we find a subfield $F$ of $\mathbb C$ such that ${ F}^{*p}={ F}^{*}$ for any prime $p\neq 5$ and ${F}^{*5}\neq F^{*}$?
Answer: Here's a possible construction.
If $F$ is a countable subfield of $\mathbb{C}$, we can form the field $F'$ by splitting all polynomials of the form $X^p-a$ for $p\neq 5$ a prime and $a\in F$. There are countably many such polynomials, so order them in some way and split them successively.
Now, iterate this procedure. Starting with $F_0=\mathbb{Q}$, define $F_{n+1}=F_n'$ and $F_\infty = \cup F_n$. Then $F_\infty$ is a subfield of $\mathbb{C}$, and any of its elements contains all of its $p$th roots for $p\neq 5$ a prime. (This is because any such element belongs to some $F_n$, so all its roots are already in $F_{n+1}$.)
I claim that no fifth root of $2$ is in $F_\infty$. (Thanks to Yuval Dor for this argument). In fact, let's even extend $F_\infty$ a little bit: in the first step we constructed $F_1$ by adding, among other things, all roots of unity except those of order 5. Let's throw in the roots of $X^5-1$ as well, so now $F_1$ actually contains all roots of unity of prime order.
No fifth root of $2$ can belong in this extended $F_1$. If any root did, then all of them would, since $F_1$ contains the 5th roots of unity. But the splitting field of $X^5-2$ is a non-abelian extension of $\mathbb{Q}$, so it cannot be contained in a cyclotomic field.
Finally, by Kummer theory, splitting polynomials of the form $X^p-a$ over a field that has the necessary roots of unity can only result in a trivial extension of an extension of order $p$. So the order $5$ can never show up, meaning $\sqrt[5]{2}$ can't appear.
Comment: Hmm. You lost me also. $F_1$ is certainly not a union of cyclotomic fields, because it contains, among other things, the splitting field of $x^{11}-p$ for any prime $p$ (with a non-abelian Galois group). And that splitting field also contains subfields of degree five because $5\mid p-1$. I still think that the construction works and the argument can be saved, but I don't see it right away. May be show that no subfield of $F_1$ can have Galois group $C_5\rtimes C_4$ (= the Galois group of  $x^5-2$)?
Comment: If you start with the field generated by all roots of unity of order coprime with 5, then it is easy to see what the prime divisors of all finite subextensions of your field are, I guess.
Comment: I can't prove that $\sqrt[5]{2}\notin F_\infty$.
Comment: Notice in  zero characteristic, a divisible   field contains any root of unity
Comment: @Reza I added a proof to my answer.
Comment: Dear prof. Alon Amit. I friendly thanks for your response. In final paragraph  you claimed that for any two field $K,F$ such that $F_1\subset F \subset K\subset  F_\infty$, $[K:F]\neq 5$, why? it is not clear for me.


Why does AWS Global Accelerator use anycast internally?

Question: Please explain the request flow and how anycast is used in the architecture?
P.S. I have searched the everywhere on why anycast was used in the internal architecture of AWS Global Accelerator. Got the answer after speaking to a few experts. Hence answered it myself so that it would be useful to the community. More answers are welcome.
Answer: AWS Global Accelerator is a service that is designed to improve the availability and performance of applications that are running in multiple AWS Regions. When you create a Global Accelerator, it provides you with two anycast IP addresses that you can use as entry points for your application traffic. These anycast IP addresses are advertised over the internet through Border Gateway Protocol (BGP), which means that they are announced from multiple AWS Edge Locations.
Here's how the traffic flow works:

A client initiates a request to access your application. The request is sent to the anycast IP address that you have configured as the entry point for your application traffic.
The anycast IP address is advertised over the internet through BGP. When the client sends the request to the anycast IP address, BGP routes the traffic to the closest AWS Edge Location that is announcing the anycast IP address.
The traffic reaches the AWS Edge Location that is closest to the client. This is the first point of contact between the client and the AWS network.
The traffic is then sent to the Global Accelerator endpoint that is associated with your application. The Global Accelerator routes the traffic to the optimal AWS Region based on your endpoint group configuration.
The traffic reaches your application in the AWS Region that you have configured. The response is then sent back to the client through the same path.
The key benefit of using anycast IP addresses is that it allows the traffic to be routed to the closest AWS Edge Location, which helps reduce latency and improve performance. Additionally, the Global Accelerator uses health checks to monitor the health of your endpoints, and automatically routes traffic to healthy endpoints. This helps improve the availability of your application.


How to get achievements notification popup for Ajax Callbacks?

Question: I'm using the Achievements module to award the badges to users on certain actions.
In the following example user will get badges after posting 5 and 10 comments.
function MYMODULE_comment_insert($comment) {
  $current_count = achievements_storage_get('comment-count', $comment->uid) + 1;
  achievements_storage_set('comment-count', $current_count, $comment->uid);

  foreach (array(5,10) as $count) {
    if ($current_count == $count) {
      achievements_unlocked('comment-count-' . $count, $comment->uid);
    }
  }
}

The above code is working, user is able to achieve badge after posting 5 comments but since the comment form is being submitted through AJAX, the rewarded achievements notification popup is not being shown until page refresh.
So how can I show achievement notification popup for Ajax callbacks? Any suggestions?
Comment: Do you use https://www.drupal.org/project/ajax_comments or your own code for ajaxify comments?
Comment: @MariaKvitova No I'm using [Flag](https://www.drupal.org/project/flag) and [Drupal Wall](https://www.drupal.org/project/drupal_wall) modules which uses Ajax. Thanks
Comment: Could you tell what version of Drupal wall do you use? I tried 7.x-2.7 it doesn't seem to work :( You can find that message appears from hook_page_alter http://cgit.drupalcode.org/achievements/tree/achievements.module?h=7.x-1.x#n709 So you can use it in your ajax-callback and return message as ajax-command. Unfortunately I can't give you more details, because I couldn't force Drupal Wall to work.
Answer: Here is another try at this (various assumptions follow):

The whole thing should run through the Wall module's code, since this is the base for any other interaction happening.
By means of the Form API and AJAX callbacks, there is a possible entry point. This is to wrap the submit callback for the _drupal_wall_comment_post_form into another callback that will make sure the Achievements' related elements are updated.
The steps in this process would be:

Use hook_form_alter to modify _drupal_wall_comment_post_form
Modify _drupal_wall_comment_post_form by hijacking the ajax callback for the wall comment submissions:
$form['drupal_wall_submit']['#ajax']['callback'] =>_your_custom_wall_ajax_callback
Wrap the original callback in your ajax callback and extend it to trigger the Achievements popup functionality using the Ajax framework commands family:
function _your_custom_wall_ajax_callback($form, $form_state) {
  $wall_wrapper = $form['drupal_wall_submit']['#ajax']['wrapper'];
  $wall_content = _drupal_wall_comment_ajax_form_post($form, $form_state);
  $commands = array();
  $commands[] = ajax_command_replace($wall_wrapper, $wall_content);

  // This is where you can write ajax commands to trigger Achievements functionality
  $commands[] = ajax_command_*();

  return array('#type' => 'ajax', '#commands' => $commands);
}

Hope this brings you a step further!
Comment: You are welcome! It would be great to update your question with things you tried and didn't work, what would you say? Cheers
Answer: You could try using Rules to add a rule for when a user post a comment and then do your thing

After creating the rule you can set conditions and actions, so you can check for the comment count and then act accordingly


Erro react-native-gesture-handler na versão react-native 0.60.0

Question:
Galera, tô com uma dificuldade com o React Navigation depois da última atualização do React-Native para versão 0.60.0
O react-native-gesture-handler não é compatível por causa de um autolink que a versão nova do React-Native tem.
Já procurei em tudo quanto é fórum e não vi ninguém com a solução, pra fazer rodar meu projeto depois que instala o react-native-gesture-handler.
Eu fiz o seguinte, pra ficar bem explicado:
Eu criei o projeto com:
react-native init PROJETO;

Instalei o react-navigation:
yarn add react-navigation

(obs: tentei com NPM também)
Instalei o react-native-gesture-handler:
yarn add react-native-gesture-handler

(obs: também com NPM);
Linkei, conforme diz o manual:
react-native link react-native-gesture-handler

Fiz as alterações necessárias no MainActivity.java, também conforme o manual.
Mas quando rodo o projeto:
react-native run-android

Dá o erro:
error React Native CLI uses autolinking for native dependencies, but the following
  modules are linked manually:

react-native-gesture-handler (
  to unlink run: "react-native unlink react-native-gesture-handler")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above.
Going forward, you can unlink this dependency via "react-native unlink " and it
  will be included in your app automatically.
If a library isn't compatible with autolinking, disregard this message and notify
  the library maintainers.

Minhas dependências estão assim:
"dependencies": {
    "react": "16.8.6",
    "react-native": "0.60.0",
    "react-native-gesture-handler": "^1.3.0",
    "react-navigation": "^3.11.0"
  }

Se alguém souber a solução, me ajuda, Vlw !!!
Comment: Não utilizo react-native, porem fiz uma pesquisa rápida e me parece que tem um request aberto para esse problema no [https://github.com/kmagiera/react-native-gesture-handler/](https://github.com/kmagiera/react-native-gesture-handler/issues/671), nesse link também parece ter uma medida paliativa.
Answer: O React-Native-Gesture-Handler suporta o autolinking no Android porém o problema se dá por conta que ele ainda não é compatível com o AndroidX.

Desfaça o Link (caso tenha feito) do projeto, manualmente
react-native unlink react-native-gesture-handler
Instale o Jetifier
yarn add jetifier -D ou npm install --save-dev jetifier

O Jetifier (https://www.npmjs.com/package/jetifier) ajuda a tornar a biblioteca compatível com o seu projeto AndroidX convertendo todos pacotes de dependência em tempo de compilação.

Agora, abra o arquivo package.json do projeto e adicione essa linha na seção Scripts:
"postinstall": "npx jetify"

Agora execute o npm install ou yarn. Você irá ver algo parecido no console

Faça os ajustes no MainActivity.java, confome o passos da documentação oficial https://kmagiera.github.io/react-native-gesture-handler/docs/getting-started.html#android

FONTE: https://medium.com/@jeancabral/https-medium-com-rocketseat-usando-react-native-gesture-handler-com-a-versao-0-60-do-react-native-17b4ec8343bb
Answer: Retirado do link: How can I disable autolinking for unsupported library?

Como posso desabilitar o autolinking de uma biblioteca não suportada?
Durante o período de transição, alguns pacotes podem não suportar autolinking em certas plataformas. Para desabilitar o autolinking de um pacote, atualize a entrada dependencies do react-native.config.js para ficar assim:
// react-native.config.js
module.exports = {
  dependencies: {
    'some-unsupported-package': {
      platforms: {
        android: null, // disabilitar na plataforma Android, outras plataformas ainda utilizaram o autolink se fornecido.
      },
    },
  },
};

Como eu disse no comentário da pergunta existe um request aberto para esse problema https://github.com/kmagiera/react-native-gesture-handler/.
Eu ainda não me aventurei nesse mundo do react-native, mas espero que os links postados aqui possa vir a te ajudar. =P
Answer: Estava com esse mesmo problema. Tentei de tudo e nada funcionou, e o pior era a lentidão e o alto consumo de memória quando tentava dar o start.
A solução que encontrei foi voltar usar a versão 0.59.9, agora tá funcionando tudo tranquilo.
estou criando o projeto assim:
react-native init --version 0.59.9 nomeprojeto

Comment: Não funcionou assim também, infelizmente, vou tentar outras formas. Eu acho que quando instala a versão 0.59.9, outras dependências estão sendo atualizadas, e estão conflitando com o react-native-gesture-handler, além do React-Native.
Answer:
Para android:
Você precisa acessar a documentação da lib e configurar algumas coisas amais que tem. https://kmagiera.github.io/react-native-gesture-handler/docs/getting-started.html#android
Para IOS:
Você precisa em um terminal do seu projeto, entrar na pasta ios/ e executar pod install


Por que minha variável é null?

Question: Estou traduzindo uma função de Java para JS, a lógica permanece a mesma mas os resultados são diferentes. No teste da expressão regular, retorna match quando testo 40kb mas ao compilar o código obtenho um null numa linha não específicada. Por que quando testo "2kb" não é null e com "40kb" obtenho erro no JS?
Log
Error:
TypeError: getNumbers is null

JS
 function process(val) {
        var isPeso = "(?:k|m|g)b$";
        var normalizado = val.trim().toLowerCase().replace(" ", "");
        var unidade = "";
        var numberPattern = "\d+(\.\d{1,2})?|(Livre)/i";

        var myArray = normalizado.match(isPeso);
        if (myArray != null) {
            unidade = myArray;

            var getNumbers = val.match(numberPattern);
            var i;
            var valores = [];
            for (i = 0; i < getNumbers.length - 1; i++) {
                valores.push((getNumbers[i]))
            }

            var out = "";
            //Caso [X ou superior]
            if (normalizado.indexOf("superior") > -1) {
                return valores[0] + unidade + " ou superior";
            }
            //Caso [X até Y] e [até Y]
            else if (normalizado.indexOf("até") > -1) {
                //Caso [até Y]
                if (valores.length == 1) {
                    out = "até " + valores[0];
                }
                //Caso [X até Y]
                else {
                    out = valores[0] + " até " + valores[1];
                }
            }

            //Caso [X ou Y] ou [X ou Y ou ...]
            else if (normalizado.indexOf("ou") > -1 || normalizado.indexOf("/") > -1) {
                out = valores[0];
                for (i = 1; i < valores.length -1; i++) {
                    out += valores[i];
                }
            }
            //Caso livre
            else if (normalizado.indexOf("*") > -1 || normalizado.indexOf("livre") > -1) {
                out = "Livre";
            }
            //Caso X
            else {
                if (valores.length > 0) {
                    out = valores[0];
                }
            }
            if (out.length == 0 || out == null) {
                return "";
            }
            return out + unidade;
        }
    }

Java
public class IntervaloHandler implements LanguageInterface{
    public static final Pattern NUMBER_PATTERN = Pattern.compile("\\d+(\\.\\d{1,2})?|(Livre)", Pattern.CASE_INSENSITIVE);
     public String normalizar(String in) throws LanguageHandler.NormalizarExcception {
            //Trim e LowerCase
            String normalizado = in.trim().toLowerCase(new Locale("pt", "BR"));

            //Identifica a unidade
            String unidade = "";

            Pattern tempoPattern = Pattern.compile("s$");
            Matcher tempoMatcher = tempoPattern.matcher(normalizado);

            Pattern bytesPattern = Pattern.compile("(k|m|g)b$");
            Matcher matcher = bytesPattern.matcher(normalizado);

            //Bytes (PESO)
            if(matcher.find()){
                unidade = matcher.group();
            }

            //Encontra os valores e formata
            ArrayList<String> valores = new ArrayList<>();
            Matcher m = NUMBER_PATTERN.matcher(in);
            while(m.find()){
                valores.add(m.group().replaceAll(" ", ""));
            }
            String out = "";

            //Caso [X ou superior]
            if(normalizado.contains("superior")){
                return String.format("%s%s ou superior", valores.get(0), unidade);
            }
            //Caso [X até Y] e [até Y]
            else if(normalizado.contains("até")){
                //Caso [até Y]
                if(valores.size() == 1){
                    out = String.format("até %s", valores.get(0));
                }
                //Caso [X até Y]
                else{
                    out = String.format("%s até %s", valores.get(0), valores.get(1));
                }
            }
            //Caso [X ou Y] ou [X ou Y ou ...]
            else if(normalizado.contains("ou") || normalizado.contains("/")){
                out = valores.get(0);
                for(int i=1; i < valores.size(); i++){
                    out += String.format("/%s", valores.get(i));
                }
            }
            //Caso livre
            else if(normalizado.contains("*") || normalizado.contains("livre")) {
                out = "Livre";
            }
            //Caso X
            else {
                if(valores.size() > 0)
                    out = valores.get(0);
            }

            //Coloca a unidade no final
            return out.isEmpty() ? "" : String.format("%s%s", out, unidade);
        }
}

Comment: Você está usando a expressão regular como literal, assim: `var numberPattern = /\d+(\.\d{1,2})?|(Livre)/i;`? Ou como string?
Comment: Tentou usar `/\d+(\.\d{1,2})?|(Livre)/i` para a expressão regular e substituir `var getNumbers = numberPattern.match(val);` por `var getNumbers = val.match(numberPattern);`?
Comment: O erro continua o mesmo.
Comment: Estava usando como String, como literal não obtive mais o erro! Ainda não obtive o resultado esperado mas obg.
Comment: Qual é o resultado esperado? Atualize sua pergunta que talvez consigo lhe ajudar, daí posto uma resposta.
Comment: São somente alguns exemplos de casos, provavelmente não está entrando no laço dos respectivos return's, irei testar
1) input = "20 Mb", expected = "20mb"; 2) input = "20 Mb ou 10mb", expected = "20/10mb"; 3) input = "aTé 10Mb", expected = "até 10mb";
Comment: É, neste caso teria que verificar toda sua função, ela está com alguns problemas, até mesmo de lógica. Você consegue resolver tudo com expressões regulares, como se utilizar agrupamentos e pegar as partes que deseja. Neste caso, teste e se não der conta poste suas dúvidas :)
Answer: Sua variável é nula por que a expressão regular não "casa" nada nos exemplos, nem mesmo 2kb funcionou por aqui.
Ela não combina com nenhuma parte da entrada por que não é uma expressão regular válida da forma que é declarada, ou seja, a sintaxe está incorreta.
Prefira usar expressões regulares literais. Então, no lugar disto:
"\d+(\.\d{1,2})?|(Livre)/i"

use isto:
/\d+(\.\d{1,2})?|(Livre)/i

Mas por que? Bem, esta \ é um carácter de escape em string, então prefira literais por ser mais elegante e até mesmo mais legível e simples de representar a expressão, do contrário você iria precisar disto:
"\\d+(\\.\\d{1,2})?|(Livre)\/i"

ou isto:
var reg = new RegExp("\\d+(\\.\\d{1,2})?|(Livre)", "i");

Bem mais conveniente usar literais, não é? =)
Veja um exemplo da forma literal:

function process(val) {
    var isPeso = "(?:k|m|g)b$";
    var normalizado = val.trim().toLowerCase().replace(" ", "");
    var unidade = "";
    var numberPattern = /\d+(\.\d{1,2})?|(Livre)/i;

    var myArray = normalizado.match(isPeso);
    if (myArray != null) {
        unidade = myArray;

        var getNumbers = val.match(numberPattern);
        var i;
        var valores = [];
        for (i = 0; i < getNumbers.length - 1; i++) {
            valores.push(getNumbers[i]);
        }

        var out = "";
        //Caso [X ou superior]
        if (normalizado.indexOf("superior") > -1) {
            return valores[0] + unidade + " ou superior";
        }
        //Caso [X até Y] e [até Y]
        else if (normalizado.indexOf("até") > -1) {
            //Caso [até Y]
            if (valores.length == 1) {
                out = "até " + valores[0];
            }
            //Caso [X até Y]
            else {
                out = valores[0] + " até " + valores[1];
            }
        }

        //Caso [X ou Y] ou [X ou Y ou ...]
        else if (normalizado.indexOf("ou") > -1 || normalizado.indexOf("/") > -1) {
            out = valores[0];
            for (i = 1; i < valores.length - 1; i++) {
                out += valores[i];
            }
        }
        //Caso livre
        else if (normalizado.indexOf("*") > -1 || normalizado.indexOf("livre") > -1) {
            out = "Livre";
        }
        //Caso X
        else {
            if (valores.length > 0) {
                out = valores[0];
            }
        }
        if (out.length == 0 || out == null) {
            return "";
        }

        return out + unidade;
    }
}
function test() {
    var val = document.getElementById("input").value;
    var result = process(val);
    document.getElementById("span").innerHTML = "Resultado: entrada: " + val + " | saida: " + result;
}
<input id="input" />
<button onclick="test()">GO</button>

    Resultado:

E um usando string "escapadas":

function process(val) {
    var isPeso = "(?:k|m|g)b$";
    var normalizado = val.trim().toLowerCase().replace(" ", "");
    var unidade = "";
    var numberPattern = "\\d+(\\.\\d{1,2})?|(Livre)\/i";

    var myArray = normalizado.match(isPeso);
    if (myArray != null) {
        unidade = myArray;

        var getNumbers = val.match(numberPattern);
        var i;
        var valores = [];
        for (i = 0; i < getNumbers.length - 1; i++) {
            valores.push(getNumbers[i]);
        }

        var out = "";
        //Caso [X ou superior]
        if (normalizado.indexOf("superior") > -1) {
            return valores[0] + unidade + " ou superior";
        }
        //Caso [X até Y] e [até Y]
        else if (normalizado.indexOf("até") > -1) {
            //Caso [até Y]
            if (valores.length == 1) {
                out = "até " + valores[0];
            }
            //Caso [X até Y]
            else {
                out = valores[0] + " até " + valores[1];
            }
        }

        //Caso [X ou Y] ou [X ou Y ou ...]
        else if (normalizado.indexOf("ou") > -1 || normalizado.indexOf("/") > -1) {
            out = valores[0];
            for (i = 1; i < valores.length - 1; i++) {
                out += valores[i];
            }
        }
        //Caso livre
        else if (normalizado.indexOf("*") > -1 || normalizado.indexOf("livre") > -1) {
            out = "Livre";
        }
        //Caso X
        else {
            if (valores.length > 0) {
                out = valores[0];
            }
        }
        if (out.length == 0 || out == null) {
            return "";
        }

        return out + unidade;
    }
}
function test() {
    var val = document.getElementById("input").value;
    var result = process(val);
    document.getElementById("span").innerHTML = "Resultado: entrada: " + val + " | saida: " + result;
}
<input id="input" />
<button onclick="test()">GO</button>

    Resultado:

Comment: Perfeito, obrigada. Por motivos desconhecidos, o  Nashorn não está executando esse script (`javax.script.ScriptException: TypeError: Cannot get property "length" of null in  at line number 1`).
Comment: @DanielaMarquesdeMorais bom, usando o primeiro examplo, tratando a função para ser avaliada pelo nashorn, funcionou OK. Entrada `aa20kb`, saída `20kb`. Qual foi a entrada que você testou?
Comment: "50kb" e obtenho o `ScriptException`
Comment: @DanielaMarquesdeMorais veja se este [gist](https://gist.github.com/brunocesarsilva/2d053889a8f6056e28c7) lhe ajuda.

Por que minha variável é null?


Closed form expression for the harmonic sum $\sum\limits_{n=1}^{\infty}\frac{H_{2n}}{n^2\cdot4^n}{2n \choose n}$

Question: I'm wondering if one could derive a closed form expression for the series
$$\sum_{n=1}^{\infty}\frac{H_{2n}}{n^2\cdot4^n}{2n \choose n}$$
$$\text{With } \text{ } \text{ } \text{ }H_n=\sum_{k=1}^{n}\frac{1}{k}\text{ } \text{ } \text{} \text{ } \text{ }\text{the } n^{th} \text{ harmonic number.}$$
Now, I know series involving harmonic numbers are well suited for a summation by part (or Abel's transformation) approach, but it doesn't lead anywere here, at least not in this state.
Any suggestions ?
Comment: Don't you mean $H_n=\sum_{k=1}^{n}\frac{1}{k}$?
Comment: Oh yes sorry, now it's corrected !
Comment: Would the fact that $\frac{{2n\choose n}}{4^n}=\frac{1}{2\pi}\int_0^{2\pi} \cos^{2n} x\,dx$ be useful if you can switch integration and summation?
Comment: Looks like a very good idea, but as far as I know there is no known closed form for the power series $\sum\limits_{n=1}^{\infty}\frac{H_{2n}}{n^2}x^{2n}$... And even if there were, I guess we would eventually get a very nasty looking integral, especially after composing with the cosine function...
Answer: For $x \in [0,1]$ let
$$ f(x) = \sum \limits_{n=1}^\infty \frac{{2n \choose n}}{n^2 4^n} x^{2n} \, . $$
Using the power series of $\arcsin$ we find
$$ x \frac{\mathrm{d}}{\mathrm{d} x} x \frac{\mathrm{d}}{\mathrm{d} x} f(x) = 4  \frac{\mathrm{d}}{\mathrm{d} x} [\arcsin(x) - x] = 4 \left[\frac{1}{\sqrt{1-x^2}} - 1 \right] $$
for $x \in [0,1)$ . In particular,
$$ f'(1) = 4 \int \limits_0^1 \frac{1}{x} \left[\frac{1}{\sqrt{1-x^2}} - 1 \right] \, \mathrm{d} x \stackrel{x=\sqrt{1-y^2}}{=} 4 \int \limits_0^1 \frac{\mathrm{d} y}{1+y} = 4 \ln(2) \, . $$
Now we can compute
\begin{align}
S &\equiv \sum \limits_{n=1}^\infty \frac{H_{2n} {2n \choose n}}{n^2 4^n} = \sum \limits_{n=1}^\infty \frac{{2n \choose n}}{n^2 4^n}  \int \limits_0^1 \frac{1-x^{2n}}{1-x} \, \mathrm{d} x = \int \limits_0^1 \frac{f(1) - f(x)}{1-x} \, \mathrm{d} x \\
&= \int \limits_0^1 \frac{- \ln(1-x)}{x} x f'(x) \, \mathrm{d} x
= \operatorname{Li}_2 (1) f'(1) - 4 \int \limits_0^1 \frac{\operatorname{Li}_2 (x)}{x} \left[\frac{1}{\sqrt{1-x^2}} - 1 \right] \, \mathrm{d} x \\
&= \operatorname{Li}_2 (1) f'(1) + 4 \operatorname{Li}_3 (1) - 4 \int \limits_0^1 \frac{\operatorname{Li}_2 (x)}{x \sqrt{1-x^2}} \, \mathrm{d} x \equiv 4 \left[\frac{\pi^2}{6} \ln(2) + \zeta(3) - I\right] \, .
\end{align}
In order to find $I$ we use a well-known integral representation of the dilogarithm:
\begin{align}
I &= \int \limits_0^\infty t \int \limits_0^1 \frac{\mathrm{d} x}{(\mathrm{e}^t - x) \sqrt{1-x^2}} \, \mathrm{d} t \stackrel{(*)}{=} \int \limits_0^\infty \frac{t \left[\frac{\pi}{2} + \arcsin(\mathrm{e}^{-t})\right]}{\sqrt{\mathrm{e}^{2t}-1}} \, \mathrm{d} t \\
&\stackrel{\mathrm{e}^{-t} = \sin(u)}{=} \frac{1}{2} \int \limits_0^{\pi/2} -\ln[\sin(u)] (\pi + 2 u) \, \mathrm{d} u = \frac{1}{2} \int \limits_0^{\pi/2} u (\pi + u) \cot(u) \, \mathrm{d} u \\
&= \frac{1}{2} [\pi K_1^{(1)} + K_2^{(1)}] = \frac{3}{8}\pi^2 \ln(2) - \frac{7}{16} \zeta(3) \, .
\end{align}
The integrals $ K_n^{(m)}$ are discussed in this question. Combining this result and the previous expression for the sum we end up with
$$ \boxed{S = \sum \limits_{n=1}^\infty \frac{H_{2n} {2n \choose n}}{n^2 4^n} = \frac{23}{4} \zeta(3) - \frac{5}{6} \pi^2 \ln(2)} \, . $$

Proof of $(*)$:
For $a \in [0,1]$ let
$$ g(a) = \int \limits_0^1 \frac{-\ln(1-a x)}{x \sqrt{1-x^2}} \, \mathrm{d} x= \sum \limits_{n=1}^\infty \frac{a^n}{n} \int \limits_0^{\pi/2} \sin^{n-1} (t) \, \mathrm{d} t \, .$$
Using Wallis' integrals we find
$$ g(a) = \frac{\pi}{2} \sum \limits_{k=0}^\infty \frac{{2k \choose k} a^{2k+1}}{4^k(2k+1)} + \frac{1}{4} \sum \limits_{m=1}^\infty \frac{4^k a^{2k}}{k^2 {2k \choose k}} = \frac{\pi}{2} \arcsin(a) + \frac{1}{2} \arcsin^2 (a) \, . $$
Therefore
$$ \int \limits_0^1 \frac{\mathrm{d} x}{(1-a x)\sqrt{1-x^2}} = g'(a) = \frac{\frac{\pi}{2} + \arcsin{a}}{\sqrt{1-a^2}} $$
holds for $a \in [0,1)$ .
Comment: This is a nice answer. Now, when I look at my junk, I am just ashamed.
Comment: Yes indeed, this is a very nice answer.
Comment: Thank you very much, this is a great answer !
Answer: This is not an answer but it is too long for a comment.
Considering
$$a_n=\frac{H_{2n}}{n^2\,4^n}{2n \choose n}\qquad \text{and} \qquad S_p=\sum_{n=1}^p a_n$$ none of the CAS I tried was able to find an expression for the partial sums or the infinite sum. Numerically, as shown below, the convergence looks to be extremely slow
$$\left(
\begin{array}{cc}
 p & S_p \\
 1000 & 1.21081501745 \\
 2000 & 1.21088004598 \\
 3000 & 1.21089738494 \\
 4000 & 1.21090493158 \\
 5000 & 1.21090901996 \\
 6000 & 1.21091153294 \\
 7000 & 1.21091321066 \\
 8000 & 1.21091439815 \\
 9000 & 1.21091527609 \\
 10000 & 1.21091594745
\end{array}
\right)$$ which can be explained by the fact that, for large values of $n$
$$\frac {a_{n+1}} {a_n} \simeq 1+\frac{2-5( \log (2n)+ \gamma) }{2 n \left(\log(2n)+\gamma \right)}$$ For the infinite summation, the result seems to be close to $1.2109201$ which is not identified by inverse symbolic calculators.
For large values of $n$, we also can find
$$a_n\simeq b_n=\frac{ \log (2n)+\gamma   }{n^{5/2}\,\sqrt{\pi }}$$ which does not help much even if
$$\sum_{n=1}^\infty b_n=\frac{(\gamma+\log(2))  \zeta \left(\frac{5}{2}\right)-\zeta '\left(\frac{5}{2}\right)}{\sqrt{\pi }}\approx 1.18001$$
 However, numerically, this can be of some help writing
$$S_\infty=S_p+\sum_{n=p+1}^\infty b_n$$
$$\left(
\begin{array}{cc}
 p & S_\infty \approx \\
 100  & 1.2109213325 \\
 200  & 1.2109203863 \\
 300  & 1.2109202368 \\
 400  & 1.2109201900 \\
 500  & 1.2109201700 \\
 600  & 1.2109201590 \\
 700  & 1.2109201535 \\
 800  & 1.2109201498 \\
 900  & 1.2109201475 \\
 1000 & 1.2109201458
\end{array}
\right)$$
Comment: First five terms summed of a partial closed form sum approximation achieved using Mathematica 11.3. After term 9 the $\log[2]$ term disappears and then appears occasionally after that, not sure if this is an error or feature of this partial series. $$\text{FullSimplify}\left[2 \sum _{m=1}^5 \left(H_{2 m}-H_{2 m-2}\right) \int_0^1 \text{FullSimplify}\left[\sum _{n=m}^{\infty } \frac{\binom{2 n}{n} x^{2 n-1}}{n 2^{2 n}}\right] \, dx\right]=\frac{11 \left(515328 \pi ^2-859301-6183936 \log ^2(2)\right)}{11612160}$$
Comment: or for slightly simpler integral $$\text{FullSimplify}\left[2 \sum _{m=1}^5 \left(H_{2 m}-H_{2 m-2}\right) \int_0^{\frac{1}{2}} \text{FullSimplify}\left[\sum _{n=m}^{\infty } \frac{\binom{2 n}{n} x^{2 n-1}}{n}\right] \, dx\right] $$
Comment: First comment should read after partial term 10
Comment: @JamesArathoon. Very interesting and I thank you. Would you mind to send me the  input form MMA syntax in a .txt file . I should try to play with it when going to university (my e-mail address is my profile). Thanks again :-)
Answer: Using the fact that $$\int_0^1x^{2n-1}\ln(1-x)\ dx=-\frac{H_{2n}}{2n}$$
multiply both sides by $\ \displaystyle-\frac{2}{n4^n}{2n \choose n}$ then take the sum, we get,
\begin{align}
S&=\sum_{n=1}^\infty\frac{H_{2n}}{n^24^n}{2n \choose n}=-2\int_0^1\frac{\ln(1-x)}{x}\left(\sum_{n=1}^\infty\frac{(x^2)^n}{n4^n}{2n \choose n}\right)\ dx
\end{align}
I managed here to prove: $$\quad\displaystyle\sum_{n=1}^\infty \frac{x^n}{n4^n}{2n \choose n}=-2 \tanh^{-1}{\sqrt{1-x}}-\ln x+2\ln2$$
which follows:
\begin{align}
S&=4\underbrace{\int_0^1\frac{\ln(1-x)\tanh^{-1}{\sqrt{1-x^2}}}{x}\ dx}_{\text{IBP}}+4\int_0^1\frac{\ln(1-x)\ln x}{x}\ dx-4\ln2\int_0^1\frac{\ln(1-x)}{x}\ dx\\
&=-4\int_0^1\frac{\operatorname{Li}_2(x)}{x\sqrt{1-x^2}}\ dx+4(\zeta(3))-4\ln2(-\zeta(2))\\
&=-4\left(\frac{3}{8}\pi^2 \ln(2) - \frac{7}{16} \zeta(3)\right)+4\zeta(3)+\frac{2}{3}\pi^2\ln(2)\\
&\boxed{=\frac{23}4\zeta(3)-\frac{5}{6}\pi^2\ln2}
\end{align}
Credit goes to ComplexYetTrivial for nicely evaluating $\ \displaystyle\int_0^1\frac{\operatorname{Li}_2(x)}{x\sqrt{1-x^2}}\ dx=\frac{3}{8}\pi^2 \ln(2) - \frac{7}{16} \zeta(3)$
Answer: Here is my way of evaluating this sum also offering a different way to calculate that polylogarithmic integral.

$$\sum _{k=1}^{\infty }\frac{H_{2k}}{k^2\:4^k}\binom{2k}{k}$$

First let's consider the following central binomial coefficient generating function.
$$\sum _{k=1}^{\infty }\frac{x^{2k}}{k\:4^k}\binom{2k}{k}=-2\ln \left(1+\sqrt{1-x^2}\right)+2\ln \left(2\right)$$
$$-2\sum _{k=1}^{\infty }\frac{1}{k\:4^k}\binom{2k}{k}\int _0^1x^{2k-1}\ln \left(1-x\right)\:dx=4\int _0^1\frac{\ln \left(1-x\right)\ln \left(1+\sqrt{1-x^2}\right)}{x}\:dx$$
$$-4\ln \left(2\right)\int _0^1\frac{\ln \left(1-x\right)}{x}\:dx$$
$$\sum _{k=1}^{\infty }\frac{H_{2k}}{k^2\:4^k}\binom{2k}{k}=4\int _0^1\frac{\ln \left(1-x\right)\ln \left(1+\sqrt{1-x^2}\right)}{x}\:dx+4\ln \left(2\right)\zeta \left(2\right)$$

$$\int _0^1\frac{\ln \left(1-x\right)\ln \left(1+\sqrt{1-x^2}\right)}{x}\:dx=\int _0^1\frac{\operatorname{Li}_2\left(x\right)}{x}\:dx-\int _0^1\frac{\operatorname{Li}_2\left(x\right)}{x\sqrt{1-x^2}}\:dx$$
$$=\zeta \left(3\right)-\int _0^{\frac{\pi }{2}}\csc \left(x\right)\operatorname{Li}_2\left(\sin \left(x\right)\right)\:dx=\zeta \left(3\right)-\int _0^1\frac{\operatorname{Li}_2\left(\frac{2t}{1+t^2}\right)}{t}dt$$
$$=\zeta \left(3\right)+2\int _0^1\frac{t\ln \left(t\right)\ln \left(1-t\right)}{1+t^2}\:dt-\int _0^1\frac{t\ln \left(t\right)\ln \left(1+t^2\right)}{1+t^2}\:dt-2\int _0^1\frac{\ln \left(t\right)\ln \left(1-t\right)}{t}\:dt$$
$$+\int _0^1\frac{\ln \left(t\right)\ln \left(1+t^2\right)}{t}\:dt+2\int _0^1\frac{t\ln \left(t\right)\ln \left(1-t\right)}{1+t^2}\:dt-\int _0^1\frac{t\ln \left(t\right)\ln \left(1+t^2\right)}{1+t^2}\:dt$$
$$=\zeta \left(3\right)+4\underbrace{\int _0^1\frac{t\ln \left(t\right)\ln \left(1-t\right)}{1+t^2}\:dt}_{I}+\frac{1}{4}\underbrace{\int _0^1\frac{\ln ^2\left(1+t\right)}{t}\:dt}_{\frac{1}{4}\zeta \left(3\right)}$$
$$-2\underbrace{\int _0^1\frac{\ln \left(t\right)\ln \left(1-t\right)}{t}\:dt}_{\zeta \left(3\right)}+\underbrace{\int _0^1\frac{\ln \left(t\right)\ln \left(1+t^2\right)}{t}\:dt}_{-\frac{3}{16}\zeta \left(3\right)}$$
The integral $I$ can be found evaluated elegantly in the book (Almost) Impossible Integrals, Sums, and Series through pages $\#98,\#99,\#100$, making use of it's result we have:
$$\int _0^1\frac{\ln \left(1-x\right)\ln \left(1+\sqrt{1-x^2}\right)}{x}\:dx=\frac{23}{16}\zeta \left(3\right)-\frac{9}{4}\ln \left(2\right)\zeta \left(2\right)$$
And in the process we also proved that:
$$\int _0^1\frac{\operatorname{Li}_2\left(x\right)}{x\sqrt{1-x^2}}\:dx=-\frac{7}{16}\zeta \left(3\right)+\frac{9}{4}\ln \left(2\right)\zeta \left(2\right)$$

Collecting the results we finally have:
$$\sum _{k=1}^{\infty }\frac{H_{2k}}{k^2\:4^k}\binom{2k}{k}=\frac{23}{4}\zeta \left(3\right)-5\ln \left(2\right)\zeta \left(2\right)$$


Find $\int_{0}^{\infty} \frac{\sin x}{x+x\cos^2 x }\,\mathrm{d}x$

Question: I have just done these, but I don't know what to do next......
\begin{align}
\int \frac{\sin x}{x+x\cos^2 x}\,\mathrm{d}x & = \int \frac{1}{x}\cdot\frac{\sin  x}{1+\cos^2 x}\,\mathrm{d}x\\
&=\int \frac{1}{x}\,\mathrm{d}(\arctan(-\cos x))\\\
&=\frac{1}{x} \arctan(-\cos x)-\int -\frac{1}{x^2} \arctan(-\cos x)\,\mathrm{d}x \\
&=\frac{1}{x} \arctan(-\cos x)-\int \frac{\arctan(\cos x)}{x^2}\,\mathrm{d}x
\end{align}
Answer: Apply Lobachevsky's formula: if $f\in\mathcal{C}(\mathbb{R}_+)$ meets $f(\pi\pm x)=f(x)$, then $$\int_0^\infty f(x)\,\frac{\sin x}{x}\,dx=\int_0^{\pi/2}f(x)\,dx.$$ The given integral is then equal to $$\int_0^{\pi/2}\frac{dx}{1+\cos^2 x}\ \underset{t=\tan x}{\phantom{\big[}=\phantom{\big]}}\ \int_0^\infty\frac{dt}{2+t^2}=\frac\pi{2\sqrt2}.$$
Comment: @NikhilKumarSingh: It is exact (look for a proof). Wolfy doesn't handle integrals of this kind well.
Comment: Proof [here](https://math.stackexchange.com/q/776903).
Comment: Just out of pure curiosity :  could you elaborate a bit starting from the integral  in title ? Thanks & cheers :-)
Comment: Nice(+1) but I have a question : Does Lobachevsky's formula gives approximate results? Your answer seems to be $1.110720...$ but answer of the integral by Wolfram is $1.12581...$. I tried this on another problem and again seems to be approximate.
Comment: @ClaudeLeibovici: see the edit (just extracted the formula itself).
Comment: thanks a lot !!!!


Let $R$ be an equivalence relation on set $A$. Prove that for any $x,y \in A$ either $[x] = [y]$ or $[x] \cap [y] = \varnothing$.

Question: For any $x$ and any $y$
$(x,x) \in R$ and $(y,y) \in R$ (since $R$ is reflexive)
So there exist $[x]$ and $[y]$ equivalence classes for $R$.
When $[x]$ and $[y]$ are equivalence classes of $R$ then,
there are possible two status which is either $[x] = [y]$ or $[x] \neq [y]$,
Assume if $[x] \neq [y]$ then $[x] \cap [y] \neq \varnothing$.
Let $z$ be an arbitrary element for $[x] \cap [y]$.
then $z \in [x] \cap [y] \implies z \in [x]$ and $z \in [y]$
but $[x] \neq [y]$
Therefore, This is contradiction!
Therefore, if $[x] \neq [y]$ then $[x] \cap [y] =  \varnothing$.
if either $[x] = [y]$ or $[x] \neq [y]$,
$\implies$ either $[x] = [y]$ or $[x] \cap [y] =  \varnothing$. (since if $[x] \neq [y]$ then $[x] \cap [y] =  \varnothing$)
Is this correct? Is there a fault? Is there another way to prove it?
Comment: z ∈ [x] and z ∈ [y] but [x] ≠ [y] is not, on its own, a contradiction. You can have non-equal sets that have elements in common. The core of this problem is to show that equivalence classes are special in this regard.
Comment: $1 \in \{1,2,3\}$ and $1\in \{1,5,9\}$ but $\{1,2,3\} \ne \{1,5,9\}$.  That is not a contradiction.  You seem to be assuming what you must prove.
Comment: Equivalence classes are disjoint.
Answer: There are only two possibilities: either $[x]\cap[y]=\emptyset$ or $[x]\cap[y]\neq\emptyset$. Now $[x]\cap[y]\neq\emptyset$ means that there exists an element $z\in[x]\cap[y]$.
If $z\in[x]\cap[y]$, then $xRz$ and $yRz$, which implies by transitivity and symmetry ($yRz\implies zRy$) that $xRy$. In that case you can show $[x]=[y]$. This is because for any $a\in A$ with $aRx$,  $aRx$ and $xRy$ implies by transitivity that $aRy$, and hence $[x]\subseteq[y]$. The reverse inclusion $[y]\subseteq[x]$ follows similalry.
Comment: Thank you very much
Answer: Suppose that $[x] \cap [y] \neq \emptyset$ and $[x] \neq [y]$.
Since the intersection is nonempty, we may pick $z \in [x] \cap [y]$. Since the classes are not equal, we may pick an element $w \in R$ which is in one class but not in the other. WLOG, assume that $w \in [x]\setminus[y]$.
Since $w, z \in [x],$ we have that $x \sim w$ and $x \sim z$. Using symmetry and transitivity, we get that $z \sim w$. However, we also have $y \sim z$. Transitivity gives $y \sim w$ which is a contradiction since $w \notin [y]$.
Comment: Thank you very much
Answer: Let $x,y\in A$.
Either $x R y$ of $x \not R y$.
Case 1:  $x R y$.
$[x]=\{z\in A| z R x\}$, $[y]=\{z\in A|z R y\}$.
If $m\in [x]$ then $m Rx$ and as $R$ is transitive and $xR y$ then $m Ry$ so $m \in [y]$ so $[x]\subset [y]$ but if $n \in[y]$ then $n Ry$ but as $R$ is symmetric and $xRy$ the $yR x$ and as $R$ is transitive $nRx$ so $n\in [x]$ and $[y]\subset [x]$ so $[x]=[y]$.
Case 2:  $x \not R y$.
If $n \in [x]\cap [y]$ then $n Rx$ and $nR y$.  As $R$ is symmetric than $xRn$ and $nRy$.  As $R$ is transitive $x R y$ which is a contradiction.  So $[x]\cap [y] = \emptyset$.
So $x Ry \implies [x]=[y]$
And $x \not R y \implies [x]\cap [y] = \emptyset$.
Those are the only two options.
Comment: Thank you very much
Answer: It suffices to prove that, for all $x,y\in A$, if $[x]\cap[y]\neq \varnothing$, then $[x]=[y]$.
Suppose $x,y$ are arbitrary in $A$ and let $z\in [x]\cap[y]$. Then $zRx$ and $zRy$ by definition. The former implies $xRz$, which, together with the latter, gives $xRy$. So $[x]\subseteq [y]$. But by symmetry, $[y]\subseteq [x]$. Hence $[x]=[y]$.


Study the convergence of the series $\sum_{n=1}^\infty\left(\ln(n\tan\frac{1}{n})\right)^{1/3}$

Question:
Study the convergence of the $$\sum_{n=1}^\infty \ln^{1/3}\left(n\tan\frac{1}{n}\right)$$

I'm trying to study the convergence of the series and I need a little help.
This is what I tried to do.
I used the limit comparison test
$$\lim_{n\to \infty}\frac{\ln(n\tan\frac{1}{n})}{n\tan\frac{1}{n}-1}=1$$
This implies that
$$\sum_{n=1}^\infty\left(\ln(n\tan\frac{1}{n})\right)^\frac{1}{3} \sim \sum_{n=1}^\infty\left(n\tan\frac{1}{n}-1\right)^\frac{1}{3}$$
And this is where I got stuck because I don't know how to study the convergence of the new one. Should I try another method or should I proceed with this one? If so how can I do that?
The answer in the solution says that it diverges
Comment: You are almost there: it happens that $f(x)=\frac1x\tan x-1$ is of order $x^2$ when $x\to0$, hence the $n$th term of the series is of order $\left(\frac1{n^2}\right)^{1/3}$ and the series diverges. Now, how you should prove that $f(x)\sim\frac13x^2$ depends very much on your background. If you can invoke the Taylor expansion of $\tan$ at order $3$, then your proof is complete.
Answer: For $n$ sufficiently large we have $$\tan {1\over n}={1\over n}+{1\over 3n^3}+\cdots$$ according to MaclaurinSeries therefore $$\forall n\in \Bbb N\quad,\quad \tan {1\over n}>{1\over n}+{1\over 3n^3}$$which can be also verified from https://www.desmos.com/calculator/2zjhgxlelr. By substitution we obtain $$\left(n\tan {1\over n}-1\right)^{1\over 3}{>\left(1+{1\over 3n^2}-1\right)^{1\over 3}\\={1\over \sqrt[3]3 n^{2\over 3}}\\>{1\over 2n}}$$as $\sum {1\over 2n}$ diverges, so do $$\sum \left(n\tan {1\over n}-1\right)^{1\over 3}$$and $$\sum_{n=1}^\infty \ln^{1/3}\left(n\tan\frac{1}{n}\right)$$
Comment: I understand what you tried to do but I don't think you that's the Maclaurin series for $\tan\frac{1}{n}$ shouldn't it be $\tan\frac{1}{n}=\frac{1}{n}+\frac{1}{3n^3}+\frac{2}{15n^5}+...$
Comment: Thank you for the feedback!!


Erro encoding PHP função copy()

Question: Estou com um problema que até o momento não consegui resolver. Quando utilizo a função copy() do php, o arquivo que é copiado de determinado lugar para o outro faz com que arquivos que possuam acentuação fiquem descaracterizados quanto ao seu nome.
Estou utilizando IIS 10 no Windows 10 E PHP 5.3.9.
copy(string $source , string $dest);

Já printei o  $dest e os nomes saem corretamente, porém quando a função é executada vou verificar na pasta destino o arquivo está com seu nome todo descaracterizado conforme nome abaixo de um arquivo XML que o nome correto seria Padrão José e Porâ.xml (estou utilizando estas acentuações para fins de testes.)
Padrão_josé_e_porâ.xml (Nome errado do arquivo)
Sei que a função copy() possuí um terceiro parâmetro para stream_context_create() porém não consegui achar exemplos da utilização deste parâmetro para ser  usado localmente.
O erro acontece depois que a função é executada, ou seja, o arquivo que é copiado de um lugar para outro fica com acentuação descaracterizada, o motivo eu não sei pois passo o nome correto na variável $dest.
Também já adicionei header('Content-Type: text/html; charset=utf-8'); no arquivo PHP.
Alguma opinião?
Obrigado.
Comment: Olá @bacco esta resposta sugerida por você não condiz com o problema que possuo, estou com problema com a função copy() do php como comentado no texto que redigi e não apenas em codificação em si. O erro está sendo gerado depois que a função é executada!
Comment: Na verdade o problema tem grande chance de ser o mesmo (não em relação ao encoding da saída, mas em relação a conversão indevida). O que precisa é localizar no código qual dos subsistemas está fazendo a conversão indevida. Se puder por os trechos do código que manipulam e capturam o nome do arquivo, podemos analisar melhor. Lembre-se que toda publicação, mesmo fechada, é passível de revisão (e até reabertura se de fato for um problema diferente). Mas para isto, se [edit] e puser o código relevante, fica mais fácil de ajudarmos (seja reabrindo, ou orientando a como aplicar a solução).
Comment: Para maior chance de solução, seria bom por todos os trechos que manipulam $source e $dest. A idéia aqui é você conseguir ter o problema resolvido, de qq forma. Só precisamos de mais material pra analisar.
Answer: Cria um arquivo .htaccess e adiciona o seguinte código: AddDefaultCharset utf-8

Erro encoding PHP função copy()


HTTP 403 with CloudFlare

Question: I've added my site to CloudFlare. I'm trying to allow requests to only come in through CloudFlare's network, and reject all others. When I add the following to my .htaccess, I get HTTP 403 Forbidden.
# Cloudflare Firewall Bypass Prevention
<RequireAll>
    Require all denied
    Require ip 18.104.22.168/22
    Require ip 18.104.22.168/22
    Require ip 188.8.131.52/22
    Require ip 22.214.171.124/13
    Require ip 184.108.40.206/14
    Require ip 220.127.116.11/18
    Require ip 188.8.131.52/22
    Require ip 126.96.36.199/18
    Require ip 188.8.131.52/15
    Require ip 184.108.40.206/13
    Require ip 126.96.36.199/20
    Require ip 126.96.36.199/20
    Require ip 18.104.22.168/20
    Require ip 18.104.22.168/22
    Require ip 184.108.40.206/17
    Require ip 2400:cb00::/32
    Require ip 2606:4700::/32
    Require ip 2803:f800::/32
    Require ip 2405:b500::/32
    Require ip 2405:8100::/32
    Require ip 2a06:98c0::/29
    Require ip 2c0f:f248::/32
</RequireAll>

The list of IPs comes directly from CloudFlare's IP ranges. In theory, CloudFlare acts as a reverse proxy for my server. Why aren't requests coming from CloudFlare? Any ideas on what I messed up, or how to fix it?
Comment: Does it work if you remove that code block? I do something similar, whitelisting only CloudFlare IP addresses and my private static IP, but I use AWS security groups rather than Apache.
Comment: Yes, when removing the .htaccess rules the site loads fine. When I only allow Cloudflare IPs, I get HTTP 403 Forbidden. For some reason, Cloudflare doesn't seem to be acting properly as a reverse proxy. I've contacted Cloudflare support, but they're extremely slow. I can't see anything in my Cloudflare settings that looks out of place. Any ideas?
Comment: CloudFlare is likely working fine, the problem is likely with your configuration. Try this answer: https://stackoverflow.com/questions/39884892/apache-2-4-whitelist-cloudflare-only
Answer:
<RequireAll>

Should be <RequireAny> or omitted altogether (since that is the default in the absence of any authorisation containers).
Comment: I tried changing `RequireAll` to `RequireAny`, removing `RequireAll` entirely, and tried changing `Require ip` to `allow from`. I always get a 403 forbidden error. I believe the issue to be from Cloudflare, and the configuration there. Everything looks good, and it should be acting as a reverse proxy, but for some reason it's just not.
Comment: @anxiety Did you check the IP addresses in your server's access log?
Answer: Solved with a variation of Tom's reply (https://stackoverflow.com/questions/39884892/apache-2-4-whitelist-cloudflare-only)
mod_cloudflare is no longer supported, but you can easily achieve the same thing by using mod_remoteip

HTTP 403 with CloudFlare


case when on inner join

Question: I have the following 4 tables:  MainTable, Warehouse,Customer and Company.
The schema of these tables:
create table MainTable(ID int, Warehouse_id int, Customer_ID int)
create table Warehouse (Warehouse_id int, company_id int)
create table Customer (Customer_ID int, Company_ID int)
create table company (Company_id int, Country_ID int, Zone_ID int)

The objectif is to get the  Country_ID and Zone_ID  for the corresponding ID (of MainTable).
We have 2 different cases: if MainTable.Warehouse_ID is not null we should do the inner join on Warehouse table (on field warehouse_id) and then a join on Company table (on field Company_ID),
else (if  MainTable.Warehouse_ID is null) we should do the inner join on Customer Table (on Customer_ID field) and then on Company Table (on Company_ID field).
the following query generates an error near the word 'case':
select CO.Country_ID, CO.Zone_ID
from    MainTable MT
inner join (case
    when MT.Warehouse_ID is not null
then
         Warehouse W on MT.Warehouse_ID=W.Warehouse_ID
        inner join Company CO on W.Company_ID=CO.Company_ID
else
         Customer Cu on MT.Customer_ID=Cu.Customer_ID
        inner join Company C on Cu.Company_ID=CO.Company_ID
    end)

Am I doing this right with a small syntax error that i missed? If not..is there any other way to do it?
Thanks
Comment: one way to do it, is by dynamic query! but you will need to use a stored proc for it
Comment: Dynamic SQL won't help since the condition is specific to each line
Answer: You can use UNION:
SELECT CO.Country_ID, CO.Zone_ID
  FROM MainTable MT
  INNER JOIN Warehouse W ON MT.Warehouse_ID=W.Warehouse_ID
  INNER JOIN Company CO on W.Company_ID=CO.Company_ID
  WHERE MT.Warehouse_ID IS NOT NULL
UNION
SELECT CO.Country_ID, CO.Zone_ID
  FROM MainTable MT
  INNER JOIN Customer Cu ON MT.Customer_ID=Cu.Customer_ID
  INNER JOIN Company CO on Cu.Company_ID=CO.Company_ID
  WHERE MT.Warehouse_ID IS NULL

Answer: Try something as below:
IF EXISTS(SELECT 1
          FROM   MainTable mt
          WHERE  mt.Warehouse_ID IS NOT NULL)
  BEGIN
      SELECT CO.Country_ID,
             CO.Zone_ID
      FROM   MainTable MT
             INNER JOIN Warehouse W
                     ON MT.Warehouse_ID = W.Warehouse_ID
             INNER JOIN Company CO
                     ON W.Company_ID = CO.Company_ID
  END
ELSE
  BEGIN
      SELECT CO.Country_ID,
             CO.Zone_ID
      FROM   MainTable MT
             INNER JOIN Customer Cu
                     ON MT.Customer_ID = Cu.Customer_ID
             INNER JOIN Company C
                     ON Cu.Company_ID = CO.Company_ID
  END

Answer: You can't do that. What would you expect the output to be with this kind of conditional joins ?
Have you tried using outer joins ?
select ISNULL(C1.Country_ID,C2.Country_ID) as Country_ID,ISNULL(C1.Zone_ID,C2.Zone_ID) as Zone_ID
from    MainTable MT
left outer join  Warehouse W on MT.Warehouse_ID=W.Warehouse_ID
left outer join Company1 C1 on W.Company_ID=C1.Company_ID
left outer join Customer Cu on MT.Customer_ID=Cu.Customer_ID
left outer join Company2 C2 on Cu.Company_ID=C2.Company_ID

Comment: Thank you all for your help. Thomas, with left outer join it works :)
Comment: for what the minus please ?

case when on inner join


how to apply multiplication within pandas dataframe

Question: please advice how to get the following output:
df1 = pd.DataFrame([['1, 2', '2, 2','3, 2','1, 1', '2, 1','3, 1']])
df2 = pd.DataFrame([[1, 2, 100, 'x'], [3, 4, 200, 'y'], [5, 6, 300, 'x']])

import numpy as np
df22 = df2.rename(index = lambda x: x + 1).set_axis(np.arange(1, len(df2.columns) + 1), inplace=False, axis=1)

f = lambda x: df22.loc[tuple(map(int, x.split(',')))]
df = df1.applymap(f)
print (df)
Output:
   0  1  2  3  4  5
0  2  4  6  1  3  5

df1 is 'address' of df2 in row, col format (1,2 is first row, second column which is 2, 2,2 is 4 3,2 is 6 etc.)
I need to add values from the 3rd and 4th columns to get something like (2*100x, 4*200y, 6*300x, 1*100x, 3*200y, 5*300x)
the output should be 5000(sum of x's and y's), 0.28 (1400/5000 - % of y's)
Answer: It's not clear to me why you need df1 and df... Maybe your question is lacking some details?
You can compute your values directly:
df22['val'] = (df22[1] + df22[2])*df22[3]

Output:
   1  2    3  4   val
1  1  2  100  x   300
2  3  4  200  y  1400
3  5  6  300  x  3300

From there it's straightforward to compute the sums (total and grouped by column 4):
total = df22['val'].sum() # 5000
y_sum = df22.groupby(4).sum().loc['y', 'val'] # 1400
print(y_sum/total) # 0.28

Edit: if df1 doesn't necessarily contain all members of columns 1 and 2, you could loop through it (it's not clear in your question why df1 is a Dataframe or if it can have more than one row, therefore I flattened it):
df22['val'] = 0

for c in df1.to_numpy().flatten():
    i, j = map(int, c.split(','))
    df22.loc[i, 'val'] += df22.loc[i, j]*df22.loc[i, 3]

This gives you the same output as above for your example but will ignore values that are not in df1.
Comment: thanks it's clear how how perform calculations within one df. the problem is that I have two df's and need to find output using 'key table' df2. df1 consists of df2 values (row, column fro the first two columns)
Comment: Could you add an example to your question to clarify the purpose of df1 and df? (adding more complex input and desired output)
Comment: df1 is an output of another source. df2 is a 'key table' to get sum of x's and y's
Comment: I've updated my answer. Is it what you're looking for?
Comment: thanks, it's not exactly what I try to get but you helped me much to solve this question!


Group Policy Separation: opinions

Question: Pertaining to Windows Server 2008 +/- 6 years: Just wondering, but when I create group policy for domains, I usually create this to one master file. The size of this Active Directory is normally for small, less-than-ten-user entities, and controlling these spaces is done largely through GP. When a new computer is added, for instance, the desktop is completely modified/prepared to resemble all others' Internet rules, file and directory shares, proxy blocks are added, Desktop icons are added/removed, and more.
What is the real advantage for creating multiple separate GP Organizational Units? Do you practice this (i.e. One makes nineteen separate policies, one for each rule)? At what size is the threshold where you make multiple.
Answer: IMHO, A lot of group policy design is about common sense.  If you have a group of settings that apply globally to all computers/users in your domain, you only need a single GPO to hold them.  If at some point a subset of those settings no longer apply to everyone or apply differently to different groups, split them out into their own GPOs.  If it's a small group of settings that all revolve around a specific function, I generally try to name the policy for the function rather than for the computers/users they apply to.  So Firewall - No Inbound Blocking and Firewall - Standard Blocking instead of Firewall - Dept A and Firewall - Dept B.
There is a processing "cost" for each GPO a computer has to process, but on today's computers it's pretty minimal.  Don't go crazy and create a policy for each setting you want to apply.  But don't worry about adding 5 instead of 1.
Comment: To better describe my environments, I make everything under a single Organizational Unit. For each rule I create, I either make it for all, or specify an and/or/except condition, citing either an active directory group or single computer.

I wonder when it would get to be a major problem. That, or if someone has the mantra of making a unique Organizational Unit for each and every single rule or group of rules, i.e. desktop icons; time server url; etc.

Group Policy Separation: opinions


Words of length $n$ containing an odd number of zeros

Question:
Let $a_n$ be the number of words of length $n$ with letters from the alphabet $\{0, 1, 2, 3\}$
  containing an odd number of zeros.

I have already verified that this is given by the recurrence relation:
$$a_{n+1} = 2 a_n + 4^n.$$ where $a_0=0$.
I then used the method of a generating function to solve this and arrive at:
$$a_n=  2^{2n-1} - 2^{n-1}.$$
Which seems to work for the first couple of values, also Wolfram Alpha agrees with my deduction.
This problem can also be solved alternatively, using a new sequence $B_n$, I find this method more difficult but wish to learn it as well. It's more of a combinatorics method, probably using a clever counting argument.

Another way to find the same result is as follows:
1) Consider the set $B_n$ of
words of length $n$ with at least one $0$ or $1$.
How many of those are there?
I am not sure how to express this in terms of $a_n$
2) In
this set there are exactly as many words with an even number of zeros as there are with
an odd number of zeros. Just change the first occuring $0$ or $1$ with its dierence
with $1$ $\dots$ (not sure what is meant here, the wording is a bit vague)
I am not sure what the author is getting at, can anybody see where the argument is going and give me some pointers?
Answer: For (1), we have $|B_n| = 4^n - 2^n$ since there are $4^n$ total strings over the alphabet, and $2^n$ of them have no zeros and no ones.
To expand on (2), let $O_n \subset B_n$ be the subset of strings with an odd number of zeros and $E_n \subset B_n$ be the subset with an even number of zeros. Note that the function $f : O_n \to E_n$ which on input $x$ replaces the first $0$ or $1$ in $x$ with $1$ or $0$, respectively, is a bijection. Thus $a_n = |O_n| = |E_n|$, and further, $O_n$ and $E_n$ partition $B_n$, so each has size $\frac{1}{2}(4^n - 2^n)$.
Comment: That is indeed an elegant way to derive the  same result, the bijection is very satisfying, thank you.


Como tratar elementos de um array individualmente?

Question: Saudações senhores,
Estou tentando projetar um portal onde meus clientes possam visualizar suas faturas, demonstrativos e notas fiscais. Como podem ver está tudo bem amador, mas encontra-se quase pronto para fazer o que preciso. Abaixo segue o código PHP e como fiz para que a informação "fatura" do banco de dados pudesse virar um link (para visualização e download de um arquivo). O problema surge quando tento fazer o mesmo com o objeto "reserva".
Como serão sempre várias reservas por fatura, o MySQL extrai essa informação como uma linha. Eu preciso manipular cada número presente nela, mas tudo o que eu tento só afeta a minha linha como um todo.
Aqui um link para uma pergunta prévia explicando o uso do group_concat nesse caso: https://stackoverflow.com/questions/38549723/how-to-group-data-with-mysql-php
Resultado da página:

<?php
$mysqli = NEW MySQLi('localhost','root','','server');

$sqlFatura = $mysqli->query("SELECT login as NOME,fatura AS
Fatura, Emissao, Vcto, group_concat(reserva) AS RESERVAS
FROM usuarios INNER JOIN faturas,anexos WHERE
usuarios.ID=IDlogin AND faturas.ID=IDfatura AND login='".
mysql_real_escape_string($_SESSION['login'])."' GROUP BY fatura");

if($sqlFatura->num_rows > 0){
    while($rows = $sqlFatura->fetch_assoc()){
        $fatura = $rows['Fatura'];
        $loc = $fatura .".pdf";
        $stur = $rows['RESERVAS'];
        $emissao = $rows['Emissao'];
        $vcto = $rows['Vcto'];

    echo "
 Fatura $fatura Emitida dia $emissao Vencimento
    $vcto=>DOWNLOAD  ANEXO: $stur

";

}
}else{
echo "SEM FATURAS.";

}

?>

Agradeço de antemão a ajuda e para quaisquer esclarecimentos bastar entrar em contato.
Att,
Comment: Você quer retornar as reservas é quer ter, qual índice como referências ? O id de faturas?
Comment: Sim, exatamente.
Comment: Essa imagem que postou, é o retorno da função que postou ?
Comment: Sim, e o resultado até aqui. Repare que eu consegui tornar cada _fatura_ em um link para o arquivo. Agora eu preciso fazer o mesmo para cada um dos números que seguem o anexo (407685,408475,etc...).
Comment: Bom, mas ao que parece, as informações estão vindo corretamente do banco, o que quer agora é tornar cada uma das reservas um link clicável que aponte para um endereço, é isso ?
Comment: Sim, me parece que é só tratar o php. Infelizmente não estou conseguindo fazer, venho quebrando cabeça tentando com loop, while e for, mas não consigo nenhum resultado sem repetições e ainda assim não clicáveis.
Answer: Bem se eu entendi sua dúvida adicione isso ao código e deve funcionar:
 echo "
 Fatura $fatura Emitida dia $emissao Vencimento
       $vcto=>DOWNLOAD
           ANEXO:$stur

";

Comment: Já havia tentado isso. Porém toda a string vira um gigantesco link. Esse problema está sendo bem frustrante.
Comment: Certo, mas qual o objetivo vc deseja então ? Você pode através do css, aplicar uma classe ao elemento link, e retirar o underline com um "text-decoration:none", e deixar o link sublinhado apenas quando o mouse está sobre o link...


Finding the Shapley value solution for a set of players of size n?

Question: I'm revising Game Theory and have come across this question:
"The Miners' Game is defined as follows. There are $n (>2)$ miners who discover
a large $(>n/2)$ quantity of gold bars. It takes two miners to carry a bar. (Assume
that it is not possible to return to the mine for a second round.) Each bar is of
equal size and value. Show that the core of this game consists of a single
imputation if $n$ is even and is empty if $n$ is odd. Find the Shapley value solution
for this game."
I can, with very basic and crude methodology, "prove" the first two facts. However I'm not sure how to find the Shapley value solution. I'm assuming that it consists of $\bar{x} = (0.5, 0.5, ... , 0.5)$ because logic, and I know for subset $S$ of all players we have $v(S∪\{i\})-v(S) = 0$ for $|S|$ even and $= 1$ for $|S|$ odd.
Any advice on where to go from here?
(Also, model proofs would appreciated for the facts relating to the core as mine are lengthy, but this would simply be a bonus.)
Comment: Hi, welcome to math.SE! [Here](http://meta.math.stackexchange.com/questions/5020)'s a reference and tutorial for typesetting math on this site.
Answer: Let $v$ be the characteristic function of the game and $N$ the entire set of miners.
If $n$ is even, $v(N)=n/2$. For an imputation to sum to $n/2$, the average over all pairs of the combined allocations to the pairs must be $\frac12$, and for the imputation to be coalitionally rational, the combined allocation must be at least $\frac12$ for each pair. It follows that the allocation is exactly $\frac12$ for each pair.
If $n$ is odd, $v(N)$ is less than $n/2$. The same argument as above shows that the average over all pairs is less than $\frac12$ but the allocation to each pair is at least $\frac12$, a contradiction.
The Shapley value is $v(N)/n=\frac1n\left\lfloor\frac n2\right\rfloor$ for each miner, by efficiency and symmetry.


honor 50 cannot be detected as device in android studio

Question: Honor 50 is the first Honor phone that is separated from Huawei and is not supported by Hi Suite. Hence, android studio can't detect it as a development device.
how to get around this?
Answer: The chipset is Qualcomm SM7325 / Snapdragon 778G 5G, therefore I'd assume ...
that the device should become known after installing the "Qualcomm USB driver".
Answer: What operating system is your Honor 50? Can you see the device using the adb devices command?
You could also try to use Cloud Debugging of AppGallery Connect to see whether it could solve the problem of device identification failure.
Furthermore, this answer might help.
Answer: eventually installing latest version of honor app solves the issue
Comment: What is honor app?


NHibernate exception enumerator was modified

Question: I have a multithreaded NHibernate application with ThreadStaticSessionContext.
I bind un each thread a new session. Before exiting the thread I commit the transaction and i get
enumerator was modified

  at NHibernate.Util.SequencedHashMap.OrderedEnumerator.MoveNext()
  at NHibernate.Util.IdentityMap.get_EntryList()
  at NHibernate.Util.IdentityMap.ConcurrentEntries(IDictionary map)
  at NHibernate.Event.Default.AbstractFlushingEventListener.PrepareEntityFlushes(IEventSource session)
  at NHibernate.Event.Default.AbstractFlushingEventListener.FlushEverythingToExecutions(FlushEvent event)
  at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
  at NHibernate.Impl.SessionImpl.Flush()
  at NHibernate.Transaction.AdoTransaction.Commit()
  at ...

I don't have a clue...
Answer: This exception is usually thrown when you add/remove from a collection while it is being enumerated (like in a foreach statement).
Comment: The code fails in

try
            {
                Transaction.Commit();
                Session.Close();
                return true;
            }
            catch( Exception ex )
            {
                //log ex
                Console.WriteLine( ex );
                Console.ReadKey();
                if( Transaction != null )
                    Transaction.Rollback();
                if( Session != null )
                    Session.Clear();
                return false;
            }

in Transaction.Commit()
Comment: It looks like the collection is being modified by another thread during the `Commit`


Triple integration problem

Question: Prove that:
$$\iiint\limits_B \frac{1}{x} dx\,dy\,dz=\frac{8-4\sqrt2}{3}$$
where
$$B=\{(x,y,z):1\leqslant x \leqslant e^z, y\geqslant z, y^2+x^2\leqslant 4\}.$$
I used Mathematica's regionplot3D to visualize $B$. However I could use some help setting the correct integration intervals.
Comment: You put a period at the end of the integral and a capital "W" in "where", as if it were the beginning of a new sentence.  I've seen many others do that before, both here and in Wikipedia articles. Is it taught that way somewhere?  I've wondered how different people could do such a thing independently of each other.
Answer: If you put $x$ and $y$ on the outside, you've got
$$
\iint\limits_{\begin{smallmatrix} x^2+y^2\le 4 \\[2pt]  x\ge 1 \\[2pt] y\ge\log x \end{smallmatrix}} \left( \int_{\log x}^y \frac 1 x \, dz \right)\,dx\,dy.
$$
The inner integral is now routine:
$$
\iint\limits_{\begin{smallmatrix} x^2+y^2\le 4 \\[2pt]  x\ge 1 \\[2pt] y\ge\log x \end{smallmatrix}} \frac{y-\log x}{x} \,dx\,dy.
$$

The constraint $x\ge 1$ means that if we put $\int\cdots\cdots\,dx$ on the outside, then the bounds work out:
$$
\int_1^2 \left( \int_{-\sqrt{4-x^2}}^{\sqrt{4-x^2}} \frac{y-\log x}{x} dy \right)\,dx
$$
The integral of $y\,dy$ over an interval symmetric about $0$ is $0$, and the integral of $-(\log x)/x$ with respect to $y$ is easy because $-(\log x)/x$ does not change as $y$-changes.  We get
$$
\int_1^2  2\sqrt{4-x^2} \left(\frac{-\log x}{x}\right) \,dx.
$$
That takes care of the bounds.
Postscript: The bounds don't work out simply this way, and I'm not sure they do any other way either.  The inner integral with respect to $y$ would need to be $\displaystyle\int_{\log x}^{\sqrt{4-x^2}}$, and the outer one could not go all the way up to $2$ since once $x$ is too big, we get $\log x>\sqrt{4-x^2}$.  You can tell that will happen because $\log x$ increases from $0$ to a positive number as $x$ goes from $0$ to $2$ while $\sqrt{4-x^2}$ decreases from a positive number to $0$.  Perhaps to be continued [ . . . . ]
Comment: Can this integral have a negative value?
Comment: Clearly it must have a negative value.  If $10$ (so the square root exists and is positive, and $-\log x<0$ since $x>1$. ${}\qquad{}$
Comment: I agree with this, but shouldn't the triple integral be positive (since the integrand is positive)?
Comment: Oh: I missed something: we have to restrict the region to the subset where $y\ge\log x$.  I'll revise it a bit.
Comment: Thanks for looking at this again.
Answer: @Michael Hardy has already elaborated much on the integral and there remains only the last part to solve. So I will try to do that. The integral now that we need to solve, after the simplification by @Michael Hardy, is $$I=\iint\limits_{\begin{smallmatrix} x^2+y^2\le 4,\\ x\ge 1,\\ y\ge \ln x
\end{smallmatrix}}\frac{y-\ln x}{x}dx$$ Now the curve $y=\ln x$ intersects with the circle $x^2+y^2=4$ at two points, one at $x<1,y<0$ and one at $x>1,y>0$. Let the later on has coordinates $(x_0,y_0)$. Note that since the function $\phi(x)=\sqrt{4-x^2}-\ln x$ is monotonic decreasing for $x>1$, and $\phi(2)=-\ln 2<0\Rightarrow x_0<2$. Then our integral becomes $$I=\iint\limits_{\begin{smallmatrix}  1\le x\le x_0,\\ \ln x\le y\le \sqrt{4-x^2}
\end{smallmatrix}}\frac{y-\ln x}{x}dx=\int_{x=1}^{x_0}\int_{y=\ln x}^{\sqrt{4-x^2}}\frac{y-\ln x}{x}dy \ dx=\int_{x=1}^{x_0}\frac{\frac{1}{2}(4-x^2-(\ln x)^2)-\ln x(\sqrt{4-x^2}-\ln x)}{x}dx\\=\int_{x=1}^{x_0}\left(\frac{2}{x}-\frac{x}{2}\right)dx+\int_{x=1}^{x_0}\frac{(\ln x)^2}{2x}dx-\int_{x=1}^{x_0}\frac{\ln x\sqrt{4-x^2}}{x}dx\\=2\ln x_0-\frac{x_0^2-1}{4}+\frac{(\ln x_0)^3}{6}-J$$ where $$J=\int_{x=1}^{x_0}\frac{\ln x\sqrt{4-x^2}}{x}dx$$

Triple integration problem


How do I expire a django template cache key on receiving a signal?

Question: In my front page template I use the cache function like this:
{% cache 86400 my_posts %}
    {% get_latest_posts %}
{% endcache %}

When there is a new post I would like to expire the cache key; like this:
def clear_post_cache():
    cache.delete('my_posts')

post_save.connect(clear_post_cache, sender=Post)

My problem is that the cache key isn't accessible as 'my_posts'. How do I find the key name?
Answer: Have a look at how the cache key is constructed:
args = md5_constructor(u':'.join([urlquote(resolve_variable(var, context)) for var in self.vary_on]))
cache_key = 'template.cache.%s.%s' % (self.fragment_name, args.hexdigest())

The key is a combination of the fragment name (my_posts) and a md5 sum of additional arguments to the cache tag. Since you don't have additional arguments, the hexdigest is d41d8cd98f00b204e9800998ecf8427e (the md5 hash of the empty string). The cache key should therefore end up to be
template.cache.my_posts.d41d8cd98f00b204e9800998ecf8427e

If you need a more general solution, this snippet might help.
Answer: Note that the md5_constructor in the first line of Benjamin Wohlwend's example above is deprecated. Current (Nov. 2011) version is:
args = hashlib.md5(u':'.join([urlquote(resolve_variable(var, context)) for var in self.vary_on]))

Answer: from django.core.cache import cache
from django.core.cache.utils import make_template_fragment_key

cache.delete(make_template_fragment_key('footer'))


Count duplicated symbols in string and group them using Javascript

Question: I need to create a function that executes text compression. Function takes one parameter x - text and returns text composed of character and it's duplicate count consecutively.
Example
x = "aaavvvfdff"
Output
a3v3f1d1f2
I tried this code:
const randomText = 'aaavvvfdff'

function getTextCompression(x) {
  const chars = x.split('')

  const duplicatesCount = chars.reduce((count, char) => {
    count[char] = (count[char] || 0) + 1;
    return count;
  }, {});

  console.log(duplicatesCount)
}

getTextCompression(randomText);

Getting output: { a: 3, v: 3, f: 3, d: 1 }
Don't know what to do next or is it good aproach?
So how to write a function which returns that output?
Comment: SO isn't a place for "how to" questions. You're supposed to do your own research, and exhaust all available resources. Posting a question here is a last resort, and it must contain an attempt at solving this yourself.
Comment: Use a for loop to iterate your characters in your string, have an integer count value to count if the next character matches the previous character then append this letter and its count to a new string to return, if the next character doesnt match the previous, reset the count and change temp to new character.
Comment: What have you tried already? We can't help you if you don't show what you have tried so far.
Answer: You can use a simple regular expression and a String.prototype.replace() to implement this function, which is a run-length encoding:

function rle (str) {
  return str.replace(/([^])\1*/g, (match, p) => `${p}${match.length}`)
}

let x = 'aaavvvfdff'

console.log(rle(x))

Just for fun I'll throw in an inverse function using a similar approach:

function rld (str) {
  return str.replace(/([^])(\d+)/g, (_, p1, p2) => p1.repeat(p2))
}

let x = 'a3v3f1d1f2'

console.log(rld(x))