Average value of a function over some given interval

Question: I was learning about simple harmonic motion from YouTube and in one of the lectures the teacher introduced to the formula for the average value of a function I know that formula for the average value of a function $f(x)$ over an interval $[a,b]$ is$$\frac{\displaystyle\int_{a}^{b}f(x)dx}{b-a}$$but I wanted to know the intuition behind that formula like how do we get to that formula. I searched for it in YouTube and Google I saw that formula everywhere but didn't find any explanation for it if someone has a explanation for it please share or refer some source from where I can know about it
Thank You.
Answer: Suppose you plot the function $f(x)$ in the $[a,b]$ interval. Then we define the average value $\bar f$ in the following way: draw a line parallel to the $x$ axis at some height $h$. Calculate the area of the function $f$ above and below $h$. When these are equal, you get the average value. In mathematical terms:
$$\int_a^b(f(x)-\bar f)dx=0\\\int_a^bf(x)dx=\bar f\int_a^bdx\\\bar f=\frac{\int_a^b f(x)dx}{b-a}$$
Answer: First think of a discrete average. Say you have $n$ people, each with some money. The average is the amount they each would have if they distributed all their money equally among all of them.
So the idea of an average is: same total amount of stuff, but distributed equally.
In the continuous case, the total amount of stuff is represented by area under the curve (integral). To distribute the stuff equally (so that the total amount remains the same), we want a constant function so that the total area under the constant function is equal to the total amount of area under the original curve.  So geometrically we want a rectangule over the relevant interval, $[a,b]$, such that the rectangular area is equal to the area under the original function. If we call the height of the desired rectangle $h$, we want
$$h\cdot (b-a)=\int_a^b f(x) dx$$
This height gives the average value of the function.
[Note: In general the function could have negative values, and/or the average value could be negative; so if you want you can think of signed area--(above the $x$-axis counts positive; below counts negative).]


SOLID no Laravel

Question: O Laravel quebra os conceitos de SOLID?

SRP - Single responsibility principle  Princípio da Responsabilidade
  Única - Uma classe deve ter um, e somente um, motivo para mudar.
OCP - Open/closed principle Princípio do Aberto/Fechado - Você deve
  ser capaz de estender um comportamento de uma classe sem a necessidade
  de modificá-lo.
LSP - Liskov substitution principle Princípio da substituição de
  Liskov - As classes derivadas devem ser substituíveis por suas classes
  bases.
ISP - Interface segregation principle Princípio da segregação de
  interfaces - Muitas interfaces específicas são melhores do que uma
  interface única geral.
DIP - Dependency inversion principle Princípio da inversão de
  dependência - Dependa de abstrações e não de implementações.

e se usarmos o comando php artisan make:controller TestController -r ele criará um Controller com todos os verbos HTTP, que fica como index, edit, delete e store em um único controlador.
No caso teriamos uma classe assim:
class TestController extends Controller
{

public function index() {

 /*  Consulta  */

}
public function store() {

 /*  Insere  */

}

public function edit($id)
{

/*  Edita  */

}
public function delete($id)
{

/*  Deleta  */

}

Isso não acaba violando um dos princípios do SOLID?
Fonte: Medium
Comment: Como funções elas estão separadas, como unidade organizacional parece ter uma coerência, afinal todas são ações de um controlador. Dá pra questionar isso? Dá. Será que deve usar um MVC? Será que SOLID é tudo isso? https://pt.stackoverflow.com/q/336319/101 Será que as pessoas sabem o que dizem? Será q é simples definir o que é coeso ou não? Que no fundo é o que prega o SOLID. Será que esquecer OOP não ajuda mais no SRP? E no fundo parece que é só sobre ele q está falando e não o SOLID. O que tenho certeza é que decorar e seguir regras não faz software melhor.
Comment: @RodrigoPires Esse negócio de sólid em Laravel é tiro no pé programa o bang e seja feliz
Comment: E por que acha isto? E qual o problema vê nisso? Temos fonte aqui também: https://pt.stackoverflow.com/q/178718/101
Comment: Eu acho (estou aprendendo ainda, por isso a pergunta) que são funções totalmente diferentes, então deveriam estar separados, não?
Comment: @RodrigoPires da pra trabalhar com laravel trabalhando com solid de boa, não entendi qual e a treta...
Answer: Cara, o SOLID é muito importante para sistemas grandes com regras de negócio complexas. Pra usar SOLID no Laravel você vai ter que fazer na mão. Você vai ter criar todos os diretórios da separação: Service, Repository, Entity(se for o caso), etc. Depois vai fazendo as injeções conforme o fluxo da arquitetura que você achar melhor. Em seguida vai aplicando as outras regras, criando intefaces e factories, aplicando a inversão de dependência e assim por diante. O Laravel não quebra o princípio SOLID é exatamente do controller que você vai chamar os services. Mas existem várias linhas de pensamento quanto a isso, vai ficar ao seu critério como vai ser o controller, mas nada de regras de negócio nele. Espero ter ajudado.

SOLID no Laravel


A contradictory consequence of the Tarski-Vaught test in Gödel's constructible universe

Question: A consequence of the Tarski-Vaught test is the following: if $(M_i)$ is a chain of elementary end-extension, that is if:
$$
M_0 \prec M_1 \prec \ldots \prec M_i \prec \ldots
$$
Then for all $j$, we have:
$$
M_j \prec \bigcup_i M_i
$$
Then if we consider $L_{\omega_1}$ in the constructible universe, we can construct $(L_{\alpha_\nu})_{\nu}$ a chain of elementary substructures of $L_{\omega_1}$ by repeatedly applying the Löwenheim-Skolem Theorem. In particular, this implies that:
$$
L_{\omega_1} \models \exists \alpha \, \forall \beta \, \exists \alpha' > \beta \, L_\alpha \prec L_{\alpha'}
$$
Now consider $\alpha_0$ the least ordinal such that $L_{\alpha_0} \prec L_{\omega_1}$. The previous sentence can be reflected down to $L_{\alpha_0}$ and this implies the existence of some chain of elementary substructures $(L_{\beta_i})$ such that the $\beta_i$ are cofinal in $\alpha$. Hence, the previous consequence of the Tarski-Vaught test yields:
$$
L_{\beta_0} \prec \bigcup_i L_{\beta_i} = L_{\alpha_0} \prec L_{\omega_1}
$$
which contradict the minimality of $\alpha_0$. Where is the error in this reasonning?
Comment: I think the only error in your argument is the "and this implies" in "The previous sentence can be reflected down to $L_{\alpha_0}$ and this implies the existence of some chain $\dots$." What it actually implies is that there is $\xi<\alpha_0$ such that $L_\xi$ has elementary extensions $L_\eta$ for arbitrarily large $\eta<\alpha_0$. But there is no guarantee that those $L_\eta$'s form an elementary chain. Any two of them, say $L_\eta\subseteq L_{\eta'}$ satisfy the same formulas with parameters from $L_\xi$,  but not necessarily with parameters from $L_\eta$.
Comment: Why did we even need that chain? Why not simply take the least $\alpha$ such that $L_\alpha\prec L_{\omega_1}$?
Comment: @AsafKaragila The chain in $L_{\omega_1}$ or in $L_{\alpha_0}$? The first one is used to establish the sentence in $L_{\omega_1}$, although it could be indeed simply a LS argument. The second one however seems necessary to establish that $L_{\beta_0} \prec L_{\omega_1}$.
Comment: @AndreasBlass That was it indeed! Took it for granted and never tried to write it down.
Answer: There are several issues. It is true that there are arbitrarily large $\alpha$ below $\omega_1$ such that $L_\alpha\prec L_{\omega_1}$. That's different from saying $L_{\omega_1}\models\exists\alpha\forall\beta\exists\alpha'>\beta\ L_\alpha\prec L_{\alpha'}$, which says a totally different thing; although I feel like $L_{\omega_1}$ consistently satisfies this sentence, using something about zero sharp, it's probably not true in general, and moreover $\alpha<\alpha'<\alpha''$, $L_\alpha\prec L_{\alpha'}$ and $L_\alpha\prec L_{\alpha''}$ don't imply $L_{\alpha'}\prec L_{\alpha''}$, so you don't really get a chain.
The main issue is that "there are arbitrarily large $\alpha$ below $\gamma$ such that $L_\alpha\prec L_{\gamma}$" cannot be expressed as a statement $\varphi$ about $L_\gamma$, by your reflection argument; namely, there is no formula $\varphi$ such that $L_\gamma\models\varphi$ iff there are arbitrarily large $\alpha$ below $\gamma$ such that $L_\alpha\prec L_{\gamma}$ (or even "there exists some $\alpha$").
Comment: Oh alright, thanks! As usual the issue lays in what is not written because it seems clear (namely the fact that for $\alpha < \alpha' < \alpha' \ldots$). However, the other direction does hold without much hassle: if some ordinal admits a cofinal chain of e.e.e., then it satisfies the sentence $\exists \alpha \forall \beta \ldots$.


Convergence analysis of quadratically convergent phase for Newton method in Boyd & Vandenberghe's Convex Optimization

Question: On Page 490 of B & V's Convex Optimization book, by the Lipschitz condition (9.31), we have, for $t\ge 0$,
$$\tag{1}
\left\|\nabla^{2} f\left(x+t \Delta x_{\mathrm{nt}}\right)-\nabla^{2} f(x)\right\|_{2} \leq t L\left\|\Delta x_{\mathrm{nt}}\right\|_{2}
$$
and therefore
$$\tag{2}
\left|\Delta x_{\mathrm{nt}}^{T}\left(\nabla^{2} f\left(x+t \Delta x_{\mathrm{nt}}\right)-\nabla^{2} f(x)\right) \Delta x_{\mathrm{nt}}\right| \leq t L\left\|\Delta x_{\mathrm{nt}}\right\|_{2}^{3}
$$
My question is how to get (2) from (1). It seems that, after mutiplying $\left\|\Delta x_{\mathrm{nt}}\right\|_{2}^{2}$ on both sides of (1), applying Cauchy-Schwartz inequality on the lefthand side is a good thought, but the basic Cauchy-Schwartz inequality is only applicable for dot product between two vectors. What can we do now?
Answer: You can use the property that $\|Ax\|_2\leq\|A\|_2\|x\|_2$.
In particular,
\begin{align}
\|x^\top A x\| = \|x^\top (Ax)\| \leq \|x\| \|Ax\|\leq \|x\|\|A\|\|x\| \leq tL \|x\|^3
\end{align}
using the given bound on $A = \nabla^2 f(\bar{x} + tx) - \nabla^2 f(\bar{x})$.
Comment: What is this property? This is exactly what I need, but does it hold?
Comment: The induced operator norm is a sub-multiplicative matrix norm; see [wikipedia](https://en.wikipedia.org/wiki/Matrix_norm)
Comment: Yes, your answer makes perfect sense. Thanks a lot.


RDS, RDWeb, and RemoteApp: How to use public certificate for launching apps on session host?

Question: Question:
How do i tell RDWeb to launch apps from remote.domain.com rather then host.internaldomain.local?
Environment:
Existing org with AD forest. New single Server 2012 running all Remote Desktop Services roles for session host. Used the new 2012 wizard to setup "QuickSessionCollection" with roles:

RD Session Host
RD Connection Broker
RD Gateway
RD Web Access
RD Licensing

Everything works with self-signed cert, but we want to prevent those.
The users are potentially non-domain machines so sticking a private root cert for on their machines isn't an option. Every part of the solution needs to use public cert.
Added public remote.domain.com cert to all roles using Server Manager GUI:

RD Connection Broker - Enable Single Sign On
RD Connection Broker - Publishing
RD Web Access
RD Gateway

So now everything works beautifully except the last step:

user logs into https://remote.domain.com
user clicks a app icon, which in background downloads a .rdp file that is signed by remote.domain.com.
.rdp is set to use RD Gateway, which is remote.domain.com
.rdp says app is hosted on internal host.internaldomain.local, which doesn't match the RDP-tcp TLS cert of remote.domain.com, and pops a warning.

It's this last step that I'd like to fix. Is there a config option in PowerShell, WMI, or .config to tell RDWeb/RemoteApp to use remote.domain.com for all published apps so the TLS cert for RDP matches what the Session Host is using?
NOTE: This question talks about this issue, and this answer mentions how you might fix it in 2008, but that GUI doesn't exist in 2012 for RemoteApp, and I can't find a PowerShell setting for it.
NOTE: Here's a screenshot of the setting in 2008R2 that I need to change. It tells RemoteApp what to use for the Session Host server name. How can I set that in 2012?
Answer: This PowerShell worked: tell the Session Collection to add a alternate address for Session Host connections. This is also what you would do for a Session Host farm with round robin.
Once I ran this, launching apps from RDWeb would give a single prompt that now matches the three settings without warnings:

Publisher: remote.domain.com
Remote computer: remote.domain.com
Gateway server: remote.domain.com

Set-RDSessionCollectionConfiguration –CollectionName QuickSessionCollection -CustomRdpProperty "use redirection server name:i:1 `n alternate full address:s:remote.domain.com"

Depending on any other Custom RDP Properties, the above command may be different because you have to include them all in one command with a linefeed between each.
Background Info:
Adding custom RDP settings: http://social.technet.microsoft.com/wiki/contents/articles/15719.adding-custom-rdp-properties-in-windows-server-2012-vdi-rds-environments.aspx
Using this setting for HA: http://microsoftplatform.blogspot.com/2012/04/rd-connection-broker-ha-and-rdp.html
Answer: I am pretty sure that you need a cert valid for both the internal and external namespace. If you have .local internally (yuck) then you may have a hard time acquiring a cert with .local in either the Subject or Subject Alternative Name fields. If you can't get a cert from a public provider for this, then an internal PKI setup is your only option here.
Comment: Right, the assumption is I won't use a .local cert at all. This was possible in 2008R2 based on my screenshot above, but that was before Connection Brokers were required and the `RemoteApp Manager` GUI was removed. So, this should work fine with a non-hostname for RD Session Host, just need to find where 2012 expects us to set the setting above.
Answer: If you don't have a UC certificate you can use this powershell script to update the FQDN to match your external host name / certificate name:
http://gallery.technet.microsoft.com/Change-published-FQDN-for-2a029b80
Comment: I've read that this script can cause errors in RDS. "Please note that there are issues using RD Web feed after using this to change the client access name. RDS looks for a RDCB farm during the connection process and then fails." This tells me that this method is unsupported by Microsoft. Is there an alternative way to change the name that is supported? source: http://ryanmangansitblog.com/2013/03/10/configuring-rds-2012-certificates-and-sso/ under "Certificate Mismatches".


Contrário de appendHTML - como fazer?

Question: Tenho uma label no formulário do meu site que adiciona à uma div (no caso do exemplo, a id dessa div é grupoExt) um conteúdo HTML. Eis o código:
var numeroFE = 2;
$("#addFE").click(function(){
    var html3  = "
";
        html3 += "
<input name='nomeFE"+numeroFE+"' id='' class='validate[required]' title=''></input>

";
        html3 += "
";
        html3 += "
<input name='empresaFE"+numeroFE+"' id='' class='validate[required]' title=''></input>

";
    $('#grupoExt').append(html3);
    document.getElementById('grupoExt_text').value=numeroFE;
    numeroFE++;
});

Gostaria de saber se é possível fazer o contrário. Ou seja, usar de código JavaScript pra remover este código adicionado à div grupoExt
Answer: Podes fazer só:
document.getElementById('grupoExt').innerHTML = '';

Que com jQuery seria:
$('#grupoExt').html('');

Com jQuery Também tens as funções:
remove():
$('#grupoExt *').remove();

empty():
$('#grupoExt').empty();

Cujo  resultado final dos dois acima é o mesmo (apesar de retornarem coisas diferentes).

Contrário de appendHTML - como fazer?


How to tell ZF2's JsonModel to return text/plain instead of application/json?

Question: Using PHP Zend Framework 2.0.2, I return JSON data after an AJAX call. Obviously, Internet Explorer 9 wants to download the data instead of returning it to the calling Javascript method.
Posts like this one and this one say to use Content-Type: text/plain instead of Content-Type: application/json, but how do I do this with ZF2's JsonModel? I'm new to it...
I imagine I have to set something in the setOptions() array, but what?
public function testJsonAction()
{
   $jsonResponse = new JsonModel(array('success' => false));

   $jsonResponse->setOptions(array(
         // ** Should I put something here? What? **
   ));

   return $jsonResponse;
}

I tried using these:
  $this->getResponse()->getHeaders()->addHeaderLine('Content-Type', 'text/plain');
  $this->getResponse()->getHeaders()->addHeaderLine('Content-Disposition', 'inline; filename="textdata.json"');

but it doesn't change the HTTP Content-Type in the response headers:
Key                   Value
Response              HTTP/1.1 200 OK
Content-Type          application/json
Server                Microsoft-IIS/7.5
X-Powered-By          PHP/5.3.13
Set-Cookie            ZDEDebuggerPresent=php,phtml,php3; path=/
Content-Disposition   inline; filename="textdata.json"
X-Powered-By          ASP.NET
Date                  Wed, 10 Oct 2012 13:19:42 GMT
Content-Length        17

Thanks for your help!
Answer: Because when \Zend\Mvc\MvcEvent::EVENT_RENDER event happen, the JsonStrategy will change content-type again. Source code is in
Zend\View\Strategy\JsonStrategy->injectResponse();
So in order to replace content-type into yours, you need to use EventManager to inject your custom header after JsonStrategy injected.
try below codes in your controller:
 $this->getServiceLocator()->get('Application')->getEventManager()->attach(\Zend\Mvc\MvcEvent::EVENT_RENDER, function($event){
     $event->getResponse()->getHeaders()->addHeaderLine('Content-Type', 'text/plain');
 }, -10000);

Comment: Thanks but it did not work, it's still `application/json`. I set breakpoints in the function you mentioned and I saw it's called after the attached event is called... and after that point, the headers contains 3 times the Content-Type key.
Comment: Hi again! I tried attaching the event function to the `MvcEvent::EVENT_FINISH` event instead at it worked! Would there be any reason NOT to do that in your opinion?
Comment: Hi, actually I just test my code in ViewModel and it works, just now I tested JsonViewModel and I found that the event priority is not small enough, I adjustment it to -10000 and it works.

I didnot use EVENT_FINISH because JsonStrategy change header in EVENT_RENDER, just in order to reduce the invasive.
Comment: Thanks! It worked. But, I did have to change `$this` for `$event` in the event function otherwise I get a `Using $this when not in object context` error...
Comment: In my development environment, use $this is ok without any warning, maybe this is related to php version, my php is 5.4.4
Comment: Hi, I have in my code: `return new JsonModel($results)`. Where do I have to put that 3 lines of code to change headers? I tried putting them before the return, but it doesn't work.
Comment: Bear in mind that your useful priorities are lower than -10000 for the `render` event and higher than -10000 for the `finish` event. Those are respectively `Zend\Mvc\View\Http\DefaultRenderingStrategy` and `Zend\Mvc\SendResponseListener` priorities.


Effect of noise on an MLE estimate

Question: Question : In general, what is the effect of noise on an estimate obtained from Maximum Likelihood Estimation technique?
Comment: Could you provide more details? I think I grasped your problem, but I need more information. First question: is this measure, $M$, a scalar or a vector (if it is a vector, please provide a dimension for it, it may be needed in answering your question) ? Secondly, do you know if the MLE of $M$ is biased/unbiased/asymptotically unbiased?
Comment: Exactly, yes. Different SNR alone (with the same guessed parameters) is more than enough to get different *estimates* (i.e., realizations of the *estimator*). Can I post this last comments as an answer?
Comment: "Asymptotically unbiased" means the estimator is biased, however, its bias depends on some parameter (which we can control), say $K$. If $K \to +\infty$, then the bias tends to zero. Clearly, it's better to be unbiased than asymptotically unbiased (which is weaker). Trivial example: $\hat{x} = x + (1/K)n$, where $n \sim \mathcal{N}(\mu, \sigma^2)$, is asymptotically unbiased. I will post another comment with other questions regarding your problem.
Comment: Ok, since I am not well-versed in AR, I'm still missing the general procedure. However, I can help on the MLE part. Your objective is to obtain an estimate of $(a,b)$, is that correct?
Denoting the unbiased ML estimate of the measure with $\hat{x}$, you fed the system with two parameters: SNR and $\hat{x}$. Fix SNR=0 dB. The problem is: I don't see any direct dependency on $x$ in the AR formula. It is hidden in $y$ ? I mean: is $y$ actually a function of $x$ ? If so, is it a known function?
Comment: (A) In general, the ML estimate of $x$ only implies that $\hat{x}_{ML}$ maximizes the *likelihood function* (i.e., the probability density function of the given problem). (B) The key point here is that $\hat{x}_{ML}$ is a continuous random variable, thus: if you simulate the system one time and obtain $\hat{x}_1$ and if you simulate the system a second time and get $\hat{x}_2$, $\hat{x}_1 = \hat{x}_2$ happens **wp0** (with probability zero). Using the language of the article, $k_{ML}$ will always be different everytime you simulate the system. Different SNR alone is more than enough.
Comment: Even if the parameters to be estimated are deterministic, the estimator is a random variable. The reason is the statistical framework: there are random variables (RVs) in the problem formulation and that's all there is required to add "randomness" to the problem. If there were no RV in the model, than you are actually solving a (nonlinear) system of equations and MLE doesn't come into play. "wp0" is full of sophistications: no, it doesn't mean it is never true; in layman terms, wp0 is something like "negligible" (as an analogy, think to a zero measure set).
Comment: As a simple example, consider the model: $y_k = x + n_k$, with $n_k \sim \mathcal{N}(0,\sigma^2)$ i.i.d., $y_k \in \mathbb{R}$ are the observables ($k=1,\dots,K$ is an index) and $x$ is deterministic and unknown. If you collect $K$ observations, the ML estimate of $x$ is the sample mean, i.e. $\hat{x}_{ML} = \frac{1}{K} \sum_{k=1}^K y_k$. But each $y_k$ is in fact a RV: $y_k \sim \mathcal{N}(x,\sigma^2)$. In fact, the sample mean is a gaussian RV. Thus, even if $x$ is deterministic, the estimator $\hat{x}_{ML}$ is not. This happens with all estimators, not just ML.
Answer: For future reference, the paper related to this question is:

Jaap C. Schouten, Floris Takens, and Cor M. van den Bleek,
  "Maximum-likelihood estimation of the entropy of an attractor", Phys.
  Rev. E 49, 126 – Published 1 January 1994.

In this paper, the authors want to obtain the Maximum Likelihood (ML) estimate of the Kolmogorov entropy, denoted with $K$. In order to do so, as a preliminary step, a quantity called $k=K \tau_s$, where $\tau_s = 1/f_s$ and $f_s$ is the sampling frequency, is estimated via ML techniques. This answer will focus on the statistical aspects of the question.
In this case, the pdf (probability density function) is given by eq. (17) of the paper, i.e.
$$
p(b_1,b_2,\dots,b_M; k) = (e^k -1)^M \exp \left\{ -k \sum_{i=1}^M b_i \right\}
$$
where $M$ indipendent realizations of $b \in \mathbb{N}_0$, which is a random variable (RV) whose pdf is a geometric distribution, are observed. Reformulating it directly in function of $K$, the actual problem to be solved is
$$
\hat{K}_{ML} = \arg \max_{K} \ (e^{K \tau_s} -1)^M \exp \left\{ -K \tau_s \sum_{i=1}^M b_i \right\}
$$
and the closed-form solution is given by eq. (20), which can be rewritten as
$$
\hat{K}_{ML} = - f_s \left| 1 - \frac{1}{\bar{b}} \right|
$$
where $\bar{b}$ is the sample mean of the $b_i$. Observe that, since the $b_i$ are RVs, $\bar{b}$ is itself a RV. Clearly, $\hat{K}_{ML}$ maximizes the likelihood function. $\hat{K}_{ML}$ is an estimator, thus, by definition, it is a random variable. More precisely, its randomness comes from the fact that $\bar{b}$ is random. In principle, if the distribution of $\bar{b}$ could be calculated, then also the distribution of $\hat{K}_{ML}$ could be derived.
In general, if an estimator $\hat{x}$ is an absolutely continuous RV, denoting two estimates (i.e., realizations of the estimator) with $\hat{x}_1$ and $\hat{x}_2$, the condition $\hat{x}_1 = \hat{x}_2$ happens wp0 (with probability zero). This does not mean it can never happen, but only that it is "negligible" (using measure theory, a clear analogy is a zero-measure set). In fact, an event with probability zero is called negligible (and not "impossible") and this is the true subtility.
This does lead to somewhat counter-intuitive results, such as the fact that negligible events can happen even an infinite amount of times (!), given an infinitely long observation period.

SNR influences the behaviour of the system and plays an important role. I will explain it with an analogy. Consider the following simplified statement
$$
(1) \quad \hat{K}_{ML} \sim \mathcal{N}\left( K, \frac{1}{SNR} \right)
$$
If SNR changes, the parameters of the distribution of $\hat{K}_{ML}$ change too and this directly affects the estimates. To see this more clearly, note that
$$
(2) \quad \lim_{SNR \to +\infty} \hat{K}_{ML} = K
$$
exactly as expected. Equivalently, if you observe that
$$
(3) \quad \hat{K}_{ML} = K + n, \quad n \sim \mathcal{N}(0, \sigma^2)
$$
where $\sigma^2$ is related to SNR, the gaussian distribution degenerates in the limit $\sigma^2 \to 0$ and $n$ collapses in its mean, i.e. zero. This is a very simple example: however, many important practical problems exhibit similar behaviour (and one should be wary of problems that do not!).

Summarizing, everytime the system is simulated, you obtain an estimate. This will be "almost surely" different from previous and future estimates, since every change in the parameters which govern the distribution of the estimator $\hat{K}_{ML}$ (be it SNR, guessed parameter, $M$, $f_s$, ...) directly affect the estimates. This should not be thought as a negative behaviour, since what actually matters are the statistical properties of the estimator, such as being unbiased, consistent, efficient, etc..., and this is also the reason why bounds such as the CRLB are useful and frequently used.
Comment: In the limit $\sigma^2 \to 0$, a gaussian distribution $\mathcal{N}(\mu, \sigma^2)$ becomes a Dirac's Delta centered on its mean, $\mu$. This actually means that it is not a RV anymore: in fact, it becomes a deterministic term, i.e. $\mu$. This is what the collapse/degeneration actually means: any randomness disappears.
Comment: Thank you for your answer.But I could not follow the technical term under (3) the gaussian distribution degenerates in the limit σ2→0 and n collapses in its mean, i.e. zero. Can you please explain what is meant by degenerate and collapse of mean?

Effect of noise on an MLE estimate


Using ASP.NET MVC 2 with Sharepoint Publishing

Question: I need include asp mvc project in sharepoint, found this guide http://aspalliance.com/1944_Using_ASPNET_MVC_2_with_Sharepoint_Publishing.all but when i try go on  http://samplemvc get error - Unable to load file or assembly  "SampleMVC". MVC and Sharepoint in same application pool. Maybe somebody know how solved this problem or know another way to use it together.
I know about SharepointMvc, but he not suitable.
I use windows 7, sharepoint 2010, iis 7.5
Answer: When you get that error, it typically means that it's looking for SampleMVC.dll, but it can't find it in either the GAC or the bin directory on the IIS site.  Did you deploy SampleMVC.dll?
From the link you provided, SampleMVC.dll is the assembly that contains your definition for the CustomHttpApplication class.
Comment: if create virtual directory with project in same pool then search this dll  will be  in virtual folder too or I wrong?
Try insert dll in bin directory and I got same error.
Comment: Strange but copied dll in GAC and this error disappeared. Thanks for the help!


Android AlarmManager Pass extra from activity to service

Question: I have tried to follow many links but no matter what my extras keep being null. First I have an activity (MainActivity) that will set up a notification using a service (NotifyService). I can get the service to be and the notification to appear at the appropriate time. However passing a string seems to be a problem.
In MainActivity onCreate() I have:
<code> Intent myIntent = new Intent(this, NotifyService.class);
 //this is what I would like to pass over
 myIntent.putExtra("newtitle" ,"this is the new title");
 myIntent.putExtra("newcontent" ,"this is the new content");

 AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
 PendingIntent pendingIntent = PendingIntent.getService(this, 0, myIntent, PendingIntent.FLAG_UPDATE_CURRENT);

 Calendar calendar = Calendar.getInstance();
 calendar.set(Calendar.SECOND, 0);
 calendar.set(Calendar.MINUTE, 25);
 calendar.set(Calendar.HOUR, 11);
 calendar.set(Calendar.AM_PM, Calendar.PM);

 alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);

 Toast.makeText(MainActivity.this, "Set Alarm", Toast.LENGTH_LONG).show();
</code>
In My NotifyService onCreate I have:
<code>Intent intent = new Intent(this.getApplicationContext(),MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,intent, PendingIntent.FLAG_UPDATE_CURRENT);
//this will be null or give me errors every time
//        if (intent.getExtras().containsKey("newtitle"))
//            title=(String) intent.getExtras().get("newtitle");
//        if (intent.getExtras().containsKey("newcontent"))
//            content=(String) intent.getExtras().get("newcontent");

    NotificationCompat.Action action = new NotificationCompat.Action.Builder(
            R.drawable.basketball, getString(R.string.wearTitle), pendingIntent
    ).build();

    Uri sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);

    Notification notification = new NotificationCompat.Builder(this)
            .setContentText(content)
            .setContentTitle(title)
            .setSmallIcon(R.drawable.basketball)
            .setSound(sound)
            .extend(new NotificationCompat.WearableExtender().addAction(action))
            .build();

    NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(this);
    notificationManagerCompat.notify(001, notification);
</code>
Mainly I've been following this tutorial: https://www.youtube.com/watch?v=tyVaPHv-RGo.
I've also looked at this link: How can I correctly pass unique extras to a pending intent?
I have tried many things with the PendingIntent flags but still no luck. I've seen it done with intents and services but nothing with pending intents.
Thanks a lot
Answer: Turns out instead on using it on create, I have to use onStartCommand. Here's the code:
<code>@Override
public int onStartCommand(Intent intent, int flags, int startId)
{
    Toast.makeText(this, "Starting..", Toast.LENGTH_SHORT).show();
    Log.d("0",intent.getStringExtra("newtitle"));

    title = intent.getStringExtra("newtitle");
    content = intent.getStringExtra("newcontent");
    Intent myintent = new Intent(this.getApplication(), MainActivity.class);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,myintent, PendingIntent.FLAG_UPDATE_CURRENT);

    NotificationCompat.Action action = new NotificationCompat.Action.Builder(
            R.drawable.basketball, getString(R.string.wearTitle), pendingIntent
    ).build();

    Uri sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);

    Notification notification = new NotificationCompat.Builder(this)
            .setContentText(content)
            .setContentTitle(title)
            .setSmallIcon(R.drawable.basketball)
            .setSound(sound)
            .extend(new NotificationCompat.WearableExtender().addAction(action))
            .build();

    NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(this);
    notificationManagerCompat.notify(001, notification);
    return PendingIntent.FLAG_UPDATE_CURRENT; // or whatever your flag
}
</code>
Got it from: Pass data from Activity to Service using an Intent
Comment: It says I can't accept my own answer. I've tried sorry


Using ml model output to choose another ml model input

Question: I'm dealing with a low event rate problem (e.g. credit card fraud).
I've balanced my data with SMOTE, and ran a neural net model (cross validated with recall as the measure).
However my precision (as can be expected) is very low.
I want to use the positive predictions (TP + FP) from my model as an input to another model - a subset of the original data. Creating a sort of "pipeline".
Practically speaking, If a credit card company were to use my model, all the positive predictions will be handled by a human who would than decide whether or not it's a fraud, so why not automate?
Just like model stacking, but the stacked model gets a subset of the data and not the previous models predictions.
I'm not sure if that's OK. Any thoughts?
Comment: I believe what you're looking for is called "Cascading classification" (feeding only certain rows of data to 2nd level classifier, based on what the first model said).
Comment: So you're saying you want to have your base model (neural net), and you feed ONLY the positive predictions to a next classifier (person/machine)?
Answer: stacking, is exactly use the prediction of previous models. You can find the ensemble method in the following book:
Z.-H. Zhou. Ensemble Methods: Foundations and Algorithms, Boca Raton, FL: Chapman & Hall/CRC, 2012. (ISBN 978-1-439-830031)
I think you method, just use the TP and FP not very well, except the recall metrics is good enough.
Answer: If it works, why not? Define your objective and run the model on historical data to predict future. If predictive performance metrics show satisfying results, your method is good!
You're not using future unobserved data to predict future. Also you're not performing stats like pvalues to need any assumptions to hold. so your method is legit.
Note to use probability models not just classification models such as SVM since your outcome of interest is not common! You can determine probbility of fraud, can't detect it. The signal to noise ratio in your problem is very low, in which case classification methods usually fail badly!


Images displayed are as a gallery, but don't want to

Question: I made this blog for travel and photography, which is one of my main hobbies.
I got a free template and made all the necessary changes all by myself, crediting the author of it of course. But I'm having this issue...
Posts on the main page, that have more than 1 photography, will appear as a slide gallery, in which I don't want that, because it will mess up the layout when photos are vertical.
As you can see here: http://jcruz-foto.blogspot.pt/search?updated-max=2016-10-29T18%3A30%3A00%2B01%3A00&max-results=7
Post nº 6 where it says "Campeonato Regional MX Ribatejo 2016"...
This is the code associated with the slider. Removing it won't do the trick lol...
<code><style type='text/css'>
/**
 * BxSlider v4.1.2 - Fully loaded, responsive content slider
 * http://bxslider.com
 *
 * Written by: Steven Wanderski, 2014
 * http://stevenwanderski.com
 * (while drinking Belgian ales and listening to jazz)
 *
 * CEO and founder of bxCreative, LTD
 * http://bxcreative.com
 */

/** RESET AND LAYOUT
===================================*/

.bx-wrapper {
    position: relative;
    margin: 0 auto 60px;
    padding: 0;
    *zoom: 1;
    margin-bottom:15px;
}

.bx-wrapper img {
    max-width: 100%;

}

/** THEME
===================================*/

.bx-wrapper .bx-viewport {
    background: #fff;
    text-align:center;
    /*fix other elements on the page moving (on Chrome)*/
    -webkit-transform: translatez(0);
    -moz-transform: translatez(0);
        -ms-transform: translatez(0);
        -o-transform: translatez(0);
        transform: translatez(0);
}

.bx-wrapper .bx-pager,
.bx-wrapper .bx-controls-auto {
    position: absolute;
    bottom: -30px;
    width: 100%;
}

/* LOADER */

.bx-wrapper .bx-loading {
    min-height: 50px;
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2000;
}

/* PAGER */

.bx-wrapper .bx-pager {
    text-align: center;
    font-size: .85em;
    font-family: Arial;
    font-weight: bold;
    color: #666;
    padding-top: 20px;
}

.bx-wrapper .bx-pager .bx-pager-item,
.bx-wrapper .bx-controls-auto .bx-controls-auto-item {
    display: inline-block;
    *zoom: 1;
    *display: inline;
}

.bx-wrapper .bx-pager.bx-default-pager a {
    background: #666;
    text-indent: -9999px;
    display: block;
    width: 10px;
    height: 10px;
    margin: 0 5px;
    outline: 0;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
}

.bx-wrapper .bx-pager.bx-default-pager a:hover,
.bx-wrapper .bx-pager.bx-default-pager a.active {
    background: #000;
}

/* DIRECTION CONTROLS (NEXT / PREV) */

.bx-wrapper .bx-prev {
    left: 20px;
    background: url(http://1.bp.blogspot.com/-WCgfaNs6MAU/VBnoMBFzakI/AAAAAAAABxw/oqXkrdC99Kw/s1600/slider-arrows.png) no-repeat 0 0;
}

.bx-wrapper .bx-next {
    right: 20px;
    background: url(http://1.bp.blogspot.com/-WCgfaNs6MAU/VBnoMBFzakI/AAAAAAAABxw/oqXkrdC99Kw/s1600/slider-arrows.png) no-repeat -30px 0;
}

/*.bx-controls-direction a {
    opacity: 0;
    transition: opacity .25s ease-in-out;
    -moz-transition: opacity .25s ease-in-out;
    -webkit-transition: opacity .25s ease-in-out;
}

.bx-wrapper:hover .bx-controls-direction a {
    opacity: 1;
}*/

.bx-wrapper .bx-next:hover, .bx-wrapper .bx-prev:hover {
    opacity:.7 !important;
}

.bx-wrapper .bx-controls-direction a {
    position: absolute;
    top: 50%;
    margin-top: -15px;
    outline: 0;
    width: 30px;
    height: 30px;
    text-indent: -9999px;
    z-index: 9999;
}

.bx-wrapper .bx-controls-direction a.disabled {
    display: none;
}

/* AUTO CONTROLS (START / STOP) */

.bx-wrapper .bx-controls-auto {
    text-align: center;
}

.bx-wrapper .bx-controls-auto .bx-start {
    display: block;
    text-indent: -9999px;
    width: 10px;
    height: 11px;
    outline: 0;
    background: url(images/controls.png) -86px -11px no-repeat;
    margin: 0 3px;
}

.bx-wrapper .bx-controls-auto .bx-start:hover,
.bx-wrapper .bx-controls-auto .bx-start.active {
    background-position: -86px 0;
}

.bx-wrapper .bx-controls-auto .bx-stop {
    display: block;
    text-indent: -9999px;
    width: 9px;
    height: 11px;
    outline: 0;
    background: url(images/controls.png) -86px -44px no-repeat;
    margin: 0 3px;
}

.bx-wrapper .bx-controls-auto .bx-stop:hover,
.bx-wrapper .bx-controls-auto .bx-stop.active {
    background-position: -86px -33px;
}

/* PAGER WITH AUTO-CONTROLS HYBRID LAYOUT */

.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-pager {
    text-align: left;
    width: 80%;
}

.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-controls-auto {
    right: 0;
    width: 35px;
}

/* IMAGE CAPTIONS */

.bx-wrapper .bx-caption {
    position: absolute;
    bottom: 6px;
    left: 0;
    background: rgba(0, 0, 0, 0.6);
    width: 100%;
    padding:20px;
}

.bx-wrapper .bx-caption span {
    color: #fff;
    display: block;
    font-size: 16px;
}

</style>
</code>
Also, I wanted to make smaller vertical images on the front page, but I just can't seem to do it as well... Vertical images are way too big
Comment: What result do you want? You want to remove the slider or automatically fix the height of vertical images?
Comment: Yes... I don't want a slider, at the main page i just want one image preview, and fix the vertical images height, they're too big
Answer: Well, you are using a Blogspot theme and this functionality is integrated into the theme.
You can switch it off from the theme settings.
OR
If you just want to get rid of this functionality via CSS only, paste this code at the bottom of your stylesheet.
Remember this is a HACK so your slider will not work anywhere else. Use this code ONLY if you want to get rid of slider functionality via CSS only and are unable to switch off the auto slider creation from theme settings.
<code>.bx-wrapper .bx-controls-direction a{display:none;}
ul.bxslider li{display:none !important;}
ul.bxslider li:first-child{display:block !important;}
</code>
Comment: I don't think I want that...
If I could put the slider inside the post, instead of outside it, that would be great
Comment: @JoãoCruz well you need to know how to edit the template in order to do that. I would suggest you reading about Blogspot Themes.
Comment: thanks, it seems its a bit impossible for me. I tried to contact the designer of it, and willing to buy the full version, but no answer
Comment: Question: While making a post on blogger, either I say that image should be small, medium or whatever, the template is forcing the image to be always that default size. I can't figure out the code that's causing it...
Comment: Well you have to dig deep into the template files.


Weird subfields of $\Bbb{R}$

Question: I found this problem, and I can't get an answer to it:

Prove that there are subfields of $\Bbb{R}$ that are
a) non-measurable.
b) of measure zero and continuum cardinality.

I can't seem to imagine how to construct such subfields of $\Bbb{R}$.
Comment: @Robert, @George, so if this is a solution, then why not post a fully explained answer?
Comment: For (b), my idea would be to use the [cantor set](http://en.wikipedia.org/wiki/Cantor_set) and have a look at the subfield of $\mathbb{R}$ generated by this set.
Comment: @Beni Bogosel: Old result of Kuratowski, but may have used CH, I don't remember.
Comment: Are there some extension fields of $\Bbb{Q}$ which may turn out to be non-measurable?
Comment: The standard cantor set $E$ certainly doesn't work because $E - E$ contains an interval.  You'll need to remove a lot more than middle thirds.
Comment: @Beni Bogosel: they would have to be extensions of $\mathbb Q$, because every subfield of $\mathbb R$ contains  $\mathbb Q$.
Comment: @Robert Israel: I realize that. I was going to something like $\Bbb{Q}[\sqrt{3}]$, or an extension like $\Bbb{Q}[\sqrt{2},\sqrt{3},\sqrt{5},...,\sqrt{prime\ number}...]$. How can we study measurability of this fields?
Comment: For (b) you could consider the set of reals which, up to a rational multiple, have a very low density of nonzeros in their binary expansion. Consider the set of $x\in\mathbb{R}$ which can be expressed as $x=q\sum_{n=0}^\infty2^{-n}a_n$ for rational $q$ and integers $a_n$ satifying $\sum_{n=0}^N\vert a_n\vert=O(N^\epsilon)$ (all $\epsilon > 0$).
Comment: ...that just came to mind, but is it really a field? Or just a ring?
Comment: @George Lowther: Yes. The question is about fields. The answer given below by JDH has a positive answer to both question, but in a complicated manner. I hope some more easier examples will surface...
Comment: Unless I'm mistaken, any set of Hausdorff dimension 0 should generate a field of Hausdorff dimension 0.  This is because, if $A$ and $B$ have Hausdorff dimension 0, so does $A \times B$, and $A + B$ and $A B$ are images of $A \times B$ under locally Lipschitz functions.
Comment: If you replace $O(N^\epsilon)$ by $o(\log N)$ then the field generated by such numbers are either rational or are Liouville numbers, so has measure zero.
Comment: @Beni: "Easy" is rather subjective. I was thinking about explicit examples, which do not require using the axiom of choice.
Comment: @Robert: Very nice. So the field generated by a "thin" Cantor set (Hausdorff dimension 0) will give an example of (b).
Comment: @Robert, what about inverses?
Comment: @JDH: $z \to 1/z$ is a Locally Lipschitz function, so it also preserves Hausdorff dimension.
Comment: @BeniBogosel How have you "found" this question ? Did you come up with it on your own or have you found it in a book/article etc. ?  (Sorry for the late commentary on a question know 5 years old.)
Comment: @temo The question is quite old, so I don't really remember. I guess it was in some book on linear algebra or on some other topics in real analysis
Comment: @BeniBogosel Ok, thanks anyway for taking the time to answer after all this time.
Answer: I expect direct constructions, but while we are waiting, let me at least offer a proof that both assertions are consistent with ZFC, since they can be obtained by forcing.
Statement (b) is true of the ground-model reals after adding a Cohen real. In the answer to this MO question, Martin Goldstern explains that the set of reals in the ground model $\mathbb{R}^V$ has measure $0$ in the forcing extension $V[c]$, but it is easy to see that it has size continuum there. So this is a subfield of $\mathbb{R}$ in the universe $V[c]$ which has measure $0$ and size continuum.
Statement (a) is true in the models mentioned in Andreas Blass' comment to my answer to this MO question, where it is explained that the set of constructible reals, which is certainly a subfield, can be non-measurable afte forcing over the constructible universe.
Perhaps one can turn both of these arguments into actual ZFC constructions by considering partially generic filters. Or perhaps there are easier direct constructions.
Comment: Thank you very much for your quick answer. I will wait for some simpler direct constructions, if they are possible.
Comment: I will accept your answer, although it is not very simple to understand. Have you found any other simpler solutions?
Comment: Beni, thanks for accepting, although I still expect someone to post a direct construction (such as the Hausdorff dimension argument mentioned in the comments). So please feel free to unaccept later.
Answer: Rather bizarrely, here's an answer to one of the questions, but I'm not sure which.  But maybe it's a useful starting point.
Pick a transcendence basis of $B$ of $\mathbb{R}$ over $\mathbb{Q}$, any $b \in B$, and look at the field $F$ generated by $B\setminus \{b\}$.  Since the translates of $F$ by elements of $\mathbb{Q}b$ are pairwise disjoint, $F$ is either null or nonmeasurable.
I suspect (hope?) that this is nonmeasurable, maybe after taking algebraic closure.  If this is so, then a strategy for getting a null field could be tossing out more elements of $B$.
Answer: You can try the answers (including mine) for a question at MathOverflow... https://mathoverflow.net/questions/27352/a-question-about-fields-of-real-numbers/27358#27358
Answer: Accidentally, I got interested in the Question (a) recently. But I don't know the answer.
For question (b), a positive answer can be given even without $AC$.
There are are two ways to answer (b).
(1). It is routine to construct a perfect set $P$ (so $P$ is of size continuum) so that the join of any finitely many member of $P$ is hyperarithmetically generic. So the field generated by $P$ does not contain a random real and so is null.
(2) It is also easy to construct a perfect set $P$ so that for any $x\in P$, $K(x|n)\leq 3\log n +c$ for some constant $c$ and any number $n$, where $K$ is the kolmogorov complexity. Then the field generated by $P$ still have Hausdorff dimension $0$.

Update on 1 Feb, 2024.
After discussion with my colleagues, I think we have a complete answer.

Theorem There is a field $F$ that is a proper subset of $\mathbb{R}$ but $\mathbb{R}\setminus F$ has no perfect subset.

Proof: Let $\{P_{\alpha}\}_{\alpha<2^{\aleph_0}}$ be an enumeration of all perfect sets. Fix any real $z\not\in \mathbb{Q}$. We, by a transfinite induction up to $2^{\aleph_0}$, build an increasing sequence fields $\{F_{\alpha}\}_{\alpha<2^{\aleph_0}}$ as follows:
At stage $\alpha$, by induction, $z\not\in F_{<\alpha}=\bigcup_{\beta<\alpha}F_{\beta}$ and $|F_{<\alpha}|\leq |\alpha+\aleph_0|$. Note that for any Polynomials $P(x)$ and $Q(x)$ over $F_{<\alpha}$, the equation $z=\frac{P(x)}{Q(x)}$ has at most finitely many solutions. So by a simple counting argument, $$|\{x\mid z=\frac{P(x)}{Q(x)} \wedge P,Q\mbox{ are polynomials over}F_{<\alpha}\}|\leq|\alpha+\aleph_0|<2^{\aleph_0}.$$
Then we may pick up some $x_{\alpha}\in P_{\alpha}$ so that the field $F_{\alpha}$ generated by $F_{<\alpha}\cup\{x_{\alpha}\}$ does not contain $z$.
This finished the construction at step $\alpha$.
Now let $F=\bigcup_{\alpha<2^{\aleph_0}}F_{\alpha}$. Then

F is field; and

$z\not\in F$; and

$\mathbb{R}\setminus F$ has no perfect subset since $F\cap P_{\alpha}\neq \emptyset$ for any $\alpha<2^{\aleph_0}$.

Weird subfields of $\Bbb{R}$


Manifolds of zero dimension and $\mathbb R^0$?

Question: Tu Manifolds Section 5.4

Example 5.13 (Manifolds of dimension zero). In a manifold of dimension zero, every singleton subset is homeomorphic to $\mathbb R^0$ and so is open. Thus, a zero-dimensional manifold is a discrete set. By second countability, this discrete set must be countable.

Why exactly is the manifold $M$ discrete? I actually proved that the singleton subsets are open in their components but was not able to show they are open in $M$ itself.
Here is what I have done thus far:
Let $M$ be a smooth manifold with dimension zero, which means by definition that all of the connected components of $M$'s topological manifold (see here) $\{C_{\alpha}\}_{\alpha \in J}$ have dimension zero.
Let $\alpha \in J$. $C_{\alpha}$ has dimension zero, which means by definition (see here) that $\forall p \in C_{\alpha}, \exists$ homeomorphism $\varphi: U \to V$ for some $U$, a neighborhood of $p$ in $C_{\alpha}$ and some $V$, an open subset of $\mathbb R^0=\{0\}$. $V$ is either $\{0\}$ or $\emptyset$. Since $U$ contains $p$, $U \ne \emptyset$. Hence, $V \ne \emptyset$ because from nothing comes nothing, so $V=\mathbb R^0=\{0\}$. Sets that are homeomorphic to singletons are singletons. Therefore, $U$ is a singleton containing p, so $U=\{p\}$.
Therefore, we have

$\forall p \in M, \exists$ unique $\alpha \in J: \{p\}$ is open in $C_{\alpha}$.

I remember the connected components $C_{\alpha}$ are:

closed in $M$
not necessarily open in $M$.
open in $M$ if $J$ is finite.

I know $\{p\}$ is open in one of the connected components of $M$. How do we arrive at the conclusion that $\{p\}$ is open in $M$ itself?
Comment: I don't think you have the right definition of an $n$-dimensional manifold. Being an $n$-dimensional manifold means just that the space is locally homeomorphic to open subsets of ${\mathbf R}^n$. In your other question, you have the hypothesis of "locally Euclidean", which implies in particular that the connected components are open, in which case the two notions of $n$-dimensional coincide.
Comment: @tomasz I think in Tu, ["space is locally homeomorphic to open subsets" is the definition for topological manifold instead of smooth manifold](https://math.stackexchange.com/questions/3008855/dimension-of-topological-manifold-and-dimension-of-smooth-manifold-in-tu-manifol). By $n$-dimensional manifold, do you refer to smooth manifold or topological?
Comment: Yes. For a smooth manifold you need some further restrictions. But every smooth manifold is in particular a topological manifold.
Comment: @tomasz I will take it to mean that you refer to a smooth manifold. Tu's definition is different from yours, if I understand correctly.
Comment: That is my point: it is not (really) different. By the definition you gave 5.2, a manifold is a locally Euclidean space, which implies that connected components are open (because Euclidean spaces are locally connected). Hence, all connected components being $n$-dimensional is the same as being locally Euclidean of dimension $n$.
Answer: I don't know what you know but I would do it like this:
Pick a point $p\in M$. It has an open neighborhood $U$ homeomorphic to $\mathbf R^0$. So $U=\{p\}$ (it has only one point!). Hence $\{p\}$ is open.
Comment: How do you know $p$ has such an open neighborhood *in M*? I know $p$ has such an open neighborhood in *one of the connected components of M*, but I don't know how to extend this to $M$ itself.
Comment: Well this is my definition. Do you consider the set of 1/n together with 0 to be a manifold ? Isn't it a counterexample to your question?
Comment: Tom, are you actually tomasz and mistakenly replied here instead of in the comments on the question? If not, I don't understand your reply here. My problem is I know $\{p\}$ is open in a connected component of $M$ but don't know how to conclude $\{p\}$ is open in $M$ itself.
Answer: You wrote down yourself that you now know that every point in your manifold is clopen (U={p} implies this, since the domain of charts has to be open). But the only clopen subsets of a connected space are the space itself and the empty set, hence $\{p\}$ is a maximal connected component, and hence all of $C_\alpha$
Comment: well, I do not know what totally disconnected means, but we conclude that $C_\alpha$ is just a point, and since $\alpha$ was arbitrary, all connected components are singletons, which are clopen, hence the union of them (i.e. M) is disrcete.
Comment: Ah, ok thank you, then yes, precisely!
Comment: Oh, we deduce $\{p\}$ is open in $C_{\alpha}$ and know $\{p\}$ is closed in $C_{\alpha}$ by Hausdorff and so conclude $M$ is totally disconnected, which implies discrete?
Comment: Enkdiu, the empty set and the one-point sets are the only connected subsets of a totally disconnected set by the definition. Thank you!


How to perform a regression on 5 years of annual observations in eviews

Question: I am new to regression analysis so please excuse my ignorance.
I have collected 5 years of annual panel data, and I would like to regress this data on eviews but it is saying there is an insufficient amount of observations. Is there any way around this? I currently have 3 independent variables, 1 dependent and 3 control variables.
My suggestion is to just copy the same data down 4 times and regress that but I am thinking that may give me incorrect results.
Any help would be appreciated even if just to confirm that it isn't possible.
Comment: Just repeating your data is not acceptable. You don't give any eviews syntax (or equivalent). One of several crucial details here is whether you are trying to pool panels or not; there is no point anybody speculating because only you can make precise exactly what you are asking.
Answer: Since you didn't specify which version of Eviews you are using, I assume that you are using latest version (7). In that case, if you have a panel data in an Excel file, you just have to import that as foreign file. Please see here for details. I am also not sure whether there is any difference between control variable and independent variable. I think all control variables are independent variables but the reverse is not true.


Como preencher uma lista C#

Question: Preciso de um recurso semelhante ao apresentado abaixo:
     email ListaEmail = new email();
     …
     while …
     {
       email Email = new email();
       Email.email1 = adoDR["email"].ToString();
       Email.tipo = adoDR["tipo"].ToString();
       ListaEmail.Add(Email);
     }

Porém, a lista não aceita o método Add().
Então tentei declarar o array com o número de registros:
email[] ListaEmail = new email[nRegistros];

e preencher os campos de cada registro.
Porém, cada elemento de ListaEmail é criado com conteúdo null, e não com a estrutura e ocorre erro em tempo de execução ao se tentar atribuir o conteúdo
ListaEmail [Cont].email1 = adoDR["email"].ToString();

O código está abaixo:
public static email[] Func_RelatorEmail(Guid IdRelator)
{
  try
  {
   string sql = "SELECT Relator_Email.IdRelator, Relator_Email.EmailId, Email.email, Email.tipo, Email.tipoSpecified "
                      + "FROM Relator_Email INNER JOIN Email ON Relator_Email.EmailId = Email.EmailId "
                      + "WHERE(Relator_Email.IdRelator='" + IdRelator + "')";

    string connString = ClsParametros.Conexao;
    SqlConnection adoConn = new SqlConnection(connString);
    adoConn.Open();
    SqlCommand adoCmd = new SqlCommand(sql, adoConn);
    SqlDataReader adoDR = adoCmd.ExecuteReader();

    // contar o numero de registros
    int nRegistros = 0;
    while (adoDR.Read())
    { ++nRegistros; }

    // criar o objeto com o numero de registros
    email[] ListaEmail = new email[nRegistros];

    if (nRegistros > 0)
    {
      adoDR.Close();
      adoDR = adoCmd.ExecuteReader();

      int Cont = 0;
      while (adoDR.Read())
      {
         ListaEmail[Cont].email1 = adoDR["email"].ToString();
         ListaEmail[Cont].tipo = adoDR["tipo"].ToString();
         Cont++;
      }
   }
   adoDR.Close();
   adoDR.Dispose();
   adoCmd.Dispose();
   adoConn.Close();
   adoConn.Dispose();

    return ListaEmail;
  }
  catch (Exception ex)
  {
    throw new Exception(ex.Message);
  }
  finally
  {
  }
}

Com certeza, não é a forma mais eficiente para se resolver o problema.
Porém, como o controle não terá utilização muito intensa e tenho muito pouco tempo para resolver o problema, tentei dessa forma.
Tem alguma sugestão para resolver esse problema?
Obrigado!
Paulo
Comment: Sua lista não é uma lista, por isso ela não aceita o método `Add`. `email ListaEmail = new email();` está errado, deveria ser: `IList ListaEmail = new List();`
Answer:
Preciso de um recurso semelhante ao apresentado abaixo
email ListaEmail = new email();
while …
{
    email Email = new email();
    Email.email1 = adoDR["email"].ToString();
    Email.tipo = adoDR["tipo"].ToString();
    ListaEmail.Add(Email);
}

Você precisa declarar uma lista, não um email.
Apenas troque a declaração email ListaEmail = new email(); para List<email> ListaEmail = new List<email>();

List<email> ListaEmail = new List<email>();
while(condicao)
{
    email Email = new email();
    Email.email1 = adoDR["email"].ToString();
    Email.tipo = adoDR["tipo"].ToString();
    ListaEmail.Add(Email);
}

Comment: Ajustei o controle para utilizar List, porém, essa função deve alimentar os dados de um Web Service, cuja estrutura tem a definição que tem um conjunto email[].
Então aparece o erro

 Cannot implicitly type 'System.Collection.Generic.List' to email[]

O caminho seria converter List para email[]? Se sim, como se efetua a conversão.
Pois esse é um exemplo simplificado, mas precisarei efetuar muitas outras estruturas no projeto.

Obrigado!
Paulo
Comment: @PauloYatsuzuka na lista, faça `ListEmail.ToArray()` (LINQ) para converter a lista num array.
Comment: @PauloYatsuzuka Exatamente isso que o Omni citou. Inclua o namespace `System.Linq` para poder este método.
Comment: Segui a orientação declarando como List<> e deu certo.
Somente precisei colocar no final
    return ListaEmail.ToArray();   Muito obrigado!
Answer: Para resolver esse problema você deve usar a classe List<T>.
A classe List<T> é genérica, onde T é o tipo do qual você quer que a sua lista seja. No seu caso, List<Email>.
Dê uma olhada nessa apostila da Caelum, acho que lhe ajudará bastante! :-)

Como preencher uma lista C#


Route mono to Left or Right instead of centered in FL Studio?

Question: This is my first post and hope I am on topic. In a DAW like Reaper when you record Mono mic on a track, it is by default centered. Same sound is then heard on both speakers.
However, I have been able to route L-Mono to speaker 1 and then same L-Mono input to  speaker 2 separately on 2 tracks in Reaper. In Routing option for a track, you can select 1 to 1 and 1 to 2 and accordingly input mono is routed to only Left  1 or Right 2 output speaker. So that  I can get a feel of two different pieces of music playing thru individual speakers.
Just for an example chords on left speaker in one track  and say some lead piece on right speaker on another track.
However I am trying out another DAW FL Studio 20 and not sure how to achieve the same in that DAW. Does anyone have any idea about the correct settings?
Hope I explained what I am trying to achieve. In case there's existing QnA, kindly share the link.
Thanks.
Answer: You're looking for how to pan audio.  Assuming you've already figured out how to get your mic into FL studio at all-
In the drop down menu where you select your input:

Select the appropriate mono (not stereo!) input for your mic.  You can do this on as many tracks as you like simultaneously.
Use the pan knob to pan this channel left or right (This may look slightly different depending on what mixer layout you have selected):

This pans the audio on that channel post-effects.  If you want to pan pre-effects, insert a panning plugin such as "fruity balance" into effects slot 1.
I'll note that there is a third panning option in the channel rack, which is only available on recorded audio or virtual instruments (not live audio) and is also pre-effects.  I only use it when I want several similar audio clips panned differently and passing through the same mixer channel.


Como baixar um programa de um repositório linux sem instalar?

Question: Gostaria de saber se é possível, se sim, como baixar um programa de um repositório linux sem instalá-lo.
O motivo é que quase sempre que quero instalar um software, posso utilizar um comando no terminal que me permite instalar, porém nesse caso, gostaria de apenas baixar e armazenar o instalador.
Alguém sabe como proceder? O sistema que utilizo em específico é o Deepin.
Comment: Esta pergunta não pertence ao escopo do site, pois não possui relação com programação.
Answer: Você talvez possa usar o seguinte comando:
sudo apt download <nome do(s) pacote(s)>

O download de um tar.gz com o .deb dentro será feito no diretório em que você estava ao executar o comando, porém ele pertencerá ao root. Para ter acesso basta usar:
sudo chmod 777 nome_do_arquivo.tar.gz

Depois falta só descompactar para achar o .deb.
Comment: O comando estava dando certo, estava baixando, porém o Deepin bloqueou o acesso e no final não deu certo. Mas enfim, é a resposta.


Ordenação de array baseado na ordem de outro array

Question: Seguinte, tenho dois vetores cada um com uma sequência numérica. Vamos chamá-los de Array1 e Array2. Os valores estão abaixo...

Array1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
Array2 = [7, 6, 3, 9, 4, 5, 1, 10, 8, 2];

A minha dúvida é como eu faria para ordenar os valores do Array1, fazendo com que a ordem dos valores seja igual ao do Array2. Por exemplo, no lugar do Array1 cujo valor é "1", ele colocaria o valor que está na mesma posição (index), só que no Array2. No caso ele trocaria pelo "7". Enfim, alguém teria um palpite?
Comment: Os teus arrays de exemplo são iguais. Neste caso ficariam os dois iguais.
Comment: É exatamente isso o que eu pretendo fazer, @Miguel . Eu ordeno o array1 a partir da posição dos mesmos valores no array2
Answer: Uma vez que ambos os arrays possuem os mesmos valores (embora ordenados de forma distinta), e que a reordenação do array 1 o deixaria "equivalente" ao array dois, você poderia fazer isto:
array1 = array2;

Mas dessa forma os dois arrays serão clones, ou seja, a mesma coleção de números, i.e.: as alterações que forem feitas em um afetarão igualmente o outro. Se quiser realmente uma cópia, faça:
array1 = array2.slice(0);

Invejosos dirão que ambas as formas são trapaça.
Comment: @GabrielPolidoro existem outras formas: http://stackoverflow.com/questions/3978492/javascript-fastest-way-to-duplicate-an-array-slice-vs-for-loop Isso pode ser interessante pois assim poderá reconhecê-las se as vir no código de outras pessoas.
Comment: Não será uma cópia verdadeira, pois ainda há ponteiros: https://jsfiddle.net/f1baf543/
Comment: Bah, eu não sabia desse slice... Vou usar direto ele agora.
Answer: Se quiseres somente duas arrays iguais podes fazer:
arrayA = arrayB;

ou até mesmo
arrayA = arrayB.slice();

porém isso não impede que elementos da array sejam referênciados de uma array para a outra, uma vez que eles não foram copiados, mas sim "apontados".
Exemplo:

var array1 = [{id:1, desc: 'foo'}, {id:2, desc: 'bar'}];
var array2 = array1.slice();

array1[0].desc = 'olé!';
console.log(array2[0]); // vai dar "olé" apesar de estar na array da cópia

Se tiveres uma array de elementos Primitivos o melhor é passar para string e de volta para array. Assim crias cópias em profundidade
Exemplo:

var array1 = [{id:1, desc: 'foo'}, {id:2, desc: 'bar'}];
var array2 = JSON.parse(JSON.stringify(array1));

array1[0].desc = 'olé!';
console.log(array2[0]); // vai dar "foo"


Cannot install Watir on Jruby 188.8.131.52 - Windows 7

Question: I am trying to install gems from a  local gem repository into Jruby 22.214.171.124 and I am getting stuck on Watir which is pretty much the first one I tried.
I am running on Windows 7 with JDK 1.8.0_131
I get the following:
Error installing watir:
ERROR: Failed to build gem native extension

it looks as though the rest of the error message is complaining about ffi-1.9.18 I am afraid I can't post the exact error message as it is inside a VM that is not internet enabled.
update: full error message:
C:\Ruby\gem>jruby -S gem install watir
Building native extensions. This could take a while...
C:/jruby-220.127.116.11/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:58:  warning: Tempfile#unlink or delete called on open file
; ignoring
ERROR:  Error installing watir:
    ERROR: Failed to build gem native extension.

current directory:       C:/jruby-22.214.171.124/lib/ruby/gems/shared/gems/ffi-1.9.18/ext/ffi_c
C:/jruby-220.127.116.11/bin/jruby.exe -r ./siteconf20170718-2540-6mqxiv.rb extconf.rb

current directory:      C:/jruby-188.8.131.52/lib/ruby/gems/shared/gems/ffi-1.9.18/ext/ffi_c
make "DESTDIR=" clean
'make' is not recognized as an internal or external command,
operable program or batch file.

current directory:  C:/jruby-188.8.131.52/lib/ruby/gems/shared/gems/ffi-1.9.18/ext/ffi_c
make "DESTDIR="
'make' is not recognized as an internal or external command,
operable program or batch file.

make failed, exit code 1

Gem files will remain installed in   C:/jruby-18.104.22.168/lib/ruby/gems/shared/gems/ffi-1.9.18 for inspection.
Results logged to  C:/jruby-220.127.116.11/lib/ruby/gems/shared/extensions/universal-  java-1.8/2.3.0/ffi-1.9.18/gem_make.out

Comment: Good first attempt for a self answered question!
Answer: I got this working now. It was obvious from the error message that 'Make' was not being located correctly. I added the correct directory to the path and Watir was installed correctly.

Cannot install Watir on Jruby 9.1.12.0 - Windows 7


Views and external DB Oracle

Question: my Drupal 6 installation is on a MySql server, while my own custom database is on Oracle.
I have made a custom module that can read and write data into my external database, but i would like to use Views module to handle the data to show. I know that I can programmatically build views, but i don't know if I can build one for Oracle DB while Drupal is on Mysql.
Answer: You can create a view to a non-drupal table/database but you need to create a connection to it first using either one of the two connector modules: the Data module or the Table Wizard module.
You can also set it up using the Views API with views_hook_data(). (See documentation on views/help/api-tables.html.)
You'll need to add your new database connection settings in your settings file.
// In settings.php for your site
// Your drupal (site) database needs to be called 'default'
$db_url['default'] = 'mysqli://user:pass@host/drupal_db';
$db_url['oracle_db'] = 'mysqli://user:pass@host/other_db';

Then, in your view hook, define the tables the view should have access to.
$data[$table]['table']['base'] = array(
    'field' => 'Primary key',
    'title' => t('Field name'),
    'help' => t('Field description'),
    'database' => 'oracle_db',
    'weight' => -10,
);

Views and external DB Oracle


How can a force on a tone be in two different directions at the same time? What's the practical ramification of that force?

Question: At the bottom of the first page of Ch. 4 of Harmonielehre, Schoenberg talks about two forces acting on C.  One force pulls downward toward F, the other upward toward G.  He then analogizes C to a man hanging by his hands from a beam.  The man's own force pulls him up, while the gravity's force pulls him down.  Schoenberg then says that these two forces are in the same direction but the effect is that they are in opposite directions.
First of all, considering that every tone pulls another tone, a fifth above it,
downward toward itself, how can the C be pulled toward the G above it?  The C being in the middle, the force from it to the F is in the same direction as that of the G to the C.  Therefore, how can the analogy of the hanging man apply to this situation?  To me, it seems that the forces acting on the man are in opposite directions.  How can the effect of the force of the C pulling the G, be the C being pulled toward the G?
P.S. after I wrote this, I feel that I understand the validity of his point, but at the same time the paradox of what he says is driving me crazy.  Also, what's the practical implication of this phenomenon?
Comment: G>C= V>I.   C>F=V>I.   F>C= IV>I. C>G=IV>I,  C>F#/Gb, exactly the same distance, in each direction, = tritone, rather dissonant, if it's any help
Comment: Can you point to a translation? My German is rather poor.
Comment: Here's an English translation: https://monoskop.org/images/8/84/Schoenberg_Arnold_Theory_of_Harmony_1983.pdf  The passage quoted is on page 23 of the book, page 35 of the pdf.  It seems to be a pretty good translation.
Comment: @Ben I., please go to https://youtu.be/2dDSjvQYVgE and fast forward to the segment at 3:00.  It's an audio of the book.
Answer: You might be interested in the writings of Schenker. Although he was thinking of tonal systems, the principle still applies: there can be a "force" on the foreground, the middle ground, and the background, each of which operate on a different timescale.
Take for example a traditional 64-53 half cadence at the secondary dominant in C (G).  The first chord has the structure of a tonic in G, but the G note is not at rest; it is pulled down (at the foreground level) by the suspension.  At the same time, it is at rest (at the middle level) because it is the tonic note in the current key.  In the background, however, it still exists in a piece in the key of C, and is operated on (weakly) by the background forces that insist that it isn't the tonic, it's the dominant.  Thus the note is pulled on by three different forces all at the same time.  That's Schenkerian analysis in a nutshell.
As for Schönberg's writings, he seems to be claiming that forces exist when a note belongs to an overtone series, and because C belongs to a series of overtones that originates in F, its relationship to F is just as strong as its relationship to G (which is obviously in C's overtone series).  This is typical Schönbergian thinking-- he seems to have a strong orientation toward symmetry, which gives some insight into his later (atonal) works. In my humble opinion though he has made an unjustified logical leap, as he has not presented a theoretical framework in support of such symmetry, and is conflating Klang with Dreiklang (reference).  A C Klang implies a C Dreiklang, in which an F Klang simply doesn't exist-- you'd have to go all the way up to the 21st partial to even come close. It is a shame, though, since an eye toward symmetry quickly explains a minor triad in the context of Naturklang (since a minor triad is a major triad that is upside down), and the very existence of the minor triad was a pesky problem during Schönberg's time-- it doesn't fit the Naturklang ("Great Major Triad In the Sky") approach to harmony theory at all. The present explanation on page 23 of his book doesn't address this, nor can it, since the foundation of his argument is the overtone series, which doesn't have a minor third until maybe the 45th partial.
In an attempt to be charitable to Schönberg (since I love his Verklarte Nacht he must not be a total idiot), it is worth mentioning that music theorists do often talk about the "plagal" and "authentic" side of a key.  The plagal side is downward, toward F and the flat side of the circle of fifth, while the authentic side is upward toward G and the sharp side (corresponding to the plagal and authentic modes that make up Gregorian modes.  A musical work can exploit these two sides as it explores different key areas, and taking note of this can offer insight into the relative stability of a key within a larger context-- the farther up or down you go on either side, the farther you get from a stable center. This is a bit different from saying that the key is "pulled" in either of those directions, though, and non-sequitur to the notion that it is pulled in both simultaneously.
You might also be interested in the writings of Victor Zuckerkandl as well, especially Sounds and Symbol, in which he states:

A system in which the whole is present and operative in each individual locus, in which each individual locus knows, so to speak, its position in the whole, its relation to a center, must be called a dynamic system.  The dynamic qualities of a tone can only be understood as manifestations of an orderly action of forces within a given system. The tones of our tonal system are events in a dynamic field, and each tone, as it sounds, gives expression to the exact constellation of force present at the point in the field at which the tone is situated.  Musical tones are conveyors of forces. Hearing music means hearing an action of forces.

Victorkandl's work (about three decades after Harmonielehre) seems to pick up where Schönerg leaves off, and goes a step further: there aren't just two forces, there is a whole "constellation" of them, and the musical context forms a dynamic system.  His work goes a step further along the fundamentalist view of the Naturklang, notably diverging from other contemporaries such as Carl Seashore who begin to place more and more emphasis on psychology and pattern-matching approaches to music. Indeed, the last section of the book, entitled simply "Triad," can justifiably be seen as further rumination on the concept of the Naturklang and the fundamental nature of harmonic space as separate and distinct from physical space, with its own structure and its own laws. And in the end, those laws seem to defy analysis, leaving authors like Schönberg and Zukerkandl grasping at straws (and, apparently, writing tome upon tome) trying to explain them.
Comment: Ha, I've never heard him referred to as "Victorkandl" before!


Is a space of polynomials over Real numbers complete?

Question: Let $P$ be the space of all polynomials over $\mathbb{R}$ normed by, $\|P\|= \max \{|a_0|,|a_1|,|a_2|,...,|a_n|\}$ where $p(x)=\sum_{k=0}^{n}a_kx^k$. Is this space complete?
Actually this problem is regarding the open mapping theorem. The map from $p$ to $p$ is not open. But this map isn't contradict the open mapping theorem. I thought its because, $P$ is not a Banach space.
Comment: Hi @Miraj Chamara, welcome to MSE. Did you already try to prove this? It's no problem if you make any mistakes, but we can help you more if you try first.
Comment: yes. I have tried this. Actually this problem is regarding the open mapping theorem. The map from p to p is not open. But this map isn't contradict the open mapping theorem. I thought its because, P is not a Banach space.
Comment: It is not complete in any norm, by Baire's theorem.
Answer: $\sum _{k=1}^{n} \frac {x^{k}} {k!}$ is a Cauchy sequence which does not converge.


Given positive rational numbers t, r, s where t < rs, how to construct positive rational numbers p, q such that t = pq and p < r and q < s.

Question: I am trying to prove Theorem 1.7.10 (3.c) of The Real Numbers and Real Analysis which is
<code>let r,s ∈ ℚ, then i(rs)=i(r)i(s)
</code>
where i is the function embeds ℚ to ℝ of dedekind cut.
I have already proved most part of the theorem but the proof depends on the following lemma.
$$∀t,r,s ∈ ℚ⁺, t < rs → ∃p,q ∈ ℚ⁺, t = pq ∧ p < r ∧ q < s$$
Comment: Well you have a typo. At the end you should have $t<rs$ (as in title).
Comment: Sorry, typo fixed
Answer: We have $\frac t s <r$. The interval $(\frac t  s,r)$ contains a rational number $p$. Let $q=\frac t p$. I will let you verify that $p$ and $q$ have the desired properties.
Comment: Thank you so much. Didn't expect there would be anwser so quickly.


Playing concert barefoot

Question: I usually play electric guitar barefoot during my rehearsal,I feel more comfortable and it's easy to maneuver the pedals this way, and it's never been a problem. But in shows, I always been using shoes.
For some time, I been thinking in playing my concerts also barefoot, but I don't know if there is any issues that i'm not aware.
My question is, there is any real problem or risk playing barefoot on concerts? there is anything I should look before entering in small stages in order to avoid electric discharges?
Comment: One quick way to check the electrical situation is to touch your guitar strings to the grille of a microphone on stage. There should be no sparks. It's also wise to get a simple, three-light outlet tester and check every outlet you use before plugging in. If anything doesn't test right, find another outlet or cancel the gig. No gig is worth your life. Electrical safety has nothing to do with being barefoot or not.
Answer: Musicians who play barefoot - Sandie Shaw, in the 1960's in the UK; Todd Agnew (US Christian singer) - and probably more. Our drummer plays barefoot so he can feel the pedals better.
If electric shock due to being barefoot is a possibility, taking your shoes off is the last thing to worry about! Fix the electrical problem first!
Some stages are a little rough, and a splinter may be a real concern - but a pre-concert check should sort that out, or you could take your own rug to play on (our drummer does that also).
Comment: Agreed. There are all kinds of things that can get on a stage, some are just gross, and some are dangerous. I would absolutely roll with my own rug big enough to handle the area I want to walk around if I were playing barefoot. I would put the rug down, build my rig, and then only take my shoes off right when I get on stage so I'm only on the rug when I'm barefoot. Too many venues have too much on their floors to do otherwise.
Answer: I have seen musicians play on stage while barefoot.  It depends on the venue as to whether that is appropriate or not.  If you are in a classy music venue (Grand Ole Opry, Bluebird Cafe, Red Clay Music Foundry, etc.) or in a restaurant - the dress code might preclude going openly barefoot.  But if it's a laid back outdoor concert at a music festival, there may not be a dress code (depending on the festival clothes might be optional).
Whether barefoot or not, a concert stage has many hazards that a musician must be aware of.  I personally like to minimize trip hazards and keep the stage floor as tidy as possible.  I bundle my cords and run them in an area that keeps the main stage free of clutter.  Obviously your instrument cable and mic cable can't be tied to the front edge of the stage but most other cables can.
I certainly want to be sure that no electrical cords or cables are in use that could create an electrical hazard - whether playing barefoot or not.
You might want to try one of the minimalist running shoes or barefoot shoes such as the ones pictured below.  These would offer some protection from splinters or hot surfaces or environmental hazards (germs, chemicals) while allowing better feel of your pedals.  Unlike socks they have a sole that is resistant to tearing and absorption of liquids and dirt.  These shoes would qualify as "shoes" in a venue such as a restaurant where the local health codes might require all patrons and occupants to wear shoes and shirt.
  Image of EvoSkins from Wikipedia article on minimalist running
  Image from www.kensavage.com
Rugs have been mentioned and those are a great idea whether barefoot or not.  A rug on stage protects your instrument and mic cables from the hard surface of the stage should you accidentally step on one.  Instead of a rug, what I use is an EVA foam (rubber) mat made to go under exercise equipment or on gym floors.  They roll up for transport and come in 4' x 6' or in 8 foot lengths and diminish fatigue of standing on stage. I actually have several and put my floor monitors on one in addition to placing one under foot to stand on. Compared to a rug, these mats offer more cushion, are lighter weight and easy to clean if a drink gets spilled on them.  Mine are dark grey (almost black).  They lay flat on their own but with mic stands and guitar stands on the edges, they don't go anywhere.

Comment: @ToddWilcox I found them on sale at Walmart and thought they would be perfect on stage.  I used to use the square interlocking foam pads when I played on a concrete patio or pool deck but they don't roll up like the equipment mats.  They are half the weight of a similar sized rug.
Comment: Dancers have leather mini-sandals they sometimes wear. These sandals only cover the ball of the foot, not the toes or heel from the floor, and look quite minimal while offering a decent and comfortable amount of protection. I can't recall exactly what they are called though. A place that sells ballet slippers should also have them (and know what they are).

Playing concert barefoot


When can I leave counterbalancing factors (between participants) in an ANOVA out of a write up?

Question: The following is a problem that I keep encountering in different forms. For now, I give one example, but I would also be interested in the answers to the more general question.
I have a design with a reaction time based dependent variable $Y$, two hypothesis-relevant between participants factors ($A$ and $B$) and three counterbalancing factor ($C$ [stimuli used in different conditions], $D$ [the hands assigned to different responses], and $E$ [the order of different parts of the reaction time measure]). Except for the DV, none of the variables is continuous. For my research question it is interesting:

whether the DV x is overall above zero
whether factor $A$ has a significant influence on the DV
whether $A$ and $B$ interact in influencing the DV

I perform the analyses with ANOVA. Writing up the results of the whole analysis with all five factors takes up a lot of journal space, so I wonder in which case I can leave out the counterbalancing factors from the analysis:

Only if there is no effect or interaction whatsoever involving the counterbalancing factors?
Only if there is no interaction between a counterbalancing factor and one of the hypothesis-relevant effects (e.g., no interaction with $A$, no three-way interaction with $A$ and $B$?
Does it matter whether an interaction between a counterbalancing factor and a hypothesis-relevant effect is ordinal or disordinal (i.e., whether the effect is "turned around" in one condition)?
And if I encounter a relevant effect or interaction with a counterbalancing factor, how should I continue: reporting the ANOVA including this factor, or should I use a covariate analysis?
Would the approach be the same if I had a within-participants design?
Answer: You don't leave factors out of an analysis for any of the reasons you state. I'm assuming you're talking about significance when you talk about effect presence and significance of the effect is a poor reason to modify your model. This is a designed study and all of these variables should be orthogonal. Further, you're going to have such small cells in the study given so many variables that high variability of the samples is going to impact significance quite a bit.
You counterbalanced because you expected a main effect of the counterbalancing variable. Therefore it's presence as a main effect isn't terribly meaningful. It's lack of presence isn't usually either. Interactions are the critical thing and you need the main effect in the model in order to look at the interaction.
So interactions are really the only thing worth discussing and it should be discussed in terms of the amount of variability accounted for rather than significance. Perhaps they bring about important issues in terms of methodology for future researchers and perhaps they qualify the meaning of whatever effects are found. Regardless of their significance they should all be reported.
That said, many researchers don't report any of the counterbalancing variables. Perhaps it's well established in a field that they're not directly of interest at all and further it may be that the field relies so much on significance tests that the spurious significance of an individual interaction (remember, they happen 5% of the time by chance) isn't worth examining.
I guess I'm just saying you need to think about your data, your variables, and what things mean. But for goodness sakes don't include or exclude things based on significance. Do keep in mind that those additional factors in the model explain error variance and influence F-ratios.
NOTE: Your concern about whether interactions are ordinal or disordinal expresses a fundamental misunderstanding about interactions. All interactions are cross over. That's not always represented in the observed pattern of means due to main effects (whether significant or not). Consider a 2x2 where the lines cross. They are easily uncrossed by making a main effect separate the lines. Therefore, the suggestion that crossing lines may be a simple diagnostic is an oversimplification.
NOTE: Be careful of the variable designation. For example, did hand matter or handedness? Should it be coded in terms of what's dominant or the side. Furthermore, there are purely technical reasons to counterbalance hand for responding such as the fact that keyboards tend to be consistently faster reporting some keys than others because they scan in a fixed order.
Comment: I think the "ordinal" and "disordinal" terms are supposed to refer to different types of interactions. A disordinal interaction is also sometimes called a "cross-over interaction" (if you plot the 2*2 means as 2 connected lines, the lines cross). An ordinal interaction is, well, one that is not disordinal.
Comment: Yes, reading it over I see that's obvious... edited to correct.


Jenkins - Promoted Builds & Git

Question: Is it possible to get the Jenkins Promoted Builds plugin to invoke a second job, which in turn builds from the commit that was promoted, rather than from the latest revision?
So the flow would be something like this:

Commit A is made
'Dev' job performs build #1 from commit A
Commit B is made
'Dev' job performs build #2 from commit B
User manually promotes Dev #1
'Staging' job builds #1 from commit A (not B)
Answer: There's a bug in Jenkins that prevents this from being possible.
Normally one would:

Install Promoted Builds plugin
Install Parameterized Trigger
Configure Job Dev to be promotable, specifying "Trigger/call builds on other projects", then setting parameter of "Pass-through Git Commit that was built"

Sadly there appears to be a bug in the Promoted Builds plugin that means not all data are passed. There exists a fix, but it appears to be awaiting integration.
I've raised a ticket in Jenkins' JIRA which y'all should vote on if you're also afflicted by this issue.

Jenkins - Promoted Builds & Git


Hook function for admin/structure/taxonomy/your_vocaburary form (Save and Reset to alphabetical)

Question: I'm looking for a hook function to interact with the buttons "Save" and "Reset to alphabetical" on taxonomy term hierarchy. Does anyone know how to override this functionality?
Answer: with hook_form_FORM_ID_alter you can add extra function to trigger on submit.here is a simple example for you :
<code>/**
 * Impelement hoo_form_FORM_ID_alter
 * @param array $form
 * @param type $form_state
 * @param type $form_id
 */
function MODULENAME_form_taxonomy_overview_terms_alter(&$form, $form_state, $form_id) {
    $form['#submit'][] = 'my_news_submit';
}

function my_news_submit($form, &$form_state) {
    if ($form_state['triggering_element']['#value'] == t('Reset to alphabetical')) { // check if reset button submited or not
        drupal_set_message('RESET CALLED');
        // ADD YOUR EXTRA WORKS HERE FOR RESET
    } else { // act on "save" button submited
        drupal_set_message('SAVED CALLED');
       // ADD YOUR EXTRA WORKS HERE FOR SUBMIT
    }
}
</code>
Comment: thank you, I don't know how I could forgot about form alter function
Comment: Your welcome ! ;)


Showing that a subspace is dense

Question: Let $T \in \mathcal L(\ell^2(\mathbb C))$,
so that
$$
T(x_n) = \left(\frac{x_n}{n}\right)\,.
$$
Show that the range $\mathcal R(T)$ is a dense subspace, knowing that the spectrum $\sigma(T) = \{1/n \mid n \in \mathbb N\} \cup \{0\}$ and a point spectrum $\sigma_p(T) = \sigma(T) \setminus \{0\}$.
We also know that
$$
\mathcal R(T) = S := \left\{(y_n) \in \ell^2(\mathbb C) \mid \sum_n n^2 |y_n|^2 < \infty\right\}\,.
$$
Hint: The dense subspace of finite sequences $\ell^{\mathrm{fin}}(\mathbb C)$ might be useful.
An attempt
We know that the range of $T$ is a subspace, as $T0_{\ell^2} = 0_{\ell^2} / n = 0_{\ell^2}$, and for $x, y \in \ell^2(\mathbb C)$ and $\alpha, \beta \in \mathbb C$, we have
\begin{align}
\sum_n n^2 \left| T(\alpha  x_n + \beta y_n)\right|^2
&= \sum_n n^2 \left| \frac \alpha n  x_n + \frac\beta n y_n) \right|^2 \\
&= \sum_n \left| \alpha  x_n + \beta y_n\right|^2 < \infty\,,
\end{align}
as $\ell^2(\mathbb C)$ is its own subspace.
As for density, let $y \in \ell^2(\mathbb C)$, so
$$
\sum_k |y_k|^2 < \infty.
$$
 We know that for a converging series the tail approaches zero starting from some large enough $n$, which leads to $\ell^{\mathrm{fin}}(\mathbb C)$, the set of sequences whose tail is zero, being dense in $\ell^2(\mathbb C)$ and $\mathcal R(T)$. As density is transitive, $\mathcal R(T)$ is a subspace of $\ell^2(\mathbb C)$ and $\ell^{\mathrm{fin}}(\mathbb C)$, then $\mathcal R(T)$ has to be dense in $\ell^2(\mathbb C)$ as well.
Did I get the gist of this right, or am I missing something crucial?
Comment: I'm not sure what your argument for density is. What you want to show is, that $\ell^{fin}(\mathbb{C}) \subseteq R(T)$.
Comment: Which by transitivity then forces $\mathcal R(T) $ to be dense in $\ell^2$ as well...
Comment: Yes, that is fine. How do you show that $\ell^{fin}(\mathbb{C}) \subseteq R(T)$?
Comment: Well, every finite sequence converges and is $p$-summable, so they would automatically be in the set $S = \mathcal R (T)$.
Comment: this shows that any finite sequence $x$ is in $\ell^2(\mathbb{C})$. How do you know that there is an element $y \in \ell^2(\mathbb{C})$ s.t. $Ty = x$.
Comment: Also, transitivity is not at play here. What you want to use is that the closure operator is montone and that $\ell^{fin}(\mathbb{C})$ is dense in $\ell^1(\mathbb{C})$ i.e. that $\overline{\ell^{fin}(\mathbb{C})} \subseteq \ell^{2}(\mathbb{C})$. Because if then we can show that $R(T) \subseteq \ell^{fin}(\mathbb{C})$ we get $\ell^{2}(\mathbb{C}) = \overline{\ell^{fin}(\mathbb{C})} \subseteq \overline{T(R)} \subseteq \ell^2 (\mathbb{C})$.
Comment: So what I need to do is show that an arbitrary finite sequence can be mapped to from $\ell^2$. Couldn't I just take a finite sequence multiplied by $n$ from $\ell^2$ to get a sequence without the coefficient $n$ in $\ell^{\mathrm{fin}}$?
Comment: Pretty much, yes. The cleanest way would be to give an explicit preimage of any $x \in \ell^{fin}(\mathbb{C})$. As you have noted, for any $x \in \ell^{fin}(\mathbb{C})$, the element $y \in \ell^{2}(\mathbb{C})$ defined by $y_n := n x_n$ does the job.
Answer: For the fast answer you'll just need to recall some facts about the spectrum of a bounded linear operator on a Hilbert space:

firstly, $\ell^2 (\mathbb{C})$ is a Hilbert space
the spectrum of a bounded linear operator on a Hilbert space is comprised of the point spectrum, the continuous spectrum and the residue spectrum.
For a normal operator, the residue spectrum is empty. The operator $T$ is even self adjoint.

Now, you know that $\sigma(T) = \{1/n \vert n \in \mathbb{N}\} \cup \{0\}$ and $\sigma_p(T) =  \{1/n \vert n \in \mathbb{N}\}$. In other words, the continuous spectrum is $\{0\}$ and thus you know that $0I - T = T$ is a injective but not surjective and has dense image, which means that $R(T)$ is dense in $\ell^2(\mathbb{C})$.
Comment: I would like to say this was useful, but this little exercise was a part of a larger guided exercise where we show that $\sigma_c(T) = {0}$, so I can hardly use all of these facts.
Comment: Fair enough. I hope the comments are helpful though
Comment: I would say yes, they were.

Showing that a subspace is dense


RVM + rails 4 + whenever =?

Question: as the title suggests I am running

rails 4
Ruby 1.9.3-p0
rvm 1.6.9
whenever 0.8.3
the project's gemset

I run whenever -w and get the appropriate setting in the crontab.
If I copy & paste that command all works out well.
Cron however has other opinion.
I tried following advice here http://danielsz.github.io/how-to-run-rvm-scripts-as-cron-jobs/index.html/ , but without much success.
Looks to me that cron fails to set the appropriate gemset.
How can I fix this?
thanks!
Answer: First of all RVM 1.6.9 is very old version, you should update with
rvm get head
rvm reload
rvm get stable

But I'm afraid you might be using ruby-rvm package from ubuntu repositories, you should use then this answer https://stackoverflow.com/a/9056395/497756 (yes this is necessary).
As for integration with cron - use wrappers and aliases:
rvm alias create my_app 1.9.3@my_app
rvm wrapper my_app --no-prefix --all

This assumed your application gems are installed in 1.9.3@my_app, it created an alias my_app so it can be referenced in scripts so the scripts do not need to be changed when new ruby version is used.
The wrappers were created in /path/to/rvm/wrappers/my_app/* this are binary files automatically loading proper ruby environment for your application, they can be used in two ways:

export PATH=/path/to/rvm/wrappers/my_app:$PATH and then simply call bundle rake
call directly: /path/to/rvm/wrappers/my_app/bundle rake

If you use rvm-capistrano it has a command to do the wrappers and alias creation for you => https://github.com/wayneeseguin/rvm-capistrano#create-application-alias-and-wrappers

RVM + rails 4 + whenever =?


Evaluating the limit $\lim_{x \to -\infty} \left(1+ \frac{1}{x}\right)^{x^2}$

Question: I am trying to evaluate
$$
\lim_{x \to -\infty} \left(1+ \frac{1}{x}\right)^{x^2}.
$$
I'd say it tends to 0, 1 or something linked to $e$ but I have no clue how to prove this... I'm getting really stuck as I try to clarify things. Can you hint me? Thank you.
Answer: Since $(1+1/x)^x \to e$, this $\to \infty$.
Added: I read the limit as $\infty$, not $-\infty$. In this case,
if $y=-x$
so $y \to +\infty$,
$(1+1/x)^x
= 1/(1-1/y)^y
 \to 1/(1/e)
=e$,
so this $\to e^x =e^(-y)
=1/e^y \to 0$.
Comment: not to 0? isn't $x \to -\infty$?
Comment: I noticed this (before your comment) and fixed it.
Answer: You can use substitution:
$$y=-x\implies x\to-\infty\iff y\to\infty\;,\;\;\text{and thus}:$$
$$\lim_{x\to-\infty}\left(1+\frac1x\right)^{x^2}=\lim_{y\to\infty}\left[\left(1-\frac1y\right)^y\right]^y=0$$
since
$$\lim_{y\to\infty}\left(1+\frac ay\right)^y=e^a\;\;\forall\,a\in\Bbb R$$