Countability of conjugacy classes of closed subgroups

Question: The answer to the question at Does almost every pair of elements in a compact Lie group generates the connected component? says there must be countably many conjugacy classes of closed subgroups of compact connected Lie groups. One of the comments (Does almost every pair of elements in a compact Lie group generates the connected component?) says that this is a direct result of inclusions of closed subgroups being (real) algebraic. However, I don't see how the result follows without using something fancy. Is there an obvious or nice proof I'm missing?
Answer: 7 years ago I wrote in an unfinished paper a proof of this result; I didn't know then if it was original but it indeed seems to be known to a number of specialists although I'm not aware of a written complete proof. Since I don't want anymore to complete this paper, I reproduce the proof here (not self-contained, relying on [LW] below) as Proposition 5; possibly Uri has a more direct approach. I include closely related Proposition 1, which was my original goal.
Proposition 1
Let $G$ be a compact group (not necessarily Lie). Consider the action by $G$ by conjugation on $\mathcal{S}(G)$ (the space of subgroups of $G$, endowed with the Chabauty topology). Then the orbits of $G_0$ (connected component of 1) coincide with the connected components of $\mathcal{S}(G)$.
As a corollary, for $G$ a compact group, $\mathcal{S}(G)$ is totally disconnected if and only if $G_0$ is central in $G$ (equivalently, $G/Z(G)$ is totally disconnected), a result obtained in [FG]. More generally, it can be checked that for an arbitrary locally compact group $G$, $\mathcal{S}(G)$ is totally disconnected if and only if either totally disconnected, or $G$ is pointwise elliptic with $G_0$ central. ($G$ pointwise elliptic means that every single element generates a cyclic subgroup with compact closure.)
Lemma 2
Let $G$ be a compact Lie group. Let $F$ be a finite group. Then there are finitely many conjugacy classes of homomorphisms $F\to G$.
Proof.
The space $\mathrm{Hom}(F,G)$ can be described as a real algebraic variety, so has finitely many components. By [LW], all homomorphisms in a given component are conjugate under $G_0$.
\end{proof}
Lemma 3
Let $G$ be a compact Lie group. Let $S$ be a connected compact semisimple Lie group. Then there are finitely many conjugacy classes of homomorphisms $S\to G$.
Proof.
The space $\mathrm{Hom}(S,G)$ is canonically identified with the space of Lie algebra homomorphisms $\mathfrak{s}\to\mathfrak{g}$, which is an algebraic variety as well, so has finitely many connected components. So we can again use [LW].
Lemma 4
Let $G$ be a compact Lie group. Let $D$ be a connected compact abelian Lie group. Then there are countably many conjugacy classes of homomorphisms $D\to G$.
Proof.
Any such homomorphism maps into a maximal torus, and all maximal tori are conjugate [Bourbaki, Groupes et Algèbres de Lie, Chap 9, §2.2]. This reduces to the case when $G$ is a torus, but then the result just follows from the fact that $\mathrm{Hom}((\mathbf{R}/\mathbf{Z})^a,(\mathbf{R}/\mathbf{Z})^b)\simeq\mathbf{Z}^{ab}$, which is countable.
Lemma 5
Let $G$ be a compact Lie group. Then there are countably many conjugacy classes of closed connected subgroups in $G$.
Proof.
Since there are finitely many isomorphism types of compact semisimple groups in a given dimension, we can fix this type, so by Lemma 3, it is enough to consider the set of closed connected subgroups whose semisimple part is a given subgroup $S$. Therefore, it is enough to count conjugacy classes of closed abelian connected subgroups in $N(S)/S$, where $N(\cdot)$ denotes the normalizer, and Lemma 4 applies.
Proposition 6
Let $G$ be a compact Lie group. Then there are countably many conjugacy classes of closed subgroups in $G$.
Proof.
By Lemma 5, we can consider those subgroups for which $H_0=L$ is given. So it is enough to count conjugacy classes of finite subgroups in $N(L)/L$, there are countably many because of Lemma 2.
Proof of Proposition 1
We begin with the case when $G$ is a Lie group. Since $G_0$ has finite index in $G$, Proposition 6 implies that there are countably many $G_0$-conjugacy classes of closed subgroups in $G$. Let $C$ be a connected component of $\mathcal{S}(G)$. Clearly, it is invariant under conjugation by $G_0$. We just obtained that the quotient of $C$ by the action of $G_0$ is countable. It is also a compact connected Hausdorff space, so is reduced to a point (it is Hausdorff because the acting group is compact, see [Bourbaki, Topologie Générale, III, §4.1]. This means that $G_0$ acts transitively on each connected component of $\mathcal{S}(G)$, and we are done.
Now let us deal with a general compact group $G$. (It is no longer true in general that the set of connected components of $\mathcal{S}(G)$ is countable). We write $G$ as a projective limit of compact Lie groups $G/K_i$. Clearly, if two elements $H,H'$ of $\mathcal{S}(G)$ are conjugate under $G_0$, then they lie in the same component. Conversely, suppose they belong to the same connected component of $\mathcal{S}(G)$. Then since $K_i$ is compact, the projection map $\mathcal{S}(G)\to\mathcal{S}(G/K_i)$ is continuous. Because of the case of Lie groups, there exists $g_i\in G_0$ such that $(g_iHg_i^{-1}K_i=H'K_i)$ (we use the fact that the inverse image of the unit component of $G/K_i$ is the unit component of $G$). Let $g$ be a limit point of $(g_i)$. If $h\in H$, then $g_ihg_i^{-1}$ can be written as $h'_ik_i$ with $h'_i\in H'$ and $k_i\in K_i$. Necessarily $k_i\to 1$, so $h'_i=g_ihg_i^{-1}k_i^{-1}$ also converges, necessarily to an element $h'$ of $H'$. We have $ghg^{-1}=h'$. This proves that $gHg^{-1}\subset H'$, and the converse inclusion $g^{-1}H'g\subset H'$ is strictly similar.
[FG] S. Fisher, P. Gartside. On the space of subgroups of a compact group II. Topology Appl. 156 (2009) 855-861
[LW] D.H. Lee, T.S. Wu.
On conjugacy of homomorphisms of topological groups.
Illinois J. Math. 13 1969 694-699
in [LW] I refer to Theorem 2.6: if $G,H$ are compact Lie groups, then the connected components of $\mathrm{Hom}(G,H)$ are precisely the $H_0$-orbits (for action by post-conjugation).
Comment: That every compact Lie group has at most countably many conjugacy classes of closed subgroups is proved in Corollary 1.7.27 [Palais, Memoirs AMS, The classification of $G$-spaces, 1960], see p.39 at  http://vmm.math.uci.edu/PalaisPapers/ClassificationOfG-Spaces.pdf.
Answer: Required Claim: In a compact Lie group there are at most countably many conjugacy classes of closed subgroups.
I am the one who made the comment that the required claim could follow from an algebraic-groups-reasoning. I did not intend to say that this is obvious, rather that there is a conceptual explanation.
Roughly, the claim follows from the fact that
given compact Lie groups $G$ and $H$, the space of continuous homomorphisms $\text{Hom}(H,G)$ has the structure of an ind-variety and the "tangent spaces to  $\text{Hom}(H,G)$ modulo $G$-conjugation" are trivial. These "tangent spaces" could be identified with first cohomologies of $H$ with coefficients in the Lie algebra of $G$.
I will try to make this precise below.
In fact, taking into account the density of the algebraic points in $\text{Hom}(H,G)$, I will be able to prove a stronger result which is new to me, see the conceptual claim below.
Convention: Let me denote here by $\bar{\mathbb{Q}}$ the algebraic closure of $\mathbb{Q}$ in $\mathbb{R}$.
Conceptual Claim: Given a compact Lie group $G$ there exists a reductive $\bar{\mathbb{Q}}$-algebraic group $\mathbf{G}$ and a Lie groups isomorphism $G\simeq \mathbf{G}(\mathbb{R})$ under which every closed subgroup of $G$ corresponds to a $\mathbf{G}(\mathbb{R})$-conjugate of the $\mathbb{R}$-points of a $\bar{\mathbb{Q}}$-subgroup of $\mathbf{G}$.
Remark: As we'll see below, the $\mathbb{R}$-group $\mathbf{G}$ is associated canonically with $G$. It follows from the conceptual claim that $\bar{\mathbb{Q}}$-structure is canonical up to conjugation.
Conceptual Claim $\Rightarrow$ Required Claim: Immediate by the fact that $\mathbf{G}$ has at most countably many conjugacy classes of $\bar{\mathbb{Q}}$-subgroups and each such subgroup is given by a finitely generated ideal in the countable algebra $\bar{\mathbb{Q}}[\mathbf{G}]$.
In what follows I will try to explain why the conceptual claim holds true.
To get started let me state a standard fact, closely related to "Tannaka-Krein duality".
Fact 1: There is a fully faithful functor from compact Lie groups to reductive $\mathbb{R}$-algebraic groups which is a right inverse to the functor of real-points (ie, for a compact Lie group $G$ we associate a reductive $\mathbb{R}$-algebraic group $\mathbf{G}$ and there is a natural Lie-groups isomorphism $G\to \mathbf{G}(\mathbb{R})$).
Idea of proof: Given a compact Lie group $G$, consider the subalgebra of $G$-finite functions in the Banach algebra $C(G)$. This is a finitely generated algebra with no nilpotents. Let $\mathbf{G}$ be its spectrum. Give proper attributions to Peter-Weyl and Stone-Weierstrass in due places.
Fact 2: Every reductive $\mathbb{R}$-algebraic group has a $\bar{\mathbb{Q}}$-structure.
Idea of proof:
This follows by structure theory - every reductive group is a finite extension of a connected reductive group, every connected one is a central toral extension of a semisimple group.
(I'd be happy if someone will provide a more conceptual explanation.)
In light of the facts above, in proving the conceptual claim we can abandon compact groups terminology and prove the following pure-algebraic-groups-claim.
AG Claim: For every reductive $\bar{\mathbb{Q}}$-algebraic group $\mathbf{H}$ and every $\bar{\mathbb{Q}}$-algebraic group $\mathbf{G}$, for every $\mathbb{R}$-morphism $\phi:\mathbf{H}\to\mathbf{G}$ there exists $g\in \mathbf{G}(\mathbb{R})$ such that $\text{inn}(g)\circ\phi$ is defined over $\bar{\mathbb{Q}}$, where $\text{inn}(g)$ is the inner automorphism of $\mathbf{G}$ given by $g$.
AG Claim $\Rightarrow$ Conceptual Claim:
Given a compact Lie group $G$, let $\mathbf{G}$ be the $\mathbb{R}$-group associated with $G$ by the functor given in Fact 1 and use Fact 2 to view $\mathbf{G}$ as a $\bar{\mathbb{Q}}$-group.
Given $H<G$, let $\mathbf{H}$ be the corresponding $\mathbb{R}$-group and $\phi:\mathbf{H}\to \mathbf{G}$ be the $\mathbb{R}$-morphism associated with the inclusion $H<G$. Use Fact 2 again to fix a $\bar{\mathbb{Q}}$-structure on $\mathbf{H}$ and apply the AG Claim.
Note that, in general, the space of algebraic groups morphisms $\text{Hom}(\mathbf{H},\mathbf{G})$ is not a variety (eg $\text{Hom}(\mathbf{G}_m,\mathbf{G}_m)\simeq\mathbb{Z}$).
However it is always an ind-variety, that is a compatible ascending union of a sequence of algebraic varieties.
Moreover, these varieties could be chosen to be invariant under the $\mathbf{G}$-conjugation action.
Edit:
When I initially wrote this answer I thought this stuff ought to be well known. I still think so, but in light of the discussion in
Why do automorphism groups of algebraic varieties have natural algebraic group structure?
and
Number of connected components of an Automorphism group
I decided to expand a bit this part of our discussion.
In particular I added the following lemma and its corollary.
Lemma:
Let $k$ be a field and $\mathbf{X}$ and $\mathbf{Y}$ be affine $k$-varieties.
Let $\mathbf{G}$ and $\mathbf{H}$ be $k$-groups acting morphically on $\mathbf{X}$ and $\mathbf{Y}$ correspondingly.
Then the space of morphisms $\text{Mor}(\mathbf{Y},\mathbf{X})$ could be represented as an ascending union of a sequence of $\mathbf{H}\times\mathbf{G}$-invariant subsets which have compatible invariant structures of $k$-varieties.
Idea of proof:
Fix a finite dimensional generating vector space $U<k[\mathbf{X}]$, let $S(U)$ be the free commutative algebra on $U$ and consider the obvious map $\pi:S(U)\to k[\mathbf{X}]$. Let $W<S(U)$ be a finite dimensional vector space containing $U$ and a generating set of $\text{Ker}(\pi)$.
Let $U_0$ be a finite dimensional $\mathbf{G}$-invariant vector spaces containing $\pi(W)$.
Note that for every $k$-algebra $A$ and a $k$-linear map $\phi:U_0\to A$, $\phi$ extends to a $k$-algebra morphism $k[\mathbf{X}]\to A$ iff its restriction to $U_0$ is multiplicative in the following sense: for every $u,u'\in U_0$, if $uu'\in U_0$ then $\phi(uu')=\phi(u)\phi(u')$. In case $\phi$ extends, the extension is unique.
Fix $V_n<k[\mathbf{Y}]$, an ascending sequence of finite dimensional $\mathbf{H}$-invariant vector spaces such that $\cup V_n=k[\mathbf{Y}]$.
The required ascending union of algebraic varieties is then given by the collections of multiplicative maps $U_0\to V_n$.
It is obvious to check that the ind-variety structure on $\text{Mor}(\mathbf{Y},\mathbf{X})$ has the expected functorial properties.
Also the map $\text{Mor}(\mathbf{Y},\mathbf{X})\to \text{Mor}(\mathbf{Y}\times \mathbf{Y},\mathbf{X}\times \mathbf{X})$, $\phi\mapsto\phi\times \phi$ is a morphism. In case $\mathbf{Y}=\mathbf{H}$ and $\mathbf{X}=\mathbf{G}$ are algebraic group, the space of algebraic group morphisms $\text{Hom}(\mathbf{H},\mathbf{G})$ is the equalizer of the two maps $\text{Mor}(\mathbf{H},\mathbf{G})\to \text{Mor}(\mathbf{H}\times\mathbf{H},\mathbf{G})$ given by
$$ \phi\mapsto \phi\circ m_{\mathbf{H}} \quad \text{and} \quad
\phi\mapsto \phi\times\phi \mapsto m_{\mathbf{G}}\circ(\phi\times\phi)$$
where $m_{\mathbf{H}}$ and $m_{\mathbf{G}}$ are correspondingly the multiplication maps $\mathbf{H}\times\mathbf{H}\to \mathbf{H}$ and $\mathbf{G}\times\mathbf{G}\to \mathbf{G}$.
Corollary: For $k$-algebraic groups $\mathbf{G}$ and $\mathbf{H}$, the
the space of algebraic group homomorphisms $\text{Hom}(\mathbf{H},\mathbf{G})$ could be represented as an ascending union of a sequence of left and right $\mathbf{H}$ and left and right $\mathbf{G}$ invariant subsets which have compatible invariant structures of $k$-varieties.
We go back to proving the AG Claim now.
We fix an $\mathbb{R}$-morphism between $\bar{\mathbb{Q}}$-groups $\phi:\mathbf{H}\to\mathbf{G}$ with $\mathbf{H}$ reductive, and argue to show that up to a conjugation by an element of $\mathbf{G}(\mathbb{R})$, $\phi$ is defined over $\bar{\mathbb{Q}}$.
Using the Corollary we put $\phi$ in a subset $\mathbf{R}\subset \text{Hom}(\mathbf{H},\mathbf{G})$ which is $\mathbf{G}$-conjugation invariant and has the structure of a $\bar{\mathbb{Q}}$-algebraic variety.
We view $\phi$ as an element of $\mathbf{R}(\mathbb{R})$.
We need to show the following.
AG Calim, equivalent formulation: $\mathbf{G}(\mathbb{R})\phi\cap\mathbf{R}(\bar{\mathbb{Q}})\neq \emptyset$.
This follows by showing that there exists a (real topological) neighborhood of $\phi$ in $\mathbf{R}(\mathbb{R})$ which consists of $\mathbf{G}(\mathbb{R})$-conjugations of $\phi$, and that this neighborhood contains also a $\bar{\mathbb{Q}}$-point.
For the second statement, note the following.
Fact 3: For every $\bar{\mathbb{Q}}$-variety, the set of $\bar{\mathbb{Q}}$-points is dense in the set of $\mathbb{R}$-point (with respect to the real topology).
An analogue of this is true for every local field of characteristic 0, but this MSE post by Eric Wofsey gives a proof for the reals ending with a cymbal sound.
For the first statement we use
Fact 4: Given a reductive $\mathbb{R}$-group $\mathbf{H}$, for every $\mathbb{R}$-representation $W$ of $\mathbf{H}$, $H^1(\mathbf{H}(\mathbb{R}),W(\mathbb{R}))=0$.
The argument in this MO post of Brian Conrad should convince you of that.
It follows in particular that $H^1(\mathbf{H}(\mathbb{R}),{\frak g})=0$, where ${\frak g}$ is the Lie algebra of $\mathbf{G}(\mathbb{R})$ viewed as a an $\mathbf{H}(\mathbb{R})$-module via $\phi$.
Informally, we think of $H^1(\mathbf{H}(\mathbb{R}),{\frak g})$ as the tangent spaces at $\phi$ to $\text{Hom}(H,G)$ modulo $G$-conjugation.
Formally, we use the same standard reasoning one uses when showing that the outer automorphism group of a semisimple Lie group is finite.
This argument is written in a way that fits our needs here in Theorem 6.7 and Lemma 6.8 of Raghunathan's book.
Comment: I'd expect that there is a similar sketch, but possibly slightly simpler, based on (1) Every complex reductive group has countably many conjugacy classes of (complex) reductive subgroups. It is easy to deduce the result since the $\mathbf{R}$-points of a transitive $G$-set has finitely many $G(\mathbf{R})$-orbits (Borel-Serre). As there are countably many reductive groups, (1) follows from (2): for all $H,G$ complex reductive, $Hom(H,G)$ has countably many classes (up to $G$-conjugacy). (2) seems to follow from your approach, but the whole avoids passing to $\bar{\mathbf{Q}}$-points.
Comment: Thanks, Yves. Actually, I also thought of using Borel-Serre and the analogous complex result. I would, if I have found a simpler proof going this way, but I have not. So, if anyway giving the local-rigidity proof, why not providing a stronger result (one should be able to replace $\mathbb{R}$ with any local field)?
Answer: The countability of the number of conjugacy classes of closed subgroups of any compact Lie group is, in fact, a simple corollary of ideas that predate the end of World War II.  Unfortunately, the earliest quotable reference that I could find was given already in Igor Belegradek's comment, as follows.
Originally, Richard Palais observed this fact [1960, 1.7.27] and his proof uses the Peter–Weyl theorem [1927b] (harmonic analysis), as well as Chung-Tao Yang's theorem [1957] (differential geometry) on the local finiteness of orbit types within smooth $K$-manifolds, when $K$ is a compact Lie group.
Alternatively, I show how to achieve the fact using those earlier methods internal to the topology of $K$.
0 Selection Theorem [1927a, Satz 28:VI]
Let $X$ be a metric space.
Equip the set $\mathrm{Cpt}(X)$ of nonempty compact subsets of $X$ with the Pompeiu–Hausdorff metric $d$.
If $X$ is compact then $\mathrm{Cpt}(X)$ is compact.
1 Closed Subgroup Theorem [1930, Section 27]
Any closed subgroup of a Lie group is a real-analytic submanifold and furthermore a Lie subgroup.
2 Neighboring Subgroups Theorem [1942]
Any compact subgroup $H$ of an arbitrary Lie group $G$ admits a neighborhood $O$ in $G$ such that any subgroup contained in $O$ is $G$-conjugate to a subgroup of $H$.
Equivalently, there exists $\varepsilon>0$ such that any compact subgroup $H'$ of $G$ is conjugate to a subgroup of $H$ if $d(H',H)<\varepsilon$.
3 Corollary [1960, Corollary 1.7.27]
Any compact Lie group $K$ has only countably many conjugacy classes of closed subgroups.
3 Proof [2019, Proof 3.8]
Write $\mathrm{CptSgp}(K) \subset \mathrm{Cpt}(K)$ for the set of closed (hence compact) subgroups of $K$.
By continuity of the group operations of $K$ and the definition of the Pompeiu–Hausdorff metric, it follows that any sequence in $\mathrm{CptSgp}(K)$ that converges in $\mathrm{Cpt}(K)$ has its limit point already in $\mathrm{CptSgp}(K)$.
Since $\mathrm{Cpt}(K)$ is compact (0), we have $\mathrm{CptSgp}(K)$ is also compact.
Observe that any proper closed subgroup of $K$, as a point of the compact metric space $\mathrm{CptSgp}(K)$, lies in the complement of the open ball $B(K,1/n)$ for some integer $n > 0$.
Since $X_n := \mathrm{CptSgp}(K) - B(K,1/n)$ is compact, there exists a finite cover $\mathcal{U}_n = \{ B(H_{n,i}, \varepsilon_{n,i}) ~|~ 1 \leqslant i \leqslant r_n \}$ for some integer $r_n>0$ such that each $\varepsilon_{n,i}>0$ occurs from (2) for $H_{n,i} \in X_n = \bigcup \mathcal{U}_n$.
Since each proper closed subgroup $H_{n,i}$ of $K$ is Lie (1), inductively each $\mathrm{CptSgp}(H_{n,i})$ is partitioned into countably many $H_{n,i}$-conjugacy classes.
Indeed, for the double induction on dimension and number of components of a compact Lie group, the basic case is the trivial group.
Thus $X_n$ has only countably many $K$-conjugacy classes of closed subgroups. Therefore $\mathrm{CptSgp}(K) = \{K\} \cup \bigcup_{n=1}^\infty X_n$ consists of only countably many $K$-conjugacy classes of closed subgroups.
$\square$
Furthermore, there is a more general statement that applies to noncompact Lie groups $G$, which must have only countably many connected components.
4 Theorem [2019, Corollary 3.9]
Any Lie group $G$ has only countably many conjugacy classes of compact subgroups.
This would be immediate if we already knew whether the ancillary space $\mathrm{Cpt}(G)$ is Lindelöf, so as instead to use a countable union in the above proof.
However, I don't know this (equivalently, if the metric space is separable).
Instead, I shall use the following tool, which is a more elaborate corollary of (2) in terms of Moore–Smith nets and the Axiom of Choice, since second-countability of $\mathrm{Cpt}(G)$ is not assumed.
5 Proposition [2019, Proposition 3.6]
Let $C$ be a compact set in an arbitrary Lie group $G$.
Any compact subgroup of $G$ contained in $C$ is contained in a conjugacy-maximal compact subgroup within $C$.
Furthermore, there are only finitely many conjugacy-maximal compact subgroups within $C$.
4 Proof
The hemicompact space $G$ is the countable ascending union of compact sets in such a way that any compact set is contained in a member of that exhaustion. The rest follows from (5), (1), and (3). $\square$
References and Historical Remarks
<code>[1916]</code> W Blaschke, Kreis und Kugel, Veit
<code>[1927a]</code> F Hausdorff, Mengenlehre, Walter de Gruyter
Satz 28:VI formally generalizes to metric spaces from the compact convex sets of [1916, §18].
<code>[1927b]</code> F Peter and H Weyl, Die Vollständigkeit der primitiven Darstellungen einer geschlossenen kontinuierlichen Gruppe, Math Ann 97:737–755
<code>[1930]</code> E Cartan, La théorie des groupes finis et continus et l'Analysis situs, Mémorial des Sciences Mathématiques 42
<code>[1942]</code> D Montgomery and L Zippin, A theorem on Lie groups, Bull Amer Math Soc 48:448–452
For a proof that is purely topological and avoids differential geometry, see [1961, 4.2].
<code>[1957]</code> C-T Yang, On a problem of Montgomery,  Proc Amer Math Soc 8:255–257
<code>[1960]</code> R Palais, The Classification of $G$-spaces, Mem Amer Math Soc 36
<code>[1961]</code> R Palais, On the existence of slices for actions of non-compact Lie groups, Ann Math(2) 73:295–323
<code>[2019]</code> Q Khan, Countable approximation of topological $G$-manifolds, III: arbitrary Lie groups $G$, preprint submitted for publication.
Comment: The statement "There exists $n$ and proper closed subgroups $H_1,\dots,H_n$ of $G$ such that $CptSgp(K)\subset U_{H_1}\cup\dots\cup U_{H_n}$ is clearly false (since $K$ is missing), but even if you mean $CptSgp(K)\subset U_{H_1}\cup\dots\cup U_{H_n}\cup\{K\}$, it's false when $K$ is the circle group. (I'm also confused you define $U(H)$ and then denote $U_H$.)
Comment: Probably you can prove with such an argument that there exists a *sequence* of closed proper subgroups $(U_n)$ such that every proper subgroup is *conjugate* into one of the $U_n$, and then the argument works as soon as you know that there is no properly decreasing sequence of closed subgroups.
Comment: @YCor : I've added an edit to address your two comments.  I hope that my amended answer is satisfying from a purely classical point of view.


Uninhabitable Equator

Question: I remember reading somewhere that some intellectuals from the medieval period thought the equator would be uninhabitable because it would be too hot. That made me ponder about a worldbuilding idea - what if there was a planet with an equator that had a climate too hot for humans to live? My question is, if this is possible how could this planet's topography/size/weather patterns differ from our own? Is it possible to make this uninhabitable zone seasonal (so that the humans can perhaps, live underground when the weather warms up)? I want to create a planet that's more or less habitable in all other latitudes, but if that's not plausible, I'd like to hear your reasoning.
Comment: I don't have time to compose a complete answer, but I don't see why you really couldn't have a planet that's unbearably hot near the equator, yet livable at higher latitudes. You *would* have to come up with a plausible-sounding reason why this doesn't result in a strong evolutionary selection pressure toward being able to survive in the area around the equator, which presumably has less intraspecific competition than does higher latitudes.
Comment: Do you want the equatorial regions to be totally uninhabitable, or just inhospitable, like Sahara desert?
Comment: @MichaelKjörling  The question specifies "human", so I'm assuming these are colonists and not a species that evolved naturally on the planet.  It's hard to imagine what evolutionary pressure there would be for an advanced (at least space fairing) civilization to develop such an adaptation.

I don't have the chops to answer this question in full, just wanted to note that if the equator were year-round lethal, the northern and southern hemispheres of the planet might be totally isolated from one another (if they have lost means for space travel).
Comment: that's right - the humans are colonists who came in thousands of years prior.
Answer: A planet that has an unihabitable equator isn't that hard.  Just push the planet a little closer to the sun, but stay inside the habitable zone.  Our own planet is already hot at the equator.  Add another 25% of sunlight and the likelihood of habitability all but drops to zero.
Add to this that the increased water level (melted ice caps) and heat would likely result in some ferocious coriolis winds, making the equator that much more painful to live in.
But if you really want some fun, make the orbit elliptical such that at perihelion the equator is uninhabitable due to heat and at aphelion the poles are uninhabitable due to cold — forcing humanity to be constantly nomadic, moving from pole to equator and back anually to avoid the extreme temperatures.
Note that I'm utterly ignoring mountains, lakes, and altitude, all of which will affect weather considerably.  Even under the conditions I've described, the right mountains along the right wind pattern that carries evaporated oceanic water will be habitable (if blisteringly hot) during the summer.  Remember that your goal is suspension of disbelief — not necessarily factual reality.  But I'd be very curious to see a planet that had such an elliptical orbit that it swung between 125% of "Earth" sunlight and 25% per the graph in the above link.  Only considerable technology would allow you to stay in one place annually.
Comment: Ani, I'm honored to have the accepted answer, but may I recommend that you uncheck it and give it 24 hours?  We have participants all over the world and you might miss out on an amazing answer simply because it's human nature to not bother with officially answered questions.
Comment: The first  (non-elliptical orbit) planet wouldn't stay inhabitable. The uninhabitable equator would see massive amounts of water turning into vapour. This will violently mess with the climate, causing both massive greenhouse effect and a heavy cloud cover on most if not all of the world. Heat will be more distributed, making a bigger equatorial band uninhabitable. And over geological periods, high-altitude water molecules are cracked by the star's UV, with hydrogen escaping the atmosphere. The final result is Venus, who was probably quite Earth-like a few billion years ago.
Answer: I'd have an equatorial ocean that runs along the equator without major openings to north or south. This would prevent ocean currents from transferring heat away from the equator. Having lots of ocean along the equator would also give the area low albedo and high ability to retain heat.
I think the lands along such equatorial ocean would be very hot and humid.
If that is not bad enough you can totally close off the connections ocean has north or south. The water will then evaporate to large extent creating large areas significantly below sea level. Adiabatic heating will then make these areas very hot. This is presumed to have happened to the Mediterranean.

Uninhabitable Equator


Can a user's reputation be hidden?

Question: How can one hide their reputation? I am pretty sure I came across different profiles with hidden reputation, where their actual reputation was replaced with the number 1.
Answer: As far as I know, the only way that reputation can be hidden (as compared to lost and/or given away) is if a user is suspended; suspended users have their reputation displayed as "1" for the duration of their suspension. When the suspension is lifted, their reputation is restored.
Comment: Hmm... That's a shame, because I can see some really good answers provided by suspended users who seem to have been pro-active on the site at some point in time.
Answer: In addition to goldPseudo's answer which discusses suspension, we can...

Stop reputation showing on our devices:  It's possible to locally hide reputation from view by using a script, e.g., Hide all pointless user data (gravatar, badges, and reputation).  The reputation will still exist and everyone else will still see it, but on the device the script is installed on it won't display.  The motivation behind this is to avoid voting based on the answerer's reputation.
Give away reputation: I've occasionally seen users who prefer not to have high reputation (e.g., in order to avoid seeing all the deleted posts), in which case, reputation can be given away in the form of bounties.
Create a new account:  I recall a user at math.SE who created a new account each time they reached a high enough reputation; it was quite confusing at times.
Comment: Can I know that math.se user? Thanks
Comment: I don't really remember; it was maybe 3+ years ago now (and I had another account back then too), but I recall times when an apparently new user would start answering meta questions with familiarity of the site's workings.  (This would be an extreme case, and probably not the best thing to do.)
Comment: Thanks. I wonder if if too much reputation give away would result in losing privileges gained along with reputation?
Answer: The primary reason for these instances of "1" rep on established accounts is laid out in goldPseudo's answer. Not mentioned there however is that such suspensions are always temporary and in the hopes that the user will fix whatever problem led to the suspension when participating in the future. Each user's suspended account will show a banner at the top that shows a category reason (without specifics) for why the user was suspended as well as the date when the suspension will be lifted.
The exact reasons for suspensions is only visible to moderators (and SE staff who audit them) and are not given out publicly to other users. Also the posts or comments which let to needing a suspension are usually cleaned up as well, so don't make the mistake of thinking that just because you see good posts from a user that their suspension was unjustified. The problematic posts have been removed and what you see left is the good ones.

Can a user's reputation be hidden?


Is there an equivalent to Arrow's Impossibility Theorem that applies to systems where voters can give multiple candidates the same ranking?

Question: Arrow's Impossibility Theorem very specifically applies only to rank-order voting systems. All candidates must be ranked in order, with no two candidates being given equal rankings. Has there been any analysis of how the results might change if ties are allowed, both in the voters' rankings and in the final societal preference? Does this change allow for a system that meets Arrow's criteria of unrestricted domain, non-dictatorship, Pareto efficiency, and independence of irrelevant alternatives?
Comment: You need to consider whether you still have dictatorship if the dictator can give equal ratings to two choices but society can give different ratings: for example a "delegated" rule which follows A's preference, except when A is indifferent in which case follow B's preference to split them, except when B is indifferent in which case follow C's preference ... etc (and only mark choices as equal if everybody does so).
Answer: Cardinal utility methods like Range Voting (and the simplest case of it, Approval Voting) can meet all four of Arrow's criteria.
However, "independence of irrelevant alternatives" is dubious because the range of a voter's preference scale is sensitive to the introduction of an extremely good or bad candidate.  For example, a voter who in a two-candidate election, might vote:

Bush: 10
Gore: 0

could, in a three-candidate election, equally sincerely vote:

Bush: 10
Gore: 8
Zombie Josef Stalin: 0
Answer:
All candidates must be ranked in order, with no two candidates being given equal rankings.

This is not correct. Arrow always considers the possibility of voters being indifferent on some alternatives. This may be often omitted or hidden in popular descriptions because it just complicates some descriptions (and in particular on the mathematical level).
From Arrow's A difficulty in the concept of social welfare (boldface mine):

It is assumed further that the choice is made in this way: […] the chooser considers […] all possible pairs of alternatives, say x and y, and for each pair he makes one and only one of three decisions: x is preferred to y, x is indifferent to y, or y is preferred to x.


JSON from wget outputs extra white space and new line after { at beginning of the output file after

Question: I am able to wget a URL which already has data in JSON format.  However when viewing the output file there is extra whitespace and newlines, which is causing issues when trying to decode the JSON.
If I just copy and paste the page contents directly from a browser to a .json file the format is perfectly fine.
How can I ensure that wget outputs the page in the exact format it is displayed in, which is json format?
Sorry I have to obscure the actual data due to privacy concerns, but the issue should still be illustrated.
Command used:
wget --load-cookies=/home/cookies.txt --header "Accept:application/json" "https://url.com/url/json?" -O output.json

Snippet of the output format, notice the multiple lines, I included those from vi just to illustrate.  The actual output does not include those line numbers:
  1
  2     {
  3       "callback": ["callback"],
  4       "attributes": ["xxx", "yyy", "zzz", "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg"],
  5       "types": ["string", "date", "string", "string", "string", "number", "number", "number", "string", "string"],
  6       "records": [["1", "2013-04-03", "blabla", "um", "yes", 1, 0, 0, " 5h 0m", "-1m"], ["2", "2013-04-03", "blabla", "er", "no", 0, 1, 1, " 5h 0m", "-1m"],

Answer: Ended up using tr -d "[:space:]" on the entire output and got the file into a format that works.


How to access network without NetworkManager?

Question: If I don't have NetworkManager installed on Debian, I edit "/etc/network/interfaces" and then run ifup eth0. I see that things are different in Fedora 14 (the directory and the command aren't available). How do I do it?
Comment: welcome to the world of learning another distro, and what the real differences are. :P p.s. you don't have to, but I leave questions unanswered for ~24 hours, it gives people a chance to review and upvote things, as peopled tend to look at answered things less I've found.
Comment: @xeno I get it. Well... in this case the solution worked immediately. Not doubts :)
Comment: often they do, I just do it so everyone has a chance to earn points I don't *think* [this Q&A](http://unix.stackexchange.com/q/5980/29) would have gotten the upvotes it did had I accepted the answer the 5 minutes after I was told the 1 wrong character I did. but as I've said, you can do this however you want, unlike accepting your own answer there's no limits on when you have to do a regular answer. It also gives people a chance to write even better answers.
Comment: @xeno BTW I never hesitate to change Accepted answer whenever a nicer one pitches. Also, luckily Gilles doesn't care whether there already is an accepted answer or not.
Comment: right... I just started doing it because it seems to keep more people (maybe not @gilles) interested for longer. about 1 day  is the max though.
Answer: You can continue to use the 'network' service.  Just run
sudo /sbin/chkconfig network on

and
sudo /sbin/service network start

and it will start the interfaces that are set up in /etc/sysconfig/network-scripts/ifcfg-*.  You might want to check the settings in those files to make sure that the interface you want to start automatically on boot is set "ONBOOT=yes".  For an interface to edit those files, you can use 'system-config-network' which is part of the system-config-network package (if not already installed).
Comment: This is out of date these days. Ever since systemd it's `sudo /usr/bin/systemctl enable network.service` and `sudo /usr/bin/systemctl start network.service`.
Comment: Yep, I realize that. My comment was more a matter of "This information is old and it's different now." than "Hah, you're wrong, it's this way!". I found it while searching for this information myself, and I just wanted to make sure it stayed up-to-date for future readers.
Comment: Yes, in later versions of Fedora, that's correct.  This was posted in January of 2011, about Fedora 14, which didn't include systemd.


libnfc: "No NFC device found."

Question: I use RC-S330 for my development with libnfc and it works well. When I run 'nfc-list', 'NFC device: Sony /  - PN533 v1.48 (0x07) opened' appear.
Recently I bought a RC-S320 and tried to run 'nfc-list', but 'No NFC device found.' appeared.
When I look 'lsusb',
the result for RC-S330 is:
<code>          Product ID: 0x02e1
          Vendor ID: 0x054c  (Sony Corporation)
          Version: 1.30
          Speed: Up to 12 Mb/sec
          Manufacturer: Sony
          Location ID: 0xfa130000 / 6
          Current Available (mA): 500
          Current Required (mA): 200
</code>
the result for RC-S320 is:
<code>          Product ID: 0x01bb
          Vendor ID: 0x054c  (Sony Corporation)
          Version: 1.28
          Speed: Up to 1.5 Mb/sec
          Location ID: 0xfd120000 / 4
          Current Available (mA): 500
          Current Required (mA): Unknown (Device has not been configured)
</code>
How can I use RC-S320 with libnfc?
Answer: Looks like the RC-S320 is not on the supported hardware list: http://nfc-tools.org/index.php?title=Devices_compatibility_matrix

libnfc: "No NFC device found."


div background color, to change onhover

Question: I'm trying to make a div's background color change on mouse over.

the div {background:white;}
  the div a:hover{background:grey; width:100%;
  display:block;  text-decoration:none;}

only the link inside the div gets the background color.
what could I do to make the whole div get that background color?
thank you
EDIT :
how can I make the whole div to act as a link - when you click anywhere on that div, to take you to an address.
Comment: Try this link http://codebins.com/codes/home/4ldqpc0
Answer: The "a:hover" literally tells the browser to change the properties for the -tag, when the mouse is hovered over it. What you perhaps meant was "the div:hover" instead, which would trigger when the div was chosen.
Just to make sure, if you want to change only one particular div, give it an id ("
") and use the CSS "#something:hover {...}" instead. If you want to edit a group of divs, make them into a class ("
") and use the CSS ".else {...}" in this case (note the period before the class' name!)
Answer: Using Javascript

  Jack and Jill went up the hill To fetch a pail of water. Jack fell down and broke his crown, And Jill came tumbling after.

Answer: There is no need to put anchor. To change style of div on hover then
Change background color of div on hover.

.div_hover {
  background-color: #FFFFFF;
}

.div_hover:hover {
  background-color: #000000;
}

 Change div background color on hover

Answer: To make the whole div act as a link, set the anchor tag as:
display: block

And set your height of the anchor tag to 100%.
Then set a fixed height to your div tag.
Then style your anchor tag like usual.
For example:

    <title>DIV Link</title>

        Stack Overflow

        Stack Overflow

Good luck!
Answer: html code:
    <!DOCTYPE html>

    <title>this is your web page</title>

css code:
    .nicecolor {
      color:red;
      width:200px;
      height:200px;
     }

    .nicecolor:hover {
      color:blue;
     }

and thats how youll change your div from red to blue by hovering over it.
Answer: Set
display: block;

on a and give some height
Answer: simply try "hover" property of CSS. eg:

 hello there

i hope this will help
Answer: You can just put the anchor around the div.

this is a div

and then
a.big-link {
background-color: 888;
}
a.big-link:hover {
 background-color: f88;
}

Answer: you could just contain the div in anchor tag like this:

a{
  text-decoration:none;
  color:#ffffff;
}
a div{
  width:100px;
  height:100px;
  background:#ff4500;
}
a div:hover{
  background:#0078d7;
}

Hover me

Answer: Just make the property !important in your css file so that background color doesnot change on  mouse over.This worked for me.
Example:
.fbColor {
    background-color: #3b5998 !important;
    color: white;
}

Comment: You should try to attach some more details to the answer, as this is surely not fully answering the question.

div background color, to change onhover


Runtime Error in Visual Simulation Environment - Microsoft Robotics Studio

Question: I am using Microsoft Robotics Studio for a school project and I am getting a strange error when I try to run the Visual Simulation Environment. It was working fine until yesterday and then suddenly it gave me a runtime error saying "Illegal command line arguments... do not use VPLHost directly, use dsshost instead to run a manifest" But I am only clicking on Run in VPL/DSS Manifest editor.
I am running MRDS as administrator and I even tried re-installing MRDS but it is still showing the same MS VPL Runtime error. I tried to search online, but cannot find any suitable solution.
I already tried running the existing samples, I.e. Urban Environment, Multiple Simulated Robots etc. but it still gives me the same error. The strange thing is that it was working perfectly one minute, and then started giving me this error message the next minute, when I had not changed anything in between. In fact, I had wanted to change something in my manifest, so I closed the running VPL application, closed VPL and opened DSS manifest editor, and ran my manifest and that is when I got this error.
What is going wrong? Is some MRDS script using vplhost32.exe instead of dsshost? If so, then where and how do I change it?
I tried running the urban envrionment manifest from the command prompt and Using DSSHost32 directly. This time, it didn't give me a runtime error but an intiialization error. I tried changing port numbers but it still doesn't work. I have deleted many files from my computer to free space (JIC) and it still doesn't work. The window just doesn't open even when I hover over it in Windows 7.
The error message looks like this: Only one usage of each socket address (protocol/network address/port) is normally permitted."
This was even after I checked netstat for free ports and tried but I get this error message. Its either this one or the "Don't use VPLHost directly" if I run it through VPL or DSS Manifest Editor.
Could it be that some external services are interfering with DSSHost/VPLHost? Are there any such services which I could try killing? ANY help/suggestion would help right now as my project is due Thursday and this is a really unfortunate time for it to be acting up like this.
Answer: Does the problem reproduce after logging off & logging back on?  It's likely that you had a process hanging around that you weren't aware of.  Logging off should shut down any processes you personally started.


How to check if the current page is the permalink page?

Question: Do any of you know a way to check if the current page is the permalink admin page?
Comment: Does this answer your question? [How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?](https://wordpress.stackexchange.com/questions/7278/how-can-you-check-if-you-are-in-a-particular-page-in-the-wp-admin-section-for-e)
Comment: What's the problem this is trying to solve? You may not need to know this and use dedicated actions and filters depending on what you're doing
Answer: <?php
// 'current_screen' action fires after the current screen has been set
add_action( 'current_screen', 'my_check_current_screen' );

// $current_screen is WP_Screen object passed by the 'current_screen' action
function my_check_current_screen( $current_screen ) {

    // compare current screen ID to the string of your choice
    if( 'options-permalink' === $current_screen->id ) {
        echo 'I am on the "Permalink Settings" screen';
    }
}

You can check what you can play with using the 'current_screen' action instead of global $pagenow:
add_action( 'current_screen', 'my_print_current_screen_object' );

function my_print_current_screen_object( $current_screen ) {

    echo '
';
    print_r( $current_screen );
    echo '
';

}

Answer: Try below lines into your function.
global $pagenow;
echo $pagenow; // This should give you current page of admin page

Answer: I don't know exactly what you want to do. But basically, you can use:
is_page( 'contact' )  // To see if this page is the page contact
is_singular( 'post' ) // To see if this is a spefic post type
get_permalink() // To get the permalink of a post inside the loop
global $pagenow // To get the page you are now
If you explain better what you want, it is easier to offer a better answer.


What is an "Image" - Linear Transformation

Question: Pretty simple and straightforward. I just need to clarify what an image really means. Is it simply the result of applying a transformation on a vector x ?
Moreover, what does it mean to find a standard matrix; I fail to understand the reasoning behind applying the transformation on the standard basis e -- is it the conventional way to do it, does it always work?
Comment: Do you understand set-builder notation?  If so then the image is defined like this: Let $T: V \to W$ be a linear transformation, then $\operatorname{image}(T) = \{w \in W \mid w= T(v)\text{ for } v\in V\}$.  The reason to find the standard matrix representing a transformation is that the standard basis is super easy to work with.  For instance if $A$ is any matrix and $\mathbf e_i$ is the $i$th standard basis vector of $\Bbb R^{n\times 1}$ then $A\mathbf e_i$ is the $i$th column of $A$ (prove this for yourself).
Comment: Or in words: the set of all possible values for $T$, the image of the definition set through $T$.
Answer: It's usually conventional to say that the "image" of x under a linear transformation is the effect of the transformation on vector x.
To find a standard matrix means to find a matrix that implements the map. It's reasonable to apply the transformation to the standard basis e because it's an orthonormal basis, something we like. So all you have to do is map the basis vectors, by applying the transformation to them. This would be your standard matrix. (eg. T( [1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1] ), for R^4). Hope this answers your question!


Numbers has stopped showing up in Launchpad

Question: Numbers has stopped showing up in Launchpad. How can I add it back?
Comment: Is it still installed in /Applications? Did you search through all pages of Launchpad?
Comment: Yes, it's still installed in /Applications and runs properly. I performed a search within Launchpad and it's nowhere to be found.
Answer: Just type your application name in Launchpad's search box found near the top of every Launchpad screen. The icon for the desired App should be displayed on a new screen by itself - click and drag it to the desired location in Launchpad.
A commandline call may help as well - but be warned that it'll rebuild the Launchpad from scratch and will remove  any customizations you've added:
<code> rm ~/Library/Application\ Support/Dock/*.db; killall Dock
</code>
Comment: The Launchpad rebuild did the trick. :)


Peeking behind ember-cli (EmberApp): vendor.js and app.js

Question: With the excellent broccoli-stew I can take a look at the exported application tree:
/* global require, module */

var EmberApp = require('ember-cli/lib/broccoli/ember-app');

var log   = require('broccoli-stew').log;
var debug = require('broccoli-stew').debug;

var app = new EmberApp();

// Use `app.import` to add additional libraries to the generated
// output files.
//
// If you need to use different assets in different
// environments, specify an object as the first parameter. That
// object's keys should be the environment name and the values
// should be the asset to use in that environment.
//
// If the library that you are including contains AMD or ES6
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.

app.import('bower_components/ember-i18n/lib/i18n.js');
app.import('bower_components/raphael/raphael.js');

var finalTree = log(app.toTree());

module.exports = finalTree;

With this I get a very clean tree-like output of my application:
[ 'assets/app.js',
  'assets/app.map',
  'assets/app.scss',
  ...
  'assets/vendor.css',
  'assets/vendor.js',
  'assets/vendor.map',
  'crossdomain.xml',
  'index.html',
  'robots.txt',
  'testem.js',
  'tests/index.html' ]

I see that in that tree we have, among other files, a vendor.js and an app.js modules (as expected), but I do not know what packages are put into each of them.
I have the feelling I am missing one in my frontend (in this case, raphael.js), so I would like to verify that ember-cli (via EmberApp)  has indeed done what I asked for (namely, include the raphael.js, probably in vendor.js)
Taking a direct look at app.js or vendor.js is not feasible (too big / don't know what to look for). I want a simple tree-like display of the files that have been included by EmberApp into vendor.js / app.js, in the same (similar) format that broccoli-stew is providing.
Is this possible? How?
Answer: To quote http://www.ember-cli.com/asset-compilation/#configuring-output-paths:
Assets                                          Output File
JavaScript files you import with app.import()   /assets/vendor.js

So although that is not a nice tree view, you should be fine :-)
Comment: That is what I *tell* EmberApp to do, not what EmberApp *does*. It is hopefully the same, but in my case that was *exactly* what I was not sure about. I wanted an independent way of listing the contents of `vendor.js`, and `app.js`.
Comment: If you really want to see what Ember is doing, have a look at the source of the function: https://github.com/ember-cli/ember-cli/blob/master/lib/broccoli/ember-app.js#L1205. Open Source <3
Comment: By the same reasoning, I do not need `broccoli-stew`, or a debugger, or ... Just look at the code! And still, those tools are very useful. Anyway, I assume there is no way of listing the contents of `vendor.js` and `app.js` once they habe been generated.


iPhone iOS Dropbox SDK how to sync in background?

Question: I'm working with the CHDropboxSync example and got it to perform sync of my core data over to dropbox and back. It uses RestKit for object mapping. The current implementation relies on DBRequest for network operations, and is not background - task friendly.
Has anyone managed to get dropbox to sync files in background on iPhone?
How can I get a list of DBRequests to execute once an application enters background mode? Is there something within the Dropbox SDK, like a request queue, that can be easily configured to continue executing in background?
I'm looking at ASIHTTPRequest, because it is capable of continuing in the background, but it seems like I'll have to rewrite quite a lot of code if I want to use that with the dropbox SDK.
I would imagine that including core data into the equation makes things a lot more complicated due to the whole NSManagedObjectContext and threading issues.
Thank you for any input! I'm very new to network based file synchronization, and would appreciate if someone can point me to a demo project that deals with dropbox sync in background.
Comment: `ASIHTTPRequest` is a dead project, you should not consider that for this or other projects that you are starting.
Answer:
The backgrounding stuff could be found here (Try using it with GCD): Background tasks iPhone
While CHDropboxSync probably fine, look into writing your own syncing code: Basic Syncing Algorithm
Try doing manual requests with the Dropbox REST API if you can't get the Dropbox SDK to do it. See MGTwitterEngine for how to do OAuth and such.


How to achieve a smooth slide in transition in Premiere?

Question: I'm a beginner in video editing and I would like to apply a similar transition to my project. Do you have any suggestions on how to do it in the best way?
I have tried to use After Effects but I am not sure which program will do better.
Answer:
(The animation above is at 15fps to reduce file size, so won't playback smoothly).
The example you've shown looks as though it might be from a web page, in which case it might have been made using CSS animations.
If you want to make something similar using After Effects, you can animate it like this:
Make a layer of text, centre it on the screen.
Right click on the position control on the text layer and check "Separate Dimensions".  This makes it easier to only animate the horizontal (x-axis) position of your text, especially when working with Curves (see below).
Animate your position keyframe, so that it begins off-screen, then comes into your original position.  Add another keyframe to hold it there for a few seconds, then animate it off the other side.
With the X position control selected, click on the Curves button

You should be able to adjust the curve of the x-position so that it forms nice "S" shapes.  This will make the text slow down as it enters and leaves in a smoother more natural way.  See easing for more info.
Click the Curves button again to turn off the Curves view.
Now go into the Text controller and click on the "Animate" button

Choose Tracking.
Go to the beginning of your timeline.
Set the tracking type to "Before", and keyframe it.
Set the tracking amount to 45 and keyframe it.
Move along your timeline until the text is in view.
Set another keyframe to adjust the tracking to zero.
Move along your timeline to where your next Position keyframe is.
Set another "Tracking" keyframe (at zero), and set the Tracking Type to "After".
Move along your timeline until the text has moved off-screen, and set another tracking keyframe to "45".
Now click on the Tracking Amount control and click the Curves button again.
Again, make the curves look like nice S shapes:

Turn off the Curves view, and tweak the positions of all the keyframes until it looks right.


Three-way interaction and no two-way interaction

Question: I was wondering in anova whether it is possible to have a three-way interaction without having any two way-interaction.
Does it make any sense to hypothesize this?
Does it make any sense to hypothesize that there is an intercation but no main effect?
Answer: Sure. It's easier to write about your last question (interaction with no main effect) so I will do that, but the logic is the same.
One way for this to happen is if one independent variable is dichotomous and the other continuous and the relationship between the continuous IV and the DV is in opposite directions for the two levels of the other IV.
Comment: Would it be reasonable to say that, even though interaction terms without main effects (and higher order equivalents) are possible _in principle_, the type of mechanisms we see in science and social science _tend_ not to show this behaviour, such that one should be _extra weary_ of overfitting when this is observed?
Comment: I think you should look at it on a case by case basis.


Are third party DSLR batteries significantly less reliable than the official ones?

Question: The official Canon battery for my camera (LP-E17) costs around $55 while third party batteries sell for about $20. Are Canon's official batteries really worth the price or would I be okay getting an aftermarket product?
Comment: Probably a more generic duplicate that is a closer match to this question: [Should I buy an original manufacturer battery, or is a generic brand OK?
up vote](https://photo.stackexchange.com/q/1339/15871) or
Comment: For what it's worth, I had a decent 3rd party additional battery for my EOS 6D, and it just doesn't have the power for video recording. After a few seconds of recording, the camera power just cuts out
Comment: @laurencemadill For what it's worth, [Should we encourage / allow comments with helpful advice to questions we know will be closed?](https://photo.meta.stackexchange.com/q/4797/15871)
Comment: @MichaelClark ok thanks, I won't be offended if you delete my comment  if you feel it's not suitable
Answer: I have purchased quite a few backup batteries for both Canon and Sony and never had issues, but I think it helps to look for brands that have had enough sales (on Amazon or a similar site with user reviews) to avoid the "bad ones". Definitely do not go for the cheapest you can find if there are any hints that it could be a compromise in quality. If the battery leaks or blows up or somehow damages the camera, your cheap battery will end up being quite pricey, so err on the side of caution. The other thing that works well is to charge your camera, inside your bag, when you wouldn't otherwise be able to plug in. You can use an inexpensive external USB battery without voiding your camera warranty and for a fraction of the price. And high-capacity USB batteries can recharge a camera battery several times.


Asus RT-N12 router + modem, my ISP needs PPPoA but the router only seems to do PPPoE?

Question: Any idea what's going on here? I plug my modem into the router, and apparently to configure it I need to put my settings into the router, but PPPoA is not in the dropdown, only PPPoE and PPTP. What do I do?
Comment: @Kyle: He can install Tomato on that router.
Comment: Sadly you may have to get a new router... either that or it's possible the PPPOA settings are hard coded into the modem. Are you able to get a connection if you set your router to automatic?
Comment: @paradroid I don't know know anything about that router specifically. But if it has the ability to run custom firmware that should fix it.
Comment: @Kyle: Actually, I am not sure if Tomato does support PPPoA after all, so I have deleted my answer.
Comment: @paradroid good call, I upvoted you on faith since I know your previous answers are of high quality. I assumed dd-wrt and tomato would both support pppoa(e)But I guess it's better we not spread false info before testing...
Comment: DD-WRT supports PPPOE
Answer: It turns out that the ADSL modem is a PPPoA bridge device, the ADSL service itself is PPPoA, and the modem bridges it to PPPoE. So plugging them together works fine. The reason it didn't work is because their tech support people said that the modem is just a dumb device that has no configuration, it simple bridges the two.
After many hours of frustration, I contacted them again and a different rep said to just plug it in, force my IP to 192.168.1.2 and point my browser to 192.168.1.1. Then I could configure it. It literally had 3 settings that I set to those my ISP instructed, and instantly the whole thing worked.
Note: I installed DD-WRT onto the router before even buying the adsl modem (The reason for getting the N-12:), I don't know if it was a necessary step but I doubt it after configuring the modem fixed it.


How to customize sql server agent jobs

Question: I need to be able to schedule a job on the 10th of each month and have it run for a set number of days or until a specified date.
Is there any way to customize sql server agent jobs using some sort of API or something?
Thanks.
Answer: You can accomplish using the SQL Job Schedule properties by using more than one schedule for the job. You can schedule the job to run on the 10th day of the month (with the option for an end date). You can then create multiple schedules, one for the 11th, 12th, etc.
Answer: The SQL Server Agent does not have a schedule option like you need, so I think your workaround is as good as it gets for keeping it inside SQL Server.
The Windows Task Scheduler however does have an option to run a job on the 'x' day of the month, maybe kicking your sproc off using sqlcmd via Windows Task Scheduler is an alternate solution?
Hope this helps
Answer: I still can't find any way of customizing the job schedule, but I have figured a way around it by adding the condition to the job step:

IF (DAY(GetDate()) >= 10)
      EXEC MySP

And setting the schedule to run every day.

How to customize sql server agent jobs


What does 'highly non linear' mean?

Question: I often read about a function being 'highly non linear'. In my understanding, there is "linear" and "non-linear", so what is this 'highly' about? Is there a formal difference from non linear? How is it defined?
Comment: Informally: "Don't expect to be able to easily map change in input to change in output."
Comment: Did you read this in a paper about Deep Learning? Highly non-linear function approximation is one of the motivations for deep learning because a shallow network has a hard time modeling the kinds of things Joe describes in his answer.
Comment: I would say it depends on where you read it. If this is written by math-savvy people, then it could mean what answers here (so far) provide. If it was written by a practitioner, like a medical doctor or a biologist, it could mean the relationship is not straight, but highly curved. In my experience, most people think linear regression refers to fitting straight lines to data, which could be part of source of the confusion.
Comment: It's not a singly defined term -- a physicist will tend to take a quite different meaning from the term than a cryptographer would. Without more context this question can't be properly answered -- we'd be guessing the context (or we'd have to account for every distinct one).
Comment: If one of these answers helped you understand this issue, consider accepting it by clicking the check mark to its left under the vote total.
Comment: No, I didn't @NeilG.
Answer: I don't think there's a formal definition. It's my impression that it simply means that not only is it non-linear, but attempting to model it with a linear approximation won't yield reasonable results and may even cause instability in the fitting method. Someone may also use it to simply mean that small input changes can result in counter-intuitively large changes in output.
Comment: (+1) for offering a very sensible criterion/content for "highly non-linear" (that linear approximation may make matters worse).
Answer: In a formal sense, I believe one could say that the second derivative differs substantially from zero.  If 0 were a "reasonable" approximation to the second derivative over the domain of interest, it is close to linear, but if it's not, the nonlinear effects become very important to capture.
I've rarely heard terms like this apply to relatively simple polynomials, often in practical use it seems to apply to divergent dynamical systems (chaos-theory sort of things), or very non-smooth functions (where much higher-order derivatives are nonzero).
Comment: Btw, "smooth" really is a technical term, meaning that every derivative exists. `x -> e^x` is smooth even though its derivatives of all orders are everywhere non-zero :-)
Answer: The important aspect missing from the other excellent answers is the domain.
E.g., $f(x)=x^2$ is

highly non-linear on $[-10;10]$ but
not on either half of the domain (i.e., on both $[-10;0]$ and $[0;10]$ one can possibly use a linear approximation of $f$ without an immediate disaster).

Another example is $f(x)=x^3-x$ which is

highly non-linear on $[-1;1]$ but
not on the larger domain $[-10;;10]$
Comment: @Aksakal: the function is certainly not linear (anywhere), but, as I said, "one can possibly use a linear approximation of f without an immediate disaster"
Comment: Any function can be approximated by a line, it's only a question of how bad the approximation is.  And in x \in [0, 0.5], the error isn't that bad.
Comment: I disagree about $x^2$. It's always highly non-linear around 0. Consider $x =[0.1,0.2,0.3]$, where $f(x)=[0.01,0.04,0.09]$. How is this linear to you? It doesn't even have linear term (obviously), it can't be approximated linearly at all.
Answer: As other mentioned, I don't think there's a formal definition. I would define it as a function which can not be approximated linearly in the typical range of disturbances to the argument. For instance, you have $y=f(x)$, and $\sigma^2=var[x]$. Then if the approximation $f(x+\sigma)\approx f(x)+f'(x)\sigma$ breaks down, then it's highly non-linear. For instance, $f(x)=exp(x^2)$ would be highly non-linear for any $x$ around zero, because its Taylor series are $1+x^2+x^4/2+O(x^5)$.
Answer: Informally ... "highly non linear" means "even a blind man can see its not a straight line!" ;) Personally I take it as a danger sign, that it will somehow "blow up in your face" when used with real world examples.
The Tower of Hanoi could be called an example of highly non linear ... the legend being when the monks finish a 64 disk stack, the world will end. If you count total time spent in training, feeding, housing, and motivating everyone to support a thankless boring pointless multi-generational task, I would expect the total cost in man hours to really blow out!
Answer: As professional mathematician I can confirm that "highly nonlinear" is not a mathematical precisely defined term. :)
And none of "highly anything" I can think of.
Nonlinear is precise and opposite of linear (obviously).
But linear occurs in two different meanings:

$f(x) =  ax+b$ is called linear function
only function $f(x) = ax$ (with no constant term $b$) is called linear

To emphasize the difference and presence of the constant term, the first function $(ax + b)$ is also called affine
Comment: Hitherto, this is the only answer, I will agree ;) (+1) for being old-school!
Answer: For smooth functions, we usually say that something is "highly" nonlinear if the magnitude of the second derivative (or perhaps the curvature) is high.  A linear function has zero second derivative and zero curvature, so it represents the extreme of low curvature.
Answer: As other answers said, there isn't a formal definition of the term from the mathematical point of view. But it has to do with the existence of the non zero derivative (the order) of the function.
A function that can be defined as being linear is some function $f(x)$ that can be described by a polynomial $P_n(x)$, even if the degree $n$ of the polynomial is big. That's because the total number of derivatives of the function that can be defined are finite (because the degree of the polynomial is finite).
But those functions that can only be described by other functions with infinite derivatives (infinite order) are said to be "highly nonlinear". For instance a function described by a exponential function who's derivatives of all orders are defined.
The word "highly" is prefixed to differentiate the function with regular polynomials of degree major or equal than 2 that are considered non linear functions (although polynomials of degree equal or major than 2 are considered "linear" from the linear algebra point of view given that they can be expressed in terms of a linear combination of the polynomial basis).
Related to all this has to do the domain of the function. As others said some functions are "more linear" in some intervals than in others. That's because the polynomial approximation theorem. Every real function can be exactly reproduced by a polynomial but that approximation at times involves a greater degree, some times the degree tends to infinity as with a power series. In that later case the function is said to be "highly nonlinear" because the existence of its infinite derivatives.

What does 'highly non linear' mean?


Meromorphic functions a constant sheaf?

Question: Is the sheaf of meromorphic functions on a (connected) compact Riemann surface constant? I am refering here to meromorphic functions in the sense of complex analysis and not to those of algebraic geometry, where I know this to hold. I do not imagine it to be the case, but then how does one go about proving the correspondence between divisors and invertible sheaves? The algebro-geometric proof I know (the one in Hartshorne) relies crucially on the sheaf of meromorphic functions being constant ...
Answer: No, the sheaf of meromorphic functions on a Riemann surface is definitely not constant.
For example if $X=\mathbb P^1(\mathbb C)=\mathbb C\cup \{ \infty \}$ the restriction map $res:\mathcal M (\mathbb P^1)\to \mathcal M (\mathbb C)$ is not surjective.
Indeed the exponential function $exp(z)=e^z$ satisfies $exp\in \mathcal M (\mathbb C)$ but is not in the image of $res$ since the exponential function has an esssential singularity at $\infty$ and is thus not meromorphic there.
Aside
Actually  meromorphic functions on a compact Riemann surface are rational: $\mathcal M(X)=Rat (X)$.
This is a special case of the so called GAGA Principle and  reinforces the above argument since it then follows that actually $\mathcal M( P^1(\mathbb C))=\mathbb C(z)$.
However I didn't want to invoke that more advanced result in my elementary proof at the level of an introduction to function theory of a complex variable.
Comment: Dear Georges, you are absolutely right. I went over my old Riemann surface notes (taken from Miranda's book) to see why I remembered this fact incorrectly, and I see that Miranda defines two types of holomorphic/meromorphic sheaves: algebraic and analytic. Since in algebraic geometry one is used to the meromorphic function sheaf (that is, the rational function sheaf) being locally constant, I somehow fused the algebraic and analytic sheaves into one in my mind. Thank you very much for your clarification.
Comment: Dear Robert, I'm impressed by the  honesty shown in your comment. We all make mistakes but not all of us admit it as gracefully as you.
Comment: Dear Georges, thank you for your kind words.

Meromorphic functions a constant sheaf?


How to program ATmega8U2

Question: I was given an ATmega8U2 chip by my friend and I have been doing a bit of research about  it. It says it does not come with a pre-programmed with a boot loader, so I was just interested about how to go about getting a c program on there? Do I have to download a boot loader to the chip or something?
Answer: You need a programmer/debugger. Atmel (now Microchip) sells a suitable device, or you could use an Arduino with suitable software as a programmer only. The latter will be a lot cheaper.
Comment: For single-chip hobbyists you're right, but the ATATMEL ICE PCBA kit costs 40 euro at Microchip Direct. AFAIK that's the same as the Atmel ICE I have with AVR and SAM In-Circuit Emulation and debug functions, just not with the plastic box at about half the cost, but officially approved Atmel (Mic). So that should be pretty affordable on an absolute scale. (just adding info before I +1)

How to program ATmega8U2


Viewing black holes?

Question: How could you possibly see a black hole when there are stars etc in front of it and then the matter being drawn into it , all you would view surely would be the objects in front of the black hole ?
Comment: Of course, if there is something in front, you can't see the black hole.  Can you explain why you think there is any doubt about this?  This seems an odd question to ask.
Comment: If something was in front you wouldn't be able to see it directly, but if you observe gravitational lensing you would know a (giant) black hole was there.
Answer: With the emergence of gravitational wave astronomy, it has become possible to obtain a direct view of black holes via their gravitational-wave emissions.
Anything undergoing acceleration emits gravitational waves. In ordinary experience this emission is very small, but when closely packed massive objects interact via their gravity the emissions become large enough to detect even at a distance of a billion light years.
The first gravitational-wave observation in 2015 came from a merger of two black holes in a galaxy $1.4\pm0.6$ billion light years away. The observed  gravitational wave signature matched closely with general relativistic calculations for such a merger. The waveforms are shown below (Wikimedia link):

The involved black holes came in with masses of about 36 and 29 solar masses and the merged black hole came away with about 62 solar masses, the remaining three solar masses being the energy released in the gravitational waves.
Note carefully that although we see the black holes directly via this method, we see them only around the time of their actual interaction. We still need black holes to interact in order to see them, even where gravitational-wave astronomy enables viewing without the use of auxiliary matter or electromagnetic radiation.
Answer: Yesish. Of course you see these foreground objects. Of the black hole itself you can see the photon sphere and its shadow.  Imaging this was awarded with a Nobel prize in 2020. A more elaborate explanation is on the telescopes website: Astronomers Reveal First Image of the Black Hole at the Heart of Our Galaxy
Answer: Black holes themselves are... black. So you don't see them directly, but indirectly from the effect they have on light rays that pass close to them.
These effects include the bending and distortion of light coming from objects behind them and even light rays, emitted from material near the black hole, orbiting the black hole once or more times before escaping towards the observer.
Light from foreground sources will be unaffected by a background black hole. However, if you consider a cone extending into space, filled with a uniform density of stars. It is quite easy to see that if you put the black hole half way along the cone, there will be far more stars behind the black hole than there are in front. The trick to observing a black hole is therefore just to make sure it is adequately illuminated, either from light sources behind it, or from sources of light in its immediate vicinity.
A simulated example of a black hole in front of a dense star field is shown below. In this case, we are so close to the black hole that there are no intervening sources of light. Almost all the light is coming from sources behind the black hole and the light rays from these are distorted in a characteristic pattern that leaves a "shadow" on the foreground field. You can imagine what this would look like if there were a few stars in front of the black hole - it wouldn't really make much difference.

Another example is the Event Horizon Telescope's image (in microwaves) of the supermassive black hole in M87. Here, the illumination is provided by the plasma immediately around the black hole. Some of this is indeed in front of the black hole, but that is of low surface brightness compared to the bright ring caused by light forced into tight orbit(s) around the black hole and what is chiefly visible in this image.

Viewing black holes?


Gap where soffit meets roof

Question: A racoon has been getting in the soffit for the last few weeks.  I have tried trapping him with no success.  The roof is to steep for me to climb up.  A roofer looked at it and didn't know how to successfully close up the gap so the racoon could not get back in.  Does anyone have suggestions on how I can close this permanently?I used mesh cloth on the inside to keep him from getting in the attic but he is just sleeping in the soffitt now.  Any help is appreciated. [
Answer: If you can reach the soffit from the attic, try weighing that corner down with a few bricks and then wedging them down with a 2x4 to straighten out the soffit. It's usually cramped up there but there might be enough room to get your arm through and drop in a few bricks.
Answer: Raccoons are persistent and industrious. I would first remove the problem (raccoon) by calling a wildlife trapper. Sometimes your local government has an agency that will take care of the problem.  Then call a handyman to close the opening. It looks like the soffiting is just bent up out of place where it meets the roof. While getting that repaired ask the service provider to look for any other possible ports of entry and correct those too.

Gap where soffit meets roof


How do I construct a P2TR address if I just want to use the key path?

Question: I want to create a P2TR (Pay to Taproot) address but I just want access to the key path spend, I have no use for the script path spend in this specific example. What should I do in regard to the script path in that case?
Answer: BIP 341 (BIP-Taproot) discusses this example where you don't require the script path.

If the spending conditions do not require a script path, the output key should commit to an unspendable script path instead of having no script path.

The BIP also explains here the rationale for this.

If the taproot output key is an aggregate of keys, there is the possibility for a malicious party to add a script path without being noticed by the other parties. This allows to bypass the multiparty policy and to steal the coins.

Committing to an unspendable script path provides the ability to prove to a third party observer that there is no hidden script path. If there was no tweak at all any key aggregation scheme would need to be revealed to that observer including individual pubkeys to get the same effect (and even this may not be enough for certain key aggregation schemes).
The Bitcoin Optech workshop on Taproot explains that you calculate the tweaked public key using:
Q = P + H(P|c)G

where
Q is the tweaked public key
P is the initial public key (P = xG where x is the private key)
H is the hash function
| is concatenation
c is the commitment to the script path spend
G is the generator point

If you don't need the script path spend you can calculate the tweaked public key using:
Q = P + H(bytes(P))G

where bytes(P) is the serialization of P as defined in BIP 340 (BIP-Schnorr).
This tweaked public key Q will be your Taproot (P2TR) address. Remember we don't hash (tweaked) public keys with Taproot (SegWit v1) like we do with P2PKH, P2SH, P2WSH (SegWit v0).
Comment: How does it work that 'Committing to an unspendable script path provides the ability to prove to a third party observer that there is no hidden script path"?  Couldn't there still be, in the resulting script tree, a hidden script path?  I just don't get what this means.
Comment: @davidbak: You are effectively revealing that there is a single script path that is hashed and this is what is tweaking your internal public key. For there to be additional script paths you are relying on the equivalent of hash collisions. Not only is the tweak the hash of single script path but the same tweak is also the hash of another (potentially multiple encoded in a Merkle tree) script path. So theoretically possible but practically **extremely** unlikely.


Master/Detail help needed for ASP.NET newbie. (screenshot too)

Question: I'm just beinning basic data driven ASP.NET webforms design. I have the first part of a form working, but I don't know what to do next.
Please see this screenshot of what I have created so far:  http://www.twitpic.com/2gnmr
I need help knowing what kind of HTML element to use in the master list, and what event/trigger on that element to use to fire off the "get child records for this selected item" sequence?
Also, is a ListView even the correct way to present the master list? At this time, I'm not trying to provide any editing features; I'll get to that later, I guess.
Should I use some other ASP.NET data control rather than hand-coding a listview like I am doing?
I don't want to see an actual "Select" link item beside each Customer Name (that looks goofy). I want the Customer Name to be the link to click on.
So, you can see in my code below that I have a ListView to present a list of CustomersWithOpenOrders. But, it's just a static list, so how do I make the Company Name label clickable, and what else will I need to make it fire back to some code-behind to fetch the child records. I already have a code-behind method to get child records for a passed-in CustomerNumber into a DataTable, and I think I would know how to bind that to a grid or listview for child records, but I do not know how to pass the CustomerNumber from the master ListView to the method from the UI form.
<asp:ListView ID="ListView1" runat="server">
    <LayoutTemplate>

          Customer

    </LayoutTemplate>
    <ItemTemplate>

          <asp:Label ID="label2" class="FirstLine" runat="server" Text='<%# Eval("company") %>' />

            <asp:Label ID="labelCustNo" runat="server" Text='<%# Eval("custno") %>'/>
            <asp:Label runat="server" Text='Ph: '></asp:Label>
            <asp:Label ID="label3" runat="server" Text='<% # Eval("phone") %>' />

    </ItemTemplate>
</asp:ListView>

Answer: I personally haven't found a case where the ListView can't solve my needs.  If you want to create a customer selection style list you can use a link button for binding.
<asp:ListView runat="server" id="CustomersList" ItemCommand="CustomersList_ItemCommand">
  <LayoutTemplate>

        Customer

  </LayoutTemplate>
  <ItemTemplate>

        <asp:LinkButton ID="link1" class="FirstLine" runat="server" Text='<%# Eval("company") %>' CommandName="Select" />

          <asp:Label ID="labelCustNo" runat="server" Text='<%# Eval("custno") %>'/>
          <asp:Label runat="server" Text='Ph: '></asp:Label>
          <asp:Label ID="label3" runat="server" Text='<% # Eval("phone") %>' />

  </ItemTemplate>
</asp:ListView>

<asp:ListView runat="server" ID="OrderList">

</asp:ListView>

Then you would need to bind the event to the ListView.ItemCommand.
protected void CustomersList_ItemCommand(object sender, ListViewCommandEventArgs e)
{
  if (e.CommandName = "Select")
  {
    if (e.Item.ItemType != ListViewItemType.DataItem) return;

    var dataItem = e.Item as ListViewDataItem;
    if (dataItem == null) return;

    var customer = dataItem.DataItem as Customer;
    if (customer == null) return;

    this.OrdersList.DataSource = GetChildRecords(customer.ID);
    this.OrdersList.DataBind();
  }
}

Comment: Well, I got it working all the way to the point where you are casting the dataItem.DataItem to a Customer type. I am not using typed DataSets or objects, but rather a plain DataSet from a SQL command call. So, how can I get the CustNo out if I set it using a CommandArgument on the LinkButton?
Comment: View it in the debugger. You may have to cast it as a DataRow or a DataViewRow
Comment: It's null in debugger. I finally just used CommandArgument equal to CustId on each LinkButton, then:
string SelectedCustomerId = e.CommandArgument.ToString();
this.lvOpenOrders.DataSource = GetOpenOrdersByCustomer(SelectedCustomerId);
this.lvOpenOrders.DataBind();

Cheating?


Simple four-function calculator

Question: Basically I just wrote this calculator as a sort of JavaScript test for myself. It's a simple calculator with addition, subtraction, and multiplication. I've made some improvements to it before posting this.
At this point I was hoping anyone could just point out some ways I could have cleaned this code up more, basically as an exercise in learning. I've included the JavaScript, followed by the HTML.

    displayNum = "";
    storedNum = "";
    operation = 0;
    queuedOperation = 0;
    calculationFinished = false;

function clearDisplay() {
    // Select the calculator's display
    var display = document.getElementById("display");

    // Clear the global variables and the display
    displayNum = "";
    storedNum = "";
    operation = 0;
    queuedOperation = 0;
    display.value = displayNum;

}

function numInput(num) {
    // Select the calculator's display
    var display = document.getElementById("display");

    // Check if the display is empty and the number being pressed is 0
    // This is to make sure the first number isn't 0 because then javascript thinks we are using OCTAL (Base eight)
    if ((display.value == "") && num == "0") {
    // If it is, do nothing
      return;
    }
    // Check if a calculation has finished
    // If it has replace the number in the display (the answer to the calculation with the number
    // that was just pressed and change calculation finished back to false
    else if (calculationFinished == true) {
        display.value = num;
        calculationFinished = false;
    }
    // if neither of these is the case input the numbers as usual
    else {
      display.value += num;
    }
}

function insertDecimal(dec) {
    // Select the calculator's display
    var display = document.getElementById("display");

    // Loop through the current number to make sure there isn't already a decimal
    for (i = 0; i < display.value.length; i++)
        if (display.value.charAt(i) == '.') {
            // If there is, do nothing
            return;
        }
    // If there isn't add a decimal to the end of the displayed number
        display.value += dec;
}

function setOperation(command) {
    // Select the calculator's display
    var display = document.getElementById("display"),
            displayNum = display.value;
    // eval both the numbers to remove quotes
    // otherwise 4 + 5 will be "4" + "5" which in JS will equal 45
            evalDisplay = eval(displayNum),
            evalStored = eval(storedNum);

    // Check if there is a queued operation
    // If there is a queued operation calculate it
    // Then set the stored number to total of the calculation
    if (queuedOperation == 0) {
        storedNum = display.value;
    }
    else if (queuedOperation == 1) {
        storedNum = evalStored + evalDisplay;
    }
    else if (queuedOperation == 2) {
        storedNum = evalStored - evalDisplay;
    }
    else if (queuedOperation == 3) {
        storedNum = evalStored * evalDisplay;
    }

    // Check what command was put into the calculator
    // Then set the operation to the correct number
    if (command == 'add') {
        operation = 1;
    }
    else if (command == 'subtract') {
        operation = 2;
    }
    if (command == 'multiply') {
        operation = 3;
    }

    // Queue up an operation for enterint multiple  commands without hitting equals
    // i.e. 10x4+8-9+3=
    queuedOperation = operation;
    // Clear the display in order to receive a new number
    display.value = '';
}

function calculate() {
    // Select the calculator's display
    var display = document.getElementById("display");
            displayNum = display.value;
    var evalDisplay = eval(displayNum),
            evalStored = eval(storedNum);

    // Do the math
    if (operation == 1) {
        displayNum = evalStored + evalDisplay;
    }
    else if (operation == 2) {
        displayNum = evalStored - evalDisplay;
    }
    else if (operation == 3) {
        displayNum = evalStored * evalDisplay;
    }
    // Change display to the answer
    display.value = displayNum;
    if (operation != 0)
        calculationFinished = true;
    // Clear all the global variables
    // Necessary in case the user wants to make a calculation using the answer
    operation = 0;
    queuedOperation = 0;
    displayNum = "";
    storedNum = "";
}
<!DOCTYPE html>

            <link rel="stylesheet" href="style.css" />

        <form class="calcForm" name="calculator">
            <input type="text" class="calcDisplay" id="display" />

                <input type="button" class="calcButton" value="7" onclick="numInput('7')" />
                <input type="button" class="calcButton" value="8" onclick="numInput('8')" />
                <input type="button" class="calcButton" value="9" onclick="numInput('9')" />
                <input type="button" class="calcButton" value="+" onclick="setOperation('add')" />

                <input type="button" class="calcButton" value="4" onclick="numInput('4')" />
                <input type="button" class="calcButton" value="5" onclick="numInput('5')" />
                <input type="button" class="calcButton" value="6" onclick="numInput('6')" />
                <input type="button" class="calcButton" value="-" onclick="setOperation('subtract')" />

                <input type="button" class="calcButton" value="1" onclick="numInput('1')" />
                <input type="button" class="calcButton" value="2" onclick="numInput('2')" />
                <input type="button" class="calcButton" value="3" onclick="numInput('3')" />
                <input type="button" class="calcButton" value="x" onclick="setOperation('multiply')" />

                <input type="button" class="calcButton" value="0" onclick="numInput('0')" />
                <input type="button" class="calcButton" value="." onclick="insertDecimal('.')" />
                <input type="button" class="calcButton" value="C" onclick="clearDisplay()" />
                <input type="button" class="calcButton" value="=" onclick="calculate()" />

        </form>

Comment: Your four function calculator only implements three functions.
Answer:
All those globals give me the willies.  Same with the evals.
You're doing math in two places -- in calculate and in setOperation.  Consider that display.value = x; storedNum = display.value; display.value = '' has the same effect as storedNum = x; display.value = ''.  Translation: you can call calculate() from setOperation, and avoid repeating yourself.  It also removes the need for queuedOperation.
insertDecimal loops over the whole string, checking each char for equality with '.'.  Better would be if (display.value.indexOf('.') != -1) return;.  Or even better than that, if (display.value.indexOf('.') === -1) { /* add the dot */ }.
insertDecimal also takes the decimal point as an argument.  This doesn't make sense, since you're not using it to add anything but decimal points.  Lose the arg.
The value of operation isn't obvious.  0, 1, 2, or 3?  Those numbers don't mean anything to me.  You're not limited to numbers; you could use operator symbols, function names, or even functions themselves.  At which point you could get rid of the if/else statements for your math.
The global displayNum is never used.  In fact, displayNum can be eliminated altogether, as its only purpose is to hold the parsed number.  Consider that with the refactoring of operation, you only ever need the value in one place -- and you can convert it right there and avoid having another variable.
The display doesn't work quite right when i calculate 125 + 0 or 125 * 0.  I get the right result, by happy accident.  (An empty string converts to 0.)  But the 0 i entered never shows up in the text box.
You're repeating yourself by setting the globals at the beginning of the script, and then doing the same thing within clearDisplay.  Have an event listener call clearDisplay when the page is ready, and you'll only have one place to change stuff.
Stylewise, having the display clear itself the instant you hit an operator button is kinda jarring.  Calculators typically don't work that way, and if you're going to make one, you should make it work the way people are used to.  Also, the cleared-out box is kinda odd anyway.  When you clear, a calculator typically shows '0'.
Stylewise, i have a personal hatred of comments that say the obvious.  They just add noise.

With that stuff fixed:
function clearDisplay() {
    var display = document.getElementById('display');
    display.value = '0';
    storedNum = '0';
    calculationFinished = true;
    operation = operations.none;
}

function clearPreviousResult() {
    var display = document.getElementById('display');
    if (calculationFinished) {
        display.value = '0';
        calculationFinished = false;
    }
}

function numInput(digit) {
    var display = document.getElementById('display');
    clearPreviousResult();
    // Get rid of a 0 if it's the only thing in there.
    // This particular way of doing it lets you enter a 0 and have it show up,
    // as well as leaving a 0 for the decimal point to snuggle up to.
    if (display.value === '0') display.value = '';
    display.value += digit;
}

function insertDecimal() {
    var display = document.getElementById('display');
    clearPreviousResult();
    if (display.value.indexOf('.') === -1) display.value += '.';
}

operations = {
    // no-op. Takes the right side, and just returns it.  Since the right side is the
    // display value, and calculate() sets display.value, this effectively makes
    // calculate() say "display.value = +display.value".
    none:     function(left, right) { return right; },

    // Math ops.
    add:      function(left, right) { return left + right; },
    subtract: function(left, right) { return left - right; },
    multiply: function(left, right) { return left * right; }
};

function setOperation(command) {
    var display = document.getElementById('display');
    calculate();
    storedNum = display.value;
    if (operations.hasOwnProperty(command))
        operation = operations[command];
}

function calculate() {
    var display = document.getElementById('display');
    display.value = operation(+storedNum, +display.value);
    calculationFinished = true;
    operation = operations.none;
}

if ('addEventListener' in window)
    window.addEventListener('load', clearDisplay);
else
    window.attachEvent('onload', clearDisplay);

Answer: Replace eval(displayNum) with +displayNum - eval executes the value which not only slower it's vulnerable to XSS.
Other than that you would start to look into making you code Object Oriented (OO) to combine code into logical groups and to take the functions and variables out of the window scope. Good Posts:
https://stackoverflow.com/questions/907225/object-oriented-javascript-best-practices
https://stackoverflow.com/questions/1908443/what-are-good-javascript-oop-resources
Answer: Some extra items that have not been raised and are so important.
Declare vars
Every variable must have a declaration. If you dont define the variable it is automatically defined and placed in the global scope. This becomes a major source of bugs, headaches, frustration and madness.
var myVar = 0;

Not
myVar = 0;

Event if you want it in global scope.
Use strict mode
All beginners should have as the very first line of any javascript
"use strict";

It will prevent you from doing what what I mentioned above.
Strict equality and inequality
Javascript has two types of equals and not equals. They are == != and ===
!==. The first two are lazy and will return true if the values are somewhat equal (to hard to explain in a paragraph)
The latter two === and !== are what you should use always, unless you know why you should use the other. Forget you ever saw ==, and != and never use them again.
Blockless blocks.
Blocks after statements can be omitted if you have only one line of code to execute.
 if (something) doFoo();

As opposed to
 if (something) {
     doFoo();
 }
 // or
 if (something) { doFoo() }

The first without the curlys was introduced some time way back and is the dumbest thing to have ever been allowed in any language. We can not remove it from the languages that allow it, too much source already written.
But you risk your coding sanity if you feel you do not need { } for single lines. Because if you make a change adding another line and forget the curls, you have a bug that is so hard to find, hours and days will be burnt for no good reason but lazy fingers. Just use the rule, all blocks are delimited with {} even if you don't have to.

Simple four-function calculator


US visa point of contact

Question: I am visiting a friend in the US who is doing au pair work with a family there. I put her contact details on my DS-160 form as my US point of contact and my visa was denied. Could it be the problem? Should I rather put the contact details of the people she is working for on my form? What else can possibly be the reason for a 214b denial?
Comment: US Visa Refusal unlike UK Refusal letters are unhelpful and posting here will serve no purpose
Comment: There must be some reason why they denied your visa.Pls. post the reason (E-Mail/letter you got).
Comment: @Pikkewyn Can you upload a copy of the refusal letter with your personal details redacted? There is a good overview of possible refusal reasons here http://visarefusal.com/214b/ ranging from simple failure to meet or comply with the requirements, through limited ties to home country, suspicious-looking invitation etc.
Comment: Note to potential close-voters: this is not a question about long-term travel or immigration. The asker wants to get a short-term visa to make a short-term visit to the USA.
Comment: Always ask at the interview for the specific reasons why you are being denied the visa. There is no chance to find out later.
Comment: Thank you Traveller,  the visarefusal.com/214 b helped me although I am still not sure what  the reason for my denial is but will just have to reapply.
Answer: A 214 B denial implies that the consular officer who was examining your visa application was not convinced that you were intending to return to your home country before the expiry of the visa. As explained here on the website of the US Embassy in Mexico, the consular officer has to be convinced that:

Has a home outside the United States that they will not abandon;
Is visiting the United States temporarily and will leave when the stated purpose of travel is complete;
Is able to pay for the trip; and
Meets the requirements of the visa type for which they are applying, and/or that planned activities in the U.S. are allowed by
  that category.

The exact reason for your visa refusal is hard to tell, but will definitely be related the consular officer not being convinced about either or all of the above points mentioned.

US visa point of contact