What do the off-diagonal elements of Hamiltonian matrix physically represent?

Question: A briefly question: what's the "physical meaning" of the off-diagonal elements of Hamiltonian matrix? Such as an Hamiltonian Matraix looks like:
$$\hat H = \begin{pmatrix} E_{11} & E_{12} \\ E_{21} & E_{22} \end{pmatrix}$$
My teacher told me such a matrix element :
$$E_{21}=\langle2|\hat H|1\rangle$$
Corresponding to the transition amplitude from $\left| 1 \right\rangle $ to $
\left| 2 \right\rangle$. I thought about it for days, but I just can't figure it out.
Comment: If diagonal entries exist, $|1 \rangle$ and $| 2 \rangle$ are not eigenstates so we have to worry about one transitioning to the other. Have you seen the fact that $\exp(-i \hat{H} t / \hbar)$ solves the Schroedinger equation?
Comment: @ConnorBehan Yes! You are right! But I have another trouble: I do know this: $E_{21}=\langle2|exp(−i\hat Ht/\hbar)|1\rangle$ represent the transition transition amplitude from $\left| 1 \right\rangle $ to $
\left| 2 \right\rangle$ , But I still have no idea about what's the relation between $\langle2|exp(−i\hat Ht/\hbar)|1\rangle$ and $\langle2|\hat H|1\rangle$, may I have more tips from you please?
Comment: @ConnorBehan I tried use Taylor expansion to expand the evolution operator, but it looks can't help since $\left| 1 \right\rangle $ isn't the eigenstate of $\hat H$ as you said, so there is no such $\langle2|(\hat H)^n|1\rangle$=$\langle2|\hat H|1\rangle^n$, I think I still can't say something about it :(
Comment: Related (duplicate?): [Off-diagonal elements of Hamiltonian matrix $H_{12}$ & $H_{21}$: energy of transition from $|1\rangle$ to $|2\rangle$ or amplitude of transition?](https://physics.stackexchange.com/questions/209350/off-diagonal-elements-of-hamiltonian-matrix-h-12-h-21-energy-of-trans)
Answer: Remember, the meaning of the Hamiltonian in the first place is that it generates time translations via the Schrodinger equation:
$$
i \hbar \frac{\partial}{\partial t} |\psi(t) \rangle = \hat{H} | \psi(t) \rangle
$$
You can formally solve the Schrodinger equation of a time independent Hamiltonian as $| \psi(t) \rangle = e^{-i H t / \hbar} | \psi(0) \rangle$. To gain some intuition, expand the exponential in power series:
$$
|\psi(t) \rangle = | \psi(0) \rangle - \frac{i t}{\hbar} H | \psi(0) \rangle - \frac{t^2}{2\hbar^2} H^2 | \psi(0) \rangle + \ldots
$$
Now, imagine starting off your system in state $|1\rangle$. Then, according to the above equation, if $H$ has off-diagonal elements connecting the state $|1\rangle$ to the state $|2\rangle$, then the Schrodinger equation will generate some amplitude for the system at a later time to be in state $|2\rangle$. The rate at which the state transitions from $|1\rangle$ to $|2\rangle$ will be proportional to $\langle 2 | H | 1 \rangle$, at least to first order in $t$. You can see this by simply using a resolution of the identity, $1 = |1\rangle \langle 1| + |2\rangle \langle 2 |$:
$$
|\psi(t) \rangle = |1\rangle -\frac{it}{\hbar} \left( \langle 1 | H | 1\rangle |1\rangle + \langle 2 | H | 1 \rangle |2 \rangle \right) + \ldots
$$
Comment: The approximation of stopping at $n = 1$ yes. $\left < 2 | H | 1 \right >$ isn't literally the transition amplitude... just its first non-trivial term.
Comment: Thank you so much! I still got one last thing to confirm: since $\hat H$ isn't a diagonal matrix (which means $\left| 1 \right\rangle $ and $\left| 2 \right\rangle $ isn't the eigenstates of $\hat H$ ), this lead to: there is no such $\langle2|(\hat H)^n|1\rangle$=$[\langle2|\hat H|1\rangle]^n$ in Taylor expansion, so we do use some kind of approximation in order to better understanding, then we finally get this: $$\langle2|\hat H|1\rangle\propto \langle2|exp(-i\hat Ht/\hbar)|1\rangle$$ Am I right?
Comment: @Connor Behan Great! Thanks a lot!
Answer: This is similar to Zack's answer, but on a more elementary level.
You need to begin with the time-dependent Schrödinger equation
$$i\hbar\frac{d}{dt}|\psi(t)\rangle=\hat{H}|\psi(t)\rangle$$
Using your given Hamiltonian matrix and writing the state
$|\psi(t)\rangle$ as a column vector this becomes
$$\begin{align}
i\hbar \dot{\psi}_1(t)=E_{11} \psi_1(t) + E_{12} \psi_2(t) \\
i\hbar \dot{\psi}_2(t)=E_{21} \psi_1(t) + E_{22} \psi_2(t)
\end{align}.$$
Now let's assume the system starts in state $|1\rangle$.
That means the starting condition is $|\psi(0)\rangle=|1\rangle$
or
$$\begin{align}
\psi_1(0) &= 1 \\
\psi_2(0) &= 0.
\end{align}$$
Then the solution for small $t$ is
$$\begin{align}
\psi_1(t) &= 1 &-i\frac{E_{11}t}{\hbar} &+ O(t^2) \\
\psi_2(t) &=   &-i\frac{E_{21}t}{\hbar} &+ O(t^2)
\end{align}$$
Here you see, it is the matrix element $E_{21}$ determining
how fast the $\psi_2$ component grows from zero to bigger values.
Answer: The off-diagonal elements represent the "coupling" between those basis states. I believe it is equal to the transition amplitude within the perturbative approximation.  To understand the off-diagonal elements, consider what would happen if they were zero.  Then the diagonal Hamiltonian matrix is already expressed in the eigenstates of the Hamiltonian.  $\hat{H} |1\rangle = E_{11} |1\rangle$ and $\hat{H}|2\rangle = E_{22} |2\rangle$.  This only occurs when $\langle 1|\hat{H}|2\rangle=0$.  If $\langle 1|\hat{H}|2\rangle\ne 0$, then the states $|1\rangle$ and $|2\rangle$ are coupled together by that $\hat{H}$, and the eigenstates of $\hat{H}$ will be some superposition of $|1\rangle$ and $|2\rangle$.


Should I post a comment to an answer with a link in it to an article about a similar situation?

Question: Recently I came across the question https://security.stackexchange.com/questions/119043/cant-update-apache-ssl-protocols-or-ciphers and I had literally just gone through that entire process by following a guide. Should I post a comment with the guide, and if I find out the guide is the catch all answer transcribe it into an answer?
Answer: This is one of the corner cases that we evaluate situationally.
When another resource is the perfect answer, and it's long and involved, posting a link is actually ok, IMO, as long as you summarize the content (and probably explain that the entire source is the answer, in order to prevent flagging).
Starting off with the link as a comment is a good start, but I would not transcribe the source if it is too long.
Comment: See that's the one thing that I'm still trying to figure out, when I should transcribe a link for the wayback machine
Answer: Technically, you probably should not post the link in the comments or as an answer.
Posting a Link as a Comment
You can see what comments should be used for here. A link answering the question is not a "clarification", "constructive criticism", or "minor or transient information".
It really is "answering the question or providing an alternate solution to an existing answer", which you technically shouldn't do in a comment.
Posting a Link as an Answer
This is definitely a no-go. We even have a delete reason for this: "This is a link-only answer".
See also here or here.
What to do?
If you just want to quickly inform the user of a possible solution, post it as a comment. It's not strictly forbidden, it doesn't really do any harm, and if someone really minds, they can still flag it.
If you want to post it as an answer, it has to be an actual answer by you (so just copy-pasting from the link would also not be ok). You could summarize the linked content, eg:

The steps to take [for your specific situation] are:

[short description]
[short description]
[short description]

For a more in-depth description of these steps, and solutions for
  similar problems [problems] see [link].

Do be sure though that this actually answers the users problem and questions.
[it seems that this wasn't the case in the example you linked to; the user has pretty specific questions (where could config X be defined), a concrete answer would be more helpful than a link to a general guide (which may be posted as additional info)].
Comment: Posting a link to see if the source could answer the question would be fine though, because it is a form of clarification ("is this what you are talking about?").


How to execute matlab code on a Raspberry Pi?

Question: I have running matlab code. I just want to execute that code on the Raspberry Pi kit.
Please tell me the various ways of doing it.
Comment: What have you tried?  Why didn't it work? I don't think this site is meant to be a substitute for you doing your own research.
Answer: You cannot run Matlab on the Raspberry Pi. Matlab requires an x86 processor, while all current models of the Raspberry Pi use an ARM processor. They're fundamentally different, and incompatible. We go into that some on our blog.
The only way you can utilize a Raspberry Pi with Matlab that I know of is to use the RPi as a sensor device. You can read about that in their documentation.
Answer: Please don't be despair if you can't find a MATLAB on any ARM platform.
On most Linux distributions (including ARM platforms), there are more than a handful of free and open-source Scientific Programming Language software packages, i.e. GNU Octave (similar and/or not 100% compatible to MATLAB), R Project (for Statistical Computing), Maxima (Computer Algebra System with symbolic and numerical expressions), etc. They should be available on a raspbian Linux distro as octave, r-base, and maxima packages, respectively. If you are more familiar with MATLAB, then I strongly recommend that you install GNU Octave package and give it a try. As I said before, GNU Octave is NOT 100% compatible to MATLAB. However, most MATLAB basic codes should run out of the box on GNU Octave. For a statistician, I believe R Project is more suitable. For those who are familiar with Mathematica, the maxima package may be a good substitute. If you are a hardcore C++ programmer, perhaps this SymbolicC++ may interest you.
I have octave, r-base, and maxima packages installed on my Rpi0 running on a Kali Linux. For a reference, I have a screen snapshot of their executions on a CLI as shown below.
Kali GNU/Linux Rolling
Linux kali 4.4.50+ #1 Fri Apr 20 17:13:36 CDT 2018 armv6l

The programs included with the Kali GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Kali GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
[snippet ...]
[habibie@kali:/home/local/PEOPLE/habibie 1%] ~
[habibie@kali:/home/local/PEOPLE/habibie 1%] ~
[habibie@kali:/home/local/PEOPLE/habibie 1%] ~
[habibie@kali:/home/local/PEOPLE/habibie 1%] ~ octave
octave: X11 DISPLAY environment variable not set
octave: disabling GUI features
GNU Octave, version 4.4.1
Copyright (C) 2018 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.

Octave was configured for "arm-unknown-linux-gnueabi".

Additional information about Octave is available at https://www.octave.org.

Please contribute if you find this software useful.
For more information, visit https://www.octave.org/get-involved.html

Read https://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.

octave:1> exit
2.610u+1.010s=15:32.02e(0.3%) TDSavg=0k+0k+0k max=36096k 1424+8io 6pf+0sw
[habibie@kali:/home/local/PEOPLE/habibie 2%] ~
[habibie@kali:/home/local/PEOPLE/habibie 2%] ~
[habibie@kali:/home/local/PEOPLE/habibie 2%] ~
[habibie@kali:/home/local/PEOPLE/habibie 2%] ~ R

R version 3.5.1 (2018-07-02) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: arm-unknown-linux-gnueabi (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> q()
Save workspace image? [y/n/c]: n
4.610u+0.430s=0:46.88e(10.7%) TDSavg=0k+0k+0k max=36108k 23008+0io 43pf+0sw
[habibie@kali:/home/local/PEOPLE/habibie 3%] ~
[habibie@kali:/home/local/PEOPLE/habibie 3%] ~
[habibie@kali:/home/local/PEOPLE/habibie 3%] ~
[habibie@kali:/home/local/PEOPLE/habibie 3%] ~ maxima

Maxima 5.41.0 http://maxima.sourceforge.net
using Lisp GNU Common Lisp (GCL) GCL 2.6.12
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) quit();
1.500u+0.450s=0:05.88e(33.1%) TDSavg=0k+0k+0k max=17952k 0+488io 0pf+0sw
[habibie@kali:/home/local/PEOPLE/habibie 4%] ~

Answer: With the R2018b release of MATLAB, you can deploy your MATLAB code on Raspberry Pi as a standalone executable.
Refer the Run on Target Hardware for more information.
Comment: Please provide information from the link, if the link dies your answer will not be very useful


What's a "characterization" question?

Question: This came up in the non-buddhism question (comments to the question). Apparently this is a sort of question that is discouraged on some stack-exchanges. My google-fu is not good enough to find the relevant meta discussions.
Answer: Thanks for bringing this up, it did slip off my radar. When I said "this question asks for characterization" (in reference to question about the "non-buddhism" movement) I meant that the question leads to answers tending to be closer to value judgement, than a fact or interpretation.
I define the boundary between question seeking interpretation and question seeking a characterization as follows:
Question seeking interpretation pertains to a phrase or concept the meaning and/or significance of which is unclear (to OP). While question seeking characterization pertains to behavior of a person or group of people. The two seem similar, however in first case, there is supposedly an objective answer, even if it is arguable (e.g. "what does anatta really mean?" or "is life really suffering?" or "does bowing have any significance beyond ritual?"), while in the second case, the question is unquestionably open-ended and all answers are a matter of opinion.
I believe we should allow interpretation-questions but not characterization-questions.
Comment: Well I don't think my question was soliciting value judgements, but the answerers sure did take it as a request for discussion of the merits of non-buddhism/or the demerits of those who don't adhere.
Comment: Yes, because you clearly were familiar with the phenomena in question, so when you asked what it was, you did not need a description (as somebody who only heard about NB but did not have direct access to their writing would need), therefore you could not have sought anything but opinions. That's what I call seeking characterization.
Comment: That sort of puts questioners into a damned if you do, damned if you don't situation. Were I unfamiliar with who they were, I would be criticized for not doing do diligence and basic googling. Anyhow, I'm fine with the Q being on hold. It will be a few more weeks before the patterns of "okay" questions become clear (to me).
Comment: I agree, that's why it is safer to stick to questions relevant to one's practice rather than letting one's mind run loose.

What's a "characterization" question?


Probability of a Gaussian random vector in a cone

Question: Let $x$ be a $n$-dimensional Gaussian random vector, i.e., $x \sim \mathcal{N}(0,\sigma^2 I_n)$. What is its probability of falling in a cone? Say a cone $C = \{ x \in \mathbb R^n: \frac{\langle x - v, -v \rangle}{\|x-v\|_2 \|v\|_2} \leq \cos \theta \}$ is parameterized by $v \in \mathbb R^n$ and $\theta \in (0,\pi / 2)$. What is $\mathbb P(x \in C)$? Is there a closed form?
Answer: Let
\begin{equation*}
    Z=(Z_1,\dots,Z_n):=x/\sigma\sim N(0,I_n),
\end{equation*}
\begin{equation*}
    Y_n:=Z_2^2+\dots+Z_n^2\sim\chi^2_{n-1},
\end{equation*}
\begin{equation*}
    c:=\|v\|_2/\sigma>0,\quad t:=\cos\theta\in(0,1),\quad u:=\frac t{\sqrt{1-t^2}}=\cot\theta\in(0,\infty).
\end{equation*}
By the spherical symmetry, without loss of generality $v=c\sigma(1,0,\dots,0)$. So,
\begin{equation*}
\begin{aligned}
    P(x\in C)&=1-P(c-Z_1>t\sqrt{(Z_1-c)^2+Y_n}) \\
    &=1-P(Z_1<c-u\sqrt Y_n).
\end{aligned}
\tag{1}\label{1}
\end{equation*}
Note that the random variables (r.v.'s) $Z_1$ and $Y_n$ are independent. So,
\begin{equation*}
    P(x\in C)=1
    -\frac{2^{(1-n)/2}} {\Gamma ((n-1)/2)}
    \int_0^\infty \Phi(c-u\sqrt y)
 e^{-y/2} y^{(n-3)/2}\,dy, \tag{2}\label{2}
\end{equation*}
where $\Phi$ is the standard normal cdf.
Mathematica cannot do anything with the latter integral. So, it is unlikely that it can be expressed in closed form.

However, using \eqref{1} or \eqref{2}, one can easily find various approximations to $P(x\in C)$, depending on how $n,c,u$ vary.
For instance, suppose that $u$ is fixed and $n\to\infty$. Then, by the central limit theorem and the delta method,
\begin{equation}
    V_n:=\sqrt2\,(\sqrt Y_n-\sqrt{n-2})\to V
\end{equation}
in distribution, where $V$ is a standard normal r.v., which let us choose to be independent of $Z_1$. Then, by \eqref{1},
\begin{equation*}
\begin{aligned}
    P(x\in C)&=P(Z_1\ge c-u\sqrt Y_n) \\
    &=P(Z_1+\tfrac u{\sqrt2}\,V_n\ge c-u\sqrt{n-2})  \\
    &\to P(Z_1+\tfrac u{\sqrt2}\,V\ge c_0)  \\
    &=1-\Phi\Big(\frac{c_0}{\sqrt{1+u^2/2}}\Big)
\end{aligned}
\tag{3}\label{3}
\end{equation*}
if $c$ varies with $n$ so that $c-u\sqrt{n-2}$ converges to some real $c_0$. Similarly, if $u$ and $c$ are fixed whereas $n\to\infty$, then $P(x\in C)\to1$.
Of course, one can also use various asymptotic expansions to obtain more detailed asymptotics.

In fact, we have a lower bound on $P(x\in C)$ that is
essentially the same as the limit in \eqref{3}:
\begin{equation*}
\begin{aligned}
    P(x\in C)
    &=P(Z_1+\tfrac u{\sqrt2}\,V_n\ge c-u\sqrt{n-2})  \\
    &>P(Z_1+\tfrac u{\sqrt2}\,V\ge c-u\sqrt{n-2})  \\
    &=1-\Phi\Big(\frac{c-u\sqrt{n-2}}{\sqrt{1+u^2/2}}\Big).
\end{aligned}
\tag{4}\label{4}
\end{equation*}
The inequality in \eqref{4} follows by formula (2.6), which means that $V_n$ is strictly stochastically greater than $V$.
Comment: @HaoHe : Do you have a further response to this answer and the updates?
Comment: Thank you again for the updated answer. The lower bound in your answer is quite good for my research purpose.
Comment: Thanks a lot for your great answer! As I look the equation 2, I am wondering is it possible to approximate (or lower/upper-bound) the $\Phi$ function such that the integral can have a closed-form?
Comment: @HaoHe : I tried to differentiate the integral in (2) with respect to $c$, to get $\varphi(c-u\sqrt y)$ in place of $\Phi(c-u\sqrt y)$, where $\varphi:=\Phi'$, but Mathematica cannot take that simpler integral either. However, you can of course analyze the integral by the Laplace method (https://en.wikipedia.org/wiki/Laplace%27s_method). You can also use asymptotic expansions in the delta method, used in the above answer.
Comment: @HaoHe : Also, I have just recalled one of my old results, which implies the just added nice lower bound on the probability in question.
Comment: Hi Iosif, you seem to be an expert in how to manipulate gaussian.  I was wondering if you can take a look at the question I asked here: https://mathoverflow.net/questions/418204/show-that-mathbbp-a-v-le-z-vz-mathbbpav-ge-z-vz-text-a-s-i.
Comment: @Boby : I have seen that question and tried to play with it, unsuccessfuly. You are asking completeness-/characterization-type questions, which can be very hard (if at all possible) to answer.
Comment: Ok. Thanks a lot.


Probe testing LFCSP components with a multimeter

Question: If I reflow a LFCSP IC such as an ADV7180 I probably won't be able to see any solder bridges or unsoldered pads because the pads are under the chip. Can I safely test for bridges by using a multimeter to test for continuity between adjacent traces?
Comment: back of my head says this sounds like analog TV ICs. Are you really designing an analog TV receiver in 2017?
Comment: Yes. Analog video is still used for FPV flying with model aircraft.
Comment: Ah, cool, nice to know!
Answer: You will need an x-ray imaging device if you did not include test pads on the board for exactly that purpose beforehand.
Comment: I can probe the traces which connect to the IC pads, just concerned that if I do that I may damage the IC if I use a multimeter.
Answer: On some parts a continuity test can give you clues if you have a board that you know works, you can write down the continuity numbers between different pins (or take sample of two or three working boards). Do continuity tests only when the board is off.
Once you have the continuity numbers this can help you to locate problems with a bad part if for example its supposed to be a high impedance input and its near zero. Another gotcha is IC's behave funny when there not powered so don't try and use spec from the datasheet to determine continuity, if you know what kind if input (ESD protected, open collector, open drain, ect then it can help you to determine continuity) it is this can help.
A lot of parts have ESD protection diodes and these turn on in a continuity test so it depends on the part. A continuity test is not a test that will always find problems but it can help during debugging. I've used it several times to find bad parts and then replace them. It really depends on the part but if you have a working board then you can make comparisons.
Another method is to use an IR camera to look for hot spots on the board, this method won't work for shorts between low current signal traces. This method will also help find parts that are dissipating too much power.
A third method is check the power rails and make sure they are in spec.


USB-C thunderbolt not working anymore - Ubuntu 18.04 + Windows

Question: I have been struggling for the last couple of days to figure out why my thunderbolt ports (on the left side of the XPS 13) stopped working on Ubuntu 18.04. The right side USB port works well and charging works on all the ports. Also, because I have a dual boot with Windows 10, I checked if I had the same issues and, indeed, the USB ports don't work on Windows. By USB ports not working I mean that neither ethernet, HDMI, external memory nor USB hub are recognized.
I don't know if it is a coincidence but it happened after I tried to find a way to transfer file to my android device. Following this post (Trying to install android-file-transfer Ubuntu 18.04 Bionic) I did the following
<code>sudo add-apt-repository "deb http://ppa.launchpad.net/samoilov-lex/aftl-stable/ubuntu artful main"
sudo apt install android-file-transfer
sudo apt install libmtp-common mtp-tools libmtp-dev libmtp-runtime libmtp9
</code>
Here are the things I noticed so far

Windows can crash when I plugin a device on the left side (but not always) with a blue screen and a forced reboot
When it does not crash, Windows shows an error "device not recognized"
Ubuntu does absolutely nothing when I plugin a device on the left side
Wifi/bluetooth work fine on both Ubuntu and Windows

I've been trying to solve that non-working USB port issue for a while now and here are the steps I followed:

I checked that the USB devices worked on other computers and they work fine
I updated the BIOS through Windows
I installed all the Windows updates
I uninstalled and reinstalled all the USB-related drivers in Windows
I disabled/re-enabled all the USB-related options in the BIOS as suggested in https://www.dell.com/community/Windows-8/XPS-13-9333-USB-Ports-Not-Recognizing-Any-Device/m-p/4565350#M9012
I disabled the USB security option in the BIOS (Switching from "User security" to "No security") https://eischmann.wordpress.com/2017/06/29/thunderbolt-security-levels-and-linux-desktop/
I ran all the BIOS and Windows diagnostics/troubleshooter and no errors were detected
I installed all the latest Ubuntu packages and updated the Kernel
I turned off the computed and waited a couple of hours (some people on this website thought that it could originate from an overheating)
I disabled the WIFI/bluetooth that could apparently conflict with the USB ports in term of CPU usage (18.04: usb or other removable devices are not recognized after update)
I tried to disable the USB power management because of some potential problems mentioned in an old post (2 usb ports stopped working)
I uninstalled the android-file-transfer related packages and removed the repository
EDIT: I tried to check the USB ports using a live USB key but the same error occurs

I run out of ideas so if anyone has a solution please feel free to reply. Thank you a lot.
I have a Dell XPS 9370 from 2018 with configuration
<code>$ inxi -ACDF
System:    Host: XPS-13-9370 Kernel: 4.15.0-36-generic x86_64 bits: 64 Desktop: Gnome 3.28.3
           Distro: Ubuntu 18.04.1 LTS
Machine:   Device: laptop System: Dell product: XPS 13 9370 serial: N/A
           Mobo: Dell model: 0H0VG3 v: A00 serial: N/A UEFI: Dell v: 1.5.1 date: 08/09/2018
Battery    BAT0: charge: 37.0 Wh 71.1% condition: 52.0/52.0 Wh (100%)
CPU:       Quad core Intel Core i7-8550U (-MT-MCP-) cache: 8192 KB
           clock speeds: max: 4000 MHz 1: 800 MHz 2: 800 MHz 3: 800 MHz 4: 800 MHz 5: 800 MHz 6: 800 MHz
           7: 800 MHz 8: 800 MHz
Graphics:  Card: Intel UHD Graphics 620
           Display Server: x11 (X.Org 1.19.6 ) driver: i915 Resolution: firstname.lastname@example.com
           OpenGL: renderer: Mesa DRI Intel UHD Graphics 620 (Kabylake GT2) version: 4.5 Mesa 18.0.5
Audio:     Card Intel Sunrise Point-LP HD Audio driver: snd_hda_intel Sound: ALSA v: k4.15.0-36-generic
Network:   Card: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter driver: ath10k_pci
           IF: wlp2s0 state: up mac: 9c:b6:d0:88:8e:5b
Drives:    HDD Total Size: 256.1GB (44.3% used)
           ID-1: /dev/nvme0n1 model: KXG50ZNV256G_NVMe_TOSHIBA_256GB size: 256.1GB
Partition: ID-1: / size: 168G used: 106G (67%) fs: ext4 dev: /dev/nvme0n1p5
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 53.0C mobo: N/A
           Fan Speeds (in rpm): cpu: N/A
Info:      Processes: 342 Uptime: 25 min Memory: 2798.2/7692.8MB Client: Shell (bash) inxi: 2.3.56
</code>
List of my USB devices
<code>$ lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 0489:e0a2 Foxconn / Hon Hai
Bus 001 Device 003: ID 0bda:58f4 Realtek Semiconductor Corp.
Bus 001 Device 005: ID 27c6:5385
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
</code>
Here are some kernel errors. Notably the "Cannot enable. Maybe the USB cable is bad?" that happends any time I connect a USB device on one of the left USB port.
<code>$ dmesg
...
[  729.934551] usb 1-1: USB disconnect, device number 2
[  755.529789] usb usb3-port1: Cannot enable. Maybe the USB cable is bad?
[  755.529931] xhci_hcd 0000:07:00.0: Command completion event does not match command
[  755.529950] xhci_hcd 0000:07:00.0: Error while assigning device slot ID
[  755.529960] xhci_hcd 0000:07:00.0: Max number of devices this xHCI host supports is 64.
[  755.529965] usb usb3-port1: couldn't allocate usb_device
</code>
Answer: You should try to boot on a USB key with a Linux distro.
The portable Linux distros come with a robust and comprehensive driver set.
If that does not work you probably got a hardware failure.
Comment: I tried to check the USB ports with a live USB key but the same error occurs.
Comment: Amzocks, dit you find a solutions to this? I have the same issue (usb-c is giving me power from the external monitor, but the same xhci_hcd error). Tried installing ubuntu 19.04 but no luck (dmesg now gives me 'Unknown WMI event type 0x12)
Answer: Finally, I had to send my computer back to the factory. They changed the whole thing and sent it back to me. Apparently it was hardware-related.


Html5 Video frame accurate

Question: I'm trying to get an html5 video tag source element to return an accurate frame number.
Something near that stackoverflow answers.
My goal here is to display an accurate timecode.
I've been looking at VideoFrame and many others, but none of them are accurate. If you play a video containing burned-in timecode or frame count, like the one I'm using video_keyframes12_24p_Mbits1.8.mp4 That I've made myself. You will eventually see one frame off.
Dose anyone has a hint on this ?
Many many thank !
Answer: The Problem
Unfortunately there is no frame API for us to use - Firefox has some experimental features, but other than that we can only deal with time and how the browser handles frame decoding as well as frame rate conversion. See below for an update.
For example, the browser may or may always convert/normalize to 30 fps, and if so may or may not assume drop-frame (for 29.97/59.94 fps/NTSC). Over time this will affect the frame count and will eventually show as offsets as there is no true link between time and frame count.
In addition there could be rounding errors due to the integer based conversion and also potentially depending on the start position in the video. There are also different solutions to how video is decoded under the hood depending on the broswer, for example, Chrome uses FFMpeg underneath, Firefox uses whatever is available in the OS* (for MP4 encoded videos) and so forth.
Possible solution
(Update: forgot to mention -) There is the Media Source Extensions API which support the VideoPlaybackQuality object. This has currently [support in Chrome and IE (on Windows 8+) as well as in Firefox.
To use you can call it directly on the HTMLVideoElement:
var q = video.getVideoPlaybackQuality();

Then read out the values using its property:
var frames = q.totalVideoFrames;

Just be aware of that this value may accumulate all frames regardless of the actual play position. You can perhaps get around this working with MSE directly. It's a little more tedious to setup and handle, but this link provides a good starting point in case you're unfamiliar with MSE.
An alternative idea would be to encode a special bar-code in the video, then read it using canvas. It would be the equivalent on an actual SMPTE time-code, but this would require an overlay being visible in the video to some degree (ala the old way of encoding tele-text into the over-scan area of the video). If the video is full-frame other problems will arise such as false detection depending on colors used for the coding (or make a solid background for it).
*) may have changed in recent versions after Cisco released their mp4 solution for free.
Answer: I posted this answer on the link you referenced, but I think it might be relevant here too:
Starting in M83, Chromium has a requestVideoFrameCallback() API, which might solve your issue.
You can use the mediaTime to get a consistent timestamp, as outlined in this Github issue. From there, you could try something like this:
var frameCounter = (time, metadata) => {
   let count = metadata.mediaTime * frameRate;
   console.log("Got frame: " + Math.round(count));

   // Display timecode code here.

   video.requestVideoFrameCallback(frameCounter);
}

video.requestVideoFrameCallback(frameCounter)

This will only fire on new frames, but you may occasionally miss one (which you can detect from a discontinuity in the metadata.presentedFrames count). You might also be slightly late in capturing the frame (usually 16ms, or one call to window.requestAnimationFrame() later than when the video frame is available).
If you're interested in a high level overview of the API, here's a blogpost, or you can take a look at the API's offical github.
Comment: There's also a follow-up [article](https://web.dev/requestvideoframecallback-rvfc/) to my blog post.
Comment: Firefox does not support `requestVideoFrameCallback`

Html5 Video frame accurate


Copy account files in Mist

Question: I copied one account file in keystore folder from one computer to another. Mist reconnized the new account but complains "wrong password" when I use it. Is there more than just copying a file to importing an account?
Comment: I tried the same few days back.  Didn't  faced any such  issue.  I simply  copied the  account file inside keystore. This is interesting, let's  see what others have to say.
Answer: When copying an account from the keystore you will need the password the key's were encoded with. This is the password that was used when each respective account was created.
You must enter this password to import the key and there is no way to access it without it. If your wallet is unlocked on the origin system, but you cannot recover the password, you could transfer it to a new address you are aware the password of. It is however likely to be locked on the origin system and require the password to send a transaction.
Hope this helps and good luck resolving your situation.

Copy account files in Mist


Chaining transactions

Question: Ripple allows to chain transactions of the same account via the AccountTxnId flag. (see https://developers.ripple.com/transaction-common-fields.html#accounttxnid) Is this also possible with Stellar?
Answer: Stellar implementation of the operations sequences is simpler and much more robust. The transaction itself is more like a container which can hold up to 100 operations (payment, manageOffer, change settings etc). Therefore you can, for example, create a new account, set its options, create a trustline, and send some tokens in a single atomic transaction. Operations are executed strictly in order. It works the same way as a transaction in a database, either all operations are applied or all of them fail.
The strict transactions execution order is also enforced by Sequence number.

Each transaction has a sequence number. Transactions follow a strict ordering rule when it comes to processing of transactions per account. For the transaction to be valid, the sequence number must be 1 greater than the sequence number stored in the source account entry when the transaction is applied. As the transaction is applied, the source account's stored sequence number is incremented by 1 before applying operations.

So you just cannot submit transactions in the wrong order, or accidentally submit the same transaction twice. Such behavior also effectively prevents replay attacks.
Comment: I know this. Still I have a use case, where a check on the order of transactions would be desired. Suppose I want someone to sign a transaction for me offline (i.e. without querying the ledger), and proof for validity of the to-be-signed transaction lies in the previous transaction of this account, which I give to the signer. Then if the last transaction appears to be valid for the signer, it could add its hash to the new tx and it would only be accepted into the ledger, if the previous transaction actually made it to the ledger.
Comment: Well, Stellar doesn't have the concept of the "previous tx" reference, and I doubt that it would be implemented in the nearest future. The sequence number is not a full analogy, but you still can use it for your case. You just check current `sequence` of the source account, and you can tell if the previous transaction has made it to the ledger. The second tx will be rejected if the first tx failed, as the second tx sequence will be considered invalid (tx 1 failed and source account sequence hasn't been changed).
Comment: This wouldn't work, because by sequence number, just any transaction could have been previously sent to the ledger. The signer wants to be secure (without connecting to the blockchain), that the transaction he signs is only valid if exactly the transaction he references was sent to the ledger previously.
I do understand, that this is a very special use case though.

Chaining transactions


How to sign an android app for the market?

Question: I've recently released my first app on the market. I tried to install the app on my phone immediately after it was released. But when installing it I got an error saying that the app was wrongly signed. I also got lots of bad ratings for my app because other people couldn't install it as well.
So my question is: how can I sign my app correctly? Is there any way to test the result before releasing the app on the market?
BTW: I used the built in function of eclipse to export the signed apk file.
Answer: You need to create  Release Key for Signing your Application.
Step : 1 Right Click Project->Export Application->Select you Project->Next->Select new Keystore -> Complete all rest Steps
Step : 2 Note down your Alias name and Password given.
Step : 3 Now if you Complete all process of Filling Details you will get one .apk file and keystore file in you stored location.
Step : 4 Now Again Right Click Project->Export Application->Select you Project->Next->Use Existing Keystore -> Give location and password->Next
Step : 5 Now you alias name will comes in your Drop Down->Select it -> Enter Password -> Next
Step : 6 It will ask for location to store your final .apk file.
Step : 7 Select your location and store.
Step : 8 Now this Final .apk file is Your Signed Application.
Note : Keep this keystore file for further updated of your Application in Android Market ,also keep track of your Alias name and Password
Comment: What's a Google Maps key got to do with Android app signing?
Comment: most people use a API that is signed with their debug.keystore.  Most people that sign are not using the debugkeystore any longer.. so I think the Google API key won't matchup any longer.
Answer: We can't really tell you from afar what is wrong. Did you create your own self-signed certificate? The cert that comes with SDK is a debug certificate and should not be used for signing a production app.
I recommend you thoroughly read the docs about signing the apps.


Is this patent expired? And if not, does it have a worldwide patent?

Question: I don't understand how to read the patent page. From the snapshot, is this patent granted and still effect? If so, does it only apply to USA or Worldwide? Thanks.
Comment: As pointed out in answers there is no such thing as a world-wide patent although there is an *almost* world-wide way of applying for a patent. There are, as of January 2024, 157 countries that can be reached by the PCT process. A few are missing, prominently including  Argentina and Taiwan. After filing each place you actually want protection in needs to be addressed with further process and payments. https://www.wipo.int/pct/en/pct_contracting_states.html
Answer: The application cited was granted as US9016652B2. Normally one would expect that patent to expire 08-20-2029. However it costs money to maintain a patent and it looks like the patent  has expired due to non payment of required fees. Similarly for US8201796B2 by the same inventor. These are US patents. There are no worldwide patents. Patents are specific to countries. I found a world patent application. But it doesn't look like it has issued anywhere. I'm not sure whether or not the fee related expiration can be overcome, but for now the US patents shouldn't be enforceable.
Just to note, I am not a lawyer so this isn't legal advice. Avoiding infringement on one patent doesn't guarantee freedom to operate over all patents. If you want to be safe, you should absolutely engage an attorney to determine if you have freedom to operate.
Answer: This is the publication of an US patent application not a granted patent.
There are no worldwide patents. However, there is such a thing as sn (almost) worldwide patent application via the PCT process of WIPO.


Could Puerto Rico become part of a US state?

Question: Could Puerto Rico become part of a US state?  I realise it has long been proposed as a 51st state, but that seems unlikely. So how about this alternative?
Answer: Yes.
This would require the consent of Congress and the accepting U.S. state, but Puerto Rico's consent would not be constitutionally required (although it would be prudent to obtain and probably would be obtained as a matter of custom and fairness).
New York States has floated the possibility of annexing Puerto Rico since it is the single most concentrated destination of Puerto Rican migration to the mainland historically and has a large and politically well organized Puerto Rican community and would favor the expansion of Democratic political party power that this annexation would entail.
Contiguity is less of a concern for Puerto Rico since it is an island in any case.
Florida would be another natural candidate, but its conservative/purple political makeup would probably oppose such an annexation even though geographically it would be a more natural annexing state.
In a similar vein, there have been proposals to annex all of the District of Columbia except the federal mall to Maryland subject to the same formal requirements.
Either annexation would be a compromise. It would give these territories full statehood status and full representation in the U.S. House but would deny Puerto Rico and the District of Columbia, respective, their own two seats in the U.S. Senate which would favor Democrats more than mere annexation would.
Comment: Why would federal consent be required?  The constitution does not say anything about states acquiring territory from a source that isn't part of another state.
Comment: If a territory is "owned" by the federal government as in the case of PR, why should a state be able to steal it from the federal government unilaterally, without Congress involved. And, changing the territory of a sovereign nation (if a state tried to annex land that was not a part of the U.S., e.g., if California tried to annex Hawaii prior to Hawaii becoming a U.S. territory() is an inherent power of a national government and one of many that SCOTUS has recognized.
Comment: U.S. Constitution Art IV, Sec 3, Cl 1 and also Art I, Section 8 which vests authority over federal property together with the necessary and proper clause. The fact that the exact language is not spelled out doesn't mean that one can't resolve the issue on the principle set forth. The 10th Amendment is meaningless and 10th Amendment arguments almost always lose. See also the Insular cases that place federal territories in the exclusive control of Congress. https://en.wikipedia.org/wiki/Insular_Cases The express parts of the constitution embody a broader theory of federalism.
Comment: It has always been clear to me that the purpose of the article 4 language is to prohibit the reduction of a state's territory without that state's consent.
Answer: Pursuant to the New States Clause of the Constitution (Art IV, Sec 3, Cl 1),

New States may be admitted by the Congress into this Union; but no new
  States shall be formed or erected within the Jurisdiction of any other
  State; nor any State be formed by the Junction of two or more States,
  or Parts of States, without the Consent of the Legislatures of the
  States concerned as well as of the Congress.

There are two precedents: Nevada (1866 and 1867) and Missouri, states which expanded their territory by absorbing part of an adjacent territory. The expansion of Nevada was enacted by Congress on 5 May 1866, coming in two parts. A large strip of Utah Territory was added

as  provided  for  and  consented  to  in  the  constitution  of  the
  State  of  Nevada,  all  that  territory  and tract  of  land
  adjoining  the  present  eastern  boundary  of  the  State  of
  Nevada,  and  lying  between  the  thirty-seventh  and  the
  forty-second  degrees of  north  latitude  and  west  of  the
  thirty-seventh  degree  of  longitude  west of  Washington,  is
  hereby  added  to  and  made  a  part  of  the  State  of  Ne vada.

The southern chunk that is now Clark county was added after it was approved by the Nevada legislature. This thing is, it still requires congressional approval.
Comment: Are you saying that there is no constitutional provision for admitting new states, or that a new state would have to be formed from a territory made out of another state? This is what the constitution says about the matter – obviously the procedure is not spelled out in minute detail.
Comment: We're not talking about new states, we're talking about expanding an existing state when the additional territory is not taken from an existing state.  The constitution only addresses the case where states are *losing* territory, which cannot be done without the state's consent as well as that of the federal government.
Comment: The constitutional clause you quote does not seem to apply because the source of the new territory is not another state.
Comment: Essentially adding territory to an existing state is forming a new state, and the Insular Cases, among others, firmly establish that federal territory is under the exclusive control of Congress. https://en.wikipedia.org/wiki/Insular_Cases
Comment: @ohwilleke the fact that PR would cease to be federal territory does seem to imply that congressional consent would be needed, but I do not buy the argument that expanding a state's territory amounts to forming a new state.


My website change automatically lenguage in wordpress

Question: how are you?
I don't know why when I change the page on my website automatically change the language.
For example: I start on the home page (in English), when I go to another page as  "Services ", the page loads in Spanish (and I need to go to the top menu of the page, to select the English option to change the language of this page). The page is datrick.com (You can see it, starting in English and then going to  "Services " and see how it change). the page was made in wordpress. i use a polylang plugin.
Answer: The service links on your front page point to the spanish version of your site. For example Market Research has the link https://datrick.com/investigacion-de-mercado/. If you want it to direct to the english version, change the link accordingly (i.e. https://datrick.com/en/market-research/).
Comment: hi @Antii Koskinen I tried, but I don't know where I can change it. Because in WordPress customize I can put only one link (but I want to put both, if you start in Spanish... Redirect to pages in Spanish, and if you start in English.. Redirect to English).And look at the menu above, it doesn't change


Determining whether a subspace of the plane (with Euclidean topology) is locally compact

Question: There is a theorem that states that a Hausdorff space is locally compact if and only if every point has a compact neighborhood. Checking whether every point has such a neighborhood can be tedious and time-consuming for more complex spaces, so is it possible to determine whether a subspace of a plane is locally compact by a simpler means; e. g. are there any sufficient conditions for local compactness in such spaces that might be simpler to prove than using the above theorem, using only general topology? I appreciate your help.
Answer: Your question is bit vague. In general there is no way to avoid checking whether every point has a compact neighborhood, even it the space is a subset of a (Euclidean) plane. There are some general theorems that might help you, for example the following:
A subspace $X$ of a locally compact Hausdorff space $L$ is locally compact if and only if it can be written as $X = A \cap U$, where $A$ is closed and $U$ is open in $L$. This applies to subsets $X$ of any finite-dimensional Euclidean space.
Moreover, your space $X$ must be defined somehow, and in some cases it is fairly obvious from the definition that it is locally compact. For example, if you have a continuous map $f : L \to Y$ defined on a locally compact Hausdorff space $L$, then all preimages of subsets $M \subset Y$ having the form $M = B \cap V$,  where $B$ is closed and $V$ is open in $Y$, are locally compact.
Answer: Maybe this is not quite what you were expecting, but here's an interesting way to get a large class of locally compact subspaces of $\mathbb{R}^2$.
The Heine-Borel theorem states that in $\mathbb{R}^n$ any subset $A \subseteq \mathbb{R}^n$ is compact if and only if it is closed and bounded.
Now take any closed and bounded subset $C$ of $\mathbb{R}^n$ , by the Heine-Borel theorem $C$ is compact and since any compact topological space is locally compact it follows that $C$ is locally compact.
So any closed and bounded subset of $\mathbb{R}^n$ is locally compact.
In the case when $n=2$, we can easily generate a large number of examples of locally compact spaces from our above deductions.
Examples:

The circle $\mathbb{S}^1$ is compact, and thus locally compact.
Any finite set of points is locally compact.
Any finite union of closed balls are closed, and thus locally compact.
$[a,b] \times [c,d]$ is closed and bounded and thus locally compact for any $a,b,c,d \in \mathbb{R}$


How does deconstructing vehicles work?

Question: I've heard that it's possible to deconstruct vehicles, but I've never done it. How do you do that? What does deconstructing them do?
Comment: Accessible through vehicle menu, and it gives you some of the resources back
Answer: Deconstruct just removes your vehicle. This prevent enemy's from getting point by destroying it.
Killing a flash should give 25 XP and by deconstructing it you can prevent the enemy from getting that XP. Now Flash isnt that big of a deal but other vehicles can cost a fortune.
Deconstructing does NOT reset or lower the cooldown and also does not return any resources.
Some people abuse this option to prevent XP from being rewarded... when you shoot a galaxy for example (300 XP) and it almost dies, people deconstruct it fast and prevents the enemy from destroying it and will not receive 300 XP.
You can decontruct in the same menu as you can lock your vehicle...
Default button : Page Down
Comment: Its also useful if you are sneaking in to avoid tipping the enemy off that you might be nearby.
Comment: @Justin Indeed. I spy a little spy.
Answer: Deconstructing vehicles is no longer possible. In mid-March, a hotfix removed the functionality of the "Deconstruct" button, and the March 27 patch removed the button from the UI entirely.
Answer: You can use deconstucting in a sneaky way. I.E. you could fill a Galaxy with a squad and then deconstruct the Galaxy so the enemy won't know there are enemies in the place.
If the enemy knows you're already there, you could deconstruct the Galaxy so they can't get XP.
The Default button is page down. You can change this by going to keybindings and selecting air.

How does deconstructing vehicles work?


How to simulate a continuous signal passing through a capacitor (simple coupling capacitor)

Question: the differential equation for the current flowing through a serial capacitor (see for example https://www.allaboutcircuits.com/textbook/direct-current/chpt-13/capacitors-and-calculus/) indicates that one must take a derivative of the signal but in the literature, a serial capacitor (for instance a coupling capacitor) is often considered as a unit that just eliminates a continuous component of the signal. Well. Is it necessary to take a derivative or just get the first moment of the stochastic signal and eliminate it in order to simulate the passing of that signal through the coupling capacitor?
Comment: I recommend Papoulis' "Circuits and systems: a modern approach". It deals extensively with this kind of problem.
Comment: Are you looking to make a digital DC blocking filter?  I suggest a search on that phrase -- "DC blocking filter".
Comment: No. Sooner I make a coupling capacitor but do not know how to do it. Clearly, if I need to take a derivative then I change the signal dramatically. If I need to apply just a high-pass filter with a cut-off freq standing below "any signal frequency", then I need just eliminate a mean value.
Answer:
Is it necessary to take a derivative

Yes

or just get the first moment of the stochastic signal and eliminate

That's just a very crude approximation of taking the derivative. In some cases that's sufficient, but in most it's not.
For DC blocking the capacitor is typically used together with a resistor to form a high pass filter. The approximation is often "good enough" if the corner frequency of the high pass is well below any signal frequency of interest.
Comment: I get the impression OP is talking about the full impulse response, i.e. transient plus steady-state, not just the cap as a DC blocker. So what OP refers to as the "first moment of the stochastic signal" might be the transient response leading into the steady-state (0) (therefore no frequency involved). In which case considering the cap, alone, is not enough. But only if I'm not mistaken.
Comment: Let's focus on a coupling capacitor. Can it be seen as a DC blocker only? And of course, there is a resistor (in the form of the input impedance of the stage, for example). Well. Is it advisable, in this case, to simulate a coupling capacitor as a high-pass filter (Butterworth, for example) of order one, if it influences a signal as a high-pass filter (together with the input impedance)?
Comment: Actually it's *not* necessary to take the derivative; that's just an artifact of how we usually solve such problems.  You can integrate the average, and subtract.  You can certainly view that as the action of a capacitor in such a circuit.
Comment: Does integration need to be made on the scale t, where t is the time constant of the high-pass filter (which is formed by the capacitor in question and the input impedance of the stage)? If yes then it is advisable to use a readily available function of  Butterworth's high-pass filter.


Saving all element states for OWN history?

Question: I have a visual editor wich uses normal drag&drop divs in a specific area.
Now i want to build or include an own history system, so that the user can click a back button (not the browser-button) and the last change is reversed.
For example: "Insert Modul B after A" -> "Delete Modul A" -> Back-Button -> (Modul A is back again.)
Is there a good jQuery-Plugin for that? Or how should i save states? (I think copy all HTML isnt the best solution).
Its hard to google for because i ever find plugins for the browser history..
Thank you.
Answer: This sounds specific enough that you would have to program your own custom solution.


Software for planning a Ultra Marathon for Windows?

Question: I found a software called UltraRunner 3 for Mac, I wonder if exists something like, but for windows.
I would like to know if exists a software that given a gps route then could generate a plan for running all the route, I mean the software would split the route in small parts, then if there ir positive elevation then would say you haceto run at 10 mim/km.
Then the software would allow you to change the intensity of all the parts of the route, thas exist something like for windows?
Answer: Hmm... well this sounds like a bad idea.
When you're running an ultra you need to listen to your body and know when to push it, how to feed it and how to water it. I wouldn't want to try and split a route down and plan it to that degree. You don't know what the terrain is like nor do you know if it's going to be hot or cold on the day.
Comment: Ultra Marathons like Badwater needs a lot of planification.. you already know that it will be very, very hot on the day.


FD Lens with an EOS adapter produces a type of glare after a couple of minutes, is this normal?

Question: I have an FD adapter for an EOS 100D, a 50mm and a 210 Sun Optics zoom lens. They both produce a type of gloss/glare/fuzzy image after around 10 minutes of being attached, is this normal? Is this humidity from these old lenses? I never leave these old lenses on the camera when not in use because I've heard this could damage the camera. Is there a way to rectify this? Like a de-humidifier? Or is this a lost cause? The image shows a bit of this effect of blur. Canon eos100d +sun opt.210mm zoom +2x adapter=420mm.
Comment: Show us a before and after photo. One with a clear image, and one with the gloss/glare/fuzzy image.     My gut reaction says it has nothing to do with humidity and it is just a degraded image due to the poor quality of the glass optics in your FD to EF adapter.
Comment: Please post some sample photos, preferably with EXIF data.
Comment: Here's a video clip with a 50 mm FD lens on EOS100D which shows the effect in more detail. https://flic.kr/p/oY8K3X
Comment: Does your EF-FD adapter have a glass element that allows you to focus to infinity?
Answer: The most likely culprit for fuzzy images when using this lens combination is the glass you will find in your FD-EOS adapter. The low quality glass that is often used greatly degrades and softens the image.
If you are using a glassless adapter then the fuzziness could be caused by the lack of infinity focus. This is due to the differences in old FD and new EOS mount flange distances.
Also please bear in mind that old film lenses, due to their age are likely to deteriorate image quality if not looked after properly.
Film Lenses are also not specifically optimised for digital cameras e.g. No digital coatings. So you might get some unusual results.
I personally have a glass FD-EOS adapter. I stopped using it because of similar issues. If you would like to use old Film lenses on your camera you would be better off trying an old Nikon F of M42 mount lens plus adapter.
Answer: The softness is probably from the 2x teleconverter and the glass in the FD->EOS adapter. That's actually like stacking two teleconverters, since most of these adapters that use a glass element to help you achieve focus to infinity are simply short teleconverters.
Teleconverters nearly always add softness, and while they do increase the focal length, they also reduce the maximum aperture, so everything gets darker, and your camera may have some serious trouble focusing correctly because it doesn't have enough light hitting the AF sensor array to actually detect phase or contrast well enough to find focus.  The 100D's upper limit for autofocusing is a max. aperture of f/5.6. At f/8, it won't be able to latch onto focus.
Given that you're using an f/4(?) lens to begin with, throwing on a 2x tc brings you down to f/8. And with the FD->EOS adapter, you're liable closer to f/11 as your maximum aperture.
My recommendation would be to take off the 2x teleconverter.  That's liable to remove most of the softness and focusing issues you're running into.  Using a teleconverter is a far far cry from using a supertelephoto lens, which is why I stopped using a 1.4x tc on my EF 75-300 III, and ponied up the $1000+ for an EF 400mm f/5.6L USM instead.
Sometimes, there are no shortcuts.


For how long are ISPs allowed to store user browsing activity?

Question: If a guy living in an oppressive country such as Saudi Arabia visited an atheist site, for instance. 5 years later, would you tell him that there's a high possibility the ISP deleted the evidence of that from their servers or would you tell him to travel abroad and stay away? Just hypothetically.
Comment: Are you asking if an ISP in Saudi Arabia is required to retain "who browsed what" info for a certain minimum time, or prohibited from doing longer than a certain maximum time? Or are you asking if it is a crime in Saudi Arabia to visit an atheist site? How does travel abroad figure into this?
Comment: A prohibition against *being atheist* does not necessarily imply a prohibition against *visiting particular sites.*
Comment: For your first question, yes. 2nd question, no because it is indeed illegal to be atheist in Saudi Arabia. Travel abroad to a free country would mean he wouldn't be extradited.
Comment: I am not aware of any legal requirement on the part of an ISP to destroy browsing activity, or for that matter if it is retained in the first place. My inclination is that this is really a question of ISP customary practice and not law.
Comment: @phoog exactly.  Nor does visiting lds.org makes one Mormon.
Comment: Sure, but in my hypothetical case, the person actively looks up atheistic/blasphemous sites and topics. Just a hypothetical example, i wouldn't do it.
Answer: In Saudi Arabia, the ISP (CITC) blocks access to prohibited sites. If some website is deemed haram, you can't get to it. CITC is not omniscient, so it is possible that a site which could be forbidden, and eventually is forbidden, is not at some point forbidden.
There are various laws against hacking and requirements to safeguard information, and the Telecommunications Act in Chapter 10 enumerates various forbidden acts (providing unlicensed internet access etc), and prohibits (18)

Other than in the course of duty, intentional disclosure of any
  information or contents of any message, which has been intercepted in
  the course of its transmission

I will not attempt to interpret that: I believe that it means that it is illegal to intercept a message except if officially required to. An IP address is not a message (anyhow, the law is written in Arabic so we'd have to go to the actual text). In other words, there is nothing that would prohibit the ISP from handing over "who touched this site" information to the mutawwi`. There is also, from what I can tell, no law requiring them to retain such information. CITC makes a lot of information available online here. Article 7 of The Anti-Cyber Crime Law may make such access to a website illegal. In other words, there's no way to be certain, save for getting sworn testimony by government officials.
Answers for other regimes would no doubt be different in details.


Did Maharshi Narada curse Lord Brahma?

Question: When Lord Brahma cursed Narada Muni to become a Gandharva, did Narada curse him back?
Comment: Welcome to Hinduism stack exchange, please try to add references to your claim.
Comment: @hanugm He is asking the source of the story. I have mentioned that in my answer.
Comment: @GIRIBLR Ha. I found some links online. Hoped that OP might update. Nice.
Answer: Yes, this is available in the narada charitra. This is under the chapter mutual curses of Narada and Brahma.

As Brahma allowed Sanaka Kumaras to carry on with their Tapasya and
asked Narada to engage in 'Srishti' by becoming a house-holder,
Narada's reaction was instant and said : would there be a fool who
would leave the outstanding 'Amrit' like 'Seva'to Shri Krishna,
instead of the poisonous drink of 'Samsara'(family life) which is
hopeless, illusory and distressful? As Narada dismissed Brahma's
proposal of Samsara with the least respect and consideration, the
latter grew furious and visibly angry. He cursed Narada to become a
quixotic, glibly and dreamy human being named 'Upabarhana' with
frivolous nature, as an indulger in 'Shringar' (romance) and music, a
veena player, talkative, wanderer and as the son of a servant maid;
after repeated births would by the grace of Shri Krishna return to
Brahma when he would then become a Gyani. Narada was non-plussed by
this spate of curses and said: Your anger was least justified and
unwarranted; normally, a father would chastise a son taken to wrong
ways but in this case, many curses were hurled to a person with
passion for the highest attachment and devotion for Shri Krishna!
Narada addressed Brahma Deva as follows: 'Chaturaanana! You have given
me so many curses without justification for the only reason of not
obeying you to distance myself from Paramatma and get into the
whirlpool of Samsara! I feel justified to give you too a few curses:
You will not be worshipped by anybody in the entire Universe by way of
Stotra, Kavacha, Mantra and Puja for the next Three Kalpas; nor could
be offered 'Yagna Bhaga'(oblations at Yagnas through Agni Homas); You
will also be denied worship by way of 'Vratas'
Comment: @Nayak, since the answer answers your question, you can accept by clicking (✔) below the arrows on the answer. This means you accept it and it lets others know that this is the correct answer. Also please do contribute upvote since you liked the answer by pressing up arrow.
Comment: Thanks so much

Did Maharshi Narada curse Lord Brahma?


How to remove gnome on Ubuntu20.04?

Question: I'm using Ubuntu20.04
I used the command sudo apt-get install gnome by mistake and gnome package was installed on my system, how to restore everything to its original state?
Answer: I've just tested sudo apt-get install gnome and then sudo apt-get purge gnome --autoremove on a fresh Ubuntu 20.04.1 LTS. It does not remove all of the dependencies which are dragged in by installing gnome because many of them are suggested by other installed packages.
Fortunately, on Ubuntu, apt keeps a log of what packages were installed and when. To see the log, it is enough to issue:
$ cat /var/log/apt/history.log

There you will find the list of packages grouped by install occurrence. Look for Commandline: apt-get install gnome. If you did not install or upgrade recently, it should be the last one.
To copy the list of packages for removal, you will want to pre-format them to strip the information in parentheses. You can do it with this useful script:
$ perl -pe 's/\(.*?\)(, )?//g' /var/log/apt/history.log

Then just copy the list of packages installed with gnome to your sudo apt purge command.
Answer: Run the following command in bash shell
sudo apt-get remove --purge gnome*

This will remove the every package in configuration file of gnome.
Answer: sudo apt-get purge gnome

should remove everything co-installed if you haven't changed the defaults.
Also see: https://askubuntu.com/questions/247549/is-it-possible-to-undo-an-apt-get-install-command
Answer: You can't. But you can install another Desktop environment like apt-get install lxde and select that one from the login screen drop down box.

How to remove gnome on Ubuntu20.04?


Can I make a Dapp in react that doesn't uses metamask at all?

Question: I want to build a Dapp in which I don't want to use the metamask wallet. There is a central ethereum address that I have and when any one calls the function that intracts with the blockchain I want that the gas fee to be deducted from that wallet in the backend and this should happen without the need of user confirming the transaction from the frontend. Which libraries should I use to perform this? Please guide me!
Comment: Like the tags in your question: use either web3js or ethersjs if you use nodejs for backend
Answer: this is awesome to onboard new users into web3.
You can use Gelato Relay https://docs.gelato.network/developer-services/relay which allows you to send transactions via a normal HTTP post to the blockchain. You can use the 1balance to pay for all transactions.
Hope it helps!


Is my ginger stem too thin?

Question:
I placed my ginger indoors beside a window, and they started growing. Some grew really fast, and some hardly at all. Why is this the case? Also, are their stems too weak/thin? I used a pair of wooden chopsticks to support one of the stems as I was afraid it would break. Do I need to add compost? I have been using potting soil all along (for the past two months).
Comment: What part of the world are you in, and is the ginger the culinary kind, used for its roots, or one grown for its decorative flowers?
Comment: Leave the stems alone.  Chopsticks here act like a 'cast' on your arm?  Atrophy.  As close an analogy with humans I could use.  Let them droop.  What is your light situation? Have you done this before?  The plant is below the surface.  All you see growing on the top are the initial photosynthetic parts of the plant.  Once there is enough energy being produced with a few photosynthetic stems the plant puts more energy into making foord/energy for itself.
Comment: ....once the available food factories are making sufficient energy for the daily overhead as well as putting a large percentage aside as stored energy for the winter it will put just enough energy into the smaller stems to keep them as 'back ups'.  Otherwise, most of its energy is being directed to the 2 or 3 vigorous, energy/food producing stems.  It uses just enough energy to make food, new vegetative growth and/or flowers/reproductive growth. Very efficient. If one of those vigorous stems were to be broken or the roots have grown and need more sustenance then more stems/leaves are grown.
Comment: Usual issue with ginger (IMPE) is that most windows don't offer nearly enough light. The plant will grow (if it's not absurdly dim), but not flower, in that case. Stem size varies with many factors including particular species of ginger and age of the plant.
Answer: Looks healthy to me! I don't think a support is necessary. If a cane grows too long for the pot, you can trim it (cut off the last 1/3 of that cane). Make sure they get as much light as possible, to avoid etiolation.
You don't need to add compost to a potted plant, but you can fertilize, if you can provide bright light as well. The reason some of them are bigger is that they came out of dormancy sooner. This is common in ginger, as well as other rhizomatus plantings (planted while dormant).

Is my ginger stem too thin?


How can I fix the power sliding doors on a Dodge Grand Caravan (VW Routan)?

Question: I have a 2011 Dodge Grand Caravan that came with power sliding doors.  But they don't work.  Is there a usual way they die?  It could be anything from the buttons to the wires to the sensors to the motor.  Is there a standard thing that should be replaced to get it working again?
Comment: I think this question has already been answered ... you might want to take a look.
Answer: The most common point of failure on these minivans is the wiring harness in the bottom sliding door track. It breaks where it is being flexed back and forth every time the door opens. Look for a plastic "tank tread" in the bottom rear. It will contain the harness that you need. See Dorman 747-311 and 747-310


When is the best time to ask a question?

Question: I am assuming that the attention a question gets depends to some extent on when it is submitted. If this is the case, would it not be sensible to ask the question when it is most likely to be noticed? My guess is that this would be the weekend.
Comment: On Security Stack Exchange, the weekend is almost certainly the worst time to submit if you want the most attention. Monday to Thursday afternoon UK time (morning US time) seems to be best. This is based entirely on my own anecdotal experience watching posts come in.
Comment: are you asking when peak activity is on the site?
Comment: Surely you wait a couple of days to ensure enough experts have seen the question and had an opportunity to answer it.  Or if you're in a blinding hurry to fix a crisis you ask immediately.  Time is irrelevant.
Comment: What @RoryAlsop said... But truthfully, we do not have such a high rate of traffic at any time, that your post would get lost in the flood - as could sometimes happen on [SO] for example. As Chenmunka said, its not like you need an immediate, within-seconds answer - so just post whenever is good for you, and check back later.
Comment: The best time to ask a question is after you have though about it, done some research to find the answer yourself, and written the draft in an editor. Of course, it helps to do that before you forget what the question was, or other things get in the way and you don' thave time to do it anymore.
Answer: There aren't so many quesitons being asked here that you risk going unnoticed unless you post on the optimal time. Just post whenever you want to. The timing is really a non issue.
If you are concerned about not getting good answers, I would suggest you read "How do I ask a good question?". That will be more useful than trying to get the timing right.
Comment: Also, I find it quite hard to generalize whether more overall activity actually has a good or a bad effect on getting high-quality answers.
Answer: Questions which do not receive much attention (and which do not have upvoted answers) are occasionally bumped to the homepage. This does a lot to reduce any effect the timing of posting might have on the attention received.


Design suggestions for Django Deployment

Question: I have used Django on-and-off for the past year or so, but I have never deployed a website into a production environment.  I would love some input on my proposed deployment design.
Use Case
I will be deploying one- or two-page websites for multiple clients over the next several months.  I plan on either using a clienta.mysite.com or a mysite.com/clienta layout.  These pages will be forms that clients enter data into (such as credit card info), which will be transferred via SSL back to the server.  The server will then make the required connections to processing sites, process the transaction, and return the result to the client.
Plan
My plan is to use a Nginx + Gunicorn setup to handle the incoming connections and serve the simple pages.  In the future I will likely do some more complex page interaction, but for now they will be simple html forms.  The django backend will handle the interaction with the remote processing servers, and then return the results to the client through a generated results page.
Questions

Will this implementation work for 10s or 100s of clients?
Are there some obvious pitfalls I am not seeing?
Is this overkill?  Are there simpler/better ways to handle this type of situation?

Thanks!
Answer: If you use one subdomain per client, you will require one SSL certificate per domain, or a wildcard certificate, which can be more expensive than a standard SSL certificate.
Comment: This is very good to know; I had completely forgotten about that effect of the subdomains.  mysite.com/clientA it is then.
Comment: Anyone else have some input on this?


Why is the total potential difference in a circuit the sum of the individual potential differences?

Question: I am having difficulty in applying my understanding of electrical potential to circuits. Why is the total potential difference in a circuit the sum of the individual potential differences among capacitor plates that are in series? I tried finding a solution before but I didn't understand the references to voltage drops. As far as I know, the electrical potential is the energy required per unit charge to take a point charge and move it from one point to another, with infinity usually set as the initial position (for convenience?). Please correct me if I am confused.
Comment: "Voltage drop" just means the difference in potential across a circuit component.
Comment: I would have to know what is your current "understanding" of electrical potential in *circuits*, even though you are clear about it for free charges. For this reason, could you please tell how would you prove what is the voltage drop across a *single* capacitor connected to a battery?
Comment: Because the electric fields are additive and so are their integrals over paths.
Answer: To understand the answer, you need to be aware of the concept of electric potential. Electric potential is a scalar quantity.
In any circuit, there is a potential at any given point on the wire. The difference in potential between any two points in this circuit is sometimes called potential difference or voltage. You can understand the difference between potential and potential difference better here.
Imagine you had a circuit as shown below:

Assume that the potentials at $A,B,C$ are $V_A,V_B, V_C$.
The potential difference between A and B is $V_A - V_B$. The potential difference between B and C is $V_B - V_C$. Adding the two, we get the expression $V_A - V_C$ which is the correct term for potential difference across AC.
I hope that this makes it clear that potential differences between two sets of points can be added to obtain the potential difference between the first and last point.
Answer: You have essentially answered your own question.  You are correct that the potential as we call it is a measure of the amount of work that would be done per unit of charge as it is moved through that potential.
Electric fields are conservative in that the amount of work that must be put into moving a particle from one potential to another is exactly equal to the amount of work that would be done BY the particle were it to make a return trip.  Energy in equals energy out in such a round trip.
This makes the amount of work done path independent, and thus the rule you stated (a trivial rule actually that a person by the name of Kirchoff gets credit for stating as a LAW) is true: The sum of the potentials across each of the components must equal the total potential.
There is no infinity of course, in the circuit.  It's all relative to an arbitrary zero.  There is no telling what the absolute potential actually is and it doesn't matter.  The motivation for electrons to move is the potential DIFFERENCE between two ends of a wire, so that is what we are interested in quantifying.
Answer: The potential difference or voltage is actually the difference in the level/numbers of electrons or positive charges on the two terminals of battery or across the terminals of passive elements. Law of conservation of energy states that the total energy of an isolated system remains constant, that is why the sum of the potential differences across the passive elements in the circuit is always equal to the potential difference provided by the source/active elements.
Answer: Because potential exactly means that you have its potential at every point and to get from start to finish you need to make a number of steps. That is one leap can be broken into a series of steps, every step is closer to the target. As you move closer to the target, your potential becomes closer to the target potential. That is, you have some potential difference at every point. But, it should be not surprise that their sum is equal to the initial difference of potentials. I wounder how the field would look like to make this to fail.
Look at this like you are on a surface of a landscape, with all its ups and downs. Now, draw some contour, that you are willing to move along. Yes, there is a lift at the voltage source point

So, why you slide down from the hill, you will need to arrive at the battery bottom level. Why the hell is difference of individual heights amounts to the total height of the hill? Why is the sum of increments is equal to the total distance?


Better Divisibility by 8

Question: Everywhere I look, when you want to see if something is divisible by $8$ then you see if the last $3$ digits are divisible by eight. But how do you know if the last $3$ digits are divisible by $8$? For example, I can't tell you immediately that $976$ is divisible by $8$. Is there a better algorithm for $8$-divisiblility or do I just need to get better at my arithmetic?
Comment: If you can recognize on sight whether the number formed by the last two digits is divisible by $4$ and whether it is divisible by $8,$ then the original number is divisible by $8$ if either the hundreds digit is even and the number formed from the tens and ones digits is divisible by $8$ or if the hundreds digit is odd and the number formed from the tens and ones digits is divisible by $4$ but not $8.$  This works because  (A) $100$ is divisible by $4$ but not $8,$  (B) $200$ is divisible by $8,$ (C) the sum of two numbers congruent to $4$ mod $8$ is divisible by $8.$
Comment: If you look, Wikipedia has a list of rules for divisibility by 8 [Link](http://en.wikipedia.org/wiki/Divisibility_rule#Divisibility_rules_for_numbers_1.E2.80.9320)
Comment: To emphasize Will Orrick's comment: you don't need to check whether 976 is divisible by 8 or not. Since 200 is divisible by 8, you can substract 200 from your number (multiple times) and check if the result is divisible by 8. So, for 976, you only need to check for 176. Better, it is sufficient to check for -24, which is obviously divisible by 8.
Answer: For mental math, you want to keep taking out chunks until you get a remainder. For this to work, you need to have memorized the two-digit multiples of single-digit numbers. Looking at the first digit of $976$, we can take out the chunk $8$ out in front to get $176$. Next we need to incorporate the second digit, because $1$ is too small, so we're working with $17$. What's the biggest multiple of $8$ underneath $17$? Clearly $16$. So take out the chunk $16$ out of $17$ and we're left with $1$, then we tack on the $6$ to the right of it and we're looking at $16$, a known multiple of $8$, and we're done.
This is essentially long division, except you only keep track of a few digits of what you're doing at a time (easier for mental math) and you're only tracking the remainder, not the quotient. Further, in contrast to long division, you can subtract the number you're working with from even larger chunks if it speeds the process up (i.e. it reduces the digits faster). Here, as Hurkyl points out, you can subtract $976$ from $1000$ to get $24$ quickly. In these cases, for the larger chunks you'll usually want something that's easy to work with mentally. For mental subtraction from big multiples of $10$, I go digit-by-digit from the right, determining at each stage what I need to add to that digit to make it zero, and then carry a $1$ over to the next digit. So I need to add $4$ to $6$ to make that digit $0$, and then for the next digit I add $1$ to $7$ and determine I need to add $2$ to $8$ to make a $0$, so the remainder is $24$, which we know is a multiple of $8$.
Comment: @Bill For what it's worth, I upvoted your answer but it's probably still gonna languish at the middle of the pack, unless the asker were to accept it.
Comment: Good chunk sizes are in my opinion 16, 40, 200, $10^n$ for $n > 2$ (that last part is why you can ignore all but the last three digits). You will probably come to choose your own favorite chunks as you do this more often, and the operation will become second nature (you almost certainly already have mechanical algorithms burnt into your brain for division by 3, 9, and perhaps 11)
Comment: I like the idea of $1000 - 976$, it's much better than my instinct to halve 976 (that gives 488, which is not as readily obviously a multiple of 8 as 24 is, in my opinion).
Comment: @Robert I think it's easier to spot that 488 is a multiple of 8 (clearly 88 and 40 are, or 48 and 8) than it is to halve 976 mentally (which would require doing 450+35+3, if we're not going to subtract it from 1000).
Comment: @blue That's kind of what I was saying, that's why I like your idea of subtraction: 488 looks more obvious but it takes more effort to get to it.
Comment: @Robert For an easier *algorithm* see my answer.
Comment: @Robert Thanks. I pinged you only because, based on your comments, I thought you might find it of interest, and otherwise might not revisit the thread to see it. Strangely, this method does not seem to be well-known, but I think it is the easiest and quickest method.
Answer: With practice there are a lot of tricks to speed things up. For your example, knowing that 1000 is divisible by 8, I would immediately simplify the problem by reducing 976 to -24.
It's not too hard to memorize a few other intermediate values as well: I remember, for example, 128, 256, and 512 as multiples of 8, because they are powers of 2, and 800 is another obvious point.
The multiples of 200 would be good choices too, and probably the right things to remember to use: the only reason I used the other things is because they spring to mind first: I have to think about whether 200 is a multiple of 8.
Comment: This answer is probably the easiest answer, thank you.
Comment: @Joao There's an easier *algorithm* - see my answer.
Answer: You can take the number formed by the last three digits, divide it by $2$, and then look the last two digits to see if it is divisible by $4$.  So, $976/2 = 488$, and $88$ is divisible by $4$.  Of course, this presumes that division by $2$ is mentally easier than division by $8$.
Comment: It can be done with $\,\le 2\,$ additions (of integers $\le 9),\,$ and $\,\le 3\,$ halvings (of integers $\,\le 15)\,$ - see my answer.
Answer: We can use modular aritmethic to deduce a criteria. Let $a = a_n 10^n  +\cdots + a_1 10 + a_0$, with $0 < a_i < 10 ~\forall ~i$ be a number represented in base $10$. Let's do a little list: $$\begin{align} 10^0 = 1 &\equiv 1 \mod 8 \\ 10 &\equiv 2 \mod 8 \\ 10^2 &\equiv 4 \mod 8 \\ 10^3 &\equiv 0 \mod 8 \\ 10^4 &\equiv 0 \mod 8  \\ \vdots\end{align}$$
So, we can write: $$a = a_n 10^n  +\cdots + a_1 10 + a_0 \equiv 4a_2 + 2a_1 + a_0 \mod 8$$
For example, $8 \not \mid12345$ because $8 \not \mid (5+2\times4+4\times3)=25$. You can do this to deduce criteria for numbers other than $8$.
Answer: For mental math the way I do it is this:
If the first digit of the three digit number is a multiple of $2$ (i.e. even), then I look at the last two digits and if they're a multiple of $8$, then the number is a multiple of $8$.
If the first digit of the number is not a multiple of $2$ (i.e. odd), then I look then I look at the last two digits, add $4$, and if the resulting number is a mutiple of $8$, then the number is a multiple of $8$.
e.g. for $224$ $$224 -> 24$$ $$24 \pmod 8 = 0$$
So $224$ is divisible by $8$.
For $368$ $$368 -> 68 + 4 = 72$$ $$72\pmod 8 = 0$$
So $368$ is divisible by $8$.
Like blue stated above, the key here is knowing the two digit multiples of the one digit multiple. I personally think my way is easier because it requires no division on your part. Just knowledge of your multiplication tables.
Answer: Hint $\,\ 8\mid abc \iff ((c/2+b)/2+a)/2\,$ yields integers for all quotients,
e.g. your $\,8\mid \color{#c00}9\color{#0af}7\color{#96f}6\,$ by  $\smash[]{\underbrace{(\overbrace{(\color{#96f}6/2+\color{#0af}7)/2}^{\large =\,\color{#0af}5}+\color{#c00}9)/2}_{\large =\, \color{#c00}7}}\,$ has integer quotients $\,\color{#96f}3,\color{#0af}5,\color{#c00}7^{\phantom{I^{I^{I^{I^I}}}}}_\phantom{I^{I^{I^{I^I}}}}$
With practice the test takes only a few seconds of trivial mental arithmetic.
A proof is easy. Note $\ 8\mid c + 10 b + 10^2 a\iff 8\mid c + 2b + 2^2 a\ $ since $\,10\equiv 2\pmod 8$
Further $\,\ nd\mid c + d\, e\iff d\mid c\ \ \&\ \ n\mid c/d + e.\,$ Iterating this yields said test
Lemma $\,\ d^3\!\mid c + d\,b + d^2 a\iff ((c/d + b)/d + a)/d\,$ yields integers for all quotients.
$\!\begin{eqnarray}{\bf Proof} && && d^{\,3}\!\mid\  c\, +\, d\,b + d^2 a\\
&\iff&\quad\ \ d\mid c &\ \&\ &d^{\,2}\!\mid\ c/d + b + d\, a\\
&\iff& \begin{array}{}\quad\ \ d\mid c\\ d\mid c/d+b\end{array}&\ \&\ &\ d\,\mid (c/d + b)/d+a\quad {\bf QED}\\\
\end{eqnarray}$
Answer: In base $10$ any number can be written as $$\sum_{r=0}^na_r10^r$$
which is $$\equiv a_0+10a_1+100a_2\pmod{1000}\equiv a_0+10a_1+100a_2\pmod8\equiv a_0+2a_1+4a_2$$
For $\displaystyle976, a_2=9,a_1=7,a_0=6\implies a_0+2a_1+4a_2=\cdots=56\equiv0\pmod8$

Better Divisibility by 8


How to have a 'Auto Go Home' feature, like the DJI Phantom 3, on a project built quadcopter?

Question: What should a quadcopter have, or have access to, in order to make this 'return home' feature work? Is GPS enough? What is the approach needed to make this happen?
I used a Arduino Mega 2560 with IMU to stable my quadcopter.
Answer: I would go with one of two-ish methods to do this, but both methods require the craft to know its own position. You could do this with GPS, or an IMU, or any other means or combination of position tracking.
Method 1 - Only track where you are and where "home" is. Use sensors to detect obstacles along your path and navigate around them as applicable.
Method 2 - Leave "breadcrumbs". Set your first waypoint where "home" is. Every time you get X meters away from the last waypoint, set a new waypoint. Assume there is no obstacles between waypoints (set the waypoint distance small enough that this should always be true), then just follow the waypoints back.
Note that Method 1 is just Method 2 with a very large distance setpoint.
Comment: There can be additional battery failsafe, RC failsafe (as mentioned in other answers) and consideration of prohibited areas
Answer: Primarily it will be GPS based. I have a Phantom 3 Pro and I have seen how the Go Home feature works.  Before it returns to the x,y coordinates set as "home" it goes to a specific altitude. Presumably this is determined from the altitude of it's home position plus some pre-determined safety zone that is known to be clear of some of the tallest standard obstructions such as streetlights, power cables etc.
It is probably a very good idea to go directly to this altitude first by vertical means only, then traverse to the lat,long coordinates and then descend to landing as the DJI does.  I have flown my quad in the mountains where I stand on a crest or cliff and fly down into the valley below. You don't want to hit cliff faces or trees on the way up or down.
Also, what about obstacle avoidance? If the vehicle goes behind something such as a tall building, making a bee line straight back to home is not going to be the best flight path.
The DJI has two ways of identifying home. One is to remember where it took off from, and if you don't give it enough time to get a proper GPS lock before you take off it might try to fly back to its previous "Home" site, which could be miles away. The other is that there is a GPS in the controller and it can communicate this to the vehicle so the vehicle comes back to the controller even if it is moving.
Also consider that it's probably coming home with little remaining battery power, so shortest distance back could be a good thing. This might contradict what was previously noted about obstacle avoidance.
I believe that the "Go Home" feature is mostly useful when it is lost from eyesight and especially when the signal gets weak or is lost completely. Many times it is only necessary to come back towards you and let you reestablish those two things, then it's probably best to let the controller assume its initial role.
Answer: The answer to what capabilities the quadcopter to have is: link loss algorithms and navigation capacity.
Link loss procedure for a robot could be:

determine that there's a link loss (no commands for 1 second?)
try to aquire link back, for a while (a minute?) (increase altitude while circling a calm radius)
increase altitude to the Safe to Navigate altitude (which is mission plan dependent, and maybe configured before each flight).
navigate to Lat-Lon of the Home Point (using intermediate points or direct navigation, if no intermediate waypoints exist).
slowly descend to the ground after some time (depends on the endurance capability of the vehicle); doing some alerting actions (playing music, waving around, displaying lights on and off) for any possible human/lives on ground would be cool.

Important: Home Point must be chosen away from people, cars, etc. And it should also be relatively easy to retrieve the vehicle back.
This procedure must be known by crew and any parties that are around the flight zone (other modelers, aviation authorities, friends, police, etc), and Home Point (and intermediate waypoints) must be set up / controlled before each takeoff.