Non-abelian Ext functor and non-abelian $H^2$

Question: Let $G$ be a group and
$$0\rightarrow K\rightarrow M\rightarrow N\rightarrow 0$$
a short exact sequence of groups. Now these are abelian groups, if I want to show that $\text{Hom}(G,M)\rightarrow \text{Hom}(G,N)$ is surjective, I would show that $\text{Ext}^1(G,K)=0$. However, if I'm studying the same question for non-abelian groups, then I do not have the tool of derived categories at my disposal. Can this be overcome with (non-abelian) cohomology?
Comment: @MikhailBorovoi How?
Comment: See the reference in my comment to [this question](https://mathoverflow.net/q/368086/4149).
Comment: I  took the liberty to edit the title and to add the tag galois-cohomology. This is relevant to my answer. Roll back if you don't like this.
Comment: Yes (in some sense).
Comment: @MikhailBorovoi, you can link to specific comments, not just questions.  I think you mean this [comment](https://mathoverflow.net/questions/368086/non-abelian-representations-and-their-induced-abelian-representations#comment928533_368086).
Comment: @LSpice: How can I do that?
Comment: See also: Flicker, Scheiderer, Sujatha, Grothendieck's theorem on non-abelian $H^2$ and local-global principles. [J. Amer. Math. Soc. 11 (1998), no. 3, 731–750](https://www.ams.org/journals/jams/1998-11-03/S0894-0347-98-00271-9/).
Comment: @MikhailBorovoi, the time stamp is a link to a specific anchor on the question page.  For example, your reference to Flicker et al.:  https://mathoverflow.net/questions/368093/non-abelian-ext-functor#comment928644_368093  .
Answer: EDITED, taking into account the comments of Donu Arapura.
As JLA wrote, a homomorphism $f\colon G\to N$ gives an extension
\begin{equation}\label{e:E}
1\to K\to E\to G\to 1.\tag{E}
\end{equation}
This extension defines a homomorphism
$$b\colon G\to \operatorname{Out} K$$
called the  band (lien, kernel) of \eqref{e:E}.
By definition, $H^2(G,K,b)$ is the set of isomorphism classes of extensions \eqref{e:E} bound by $b$.
A cohomology class $\eta(E)\in H^2(G,K,b)$ is called neutral if the extension \eqref{e:E} splits, that is, there exists a homomorphism  $G\to E$ such that the composite homomorphism $G\to E\to G$ is the identity automorphism of $G$. In this case we obtain an action $\varphi$  of $G$ on the normal subgroup $K$ of $E$, and we obtain an isomorphism $E\overset{\sim}{\to}K\rtimes_\varphi G$ with the semidirect product.
There may be more that one neutral class in $H^2(G,K,b)$: they correspond to semidirect products with different actions $\varphi$ of $G$ on $K$. I have read that there may be no neutral elements, but I don't know examples. (In the Galois cohomology setting, for a connected reductive group, by Douai's theorem there always exists a neutral element in nonabelian $H^2$; see [2], Proposition 3.1).
If $K$ is abelian, then $\operatorname{Out} K = \operatorname{Aut} K$, so $b$ is just an action of $G$ on $K$, and  $H^2(G,K,b)$ is the usual abelian group cohomology $H^2(G,K)$, where $G$ acts on $K$ via $b$.
The set $H^2(G,K,b)$ can be described in terms of cocycles. See Section 1.14 in Springer [1].
The band $b$ defines an action of $G$ on the center $Z=Z(K)$, and we may consider the usual (abelian) group cohomology $H^2(G,Z)$. From the cocyclic description of $H^2(G,K,b)$ it is clear that $H^2(G,Z)$ naturally acts on $H^2(G,K,b)$.
Moreover, if the set $H^2(G,K,b)$ is nonempty, then $H^2(G,Z)$ acts on it simply transitively; see Mac Lane, Homology, Theorem IV.8.8. The set $H^2(G,K,b)$ is nonempty if and only if a certain obstruction  $\operatorname{Obs}(G,K,b)\in H^3(G,Z)$ vanishes; see Mac Lane, Theorem IV.8.7.
Note that we should not think that $H^2(G,K,b)$ "equals" $H^2(G,Z)$. First, $H^2(G,K,b)$ does not have a distinguished unit element. Secondly, $H^2(G,K,b)$ has a distinguished subset $N^2(G,K,b)$ of neutral elements. This is important because in many applications one uses nonabelian $H^2$ in order to determine whether a given extension \eqref{e:E} is split or not.
As far as I know, nonabelian $H^2$ is mostly used in the Galois cohomology setting.
Namely, if $k$ is an algebraic closure of a field $k_0$ of characteristic 0, $G=\operatorname{Gal}(k/k_0)$,
and $Y$ is a quasi-projective $k$-variety with additional structure (say, an algebraic group or a homogeneous space) such that for any $\sigma\in G=\operatorname{Gal}(k/k_0)$ there exists an isomorphism $\alpha\colon\sigma Y\overset{\sim}{\to}Y$,  then it defines an extension
$$1\to \operatorname{Aut} Y\to E\to G\to 1,$$
where $E$ is the set of such pairs $(\alpha,\sigma)$
with a suitably defined composition law.
We obtain the cohomology class $\eta(Y)\in H^2(k_0,\operatorname{Aut} Y,b)$
of this extension for a suitable band $b$.
The variety $Y$ (with additional structure) admits a $k_0$-model if and only if $\eta(Y)$ is neutral, that is, the extension splits;
see this question.
For nonabelian $H^2$ in Galois cohomology see:
[1] T. A. Springer, Non-abelian $H^2$ in Galois cohomology, in: Algebraic Groups and Discontinuous
Subgroups, Proc. Sympos. Pure Math. 9, Amer. Math. Soc., Providence, 1966, 164-182.
[2] M. Borovoi, Abelianization of the second nonabelian Galois cohomology. Duke Math. J. 72 (1993), 217-239.
[3] Flicker, Scheiderer, Sujatha, Grothendieck's theorem on non-abelian $H^2$ and local–global principles.
J. Amer. Math. Soc. 11 (1998), no. 3, 731–750.
See also newer papers (they refer to these three), and this preprint.
Comment: This is a very nice answer. I do have a couple of questions. (1) When you say $\eta(E)$ is neutral, does that mean there exists a lift of $b$ to $G\to Aut(K)$, such that $E$ is the semi direct product? So then it is clear, there may be more than one, or perhaps none. (2) What is the relationship to the old results of Eilenberg-Maclane "Cohomology theory in abstract groups. II." Annals (1947)? As I recall, they show that the set of extension classes is either empty (with obstructions in $H^3$) or parameterized by $H^2(G, Z)$, where $Z$ is the centre of $K$.
Comment: Thanks again for the interesting answer. Concerning an example. Let $F$ be a nonabelian free group. Choose a surjection $f:F\to G$, where $G$ is finite and nontrivial. Let $K$ be the kernel. $K$ is again nonabelian and free, so it must have trivial centre. By your answer, the nonabelian $H^2$ consists of a single element. This cannot be neutral, because the sequence can't split, as $F$ is torsion free.
Comment: If you are interested in nonabelian $H^2$ in Galois cohomology, please ask a separate question, and I will answer it when I have time
Comment: Let me know if you prefer that I ask these as separate questions, rather than as comments.
Comment: Of course it's your right not to name your paper if you don't want, and I apologise for an unwanted edit; but too many old MO comments become less useful when "here"-type links fade, so I'll put the name of "this preprint" here if it's all right:  [Borovoi - Extending the exact sequence of nonabelian $H^1$, using nonabelian $H^2$ with coefficients in crossed modules](https://arxiv.org/abs/1608.07366).
Comment: @LSpice: I think that my preprint is not quite relevant to this answer, and so I did not name it on purpose.
Comment: Thank you, @DonuArapura, for the example.
Answer: If you have a morphism $f:G\to N\,,$ then you get a $K$-extension of $G$ by pulling back the $K$-extension of $N\,.$ The morphism $f$ lifts to a morphism into $M$ if and only if this extension is trivial. So you could show the map you want is surjective by showing that all $K$-extensions of $G$ are trivial.
If $K$ is abelian, then isomorphism classes of $K$-extensions correspond to classes in (abelian) group cohomology.
Comment: I think the general approach is sound, but all you need for the morphism to lift is that the extension is split (which doesn't mean it's trivial, since semidirect products exist), so you'll need done kind of pointed set of "extensions modulo splittings"


Passwordless rsync while requiring key and password for all other access

Question: I have a server set up to require public-key authentication for ssh access using a key with a password. Is there a way to set up a password-less key that will only be allowed when executing rsync over ssh, while still requiring the key and password for all other ssh access?
Answer: Create a separate RSA key just for rsync to use.  Do not put a passphrase on that key.  Give it a unique name, such as id_rsa_rsync for the private key and id_rsa_rsync.pub for the public key.
On the server, install the public key on a new line of ~/.ssh/authorized_keys, like this:
(server)$ cat << EOF >> .ssh/authorized_keys
command="rsync",no-pty,no-port-forwarding (paste your public key here)
EOF

Check the resulting file to make sure it looks sort of like this:
(server)$ tail -1 .ssh/authorized_keys
command="rsync",no-pty,no-port-forwarding ssh-rsa AAAAB3..blah..blah..HhcvQ== firstname.lastname@example.com

When you want to rsync from your local machine to the server, you will need to add -e 'ssh -i ~/.ssh/id_rsa_rsync' to tell rsync to use the new key you just set up:
rsync -av -e 'ssh -i ~/.ssh/id_rsa_rsync' local/files* server:/remote/path/

With some clever entries in your ~/.ssh/config file, you can simplify the rsync command line:
# this entry is used for normal logins to "server":
Host server
  IdentityFile ~/.ssh/id_rsa

# this entry is used for rsyncing to "server" without a passphrase:
Host server-rsync
  Hostname server
  IdentityFile ~/.ssh/id_rsa_rsync

The Hostname server line needs to specify a valid DNS name or /etc/hosts entry.  With that config entry in place, your rsync command line becomes just:
rsync -av local/files* server-rsync:/remote/path/

Comment: So, per your last point,  if I set up config in .ssh, I don't have to even tell rsync directly to use ssh, but it will look in the .ssh/config file automatically and use that?
Comment: Yes, if I understand you correctly.  rsync uses ssh by default.  But by default, ssh uses your **normal** key, which requires a passphrase.  But if you set up the .ssh/config file, and then use the special hostname "server-rsync" (or one of your own choosing) in the rsync command line, then ssh will use the new key that does not require a passphrase.
Comment: I couldn't get this to work, then I discovered this method will allow executing rsync [b]on the server[/b] using the password-less key. I'm trying to use rsync on my local host to copy files to the server and I wasn't clear on that in my question. It put me on the right track, though, for an alternative. Thanks!


Estimating N from d and variance for within-studies designs in meta-analysis

Question: This is a cross-validation question.
I am running into a problem with a database and am using CMA. I am under the impression that once I compute effect size (d) and variance I should be able to accurately estimate sample size (N) for that comparison using the following formula, N_Calc:
N=(8+d^2)/(2*var)
I have no problems reverse engineering N when I check my between-subjects comparisons, and N_Calc is providing accurate estimates that closely match the actual N for those comparisons. So as far as cross-validation goes with those particular designs I am fine.
Where I run into problems is within-subjects designs. In many cases, of course, I don't have access to much more than N, t-values, p-values. However I do have access to some studies in which I can access raw data or access the specific comparisons - with the Pearson's r computation between means for each comparison. That's an ideal situation insofar as we know within-subjects experiments will typically show some correlation between treatment means. My problem is this: when I plug in that information into the appropriate column in CMA, I am unable to use N_Calc to get an accurate estimate of the original N.
Let's take this example:
So I have a study where the outcome is reaction time - control group (M = 1012.143, sd = 170.188) and treatment (M = 944.00, sd = 163.405). The Pearson's r between the means is .872. The actual N is 106. When I plug that info into the appropriate computation column in CMA, my d = .407 and I have a var = .003.
When I reverse engineer the N for the purpose of cross-validation, here is what happens:
N=(8+.407^2)/(2*.003) = 8.165649/.006=1360.915
Out of curiosity, I tried reversing the sign of Pearson's r. When I do that, here is what I get:
d = .409 and var = .038.
When I try to reverse engineer the N, here is what happens:
N=(8+.409^2)/(2*.038)=8.167281/.076 = 107.46
That actually comes close to approximating my actual N, which on the surface seems like what I want - i.e., demonstration that I can apparently cross-validate from d and variance and reproduce the original N with some degree of certainty.
My worry is that although I appear to have solved a problem on the surface, I am very unconfident that this is a correct solution.
My question is partially whether the N_Calc formula that I am using to reverse engineer N is applicable to situations outside of between-subjects comparisons. It seems like it should be since I am using d and variance info to plug into the formula, but I am genuinely not sure. If the N_Calc formula is applicable, is my solution to my problem with within-subjects comparisons appropriate, or am I doing something wrong? If I am doing something wrong, what do I need to do in order to get accurate computations?
Bear in mind that my only meta-analytic experiences to date have been strictly ones in which the studies were between-subjects designs. I have never dealt with within-subjects designs in a meta-analysis, nor have I tried to cross-validate effect size calculations using N_Calc formula with within-subjects designs and could use some guidance.
Thank you.
Update:
I tried one other approach to reproduce N from d and var that on the surface appears to work. I'm just following a hunch. Here it is:
I used the square root of the denominator term in the original N_Calc formula. I don't have the mathematical sophistication to justify this approach with any formal proof. It's just a hunch, and it should be treated as such for the time being:
Now, when I reverse engineer the N for the purpose of cross-validation, here is what happens:
N=(8+.407^2)/sqrt(2*.003) = 8.165649/.077459666=105.418
The advantage is that I am using the actual original correlation rather than manipulating correlation by reversing signs, my original d remains as it should as does my original variance as computed, and I appear to be cross-validating by reproducing a close approximation of the original N, which as you will recall is N=106.
Again, I have no mathematical proof to justify this approach to reproducing N from within-subjects d and variance, but on the surface, it appears to work. I reproduced N for another comparison in another report and was able to get a reasonable approximation.
So again, hoping to tap into the brainpower here to help me figure out if I am on the right track. If I am, great. If not, I'd love to know. More importantly, I'd want to know what that right track is.
Thank you for any guidance you can offer me.
Answer: First of all, for a between-subjects design, the (large-sample) variance of a standardized mean difference (Cohen's d) is given by $$v = \frac{1}{n_1} + \frac{1}{n_2} + \frac{d^2}{2(n_1+n_2)}.$$ In the special case that $n_1 = n_2 = n$, we can simplify this to $$v = \frac{8 + d^2}{4n}$$ or $$v = \frac{8 + d^2}{2N},$$ where $N$ is the total sample size. Rearranging this yields $$N = \frac{8 + d^2}{2v}.$$ But note that this is a special case where the group sizes are identical.
For a within-subjects design, the (large-sample) variance of the standardized mean change is $$v = \frac{2(1-r)}{n} + \frac{d^2}{2n}.$$ This can be rearranged to $$n = \frac{2(1-r)}{v} + \frac{d^2}{2v}.$$
In your example, this yields $$\frac{2(1-.872)}{.0032} + \frac{.407^2}{2(.0032)} = 105.9.$$ I used $v = .0032$ (instead of just $v = .003$) to reduce the rounding error.


Should Q be considered a Gospel?

Question: According to Wikipedia Q source is sometimes called the Q Gospel. My understanding of Q though is that it is proposed mostly as a collection of sayings. Is it proper to call it a "Gospel"? Why or why not?
Comment: References to Q should be limited to more abstract terms like "theory" or "potential source(s)" or just simply as "Q." We could also say the same as Proto-Luke and Proto-Matthew and Proto-Mark. Attempting to tie these "documents" to any current document is fun and an excellent brain challenge, but isn't really worth debating how it should be categorize.
Answer: The Gospel of Thomas consists mostly of sayings, and it explicitly claims to be a Gospel in its first sentence.  So that's pretty good evidence that something like Q would have been thought of as a gospel around the time when Thomas was written (which is sometime between the mid 1st and mid 2nd century, we don't know).
On the other hand, we don't know when "gospel" was first used as a name of a genre or writing.  One theory is that it was first used to refer to a genre of writing in Mark 1:1.  So it might be anachronistic to refer to Q as a gospel, since the genre may not have yet existed.
Comment: The Bible doesn't really deal in hard and fast genres. There is too much overlap (historical narrative written as poetry etc.) so that is largely an imposed idea.

The four gospels correspond to the four faces of the cherubim, which in turn correspond to the four points of the compass in the tabernacle furnitures (Lion - Ark, Ox - Altar, Man - Table, Eagle - Lampstand), which give us priest, king, prophet and mediator. Four eye-witness testimonies is thus sacred architecture. Any speculation concerning an imposed genre and whether it might apply to other texts misses the point entirely.
Comment: "Gospel" is really only a genre within the Christian realm. Otherwise it's more of a "history" or "biography."
Answer: To me, in order for any book to be considered a Gospel the first thing it would have to have is the teaching of the death, burial, and resurrection of Jesus Christ since that's what the word means in the underlying NT Greek in the canonical Gospels.  That is the good news after all; that Christ died, was buried, and rose again!

εὐαγγέλιον (euaggelion)
Outline of Biblical Usage
1) a reward for good tidings
2) good tidings

a) the glad tidings of the kingdom of God soon to be set up, and subsequently also of Jesus the Messiah, the founder of this kingdom. After the death of Christ, the term comprises also the preaching of (concerning) Jesus Christ as having suffered death on the cross to procure eternal salvation for the men in the kingdom of God, but as restored to life and exalted to the right hand of God in heaven, thence to return in majesty to consummate the kingdom of God
b) the glad tidings of salvation through Christ
c) the proclamation of the grace of God manifest and pledged in Christ
d) the gospel
e) as the messianic rank of Jesus was proved by his words, his deeds, and his death, the narrative of the sayings, deeds, and death of Jesus Christ came to be called the gospel or glad tidings

Note: Emphasis is mine.

Should Q be considered a Gospel?


Replacing a sub panel

Question: I have a existing 6 circuit 100 amp sub panel.It has the grounds running with the neutral wires. I need more circuits. I bought a 20 space main 100 amp breaker box. It doesn't have a ground bus bar. It has a 100 amp breaker with two poles for the hot wires and a neutral bus bar, no ground bar. My understanding is that you cannot connect the ground to the neutral bus bar in a sub panel. Do I just add a ground bar? If yes does it have to be grounded to the earth with a grounding bar? The sub panel is 32 feet from the main. Or could I remove the connecting bar on the neutral bus bar and use one side for the ground bus bar and one side for neutral bus bar.
Comment: Please revise your post title to ask a clear, specific question. It's not a book title. :)
Comment: So buy the manufacturer's accessory ground bar kit (or even two of them) - they surely make one. And remove the neutral bonding screw, of course.
Answer: If you want to use that panel, you will need to buy accessory ground bar(s) for it.  The label will state the specific model numbers of ground bar that will perfectly fit the sites already provided for mounting ground bars.  Expect to pay under $10.
They omitted the ground bars to make the panel cheaper, since they expect most users will be using it as the main panel.
DO NOT break up the neutral bars. They probably gave you just enough, and you'll need them. Yes, they are expecting grounds on the neutral bars, but they expect you to put 3 grounds on 1 neutral lug. So only 33% more neutral spaces than needed for neutrals. A 30-space panel typically has 40 neutral spaces, etc.
You need a ground wire back to the main panel.  Fullstop, final answer.  (unless of course you have EMT, IMC or RMC metal conduit, where the metal conduit shell is rated to be the ground wire).
If you are in an outbuilding, then you need a ground rod ALSO.  It does a different job than the wire.
Comment: Thanks Harper for the clear and understandable answer.
Answer: The ground and neutral bus/bar must be electrically separated/isolated from each other in a sub panel.
If you have two buses that are/have only a wire connecting them, then removing that wire should do it.
The neutral bus/bar needs to be insulated from the metal of the panel.
The sub panel if in the same building just needs the ground bus/bar connected by a ground wire/metal conduit to the ground of the main panel.  The neutral bus needs connecting to the neutral of the main panel also.

Replacing a sub panel


What is purpose of /etc/shadow and shadow cache files in Linux operating system?

Question: What is the purpose of the /etc/shadow file in Linux Operating system?  Also, is it same for SUSE clients?
There is one shadow cache file is maintained what is purpose of that?
Answer: From the beginning, Unix and Unix-style operating systems (including Linux) have always stored passwords as cryptographic hashes (1).  These hashes were originally stored in /etc/passwd, but this file needed to be world-readable to make the information available for other purposes - even a simple ls -l needs to read /etc/passwd in order to convert each file owner's numeric user id to their username for display.  However, having the hashed passwords in a world-readable file allowed malicious users to easily obtain those hashes and attempt to generate usable passwords(2) for other users' accounts.
To prevent this, the hashed passwords were eventually moved into a file readable only by root (and occasionally a privileged group of administrators), /etc/shadow.  This hides the hashes from normal users of the system while keeping them available for user authentication purposes.
Notes:

Pedantic, I know, but the stored passwords are not encrypted.  They are hashed using a cryptographically-secure (at least as of the time it was written) hashing algorithm.  The primary distinctions relevant here are that hashes are fixed-length (the length of encrypted text varies based on the length of the text which was encrypted) and non-reversible (encrypted text can be decrypted; hashed text cannot).
Because hashes are fixed-length, there are an infinite number of inputs which will match any given hashed representation.  An attacker could, therefore, find a working password which is not necessarily the same as the owning user's password - although this is very unlikely given the size of modern crypto hashes.
Comment: @phunehehe No, the input set (all possible passwords) is infinite, but the output (all possible hash values) is finite.
Comment: The number of inputs leading to any given collision is **not** infinite, because the length of strings which can be hashed by any given algorithm is **finite**. See for instance http://stackoverflow.com/questions/17388177/is-there-a-limit-for-sha256-input
Comment: @MariusMatutiae Assume a really bad hash implementation which truncates at 3 characters. The correct password is "abc". The inputs "abcd", "abcde", "abcdef", etc. will also produce the same output hash and, therefore, also be accepted. There are an infinite number of strings which start with "abc" and will trivially collide. (Note that we're basically just disagreeing here on whether "the input" means before or after truncation is applied.)
Comment: I think in the last paragraph you must mean to say "finite" not "infinite".
Comment: @phihag Ah I see. But a hash would be much longer than any human-rememberable password anyway :)
Comment: @phunehehe - In general practice, true, but it is still possible for hash collisions to occur within the space of human-rememberable inputs.
Comment: @MariusMatutiae That depends on how the implementation behaves if given input exceeding the maximum length. If it throws an error and refuses to perform the hash, then, yes, the number of potential collisions is finite. If, OTOH, it hashes as much as it can and ignores the excess data, then the number of potential collisions is infinite, since the excess can be of any length and made up of any content without affecting the resulting hash.
Comment: I don't think so: if a long input is truncated, then it does notmatter what the truncated part looks like, the hash is determined only by the finite-length part, hence the number of collisions is finite. Truncated data is irrelevant.
Comment: I agree, but what I am saying is that the space of all guesses is the truncated space, not the extended space with all passwords of indefinite length
Answer: The /etc/shadow file was created for security reasons, and holds each user's encrypted password.
Originally, the encrypted password was stored in /etc/passwd.  /etc/passwd had to be world readable so that the system could map userids to user names, and so that users could find out information about each other, e.g. the other user's home directory, or their phone number, which was traditionally stored in the "gecos" field and displayed by the "finger" utility.
But then people realized that this was a security problem.  Anybody with enough time could do what's called a bruteforce attack, by programatically generating encrypted passwords for every possible password.  If the attacker did that without actually trying to log in via telnet or ssh, the system could not know that it was being attacked.
So the encrypted password was moved into the newly created /etc/shadow, which is readable only by root.
It also contains other information that the /etc/passwd file did not support related to the user's account and password, e.g. when the password was last changed and when it will expire.
See man 5 shadow (web version) for full details of the file format.

I can't say whether it is the same for SUSE, without knowing which version of SUSE you are dealing with.  For example, your SUSE system may use Blowfish rather than MD5.
You also implied you were mixing your /etc/shadow file with a system running a different Linux distribution, but did not say what the other distribution was.
See Problems migrating shadow file from SuSE 9.3 to Ubuntu Server x86_64 for example.
To try to figure it out, open up /etc/shadow and see whether the encrypted password field starts with $1$ or $2$.  If it contains $1$, then it's MD5, and compatible with most other distributions.  If it contains $2$, then it's probably Blowfish according to Blowfish shadow files on Debian.
If you are using Ubuntu, the first Google search result for Ubuntu blowfish might be a good starting place.
Answer: Users are listed in the /etc/passwd file. This file contains many information used by the systemm not only to allow users to log in.
Each line corresponds to a user entry and different fields are separated by colons. The first filed is the login, it is followed by the corresponding password.
Encrypted passwords used to be stored in this field. However, the /etc/passwd file has to be readable by everyone on the system, so encryption does not prevent from brute force attacks, as it has been said by @Mikel. The solution was to move these encrypted passwords in root-only readable file: /etc/shadow.
Thus, /etc/shadow contains the encrypted passwords of the system's users. The system knows it has to check for passwords in this file when password fields in /etc/passwd contain an x alone (meaning "cross over to /etc/shadow")
Comment: Note that passwords stored in `/etc/passwd` were/are still hashed in exactly the same way they would be if they were in `/etc/shadow`. You don't actually *say* that passwords in `/etc/passwd` would be plaintext, but it would be easy for someone unfamiliar with *nix password handling to misinterpret your answer as implying that.
Comment: I don't think the `x` actually means anything. It's there just as an invalid hash (one that doesn't match any password). Some systems use `!`.
Answer: Let's see if I can get all the up-votes in the world, since I wrote what became the Linux Shadow Password Suite in '87 ;)
The original /etc/passwd file contained a modified DES-based hash of the cleartext password. At the time the crypt() function was created, it was believed (and this was stated by the creators of the UNIX operating system) that attacks against the password hash would be infeasible, due to the number of possible passwords and the use of a 12-bit (4,096 possible values) "salt". Each possible cleartext password had 4,096 possible hashed values, and with 64-bits of hashed result, that gave a total of 2^72 possible password hashes.
As another poster mentioned, /etc/passwd was also used by various utilities to map between user names and UID values (the /etc/group file provides the analogous function for groups) and that required it be world-readable.
In the 1980s it became obvious that dictionary attacks against the password hash stored in the /etc/passwd file were becoming feasible and /etc/shadow was introduced to AT&T UNIX in an early release of System V. I documented which manpages I used to write the original Shadow library, and I've since forgotten, but it was definitely an early System V release, probably SVR3.2.
What AT&T did, and what I implemented for SCO Xenix (the original SCO Xenix, not the later evil SCO Xenix) in '87 that eventually came into use on Linux, was simply move the hashed password to /etc/shadow. This prevented the drive-by attack, where an unprivileged user acquired a copy of /etc/passwd and ran an attack against it. If you're familiar with why I wrote Shadow in the first place, I had a user download my /etc/passwd file via UUCP back in the days when we still used UUCP for just about everything.
By the time Linux was created and came into wide-spread use, there were a very large number of tools for attacking password hashes. High-performance re-implementations of crypt() were one avenue, and dictionary-based attacks via tools such as Crack and libcrack were others. The initial port was done by Nate Holloway and Floria La Roche (I gave them credit, I don't know if anyone did the work before them).
Eventually the use of crypt()-based hashes, even in a protected file, was no longer secure and the original MD5-based hash changes were made. MD5 eventually was considered to be too weak, and newer hashes were used.
In theory, a strong enough hash could be stored in /etc/passwd. Poor operational security means that many systems have their /etc/shadow files available through various attack vectors -- "I stole the backup files" is probably the easiest.


User account password encryption by web based emails service providers?

Question: Do web based email providers like Gmail, hotmail encrypt user account passwords when saving them to their database? If they do, why does account information get leaked after a hack?
Answer: They are not encrypted, they are actually hashed: they are both cryptographic operation with the difference that hashes are irreversible.
One cannot simply "decrypt" a password hash. However, given a password, one can generate a hash for it.
If an attacker has obtained by some mean the content of the password hashes database, he can then think of a random password, compute its hash, compare this computed hash to check if it matches one the hashes stored in the database. If it does, then it means that the attacker has just guessed the right password for the corresponding user!
To make the process quicker, the attacker would use two main means:

Instead of thinking of a random password, he will use a very large list of the most frequently used passwords and dictionary words, which will usually already provide him a lot of accounts, but furthermore he will then automatically apply to these potential passwords a set of frequent transformations wrongly perceived as secure by a lot of users.
Some password cracking software allow to accelerate the hashing process by using the GPU (the graphic card processor) which happens to be quicker than the CPU for the cryptographic operations required to compute some hash (the effectiveness heavily depends on the exact hash algorithm used, modern recommended hash algorithm are specially thought to fight against this).

Such process will usually not allow to get all passwords from the leaked databases, but it will still allow to get a lot of them: all the weaker ones. So, if you use a strong password, and the website used a proper password hash method, then even in case of a database breach your password may still be safe
Comment: It's not so much that GPUs (and other, more specialized hardware) are fast at individual hashes - they usually aren't - but that they are extremely *parallel* and can compute hundreds or thousands of hashes at the same time. A modern "enthusiast"-grade GPU can compute billions of "secure" hashes per second. This is why password hashing algorithms try to not only be slow (via high iteration counts, or deliberately slow hashing code), but also RAM-expensive; fast RAM (such as used in video cards) is expensive, and RAM I/O is still a performance bottleneck even when using it.


Form that sends data to an admin panel and can export it

Question: Is there a way to have a form submit data to a admin control panel where the data is stored and can be rectified there? Could it also be able to export the data as excel for example?
Comment: If I understand you better ... you want to have a form that submits data ... but you want to see the results of the data in a CSV or somewhere that doesn't require logging into WordPress?
Comment: @Damien, preferably in stand alone user admin panel. I would in fact have to convert a lot of Excel sheets already in existance into a database to be stored in the database/admin panel, where it could then be accessible and exported to formats like excel, word, etc. But from then on I would have to have a form to be filled with the user's details and stored in the database as well.
Comment: you say you want an Admin Panel BUT you don't want the user to login to WordPress Admin - but you 'cant' really do that. Why not create a WordPress user that only has login access and to see the form data? that is easy to do with a plugin like User Role
Answer: there are 2 very popular form plugins

Gravity Forms - extremely customisable and saves all data to your database (Commercial)
Contact Form 7 - also saves everything to your database and easy to use (Free)

Both send the data to the Admin panel so you can review inside WordPress.
I know that Gravity Forms has an option to EXPORT the form entries as a CSV file.
Review Form Submissions without logging in
Both can send email notifications to your email address so you can see what has been submitted without logging into WordPress.
The other way to see all the form submissions without logging in is to open your SQL database and view the data there. Then you can save the table as a CSV.
Comment: I mean a special admin panel easy to use that is not inside Wordpress menu (if that would be even possible). How can I gain 15 reputation to rep someone btw
Comment: there are lots of ways to earn rep ... 1. Complete your profile.  2. try reading all the FAQ's at http://wordpress.stackexchange.com/faq youll get a badge for that and 3. check your priveldges. http://wordpress.stackexchange.com/privileges  and  be careful to stop asking questions that are getting you negative rep.
Answer: You can try my admin panel class which is create admin panel pages for you with ease and has Import Export features.
And Available fields are:

Input
Textarea
Radio button
Checkbox
Select Dropdown
File Upload
Image Upload
WYSIWYG editor
Date Picker
Time Picker
Color Picker
Taxonomy List Dropdwon or checkboxes
Post list Dropdown or checkboxes
WordPress User Roles Dropdown or checkboxes
Syntax Highlighted Code Editor (PHP, CSS, HTML, JAVASCRIPT)
Typography Field (set of size, color, face, family fields)
Sortable Drag & Drop
Repeater Field which can be set as sortable
Conditional Field block
Comment: So that creates admin panel pages? How would they be accessible to the user? Would that be inside wordpress as well?
Comment: you set the needed capability when you create the page/panel and its for using inside the WordPress admin area.


Does Unity generally perform better with proprietary Nvidia drivers?

Question: I always feel stressed when updating or switching to proprietary drivers, because it has crashed my Ubuntu before. Unity is a little slow on my system. Can switching to a new version of proprietary drivers speed it up some day?
Answer: Generally it is a smoother experience (depending on which Nvidia card you have) although the Nouveau driver is definitely improving.
Have you/are you willing to try unity-2d?  It should run much more smoothly for you
Answer: Generally speaking the window manager itself does not perform better, but the applications do. This is most notable with any graphics intense , 3d application or games.
I try to stay with the open source drivers for the same reasons you do.
If the open source driver is causing you a problem, try the nvidia driver, you can always revert.
https://help.ubuntu.com/community/BinaryDriverHowto/Nvidia
Answer: Yes, in my proprietary driver is smoother than open source driver. Extremely on games/3d applications.
I have not any problem on installing Nvidia proprietary driver!
Following procedure is what i used for installing Nvidia driver:

Download appropriate current driver from NVidia.com
Copy downloaded driver into Desktop
Right-click on it and under Permissions tab active Execute check box
Press Ctrl+Alt+F1 to switch to tty1
Loggin and stop LightDM service using sudo service lightdm stop
Goto desktop folder and run Nvidia driver using following commands: (notice that my Nvidia driver is NVIDIA-Linux-x86_64-285.05.09.run)
cd ~/Desktop
sudo ./NVIDIA-Linux-x86_64-285.05.09.run
It will notify you to problem on installing driver and will asks you to uninstalling Nouveau driver. Also it will asks "Do you want to disabling Nouveau driver?"
Let it to do that.
Again it will prompt you to unsuccessful installation. Don't worry, it is OK... reboot your machine using sudo reboot
Now your resolution is 800x600. It's OK.
Repeat step 4 ~ 6 and complete installation procedure and let it to auto configure X
Reboot or start LightDM service using sudo service lightdm start command

Enjoy! :)


What happens if you let a cable roll slip into a black hole?

Question:
Does the cable roll spin faster the more cable goes into the black hole in reference of a observer standing next to it?
Can gravity pull the cable that it exceed the speed of light inside a black hole in reference to the center of the black hole?
Comment: Gert, as evidenced by your question and comments, you do not yet have even a basic grasp of SR much less GR.  For example, when you state something like "approach the speed of light" in SR, you should have in mind an answer to the question "in which reference frame".  In GR, that question is much more subtle due to the curvature of spacetime.  The bottom line is that your questions are not remotely well defined and, frankly, few here are likely to engage because almost any answer will assume a basic understanding of the physics.
Comment: What do you mean by "pull force exceed the speed of light"? A force is not a speed, you cannot compare the two.
Comment: I assume when gravity pulls harder on the cable, the cable moves faster to the center of the black hole and at some point reaches the speed of light?
Comment: It can approach the speed of light, but cannot reach or exceed it.
Comment: Ok thanks, what about the cable roll outside the black hole, will it spin at a constant rate or accelerate?
Comment: Can I also state that gravity has a limit so it can not pull harder on objects that approach the speed of light?
Comment: True, but a simple yes or no will do for now :)
Comment: I'll give an answer a shot. It will probably get picked on a bit for the details, but hopefully the OP will learn a couple of things at least.
Comment: I added a observer reference frame.
Answer: Whether it's a black hole or some other more ordinary mass pulling on your rope isn't actually that interesting. Let's think about a cable unrolling above Earth to start with.
What we have is a pulley with a rope hanging off one side. The weight of the rope exerts some force on the edge of the pulley, causing it to undergo angular acceleration (starts to spin). This releases some more rope, so the force increases a bit, acceleration increases, pulley spins faster and faster. Some assumptions:

Let's assume that our spool of rope is very big, so that there's always a lot of rope left in it, and the change in the mass of coiled rope is unimportant.
Let's also assume the bearings or whatever that allow the pulley to rotate are frictionless.
Also, let's not complicate anything with relativistic speeds, yet.

Once the end of the rope hits the ground, the weight of the portion of the rope lying on the ground is no longer felt by the pulley. Since there is always a constant amount of rope between the pulley and the ground, the force is constant. The pulley continues to spin faster, but with constant acceleration. Still assuming speeds stay non-relativistic for now. Now for the first consideration with the black hole. Instead of "hitting the ground" the end of the rope now "hits the singularity". The weight of the portion of the rope absorbed by the singularity is no longer felt by the pulley. We're adding a bit of mass to the black hole, but let's assume that the mass of rope that we're feeding in is small compared to the mass of the black hole (similar to how you'd assume the mass of rope lying on the ground is much less than the mass of the Earth). This means the gravitational force exerted by the black hole doesn't increase. So we really have exactly the same scenario. Don't worry, it will get more complicated in a minute.
As the pulley keeps spinning faster, its edge (the part that's spinning fastest) grows to an appreciable fraction of the speed of light. The rope is coming out at the same speed that the edge of the pulley is moving, so it is also now moving relativistically. Now Newtonian intuition starts to break down. Another way to look at what has been going on is in terms of energy. The rope starts with some gravitational potential energy (from having a height above the Earth/black hole/whatever). As it falls it loses potential energy, which goes into the kinetic energy of the rope and rotating pulley. Newtonian considerations would tell you something along the lines of:
$$-\Delta U = \frac{1}{2}mv^2 + \frac{1}{2}I\omega^2$$
$v$ is the speed of the rope, and $\omega = v/r$ is the angular speed of the pulley (equal to the speed of the rope divided by the radius of the pulley). Anyway. This breaks down once speeds start getting relativistic. Energy is still conserved, but the change in speed obtained for a given energy input starts to decrease. You can put in more and more energy, and the speed will always keep increasing, but the increase for a given amount of energy gets smaller and smaller. The speed keeps increasing, approaching the speed of light, but never reaches it. You'll get to $.9c$, then $.99c$, then $.999c$, eventually $.9999999999999...999999c$, but never reach $1.0c$.
In practice, a lot of other things prevent you from getting to relativistic speeds in the first place. You might have a nearly frictionless pulley, but nearly isn't zero, and as speeds pick up the heat production from friction will destroy your equipment. Or air friction on the rope will increase with the speed until equilibrium is reached and the rope is falling at a constant speed. There is no air above a black hole of course... You need a lot of energy to get to relativistic speeds, which means to need to drop a LOT of rope. And the more rope you need to drop, the more needs to be coiled. But this increases the mass of the coil, which increases the energy needed to accelerate it. So more rope is needed. But this increases the mass of the coil... it's likely your coil will get so massive that it will collapse and form it's own black hole before you can get to relativistic speeds by unrolling it.
There are also worries about the tensile strength of the rope. You can't hang your spool arbitrarily high, at some point the weight of the rope below a given segment will be so much that the rope will break. This gets even worse around a black hole. As the rope approaches the singularity, the tidal force on the rope increases dramatically. Basically the BH is pulling harder on a nearby piece of rope than a more distant piece. As the singularity is approached, the tidal force tends to infinity, so even the most durable imaginable rope will be torn apart.
So far this has all been classical mechanics and special relativity. I won't even try to start bringing general relativity into this.
That's some ideas to get you thinking a bit. You can play with assumptions and adding in new considerations for different effects more or less ad infinitum. But the big take-away message is:

Nothing with mass can move faster or equal to $c$, even if black holes are involved (massless particles like the photon can move at $c$, and in fact cannot move any faster or slower than this).
The faster an object is moving, the more energy it takes to increase its speed by a fixed amount. This becomes important when speeds are a significant fraction of $c$. At much lower speeds the effect is safely ignored.
Comment: When talking about these speeds... the tension in a cable travels at the speed of sound; very very slowly.
Comment: I assume that in general relativity the rope get a little bit longer then it suppose to be :) but does not contribute to the pulley speed from the observer?
Comment: No. I don't think I can really explain much more without a full blown introduction to the subject. At this point it's probably time you look at seriously trying to learn a lot about the theory, mathematics, etc. if you want to know more. Good luck and enjoy :)
Comment: @Kyle "like the photon can move at c, and in fact cannot move any faster or slower than this" What about light traveling through a medium? Doesn't it slow down?


Are there analog re-configurable filters?

Question: I know that we can build a chip (or circuit) or use FPGA to have re-configurable digital filters. But how about analog filters, can we have re-configurable analog filters?
thanks
Answer:
can we have re-configurable analog filters?

Yes. The knob you turn on your grandma's kitchen or living room radio changes the tuning of an oscillator by changing the capacitance of a component. Any stable oscillator is essentially a filter for its resonant frequency.
Also, plenty of other examples: Tunable RC filters with adjustable R; mechanically tunable metal spring filters; tunable microwave cavity resonators with tuning screws, PIN diode-based LC filters... the list goes on.
Basically, take any analog filter topology and make one of the components adjustable, you get a reconfigurable filter.
Is that useful? Well, sometimes it is, if you need to keep your passband adjustable (though that is more commonly done via octave filter banks) or need to adjust your ADC's anti-aliasing filter (though that is more commonly done using high-rate ADCs and digital filtering / sampling methodology).
Generally speaking, you avoid doing complicated things with filters in analog domain as far as possible, really. Analog filters are always a trade-off, and digital filtering hence has replaced them wherever feasible.
Can you get as much freedom as with a digital filter? Practically never. Something like a RRC is pretty trivial in digital, but will need a lot of work to even remotely approximate in analog domain, it will be dependent on temperature, and costly. The closest you'd get to an analog RRC would probably be a bucket-brigade filter, and that's almost a digital filter: discrete in time, but continuous in amplitude.
Comment: I am thrilled with your professional answer, thanks very much
Comment: It may be worthwhile to mention "tone" knobs found on powered audio equipment as well as entirely-passive electric guitars.
Comment: You can also use switched capacitors filters as programmable filters too
Comment: @Ben there's a large semantic overlap between switched cap and bucket brigade filters. (I'd say they are essentially the same thing; or, the switched capacitor filter is the dominant implementation of a bucket-brigade filter; you can do the same using e.g. switched lengths of transmission line, but I'd call that "slightly exotic")


Treatment of ambidentate ligands in geometrical and optical isomerism

Question: Are ambidentate ligands considered different entities when they donate through different atoms? For example will a hypothetical square planar complex like [Pt(ONO)2(NO2)2] show geometrical isomerism?
Comment: i think you are right
Answer: To specify [Pt(NO2)4]2+ would mean the ligand donates electrons through the N-atom, and not the O-atom. If it were to donate through O, it would be written as (ONO) and not (NO2).
Thus, this compound would not show geometrical isomerism. Also note that, if NO2 ligands are replaced by ONO, then that is a form of structural isomerism in complexes, called linkage isomerism.
Comment: Edited the complex to [Pt(NO2)2(ONO)2]. This doesn't answer my main question though, as to whether -ONO and -NO2 will be treated differently when considering stereoisomerism
Comment: If you write the complex as you have written now, then it does show geometrical isomerism. The point is, if a ligand is written as NO2 then it is nitrito-N and if it is written as ONO then it is nitrito-O. Similarly for other ligands (CN and NC are different, etc). Just like in organic chemistry, when discussing stereo isomers, don't count structural isomers.


Nuclear reactions and energy conservation

Question: How are nuclear fission and fusion compatible with the law of conservation of energy?  During fission $He$ splits into 2 hydrogen atoms along with enormous amount of heat energy and hydrogen also combine to form helium with enormous amount of heat energy. But in my opinion to follow the law of conservation of energy one of the reactions must be endothermic. Please clear this vagueness.
Answer: The energy released/absorbed in nuclear reactions depends on the binding energies of the nuclei.So yes,energy is released in nuclear fusion of hydrogen to helium while energy will be absorbed in the reverse fission reaction.The curve below illustrates this point precisely:

Comment: Looking at this graph you also can deduce that fusion process (taking place in star) will cook element up to iron and then stop as it is no more possible to gain energy doing fusion from iron.
Comment: As an amendment to @floqui's statement, it will be possible to endothermically produce elements heavier than iron in stars (particularly during supernovae), but these processes will not create net energy, but will rather consume energy produced by the fusion of lighter elements.
Answer: Short story:  They aren't compatible.
The Law of Conservation of Energy, and its companion the Law of Conservation of Mass, are only approximations of the Law of Conservation of Mass/Energy.  The approximations work because of the huge conversion factor, $c^2$, to go from mass to energy.
This means that in any chemical reaction, the "mass" of the energy involved is immeasurably small, compared to the mass of the chemicals taking part.
Look at any specific nuclear reaction (fission fusion, decay, etc) and measure the masses and kinetic energies of all the reagents and all the products.  Convert the energies into masses using $c^2$, and the total mass/energy will be conserved!


Completed Admin Beginner trail but now it's showing 48% complete

Question: A few months ago (on April 28, 2017) I completed the Admin Beginner trail in Trailhead. Soon afterwards I began the Admin Intermediate trail and got about half-way through before project schedules caused me to stop or spend little time on Trailhead.  (The last time I completed a unit was on June 30.)  Today I went back into Trailhead to pick up where I left off but found that it showed that I am only 48% of the way through my Admin Beginner trail.  Has anyone seen this happen before?
Answer: Yes, this happens from time to time. The reason why is that new content is being added on a regular basis (approximately every six weeks). Reaching the end of a trail doesn't mean there won't be more of that trail later.
Answer: Yes I have seen this before. SalesForce regularly update the content of trails, and sometime add additional modules to existing trails! I often find that after a few months away from Trailhead, that when I login I need to complete additional modules to 're-complete' my trails (and thus regain the badges).
I think this is good, as SalesForce is an ever evolving platform, of course the modules content will change over time.


Sample size in a population of 300

Question: I have to conduct a survey in the discipline of International relations. I have a list of 300 diplomats to interview for close ended, open ended questionnaire. I want to select randomly every fifth from the list and the number of sample comes to 60. Is it a correct same size from a population of 300? would be grateful for your answer please.
Answer: You would need at least 169 samples (with 95% confidence and with 5%- Margin of error) which is a most common requirement.
With your current sample size you are having 11.3% margin of error (with 95% confidence). Use this on-line sample size calculator to calculate sample. Also please see the table given below for your quick reference.

Hope this helps!
Answer: The prior answers regarding sample size are good ones. I want to address the issue of using n-th select to choose your sample. In a famous example from the 50s Paul Lazarsfeld, the great Columbia sociologist, did a huge study of The American Soldier where he selected every 10th name from a list provided by the Army. Using this criteria, what he got back was a sample of non-commissioned officers (NCOs) since the basic unit in the Army was the platoon containing 9 men plus an NCO as the 10th. Luckily, Lazarsfeld discovered the error before the study was done and was able to correct it in time.
The point is that in using n-th select, unless your list of diplomats is randomized, any structure, organization, sorted order, etc., of any kind that exists in the original list will result in a nonrandom sample.
Comment: Grateful to all for help. Hope to do better in my survey. Thanks
Answer: It will depend on the bound (margin of error) that you want.  Here's the general sample size formula for a proportion:
$$n = \frac{Np(1-p)}{(N-1)\frac{B^2}{4}  +  p(1-p)}$$
where p is a guess at the true proportion, B is the desired bound, N population size.  If you don't know p, the worst case is $p = \frac{1}{2}$, so with your N = 300, we get the formula
$$n = \frac{300}{(299)B^2  +  1}$$
For the case you stated (n = 60), the bound you would expect (at worst) is
$$B = 2\sqrt{\frac{300-60}{300}\times\frac{1}{4\times60}} = 0.11$$ So a sample of size n = 60 would give a margin of error of around plus or minus 11 percent.
This assumes the worse case where the proportion is really around 1/2.  If it is close to zero or one you will get a better bound.

Sample size in a population of 300


Numbers related to attacks moves

Question: Is it better to have a much higher special move number or first attack number. Also do they increase when evolved or do they stay the same.
Answer: A pokemons start attack moves will not change until you evolve it, so you should look for one with a high normal attack value and a good special attack. I prefer special attacks that take longer to get ready but have a very high attack value. When you evolve a Pokemon these attacks will change so they don't matter much. Do you expect to have a gyrados with splash? Therefore if you're planning to evolve a Pokemon, wait until you have enough candies and then pick your highest CP Pokemon, because in this game that's really all that matters.

Numbers related to attacks moves


best way for running code in async with kotlin

Question: hi i want use jsoup to load a large table from html, what is the best way for doing this in async way?
AsyncTask? coroutines? doasync library? which one? i need show progressbar while fetching data so please tell me what is the best way?
UPDATE:
i want run this code in async
doc: Document = Jsoup.connect(url).timeout(0).maxBodySize(0).ignoreHttpErrors(true).sslSocketFactory(setTrustAllCerts()).get()
// some code for parsing...

Comment: Of those three, I would use coroutines, perhaps feeding into a `LiveData` for use by the UI layer.
Comment: @CommonsWare can you give me a example of that?
Answer: In Kotlin, the general approach is coroutines, but normal threading is also a completely fine option, depending on what you're doing.
For example, if your operation is a thread-blocking operation, it actually can't run safely in a coroutine unless it's dispatched in a separate thread. For coroutines, you need to know the difference between suspending and blocking (huge difference).
So if reading the HTML table is a blocking operation, and you don't need to integrate with other coroutines, then a normal thread works just fine. There are many Java examples that are transferable to Kotlin.
With coroutines, you can do something like:
suspend fun getDoc() = withContext(Dispatchers.IO) {
    Jsoup.connect(url).timeout(0).maxBodySize(0).ignoreHttpErrors(true).sslSocketFactory(setTrustAllCerts()).get()
}

Then, in your main code:
fun main() = runBlocking {

    val deferredDoc = async { getDoc() }

    // Do whatever.... it's not being blocked...

    val doc = deferredDoc.await() // SUSPENDING CALL - but not blocking
}

Obviously, your program's structure will look different than this example, because it depends entirely on what code you want to execute asynchronously with "getDoc()".
For example, you can even have another coroutine that executes while "deferredDoc.await()" is suspending, without even creating another thread. That's the benefit of coroutines.
In the structure above, we have 3 guaranteed threads:

Main thread, which is always blocked
Main Coroutine thread. This is what the coroutines generally run on. Kotlin coroutines will run your coroutines asynchronously inside this thread using suspension.
IO thread. This is what your blocking code will run on.
Answer: I'll advice you try out Kotlin Coroutines. This would enable you dispatch expensive or long-running operations i.e. querying databases, making network requests/calls off to other threads thereby not blocking the Main Thread. Coroutines help you avoid the hassle of callbacks. Also, Google deprecated the AsyncTask API (in Android 11) and recommends using Java's Concurrency framework or Kotlin Coroutines as the way to go for multi-threading purposes.
Comment: thank you, can you please give me a example for doing that? i updated my question and i added codes that i want to run in async
Comment: The answer provided by @Clay07g shows how to get this done ( ;


I want to print some posters but don't know where to look for Images which are not Copyrighted?

Question: I started a new website for selling posters of Movies, Celebrities and Sports. Problem is most of the images that I got from Internet are now claimed by some people that they have copyrights of the images. I am trying to find the right Images but its very difficult for me. I looked in many free stock images website but was unable to get Images which are worth printing.
Answer: I am not a lawyer. You should get one, if you are concerned about possible legal issues.

First of all, pictures that are not copyrighted (i. e. in public domain) are not your only hope. There are quite a lot pictures that once you get them might be legally used for any purpose (incl. for profit), modified and/or reproduced without royalty, they are called 'free' (as in 'freedom') or 'libre' ones. The popular copyright licenses for free/libre works of art are: CC0, CC-BY, CC-BY-SA, Free Art License. (Do not forget to understand them, they have certain requirements.)
You might use, for example, Google Advanced Image Search (usage rights: 'free to use, share or modify, even commercially') to find free/libre images on some topic, but you have to be careful: copyright status might be mislabeled, you'd better double-check it with reverse image search and common sense. Some resources (like Wikimedia Commons) are quite trustworthy, some are not.
Also, a copyright of author of an image is not the only thing you have to be aware of: if it's a photography of a person, that person also have certain right that varies with jurisdiction which you might violate; some words or (a name of a sport event for example) might be trademarks, et cetera, et cetera.


Call a block in layout.xml file with A/B type

Question: This is about block type which I don't know exactly.
<block type="A/B" name="root" output="toHtml" template="">

What is "A/B" as block type there?
Any help appreciated.
Answer: type="A/B"  here A is for Module name and B is for class name of that module(A).
It can be denoted that A refers to => page <=> Mage_Page_Block
Which is declared at app/code/core/Mage/Page/etc/config.xml
And B refers to => html => Mage_Page_Block_Html Class
as well as declared at app/code/core/Mage/Page/Block/Html.php
Hope this helps. :-)
Answer: Here A is a class group of Block for example core, page etc. Class group is a node between <block> and <class> i.e. <testing_contact> in following example.
if you consider for you custom module then whatever the class group you have mentioned in your configuration is the part of A.
for example suppose you config file is as bellow.
<?xml version="1.0" encoding="UTF-8" ?>
    <config>
        <global>
           <blocks>
              <testing_contact>
                  <class>Testing_Contact_Block</class>
               </testing_contact>
           </blocks>
       </global>
    </config>

Then in this case your A is testing_contact.
and as far as B is concern it is simply a file under Block directory.
so for above example if we say <block type="testing_contact/product" />
then product is a file which is available under  Testing/Contact/Block directory.
This directory is find by <class>Testing_Contact_Block</class>
So if we consider any core example lets say <block type="cms/block" /> then for this if we look at a config file of cms module located at app\code\core\Mage\Cms\etc\config.xml here you will get a code like
        <blocks>
            <cms>
                <class>Mage_Cms_Block</class>
            </cms>
        </blocks>

so your A is cms and B is block and if you look at app\code\core\Mage\Cms\Block you will get a file with this name.
Hope this will help you to understand.
Comment: I was little bit late for answer
Answer: Magento Bloks are built by three parts.
The first part is the layout, here you specify where the block is going to be added.
The second part is the template, this is phtml file (html with php) where you are suppose to only add what is going to be displayed.
The last part an the one that must be added in that "type" is the block class. This class contains the code that is not planed to display something and allows you to set things like the template (second part) that must be render.
This class will extend a block class from magento core.
Imagine that you need to use parameter from the configuration and display those parameters in any place.
You will have:
A layout to add the block.
A block class that extends Mage_Core_Block_Template and implements getConfig and initializes $_template with the path to the template(phtml)
A template that will use the getConfig to get the config values and display it.
The type attribute points to the block class. The reference must be done in the magento way to point files. I mean in the config.xml you need to add a blocks like this:
    <blocks>
        <NAMEBLOCK>
            <class>COMPANY_PLUGINNAME_Block</class>
        </NAMEBLOCK>
    </blocks>

and after refer it as "NAMEBLOCK_NAMEFILEWITHOUTEXTENSION"
After you need to add the block class file to the path COMPANY/PLUGINNAME/Block/NAMEFILEWITHOUTEXTENSION.php


Custom tool to deploy smart contract

Question: We want to migrate away from truffle for deploying the smart contract. What kind of approaches would be good to do this? Can deployment be done without truffle or similar tools, and done manually "pure" way?
Answer: For simple things, I think Remix online in remix.ethereum.org does a pretty good job and you have access to the debugger. Used together with Metamask make things even easier and this is always up to date with solidity new releases.
Combining your preferred text editor with Web3, in particular, web3py make things clean if you are familiar with python, but the wrapper for solidity is not up to date with the latest version.
Answer: You can also use web3 deploy to deploy your contract through a geth node (test/mainnet) by pasting your code into a browser with remix, then clicking the details tab. coping and pasting the web3 deploy script from the details tab into your terminal which has geth running. This will then deploy the contract to which ever network you are working on, don't forget to specify which EOA you wish to deploy from and the constructor arguments if there is any within your contract.
hope this helps

Custom tool to deploy smart contract


Material Shader for different color rings/areas for a plant trunk (Equisetopsida)

Question: i want to recreate the trunk of this plant with shaders, but I don't have that much experience how i could do this. Could someone show me a node setup to emulate the trunk? I would be really happy! So it's more or less about how I can make the different color rings and the transitions, which aren´t quite perfect.
Comment: Try using a Wave texture.
Answer: I would use a Gradient Texture, isolated on the Z-axis, as well as scaled with a Mapping Node and repeated using a Fraction (Math) Node. This way, the "taper" starts at the bottom of each "segment" and can be used as the basis for a Bump as well as a ColorRamp:

However, for added realism, I would suggest warping the input vectors with a Noise Texture first, which will both distort the "seams", as well add some "organic" bumpiness to the surface:

Here's a setup that better replicates your sample image - I added a bit of "plant subsurface" (low value) and changed the subsurface radius values to slightly favor green (0.2,0.6,0.4). Notice the pattern is different on all of the "sticks - this is because I duplicated them in Edit Mode) - if you duplicate them in Object Mode , the pattern will be identical because the texture is using Object Texture Co-ordinates which are relative to the object's origin - A workaround is to use Generated Texture-Coordinates, but that will require some slight alterations to the Mapping Node (to avoid distortion):
Comment: Thank you so much for your answer! That is really awesome! Unfortunately i can´t really reproduce it, altough i made the same settings. I played around with the Divide Node etc. but regardless what i´m doing, rings like yours don't come out so clear and the white edge isn't visible either. I am attaching a screenshot of my node setup in my question. Thank you again!
Comment: Some of the way the values apply are dependent on the size of the base mesh as object texture coordinates place the 0,0,0, mark directly at the origin (usually the center) of an object and increment (+ or )- from there (depending on direction) - Notice I scaled by 4 on the Z of my Mapping node - you may need to change your scale value  differently (higher or lower) to make it "fit" your object.
Comment: Yes i found that also out but i have to increase the Mix Node after the Noise Texture to something like 0.95 so that the rings arent distorted to much like in your example. And then the noise is almost gone. I attached the picture it in the question.
Comment: Try reducing the scale of your noise texture.
Comment: Aah this was the problem the whole time. Thank you again, it´s awesome! :))


Does the effect of the Jungle Drums upgrade stack with multiple Monkey Villages?

Question: In Bloons TD 5, there is a building called the Monkey Village. It primarily provides upgrades for other towers in its range, and one of these is called Jungle Drums and increases the attack of towers in the range of the village, which leads me to my qustion: If I build multiple Monkey Villages, each upgraded to have Jungle Drums and have the same towers in their range, will the attack speed increase stack, i.e. will the attach speed of the towers in their range increase for each Monkey Village with Jungle Drums?
Comment: To those downvoting, might I learn what you see wrong with this question?
Answer: No matter how many villages you have, this buff, or any buff for that matter, will not stack with multiple villages. 5 villages will have the same effect as one. However, if you have a 4|0 village and a 0|4 village, a tower in range of both of them will receive the effects of both villages.
Answer: No, the Jungle Drums effect doesn't stack. However, on older BTD 5 Mobile versions (and Battles) the MIB Call to Arms boost did stack, being able to make towers shoot up to 60 times per second.
Answer: No, unfortunately, it does not stack if you put multiple Monkey-Drum-Villages in the same area, I have tested and re-tested this in  game multiple times, for example, one of the times I tested it with 20 of them, and they were all centered around a single 0/0 dart monkey, and the effect was only that of one-fold the advertised amount, as otherwise, it would clearly be a visible change, when you are increasing the effect 20-fold, which would cause a tower that fires once every second to fire about 16.37 times per second, an obvious difference, however, all of these villages only increased his rate of fire by 15%, the advertised benefit that is given to nearby towers, even when there is one village, so, clearly, this effect does not stack, sadly.


Fix text stretching when printing to a receipt printer with Java

Question: I am printing to some Epson receipt printers by implementing the Java Printable and placing my code into the print method. To draw the text to the printer I use Graphics2D.drawString. I am also drawing a rect to the printer to see how to compares to the text size when printing to other printers. When printing to the receipt printer the text on the paper is about double the width of printing to a laser printer or the XPS writer virtual print. Is this a problem with the way Java draws text to the Graphics2D object? I have the newest version of Java installed of 6 update 20.
Any Ideas of what to look into would be helpful.
Thanks.
Here the code I am using. With this example I am seeing the letter 'c' on the right edge of the rect when sending it to a XPS writer and if I print it to my receipt printer the 6 is on the right edge of the rect and you can tell the text is much wider then it should be. The rect seems to be the correct size.
I have tried changing the page and margin sizes but it does not seem to fix my text problem. I got these paper sizes and margins from how Microsoft Word is auto detecting the printer. Word prints the text correctly to the receipt printer.
public static void main(String[] args) {
   PageFormat format = new PageFormat();
   Paper paper = new Paper();

   double paperWidth = 3.25;
   double paperHeight = 11.69;
   double leftMargin = 0.19;
   double rightMargin = 0.25;
   double topMargin = 0;
   double bottomMargin = 0.01;

   paper.setSize(paperWidth * 72.0, paperHeight * 72.0);
   paper.setImageableArea(leftMargin * 72.0, topMargin * 72.0,
        (paperWidth - leftMargin - rightMargin) * 72.0,
        (paperHeight - topMargin - bottomMargin) * 72.0);

   format.setPaper(paper);

   PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
   aset.add(OrientationRequested.PORTRAIT);

   PrinterJob printerJob = PrinterJob.getPrinterJob();
   Printable printable = new ReceiptPrintTest();
   format = printerJob.validatePage(format);
   printerJob.setPrintable(printable, format);
   try {
      printerJob.print(aset);
   }
   catch (Exception e) {
       e.printStackTrace();
   }
}

public class ReceiptPrintTest implements Printable {

    public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException {

      if (pageIndex < 0 || pageIndex >= 1) {
            return Printable.NO_SUCH_PAGE;
        }

        Graphics2D g2d = (Graphics2D) graphics;
        g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());

        Font font = new Font("Arial",Font.PLAIN, 14);

        g2d.setFont(font);
        g2d.drawString("1234567890abcdefg", 50, 70);

        g2d.drawRect(50, 0, 100, 50);

        return Printable.PAGE_EXISTS;
    }

Answer: Have you tried setting the font using setFont?
Comment: Yes, I added some more information on my problem and the code I am using.


Fragmented/broken down Text

Question: I'm wondering how to achieve the effect in this attached image where text is fragmented to various degrees, some to the point of illegibility while elements remain legible. I'm experimenting mainly with Photoshop but can try InDesign also.
Answer: You can accomplish this in Illustrator very easily but this method should work similarly in Photoshop. Instead of using the pathfinder tool, in Photoshop you would just use the rectangular selection tool and delete.
In Illustrator, you start off by typing your text and then expanding it. After it's expanded you should ungroup it.

After that you can start "cutting out" segments of the text using the rectangular marquee tool, (M) and then using the pathfinder function minus front.

You would just continue doing this until you have your desired cut-outs.
In the image below I marked out the general shapes the artist used to remove more an more of the letter.
Answer: There is no Automatic way of doing it, as you can see though it cuts off a bit more of each letter as it goes up. (in this case it also dows it in order, I didn't exactly do it like that)
I wrote out the text, then cloned it (Ctrl C, Ctrl V) and dragged it above the  text, now I just made some black boxes on the areas I wanted to cover, then selected my most recent line and repeated = (Clone and added some more boxes, to cover more of the text)
After each time I covered a bit more until it produced the desired effect:

Fragmented/broken down Text


What are the security risks associated with hosting a web application that does not handle sensitive data without HTTPS?

Question: Suppose one hosts a web application that does not handle any sensitive data (e.g. passwords, session cookies, etc.), without using HTTPS. What potential security issues arise as a direct consequence from this? Assume that man-in-the-middle attacks are useless, as there is no valuable data to extract from an attackers perspective.
Comment: A user that otherwise has his browser configured to exclusively browse via secure channels may just for the purpose of visiting your site modify configuration. Which could lead to the browser happily sending data (e.g. other sites cookies) to MitM attackers which without that override would have had no opportunity to request it.
Answer:
... a web application that does not handle any sensitive data (e.g. passwords, session cookies, etc.)

Sensitive data might be way more than passwords or session cookies. These might involve the specific URL, the content of the returned information etc. Just imagine users browsing sites with information to specific health conditions or sexual preferences - it is sensitive what the user is visiting even if no passwords or sessions are involved. Without HTTPS the ISP or some attacker in the path (like a parent in the local network) can view this kind of traffic.
Apart from that without HTTPS the integrity of the data isn't protected either, i.e. some man in the middle might modify existing content or serve its own content. This might be used to serve wrong information or block specific information. But it might also be used to run attacks against the user, as was done in this recent case in Egypt.
Comment: Or the page have no sensitive information but an attacker modifies it to ask for sensitive information.
Answer: HTTPS provides integrity for request and response data (headers and body). If the connection isn't secure, then someone may be able to hijack the connection, and inject unwanted info onto the pages you're browsing. This can make the owner of the website lose reputation if the injected data are harmful contents.
However plaintext HTTP does find some use in operating system updates - Debian use plaintext HTTP (assuming for efficiency reasons) and verify package integrity using digital signatures with public-key embedded into the operating system.
Another point is that, increasingly many Web APIs now require a "secure context" to operate. You can get it using loopback address when testing your website locally, but you need an HTTPS connection when you go online.
Comment: most of this doesn't answer the questions about risks. The part that does, repeats the other answer.


AJAX pagination requests growing exponentially

Question: I have a window with some (jQuery ajax) tabs, in each one I show some information about the user: messages sent, received, posts made and comments made. I need to do some pagination which work well when going back and forth between pages. But in the last two tabs (posts and comments written) I see the requests done exponentially increase. Here is part of the code
if ($pageno != $lastpage) {
   echo '
Siguiente
';
}

The code of the jQuery call working fine:
$(".display_messages").on("click", ".next_page", function(){
var pageno = $(this).attr('id').replace('next_page_no_','');
$.get('retrieve_messages_rec.php?pageno='+pageno,function(data) {
    $('.display_messages').html(data);
})
});

The code of the jQuery call working not that well:
$(".show_last_posts").on("click", ".next_page_posts", function(){
var pageno = $(this).attr('id').replace('next_page_no_','');
var usr_id= <?php echo mysql_real_escape_string($_GET['usr_id']); ?>;
$.get('user_last_posts.php?pageno='+pageno+'&usr_id='+usr_id,function(data) {
    $('.show_last_posts').html(data);
})
});

To give a better idea, when you click '.next_page' in the code working fine you see one request done each time you click. But when you click in '.next_page_posts' (in the second example) you get one request of the file 'user_last_posts.php' the very first time, three requests the second click (for next couple of posts), six requests to go to the third page, twelve for next, 24 then and so on. Why is it looping that way? Are the pieces of code shown here enough to see where my mistake is? Since they are basically identical, why it works fine in some of them but not in others? Or am I paranoid and that's normal? Thanks
Comment: Adding '$.one($.get...' calls the file twice only, but I am aiming to load it once only.
Answer: The difference is between .next_page_posts and .next_page. .next_page is bound to a single element, while .next_page_posts is bound to each post. Compare the two selectors:
console.log( [".next_page_posts:",  $(".next_page_posts").length,  ".next_page:",  $(".next_page").length] )