AlternativeText dos sharpes para guardar config

Question: ola
gostaria de saber se existe algum problema/risco de se usar a propriedade  AlternativeText  dos objetos sharpes para guardar parâmetros de funcionamento
tem algum risco de do nada esses dados serem apagados/substituídos de repente por outras ações dentro do próprio office?
estou montando um esquema para usar shape "formas" como botões especiais como grupos de option button e checkbox e pensei desse espaço para ter a configuração de funcionamento
como não era prioridade eu deixei um pouco de lado, mas parte do que eu fiz , tem algo mais avançado mas nem achei a planilha
Sub SelecDigitoFORMA()
     Dim Nn As Long, Cj As Long, dsL As Long, dsC As Long, V As Long
     Dim Sh As Shape     'Object
     Dim ConfigB() As String     ' matriz de configuração
     Dim CfB(1 To 20) As Long     ' define possição das configurações
     CfB(1) = 0          'Tipo= 0 controle, 1 chekcbox ,2 option, 3 rotativo
     CfB(2) = 1          'Estado= 0 desativado, 1 ativado, possição no rotativo
     CfB(3) = 2          'valor se desaAtivado
     CfB(4) = 3          'valor se ativado
     CfB(5) = 4
     CfB(6) = 5     'Linha inicial ( 0 PARA POSSIÇÃO  TopLeftCell)
     CfB(7) = 6     'deslocamento LINHA
     CfB(8) = 7     'coluna inicial ( 0 PARA POSSIÇÃO  TopLeftCell)
     CfB(9) = 8     'deslocamento COLUNA
     CfB(10) = 9     '
     CfB(11) = 10     '
     CfB(12) = 11    '
     CfB(13) = 12    '
     CfB(14) = 13     '
     CfB(15) = 14    'cor fundo se desativado
     CfB(16) = 15     'cor fundo se ativado
     CfB(17) = 16     'cor texto se desativado
     CfB(18) = 17    'cor texto se ativado
     CfB(19) = 18    'possição de sequencia acionamento
     CfB(20) = 19    'Nome botão
     'ActiveSheet.Shapes.SelectAll

     Set Sh = ActiveSheet.Shapes(Application.Caller)
     'Sh.Fill.BackColor.RGB = RGB(0, 128, 64)
     ccs = Sh.TopLeftCell.Column
     cs = Cells(1, ccs).Value2
     NWP = Sh.OnAction & cs
     Gn = Sh.Title       ' nome grupo
     pre = Sh.OLEFormat.Object.Caption & ccs

     ConfigB = Split(Sh.AlternativeText, ",")
     If UBound(ConfigB) < 1 Then Exit Sub

     If ConfigB(CfB(1)) = "0" Then
          V = ConfigB(CfB(2))     'Cells(2, cs + 1).Value2
          If V = 1 Then

               ' Cells(ConfigB(CfB(6)) + ConfigB(CfB(7)), ConfigB(CfB(8)) + ConfigB(CfB(9))).Value2 = 0    ' Val(ConfigB(CfB(3)))

               ConfigB(CfB(2)) = 0
               Sh.BackgroundStyle = 3
               Sh.TextFrame2.TextRange.Font.Fill.ForeColor.ObjectThemeColor = msoThemeColorBackground2
          Else
               ConfigB(CfB(2)) = 1
               Sh.BackgroundStyle = 1:
               Sh.TextFrame2.TextRange.Font.Fill.ForeColor.ObjectThemeColor = msoThemeColorText2
          End If
          Sh.AlternativeText = Join(ConfigB, ",")

          For Each Sh2 In ActiveSheet.Shapes
               ccs = Sh2.TopLeftCell.Column
               gcs = Cells(1, ccs).Value2
               BBN = Sh2.OnAction & gcs
               If BBN = NWP Then
                    If Gn = Sh2.Title Then
                         ConfigB2 = Split(Sh2.AlternativeText, ",")
                         If UBound(ConfigB2) < 19 Then Exit Sub
                         If ConfigB2(CfB(1)) <> "0" Then
                              ConfigB2(CfB(1)) = Val(ConfigB(CfB(2))) + 1
                         End If
                         Sh2.AlternativeText = Join(ConfigB2, ",")
                    End If
               End If
          Next Sh2

     Else
'==========================================================
          With ActiveSheet
               For Each Sh In .Shapes
                    adf = Sh.TopLeftCell.Address     'Local
                    ccs = Range(adf).Column
                    lls = Range(adf).Row
                    gcs = Cells(1, ccs).Value2
                    BBN = Sh.OnAction & gcs

                    If BBN = NWP Then
                         If Gn = Sh.Title Then        ' nome grupo

                              ConfigB = Split(Sh.AlternativeText, ",")
                              If UBound(ConfigB) < 10 Then Exit Sub

                              If ConfigB(CfB(1)) <> "0" Then
                                   If ConfigB(CfB(6)) = "0" Then dsL = gcs + ConfigB(CfB(7)) Else dsL = Val(ConfigB(CfB(6))) + ConfigB(CfB(7))     'LINHA DE SAIDA
                                   If ConfigB(CfB(8)) = "0" Then dsC = gcs + ConfigB(CfB(9)) Else dsC = Val(ConfigB(CfB(8))) + ConfigB(CfB(9))     'COLUNA DE SAIDA

                                   If pre = Sh.OLEFormat.Object.Caption & ccs Then
                                        If ConfigB(CfB(2)) = "0" Then
                                             ConfigB(CfB(2)) = 1
                                             Cells(dsL, dsC).Value2 = ConfigB(CfB(4))
                                             Sh.BackgroundStyle = 3
                                             Sh.TextFrame2.TextRange.Font.Fill.ForeColor.ObjectThemeColor = msoThemeColorBackground2
                                        Else
                                             If ConfigB(CfB(1)) = "1" Then
                                                  ConfigB(CfB(2)) = 0:
                                                  Cells(dsL, dsC).Value2 = ConfigB(CfB(3))
                                                  Sh.BackgroundStyle = 1:
                                                  Sh.TextFrame2.TextRange.Font.Fill.ForeColor.ObjectThemeColor = msoThemeColorText2
                                             End If
                                        End If
                                   Else
                                        If ConfigB(CfB(1)) = "2" Then
                                             ConfigB(CfB(2)) = "0":
                                             Cells(dsL, dsC).Value2 = ConfigB(CfB(3))
                                             Sh.BackgroundStyle = 1:
                                             Sh.TextFrame2.TextRange.Font.Fill.ForeColor.ObjectThemeColor = msoThemeColorText2
                                        End If
                                   End If
                              End If
                              Sh.AlternativeText = Join(ConfigB, ",")

                         End If
                    End If
               Next Sh
          End With
     End If

End Sub

Answer: Olá,
Todos os shapes (incluindo Gráficos) no Excel possuem a propriedade AlternativeText.
Essa propriedade pode ser usada para armazenar informações. No seu caso, é possível sim usar essa propriedade pra guardar parâmetros sem que haja perda dos dados.
Segue um exemplo de uso:
Sub SetAlternativeText()
    Sheet1.Shapes("Rectangle 1").AlternativeText = "ABC"
End Sub

Sub GetAlternativeText()
    MsgBox Sheet1.Shapes("Rectangle 1").AlternativeText
End Sub

De toda forma, talvez seja possível fazer esse armazenamento através de uma variável global.
Comment: já tinha feito uns testes , Até que funciona bem, mas para uso mais abrangente teria que montar todo um sistema .Não sei bem como se usaria uma global para isso, sendo que os dados são individuais marcando valores e estados dos objetos.
Comment: Você pode declarar as variáveis fora da função e usá-las quando for necessário em qualquer escopo do seu código.

E em caso de você precisar armazenar esses dados historicamente, é possível também declarar um array global e ir armazenando esses valores no array.
Comment: sim , até entendo, mas acho que esse artificio somente seria valido caso haja uma sobre carga ou problema envolvido com o uso das capacidades dos proprios objetos, uma vez localizado o objeto e lendo seu AlternativeText já se tem os parametros sem precisar de procurar em uma array e salvar em planilha , eu queria algo que funcionase como botão de opção e de seleção


Five Fret Higher Guitar Tuning for Voicing

Question: In order from bottom up, I'm considering moving my A, B, G, and E strings to the left one string, while tuning the B up to C.
Then I discard the low E and replace the high e with another G string which I tune up to A.
This gives me ADGCEA tuning.  Since I only play arpeggios and strums, the pitch order is largely inconsequential.  However, I can now use regular fingerings in different keys, allowing me to never have to move the capo more than a few frets to match my voice.
I did this with a Uke, and it works great.  Has anyone tried this with a guitar?  Any comments?
Comment: Very interesting idea!
Answer: Another possible problem of shifting the strings is with intonation.  If you have a compensated bridge, which has slightly different string lengths for the different strings, your intonation will suffer, because the compensation will be wrong.
Comment: Yes.  Intonation on ukes is notoriously difficult.  None of my guitars has a compensating bridge, but I do anticipate having to address both string gauge and bridge. I probably will not work with the nut.  OBTW, a Spanish guitarist I met says that tuning a half step down, putting a capo in #1 position, then retuning with the capo on mitigates intonation problems in some guitars.  That takes the nut out of the picture.  Based on your comments, I'll get a spare G string and try it on one of my guitars.   It may be a long time, but I'll respond when I've tried it.
Comment: I agree- the best thing to do is simply try it out.
Answer: I've never tried this with a guitar and I imagine that you would be able to get it to work. However, you may run into issues with the action (string height) if you're not careful, because by moving the strings down they will be sitting in larger pockets in the nut. You may also have some issues with intonation and that may need to be adjusted as well.
I think using a  capo is going to be cheaper and easier to do than a guitar setup. I'm interested to see how your new setup works for you.
Comment: using a capo may affect the resonance the guitar would have compared to the longer string "open" tuning, so actually tuning the longer string scale to the notes you want could have a better sound than the shortened string sound that a capo gives.
Comment: Also, to quote the question: " However, I can now use regular fingerings in different keys, allowing me to never have to move the capo more than a few frets to match my voice." .   I think the questioner already considered using a capo.
Comment: Alphonso- yep.  About the slots in the nut: yes, this could be a problem.  But depending on the profile of the slots, it might not be.  It won't hurt to try and see.
Comment: Whoops! You right the OP did mention using a capo. I should have read the question more carefully.


Is there a Perl strict symbol resolution syntax for functions?

Question: I want to know how to force the resolution of subs at compile time.
For some background, with perl, I can resolve package symbols strictly at compile-time using a :: affixed to the end of the package name. For example.
perl -wE'use warnings FATAL => "bareword"; die 7; Foo::; die 42'
Bareword "Foo::" refers to nonexistent package at -e line 1.

You'll notice in the above code, we didn't die with 7 or 42. We died before the run-time phase. This only works to resolve the package name. I can use a method resolution operator (->) with the above syntax and resolve a function name in run-time,
perl -E'use warnings FATAL => "bareword"; die 7; Foo::->bar(); die 42'
Bareword "Foo::" refers to nonexistent package at -e line 1.

But this isn't exactly what I want,

If I declare a package Foo that lacks a sub bar and I want to call the non-existent function bar inside that package, I will no longer get a compile-time error,
  perl -E'package Foo {}; use warnings FATAL => "bareword"; die 7; Foo::->bar(); die 42'
  7 at -e line 1.

You can see here, when () is affixed to the end of the symbol it resolves in run-time; but, when :: is affixed to the end of a symbol though it's assumed to be a package name it's resolved in compile-time.

The -> operator is using run-time method resolution. It searches @ISA, and also provides a first argument of the class.

What I would like is to die if Foo doesn't have bar sub in compile-time.
Comment: One way, see [How can I smoke out undefined subroutines](https://stackoverflow.com/questions/41428150/how-can-i-smoke-out-undefined-subroutines/41434568#41434568)
Comment: How is this different than [this question](https://stackoverflow.com/q/41428150/589924)?
Comment: You had this question marked as not a dupe, so you must think it's different. But until you explain how it's different, I don't see how we can help you.
Answer: Calling a function without parentheses will attempt to resolve the symbol in the parsing phase, this also includes fully-qualified symbols. The tricky part is what happens when it doesn't resolve. Under use strict 'subs', it will die due to bareword strings being disallowed.
use strict;
use warnings;
Foo::bar; # Bareword "Foo::bar" not allowed while "strict subs" in use

This gets trickier when there are arguments. It still attempts to parse it as a bareword string, and so may report a syntax error when it's followed by something that wouldn't make sense there.
use strict;
use warnings;
Foo::bar 42; # Number found where operator expected

Other times it parses it as an indirect method call, which then postpones the error to runtime, or may even end up doing something you didn't expect.
use strict;
use warnings;
my $foo;
Foo::bar $foo; # Can't call method "bar" on an undefined value

Basically, Perl tries really hard to figure out what the syntax was supposed to mean and so doesn't always end up with a useful error message when it doesn't work.
Comment: Not automatically, that is precisely what the parser symbol checking is doing and the parentheses cause this to be deferred, the problem is it just has many fallback options. You can explicitly check if a function is defined with something like `BEGIN { die "Foo::bar is undefined" unless defined &Foo::bar }`
Comment: Certainly this would all be much simpler if indirect object notation didn't exist.
Comment: Consider the usual case of intentionally delaying a symbol resolution using parentheses: calling a subroutine which is defined later in the same file, without needing to predeclare it.
Comment: Can you be explicit, is there any method to do this with parenthesis in such a fashion that works that works with variables and without indirect object syntax?
Comment: Yes, I know I could write it explicitly. I just figured there was a way to force it. Since that's precisely what I want and it seems like something `strict` should do. Especially when perl doesn't permit overloading. It seems like the symbol either exists or it doesn't and that can usually be determined at compile time.
Comment: Or put another way, it seems like a bareword check that was a little more aggressive would be massively more useful. Parens shouldn't make that warning less strict
Comment: I agree such a thing would be useful, but it's not a hard line that strict currently draws, because there are many other possibilities and some symbols are not meant to be resolved until runtime (indicated by parentheses, or being part of a method call, etc).


How to synchronize two check boxes values, upon change?

Question: In my module, I have created a simple form with a single checkbox (A) and a submit button.
I also have a checkbox (B) boolean that i added in the user profile.
Now I would like to:

write a submit function that would update checkbox (B) with the status of checkbox (A).
Get rid of the submit button, and have Checkbox B updated automatically  upon change of checkbox (A) status.

I am trying to achieve an email notification on comments system as I described here in a previous post: How to add a checkbox form to a panel?
Thanks,
baba
Answer: I got it working this way:
<code>/**
 * Implements hook_block_info
 */
 function mymodule_block_info() {

  $blocks['block_notify'] = array(
                           'info' => t('Notify me'),
                           'cache' => DRUPAL_NO_CACHE,
                           );

   return $blocks;
}

/**
 * Implements  hook_block_view
 */
 mymodule_block_view($delta = '') {

 $block = array();
 switch ($delta) {
               case 'block_notify':
                 $block['content'] =  drupal_get_form('mymodule_example_form');
                 break;

              }
  return $block;
}

function mymodule_example_form($form, &$form_state) {

 global $user;
 user_full = user_load($user->uid);
 $val = $user_full->field_user_message_notification['und'][0]['value'];

 $form['form_notify'] = array(
                         '#type' => 'checkbox',
                         '#default_value' => $val,
                         '#title' => t('Notify me by email when I receive a new message'),
                         //'#description' => t("Check this option to be notified by email when you receive a new message"),
                         );

drupal_add_js(drupal_get_path('module', 'mymodule') . '/mymodule_request.js', 'file');
global $user;

return $form;
}

function mymodule_example_form_submit($form, &$form_state) {
// Submission logic.
 global $user;
 $user_full = user_load($user->uid);
 $edit = (array) $user_full;
 $edit['field_user_message_notification']['und'][0]['value'] = $form_state['values']['form_notify'] ;
 user_save($user_full, $edit);

 }
</code>
Then to trigger form submit on checkbox change I just added the follwing javascript in mymodule_request.js
<code>jQuery(document).ready(

function ($)
{
 jQuery.noConflict();

 $checkBox = $("#edit-form-notify");

 if( $checkBox.length != 0)
 {
    $checkBox.click(
        function(){
            //        alert('hello');
            this.form.submit();
            }
          );

 }
});
</code>
I can now just select the "Notify me" block in my panel by " add content" in panels.


Question on countability of family of holomorphic functions

Question: Let $\mathcal{F} \subset \mathcal{H}(\mathbb{C})$ a family of holomorphic functions such that for every $z \in \mathbb{C}$ the set $\{f(z): f \in \mathcal{F}\}$ is countable, my question is if $\mathcal{F}$ is necessary countble.
I don't have any idea from where to start so any tips or help would be really appreciated.
Answer: Apparently, the question you ask has name and surname: it is called Wetzel's problem. To that extent, we can mention the Wikipedia page, which has a brief historical overview of the problem, as well as the article by Erdös, which proves the following:
The conclusion of the problem (i.e., there are only countably many  analytic functions in the family) is equivalent to the continuum hypothesis not holding.
Therefore, there is no simple answer to your question. The article by Erdös contains a beautiful proof of such equivalence, which I recommend that anyone who likes mathematics checks.
On the other hand, if you replace "countable" by "finite" everywhere, there is a simple answer: yes, the family must be finite, given that $\{f(z) \colon f \in \mathcal{F}\}$ is finite for all $z \in \mathbb{C}.$ The proof, which is fairly simple, is as follows:
Suppose there is an infinite sequence $\{f_i\}_{i \ge 1} \subset \mathcal{F}$ of pairwise distinct analytic functions. Let first $B_{i,j} = \{z \in \mathbb{C} \colon f_i(z) = f_j(z)\}.$ As all functions are analytic and distinct pairwise, the set $B_{i,j}$ is at most countable. Thus, the set
$$B = \cup_{i,j \ge 1, i \neq j} B_{i,j}$$
Is also countable. Now let $A_N = \{z \in \mathbb{C} \colon |\{f(z) \colon f \in \mathcal{F}\}| = N\}.$ As $\cup_{N \ge 1} A_N = \mathbb{C},$ there is $M \in \mathbb{N}$ such that $A_M$ is uncountable.
On the other hand, as $A_M$ is uncountable and $B$ is countable, there is at least a point $z_0 \in A_M \cap B^{c}.$ But this is a contradiction, as $z_0 \in B^{c}$ implies that $f_i(z_0) \neq f_j(z_0), \forall i\neq j,$ and thus $z_0 \not \in A_M.$
Comment: LOL this means I've just spent the last couple of hours trying to prove the negation of the Continuum Hypothesis. No wonder....
Comment: Thank you very much! Your answer is really good and complete. I haven't read Erdös article but reading Wikipedia's page on the problem I've shown that the proof following Erdös reasoning is also avalible in the book _Proofs from THE BOOK_ by Aigner and Ziegler and it is very well explained there.
Comment: I am glad to help :) Yep, it is in the 'Proofs from THE BOOK', and the version there is explained to great detail, also a really nice source


Fetch a view into hook_preprcess_node and then put it in a block

Question: I want to fetch a view in my template_preprocess_node function and then put in in a block, so I can diplay it in the sidebars of my page. I have the view (the code below) but don't know how to put it in a block. Thank you for your help in advance!
<code>    $view = views_get_view('playlist');
    $view->set_display('block');
    $view->set_arguments(array($course));
    $view->pre_execute();
    $view->execute();
    $variables['content']['playlist'] = $view->render();
</code>
Answer: If you want to draw a view of content based on a node, then you should build a module that declared hook_block(), and that hook_block gets the current node with menu_get_object(), and form the desired view.
At the theming layer, when your node is preprocessed for theming, it's not a good place to construct any blocks. Hope this helps.
Comment: I got your point and Ive actually made it that way. Thank you for your help!


What formula can be used to identify the number of points required in drawing desired line count?

Question: I have to draw lines through a given points. Each point has to draw a line through other points. It draws only in one direction. So there is no duplicate lines passing through same points.
Now, I have been restricted to draw only 1000 lines. So I want to know how many points will I need to draw the stated count of lines? What is the formula that I can use to get the number of points required?
I thought of (n + 1) + (n + 2) + ( n + 3) + ..... = 1000. But don't know if this is right, as I have to put n = 0 to satisfy my equation.
Here is the illustration of what I am attempting:

Please let me know what I can do.
Answer: It's the triangle numbers, in your diagram there are 10 lines, $\frac12n(n+1)$ with $n=4$, or use $\frac12n(n-1)$ with $n=5$.
Then to find out how many points are needed for 1000 lines, or the closest $n$ possible, form a quadratic equation and solve.
Comment: But I don't know what is n? then how will it be possible to decide whether it is even or odd to chose the formula?
Comment: n is found by solving the quadratic equation 0.5n(n-1)=1000 (both formulae will give the same answer, because in the first after solving you'd have to add one to get the number of points)
Comment: true. but you have proposed two equations. one I suppose work when `n` is even and the other one when `n` is odd. Am I have a misconception?
Comment: (comment above was edited)
Comment: solving quadratic gives me an imaginary number if the line count is set to 500. Can you please tell me whether I am wrong?
Comment: check all the minus signs, it should be real, all the best with it
Comment: yes my bad. thank you for the answer
Answer: Suppose you have $n$ points. Pick any point on the circle, and observe that $n-1$ lines emerges from that point. Also, every line is shared by $2$ points, so the total number of lines is $$\frac{n(n-1)}{2}$$
If you have $1000$ lines, then the minimum number of points is the smallest $n>0$ such that $1000\leq\frac{n(n-1)}{2}$. This can be solved to yield $$\left\lceil \frac{1+3\sqrt{889}}{2}\right\rceil=46$$
Comment: Wow. that is one amazing solution. Thank you.


How can I send a body message with mpack?

Question: How can I send a body message with mpack?
mpack -s "Test" /home/Desktop/text.txt firstname.lastname@example.com

In this scenario, it will sent a text.txt file with the subject ''test'', but what if I want to send a message body with it.
I tried:
echo "Body Message" | mpack -s "Subject" file.txt email@example.com

but it doesn't work.
Answer: Include it as a description.
Example:
echo "this is the message body" > message_body.txt
mpack -s "Subject goes here.." -d message_body.txt email@example.com
rm message_body.txt


Solutions to Linear System of ODEs Have Identical Bases?

Question: When solving an ODE system like $\vec{x}'=\begin{bmatrix} 1 & 2\\3&4 \end{bmatrix}\vec{x},$ you assume that the solutions $x_1(t)$ and $x_2(t)$ will have identical bases. So in this example, each solution might be a linear combination of two exponentials, $e^{r_1t}$ and $e^{r_2t}.$ This allows the system to be solved as an eigenvalue equation. My question is, why can we guess that $x_1$ and $x_2$ will have the same basis functions? Why doesn't the solution look more like this: $x_1=c_1e^{r_1t}+c_2e^{r_2t}$ and $x_2=c_3e^{r_3t}+c_4e^{r_4t}?$
Thanks in advance. :)
Answer: I think you can benefit from reading this, but in short the solutions to the equation $\dot{x} = A x$ are in general $x(t) = e^{At}x(0)$, so if you can diagonalize $A = U\Lambda U^{-1}$ then $x(t) = U e^{\Lambda t}U^{-1}x_0$, where $e^{\Lambda t} = {\rm diag}\{e^{\lambda_1 t}, e^{\lambda_2t}, \cdots \}$, so in general the solution will be a linear combination of functions of the form $e^{\lambda t}$. What is important to note here is that in general $\lambda \in \Bbb{C}$, so solutions can also include functions such as $\sin \lambda t$

EDIT
Note that
\begin{eqnarray}
A^2 &=& (U\Lambda U^{-1})(U\Lambda U^{-1}) = U\Lambda(UU^{-1})\Lambda U^{-1} = U\Lambda^2U^{-1} \\
&\vdots& \\
A^k &=& (U \Lambda^{k-1} U^{-1})(U\Lambda U^{-1}) = U \Lambda^k U^{-1}
\end{eqnarray}
Therefore
\begin{eqnarray}
e^{At}&=& \sum_{k=0}^{+\infty}\frac{t^k}{k!}A^k = \sum_{k=0}^{+\infty}\frac{t^k}{k!}U\Lambda^kU^{-1} \\
&=& U\left(\sum_{k=0}^{+\infty}\frac{t^k}{k!}\Lambda^k\right)U^{-1} \\
&=& U e^{\Lambda t}U^{-1}
\end{eqnarray}
Comment: Thank you for the answer. Why is it that $e^{At} = Ue^{\Lambda t}U^{-1}$? How come the matrices $U$ and $U^{-1}$ aren't powers of an exponential?
Comment: @Aladris I updated my answer, hopefully it makes more sense now


The redirect_uri does not match the registered value Azure AD B2C For LinkedIn

Question: I tried to add an identity provider for my Azure AD B2C, I add Facebook and LinkedIn for my Azure AD B2C provider. Facebook is working fine but not LinkedIn it keep getting error like this:

The redirect_uri does not match the registered value

Here is my redirect uri:
https://login.microsoftonline.com/te/Heisenberg.onmicrosoft.com/oauth2/authresp

As you can see Heisenber.onmicrosoft.com is my tenant. I also tried the following redirect uri:
https://login.microsoftonline.com

The result is the same.
Any suggestion what should I do or change?
Comment: fixed, what should i do is , i must use lower case to my redirect uri, even tough my tenant is Heisenberg.onmicrosoft.com with capital. So i tried to change to all lower case and its worked
Comment: Try to add "/signin-linkedin" at the end of the uri like this: `https://login.microsoftonline.com/te/Heisenberg.onmicrosoft.com/oauth2/authresp/signin-linkedin`
Comment: Can you sign out of LinkedIn, and then click "LinkedIn" in your policy. When it sends the request to LinkedIn, you can look at the URL in the browser and see what "redirect_uri" is passed in. It must match the redirect_uri that is registered for your application. If you have difficulty with that, please update the question with the link for the authentication page at LinkedIn.
Answer: fixed, what should i do is , i must use lower case to my redirect uri, even tough my tenant is Heisenberg.onmicrosoft.com with capital. So i tried to change to all lower case and its worked
Comment: I have standalone java application that has to connect to LinkedIn Marketing Campains API and upload contact list. Where is the URL i have to configure in website and redirect URL of LinkedIn app creation process?


configuration file editor in Eclipse

Question: Greetings,
Anybody uses Eclipse to edit configuration files like httpd.conf and the likes, or even shell scripts? Which editors are there for that?
Thanks.
Pedro.
Answer: There's shelled, a shell editor plugin for Eclipse. Syntax highlighting is quite solid. It even provides mouse-hover docs for commands having a man page.
Answer: there is a cool editor for http.conf called ApacheConf. Other than that I think Notepad++ does the trick but only for syntax highlight.
Comment: I use TextWrangler myself on the Mac. But I was trying to find something to use inside Eclipse, and not only httpd.conf, but configuration files in general and shell scripts in particular. But thanks anyway.
Answer: Notepad++ is great for this kind of tasks.
Comment: I was really trying to find an Eclipse editor for shell scripts in particular and configuration files in general. But thanks nevertheless.

configuration file editor in Eclipse


Cannot install .NET 3.5 on SharePoint server and may need to remove/reinstall previous versions. Will I be okay?

Question: My environment is Win server 2003 acting as an app server for a farm.
I need to install .NET 3.5 so that various applications may run on the SharePoint sites. Unfortunately this is not proving to be possible and the only course of action I see resolving it is to remove/reinstall all of .NET.
My question is whether or not this will 'hurt' my SharePoint installation in any way. I need it to be a quick and painless process so that the server may come back up with minimal downtime.
For anyone that's curious there is no error message left by the installer GUI or EventViewer -- however there is this left by VSSWMSIFailInfo.txt:
DDSet_Error: CConfigEntry::RefreshConfigFile could not load _spConfigDoc path=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\WSF30.tmp isSuccessful=0 Error code: 0x1
DDSet_Error: CFxInstaller::SetupExtensions extensionElement.Initialize failed.  cswMachineConfigPath=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\WSF30.tmp. Error code: 0x80004005
DDSet_Error: CFxInstaller::SetupBaseComponents SetupExtensions failed. Error code: 0x80004005
DDSet_Error: Setup failed. Error code: 0x80004005

The only relevant information I could find on this is this post on msdn: http://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/7bc9797b-10ec-42c5-a21e-99c2b45b83ad/. Unfortunately the suggested resolution did not work for me. Hence I am left with going for the shotgun solution...
Answer: Here is the short answer: it will ruin your day.
Admittedly I removed .net using the removal tool and not through the control panel. SharePoint does not like to have .NET pulled out from under it.
Here is how I fixed it without reinstalling SharePoint or IIS:
(this takes place AFTER .NET has been removed and SharePoint is in agony)

downloaded/installed .NET 3.5 from microsoft which installs previous versions alongside
installed .NET updates from windows update (reboot)
installed more .NET updates/service packs from windows update (reboot)
fix machine.config (%WINDIR%\microsoft.net\Framework64\v2.0.50727\machine.config)
In my case there was invalid markup in the <processModel> node (invalid quotes). I would suggest having this backed up just so you can overwrite the entire file -- I used procmon to figure out what file was being read when psconfigui.exe barfed. This may or may not be a problem you encounter as it seems fairly random.
Run SharePoint configuration wizard
add ASP.NET_2.0.50727 ISAPI filter to "Web Sites" in IIS Manager
Add wildcard application map for EACH SHAREPOINT SITE in IIS (site properties, home directory, configuration) to have C:\WINDOWS\microsoft.net\Framework64\v2.0.50727\aspnet_isapi.dll and "uncheck verify that file exists"
Ensure that ASP.NET & Windows SharePoint services are Allowed in the Web Services Extension section in IIS Manager

After all these steps (and probably an iisreset) SharePoint should finally be working again! What a nightmare
Answer: SharePoint will pitch a fit, and things will go down hill from there.
BACKUP your site(s) before you touch anything else, and then look at the ability to re-install the .NET Frameworks since they're the backbone of SP.


Making Twitter 1.1 API requests on site with OAuth and Twitter modules

Question: I've setup a Twitter app and placed the appropriate Consumer Key and Consumer Secret strings in the settings of admin/config/services/twitter/settings.
I'm able to make twitter 1 api requests just fine, such as drupal_http_request('https://api.twitter.com/1/statuses/oembed.json?id=507185938620219395'); Using api.twitter.com/1.1, however, causes a 215 Bad Authentication error.
Obviously I'm not passing the necessary data to authenticate myself, but how do I go about doing that? All my google searching comes up with Drupal situations utilizing modules which do everything from the UI, or code examples which use php libraries such as Twitteroauth.
I should add that I am running a localserver test site and have setup my app's callback as both http://127.0.0.1:8000/twitter/oauth or the domain name I have setup in etc/hosts on my linux server. Neither seem to help, but both are accepted just fine in the twitter settings.
Lastly, I have been getting the following Notice on admin/config/services/twitter:

Notice: Trying to get property of non-object in user_access() (line
  808 of /var/www/twitcher/modules/user/user.module). (as well as lines
  820, 821, 827 and 830)

I only began seeing this 2 days ago, and have been unable to figure out exactly what is causing this (I've seen other threads about the same notice, usually relating to Administrative Views, but nothing on the Twitter module).
What is preventing authorization here?
Comment: Thanks for the edit!
Has anyone had similar issues before?
Comment: Using the tutorial at http://blog.jacobemerick.com/web-development/working-with-twitters-api-via-php-oauth/ , I wrote my own script which was able to make 1.1 requests which respond with recent posts from my own timeline (or that of a specific user). I can't, however, get it to authenticate when I make a request for a specific tweet (by ID or URL). I have tried using oembed.json and show.json, but in both cases I am receiving an " Error Code 32 Could not authenticate you " response.
Comment: While researching, it seems that the likely problem is my signature base string. It is proposed that the problems are likely:

a) The parameters of the base string are not in alphabetical order (mine are)

b) One or more of the parameters have been urlencoded twice (mine are only encoded once)

I am unable to theorize what else the problem might.
Comment: I have compared my base signature string with examples found on a few post threads, as well as the Twitter API Official docs, but it seems to be fine. I am, however, able to authenticate on the timeline requests, so I'm not sure what the issue is. Does anyone have any ideas?
Comment: It can be observed that using an Oauth library, such as twitteroauth, would solve these problems. Furthermore, using this approach isn't really solving the issue through "Drupal" means, such as harnessing the use of a preexisting module. That being said, is there some type of way in which I could take advantage of the Twitter and Oauth modules which would facilitate the programmatic implementation of Twitter API requests on a Drupal site?
Answer: Perhaps not a Drupal solution, but I thought I would update to say that I have settled on using Twitter-API-PHP found here https://github.com/J7mbo/twitter-api-php


Obter o título da página dentro de uma variável dinâmica em JavaScript

Question: Olá!
Há um formulário que precisei colocar o name como dinâmico. Originalmente, esse name era apenas registerformpopup. Agora coloquei como registerformpopup + o título da página que varia de acordo com a página em que o usuário preencheu o formulário.
Isso funcionou perfeitamente.
<form class="<?php if ( get_theme_mod( 'thim_auto_login', true ) ) {
    echo 'auto_login';
}
?>" name="<?php echo 'registerformpopup' . get_the_title() ?>"
    action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>"
    method="post" novalidate="novalidate">

<?php wp_nonce_field( 'ajax_register_nonce', 'register_security' ); ?>

O problema é que percebi que haviam várias funções em javascript que usavam o mesmo name para que fossem executadas.
O que eu pensei foi em também torná-lo dinâmico. Porém não estou conseguindo fazer as funções em JS funcionarem.
A função original em JS é a seguinte:
register_ajax: function() {
            $('#thim-popup-login form[name=registerformpopup]').on('submit', function(e) {
                e.preventDefault();

                if (!thim_eduma.validate_form($(this))) {
                    return false;
                }

Tentei de várias formas mas não consegui. Tentei colocar um código php dentro do JS mas não deu. Também tentei o seguinte:

    register_ajax: function() {
        $('#thim-popup-login form[name="registerformpopup' + document.title + '"]').on('submit', function(e) {
                e.preventDefault();

                if (!thim_eduma.validate_form($(this))) {
                    return false;
                }

Alguém pode me ajudar?
Comment: Tens um erro de sintaxe em `$('#thim-popup-login form['name=registerformpopup ' + document.title]')`... essa concatenação poderia ser `$('#thim-popup-login form[name="registerformpopup' + document.title + '"]')`
Comment: Oi Sérgio, tudo bem? De fato a concatenação estava errado. Obrigado! Mas ainda não funcionou. :(
Comment: Cara, vc não precisa pegar o name do form para usá-lo. Há mts formas de pegá-lo sem usar o name necessariamente.
Comment: Por exemplo: `$("form").on("submit", function(){ $(this) });`...o `$(this)` é o form que foi submetido, não importa o que tem nele.
Comment: No mesmo código php há o formulário de login e de cadastro. Acredito que seja esse o motivo de usar o name.
Answer: Você poderia utilizar o attributeStartsWith do jQuery.
Segue o exemplo do site:
<!doctype html>

  <meta charset="utf-8">
  <title>attributeStartsWith demo</title>

<input name="newsletter">
<input name="milkman">
<input name="newsboy">

O resultado deste HML é o 1° e o 3° input com o texto "news here!", pois somente eles começam com a palavra "news"
Comment: Incrivelmente deu certo, Murilo. Escrevi assim no código JS:

 `$('#thim-popup-login form[name^="registerformpopup"]')`

Agradeço muitíssimo por compartilhar seu conhecimento.
Comment: Que bom que deu certo! Fico feliz em poder lhe ajudar!


Angular 9 app white screen and empty console in Internet Explorer 11

Question: So the common issue with Angular apps and compatibility with IE. Just white screen with no errors in the console. I've seen a ton of similar posts but everywhere the same solution.
What I've already tried:

polyfills.ts

import 'classlist.js';  // Run `npm install --save classlist.js`.
import'core-js/es/symbol';
import'core-js/es/object';
import'core-js/es/function';
import'core-js/es/parse-int';
import'core-js/es/parse-float';
import'core-js/es/number';
import'core-js/es/math';
import'core-js/es/string';
import'core-js/es/date';
import'core-js/es/array';
import'core-js/es/regexp';
import'core-js/es/map';
import'core-js/es/weak-map';
import'core-js/es/set';
import 'web-animations-js';  // Run `npm install --save web-animations-js`.

tsconfig.json
 "target": "es5",

meta tag in index.html
<meta charset="utf-8" http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

browserslist
removed the not, now it's just IE 9-11 # For IE 9-11 support, remove 'not'.

And still I receive a white screen with no errors in the console. What else could I try?
Comment: I want to confirm with you whether you had added any functionality to this project or is it a freshly created project? If it is a freshly created project then you not need to add any polyfill in the polyfills.ts file. You just need to set `"target":"es5"` in `tsconfig.json` file. Then after if you run the project then it will work in the IE browser. Further, you can add polyfills as per your requirements. Let us know if you had added any functionality to the project. Try to provide detailed information about it may help to understand the issue in a better way. Thanks for your understanding.
Comment: have you tried `target:es2015` ? also have you changed `.browserlistrc`
Comment: Duplicate post? [Angular 9 app white screen in IE 11 and empty console](https://stackoverflow.com/questions/64858002/angular-9-app-white-screen-in-ie-11-and-empty-console)
Comment: @JSmith yes, updated the post, changed the browserslist also. What's the difference between es5 and es2015?
Comment: @R.Richards sorry, that was my post, got some issues with stackoverflow yesterday, deleted that question, thanks
Comment: @Deepak-MSFT There's a lot of functionality indeed. There a lot of different services in the application, not even sure where to begin. You think the services and functionality may influence the compatibility with IE?
Comment: Now I'm receiving these errors in console! `'URLSearchParams' is undefined polyfills-es5.js`
Answer: From your last comment now we know that you are getting 'URLSearchParams' is undefined polyfills-es5.js error.
It looks like your code contains URLSearchParams that is not supported by the IE browser. This can be the possible reason for the error.
Polyfill is available for URLSearchParams.
I suggest trying to use this polyfill in your project may help you to fix this error.
Comment: For `ReferenceError regeneratorRuntime is not defined` I suggest you try to add [regenerator-runtime](https://www.npmjs.com/package/regenerator-runtime) package in your project and import it. For `initHeaderAndFooter' is undefined` error I suggest try to click on the error, it will take you to the problematic line of code. You can share that code here may give an idea about the issue.
Comment: yep, did `npm install url-search-params-polyfill --save` and added `import 'url-search-params-polyfill';` to polyfills. Now the error is gone and it seems that it starts working properly. Just some errors are left. A function `'initHeaderAndFooter' is undefined' from custom.js script. Not sure why tho. And `ReferenceError regeneratorRuntime is not defined` in my error handler now, I think because of the IE fixes, polyfills etc, the error wasn't there before.
Comment: that didn't help. Now target is es5, chrome works, but IE is throwing `Syntax error: core.js (46516,21)` but from my understanding that could be anything. And as you probably know if I switch to target:es2015, IE would work normally but Chrome would have error
Comment: I guess there's something missing in polyfills as IE11 is not understanding the core.js script?
Comment: By just seeing the error message it is hard to say whether there is anything missing. I suggest trying to post the line of code where this error occurs. I also suggest you keep the `target: es5` and do not change it if you want to support the IE browser.
Comment: As the error states that there is `syntax error in core.js(46516,21)`. I found that he is not liking this line `projectedView.state |= 32 /* CheckProjectedView */;` in `node_modules/@angular/core/fesm2015/core.js`.
Comment: Yes, I've set target to es5 and I'll leave it as that.
Answer: Found a solution, the problem was with @ngx-translate library.
I was using "@ngx-translate/core": "^12.1.2", "@ngx-translate/http-loader": "^6.0.0"
I downgraded to 12.0.0 and 5.0.0 and it worked. Don't really know why the newer version is incompatible with IE11, but now my Angular apps works on both Chrome and IE11 without any errors.


Docker: Mount directory from one container to a specific path in another

Question: When we use "-v" argument in "docker run" command, we can specify {src path from host}:{path in container}, e.g
docker run -v /var/volumns/v1:/var/docker/v1ref ...

But, how about mounting a data-only container?
docker run --volumes-from data-only-container:<here is mode, ro or rw>

How I can achieve the same when using "-v"? Can I mount it to a specific folder?
Comment: See https://stackoverflow.com/q/48186109/201725. There are ways, if somewhat hacky, to do it.
Answer: I am afraid that the direct answer to your question is: no, you can't. volumes-from import the volumes exactly as they are defined in the other container.
Since docker 1.9 volume containers are being replaced with named volumes as the recommended practice. With named volumes you can mount it wherever you want :
docker volume create --name data
docker run -v data:/var/docker/v1ref ...

Regards
Comment: You can fill the container initially from a container, but you can't keep it synchronized, plus it takes up additional space. But there are some ways to do it, see https://stackoverflow.com/q/48186109/201725


Can an h2 tag be set to a certain percentage of its h1 relative?

Question: I hope this isn't a duplicate; I had a hard time phrasing this while searching for an answer.
I've left my h1 tags at their default size, and I plan to use h2 as a sort of subtitle proportionate to whatever h1 is set to.
I am trying to figure out a way to set h2 to be a percentage (say, 75%) of whatever h1 is set to, so that it would auto update if h1s size was ever redefined.
// an example
h1 {
  font-size:18px;
}

h2 {
  font-size:75% of h1 //obviously not correct
}

Comment: You could adjust the font size on the container and use EMs to create the relative sizing.
Comment: Only if they are nested in the html. Otherwise no.
Answer: Current pure CSS solutions will involve setting the common ancestor element's font-size to be the same as your H1 font size.  Then H1 would be 1em, H2 would be 0.5em (or whatever).  But that would be an inconvenient way to handle it if that ancestor element contains any text other than headlines.
The trivial way to handle it would be with a CSS pre-processor, such as Sass, Less, PostCSS.  Example in Sass:
$size: 18px;
h1 {
  font-size: $size;
}
h2 {
  font-size: $size/2;
}

A future pure CSS solution will be to use CSS variables, which are currently supported only in Firefox:
:root {
    --h1: 20px;
}

h1 {
    font-size: var(--h1);
}

h2 {
    font-size: calc(var(--h1) / 2);
}

Comment: Oh - interesting. I know we are using Stylus and Jeet; I'll give this a shot.(I'm quite new to CSS preprocessors)
Comment: Yup - works in Stylus using variables. Not sure why I hadn't thought of that; I guess I was thinking in pure CSS terms.
Answer: Well, you can set the font-size using em units to make them relative to their surroundings, then make each smaller <hX> tag 75% smaller than the previous.

h1 { font-size: 2em;     }
h2 { font-size: 1.5em;   }
h3 { font-size: 1.125em; }
h4 { font-size: 0.85em;  }

.sm { font-size: .5em; }
.lg { font-size: 2em;  }

h1

h2

h3

h4

h1

h2

h3

h4

h1

h2

h3

h4

Comment: Yes, this looks like it would work. The only thing is that it still involves manually keying in a value even if `h1` changes because they aren't really set "relative" to each other. So I might as well just have a `px` value or whatever I was going to use.
Comment: Yeah, it is limited to the extent that CSS itself is limited. Unfortunately, this is as close as you're going to get with pure backwards compatible CSS. And you do realize that using a CSS pre-processor still generates a bunch of fixed sizes in the compiled CSS right?
Comment: Yes. But the pre-processor eliminates the need for me to edit all of the fixed sizes in the compiled CSS, therefore allowing me the flexibility I desired.
Comment: Well, technically, you asked how to do this using CSS, not a CSS preprocessor. If you wanted to know how to do it with a CSS preprocessor then you should have asked as such. As per the current revision, this is the only answer that actually answers the question that was asked.
Comment: I know what you're saying. But the real answer I got from all of this was that pure CSS (at least in browser support terms) doesn't support doing what I wanted to do at this time. A pre-processor does. And I never explicitly stated that pre-processors couldn't be used. In fact, I never used the term "pure CSS" anywhere. I don't mean to be overly argumentative - I just wanted to point that out. I do think that yours was a very useful and well thought out answer.
Answer: Why don't you set both as percentages
h1 {
    font-size:100%;
}

h2 {
    font-size:75%;
}

That way because h1 is 100% then h2 will be 75% of 100%
https://jsfiddle.net/ta5xep3t/
Comment: What is `h1` 100% relative to? I need the regular body font-size to be less.
Comment: 100% is default font size, 200% is double the default font size, it is standard


Is cantor set homeomorphic to the unit interval?

Question: Can anyone help me with this question?

Is cantor set homeomorphic to the unit interval?

I (think that I) can see that there is an $f: C \rightarrow [0,1]_{inf}$ which is a surjective bijection (where $[0,1]_{inf}$ is the points in $[0,1]$ that has infinite binary representation) since we can view the cantor set as the set $\{0,2\}^\mathbb{N}$.
But, I cant see if this can be widened to a surjective onto map $f: C \rightarrow [0,1]$, and if there is, I can see why this function is continuous with a continuous inverse.
On the other hand, If the claim stated above is not true, I am not sure how to show that.
Thank you!
Shir
Comment: One of the two spaces is connected, the other isn't.
Comment: $C$ *is* however, homeomorphic to $[0,1]_{inf}$ (because $f$ is continuous, for example). And you *can* map $C$ onto $[0,1]$, but not injectively (the function is called devil's staircase or Cantor function).
Answer: Those sets aren't homeomorphic:
unit interval is connected, while cantor set isn't
Comment: In fact, Cantor is totally disconnected: its only connected subsets are singletons.


How to filter only first level menu links using views?

Question: I have created the menu with the below structure,

A

Link A1
List A2

Link A21
List A22

B

Link B1

Link B11
List B12

List B2

Now my requirement is to get only first level menu links i.e A and B only using views module.
Answer: I found the answer by adding Filter criteria as given below in views. Please improve this answer if I am not correct.
<code>Parent plugin ID (not_begins menu)
</code>


Underlying Set in Model Theory

Question: In model theory a structure has an underlying set.
In addition to the interpreted relations, are there
(implicit) assumptions made about possible
operations on this set? For example, is it assumed to have
unions, satisfy some of the axioms of ZF, ZFC?
Thanks,
John
Comment: This question is better suited to math.stackexchange.  Briefly a model has an underlying set and certain derived sets corresponding to interpretations of the function and relation symbols.  A web search can likely provide a good answer to this question.
Comment: For most purposes, the set-theoretic background is not formal set theory, but the informal set-theoretic background used in any other branch of mathematics.
Answer: As with other branches of mathematics, for basic (naive) model theory, all we need is naive set theory, and the notion of a set is just as naive.
And as with other branches of mathematics, at some point, we do need some formal set theory, so we assume that the sets we are talking about live in the mathematical universe, governed by ZFC. In fact, many model theorists find it convenient to assume, beyond ZFC, that there is a proper class of strongly inaccessible cardinals, though this assumption is usually just a simplification (namely simplifying the notion of a monster model).
The only internal assumption about universes of models in model theory (besides those forced by being a set in the Von Neumann universe) is, as far as I can tell, that they are non-empty. One can do model theory with empty structures, but that forces one to make a number of unpleasant exceptions, while empty structures are clearly beside the point, so it is usually avoided.
Comment: Can you give any instance where model theory needs to assume that the elements of the universe of a model are metatheoretical sets?
Comment: @RobArthan: How we model *elements* is irrelevant in model theory (more or less like in other branches of mathematics, including, to a certain point, set theory). What *does* matter is how we model *models*.
Comment: quite! So you don't need to assume the ontological straitjacket of ZFC (in which everything is a set): model theory would work just as well in a set theory with Ur-eleements or in some kind of type theory ... (as I said in my answer).
Answer: No assumptions are made about the elements of the underlying set of a structure in model theory. In fact, the definition of a model doesn't require those elements to be sets (and would work if one's metalanguage has ur-elements or is some kind of type theory where not everything is a set).

Underlying Set in Model Theory


Why add one to the number of observations when calculating percentiles?

Question: The CFA Quantitative Methods book uses the following formula for finding the observation in a sorted list that corresponds to a given percentile $y$ in a set of observations of size $n$:
$(n + 1)\frac{y}{100}$
It defines percentile as follows: "Given a set of observations, the yth percentile is the value at or below which y percent of observations lie."
My question is, where does the $+ 1$ come from? I can see that if you wanted to ensure that all values are below a given percentile, it is useful. It also ensures the correct value for the median. But given the definition of percentile above, I would think it should be possible to have a hundredth percentile, which would be equal to the largest value. Is the "at or below" in conflict with the $+ 1$?
Comment: What is the formula supposed to give you? The number of observations in the $y$th percentile?
Comment: It gives the rank of the observation that corresponds to the $y$th percentile.
Answer: In our sorted list, the indices follow a discrete uniform distribution. As you mentioned, the median is satisfied if we calculate our percentile with $(n + 1)$.
The median (50th percentile) of a discrete uniform distribution is:
$\frac{a \ + \ b}{2}$(a proof of the derivation can easily be found online).
Where $a,b$ denote our support. Here $a = 1$ and $b = n$.
Now, this leads us to: $0.5p = \frac{n \ + \ 1}{2} \Rightarrow p = n + 1 \Rightarrow xp = x \cdot (n + 1)$
where $x \in [0, 1]$.
Answer: You answered your own question:
"I can see that if I use the first formula to calculate the 50th percentile, the +1 ensures I get the same answer as when I calculate the median."
That's a really important property for percentiles!  One you should want.
Also, if you are fitting empirical data to some parametric curve, adding +1 allows for a "tail".  Many curves you would fit to have infinite support, so if you did not add +1, you would be saying your last data point is at the 100%-tile, which is usually a bad assumption.
Answer: These $+1$ terms show up a lot in counting problems because subtraction isn't quite the opposite of counting. But it is hard to see this symbolically, best to use an example.
Suppose you have $99$ people who took a test. Who is in the $99^\text{th}$ percentile? Well, precisely nobody comes above the best score, and only the best comes above the second-best. But one person is a bit over $1$%, so everyone but the first person is in the bottom $98.99$%, so you want the $99^\text{th}$ percentile to be at the last person. This is what the formula gives.
But $\frac{ny}{100}$ would also get this result, so what gives?
Well, who is in the $100^\text{th}$ percentile? Nobody, by definition. Every single person should be below this mark, which means it cannot begin at any person. This is what the $+1$ formula gives, because $\frac{(n+1)(100)}{100}>n$. if you don't have the $+1$, then you get $\frac{n(100)}{100}=n$, which would mean the best scorer did better than all the people. That would be okay for "all the other people", but E can't have done better than emself!
Comment: *"Well, who is in the 100th percentile? Nobody, by definition."* No, not if your data have finite support.  You well *could* have empirical data in the 100th percentile.  It's when you have infinite support that this assumption is important.
Comment: Is it true that nobody is in the 100th percentile by definition? The CFA book defines percentile as follows: "Given a set of observations, the yth percentile is the value *at* or below which y percent of observations lie." I would think that according to this definition (i.e., given the "at"), if there is a unique highest observation, that would be the 100th percentile.
Comment: @dumbquestion: Well, under that definition, no, it's not, but that definition appears to be inconsistent with this formula. This becomes more apparent with 100 people with even score distribution, since it would claim the $50^\text{th}$ percentile would begin with person 50, but the formula would say it begins with person 51. So if you want to keep the interpretation of the median as the $50^\text{th}$ percentile (which you do, in fact) then I cannot justify using "at or".
Comment: @trb456: Perhaps we are using different definitions (I admit to being ignorant of conventions in statistics). I am using "The kth percentile is the subset of the data which excludes the lowest k%". Hm, but this also does not calculate medians correctly. What definition is correct?
Comment: @Eric Yes, that's the thought process I went through myself. Are these inconsistent, then?
Comment: @dumbquestion: I'll defer that to trb since I seem to have a misunderstanding about the definitions.


How to bind multiple forms validation to Jquery Validator

Question: I have multiple forms in my page which has same values.
Instead of writing multiple rules and messages, I have written a common method where rules and messages can be pass as a parameter.
But this works only if a page has different form values. And if a page has multiple forms with similar values then am unable to bind it, because I don't want to write multiple rules and messages. Because both the forms has to display the same error messages, if the validation fails.
So in the below code, both the rules and messages are same, how do I can use one set of rules and messages to display for both the forms accordingly.
This is what I tried.
HTML:
<form id="form1">
  First Name
  <input id="firstName1" name="firstName1" required/>
  Last Name
  <input id="lastName1" name="lastName1" required/>
</form>

<form id="form2">
  First Name
  <input id="firstName2" name="firstName2" required/>
  Last Name
  <input id="lastName2" name="lastName2" required/>
</form>

JS:
Validation Common Method:
window.validation = {
   validateForm : function(that, fId, rules, messages, handlerFnc){
    var _self = this, _this = that;
    return {
      rules : rules,
      messages : messages,
      submitHandler: function(fId, evt) {
        var serForm = $(fId).serialize();
        (handlerFnc) ? handlerFnc(fId, _this, evt) : null;
      }
    }
  }
}

Calling this method in my View:
    var rules = {}; var messages = {};
          rules.firstName1 =  {
            required: "FN Req Field"
          };
          messages.lastName1 = {
            required: "LN required field"
          };
          rules.firstName2 =  {
            required: "FN Req Field"
          };
          messages.lastName2 = {
            required: "LN required field"
          };
          $('#form1').validate(validation.validateForm(_self, "form1", rules, messages, _self.handlerFn2));
          $('#form2').validate(validation.validateForm(_self, "form2", rules, messages, _self.handlerFn2));

Comment: What's wrong with what you have?
Comment: @Barmar: I want to centralised the rules and messages, as both the forms has same values. Is there a way to keep the one set of rules and messages for both the forms. Instead of repeating them.
Comment: Isn't that what you've done with your `rules` and `messages` variables? Where is the repetition?
Answer: Ideally you would be able to use $("#form1, #form2").validate(...), but the jquery-validate implementation only operates on the first element it's called on. So you can use .each()
$("#form1, #form2").each(function() {
    $(this).validate(validation.validateForm(_self, "form1", rules, messages, _self.handlerFn2));
});


What does $R(G:X)$ mean in Rao's book?

Question: I was reading Rao's chapter 4 of his Linear Statistical Inference, 2nd ed. He uses the notation $R(G:X)$ in section 4.i (p. 294, formula (e), p. 296 formula (4i.1.21)) and that notation appears again in the last paragraph of p. 300. Unfortunately, Rao does not define the notation and I could not quite point out the meaning from the context. Does anyone know what it means?
Another book uses something similar $S(X:V)$ and they also do not define the notation, and again I am not quite sure what it means. (To be more explicit, they define $S$ to mean the image space or column space, and my best guess is that $X:V$ simply means the concatenation $[X, V]$ of the two matrices. Both expressions $X:V$ and $G:X$ appear in the context of the General Gauss Markov Model.)
I know this is a long shot, but if you know, I'd appreaciate if you let me know.
Regards,
W
Comment: R(X) is the rank of matrix X and G : X is as in the question.  Rao uses a script M to mean the range space (M = manifold), not R.
Comment: @G.Grothendieck Yes, Rao uses $M$ for column space. $S$ is used by Takeuchi, Yanai and Mukherjee. So you are saying that $G:X$ simply means the matrix with columns of $G$ and then of $X,$ what I called the concatenation?
Answer: Rao has a knack of resorting to two notations while explaining stuffs involving rank throughout the very same treatise: $\operatorname{rank}(\cdot); ~R(\cdot):$ see sec. $\rm 1b.6, ~1b.7$ and as  G. Grothendieck correctly noted, Rao uses $\mathscr M(\cdot)$ to denote the range space.
$\mathbf{G}:\mathbf{X}$ is a partitioned matrix. It is evident from the derivation he is doing: observe $(\rm 4i.1.21)$
$$R\begin{pmatrix}\mathbf G & \mathbf X\\ \mathbf X' & \mathbf 0\end{pmatrix} = R(\mathbf{G}:\mathbf{X}) + R(\mathbf X);$$ it is easy to show using elementary row transformations.
Comment: Rao is not my first choice; it's for reference only. Sometimes, it takes time to comprehend but overall a good content provided you already are well-versed with what you are supposed to read.
Comment: I am still not clear if $G:X$ means $[G,X]$ or $\begin{pmatrix} G &X \\ X^\intercal &0\end{pmatrix}.$
Comment: $\mathbf{G}:\mathbf{X}$ means $[\mathbf{G},\mathbf{X}].$
Comment: Okay, thanks. That was my guess all along, however, Rao uses $[G \mid X]$ to denote $[G, X]$ almost everywhere else in the book and $G:X$ only appears in the three spots I mentioned in the question without defining it ever.
Comment: His writing is pretty enjoyable but thanks to these sort of notation changes, it can be itchy a bit.
Comment: I actually find his writing archaic, hard to follow and overall I just go to his books when other authors are not as rigorous. It is true that Rao has everything and well proven, but since I only ever read him for specific topics, his personal, unique and strange notation makes it even harder.

What does $R(G:X)$ mean in Rao's book?


Multiple svnserve instances on network share

Question: we have SVN configured using a custom tunnel. Every time I commit, svnserve is started on a remote Linux machine. Thus it is possible to have several svnserves running simultaneously accessing the same repository on a network. I have found this question, but it seems somewhat different. I know that accessing the repository via file:// is dangerous. How about our setup?
Thanks for any hint!
Answer: This is pretty much how the svn+ssh protocol works, it's fine.


R as a backend processing engine

Question: I have an R script that process a CSV file and spit out result as CSV. This work fine in desktop environment.
Now I would like to implement some think like this:

set up an email where user could send CSV file as attachment
On a server, have an program to check email automatically and pass the CSV file to a specific folder (I don't know exactly how to do this, but I have people in the team to do this)
Every time when there are new CSV file come into the folder, get R to pick up this CSV file and run the script. The result is a new CSV file.
Deliver the result back to the user by sending an email.

I'm kind of stuck on number 3. Did anyone setup R (or R server) to run in this fashion. Any suggestion is much appreciated.
Comment: This question is more adequate for a place like StackOverflow.com If you are running a Linux server, this is ridiculously easy to do with a Bash script using 3, maybe 4 lines of code. See `?mutt`, `?sleep`, `?mv`, and use `R CMD BATCH` to execute workhorse functions.
Comment: This question appears to be off-topic because it is not about statistics.
Comment: This question is only about how to get R to do something, & not about any related statistical issues. Thus it is off-topic for CV (see our [help center](http://stats.stackexchange.com/help/on-topic)). Moreover, it isn't really a programming question in [Stack Overflow's](http://stackoverflow.com/) sense, as it isn't a problem w/ specific code you are using & doesn't have a [reproducible example](http://stackoverflow.com/q/5963269/1217536), so it would be off-topic on SO as well. You could try asking on the r-help-listserv.
Answer: What kind of operating system are you running?  You can run R in non interactive mode with: R --slave.  You could set this up on crontab (as a bash script or some other language that could call R) to run on a particular folder every X minutes,hours, days, etc.  You could send an email with sendmail in bash.

R as a backend processing engine


Evitar que uma action seja interceptada pelo Interceptor Handle

Question: Implementei uma classe para interceptar algumas urls e verificar se tenho um usuario logado na sessão, se sim acesso a url, caso contrário sou automaticamente "jogado" para a tela de login.
Acontece que na pagina de um login eu tenho um link para cadastrar um usuário no meu sistema, só que como não tenho um usuário na sessão pois sou um usuário que ainda vou me cadastrar, gostaria de saber como liberar minha action adicionaUsuario do interceptor e deixar com que eu efetue o cadastro do usuário. Hoje ao cadastrar um usuário sou levado novamente para a tela de login.
Debugando, quando clico no botão que chama a action adicionaUsuario ele nem chega até o método, ele retorna true no interceptor e já me leva para a página de login.
Segue abaixo o meu método preHandle do meu interceptor e o meu método para adicionar usuário que vem do controller:
public class AutorizadorInterceptor extends HandlerInterceptorAdapter {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object controller) throws Exception {

        String uri = request.getRequestURI();
        if( uri.endsWith("loginForm") || uri.endsWith("efetuaLogin") || uri.contains("resources") || uri.endsWith("mainUsuario") || uri.endsWith("adicionaUsuario") ) {
            return true;
        }

        if(request.getSession().getAttribute("usuarioLogado") != null) {
            return true;
        }
        response.sendRedirect("loginForm");
        return false;
    }
}

Controller:
@RequestMapping(value = "adicionaUsuario")
    public String adicionaUsuario(Usuario usuario) {

        usuarioService.adicionaUsuario(usuario);

        return  "usuarioSuccess";
    }

Comment: mas se você retorna "true" não está dizendo que DEVE interceptar o evento?
Comment: Algum motivo para não usar o Spring Security?
Comment: Que tal no método `adicionaUsuario` colocar o usuário na sessão?
Answer: Pelo que entendi o adicionaUsuario já recebe o objeto preenchido do form com os dados do novo usuário. Até ai está ok!
seu erro está na sintaxe, aparentemente a confirmação da tela está correta, vc está dando um true na página aberta. Porém vc está direcionando o usuário para a página usuariosuccess que não tem permissão de acesso. Tente permitir o acesso dele para esse direcionamento e se o erro persistir veja se o método adicionaUsuario é acessível por todos.
Answer: olha, acho que seu problema está exatamente na forma como escreveu o método preHandle()
repare ao debugar que caso a primeira condição seja satisfeita você já encerra o método dando return true;
ou seja não será executado as linhas de código abaixo pois o método já retornou a resposta na primeira condição IF...
Answer: Ao inves de utilizar request.getRequestURI()use request.getServletPath()


Cannot see tables from my database in Android emulator

Question: I did some research about showing the tables from my application database. all tutorials stated that this command "slite> .tables" will show them, but the response I always get is ".tables". I am using Android 2.2 virtual device. I can see my database: # sqlite3 data/data/my_package/databases/X.db. After this command I get:

SQLite version 3.6.22
  Enter ".help" for instructions
  Enter SQL statements terminated with a ";"
  sqlite> .tables

The response is  ".tables", instead of tables from the database. I know I am creating those tables,because in the application I can see that information.
I must be doing something wrong, just don't see what. Did someone got this error too and found a reasonable explanation?
Comment: I would think you would need to run some SQL to describe the tables from the database
Comment: Simply using '.tables' works for me...
Answer: This should be an equivalent statement:
<code>SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;
</code>
Comment: hmm. this is weird. if i run the command above i get this response: "SELECT: not found", if i run the command like this "# sqlite3 select name from sqlite_master where type='table' order by name;" i get this result "sqlite3 select name from sqlite_master where type='table' order by name;
sqlite3: Error: too many options: "from"
Use -help for a list of options."
Comment: After you call `sqlite3 data/data/my_package/databases/X.db` from a command prompt,  try `CREATE TABLE tmp (temp text);` at the sqlite prompt.  Does it return you to the sqlite prompt without error, or does it tell you that it can't open the database?  If the latter, the path to your database is wrong.  If the former, try the first select statement I gave you from the sqlite prompt; does tmp show up?
Comment: i run the create table tmp command and i got "create: not found". wondering why the path to the db is not correct. if i want to see all the packages, # ls data/data/ i can see my project there, and # ls data/data/package../databases i get the name of the database. and right after that command i am trying the creation of tmp table or the select sql from above.
Comment: What sort of computer are you on?
Comment: windows vista premium. it's like i have to activate something to make the command prompt interpret my sql commands. can't understand why i get no reaction from it besides the above of course.
Comment: Are you sure you're typing the sql commands at the sqlite command prompt and not at the windows command prompt?  If you're using Eclipse, trying using DDMS to grab a copy of your database out from the emulator and put it in the same directory as your sqlite3.exe and try it without the path reference.  Otherwise, I've got no clue, sorry; it works for me on both XP and Windows7.
Comment: finally it worked. i had to adb pull data/data.... and it creates me a new file .db in the android sdk folder and that i can open with sqlbrowser. thank you.


What is the limit to the number of parameters you can have in Firebase Remote Configs for one project

Question: Just started using the Firebase Remote Configs and could not find in the docs where it states the limit to the number of config parameters for one project. Anyone on the team know ?
Answer: The docs have been updated to include the limits.

Within a Firebase project, you can have up to 2000 parameters, and up to 500 conditions. Parameter keys can be up to 256 characters long, must start with an underscore or English letter character (A-Z, a-z), and may also include numbers. The total length of parameter value strings within a project cannot exceed 800,000 characters.


Complex for loop with an empty body

Question: I have taken a JavaScript function that shuffles array elements with the help of a for loop that accepts arguments but doesn't have a body (empty body).
After the for loop evaluates the array elements are shuffled. This is the codepen.
Here is the function's code:
function shuffle( array ) { // Shuffle an array
    //
    // +   original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)

    for(var j, x, i = array.length;
            i;
            j = parseInt(Math.random() * i),
            x = array[--i], array[i] = array[j], array[j] = x){

    }
    return array;
}
console.log(shuffle(['Kevin', 'van', 'Zonneveld']));

If the loop doesn't have a body, can I initialize all the elements outside of the for loop? Like below:
var j, x, i = array.length;
var j = parseInt(Math.random() * i), x = array[--i], array[i] = array[j];
array[j] = x;

Comment: The loop doesn't have any statements in its body, but it *does* still need to be a loop because it does still run for a number of iterations. Put some console.log() statements inside the loop to log all the variables and you'll see what is happening.
Answer: You may initialize your variables before the for loop, but not in the way you specified.
The syntax of a for loop is:
for ([initialization]; [condition]; [final-expression])
   statement // for you this is empty - no statement

The initialization step as you can see is the first one, before the first semicolon (;). So a correct initialization would be:
var j, x, i = array.length;

But not:
var j = parseInt(Math.random() * i), x = array[--i], array[i] = array[j];
array[j] = x;

As these are the condition and final expression steps. Note that your loop will end when the condition !i is met.
There is no reason to perform this tough. And if you do, make sure you only omit the initialization part of the for loop and not any of the others.
An easier way to view this loop is:
for (
     // initialisation: declare three variables
     var j, x, i = array.length;
     // The loop check: when it gets to `!i`, it will exit the loop
     i;
     // the increment clause, made of several "sub-statements"
     j = parseInt(Math.random() * i),
     x = array[--i],
     array[i] = array[j],
     array[j] = x
)
    { } // The body of the loop is an empty statement

For the sake of completeness, you may also find it more understandable to view an equivalent while loop to this for loop (notice how the initialization is before the loop here):
var j, x, i = array.length;
while (i) {
     j = parseInt(Math.random() * i);
     x = array[--i];
     array[i] = array[j];
     array[j] = x;
}

Comment: why here is used for loop? loop is intended for to implement code from one till another point. here for loop is implemented one time in each function call
Comment: No, it is run multiple times depending on the condition and final expression. You can try to run it and see for yourself... it will run until the `condition` part is not met.
Comment: I did console.log and i saw three times it loops and in every loop i is decremented. if nowhere we declared that condition let i decrement, why i is decremented, second is we take one of three result why needed loop? simply math.random does it? isn't it?
Comment: You can see that `i` is decremented inside the command `x = array[--i];` . The `--i` decrements `i` (even if it is not in a stand-alone statement). And we don't just "take one of three results".. The loop runs for however many times that it needs to (it can run more or less times, you can check this with different arrays)
Comment: Does i depends on array[--i]? if i dont increment i or decrement i and if i decremented inside array index does it affects i?
Comment: If it didn't have the `array[--i]` then the loop will never end. You can certainly decrement it not in the array index. There is no problem in writing: `--i` and then `array[i]`. That will be equivalent

Complex for loop with an empty body


Crystal Reports linking multiple datatables from same dataset

Question: My ASP C# application has one Crystal report with a main report and one subreport that is within the main report itself. My main report lists students and the subreport is expected to list the mark list for students those are listed.
I am populating the datatable for the main report while a button is clicked, that works fine. However, do not know how to link main and sub reports. I have defined one parameter that links both the datasets, however I don't have any idea how to populate the 2nd datatable when the button is clicked.
Would appreciate some samples, which I couldn't find after searching hours (mostly because I don't know the correct terms to search with)
Answer: By combining these threads, I've devised a solution

https://www.c-sharpcorner.com/article/generate-Asp-Net-crystal-report-using-dataset/
How to set datasource of Sub crystal report in c# win form app

All I needed was to populate the datatables within the dataset & to link the subreport(s) on common columns. Sample code provided below.
<code>using CrystalDecisions.CrystalReports.Engine;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace insert_demo
{
    public partial class MarkList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //DataTable dt = new DataTable();

            SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|insert_demo.mdf;Integrated Security=True");

            SqlDataAdapter da = new SqlDataAdapter(@"SELECT * from tbl_data", con);
            Students ds = new Students();
            da.Fill(ds, "StudentTable");

            SqlDataAdapter da1 = new SqlDataAdapter(@"SELECT * from STUDENT_SCORES", con);
            Students ds1 = new Students();
            da1.Fill(ds1, "MarksTable");

            ReportDocument oRpt = new ReportDocument();
            oRpt.Load(Server.MapPath(@"~/CrystalReport4.rpt"));
            oRpt.SetDataSource(ds);

            oRpt.Subreports[0].DataSourceConnections.Clear();
            oRpt.Subreports[0].SetDataSource(ds1);

            CrystalReportViewer1.Visible = true;
            CrystalReportViewer1.ReportSource = oRpt;

        }
    }
}
</code>


Representation of 3-queens problem as boolean expression for SAT solver

Question: The nxn queens problem is if the is a solution where n queens can exists on a nxn board with the rules of chess, 1 per row,col,diagonal. I am trying to represent the nxn queens problem where n=3 in propositional form. so we define 9 Boolean variables, let a,b,c, represent the entries on row 1, d,e,f the entries on row 2, and g,h,i represent the entires on row 3. So given the rules we have the following propositional formula:
Exactly one queen on top row :  (a∨b∨c) ∧ ~( a∧b∧c)
Exactly one queen on middle row : (d∨e∨f) ∧ ~( d∧e∧f)
Exactly one queen on bottom row: (g∨h∨i) ∧ ~( g∧h∧i)
Exactly one queen on left column :  (a∨d∨g) ∧ ~( a∧d∧g)
Exactly one queen one queen on middle column : (b∨d∨h) ∧ ~( b∧d∧h)
Exactly one queen on right column: (c∨e∨i) ∧ ~( c∧e∧i)
No two queens on the same diagonal:  ~(a∨e∨i) ∧ ~( c∧e∧d)
However, this returns satisfiable on the sat solver, yet we know that the nxn queens problem is only solvable for n>3, so my representation must be false.
Comment: You meant (a∨b∨c) ∧ ~( a∧b) ∧ ~( a∧c) ∧ ~( b∧c). For the $n$-queens you might want to implement $n \mapsto n+a_i$ in SAT, so you can define the rule $\sum_i a_i = 1$
Comment: yeah that makes sense, thanks!
Answer:
Exactly one queen on top row :  (a∨b∨c) ∧ ~( a∧b∧c)

This is wrong, as it still allows two queens in the same row
So do:
$$(a \lor b \lor c) \land \neg (a \land b) \land \neg (a \land c) \land \neg (b \land c)$$
... same for the others ...


Website not load fully in webview Android Studio

Question: I am trying to show the website with url but when its loaded, Some Website load fully and some of websites not load properly as load in chrome or any external browser. I am stuck here and didn't understand how to solve it.
<code>public class UresultDetailFragment extends Fragment {
    private WebView webView;

    public UresultDetailFragment() {
        // Required empty public constructor
    }

    @SuppressLint("SetJavaScriptEnabled")
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view= inflater.inflate(R.layout.fragment_uresult_detail, container, false);
        String url= getArguments().getString("url");
        webView=(WebView) view.findViewById(R.id.UniversityDetailWebview);

        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setLoadWithOverviewMode(true);
        webView.getSettings().setUseWideViewPort(true);

        webView.getSettings().setSupportZoom(true);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setDisplayZoomControls(false);

        webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
        webView.setScrollbarFadingEnabled(false);
        webView.setWebViewClient(new WebViewClient());
        webView.loadUrl(url);

        return view;
    }
}
</code>
Comment: Try adding User-agent header to your requests
Answer: Attach a WebViewClient with the web view and implement on received error event and see if there is any error occurred during loading.
https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedError(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20android.webkit.WebResourceError)


2020 Moderator Election - Announcement

Question: Expatriates will begin the nomination stage for a special election on July 6th to bring in one more moderator.
For full details of the process, see the announcement on Meta Stack Exchange. The timeline:

Starting on July 6th, users can nominate themselves. Users can also ask questions on meta for potential moderators to answer. (Use the discussion and election tags.)

On July 13th, if there are two or more candidates, we'll run an election. If not, I'll simply appoint the candidate. (There's a small chance we'll need to remove a nomination).

If there is an election, I'll announce the results on meta on July 21st.

(Note for current moderators: there's no need to nominate yourself even though you'll likely get an email saying you should. The system assumes the first election is a graduation election, which would mean moderators would need to be re-elected. This isn't that sort of election.)
If you have any questions about the process, please stick them in an answer here.
Comment: Would you please link the [questionnaire](https://expatriates.meta.stackexchange.com/questions/415/2020-community-moderator-election-questionnaire?cb=1) on the [main election page](https://expatriates.stackexchange.com/election?cb=1)? There have been some vote-swaying answers there and I think any voters should have the opportunity to see that.
Comment: @ouflak it is linked as a hyperlink for "The Candidates answer your questions", which is by default how we usually do it.
Comment: Yes! @Catija linked it for us. Thanks!
Answer: Are moderators required to sign up to agreements that muffle their voice about criticism of StackExchange corporate policies? I'm notoriously politically incorrect. And I've openly spoken out against certain corporate objectives. It's not hard for me to imagine getting run off the site for expressing opinions that, as a normal user, perhaps wouldn't cause quite the same reaction from the company. I've demonstrated a willingness and eagerness to take on extra roles for moderating and maintaining the site, and I'm quite happy to keep that up or take on those extra responsibilities should they become available to me.
I know for myself that I would be just fine handling the extra duties and dedicating some of the already significant the time I spend on here to those tasks. But some of the company structure has clearly changed recently, and there have been certain pronouncements and actions by the company which I consider wildly off-topic, borderline offensively inappropriate, and perhaps even dangerously counterproductive. I've been active on StackExchange across a variety of sites for almost a decade and not once has my my race/ethnicity, gender/orientation, religion or immigration status (even here on Expats) played a role in my moderation efforts. As a moderator, I'd fully expect that to continue to be the case. If I'm not allowed to express those kind of opinions on here, I just question if I'm a good fit for the role of a moderator as seen from the company perspective.
Comment: You might want to read the current https://stackoverflow.com/legal/moderator-agreement although it's true that the part about "other moderator policies made available to me" is not too well defined at the moment. This would be a good question over the main meta though
Comment: @SztupY, I actually [asked a question about this a few days ago on the StackOverflow Meta election announcement](https://meta.stackoverflow.com/questions/398884/2020-moderator-election-qa-question-collection/398972#398972). There [were one](https://meta.stackoverflow.com/questions/398884/2020-moderator-election-qa-question-collection/398921#398921) or two other [similar questions](https://meta.stackoverflow.com/questions/398884/2020-moderator-election-qa-question-collection/399045#399045) asked as well.

2020 Moderator Election - Announcement


Meaning of word "lift" in the context of quotient vector spaces

Question: I'm trying to understand a point made in a lecture video by Benedict Gross. The context, paraphrased, is as follows.
We have a finite-dimensional vector space $V$ and a subspace $W$ of $V$. We define the canonical quotient map $f: V \to V/W$. Let $\{w_1, \ldots, w_n\}$ be a basis for $W$. As the $w_i$ are linearly independent in $W$ and hence in $V$, we can extend them to a basis $\{w_1, \ldots, w_n, v_{n+1}, v_{n+2}, \ldots, v_m$. Now let $W' = \text{span}(v_{n+1}, v_{n+2}, \ldots, v_m)$.
Gross then says: "Because of the existence of bases, you can find a subspace which in some sense lifts this." I believe by "this" he was referring to $V/W$.
I'm having a lot of trouble understanding this comment. My understanding of lifts, based on the Wikipedia article, is as follows. Let $f: X \to Y$ and $g: Z \to Y$ be maps. It seems to define a "lift" in the context of the function $f$, rather than a set or a subspace, as a lift of $f$ to another set, say $Z$ (so the two necessary components of a lift are the function and the set it's being lifted to). The "lift" is then a map $h: X \to Z$ with $f = g \circ h$.
I'm having difficulty reconciling this with Gross's comment. I can't seem to "compose" maps per se, but thinking of this in terms of a diagram, I could define the inclusion map from $W'$ to $V$ in addition to the isomorphism from $W'$ to $V/W$, but this doesn't seem in any way "commutative."
Answer: Let me try and provide some intuition. Quotients appear all throughout mathematics, not just for vector spaces. Given an object $X$ (in your case a finite dimensional vector space), and a subobject $Y$ of $X$ (in your case a vector subspace), we can define a quotient $X/Y$ and a quotient map $\pi: X \to X/Y$ (in your case, a linear map). Then, informally, if we have a "thing" defined on $X/Y$, we can often "lift" it to a "thing" defined on $X$. The canonical example is that if we have a map $f: X/Y \to Z$ (in your case a linear map), we can lift it to a map $f\circ\pi: X\to Z$ by precomposing by $\pi$.
Here it seems Gross uses the word "lift" not for the lifting of a map, but for lifting the vector space $V/W$ itself. Here's how you can do so: choose a basis $\{w_1,\dots,w_n\}$ for $W$. Extend it to a basis $\{w_1,\dots,w_n,v_{n+1},\dots,v_m\}$ for $V$. Then $\{v_{n+1}+W,\dots,v_m+W\}$ is a basis for $V/W$. So we can "lift" $V/W$ to $V$ with the linear map $\iota: V/W\to V$ defined on basis vectors by
$$\iota(v_i+W) =v_i.$$
So this allows to view $V/W$ as $\iota(V/W)$, a subspace of $V$
(Note that $\iota$, unlike $\pi$, is not canonical! It depends on the choice of basis extension $\{v_{n+1},\dots,v_m\}$. The subspace $\iota(V/W)$ is not canonical either!).
Keep in mind the term "lift" is informal, and can mean different things depending on the "thing" we are lifting.


Kibana extract number

Question: I need to extract a number from a message in kibana and found all value that are greater than 1, is there a way to get that number not in yellow?, my logs are these:

thanks a lot
Answer: Solved by using regex:
message: "Time for external call to Firebase:" AND /[1-9].[0-9]{1,3}/

Kibana extract number


How to Create MySQL Query to Find Related Posts from Multiple Tables?

Question: This is a complicated situation (for me) that I'm hopeful someone on here can help me with.  I've done plenty of searching for a solution and have not been able to locate one.  This is essentially my situation...  (I've trimmed it down because if someone can help me to create this query I can take it from there.)
TABLE articles (article_id, article_title)
TABLE articles_tags (row_id, article_id, tag_id)
TABLE article_categories (row_id, article_id, category_id)
All of the tables have article_id in common.  I know what all of the tag_id and category_id rows are.  What I want to do is return a list of all the articles that article_tags and article_categories MAY have in common, ordered by the number of common entries.
For example:
article1 - tags: tag1, tag2, tag3 - categories: cat1, cat2
article2 - tags: tag2 - categories: cat1, cat2
article3 - tags: tag1, tag3 - categories: cat1
So if my article had "tag1" and "cat1 and cat2" it should return the articles in this order:
article1 (tag1, cat1 and cat2 in common)
article3 (tag1, cat1 in common)
article2 (cat1 in common)
Any help would genuinely be appreciated!  Thank you!
Comment: This is a fun one, and a challenge. . .
Answer: If you would just have the tag table (not the category table) this is a more optimized start:

SELECT article_id,count(*) AS q
FROM article_tags
WHERE id_tag IN (
    SELECT id_tag
    FROM article_tags
    WHERE article_id=41
)
AND article_id!=41
GROUP BY article_id
ORDER BY q DESC
Comment: this way is comming with slow.
Answer: Okay, here's my first draft:
<code> SELECT article_id, count(*) as common_term_count FROM
      (
      SELECT article_id FROM tags WHERE tag IN
         (SELECT tag FROM tags WHERE article_id = :YourArticle)
      UNION ALL
      SELECT article_id FROM categories WHERE category IN
         (SELECT category FROM categories WHERE article_id = :YourArticle)
       ) AS accumulator_table
 GROUP BY article_id ORDER common_term_count DESC
</code>
I think this is valid MySQL syntax.
Comment: Thank you for your response. Unfortunately, common_term_count always returns 1, but I think it's close.  If I take out the UNION and only SELECT from tags, it returns an accurate count.  It only returns 1 when a UNION is made.  Any thoughts?
Comment: I see I have a syntax error, having reversed SELECT and ALL.  That could possibly be affecting the results.  Will edit and fix.
Comment: Actually yes, my typo was probably causing the problem.  UNION without ALL will cause the removal of all duplicate records in the result set.  Since the two UNIONed queries produce all identical rows, that was likely causing the problem.  My apologies for taking up your time on that.
Comment: Not sure why MySQL even ran the query with the typo, I would have expected different numbers of columns in the two UNIONed queries.  In my (limited) MySQL experience, it seems to run a lot of queries that I wish it wouldn't.
Comment: Thanks so much, Larry!  That fixed it.  I appreciate you taking the time to help me!  I spent the time trying to learn more about UNIONs and JOINs -- they have always been rather puzzling to me!  You just solved a very needed solution for me.  I can't thank you enough!  :-)
Comment: Always a pleasure to be able to help someone out.