Can DNS point to specific port?

Question: I got virtual machine on some server and my URL is something like this.

22.214.171.124:8002

Can I get DNS who will point to specific port ?
One more thing. If I cant do that, can my virtual machine on server be sub-domain of that server DNS ?
Answer: DNS has no concept of ports for older protocols such as HTTP, HTTPS, and SSL.  DNS only points to the IP address.
The port to connect to for a particular service is determined by convention.  For example the default port for HTTP is 80, the default port for HTTPS is 443, and the default port for SSH is 22.
The only way to override the default port is to specify it in the URL (or on the command line for something like SSH).  There is no way to specify port numbers in DNS.  If you are running a website, your server must respond to HTTP requests on port 80 if you don't want to have an ugly port number in the URL.

It is not clear to me exactly what you are trying to accomplish.
If you want to run multiple sites on the same server, that is usually possible.  You can run multiple sites from different domains or different subdomains all in the same server.  You need to configure virtual hosts for that to work.
You may need to run a second server that runs a different technology (for example Tomcat to run Java or a Rails server to run Ruby).  In that case, it is common to connect your additional server to your main server using a reverse proxy to remove the port number from the URL.
If you are trying to host your site at home and your ISP is blocking port 80, then you are out of luck.  Your only options are to find different hosting or have a port number in the URL.

There is a newer innovation that allows port numbers to be specified by DNS: SRV Records.   However, SRV records only work with new protocols that say to use SRV lookups in their specification.   Older protocols such as HTTP and HTTPS will continue to use their current port numbers and won't support SRV.
Comment: I have virtual machine on some host who have address `www.example.com` , but can i get `mypage.example.com`? That server have about 10 virtual machines and one DNS, can our virtual machines be sub-domains
Comment: [According to this article](http://stuff.mit.edu/afs/sipb/project/vmdialup/archive/i386_linux24.old/lib/vmware-console/help/esx/networking_assignip.htm) each virtual machine must have its own IP address.  If that is the case, then yes, you can assign a subdomain to a virtual machine by putting the IP address in as a DNS `A` record.
Answer: PORT settings is a hosting server side setting and has nothing to do with the DNS. When pointing a domain or sub domain to an IP the hosting server will control the port element via a virtual host file.
So in other words, simply put the A record to IP address and then have the virtual host file control what port the server operates on.
Answer: What you are looking for is Dynamic DNS (DDNS) with port forwarding and a majority of DDNS service providers are offering port forwarding as well. You can then set up your domain something.something.com to 188.8.131.52:8002
You can get a router with DDNS support and if you configure it properly, the subdomain will be pointing to your home router and from there you can re-direct ports as well.
Answer: It's possible in apache to have a virtualhost forward to another server, on another port and/or another ip.
So apache acts as a proxy.
It is also possible to run a small virtualhost, that sends a 301 redirect to the other port
Note the first method hides the new port, while the second show it in the url

Can DNS point to specific port?


If 3SAT reduces to its complement then PH=NP

Question: In Chapter 5 of the Arora–Barak complexity theory textbook we are asked to prove the following statement:

If 3SAT is polynomial-time reducible to its complement then PH=NP.
  How do I prove this statement?
Answer: Show that in that case $\text{NP=coNP}$ which means $\Sigma^p_1=\Pi_1^p$, so the hierarchy collapse to the first level.
Answer: Here is the sketch for proving this: Suppose that $\mathsf{3SAT}$ is closed under its complement under polynomial-time reductions. Since $\mathsf{3SAT}$ is an $\mathsf{NP}$-complete problem, this implies that $\mathsf{NP}$ is also closed under complement, i.e. $\mathsf{\Sigma_n^p}=\mathsf{\Pi_n^p}$ where $n =1$. For $n \geq 1$, and $\mathsf{\Sigma_n^p}$, define $n$ non-deterministic Turing machines $\mathcal{M_1} \ldots \mathcal{M_n}$ each of which is in one-to-one correspondence with the respective oracles of $\mathsf{\Sigma_n^p}$. Define a non-deterministic Turing machine $\mathcal{M}$, as the concatenation of $\mathcal{M_1} \ldots \mathcal{M_n}$. Finally, prove that $\mathsf{\Sigma_n^p}$ answers yes iff $\mathcal{M}$ does so.
Some insights on why this works: The power of the polynomial hierarchy comes from the fact that one can negate the answer obtained from the oracle. Of course, if $\mathsf{NP}$ is already closed under complement, then one can simply concatenate polynomially many non-deterministic Turing machines and obtain the same computational power with a single non-deterministc Turing machine, which in turn implies that the polynomial hierarchy collapses to the first level.


what archetype that was used to generate a maven app?

Question: Is there a simple way of finding out what archetype that was used to generate a maven app in the project. I dont't seem to find it in the pom.xml, but maybe Im looking in the wrong place? In my case it is  web app, but i don't know exactly what maven archetype that was used.
Answer: No, that information is not provided in the generated Maven project.


Path integrals on statistical mechanics

Question: I'm looking for references covering the following topics: path integrals in statistical mechanics and Wick rotations, second quantization, fermionic systems and Ising-like models and mean field theory. I have a background in quantum mechanics, statistical mechanics and thermodynamics.
Answer: Second Quantization is very good thing to start with anything. After that you may want to see lecture notes of Feynman, which cover all topics you mentioned, but I will recommend that only if you have done first course Statistical Mechanics properly. It is good to start with some application parts, like BCS theory. This will give some flavor of Wick's rotation, second quantization, fermionic system. David Tong's lecture notes will also prove to be helpful.
For Ising-like models which exhibit quantum phase transition, you can refer to any Quantum Phase Transition book or you can develop better understanding for Ising model.
Answer: The book by Altland and Simons has rather a detailed and exhaustive introduction to the second quantization, path integral formalism for bosonic and fermionic fields, with some exercises to check the understanding of the topics.
These topics are also covered rather well in the book by Shankar. Here you can find a long discussion of Ising model, from different aspects and perspectives.
References:

A. Altland & B. D. Simons, Condensed Matter Field Theory, doi:10.1017/CBO9780511789984.
R. Shankar, Quantum Field Theory and Condensed Matter:
An Introduction, doi:10.1017/9781139044349.
Answer: I think to study second quantization from path integrals, use Gauge field theory by Stefan Pokorski as 1st choice and use Peskin and Schroeder as second choice.
References:

S. Pokorski, Gauge Field Theories, doi:10.1017/CBO9780511612343.
M. E. Peskin & D. V. Schroeder, An Introduction to Quantum Field Theory.

Path integrals on statistical mechanics


Craft 2 FormBuilder 2 equivalent plugin in Craft 3

Question: Is there any plugin equivalent to Craft 2 FormBuilder 2 plugin in Craft 3? My Craft 2 website forms are built with FormBuilder 2. I upgraded the website to Craft 3, but FormBuilder 2 is not working. I need an equivalent plugin to work in Craft 3.
Answer: There are a large number of form plugins in the Craft plugin store. See: https://plugins.craftcms.com/categories/forms
Some options:

Solspace Freeform
Solspace Express Forms
Sprout Forms
Comment: I need a free plugin for implementation. The free version of these plugins have limitations. I need spam protection, email configuration etc. Any other free plugin available?
Comment: Not sure there are many options. Most of the major plugin developers moved to a paid model with the transition to Craft 3. So it's either buy something or spend your time to build or extend a free option.
Comment: Shall we do these forms as module and then including it in templates.? If yes, please share any tutorials are available.
Comment: Have you seen https://plugins.craftcms.com/wheelform?
Comment: Thank you. Let me look into this plugin


What is the best way to develop Mathematical intuition?

Question: I want to develop my pure mathematics knowledge and would like to know what is the best way to develop mathematical intuition? I am going through exercises that ask for proofs and I don't have the intuition to do so.
Comment: Perhaps it would be best to post the specific questions you are having difficultly with. The best way to develop mathematical intuition is imo to "do more exercises," but that advice seems misplaced here. As for proofs, you should learn the basic logical structure of direct proof, proof by contradiction, contraposition and induction, rinse and repeat.
Comment: When you figure this out, let me know. I've been trying for 20 years!
Comment: Could you be more specific? Give an example of what you are trying to prove. What have you tried? The book or site that has the exercises you are trying to do probably also has examples. Do you understand why the proofs of the examples work?
Comment: Dear James, It would help a lot if you gave more background.  At what level are you working (e.g. basic group theory, general topology, more advanced undergrad courses, graduate courses, ... ?).  Regards,
Comment: I think this question is a duplicate of https://matheducators.stackexchange.com/questions/11950/how-does-a-student-learn-to-dig-behind-the-scenes-or-feel-math-like-a-fields
Comment: Asking for "the best" way to do anything is often an indication that a Question lacks a well posed problem that can be solved by reasoned mathematical argument (or experience).  My advice would be spent on how to test the intuition that one has; recognize when one is motivated by an intuition and be willing to develop a simplified case in which to check its reliability.
Answer: I can say that a big part of mathematical intuition comes from experience. That being said there is no "best way". I like to think about experience like this:
You're stuck in thick, dense jungle like the amazon rain forest. You have a machete, and you're chopping down plants struggling to find a way out. You walk around headless, knowing not even of a path to the nearest village.
However now say you are flying in a helicopter with a reasonable view around. Now not only can you see where you would be in the jungle, but can also see where the nearest village is. You can see the terrain, map out a path, avoid crossing big streams, etc.
This is the analogy: In the first situation you are stuck with how to move, in the next one with a lot of experience you can see many connections and the way out.
Now we come to your next problem. You say that when going through exercises they ask for proofs. What I would recommend if you have never ever seen a mathematical proof is to go through an article like this one.
Of course it is not possible to grasp these techniques at once. You should try out a few suggested exercises, look at how things are done first, look at how other people do things. Why do they think like this? Slowly after a while, your mind will get used to it.
I am willing to edit my answer and improve on it if you provide more detail on the specifics of your difficulties.
Comment: Maybe I'm torturing the analogy, but I wanted to add to it. Experience hacking around through the jungle is still important! How did you know, when taking in the helicopter's eye view, that big streams are something to avoid, or other jungle features to avoid? And once you've plotted a route from the helicopter and jump back into the jungle, you can't travel the path without your skills with the machete.
Comment: @Hurkyl, I do not think he was claiming otherwise.
Answer: Here is a true story. One year a student questionnaire on my first year analysis course wrote: "Professor Brown gives too many proofs." I thereupon decided that next year the course would have no theorems,  and no proofs. It would however, have "Facts" and "Explanations".  (I got this idea from an engineer!) Part of the deal of course would be that an Explanation should explain something. Another point is that unlike the good old days when Euclidean Geometry was studied at school students have no previous experience of the words "Theorem" and "Proof".  Also the study of Grammar has gone as well, so they are unfamiliar with the structure of language.
What is called a "proof" is really an explanation but written very carefully.
In other second year lectures which needed an explanation of a particular case of $A \subseteq B$ I asked the class "What is the first line of the proof?" and then, to be written further down on the board, "What is the last line?". By the end of the course, they got the idea!
Also students need training in writing carefully.  See a course called Ideas in Mathematics I gave.
I also found that the best way to develop intuition was to write things out very carefully, and explain them to others.  When you have written something  out 5 times, you may see how to improve it a bit. Then another bit. And so on.
The idea that a proof is found one step after another is just not so. For 9 years I had an idea of a proof in search of a theorem. It took that long, and lots talking and writing,  to piece together the gadgets needed to make the idea of the proof actually work and prove a theorem.
The composer Ravel said that you should copy. If you have some originality, this may appear as you copy. If not never mind! Your new ideas also may only appear at the 5th copy, as the wheels of the brain start to unclog. In fact it has been said that Newton was an inveterate copier!
Comment: I just want to say - this post helped me out a ton today. Thank you for the beautiful detail you put into this post.
Answer: To learn how to prove something you want to do something like this:
First pick something at an adequate level matching your current level of skill.
Then gather a bunch of exercises that ask for proofs together with answers. But don't look at the answers. Sit down and try to solve them. If you get stuck, look at the first line of the answer and try from there. If that still doesn't get you anywhere, look at the next line, and so on.
Repeat until you have gained some confidence. This will teach you how to prove some of the things you come across.
I also recommend reading "Thinking Mathematically". This will help you change your thinking so that you will get stuck less often in general.
Hope this helps.
Comment: I would also suggest looking at the last(s) line(s)
Answer: "I want to develop my pure mathematics knowledge and would like to know what is the best way to develop mathematical intuition? I am going through exercises that ask for proofs and I don't have the intuition to do so."
Honestly, I think you should not build a theory about this. You simply don't know how to solve certain problems. That's it. Don't interpret it that there is something fundamentally wrong with you. Don't conclude that you don't have intuition. Not all exercises are that simple.
Also, intuition comes from experience. The best way is experience. What kind of experience? Well, it depends on what you want. Do you want to be able to solve problems in your book? To become a mathematician? To become a math teacher?
Whatever you do, DON'T read http://zimmer.csufresno.edu/~larryc/proofs/proofs.html suggested in another post.
This will do more harm than good. I read this very article recently and I was speechless. In my humble opinion, this guy clearly contributed to ruining math education in this country, even though he probably meant no harm. You don't need to read anything special to understand proofs. Unfortunately, many people in this country want to sell you books about proofs and so they present it as a special skill. Mathematics is proofs. If you have a course without proofs and it is called mathematics (and it is beyond high school), you are paying your money for nothing, period. Read Paul Lockhart's article on education, A Mathematician's Lament: http://www.maa.org/devlin/LockhartsLament.pdf
If you still don't understand why I don't like this article by Larry Cusick, let me quote from the introduction: (http://zimmer.csufresno.edu/~larryc/proofs/proofs.introduction.html)
"The basic structure of a proof is easy: it is just a series of statements, each one being either
An assumption or
A conclusion, clearly following from an assumption or previously proved result."
---Who needs to be taught the basic structure of a proof? Most people who don't understand proofs will only get more confused. Unless you study math logic, you don't need to analyze the structure of a proof. Furthermore, in many cases it is easier to understand a proof than to dissect it into assumptions and conclusions. It's like a second grader who knows that 5*7=35, but doesn't know "what is the product if the multipliers are 5 and 7".
Continuing with the article. "And that is all. Occasionally there will be the clarifying remark, but this is just for the reader and has no logical bearing on the structure of the proof. "
---Well, this piece of information is not very useful. It is probably more confusing than the actual "clarifying remark" it is warning you about. Anyway, I am not really sure, what it means. It says "...just for the reader". Does it suggest that the proof itself is not for the reader?
"A well written proof will flow. That is, the reader should feel as though they are being taken on a ride that takes them directly and inevitably to the desired conclusion without any distractions about irrelevant details. Each step should be clear or at least clearly justified. A good proof is easy to follow."
---This is almost a joke. I particularly like "...without any distractions about irrelevant details". Forgive me my sarcasm.
"When you are finished with a proof, apply the above simple test to every sentence: is it clearly (a) an assumption or (b) a justified conclusion? If the sentence fails the test, maybe it doesn't belong in the proof."
---No, when you are finished with a proof, just see if it makes sense. There is no need to apply any tests. This is just another trick to make people afraid of proofs. Furthermore, this "test" is wrong. There may be justified conclusions that don't belong to the proof. On the other hand, a statement may belong to the proof, but it may be unjustified, then it doesn't pass this test.
Comment: I would have to disagree with you there. One important property of a mathematical proof is that it does not use inductive reasoning (not to be confused, of course, with induction). I don't think this fact is obvious by any means. Another is that every premise is either a definition or a previous theorem. Furthermore, students need some way of distinguishing between "obvious" statements like "a circle divides the plane into two parts", which need proof, and statements like "if A implies B and A is true, then B is true", which do not.
Comment: "One important property of a mathematical proof is that it does not use inductive reasoning (not to be confused, of course, with induction). I don't think this fact is obvious by any means." - well, I don't think that this fact is relevant. People who don't understand proofs, don't understand what is "inductive reasoning" either. My point is that you should not try to explain the theory behind proofs, unless you are teaching advanced mathematical logic. Just expose people to simple proofs, and they will pick it up.
Comment: Lastly, I don't see that much difference between the statement about a circle and the statement about A and B. I don't think that you really need to prove that a circle divides the plane into two parts. Maybe you do need it if you are building all geometry from scratch using a system of axioms - not Euclidean axioms, these will not be sufficient to prove this statement. Euclid did not define things like a point on a line lies between two other points. On the other hand, tautologies may still need a proof. (Well, it depends on which logic/model/proof system we are working with.)
Comment: I guess it depends on just how rigorous you want to be. Many "obviously true" mathematical statements are false. However, all mathematical statements that have been proven are true.
Comment: I may not agree with everything @Sergey says, I agree with the general idea -- Lockhart was right in saying that Math loses everything when it is reduced to formula and solving. And that's what that article appears to actually teach -- formulas for how to do a proof!  However, students do need to learn what proofs are, the rules they follow, and what to try when stuck. So maybe [Houston's book](http://www.amazon.com/How-Think-Like-Mathematician-Undergraduate/dp/052171978X/) as opposed to [Velleman's more formulaic version](http://www.amazon.com/How-Prove-It-Structured-Approach/dp/0521675995/)
Answer: Seems like you're at a basic level. I would recommend reading carefully the proofs from some book you like. You need to get used to the language, to the ordering of the arguments, to notation... You may need support from your teacher, and that's OK. Then moving to the exercises should be easier. But you should try really hard -- thats hard work, and takes some time. If you fail to do some exercise, do your best to learn from it, and ask yourself why weren't you able to do it, ask if the solution is "natural". I believe that, as you get used to the arguments, proving theorems by yourself will come naturally.
Good luck :)
Answer: I'd recommend reading "How to Solve It: A New Aspect of Mathematical Method (Princeton Science Library)" written by G. Polya and any other book related to problem solving. Then, you should do three things:

Get a book about recreational math (e.gr. Martin Gardner's books) and try to solve exercises.
Get any book on your math level (e.gr. 'Euclid's elements', or Rudin's 'Principles of mathematical analysis', both are difficult examples, but you can find easier books) and begin reading the definitions. Whenever you find a theorem, try to write a proof without checking the book's proof.
Measure both the time invested in solving exercises side to side with the number of exercises and use it to reflect about your progress. This should not take too much effort, but its purpose is to help you to become aware about your progress and your weaknesses.

This method needs discipline and regularity.


Example of a transformation that is not canonical

Question: Can someone please give me an example of a transformation that is not a canonical transformation?
Comment: See my answer here for examples of non canonical transformations on the harmonic oscillator which are nonetheless used regularly in quantum optics: https://physics.stackexchange.com/questions/450187/why-do-we-care-only-about-canonical-transformations/453466#453466
Answer: Hint: Canonical transformations are volume preserving in phase space according to Liouville's theorem. So e.g. a dilation
$$Z^{I} = 2 z^I, \qquad I~\in~\{1,\ldots ,2n\}, $$
is not a canonical transformation.
Comment: In Goldstein, this sort of transformation would be called an *extended* canonical transformation (see Sec. 9.1).
Comment: $\uparrow$ Yes.
Answer: Consider the transformation $x \mapsto x, p \mapsto v = \frac 1 m [p - qA(x)]$ where $A$ is a vector potential. Then $\{v,v\} = \frac q {m^2} v\times B$ where $\{\cdot,\cdot\}$ is Poisson bracket and $B = dA$ is the magnetic field, so this transformation is not canonical.
More concretely:
With the Hamiltonian $H = (p-qA)^2/2m$, you find $\dot v_i = \frac q m (v\times B)_i$. If the form of Hamilton's equations is preserved, then $\dot v_i = -\partial K/\partial x_i$ where $K$ is the new Hamiltonian, the "Kamiltonian". But then $\partial_j \dot v_i$ must be a symmetric tensor, but this is not the case for arbitrary $B$.
Answer: One way is to spoil a canonical transformation. But in reality, canonical transformations are a very restricted subset of all possible transformations. Therefore, if you just 'randomly' pick a transformation, it is very likely not going to be canonical. All you have to do, once you picked it, is check that it is indeed not canonical, which you can do using the Poisson brackets.
Discussion
For simplicity, we'll stick to the case of one degree of freedom (so one $q$ and one $p$). Also, I'll assume that we are only considering differentiable transformations with a differentiable inverse, at least in some open set in the $q,\,p$-plane. (If your transformation fails to be differentiable, or fails to be invertible, or fails to have a differentiable inverse, it will also not be canonical. But I assume you are asking for transformations that fail to be canonical for other reasons.) Finally, I will only consider restricted canonical transformations, i.e. those that don't involve time $t$ explicitly.
How to check if a transformation is canonical
Whether or not a transformation is canonical can be checked using the Poisson brackets (with respect to the old coordinate and momentum), $\{Q,\,P\}=(\partial_{q}Q)(\partial_{p}P)-(\partial_{q}P)(\partial_{p}Q)$. Namely, since the Poisson brackets are invariant under canonical transformations, and $\{q,\,p\}=1$, it follows that if a transformation $q,\,p\to Q,\,P$ is canonical, with $Q$ the new coordinate and $P$ the new momentum, then $\{Q,\,P\}=1$. Equivalently, if $\{Q,\,P\}\neq 1$, the transformation is not canonical. It turns out that the converse is true as well: if $\{Q,\,P\}=1$, the transformation is canonical.
There are other ways, see e.g. here, but this one is adequate for our purposes.
Spoiling a canonical transformation
For example, recall that there is a canonical transformation that, in effect, exchanges coordinates and momenta: $Q=p$ and $P=-q$. Indeed, if you compute the Poisson bracket, you get $\{Q,\,P\}=1$. Now, if we modify this transformation in some way, chances are, the result will not be a canonical transformation.
So, how about $Q(q,p)=p$ and $P(q,p)=+q$? Computing the Poisson bracket, we find that $\{Q,\,P\}=-1$, and thus this transformation is not canonical.
One can ask various further questions here. For example, if we want the new coordinate to be the old momentum ($Q=p$), what is the most general form of $P(q,p)$ so that the transformation $q,\,p\to Q,\,P$ is canonical, with $Q$ the new coordinate and $P$ the new momentum? Since the transformation is canonical if and only if the Poisson bracket is 1, we solve the equation $\{Q,\,P\}=-\partial P/\partial q = 1$. The solution is $P(q,\,p)=-q+f(p)$, where $f(p)$ is an arbitrary function of $p$. It follows that if $P(q,\,p)$ has any other form, the transformation will not be canonical. So, all of the following, and many more, fail to be canonical transformations:
$Q(q,\,p)=p$, $P(q,\,p)=-q^3$;
$Q(q,\,p)=p$, $P(q,\,p)=q\,p$;
$Q(q,\,p)=p$, $P(q,\,p)=e^{q}$;
and so on.
'Randomly' picking a transformation
As should be clear from the above, canonical transformations are a very restricted subset of all possible (differentiable and reversible) transformations. Thus, if you just take any old ('randomly chosen') transformation from $q$, $p$ to some $Q(q,\,p)$ and $P(q,\,p)$, it is extremely likely that it's not going to be canonical. So one 'method' of generating non-canonical transformations is to just try some crazy functions $Q(q,\,p)$ and $P(q,\,p)$, and compute their Poisson bracket. If the result isn't 1 (as will almost certainly turn out to be the case), voila, you have a non-canonical transformation. For example:
$Q(q,\,p)=q^3$, $P(q,\,p)=p^3$; $\{Q,\,P\}=9\, q^{2} p^{2}\neq 1$;
$Q(q,\,p)=\arctan (q\,p)$, $P(q,\,p)=\tanh p$; $\{Q,\,P\}=p\frac{\text{sech}^{2}p}{1+q^{2}p^{2}}\neq 1$.
And so on.
Answer: All reversible variable changes, especially those that help solve the differential equations, are good, although the "new" equations may not have a canonical form.


How do I get entries in a quick list to open in their own window?

Question: I've created a few custom apps .eg facebook, google plus. I want them to open in ther own window instead of google chromes window (the white arrow showing open applications on the unity launcher). Can anyone help me do this?
Answer: Actually this is a bug but these days it has been fixed, try to update your sistem. Then click on a web app in Chrome and choose Open in a window.
https://bugs.launchpad.net/unity/+bug/692462


Newey-West robust standard errors for autocorrelation only (no heteroskedasticity)

Question: May I use the Newey-West procedure when I have only autocorrelation?
Or can I only use the Newey-West when I have autocorrelation and heteroscedasticity?
Comment: If you have a regression model with autocorrelated (but not heteroskedastic) residuals, you could run *regression with ARMA errors*. This would give you more power (narrower confidence intervals) and help in forecasting if needed. Therefore, it could be preferred over using robust standard errors without explicitly modelling the autocorrelation. Search "regression with ARMA errors" here on Cross Validated; there are quite many recent posts on the subject.
Answer: The N-W error structure is assumed to be heteroskedastic and possibly autocorrelated up to some lag.
If you errors are assumed to follow a first-order autoregressive process, you can use Prais-Winsten or Cochrane-Orcutt regression.
If it is longer, ARMA might work.
Comment: I suppose N-W is robust regardless of presence of heteroskedasticity. But would using it be efficient when there is no heteroskedasticity? Could one gain power by using another form of robust errors? I already know one could gain power by using *regression with ARMA errors*, which is probably the best option here; but I am still curious about alternative versions of robust standard errors.
Comment: That's what I think, too. Pardon my nitpicking, but I thought maybe you knew more on the subject and could make your answer more elaborate so that it could serve as a nice reference for similar future questions.
Comment: @RichardHardy I was agreeing with you, but did not make that at all clear. If you had some knowledge of the AR structure, feasible GLS would be the most efficient alternative.
Comment: @RichardHardy I think N-W would not be as efficient if there's truly no heteroskedasticity.
Answer: The short answers are YES and YES.
The Newey-West estimator is one of the so called heteroscedasticity and autocorrelation consistent (HAC) estimators of the covariance matrix, it's not the only one out there. It works for any combination of heteroscedasticity and autocorrelation present.


Entity Framework 4.1 To know the which Foreign Key constraint is violated during deletion

Question: I have started using Entity Framework 4.1 with Code first. I really love this over the previous ado.net techniques.
I have a very simple situation in which there is a department table and an employee table in database. Each employee belongs to a department and a department has got many employees. The business rule is : While, deleting a department, if there are any associated employees, it should not allow deletion. I can write a small method just before deletion and check the dependancy. However, since my project is a much complex one with more than 300 db tables, I hate to do this. The relationships gets changed frequently which results in lot of changes in all the delete methods of the project.
In ado.net, in similar situations, I used to parse the exception thrown and get the name of the particular Foreign key constraint which was violated. Based on the name of the violated FK constraint, I used to give appropriate error message to client. This technique worked well even in a fairly large project with more than 150 tables.
How do I do a similar thing in EF ? How do I get which FK is violated when SaveChanges() is called ?
Answer: You need to get the Message of the inner most exception(usually its a SqlException). Then you can extract the FK name from that string and check which FK is violated.


How to send after filtered views result in mail in drupal 7?

Question: I have created a view in drupal 7 with filters.. View is working fine I need to send after filter view result in mail with ajax views.
This time I am not using ajax so I am sending a filtered url in mail..
But I need to use ajax views. is it possible?
Answer: I'm not totally sure what you mean by

I need to send after filter view result in mail with ajax views

If you need to send to the list of items (e.g., the items are members with email addresses), then you should install Rules, and set up Views Bulk Operations as described in this Drupalize Me (i.e., Lulabot's teaching videos) series. Parts 18 through 21 describe how to take a view, and use Rules to make it do something like send an email.
If you'll expand a bit about what you're trying to do, I can be a bit more specific about this.
Comment: For example: I have two type filter age and rupee..
Age: 34,56,76 values. Rupee: 344$,123$,12$ etc. if i select 34 from and 123$ from rupees. then i got filtered data.. I need to send these filterered value. If I am not using ajax then easily send url .. but in the case using ajax .
Comment: So, you have a view with an exposed filter form with two drop downs, one for age, and one for (price?) in rupees.  when someone sets the drop downs and presses "Apply", you want an email to go out? If so, you can probably attach a javascript handler to the Apply button.  The handler would call an ajax handler on your site that sends an email.  That what you mean?
Comment: Here I dont need to use apply button,, I need to use auto submit.
after select any filter then we got filtered content.. I need to send this contetnt and selected filter in mail.


How have we proved that pions are mesons?

Question: How have we specifically proved that pions are mesons? Meaning what experiments or calculations have we done to prove that. In addition, how do we know that muons and taus are fundamental particles (not mesons). With such short lifetimes it is near impossible to measure them accurately so how have we come to this conclusion?
Comment: As a note - muons have a lifetime of microseconds, which is an *eternity* in the particle physics world.
Answer: Historicaly:

From theoretical considerations, in 1934 Hideki Yukawa predicted the existence and the approximate mass of the "meson" as the carrier of the nuclear force that holds atomic nuclei together. If there were no nuclear force, all nuclei with two or more protons would fly apart due to electromagnetic repulsion. Yukawa called his carrier particle the meson, from μέσος mesos, the Greek word for "intermediate", because its predicted mass was between that of the electron and that of the proton

italics mine.
All the experimental data that support the standard model of particle physics are a proof that the pion is not an intermediate of any fundamental interactions, so that the pion  is  not intermediate is  firmly established experimentally.
In a dictionary, meson is:

a very small piece of matter that contains a quark and an antiquark

Again, all the experiments that led to the standard model have the pion as a meson, the first classification came with the eightfold way that led to the  implication of the existence of quarks.

The meson octet. Particles along the same horizontal line share the same strangeness, s, while those on the same left-leaning diagonals share the same charge, q (given as multiples of the elementary charge).

The experiments that support this interpretation of the data are large in number.
The assignment of the title "fundamental" and the axiomatic entry into the table of fundamental particles of the standard model does not depend on lifetimes, although they can be measured accurately. They depend on observing interactions and the final classification of fundamental forces, and the quark model. The standard model is a mathematical model that fits successfully the majority of data gathered the last decades in particle experiments and is continually validated with new experiments.


Vernacula and Vernacu

Question: I notice that two tags have appeared, vernacu and vernacula. Are these words that I don't understand or typos for vernacular? If the latter, what should I do about it?
Comment: probably misspellings/typos for *vernacular* (as is yours?)
Comment: @Mari-LouA, well spotted. Should I do anything about it?
Comment: Correct the spelling on the tags? Is there a tag for "vernacular"? Maybe you could change the tag to *slang* or *colloquial*.
Answer: Tags are automatically deleted within a short amount if time if they have no posts. So the proper way to deal with misspelled tags that cover a small number of questions is to re-tag. In this case, neither of the tags have posts associated with them, so these tags should disappear soon.
If the misspelling is particularly common and recurrent, it may be worth merging with the proper spelling.
Edit:
As of 16 Jan 2016, vernacu and vernacula seem to be "destroyed."

Vernacula and Vernacu


How to abstract a shape out of imported 2D file in SketchUp Make 2017

Question: I imported 2D file to SketchUp but can't select the puzzle shape only so I can use the Push/Pull tool for this specific shape. How to do it?
Answer: It's unfortunately very unclear in your question as initially written: the "2D" element you've imported - was this an image file, used as a texture, or a vector format such as DWG, DXF, EPS, used to create actual geometry?
In other words, the bounding box we see in your screenshot looks like you've a rectangle with an image with transparency on it - in which case you will need to trace with lines to get a puzzle-piece shaped face you can extrude... or if the data you brought in was in a vector format, you'll need to double-click to open the group or component, select one puzzle-piece face, and then extrude.

Edit per comments:

DWG imported to sketchup comes in as a group: you will need to double click to edit or delete sub-elements of that group - individual line segments in this case. Once you've double-clicked and are in 'isolation mode' with the group elements visible and everything else either grey or invisible, select all your edges and try "make face" and see if that gets you what you need: if not, you will probably need to redraw some line segments to get SketchUp to reparse those edges to see if it can declare a face between them. Also, zoom in very closely to where edges meet, and be sure there are clean intersections: AutoCad is actually quite inaccurate, and so you may not have clean intersections for SketchUp to work with - you may redraw those which don't correctly intersect, either in ACad or SketchUp.
Hope this helps.
Comment: Thank you for you comment. This is DWG file. I saved a puzzle shape but once opened in Sketchup it selects as rectangle and therefore I can't extrude the puzzle shape only. How to 'trace it with lines'?


cordlell battery/charger

Question: I am converting my cordless drill to corded. to do this I need to use the charger which slides on the battery to attach to the damaged tools sole plate. I made a connection between the drill motor wires and the chargers input port in order to power the motor with the original battery. I have a second identical battery charger. can I remove the charging pcb or bypass it to make a direct connection between the drill motor and the plate contacts. the charging plate will simply replace the tools damaged bottom. in this way I can use the battery as designed or charge battery as designed or a direct connection to the motor from a dc power supply. does this seem possible?
Comment: Probably not. There's no reason to think that the charger output has the current capacity to operate the motor directly -- or that its "battery charging logic" won't be thoroughly confused by having the motor as a load.
Comment: Instead, perhaps you should learn to repair the batteries.
Answer: No, do not do this. A charger applies current in the range of tens of mA to trickle charge the battery. The motor may draw thousands of mA when its pushing a load. There are other details as to how battery charging works, but your proposal just will not work.

cordlell battery/charger


Compatibility for Thomas & Betts breakers

Question: Need to replace Thomas & Betts 2-pole 30 amp breaker for a water heater. What brand would be compatible? Panel is also T&B. TBB10 (20-20) C Model #1
Comment: That's a manufacturer, not a panel model. I can't fix "a Chevrolet" without more information either. :)
Comment: It may be important _which_ service panel you have. You'll need breakers that are _UL Classified_ for that panel.
Comment: Sorry... Panel is T&B  TBB10 (20-20) C model #1
Comment: As stated, panel is also Thomas & Betts
Answer: This handy chart seems to show that the Eaton CL230 breaker is a "Classified" replacement for the Thomas Betts TB230 breaker.
Since this is a pretty common breaker sold at national big box home improvement stores it should be straightforward to compare the two.  These cheaper breakers are normally not even in a package, making comparison even easier.
The comment from isherwood about the type of panel you have is valid.  This is meant to point you in the right direction, but its not a definitive "certified" answer.
Comment: The presence of an item on Home Depot's website does not mean they stock it at the stores.  I would not expect them to have Eaton CL in stock. They can certainly order it though.
Comment: @Harper-ReinstateMonica True. But the good news with Home Depot (unlike quite a few online+bricks-and-mortar web sites) is that they will (generally) tell you pretty clearly whether it is in your local store (and even exactly where in the store to find it!) or not.
Answer: Talk to an Eaton authorized dealer, i.e. an actual electrical supply house that deals in Eaton.  They can check their cross reference book to see if the BR busing is compatible (ThreePhaseEel thinks it isn't, which I believe).
If not, they can get the Eaton CL that JPhi1618 mentioned.
Either way, Eaton is your one-shop shop.
Comment: I'm pretty sure Eaton CL is correct -- if BR was compatible, it'd be a cross-list, not a classification


Storing an audio file in a UIDocument

Question: I have a little app that works with iCloud. It stores audio files into the cloud. I noticed that loading the audio files from a second device doesn't work immediately. So I implemented
<code>- (BOOL)downloadFileIfNotAvailable:(NSURL*)file
</code>
That helped but still it works sluggish.
I wanted to speed up the downloading process on other iCloud devices by wrapping the audio file in a UIDocument. Is this even possible? I could store the file contents in a NSData, but is there a point (seeing as how AVAudioPlayer wants a URL)? Is there another way for me to speed up the synchronization?
Thanks
Answer: You can use NSFileCoordinator's coordinateReadingItemAtURL method for this.  Take a look at the answer from this SO?

Storing an audio file in a UIDocument


When did Vishnu become brother of Parvati?

Question: Vishnu is not biological brother of Parvati. But still he is considered has her brother. When did he become his brother ?
Is Vishnu also brother of Sati ?
Answer: Vishnu and Parvati are brothers and sisters in terms of tattvas, Same with Brahma and Lakshmi, and Rudra and Saraswati respectively.
Sri Brahmanda Purana says that Mata Tripura Sundari along with her husband Bhagawan Tryambaka Bhairava Shiva creates the whole universes along with Tridevs and Tridevis as follows.:

A. From the left eye, which was of the nature of Soma (moon) came Brahma and Lakshmi.
B. From the right eye, which was of the nature of Soorya (sun) came Vishnu and Parvati.
C. From the third eye, which was of the nature of Agni (fire), came Rudra and Sarasvati.

I hope this clarifies your queries. Prd..
Answer: In Srimad bhagavatham the following are the slokas in which Sri Krishna speaks with Devi or yoga maya

gaccha devi vrajaṁ bhadre
gopa-gobhir alaṅkṛtam
rohiṇī vasudevasya
bhāryāste nanda-gokule
anyāś ca kaṁsa-saṁvignā
vivareṣu vasanti hi -- SB 10.2.7
'O Devî, so auspicious, go to Vraja beautiful with her cowherds and cows, where Rohinî and other wives of Vasudeva are living in the cowherd-community [Gokula] of Nanda in seclusion out of fear for Kamsa.
In the womb of Devakî there is the embryo known as [Ananta-] S'esha that is a plenary expansion of Me; make a smooth transfer by motivating Him to move out of her into the womb of Rohinî.
Then will I with My full potency do My share in becoming Devakî's son,
o all-auspicious one, while you as well will appear as the daughter of
Yas'odâ, the wife of Nanda.
The people will with incense worship you as the fulfillment of all
their desires in different forms of sacrifice, because you for all
that one may desire are the one capable of bestowing the blessings.
Depending on the place on earth [**] will you be given different names
like Durgâ, Bhadrakâli, Vijayâ, Vaishnavî and Kumudâ, Candikâ,
Krishnâ, Mâdhavî, Kanyakâ [or Kanyâ-kumârî], and Mâyâ, Nârâyanî,
Îs'ânî, S'âradâ and also Ambikâ.

Srimad bhagavatham
As they are both born or transferred between wombs of same mothers they became brother and sister. Also they are Narayana and Narayani.


How to write a monologue that reveals a backstory?

Question: My short story is from a third person POV, but I wanted to write a chapter in which the protagonist is doing a monologue that will tell details of her traumatic past, being kidnapped by a pedophile, instead of just writing a flashback. So how can I do it without making it look like the character is just narrating a boring story, but rather keeps the reader interested?
Answer: For starters, you need to think about what the character is feeling when recounting this tale. Do they look back on it with horror? Sorrow? Hatred?
Or has it been so long that they have simply accepted it?
How the character reacts to their trauma makes the story a lot more believable and real.
If a person has been through something traumatic, it's hard to imagine them wanting to talk about it. They might get choked up, cry, avoid certain questions, etc. The emotional response is as important if not more important than the story itself. Especially if this response is unexpected from the character.
Examples-An otherwise emotionless character breaking down in tears. A normally happy-go-lucky character speaking in a robotic and detached way. A tough, seemingly unbreakable character shivering uncontrollably at the mere mention of their trauma. Etc.
The response of the people listening is important as well.
Are they sympathetic? Do they want to find the kidnapper and get revenge on their friend's name? What do their faces look like right now? Is there fear in their eyes? Sadness? Anger?
Their reactions could affect the protagonist's feelings too.
For example, imagine the MC is telling their story and the responses of the other characters are fear, shock, and disgust. The shock is probably because they're horrified the MC went through so much trauma, but the MC might not think of it like that. They might think the disgust is directed at them instead.
The MC might think, "They're pitying me. They'll never look at me the same. They hate me. I should have never told the truth."
Or something along those lines. This leads to drama. This pushes the characters forward.
Location is significant too. Is the MC admitting their backstory in a high action moment or has everything slowed down? Telling this story on the battlefield is quite different than telling it in a cafe.
You most likely want either a slow, intimate scene where the character tells their secret in confidence to a trusted friend, or an intense, dramatic scene where the character felt compelled to tell the truth, and once the words are out they can't get them back.
Maybe if the kidnapper ever goes to court the MC might have to admit all the details to a court, for example.
Answer: Is This Thing On?
This would definitely be a style choice, and wouldn't work in all stories. Have this be the start of a chapter (or possibly even the book). Put it in indented, and deliver it in first person (like the character is breaking the fourth wall). The character delivers the monolog like they are broadcasting or recording for an audience, and may even make some reference to the supposed audience to suggest who they imagine they're talking to. Here's a somewhat raw example from the book I'm just starting.

My name is Belladonna, but everyone who knows me well calls me Beedee. I want to make it clear that there is nothing romantic about me.  I am a monster. The polite term among the Zeta is Lindorm, as in "Lindorm's disease." The crude term is Lamia, like the Greek monster. My very existence is a war crime. My daughters, if I have any, will be vicious psychic apex predators who will reproduce parthenogenically and constantly mutate and adapt to new environments.  Back home on New Madagascar, controlling the Lindorm packs is a constant struggle.

The supposed audience is a group of colonists just arriving from Earth. She explains things, but she does it as a dialog and leaves out details that she wouldn't need from her supposed audience. You don't have to establish a location, since they are speaking from some imagined place. Since it is set off (indented or otherwise separated) it doesn't require the speech to make sense in the context of the story.
Soliloquy:
A poetic version of this is the internal monolog delivered like a speech, the soliloquy. The character discusses their internal feelings with no regards to the audience. This is fun, but a bit more artsy.


Examples of isomorphism in linguistics?

Question: I've read the definition (more than one, actually) but I'm not sure I understand what isomorphism is exactly. I'd be grateful for a simple explanation or some suggestions for a recommended reading on that topic.
Comment: What definitions have you read already?
Comment: The original Kurylowicz definition ("parallelism in the organization of the phonic and semantic aspects of a language") is the one I remember
Answer: Good question.
I'll reject the mentioned Kurylowicz definition as a rather specific interpretation and make the definition a more general one as "having the same structure".
I think that in linguistics, the term isomorphism is used in quite different ways, I'll make an attempt to account for each of them:

1)
Isomorphism can exist between different levels of linguistic analysis.
For example, the notion of allophones (sounds that have a different form, possibly different occurrence contexts, but make no difference in meaning) is similar to the one of lexical synonyms (two words that hava a different form but the same meaning, even though they may belong to e.g. different registers) and the one of syntactic paraphrases (two expressions that have a different form but the same meaning, not excluding the possibility that one may be preferred over the other, as long as they contribute to the same meaning).
Or the difference between a phone (a sound in terms of its physical properties, e.g. [ʁ] or [z]) and a phoneme (an abstraction over phones which occur in the same contexts, e.g. /ʁ/ with allophones [ʁ], [ʀ] and [r] in German) is similar to the difference between a word form (like sleep, sleeps, slept) and its lemma (an abstraction over all forma a word may take, sleep), and possibly even the semantic notion of extension (the referential meaning of an expression with respect to a certain utterance situation) vs. intension (an abstraction over all references an expression may denote, the "idea" that is behind an expression rather than its look in a concrete use).
Or the distinction between predicates (love(x,y), red(x), man(x)) and operators (∧, → , ∃, ...) in semantics corresponds (sometimes) to the difference between lexical categories (nouns, verbs, adjectives) and functional categories (D, C, I, ...) in syntax.
Or, to quote The free dictionary1:  "for example, the hierarchical sequence of such types of phonic units as the distinctive feature, the phoneme, the syllable, and the phonological word is structurally analogous to the sequence of such semantic units as the seme, the sememe, the onomateme, and the sentence."

2)
Isomorphism can exist between the syntactic and the semantic structure of expressions. (Note that "syntactic" can also mean "morphological" here, possibly even "phonological" when it comes to the structural hierarchy of a word).
For example, the phrase old men and women is structurally ambiguous between two readings:

old [men and women]
[old men] and [women]

The issue is with the scope of the modifier "old", which can either have scope over the whole NP men and women or only over men. The surface syntactic structure corresponds directly to the semantic structure: Depending on the grammartical hierarchy between the constituents, the phrase receives a corresponding meaning interpretation. A syntax tree (with NP, AP, ...) would be hiearched the same as a "semantics tree".
This works not only on the sentence-syntactic, but also the morphological level:

   vs.
masquerade ball for vampires vs. ball with vampire masquerades

Again, the syntactic structure is isomorphic to the semantic structure.
In contrast, the following ambiguity is not isomorphic between syntactic and semantic structure:

Every child sings a song
1)
  For every child it holds that it sings a song (not necessarily the same one)
∀x(child(x) → ∃y(song(x) ∧ sing(x,y)))
2)
  There is a song which every child sings (and this is the one and the same song)
∃y(song(x) ∧ ∀y(child(y) → sing(y,x)))

As you can see, the two readings have two different logical forms or semantic structures.
However, on the surface syntactic level, both sentences are structured the same way - in both interpretations, the grammatical subject stays the subject and the object the object:

One grammatical structure corresponds to two semantic interpretations.
The syntax and the semantics are not isomorphic here.

3)
Isomorphism as a "biunique mapping between form and meaning", to come back to Kurylowicz, taking the definition form here2: p. 18. "Form" is here to be understood as "phonic aspects" and "meaning" as "semantic aspects", to use the wording from the comment.
Isomoprhism in this sense would mean a 1:1 correlation between form and meaning and is, for example, violated by homonymy (one form, several meanings) and synonymy (several forms, one meaning) on the lexical level as well as structural ambiguity (one surface form, several possible interpretations) and paraphrase (different surface forms, one meaning) on the syntactic level.

4)
Isomorphism between (phonological, morphological, syntactic, ...) linguistic forms across languages.
Partee et. al. (2012: 203) "Japanese and Korean are sometimes said to be isomorphic with respect to syntactic structure, a claim which would be true if the two languages differed in their morphemes but sentence could be put into morpheme-by-morpheme correspondence preserving syntactic configutations and permitting the same syntactic operations."3 Unfortunately, I don't know enough about Japanese and Korean to go into detail about this statement, but I think the idea should be clear.
The same page provides another nice, though non-linguistic example which may help you understand the meaning better: "For example, a paper pattern for a dress may be said to be isomorphic to the cut-out cloth with respect to the size and shape; they differ only in their material."3

It seems to me that the definition of "isomorphism" is too general to not have very different possible interpretations in linguistics, but I hope I caputured the four major ones.

References
1 Isomorphism of Linguistic Levels. (n.d.) The Great Soviet Encyclopedia, 3rd Edition. (1970-1979). Retrieved September 19 2016 from http://encyclopedia2.thefreedictionary.com/Isomorphism+of+Linguistic+Levels
2 Rainer, F., Dressler, W.U., Gardani, F. & Luschützki, H.C. 2014. Morphology and meaning: an overview. In: Morphology and Meaning: selected papers from the 15th international morphology meeting, Vienna, February 2012. Amsterdam/Philadelphia: John Benjamins B.V.
3 Partee, B. B., ter Meulen, A. G., & Wall, R. (2012). Mathematical methods in linguistics (Vol. 30). Springer Science & Business Media
Comment: This is an amazing answer, you are my hero
Comment: The claim has been made that Japanese and Tamil (languages which are certainly not related in any way) are isomorphic in the sense that they can be translated morpheme-by-morpheme. This is probably exaggerated, but it is true that they are both prototype SOV languages, with all of the stigmata, and that morpheme-by-morpheme translation examples are easy to come by.
Comment: @jlalwer Thanks, then I understood their argument correctly. I just don't know enough about these languages' syntax (in fact, pretty much nothing) to further elaborate on to what extend the claim is true or to give examples. You were mentioning Tamil now, the book was talking about Korean which is again a completely different langauge family - so there is an isomorphism between all three of them?

Examples of isomorphism in linguistics?


MySQL Query - avoid Duplicate Entry

Question: The Userdatabase has usernames with "?" ending on the name. For example username: "Alex?"
Instead of deleting it I'm trying to replace this "?" with a "2" to avoid duplicate entries. The Problem is, there a still duplicate entries even with 2 at the end. I need a query, which automatically changes the 2 to 3,4,5,6,7,8 or 9 until no duplicate entry exists anymore. I was doing this manually until now, but honestly I changed over 200 lines and I guess there are more than 1000.
Some Ideas?
The Query I use:
UPDATE `userdatabase`
SET `username` = replace(`username`, "?","2")

Answer: i am not familiar mysql update syntax in detail, but if table "userdatabase" have unique id column may be possible something like that
replace(username, "?", (select count(*) from userdatabase db where db.username = username and db.id < id))

MySQL Query - avoid Duplicate Entry


Any way to catch the notifications so another program can read them?

Question: I know you can see notifications in the terminal using dbus-monitor "interface='org.freedesktop.Notifications'" | grep --line-buffered  "string", but is there any easy way to catch the notifications and send them to a running application?
Answer: I'm not a ruby developer, came across this question while looking to do the same thing with Python - for Ruby, you might want to check out https://github.com/mvidner/ruby-dbus for this.
For python I'm using the python-dbus package now which is working great :)


effect of three terms of PID controller on output response?

Question: What is the effect of each of the three terms on output response of a pid controller?
i mean how will P term shape/effect the output response
similarly what is the effect of I and D terms on output response respectively?
Answer: You have a few questions about PID control.  Let's break it down to its basic concepts.
The P term (for Proportional) is what you might think of as the strength of the controller.  If you want a system to reach a particular state, and it is instead at some other state, the P gain multiplies the error to drive the system toward the desired state.   In a perfect world, the system gets there.  However, if there is a lot of friction, or the P gain is too low, the system may only get partway to the goal.   This is overdamped behavior.  Conversely, if there is little friction, or the P gain is too high, the system may travel past the goal state and overshoot the goal.  In this case, the error will change sign, and the P gain will cause it to go back toward the goal state.  This is underdamped behavior.  In general, you want the P gain to be relatively high so the system responds strongly (quickly) to error states.
The D gain (for Derivative) helps compensate for underdamped behavior.  When the derivative of the error is large, so that the system is approaching the desired state quickly, the D gain responds to counter the rapidly-changing state.  In effect, this adds damping to the system to reduce or eliminate overshoots.  When the system is close to the goal state, and the error is not changing much, the D term does very little.  When the error is reducing quickly, the influence of the D gain can stabilize the performance. Note:  if the D gain is very large, it can lead to oscillatory behavior due to the rapidly-changing derivatives.
The I gain (for Integral) serves to drive a system to its goal state in those situations for which the P (&D) gains are not strong enough to overcome the system's characteristics and cannot precisely reach the goal state.  This is really only useful when trying to achieve a steady-state position.  The I gain is a multiplier of the integrated error, so as a small fixed error remains over time, the I term grows until it can drive the system to the goal.   Note that real physical systems always lag the controller (due to friction, inertia, power supply slew rates, etc), so the integral term should not be enabled until the system is within a threshold of the desired state.  Otherwise, the accumulated errors from the lagging response will cause the I term to be large, causing overshoot, due to the accumulated errors during motion, instead of just considering the errors when at steady-state.
Answer: Check this video: https://www.youtube.com/watch?v=4Y7zG48uHRo
It explains how PID algorithm work for controlling self driving cars.


2 iPhones, 1 computer. Why are they now both running on the same iTunes account?

Question: I have recently synced my partner's iPhone to my computer because his computer crashed. He has his own iTunes account so we backed his phone up to iCloud, wiped it a re-synced it to my computer.But when he tried to access iTunes through his iPhone (to download music or new apps) it takes him to my account and asks for my password.In settings on his iPhone under iTunes account it still has his user ID. How do we get access to his iTunes account from his iPhone back?
Answer: Why not log out your iTunes account so that he can log in his iTunes account?
Comment: And how should they to that (as it seems this is exactly what they are trying to do here)?


When breeding animals, is it legal to feed them pills that increase sex drive?

Question: Take this scenario: Owner A has dog A and has agreed with Owner B to breed dog B. However, dog A does not like dog B. To avoid missing this opportunity, owner A gives dog A medicine that increases sex drive for a higher chance of mating with dog B. Is this legal?
Comment: Is there some reason you think this might not be legal?  I struggle to imagine what law this would violate unless there is something unstated (i.e. the drug has some side effect that potentially constitutes animal cruelty or the owners want to register the resulting puppies with some organization whose bylaws prevent assisted reproduction)
Comment: Perhaps the drug needs to be given to dog B so tht dog A will "like" her.
Comment: I am not sure "drive" is quite the right word, but using hormones or reproductive system modulating drugs is very common in various forms of farming, dairy in particular.
Comment: @JustinCave Off-label usage of prescription medication might be one such reason.
Comment: @nick012000 In what jurisdiction is off-label usage of prescription drugs a crime, even in humans?
Answer: While different countries around the world have laws against animal cruelty, I don't see how any of them would apply here.
If there are no harmful side effects, the drug is legally available for this purpose to the owner, and it is the animals owner agreeing to it or in this case even administering it themselves... that is perfectly legal.
Comment: I think the part 'drug is legally available to the owner' is where some restrictions can come in. To my knowledge Viagra is prescription only in most EU countries so even if you legally got it for yourself you couldn't legally use it for your dog. I don't know whether there are animal alternatives and whether these are over the counter or whether some restrictions apply.
Comment: @quarague You may be right, I never considered that dogs might share prescription only medicine with humans. I edited in "for this purpose" just to make it clearer.
Answer: There are various products available that purport to do something like this, a number of which are a brew of natural ingredients. Sildenafil is in fact used for dogs, but "off-label" for heart and lung high blood pressure conditions, and that is a prescription drug (no indication that it works in dogs the way it works in humans). Ignoring the question of efficacy, any given product might be subject to FDA regulation, so you would have to read here for the specific product.


A question of notation: what does $x\lt y\in S$ mean?

Question: I've seen expressions like $x\lt y\in S$ used on this site to mean "$x\lt y$ and $x\in S$ and $y\in S$." This has me worried because I sometimes use $x\lt y\in S$ to abbreviate "$x\lt y$ and $y\in S$". How widespread is the former usage? Should I avoid using abbreviations such as $x\lt y\in S$ and $x\ne y\in S$ etc. because I'm likely to be misunderstood?
Comment: It's ambiguous. It's terrible notation. $S$ could be a set of ordered pairs and $\lt$ could be a relation thereon. You should avoid it at the cost of a few more keystrokes.
Comment: I'm voting to close this question because it should be posted on main and not on meta.
Comment: Since you asked *how widespread* it is, here is [search for $x\lt y\in S$ on SearchOnMath](https://www.searchonmath.com/result?query=%24%7Bx%5Clt+y%5Cin+S%7D%24&page=1&tm=0&domains=o%2C) with the domain limited to MO. (You can also change to other domains - just to have some comparison.) Already on the first page, it shows many different expressions. (I am not sure how exactly this search engine decides which two expressions are similar.) Here is [the same search on ApproachZero](https://approach0.xyz/search/?q=%24x%5Clt%20y%5Cin%20S%24&p=1). (A0 indexes [math.se] and AoPS, but not MO.)
Comment: @bof Of course, in both cases - in [SearchOnMath](https://www.searchonmath.com/result?query=%24%7Bx%5Cne+y%5Cin+S%7D%24&page=1&tm=0&domains=o%2C) and in [Approach Zero](https://approach0.xyz/search/?q=%24x%5Cne%20y%5Cin%20S%24&p=1) you can use this as a search query, too. (I am not sure to which extent this could be helpful. But at least among the search results you can see some occurrences - still, you'd have to check them individually to see what *meaning* exactly the author of the post has in mind. As you said in the last comment, for this you can't really rely on computer.)
Comment: @bof all three of your examples are unambiguous because of how those relation work. The problem with $x\lt y \in S$ is, as you pointed out, is that people can quite reasonably assume it means one of two mutually exclusive things.
Comment: @bof Your question does not apply only to writing mathematics on the main site, but to writing mathematics in general. In its current version, you didn't even write "on MO" in it (and even if you would that would be a boat-programming specification). Anyhow, we have other users and moderators to take this decision; this is just my opinion and I do not claim I know more. :)
Comment: @FedericoPoloni, [re](https://meta.mathoverflow.net/questions/4792/a-question-of-notation-what-does-x-lt-y-in-s-mean#comment24371_4792), what is "a boat-programming specification"?
Comment: @LSpice This page should explain it: https://meta.stackexchange.com/questions/14470/what-is-the-boat-programming-meme-about
Answer: Yes, ambiguous notation should be avoided in places with a general audience, like journals and here on MathOverflow. It's useful to have shorthand in specific places where all readers can agree on the meaning but it is evidently incorrect to assume that everyone everywhere agrees on that same meaning.
Comment: Ironically, I think we're arguing about the meaning of ambiguity, not about mathematical practice. What you describe is what I would call imprecise or inexact. These are cases where the meaning can be clarified with additional context. When you say "the group $G$" it is (unambiguously) clear that you mean that $G$ is endowed with a group structure that satisfies the group axioms. It is not immediately clear what this structure is but that just missing context. I think this is part of language and it has nothing to do with mathematical practice per se.
Comment: Actually, there's more like the annoying $\sin^2(x)$ convention.
Comment: [Re](https://meta.mathoverflow.net/questions/4792/a-question-of-notation-what-does-x-lt-y-in-s-mean#comment28833_4793), I have waged a quixotic battle against that all my years of teaching.  I use $\sin(x)^2$, which students insist on reading as $\sin(x^2)$ because parentheses seem to mean nothing to them, so I am stuck with the abomination $\bigl(\sin(x)\bigr)^2$, which makes no-one happy.
Comment: Nonetheless, there are surely universally accepted ambiguities. Not only does (almost?) no-one refer to "the group $(G, \cdot)$", and almost everyone to "the group $G$" (in general; of course one might write something like "the monoid $(\mathbb Z, \cdot)$ versus the monoid $(\mathbb Z, +)$"), doing so would surely be regarded as obscuring, not clarifying.  So I think one cannot respond: always write precisely!; but rather: only use almost universally understood ambiguities!  And from this point of view the question can be understood as: is this amiguity universally understood, and, if so, how?
Comment: @LSpice Ambiguous usually means something that has two or more plausible readings. My personal favorite is "$1=0!$" I don't think "the group $G$" is ambiguous in that sense. Nobody would say the phrase "this is a pen" is ambiguous just because you don't know the color.
Comment: [Re](https://meta.mathoverflow.net/posts/comments/28825), I think that "the monoid $\mathbb Z$" has at least two plausible readings, and that it is quite common to omit the operation if the context makes it clear (though also quite common to specify it). (For that matter, it is *possible*, though not *likely*, to put different group operations on $\mathbb Z$, so even "the group $\mathbb Z$" is technically ambiguous.) But I was not claiming that ambiguity is good, or even acceptable, in this particular case, only that I think that the dictum "never write ambiguously" is not commonly practiced.
Comment: [Re](https://meta.mathoverflow.net/questions/4792/a-question-of-notation-what-does-x-lt-y-in-s-mean/4793#comment28825_4793), also, I think that that analogy may not be perfect; a pen is a pen regardless of its colour, but a set is simply not a group, even if it has a canonical group structure (sometimes a unique one up to choice of identity, but never, except the one-point set, genuinely a unique one).
Comment: By "ambiguous" I mean something that has two or more plausible meanings even with full context. For example, every paper or book on [partial combinatory algebras](https://ncatlab.org/nlab/show/partial+combinatory+algebra) says somewhere that $abc$ means $(ab)c$. That's because the application operation is not associative and thus $abc$ is ambiguous. Interestingly, this is done even though everybody in the field uses this convention.
Comment: The only "universally accepted ambiguity" I can think of is precedence of operations. Everywhere, even outside mathematics, $ab+c$ means $(ab)+c$ and not $a(b+c)$.
Answer: The short versions of your two suggested meanings are:
$$x,y\in S,\, x<y$$
or
$$y\in S,\, x<y$$
Neither require much more typing or space than the original ambiguous expresion.
Comment: I can't help pointing out that even the first can potentially be ambiguous, since commas are implicitly standing for conjunction in context-depend ways—i.e., $x, y \in S$ means $x \in S \land y \in S$, but $x, y \in S, x < y$ means $(x \in S \land y \in S) \land (x < y)$.  For an extremely contrived example of ambiguity, one could imagine $S$ being something like a set of strings in a certain language, with $<$ being the superstring relation, in which case we could have $1 = 1, 1 \in S, 1 = 1 < 1$.


Difference between reduce and foldLeft/fold in functional programming (particularly Scala and Scala APIs)?

Question: Why do Scala and frameworks like Spark and Scalding have both reduce and foldLeft? So then what's the difference between reduce and fold?
Comment: See also: http://stackoverflow.com/questions/16111440/scala-fold-vs-foldleft/16113418#16113418
Comment: Also [Difference between fold and reduce revisted](https://stackoverflow.com/q/41384069/9613318)
Answer: reduce vs foldLeft
A big big difference, not mentioned in any other stackoverflow answer relating to this topic clearly, is that reduce should be given a commutative monoid, i.e. an operation that is both commutative and associative.  This means the operation can be parallelized.
This distinction is very important for Big Data / MPP / distributed computing, and the entire reason why reduce even exists.  The collection can be chopped up and the reduce can operate on each chunk, then the reduce can operate on the results of each chunk - in fact the level of chunking need not stop one level deep.  We could chop up each chunk too.  This is why summing integers in a list is O(log N) if given an infinite number of CPUs.
If you just look at the signatures there is no reason for reduce to exist because you can achieve everything you can with reduce with a foldLeft.  The functionality of foldLeft is a greater than the functionality of reduce.
But you cannot parallelize a foldLeft, so its runtime is always O(N) (even if you feed in a commutative monoid). This is because it's assumed the operation is not a commutative monoid and so the cumulated value will be computed by a series of sequential aggregations.
foldLeft does not assume commutativity nor associativity.  It's associativity that gives the ability to chop up the collection, and it's commutativity that makes cumulating easy because order is not important (so it doesn't matter which order to aggregate each of the results from each of the chunks). Strictly speaking commutativity is not necessary for parallelization, for example distributed sorting algorithms, it just makes the logic easier because you don't need to give your chunks an ordering.
If you have a look at the Spark documentation for reduce it specifically says "... commutative and associative binary operator"
http://spark.apache.org/docs/1.0.0/api/scala/index.html#org.apache.spark.rdd.RDD
Here is proof that reduce is NOT just a special case of foldLeft
scala> val intParList: ParSeq[Int] = (1 to 100000).map(_ => scala.util.Random.nextInt()).par

scala> timeMany(1000, intParList.reduce(_ + _))
Took 462.395867 milli seconds

scala> timeMany(1000, intParList.foldLeft(0)(_ + _))
Took 2589.363031 milli seconds

reduce vs fold
Now this is where it gets a little closer to the FP / mathematical roots, and a little trickier to explain.  Reduce is defined formally as part of the MapReduce paradigm, which deals with orderless collections (multisets), Fold is formally defined in terms of recursion (see catamorphism) and thus assumes a structure / sequence to the collections.
There is no fold method in Scalding because under the (strict) Map Reduce programming model we cannot define fold because chunks do not have an ordering and fold only requires associativity, not commutativity.
Put simply, reduce works without an order of cumulation, fold requires an order of cumulation and it is that order of cumulation that necessitates a zero value NOT the existence of the zero value that distinguishes them.  Strictly speaking reduce should work on an empty collection, because its zero value can by deduced by taking an arbitrary value x and then solving x op y = x, but that doesn't work with a non-commutative operation as there can exist a left and right zero value that are distinct (i.e. x op y != y op x).  Of course Scala doesn't bother to work out what this zero value is as that would require doing some mathematics (which are probably uncomputable), so just throws an exception.
It seems (as is often the case in etymology) that this original mathematical meaning has been lost, since the only obvious difference in programming is the signature. The result is that reduce has become a synonym for fold, rather than preserving it's original meaning from MapReduce. Now these terms are often used interchangeably and behave the same in most implementations (ignoring empty collections). Weirdness is exacerbated by peculiarities, like in Spark, that we shall now address.
So Spark does have a fold, but the order in which sub results (one for each partition) are combined (at the time of writing) is the same order in which tasks are completed - and thus non-deterministic. Thanks to @CafeFeed for pointing out that fold uses runJob, which after reading through the code I realised that it's non-deterministic. Further confusion is created by Spark having a treeReduce but no treeFold.
Conclusion
There is a difference between reduce and fold even when applied to non-empty sequences. The former is defined as part of the MapReduce programming paradigm on collections with arbitrary order (http://theory.stanford.edu/~sergei/papers/soda10-mrc.pdf) and one ought to assume operators are commutative in addition to being associative to give deterministic results. The latter is defined in terms of catomorphisms and requires that the collections have a notion of sequence (or are defined recursively, like linked lists), thus do not require commutative operators.
In practice due to the unmathematical nature of programming, reduce and fold tend to behave in the same way, either correctly (like in Scala) or incorrectly (like in Spark).
Extra: My Opinion On the Spark API
My opinion is that confusion would be avoided if use of the term fold was completely dropped in Spark.  At least spark does have a note in their documentation:

This behaves somewhat differently from fold operations implemented for
  non-distributed collections in functional languages like Scala.
Comment: @samthebest: Are your sure about the commutativity? https://github.com/apache/spark/blob/0f1f31d3a6669fbac474518cf2a871485e202bdc/core/src/main/scala/org/apache/spark/rdd/RDD.scala#L1016 says "For functions that are not commutative, the result may differ from that of a fold applied to a non-distributed collection."
Comment: That is why `foldLeft` contains the `Left` in its name and why there is also a method called `fold`.
Comment: @AlexDean in the context of computer science, no it doesn't really need an identity as empty collections tend to just throw exceptions.  But it's mathematically more elegant (and would be more elegant if collections did this) if the identity element is returned when the collection is empty. In mathematics "throw an exception" doesn't exist.
Comment: @Cloudtech That is a coincidence of it's single threaded implementation, not within it's specification. On my 4-core machine, if I try adding `.par`, so `(List(1000000.0) ::: List.tabulate(100)(_ + 0.001)).par.reduce(_ / _)` I get different results each time.
Comment: @Make42 That's correct, one could write their own `reallyFold` pimp though, as: `rdd.mapPartitions(it => Iterator(it.fold(zero)(f)))).collect().fold(zero)(f)`, this wouldn't need f to commute.
Comment: Truly hate to break the perfect 256 vote count, but this is an excellent answer!!
Comment: @sschaef true, but `fold` doesn't exist in, say Scalding, because unlike `reduce` it doesn't require commutativity. I've updated my answer to explain this. Basically the point I'm trying to make is that the difference between `fold*` and `reduce*` is very much related to the roots of FP in Category Theory.
Comment: Do you have an example for distinct (i.e. x op y != y op x) by using reduce and fold to see the difference. I dont think it is correct statement for reduce. For example, I use non-commutative operation "divide" to do the reduce. (List(1000000.0) ::: List.tabulate(100)(_ + 0.001)).reduce(_ / _)  For the statement "(i.e. x op y != y op x)." it should give me random result, but it gives me the same result every time, so I think reduce still keep the order of cumulation
Comment: Great answer. I think that "reduce should be given a commutative monoid, i.e. an operation that is both commutative and associative" should read: "reduce should be given a commutative semigroup, i.e. a data structure which supports a combining operation that is both commutative and associative". I don't *believe* that reduce needs an identity element.
Comment: @samthebest - I see what you're saying, thanks. This is why you have to work with sumOption for Semigroups in Algebird...
Comment: To be fair contract of `fold` on RDD is exactly the same as contract of Scala `ParSeq.fold`. Although `ParSeqs` typically (always?) keep the order it is not really a part of the contract. One can easily implement `fold` (or not so easily `foldByKey`) which guarantee order of merging and the main reason to do it as it is done now is performance / flexibility of scheduling.
Comment: @Make42 I've updated my answer, indeed I assumed that the order of combining was done on the order of partitions (which would be nice, and the logical way to implement it), but it turns out it's based on a more of a "first come first serve" basis, and thus non-deterministic.
Comment: @samthebest: So, in Spark, all of the combiner methods (`reduce`, `reduceByKey`, `fold`, `foldByKey`, `aggregate`, `aggregateByKey`, `combineByKey`) need to get functions passed that are both, associative and commutative afterall, right?
Comment: @samthebest: Not sure this works... The collect also gets the partitions first come, first serve. How do you know they are in the right order for the second fold? I tried this with a real example and I got my words back in the correct order with both your code and the original Spark fold. I suspect that within a partition fold in Spark will not need commutativity, but that putting the partitions together is the issue. Your solution does not improve on that, since the collect will have the same issue. What do you think?
Comment: @Make42 I read the code for collect, it does preserve order of partitions. Step through it and you'll see this `(index, res) => results(index) = res` as the result handler - so the result handler uses the partition index to place the result in the `Array`
Comment: @samthebest so at this point I have a question afaik string concat is non-commutative, when I run this code multiple times `List("abc","def","ghi","jk","lmnop","qrs","tuv","wx","yz").par.reduce(_+_)` I guess it should give me random result but I'm getting same result everytime.
Comment: @Cloudtech @samthebest I guess in this case of `(List(1000000.0) ::: List.tabulate(100)(_ + 0.001)).par.reduce(_ / _)` producing different results in each time related with division operation being not associative I mean not related with being non-commutative [http://docs.scala-lang.org/overviews/parallel-collections/overview.html] please look at line starting with "Note: Often, it is thought that.."
Answer: If I am not mistaken, even though the Spark API does not require it, fold also requires for the f to be commutative. Because the order in which the partitions will be aggregated is not assured.
For example in the following code only the first print out is sorted:
import org.apache.spark.{SparkConf, SparkContext}

object FoldExample extends App{

  val conf = new SparkConf()
    .setMaster("local[*]")
    .setAppName("Simple Application")
  implicit val sc = new SparkContext(conf)

  val range = ('a' to 'z').map(_.toString)
  val rdd = sc.parallelize(range)

  println(range.reduce(_ + _))
  println(rdd.reduce(_ + _))
  println(rdd.fold("")(_ + _))
}

Print out:
abcdefghijklmnopqrstuvwxyz
abcghituvjklmwxyzqrsdefnop
defghinopjklmqrstuvabcwxyz
Comment: After some back and forth, we believe you are correct.  The order of combining is first come first serve.  If you run `sc.makeRDD(0 to 9, 2).mapPartitions(it => { java.lang.Thread.sleep(new java.util.Random().nextInt(1000)); it } ).map(_.toString).fold("")(_ + _)` with 2+ cores several times, I think you will see it produces random (partition-wise) order. I've updated my answer accordingly.
Answer: fold in Apache Spark is not the same as fold on not-distributed collections. In fact it requires commutative function to produce deterministic results:

This behaves somewhat differently from fold operations implemented for non-distributed
  collections in functional languages like Scala. This fold operation may be applied to
  partitions individually, and then fold those results into the final result, rather than
  apply the fold to each element sequentially in some defined ordering. For functions
  that are not commutative, the result may differ from that of a fold applied to a
  non-distributed collection.

This has been shown by Mishael Rosenthal and suggested by Make42 in his comment.
It's been suggested that observed behavior is related to HashPartitioner when in fact parallelize doesn't shuffle and doesn't use HashPartitioner.
import org.apache.spark.sql.SparkSession

/* Note: standalone (non-local) mode */
val master = "spark://...:7077"

val spark = SparkSession.builder.master(master).getOrCreate()

/* Note: deterministic order */
val rdd = sc.parallelize(Seq("a", "b", "c", "d"), 4).sortBy(identity[String])
require(rdd.collect.sliding(2).forall { case Array(x, y) => x < y })

/* Note: all posible permutations */
require(Seq.fill(1000)(rdd.fold("")(_ + _)).toSet.size == 24)

Explained:
Structure of fold for RDD
def fold(zeroValue: T)(op: (T, T) => T): T = withScope {
  var jobResult: T
  val cleanOp: (T, T) => T
  val foldPartition = Iterator[T] => T
  val mergeResult: (Int, T) => Unit
  sc.runJob(this, foldPartition, mergeResult)
  jobResult
}

is the same as structure of reduce for RDD:
def reduce(f: (T, T) => T): T = withScope {
  val cleanF: (T, T) => T
  val reducePartition: Iterator[T] => Option[T]
  var jobResult: Option[T]
  val mergeResult =  (Int, Option[T]) => Unit
  sc.runJob(this, reducePartition, mergeResult)
  jobResult.getOrElse(throw new UnsupportedOperationException("empty collection"))
}

where runJob is performed with disregard of partition order and results in need of commutative function.
foldPartition and reducePartition are equivalent in terms of order of processing and effectively (by inheritance and delegation) implemented by reduceLeft and foldLeft on TraversableOnce.
Conclusion: fold on RDD cannot depend on order of chunks and needs commutativity and associativity.
Comment: How about you award it to @Mishael Rosenthal since he was the first to clearly state the concern.  I have no interest in the points, I just like using SO for the SEO and organisation.
Comment: I have to admit that the etymology is confusing and programming literature is lacking in formal definitions.  I think it's safe to say that `fold` on `RDD`s is indeed really just the same as `reduce`, but this doesn't respect the root mathematical differences (I've updated my answer to be even more clear).  Though I disagree that we *really need* commutativity provided one is confident whatever their partioner is doing, it's preserving order.
Comment: Undefined order of fold is not related to partitioning. It is a direct consequence of a runJob implementation.
Comment: AH! Sorry I couldn't work out what your point was, but having read through the `runJob` code I see that indeed it does the combining according to when a task is finished, NOT the order of the partitions.  It's this key detail that makes everything fall into place. I've edited my answer *again* and thus corrected the mistake you point out.  Please could you either remove your bounty since we are now in agreement?
Comment: I cannot edit or remove - there is no such option. I can award but I think you get quite a few points from a attention alone, am I wrong? If you confirm that you want me to reward I do it in the next 24 hours. Thanks for corrections and sorry for a method but it looked like you ignore all the warnings, it is a big thing, and answer has been quoted all over the place.
Answer: One other difference for Scalding is the use of combiners in Hadoop.
Imagine your operation is commutative monoid, with reduce it will be applied on the map side also instead of shuffling/sorting all data to reducers. With foldLeft this is not the case.
pipe.groupBy('product) {
   _.reduce('price -> 'total){ (sum: Double, price: Double) => sum + price }
   // reduce is .mapReduceMap in disguise
}

pipe.groupBy('product) {
   _.foldLeft('price -> 'total)(0.0){ (sum: Double, price: Double) => sum + price }
}

It is always good practice to define your operations as monoid in Scalding.


When I open my list on sharepoint, it always opens in quick edit mode. How can I fix this?

Question: When I open my list on SharePoint, it always opens in quick edit mode, how can I fix this?
Comment: Can you share the URL of the site (endpoint might be helpful), also check options such whether the site is edit mode at page level or list leve.  IF there are any check-outs, check-in the same and then try realoding the site list. Also try accessing the list using alternate routes such going to site collection and accessing the list (link) from there.
Comment: The SharePoint designer solution did the fix. Thanks! Had 20 views to edit and designer was the easiest and fastest way.
Answer: It seems that your default view is created using datasheet mode, try to create a view using standard template and then set it as default view.
It will no longer open in quick edit mode.
Comment: Not useful when you need to use datasheet mode (e.g. when you have a spreadsheet of data that needs to be added/turned into a list.
Answer: The simplest and most effective way is to edit the script in Sharepoint Designer. Simply change the "Type" (see the attached picture) from "GRID" to "HTML" and save changes. Voila! your list will open in View mode.
Comment: The SharePoint designer solution did the fix. Thanks! Had 20 views to edit and designer was the easiest and fastest way.
Comment: Looks like this is actually referring to the "All Items" entry in the Views section of SP Designer. Editing the value as you suggest there does solve the problem.
Answer: You can switch off quick edit on advanced settings page of the list.

UDP: Or you can change the view style on view's editing page.
Comment: The first option does not work; it still shows the 'quick edit' view, but doesn't show any of the options. Even worse, the "stop editing this list" option doesn't do anything.
Comment: I can't find the 'View Style' input list in your update, either.
Answer: in  your list default view is created using datasheet mode ,please create new view or you can use the existed view from library setting.
Comment: Not particularly useful if you need to create a list based on an existing spreadsheet of data (e.g. when you have lots of data already existing and just need to put it in a list).


Are the Taliban Pashtun nationalists?

Question: It is a well known fact that the groups composing the Taliban seek to obtain a Islamic emirate in compliance with Islamic laws; however, do they also seek to the foundation of a "Pashtunistan", the same way Islamic Baloch separatists seek their ethnic land?
Answer: Not ... exactly.
Pashtun culture is traditionally very tribal. So it is much more natural for them to feel allegiance to their family groups, tribes, and clans. Effectively, this means they like their politics very decentralized. This is why the north western province of Pakistan bordering Afghanistan, which is also mostly Pashtun, has a reputation for being a "wild west" territory. Until recently, the Pakistan government found it best to let much of it operate entirely under tribal control.
Sure there's an affinity for other Pashtuns. Like most everyone else, Pashtuns feel that people from their own culture are more likely to have the right ideas about things. However, the main trans-tribal institution Pashtuns seem to respect is their religion (largely Sunni Muslim, of the Hanafi school, but also heavily influenced by their own culture). This is why they have a tendency to think in terms of establishing an Iran-style theocratic government when they really must have a super-tribal government at all, and if it has a role it is to enforce proper Muslim behavior.
Now one could argue that this is a kind of Nationalism, but only pushing the religious aspect of their identity. However, it is more properly termed something else. Essentially Islamist, but only for their culture's flavor of that faith. Their main concern seems to be that governments ruling over Pashtuns should be run according to Pashtun religious principles. Most of the rest of politics should be left to the tribes.
The political expression of these principles for the last few decades has been The Taliban.

The Taliban's ideology has been described as combining an "innovative"
form of Sharia Islamic law based on Deobandi fundamentalism and
militant Islamism, combined with Pashtun social and cultural norms
known as Pashtunwali, as most Taliban are Pashtun
tribesmen.

(Of course this is all gross generalization, which means it's trying to describe mass cultural behavior, not the feelings of individuals. No people are a monolith).
Comment: @WantARevolution - It was news to me too until I started researching this question, but it appears that in the last couple of years the "[Federally-administered Tribal Areas](https://en.wikipedia.org/wiki/Federally_Administered_Tribal_Areas)" of Pakistan got rolled into a proper province under government control.
Comment: You have mentioned that **"Until recently,** Pakistan government... tribal control."
Has there been a change in their mindset?
Comment: Thank you for your answer T.E.D. One thing that bothers me is why they try to achieve control over the Panjshir valley, which is mostly composed of ethnic Tajiks and Uzbeks. So if there is no ethnic consideration or national territorial one's, why do the Taliban stop at these specific borders for their envisioned Emirate?
Comment: I remarked that the Taliban have been *trying* to take over Panjshir Valley against the Northern Alliance. Which goes back to my point of what value they see against that territory, because if they are not fighting for a dual Islamic and ethnic cause, why just remain isolated to Afghanistan? Their support to and by people of Pashtun origin, and their disputes of the border with Pakistan makes me wonder this. This makes it seems Ethnic in nature but were that the case they have no reason to expand north.
Comment: @Evamentality - Ah, I misunderstood. Well, the issue there is that the internationally-recognized borders of Afghanistan include that valley, not to mention it is **very** close to Kabul. That being said, they (Taliban) never took it before the US invasion, so its quite possible they'll be OK with just leaving it and the rest of the NE Takjik area alone for a while now as well. Particularly since they appear to have an ISIS problem in their own territory.

Are the Taliban Pashtun nationalists?


How to set tab to 4 spaces in vim?

Question: By default, the tab in vim is set to 8 spaces. How can we set the tab to 4 spaces in vim permanently?
Answer: Create a ~/.vimrc file with this line:
set ts=4 sw=4

This will set tabstops every 4 spaces and set the shiftwidth (that amount you indent) as 4 spaces also to match your tabstops.
Answer: Make ~/.vimrc and add this:
set tabstop=4

Here are some other helpful ones:
syntax on " Syntax highlighting
set showmatch " Shows matching brackets
set ruler " Always shows location in file (line#)
set smarttab " Autotabs for certain code
set shiftwidth=4

Comment: my backspace is not working after doing this.
Comment: @shahooo add `runtime defaults.vim` to the top of your `.vimrc`.
Answer: If you are just using vi (some people do not have vim available) put this in your .exrc file in your home directory or where you are editing code if you have/want a specific startup for a particular directory of code:
set shiftwidth=4
set tabstop=4
set expandtab "this might not work on all hosts"
"quotes make nice comments in your .exrc files"

How to set tab to 4 spaces in vim?


Modelling nonnegative integer time series

Question: I have a time series of integer values $x \geqslant 0$.  I would like to model it using, say, ARIMA, or Holt-Winters.  How do I properly preprocess it for the task?  I tried log-transform of $x' = x + 1$. Are there any other ways?
Answer: Use a model for integer time series, not ARIMA or Holt-Winters' method. You could try an INAR for example, or an autoregressive conditional Poisson model, or a GLARMA model. See Fokianos (2012) for a comprehensive review. Some possibilities in R are described in Liboschik et al (2017).
Comment: I think I could take a look at GLARMA since there is a package for that. However, is it actually conceptually wrong to model non-negative integer time series values with models like sarima or exponential smoothing (additive)? To me it seems like we can forecast, and then round to the closest integer. If the value is negative after the backwards transformation, it can be set to 0. Nevertheless, I am not sure if such a procedure is permissible given those model assumptions...