$S^2=SO(3)/SO(2)$. Does this mean that $S^2 = SU(2)/U(1) $?

Question: $S^2=SO(3)/SO(2)$. Does this mean that $S^2 = SU(2)/U(1) $ since $SO(3) \approx SU(2)$ and $SO(2) \approx U(1)$? Is there some more generic rule on how to relate
$S^{n-1} = SO(n)/SO(n-1)$ to the corresponding (special) unitary groups? Also, is there a way to write $S^{n-1}$ as a quotient or so of $Sp(n)$ and $Spin(n)$ (e.g. in specific dimensions)?
Comment: Just a few comments: (i) Some of the "$S^{1}$"s in your post should perhaps be "$S^{2}$"? (ii) $SO(3)$ and $SU(2)$ are not isomorphic as groups (or even homeomorphic as manifolds; $SU(2)$ double covers $SO(3)$). (iii) Whether or not $SU(2)/U(1) \approx S^{2}$ depends on how $U(1)$ is embedded. If $U(1)$ is the diagonal subgroup, then "yes"; the coset space is essentially the Hopf fibration. (iv) If memory serves, _Einstein Manifolds_ by Besse addresses your questions about spheres and Spin coset spaces.
Comment: If you take $\mathbb{R}^{n}$ with standard euclidean norm then $SO(n)$ acts on the vectors of unit length (the sphere $S^{n-1}$. So you have to figure out the stabilizer of a point. In particular choosing co-ordinates and embedding $SO(n-1)$ as the first $n \times n$ principal diagonal you get that it fixes the vector $(0, \ldots, 1) \in \mathbb{R}^{n}$. So we see the isomorphism. There are some coincidental isomorphims in low dimensions between spin groups and SO(n) which might give you isomorphic quotients but in general this is not true in higher dimensions.
Comment: Further to @AndrewD.Hwang's [comment](https://math.stackexchange.com/posts/comments/2454243)$\newcommand\o{\operatorname}$, while $\o{SO}(3)$ is not isomorphic to $\o{SU}(2)$, there is an isomorphism $\o{SU}(2)/\{\pm1\} \to \o{SO}(3)$ (the adjoint representation).  The inverse isomorphism carries each $\o{SO}(2)$ in $\o{SO}(3)$ into an $\o U(1)/\{\pm1\}$.  Then $\o{SU}(2)/{\o U(1)} \cong (\o{SU}(2)/\{\pm1\})/(\o U(1)/\{\pm 1\})$ by abstract nonsense, which is $\cong \o{SO}(3)/{\o{SO}(2)}$. (Also, I think that there is only one $\o{SU}(2)$-conjugacy class of $\o U(1)$s inside $\o{SU}(2)$.)
Answer: In general, to identify, say, a smooth manifold $X$ with a quotient $G/H$ of a Lie group $G$ by a closed Lie subgroup $H$, you need to produce a smooth transitive action of $G$ on $X$ with stabilizer $H$. For the classical compact Lie groups there are three standard series of transitive actions on spheres which go like this.
The special orthogonal group $SO(n)$ acts on $\mathbb{R}^n$ preserving the standard inner product. This naturally induces a transitive action on the unit sphere $S^{n-1}$ with stabilizer $SO(n-1)$, and hence
$$S^{n-1} \cong SO(n) / SO(n-1).$$
Furthermore, the natural map $Spin(n) \to SO(n)$ means we can also think about this action as an action of $Spin(n)$; then its stabilizer turns out to be $Spin(n-1)$, and so we can also identify
$$S^{n-1} \cong Spin(n) / Spin(n-1).$$
When $n = 3$ there is an exceptional isomorphism $Spin(3) \cong SU(2)$, and $Spin(2)$ inside $Spin(3)$ can be identified with the diagonal copy of $U(1)$ inside $SU(2)$. Note that the map $Spin(2) \to SO(2)$ is multiplication by $2$, as opposed to the standard map $U(1) \to SO(2)$ which is an isomorphism.
Similarly, the special unitary group $SU(n)$ acts on $\mathbb{C}^n$ preserving the standard inner product. This naturally induces a transitive action on the unit sphere $S^{2n-1}$ with stabilizer $SU(n-1)$, and hence
$$S^{2n-1} \cong SU(n) / SU(n-1).$$
Finally, the compact symplectic group $Sp(n)$ acts on $\mathbb{H}^n$ preserving the standard inner product. This naturally induces a transitive action on the unit sphere $S^{4n-1}$ with stabilizer $Sp(n-1)$, and hence
$$S^{4n-1} \cong Sp(n) / Sp(n-1).$$
Comment: @Marion: no. Lie groups of rotations are more complicated than spheres. They act on spheres, but that doesn't mean that the spheres themselves have Lie group structures. It's known that any compact connected Lie group has Euler characteristic $0$ (e.g. by the Poincare-Hopf theorem), and this rules out even-dimensional spheres having a Lie group structure. For the odd-dmensional spheres the argument is more involved.
Comment: QiaochuYuan thanks a lot. Would you be able to provide a good reference maybe?
Comment: Let me ask another related question. Is $S^2$ considered a Lie manifold? Generally the symmetries of spheres are rotations. Intuitively this would tell me that they are Lie manifolds. I heard today that only $S^0,S^1,S^3$ are Lie manifolds. Why is that?
Comment: @QiaochuYuan    I'm reading a book Wherein they mention the two-sphere as the coset: $$S^{2}\simeq\frac{SU(2)}{U(1)}$$ This doesn't fit your schema above..(Ref: Formulations of General Relativity Gravity, spinors and differential forms by Krasnov 2020)  Am I missing something?  Or is it because of the special isomorphism in dimension 3???
Comment: @R. Rankin: this is a special case of the spin isomorphism, thanks to the exceptional isomorphism $SU(2) \cong Spin(3)$.


Clustering using using min,max,mean and standard deviation

Question: I have read some papers on clustering application to detect outliers in the data set. In many places the euclidean distance between any 2 data points is calculated using minimum , maximum , mean and standard deviation of the data unit. Let's say the data set consists of multiple samples each of 1 hour duration. Now 1 hour of data is summarized to minimum , maximum , mean and standard deviation and euclidean distance is calculated on these parameters.
My doubt is what is the significance and rationale behind selecting the above 4 descriptive statistical parameters for subsequent use in clustering application.
Comment: Could you add a reference? This practice is non standard, though to be clear any distance metric can be used
Comment: I have never heard of using min, max, mean & SD to calculate Euclidean distance, & I cannot see how it is possible. The Euclidean distance between 2 points is the square root of the sum of the squared distances on each dimension. Can you say more about your situation & your data?
Comment: @Harsh and @gung   It was used like `d(X,Y) = sqrt( (avgx  -  avgy  )^2 + (stdx  -  stdy  )^2 + (maxx  -  maxy  )^2 + (minx  -  miny  )^2`
Comment: @Harsh  [ http://arc.aiaa.org/doi/book/10.2514/MSPOPS12 ] Here you can find the paper _**"New Telemetry Monitoring Paradigm with Novelty Detection"_**
Answer: Sure. You can also add other moments such as kurtosis and skew. In essence, this is the approach to clustering time series suggested by Rob Hyndman in this paper, Dimension Reduction for Clustering Time Series Using Global Characteristics where he develops the rationale.
http://www.robjhyndman.com/papers/wang2.pdf
Comment: @Johnson  Thanks for the reference. But the rationale for selecting _"`min,max,mean and std deviation`"_ is not mentioned in the paper.
Comment: "Moments" refer to key statistics of any distribution, even if the metrics you're focused on aren't explicitly mentioned.


Statistical mechanics vs. many-body theory

Question: Where is the basic difference of statistical mechanics with many-body physics? What are the systems which cannot be studied in statistical mechanics but in many body theory? After all we know interacting systems can be dealt with in statistical mechanics for example in studying the models of real gases, Ising-like systems by mean field theory etc.
Comment: I think the difference is subjective and it is a matter of taste which one you prefer.
Answer: The uses of this two theories are completely different.
Statistical Mechanics is used to see how by modelling the behavior of microscopic constituents you can predict the macroscopic phenomenas that you observe.
On the other hand Many Body Theory uses first principle techniques to see what happens microscopically when you have large no of particles in your system. Explaining the macroscopic phenomena are the second step here.
Because of their different techniques the applicability of these two theories are also different. For instance if we have a system with 20 atoms each with 2 valence electrons then if you use statistical mechanics the statistical fluctuations(uncertainty) in your results will be comparable to the actual results. Here you have to use Many Body Theory. On the other hand when you have 10^23 molecules, solving many body equations will become unimaginably tough even with largest supercomputers. There people use statistical mechanics.
Answer: I don't have an "official" distinction, but one difference is that statistical mechanics is used for systems with a very large number of particles, and is only concerned with quantities which are averaged over the whole ensemble. Many-body theory deals with smaller systems, and attempts to treat all the particles in the system, within some approximation.
Another is that many-body methods are typically used to apply to problems where the density of states is low, and they describe individual quantum states of the system.


What would Socrates have said if the trolley problem was asked to him?

Question: Imagine a situation a wagon carrier asked to Socrates a variation of the Trolley Problem. What will be the Socrates' answer in terms of being just and being a good man?
Comment: You should state the trolley problem.  Or at least give a link.
Comment: http://en.wikipedia.org/wiki/Trolley_problem but I have no idea how Socrates would deal with it.
Answer: Socrates, at least in his portrayal in the early Platonic dialogs (generally viewed as closest to the historical Socrates), would be more inclined to ask such a question than answer it.  His typical approach was to take someone who felt a sense of certainty about some moral or philosophical issue, and to ask him a question that would introduce doubt about his beliefs.  If pressed on his own stance, he would profess ignorance.


How are you finding [something]?

Question: I have read the expression "How are you finding [something] ?" (= What are you thinking of [something] ?) for the first time today. Is it used only/mostly in UK?
Comment: Waiter: how did you find your steak, sir? Diner: I just moved the peas and there it was!
Answer: How are you finding  may be American usage
What are you  thinking  of / about is quite idiomatic in British English.
What do you think about something is used to talk about an opinion .

What  are you thinking  of? ( idea)
I am thinking  of going to  America.(idea)
Answer: I would think that this usage of 'find' has a place in US English, judging by this entry in the Merriam-Webster (an American dictionary) entry:

3a: to discover by the intellect or the feelings : EXPERIENCE find
  much pleasure in your company
Answer: Although the usage is common in the UK ('I've always found him pleasant', for example), the online dictionaries I've looked at on and offline are strangely reticent about this precise meaning. (I forgot to try Merriam-Webster.)
However the OED mentions it specifically, as described here on StackExchange when a similar question was asked two years ago.
The somewhat similar legal usage 'Do you find the accused guilty or not guilty?' is perhaps related.

How are you finding [something]?


Convert Html Table to Excel

Question: i want to export an HTML table to excel in MVC.
I have the following code in my controller:
  public JsonResult ExportToExcel(Control ctl)
        {

            Response.Clear();
            Response.ContentType = "application/ms-excel";
            Response.AddHeader("content-disposition", "attachment;filename=ExcelCopy.xls");
            System.IO.StringWriter sw = new System.IO.StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);
            ctl.RenderControl(hw);
            Response.Write(sw.ToString());
            Response.End();
            return Json(1);
        }

and the follwing function in jQuery:
 function btnConvertToExcelClick() {

        var inputParamtrs={ ????????? }
         $.ajax({
                type: "POST",
                url: "/Expenses/ExportToExcel",
                data: inputParamtrs,
                success: function (json) {

                         }

        });
        return false;
    }

I guess what im trying to ask is how to pass the whole HTML table to the JsonResult function as a Control. Help!
Answer: Json is not a format that is supported by Excel, so you're using the wrong ActionResult.
Instead try creating your excel file as an HTML table or a CSV file.  I recommend exporting a CSV file as it's probably the easiest to construct.
Further, you can use an excel library to construct an Excel file.  Here are a couple.
http://e-infotainment.com/applications/csharp-excel-library/
http://code.google.com/p/excellibrary/
After you've constructed your CSV you can return the CSV as with a ContentResult (instead of json.)
    public ActionResult MakeExcelCSV()
    {
        string excelCSV = null;
        // consruct your CSV
        return Content(excelCSV, "application/ms-excel");
    }

Or you if you made an excel file with the library you can return it with a FileResult (instead of json)
    public ActionResult MakeExcelFile()
    {
        Stream excelStream = null;
        // consruct your excel file
        return File(excelStream, "application/ms-excel", "myexcel.xlsx");
    }

In either case, you won't need an ajax call to load the content, just link to it and open it in a new window.
 Your Text

Convert Html Table to Excel


Blocking web sites with Windows Firewall

Question: Is it possible to use Windows Firewall to block specific web sites for all browsers?
Answer: Yes, you should be able to achieve that using the Advanced Settings of the firewall. But you will need to know all the ip addresses of the remote servers.
See this example which talks about ICMP but you can do the same for any traffic. The Scope tab would be of interest because that's where you would define the remote ip of the web server(s).
Comment: The key thing being, "the IP addresses of the remote servers." The Windows firewall can't block "facebook.com", it can block 126.96.36.199 (etc) though.
Comment: Does the "local IP Addresses" list apply to the local intranet? Is there any way to specify no local IP addresses?
Comment: The "local IP addresses" refers to the ip address(es) of the machine's network card(s) or 127.0.0.1. But if you wanted to block access to this machine from the local network, then you would need to specify the ip addresses for the local machines/network in the remote ip as well. As far as the firewall is concerned, unless it resides on the local machine, then it is considered remote. More information would help answer the second question. Is this server the middleman between clients and websites? What role does it play?
Comment: This is on a workstation.
Comment: OK. When you say "no local ip addresses", do you mean allowed or denied? No matter which one, you can create a second firewall rule where you specify the local subnet to be allowed or denied.
Answer: Its probly better to block in the router or if you want it on a machine only do a redirect in the hosts file.  en.wikipedia.org/wiki/Hosts_(file)


Looking for Closed Form of Sum

Question: Is there a closed form of the following sum?
$$\sum^{m}_{j=0}\frac{(-1)^{j}{m \choose j}}{n+jk}$$
I figure it should but the binomial is throwing me off. Any help would be greatly appreciated.
Comment: Uh, so is $k$ just a constant here? Or were you $jk$ about there being a $k$?
Comment: I guess what I'm really wondering, OP, is whether this is a component of a larger sum or expression that people might be more successful trying to help you simplify. (Otherwise the appearance of $n$ and $k$ would be a little odd.)
Comment: Sorry for not clarifying, n and k are both constants in this sum. I appreciate the pun.
Comment: It is a component of a larger sum, I'll add it in so the variables make more sense in context.
Answer: The given sum equals
$$ \int_{0}^{1}\sum_{j=0}^{m}\binom{m}{j}(-1)^j x^{jk+n-1}\,dx =\int_{0}^{1}x^{n-1}(1-x^k)^m\,dx$$
and by the substitution $x=z^{1/k}$ and Euler's Beta function this equals $\frac{\Gamma(m+1)\,\Gamma\left(\frac{n}{k}\right)}{k\,\Gamma\left(1+m+\frac{n}{k}\right)}.$
Comment: You already knew that from your previous question (https://math.stackexchange.com/questions/2326721/integrating-a-tricky-infinite-sum-with-a-rising-factorial), by the way.
Answer: We recall the Melzak's identity $$f\left(x+y\right)=x\dbinom{x+n}{n}\sum_{k=0}^{n}\left(-1\right)^{k}\dbinom{n}{k}\frac{f\left(y-k\right)}{x+k},\, x,y\in\mathbb{R},\, x\neq-k $$ where $f $ is an algebraic polynomial up to degree $n $. So taking $f\left(z\right)\equiv1$ and $x=n/k$ we have $$\frac{1}{k}\sum_{j=0}^{m}\dbinom{m}{j}\frac{\left(-1\right)^{j}}{j+n/k}=\color{red}{\frac{1}{n\dbinom{n/k+m}{m}}}.$$
Answer: Assuming $n, k, m$ are positive integers, you could write this as
$$\log \left(\dfrac{\prod_{j \text{ even}} (n+jk)^{{m \choose j}}}{\prod_{j \text{ odd}} (n+jk)^{{m \choose j}}}\right)$$
For example, if $m=4$ it is
$$\log  \left( {\frac {n \left( 2\,k+n \right) ^{6} \left( 4\,k+n
 \right) }{ \left( k+n \right) ^{4} \left( 3\,k+n \right) ^{4}}}
 \right)
$$
Thus this is the log of a rational function of $n$ and $k$.  Numerator and denominator of that rational function are both of total degree $2^{m-1}$.  I don't see how this could be simplified any further.
Comment: I find it very annoying when the OP completely changes a question after it's answered.
Comment: I apologize for doing that, someone pointed out that I should include the full question so that it may give more context, I still greatly appreciate your contribution.
Answer: There is a  technique for this that has appeared  on several occasions
on MSE which I am not able to locate at this time. We introduce
$$f(z) = (-1)^m \frac{m!}{n+zk} \prod_{q=0}^m \frac{1}{z-q}.$$
We suppose that $z=-n/k$ is not an integer from the range $[0, m].$ We
then obtain
$$\mathrm{Res}_{z=j} f(z)
= (-1)^m \frac{m!}{n+jk}
\prod_{q=0}^{j-1} \frac{1}{j-q} \prod_{q=j+1}^m \frac{1}{j-q}
\\ = (-1)^m \frac{m!}{n+jk} \frac{1}{j!} \frac{(-1)^{m-j}}{(m-j)!}
\\ = (-1)^j \frac{1}{nj+k} {m\choose j}.$$
It follows that
$$S = \sum_{j=0}^m \mathrm{Res}_{z=j} f(z)$$
and since residues sum to zero this means that
$$S = -\mathrm{Res}_{z=-n/k} f(z) - \mathrm{Res}_{z=\infty} f(z).$$
Now  the residue  at infinity  is zero  since $\lim_{R\to\infty}  2\pi
R/R^{m+2} = 0$ or more formally through
$$-\mathrm{Res}_{z=0} \frac{1}{z^2} f(1/z) =
- \mathrm{Res}_{z=0} \frac{1}{z^2}
(-1)^m \frac{m!}{n+k/z} \prod_{q=0}^m \frac{1}{1/z-q}
\\ = - \mathrm{Res}_{z=0} \frac{1}{z^2}
(-1)^m \frac{z\times m!}{zn+k} \prod_{q=0}^m \frac{z}{1-qz}
\\ = - \mathrm{Res}_{z=0} z^m
(-1)^m \frac{m!}{zn+k} \prod_{q=0}^m \frac{1}{1-qz}
= 0.$$
This leaves the contribution from $z=-n/k$ and we get
$$-\mathrm{Res}_{z=-n/k} \frac{1}{k}
(-1)^{m} \frac{m!}{z+n/k} \prod_{q=0}^m \frac{1}{z-q}
\\ = (-1)^{m+1} \frac{m!}{k} \prod_{q=0}^m \frac{1}{-n/k-q}
\\ = (-1)^{m+1} \times m! \times k^{m} \prod_{q=0}^m \frac{1}{-n-qk}
\\ = m! \times k^{m} \prod_{q=0}^m \frac{1}{n+qk}.$$

Looking for Closed Form of Sum


Do you ask testers to talk about themselves at the start of a usability test?

Question: When performing a one-on-one usability test, do you ask your testers to introduce themselves and give a brief background about themselves? Or do you just introduce yourself, give background about the site they're testing, and begin?
Comment: As folks mentioned below this kinda depends on the stage. Are you asking this in regards to making the participant comfortable or are you asking them these questions as a screener? It also depends on where you're doing your 1:1, e.g. a mall test would be conducted slightly differently compared to a traditional usability lab setup.
Answer: It would be a personal choice on how you wish to conduct your usability testing sessions.
In an ideal situation your participants have been recruited and screened prior to testing. The screening process is based on requirements, which guides screening questions and confirms qualified participants. This means that you are well aware of who they are, their background and a little about themselves.
When it comes time to conduct the usability test a very basic flow I follow is:

Introduce myself
Have participant sign any necessary forms
Ask pre-test/background questions
Ask test questions and collect performance data
Ask closing questions
"Thank you and get out"

I never just ask "tell me a little about yourself" or "give me some brief information about your background". All questions should be to the point and very applicable to the product you are testing.
If I've had the chance to go through a proper recruiting process, the pre-test questions are very brief and serve mostly to just identify the individual within the recording season. "What is your name?", "What is your role?", "How many years of experience do you have on this product?" - then go. You can now watch the recorded test session without having to go back and look at the recruiting information to figure out who the participant is, and if you do want to go back to find them you can do it easily... because they just told you who they are (instead of "test participant #5").
If you don't go through an in-depth recruiting process your pre-test questions should be more specific to the user's experience in the environment and related processes/products. One would hope you've done a little filtering before so you at least have a rough target audience.
Introductions and background in the pre-test is fine, but never (in my opinion) ask an open ended question. Ask the questions you need to ask to get the background information you need to get for the usability analysis you are currently conducting.
Comment: I'd tend to just go over the screening questions briefly with them particularly technical requirements to which recruiters can sometimes misunderstand responses.   On the list above I always add the statement: "We're not testing you: we're testing the software, so no response you give can be 'wrong'"
Comment: @PhillipW, good call! That sort of statement is hidden in my above list somewhere between 3 & 4. It is too easy for participants to feel they are being tested -- I've been in several sessions where participants were petrified the results would be shared with their boss!
Answer: I would normally ask the tester a little about them, but in light conversation.
This makes them feel a little more at ease and they get used to talking to you a little bit and it can also be good to get some more background information and help you shape more specific scenarios for them to make the test as realistic as possible.
Answer: I find it beneficial to start off getting to know the person a bit. It gets the conversation flowing and you can transition right into the test without it feeling forced or methodical. This usually makes for a more natural and comfortable testing experience for the tester.
Answer: Either I or a recruiter have already asked participants a series of demographic questions to screen them and make sure that they'll be a good fit for that study. I'll typically ask a few questions that are based on that information, particularly if they were recruited by someone else.
For example:
"I see that you've been djing for 15 years. What genre(s) of music do you dj?"
"How many years have you been using OS X?"
"Which neighborhood in San Francisco are you living in currently?"
I try to keep it relevant to the study and ask questions that can be answered briefly. An open-ended question can encourage participants to begin talking at length about unrelated topics and I prefer to avoid interrupting participants whenever possible.
I do consider it valuable to ask a few conversational questions before beginning a study. It helps establish rappor.
Answer: When I have an informal period before the study begins, then I will chat with them during that time.  For example, for in-person usability studies, I have to pick up the participant from the reception desk and walk them to the usability lab.  The walk is a few minutes, and we chat as we walk.  I don't ask them to introduce themselves and give a brief background.  I ask specific questions like "have you ever been to our campus before?" or "have you participated in a usability study before?"  I will sometimes ask them to refresh my memory about answers to specific questions in the usability study screener.  "Can you remind me how big your infrastructure is?" is one of my standard questions for my current role, where I'm usually talking to system administrators.
When we are in the usability lab, my questions are focused on the goals of the study.  In that case, I introduce myself, give them some information about what will happen during the study and a reminder that we're not testing them but rather our software, and give them the opportunity to ask me any questions.  I sometimes have some questions that I will ask before we delve into the task list, which are gathering additional information beyond what was gathered in the screener or to clarify something ambiguous in their answers to the screener.
This assumes that your participants were screened for relevant characteristics before you scheduled them to participate in your study.  In the absence of such screening, then I will ask them questions similar to what I would have asked if I had pre-screened them.
Answer: The answer to this question really depends on your research goals and the product you are testing. If you are going for "hard truth", more quantitative  data; and you have many participants then it will be only a waste of time. E.g. if you are looking for usability issues of a museum website and your participants are people who work with computer at work, parents between 30 - 45; then I would think that I would not need to talk to them. Being friendly would be enough to carry the research and identify the problems. That was what I did with museum websites. In another project, I was researching on a very private personal product related to sex life. Getting the participants to "open up a bit" helped to not only identify the usability issues, but also inspire me when I was doing the redesign.
One more thing, there is always a risk of the participant getting a bias when they get to know you. It s a subconscious thing. We tend to critisize less or  hide bad things about themselves or about something we dientify wit them even from people we slightly like.


Pulling a file from another job before building in Jenkins?

Question: Hope you can help me on this one. I have a job called "Template" that generates a template.xml file. I have several other jobs that use this template.xml file. However, before they build, i wanted that they could pull the latest template.xml from the "Template" job workspace.
Answer: In your "template" job, under Post-Build Actions, choose to artifact your xml file using the archive option.
You can then use the "Copy Artifact Plugin" to copy it over to all other jobs.
Jenkins Job Setup for Artifact Generator Project:

Jenkins Job Setup for Artifact User Project:
Comment: I ended up using wget to get the file from the workspace... is this a bad practice?
Comment: See highlycaffeinated's comments below. To add to that, you are limiting yourself to using Linux slaves (may not be an issue, something to think about though). Also, archiving allows you to relate different template files with different builds of the other jobs (using fingerprinting).
Answer: In your Template job, you can archive the template.xml file as an artifact, then it will be available to your other jobs at a URL similar to the following:
http://myserver/jenkins/job/myjob/lastSuccessfulBuild/artifact/template.xml

Comment: Two risks in pulling it from the workspace: 1) a person with appropriate permissions can click the "Wipe Out Workspace" link and remove the file; 2) a build may fail leaving either no file or an unusable file.  Pulling the file from the archived artifacts will always get you the file from the last successful build.
Comment: I ended up using wget to get the file from the workspace... is this a bad practice?
Answer: I used Copy Artifacts plugin with Jenkinsfile. Here an example:
In the job that is producing the artifact you should do something like:
pipeline {
 options {
  copyArtifactPermission '*' //Here you can specify the job name also
}
  stages {
    stage("Run") {
      ...
      archiveArtifacts artifacts: "my_artifact.yaml"
    }
  }
}

In the job that is consuming the artifact you can use something like:
stage("Consumer") {
  steps {
    script {
        copyArtifacts filter: "my_artifact.yaml", projectName: 'PRODUCER_JOB',
          selector: lastSuccessful()

    }
  }
}

Comment: Is archiveArtifacts a part of Copy Artifacts plugin?
Comment: Nope. https://www.jenkins.io/doc/pipeline/steps/core/#archiveartifacts-archive-the-artifacts
Answer: In my end I use a pretty strainghforward approach. I run jenkins in a usual layout (ubuntu 16.04 server) and I need call the checkstyle maven plugin using the same checkstyle.xml config file residing inside a dev-resources job:

Than I call mvn checkstyle:

Hope it can be useful for someone else.


A word for choosing wrong no matter what...?

Question: I'm looking for a word (that may or may not exist) that embodies the feeling of having to choose between two things and knowing that whichever you choose, you will feel like the other was the better choice. Any ideas?
Answer: There is a phrase:

The grass is always greener on the other side of the fence.

This embodies the feeling where one always believes that something else is better rather than their current situation.
This could or could not apply to your situation. It all depends on what it is.
Did this help?


Is it possible to extend your Origin gametime?

Question: Is there a way to get more "gametime" on a specific game in Origin after it runs out? Or a way to extend one's "gametime" before running out?
Comment: If my answer has solved your question, please use the tick underneath the downvote arrow.
Comment: Had to wait a certain time , then forgot. Sorry.
Answer: No, you CANNOT extend your OriginTM Game TimeTM counters.
Game time is designed to be a timed demo. It's basically, "try before you buy". Extending is not possible due to the way the system works and how timed data is stored.
There isn't any method to extend it because it is a timed demo of a full game.
Alternatively, you can do what the system's trying to achieve, which is to buy the game.
With this system, they're hoping that you're invested into the game by the end of the two hours, to the point where you'll want to continue progress, thus buy the game.

Couldn't they just do a time extender?

That'd the pointless.. It is a timed demo. Not some subscription-based model placed on a game that can normally be purchased for a one-time fee.
I'd dread to see what happens if Minecraft had adopted a subscription-based model.
Comment: Seems reasonable :).
Answer: you could turn off your wifi once you are in the game but you may only be able to play the campain
Comment: I'm pretty sure that they thought of that while building the system... Seems pretty unlikely they'll just let you have a game for free as long as you're offline.


Get Facebook referral URL in Google Analytics

Question: In my Google Analytics reports I get "facebook.com / referral" as the source. Is it possible to get the exact URL?
Answer: I don't think it's possible. as @yahelc pointed on a previous comment most traffic from facebook goes through a facebook controlled redirect on page facebook.com/l.php .So if you want to have campaigns on facebook you can use urls with campaign query parameters to keep track of it.
eg: link to
http://www.example.com/?utm_campaign=Facebook&utm_medium=social&utm_source=facebook.com

Now they will show up in GA as a separate campaign and you can tell how many visitors come from that specific link. You probably want to minify that link using bit.ly or goo.gl.
Create multiple campaigns on facebook and change the utm_campaign parameter as much as you want. You can also create different utm_content parameter to separate your marketing efforts on facebook. Keep the utm_medium and utm_source as static as on the example above.
This is how social marketing analytics measures marketing efforts on social networks. Anything that comes from facebook is not tagged you know comes from people posting links to your site other than you.
At the same time it really makes no sense to have the referral url at all. If you think about it most of the times it will be from private posts that you don't even have access to see, even if you had a url for it. That's just not the way facebook works. It doesn't have pages, it has streams and posts.
More about url tagging:
http://support.google.com/analytics/bin/answer.py?hl=en&answer=1033863
Comment: It is because we want to know if the visitor came from their Facebook business page. But I get that it may be the wrong way to look at it.
Comment: If you want to see how many people come from their business page you should definitively look into campaign tagged urls. Make sure the links on the business page are tagged. Alternatively you can create a specific landing page that you send your users to.
Answer: The answer is yes and no. You can drill down to referral path for facebook source in the report Traffic Sources -> Sources -> Refferals by simply pressing facebook.com at the Source coloumn, just like for all other visits from the referring site.
But that would be not much of a use, because for facebook you'll always see /l.php. And that's how facebook works, it doesn't allow visitors to visit the link immedeately, instead it redirects user to the page with url facebook.com/l.php?u=<link-to-your-site.com> with a redirect or maybe with some text like "if you're sure you want to leave", so technically, the referring page would be this /l.php that GA shows.
So if you need to track the efficency of your Facebook activities - use utm tags, like @Eduardo Cereto mentioned. Here's a very nice video tutorial on link tagging for GA: http://services.google.com/analytics/breeze/en/v5/campaigntracking_adwordsintegration-v23_ia5/ (starts from p. 17, you can skip all that goes before).
Hope it helps!
Answer: i just know this settings here:
http://www.sebastienpage.com/2009/05/06/google-analytics-trick-see-the-full-referring-url/
Comment: This doesn't work for Facebook, which launders the url through a redirect-er; everything will just be `/l.php`
Comment: This GA post is 4 years old. Analytics has changed completely.


Determinants and Adjugates

Question: If the determinant of a matrix $A$ is zero, then is the product $$A \cdot \operatorname{adj}(A)$$ also zero? Is there an explanation that does not involve eigenvalues?
Answer: To address the question writer's question, I derive from the well-known Laplace expansion formula.  In this way, OP will really understand how $\operatorname{adj}(A)$ interacts with $A$ through matrix multiplication to give a diagonal matrix.
Denote $C_{ij}$ as the $(i,j)$-th entry of the cofactor matrix, which is the transpose of $\operatorname{adj}(A)$.  I hope following classical argument is accessible to any interested high school students.
By the well-known Laplace expansion formula for calculating determinants, for any $i \in \lbrace1,\dots,n\rbrace$
\begin{align}
\det(A) &= \sum_{j=1}^n (-1)^{i+j} a_{ij} \det(M_{ij}) \\
&= \sum_{j=1}^n a_{ij} C_{ij} \label{1}\tag{1}
\end{align}
But a matrix product of $AB$ has entries of the form
$$(AB)_{ij} = \sum_{k=1}^n a_{ik} b_{kj} \label{2}\tag{2}.$$
To make \eqref{1} resembles more \eqref{2}, we consider the transpose of the cofactor matrix, whose $(j,i)$-th entry is $C_{ij}$.  For any $i$ fixed,
$$
\det(A) = \sum_{j=1}^n a_{ij} (C^T)_{ji} \label{1'}\tag{1'}
$$
We change the $j$ in \eqref{1'} to $k$.  For each $i$ fixed,
$$
\det(A) = \sum_{k=1}^n a_{ik} (C^T)_{ki} \label{1''}\tag{1''}
$$
\eqref{1''} represents any diagonal entry of $AC^T$.  To show that $AC^T$ is a diagonal matrix, one needs to justify that the non-diagonal entries of $AC^T$ equals zero.
For each $(i,j)$ fixed with $i\ne j$,
$$
(AC^T)_{ij} = \sum_{k=1}^n a_{ik} (C^T)_{kj} = \sum_{k=1}^n \color{red}{a_{ik}} C_{jk} \label{3}\tag{3}
$$
This is in fact the Laplace expansion of the determinant
$$
\begin{vmatrix}
 a_{11} & a_{12} & \cdots & a_{1n} \\
 a_{21} & a_{22} & \cdots & a_{2n} \\
 \vdots& \vdots & \ddots & \vdots \\
 a_{i1} & a_{i2} & \cdots & a_{in} \\
 \vdots& \vdots & \ddots & \vdots \\
 \color{red}{a_{i1}} & \color{red}{a_{i2}} & \cdots & \color{red}{a_{in}} \\
 \vdots& \vdots & \ddots & \vdots \\
 a_{n1} & a_{n2} & \cdots & a_{nn}
 \end{vmatrix}
$$
Note that the $\color{red}{j\text{-th row}}$ of the above matrix is replaced by the $i$-th row of $A$ as the Laplace expansion formula \eqref{3} suggests.  Since any matrix with two identical rows has zero determinant, we conclude the following useful formula.
$$\bbox[2px, border: 1px solid red]{\det(A)I_n=AC^T=C^TA}$$
Uptil this step, this works for entries defined on any commutative ring (equipped with addition and abelian multiplication, I don't know whether this works for non-commutative rings.)
To answer the question, we set $\det(A) = 0$, so that $A \operatorname{adj}(A) = 0$.
Remark: We assume nothing on the existence of multiplicative inverse in the commutative ring.
Comment: Very nice! ${}{}$
Comment: @RafaelVergnaud Equation \eqref{3'} describes the off-diagonal entries in the matrix product $AC^T$.
$$(AC^T)_{ij} = \sum_{k=1}^n a_{ik} (C^T)_{kj} = \sum_{k=1}^n \color{red}{a_{ik}} C_{jk} \label{3'}\tag{3'}$$
$C_{jk}$ (row $j$ column $k$) with $k$ running from $1$ to $n$ means a row of cofactors $C_{jk}$ with the $j$-th row of $A$ deleted.  The factor $a_{ik}$, $k = 1,\dots,n$ replaces $a_{jk}$ in the above Laplace expansion, giving a zero determinant.  This holds for $\binom{n}{2}$ pairs of $(i,j)$.
Comment: Hey, GNU, I don't quite understand why the remaining entries are zero's. It could be the notation. I do understand if there are two row vectors that are equivalent in a matrix, then the determinant of that matrix is zero.
Answer: Note that $$A \times \operatorname{adj}(A)= \det(A) I$$ where $I$ is the identity matrix.
Thus  $$ \det(A)=0 \implies A \times \operatorname{adj}(A)=0$$
Answer: From the formula for matrix inverse, you can find that the determinant is equal precisely to the expression you're asking about. So determinant being zero is equivalent to this expression being zero.
Comment: Hey. That's actually what I'm trying to prove. I'm assuming that A is not invertible and trying to show that A * adj(A) = det(A) * I_n = 0. But, just wanted to make sure. Thank you!
Comment: @RafaelVergnaud If you want to be sure about this (over *any* commutative ring), I suggest you to take a look at my answer.

Determinants and Adjugates


slither is not working on my linux environment

Question: <code>slither test/TestUtils.sol
Traceback (most recent call last):
  File "/home/mente/.local/lib/python3.10/site-packages/slither/__main__.py", line 826, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/home/mente/.local/lib/python3.10/site-packages/slither/__main__.py", line 86, in process_all
    compilations = compile_all(target, **vars(args))
  File "/home/mente/.local/lib/python3.10/site-packages/crytic_compile/crytic_compile.py", line 637, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "/home/mente/.local/lib/python3.10/site-packages/crytic_compile/crytic_compile.py", line 117, in init
    self._compile(**kwargs)
  File "/home/mente/.local/lib/python3.10/site-packages/crytic_compile/crytic_compile.py", line 548, in _compile
    self._platform.compile(self, **kwargs)
  File "/home/mente/.local/lib/python3.10/site-packages/crytic_compile/platform/solc.py", line 154, in compile
    targets_json = _get_targets_json(compilation_unit, self._target, **kwargs)
  File "/home/mente/.local/lib/python3.10/site-packages/crytic_compile/platform/solc.py", line 276, in _get_targets_json
    return _run_solc(
</code>
Answer: One possible cause of this error is that the version of the Crytic Compile library installed on your system is incompatible with the version of Python you're using. The error message mentions that Python 3.10 is being used, but the latest version of Crytic Compile only supports Python 3.6, 3.7, and 3.8.
To resolve this issue, you could try uninstalling the current version of Crytic Compile and installing a compatible version. You can check the supported Python versions for the latest version of Crytic Compile on its GitHub page: https://github.com/crytic/crytic-compile
Once you have a compatible version of Crytic Compile installed, you should be able to use Slither to analyze your contracts without encountering this error. It's also a good idea to double-check that all of the other dependencies for Slither are installed and up-to-date, as this can sometimes cause similar issues.


Experimental proof of light speed isotropy

Question: Where is the experimental proof that observers travelling toward or away from a light source, will always find that light from that source measures the same speed, regardless of their own speed?
Comment: One needs to distinguish between the isotropy of the one-way speed of light and the isotropy of the two-way speed of light.  Here's a review:  [A Review of One-Way and Two-Way Experiments to Test the Isotropy of the Speed of Light](https://arxiv.org/abs/1011.1318)
Comment: Related, possible duplicate: https://physics.stackexchange.com/q/2230/
Comment: Also related: https://physics.stackexchange.com/q/232129/ and https://physics.stackexchange.com/q/233540/
Comment: The question in the title differs from that in the text. Use constancy instead of isotropy.
Comment: See my answer at https://physics.stackexchange.com/q/361488/
Answer: There have been very many tests of the constancy of the speed of light. You can readily find lists and descriptions of them on the Internet. For example, see https://math.ucr.edu/home/baez/physics/Relativity/SR/experiments.html
Answer: It is claimed that on the earths surface the existence of an Äther would be observed with the Michelson-Morley experimen.

Michelson expected that the Earth's motion would produce a fringe shift equal to 0.04 fringes—that is, of the separation between areas of the same intensity. He did not observe the expected shift; the greatest average deviation that he measured (in the northwest direction) was only 0.018 fringes; most of his measurements were much less. (Wikipedia)

By this the quite possible assumption that the velocity of EM radiation depends from some property or conditions of space (Äther) was declined. Instead it was claimed that the speed of light is independent from the observers velocity.
Later Einstein introduced an observer in a point of space with different gravitational potential should observe a smaller value of c in a point of space with higher gravitational potential [like for example near a Black hole). The Äther was banned but isn't the gravitational potential a condition or property of space?

Where is the experimental proof that observers travelling toward or away from a light source, will always find that light from that source measures the same speed, regardless of their own speed?

Reproducing the MM experiment on a satellite with its vanishing gravitation in relation to the earths field, with its high velocity in relation to the earth and it acceleration-free behavior your question will be answered better than with MM experiments on earth. But this experiment is not necessary because we are sure to reach the right answer for all time.
The point is that in our daily life we could live with the constancy of light independent from the observers speed or with the constancy of light due to the gravitational potential. More interesting is the question, would this two different points of view change something in calculations for real physical processes, say for particle accelerators.
Comment: Does this mean then, that if I were to travel towards a source of light at 242Ms-1 and I measured the speed of that light, I would find that its speed would measure 299,792,458Ms-1 rather than the 299,792,700Ms-1 that common sense would tell me I should?
Comment: Robert, no. IF and only IF the MM experiment on a satellite shows the anisotrophy of space one has first to measure this anisotrophy in all directions and by this the metric of space. One has to determine in which direction we are traveling in relation to the overall space. Remember that in flowing water after a while you are part of the flow. In space your are moving always on a geodesic path. Ttarting in another direction / with another speed you are on another geodesic path too. Determining the anisotrophy you will know with which speed light arrives you from different directions.
Comment: There isn't any information about the relative motion between any source and you. It does not matter in which direction the source moves relatively to you. The emitted light travels in space with c. And c always depends from the local gravitational potential.
Answer: First, the constancy of the speed of light and its isotropy in a vacuum does indeed have strong theoretic descriptions and proofs, such as those provided by Albert Einstein and Hendrik Lorentz.
Our everyday experience that there is no limit to how fast an object can move if you keep accelerating it is actually incorrect. Both position (in the direction of motion) and time measurements are slightly nonlinear (and given by the Lorentz "boost", see What is a Lorentz boost and how to calculate it? and https://en.wikipedia.org/wiki/Lorentz_transformation), getting increasingly inaccurate with increased speed. So the conventional fixed maximum speed of any object, which is the speed of light in a vacuum, is actually an infinite speed when properly measured. Obviously, it is impossible to reach an infinite speed, no matter how much we try to accelerate, because the energy required for acceleration to true infinite speed would be infinite. The conventional idea that the speed of light is fixed is only correct due to our mistaken way of measuring speed. If we did measurements according to how Nature actually works (see the Lorentz references above), the speed of light would be infinite. You can't go faster than infinite speed!
Second, one-way measurements of the speed of electromagnetic radiation from a near-point radioactive source to a spherical radius show no anisotropy.
Third, photons have been slowed down dramatically through laser refrigeration and other techniques, but measurements of the one-way (slower) speed of light show isotropy to within the fairly good accuracy possible in the experiments.
Fourth, the Global Positioning System relies on accurate timing to compute a location and elevation of any GPS receiver. The time values transmitted by the 24 current satellites are corrected by software separately for the special and general theories of relativity. If there were any error in either theory such as an anisotropic speed of light, the GPS would not work to the phenomenal and repeatable precision that it demonstrates every day, all over the world.


Cross Premise Hybrid Office365 on prem issue

Question: We have this Hybrid setup where few pilot users are migrated to office365.
Now the problem started, wherein on-prem users who have access to Calendars for the users who are migrated are getting random password prompts.
Does anyone come across this situation and a solution?
Answer: Did this issue persist via OWA?
Folders can be accessed cross forest in many scenarios, but they are not fully supported by Microsoft as outlined in Permissions in Exchange hybrid deployments.
I suggest you remove the permission and re-assign it. It is better to create a new profile for test.
The best solution is to move both mailboxes to Exchange Online.


About Equallogic Dell storages controller replacement ? Active /Passive

Question: Regarding Dell Equallogic storage arrays, is it possible to replace the active controller module despite the fact that it's processing volume I/O? If not, what should I do before replacing it?
Comment: In a dual controller mode it will switch to the other controller in case of a fault. What are you tring to do ? (as I have difficulty to see why you replace it if it work (as it's active))
Comment: In Equallogic models , several times i had that problem. Running active controller having a problem but still running. But its critical and can go down anytime. So thats why sometimes it should be replaced when a thresold limit reached or something like that as i understand.
Comment: I want to ask that , can i just reboot the active controller and all luns will be automatically transferred to the passive one when it comes online to be the primary active controller.  Or should i move all luns by myself to other passive one - that option seems not right because its passive and i can not move to that one right ?
Comment: You move no LUN.... the way it work is the passive will activate and the active become passive.  the IP is the same, so the gear connect to the new active, the problem you can face is a bad failover switch, thus vm on the lun can lost access to the lun temporary.
Answer: You move no LUN.
The way it work is the passive will activate and the active become passive. The IP is the same, so the gear connect to the new active, the problem you can face is a bad failover in case of a bad configuration, thus your hypervisor can lost access to the SAN temporaly. Its the problem you can face.
To switch to the passive controller manually the easiest way is to unplug the rj45 from the active controller, the passive (still plugged) will take the load from there.
Its actually a good test before putting a equalogic into production.
To move LUN its not when the active/passive controler do balance. Its when you have a failover equalogic SAN configuration. When the active SAN fail, the passive SAN automaticly take the load, but when the failed SAN is ready to rebecome online you need to redirect to a new iscsi target to retarget the correct active SAN. As you can see its not your case.
Comment: Unplugging the networking from the back of the active controller is absolutely the worst way to perform a failover from active to passive. At best, for a system new enough to include "vertical port failover", the active controller will "borrow" the passive's network link to continue functioning.
Answer: Before replacing the active controller, you should perform a "restart" from Group Manager. The process this starts makes an attempt at a non-disruptive failover, and provides a quicker handoff of iSCSI sessions than simply removing the active controller would. Whether or not this causes an outage for you would depend on whether your host configuration follows Dell's best practices (e.g. iSCSI login timeout of 60 seconds).


Hera: Multiple Nvidia drivers installed (?) How to clean up

Question:
I saw that these were "free" in the AppCenter, so I clicked on them all. The next boot resulted in the black screen several people experience. I managed to (finally) get back to a working system, but don't ask me how. So, (1) is it possible to get rid of them from the list shown in the figure and (2) how do I know if I am using the best driver for my video card (Nvidia GEForce GTX 570)  Thanks
Answer: The following command will remove the proprietary Nvidia driver:
sudo dpkg -P $(dpkg -l | grep nvidia-driver | awk '{print $2}')
sudo apt autoremove

This will install most recent nvidia driver
sudo ubuntu-drivers autoinstall

Answer:
Currently, it doesn't appear possible to hide the drivers.
Checkout the related issue #247 and issue #1068 on the AppCenter's issue tracker which have to do with this.

I recommend installing the latest Nvidia drivers that support your graphics card.
I have similar drivers available on my laptop and use the nvidia-driver-390 package which works very well.


Implementing Dijkstra's shortest path algorithm using a red/black tree?

Question: I know that Dijkstra's algorithm in reality is implemented using a Fibonacci heap. But can it also be implemented using a red black tree and still have a worst-case running time of O(m log n)?
Comment: See http://www.cs.utexas.edu/users/shaikat/papers/TR-07-54.pdf for actual ways on how to implement it efficiently.
Comment: Have a look into this related question http://stackoverflow.com/q/14252582/194609
Answer: For starters, it's rare to actually see Dijkstra's algorithm implemented with a Fibonacci heap.  Although the Fibonacci heap gives great asymptotic performance (O(m + n log n)), in practice it has such high constant factors that other types of heaps are more efficient.
As to your question - yes, you could use a red-black tree as a priority queue to get O(m log n) performance.  This works because you can find the minimum element in a red-black tree in O(log n) time and simulate a decrease-key operation on the tree in time O(log n) by doing a deletion followed by an insertion.  However, this is probably not as efficient as using a standard binary heap, since the red-black tree has worse locality of reference and more memory overhead.  More generally, you always can use a balanced binary search tree whenever you need a priority queue, though usually doing so is overkill.
Hope this helps!
Answer: I would not say that Dijkstra's algorithm is implemented using a Fibonacci heap. In fact any heap will do although Fiboncci has the best amortized complexity for different operations(keep in mind though this only shows in really huge graphs). Again using red-black tree will achieve the same computational complexity but will have higher constant as working with red-black trees is more complex.
What you need for this algorithm is only to be able to get the minimum element from a given set. That is what a heap is meant for and thus it is best suited for this problem. A red-black tree can do a lot of other stuff and thus is more complex and preforms worse in this particular case.
Answer: This is an interesting question. Yes, you can use Red-Black tree to implement, here is an example below:
https://rosettacode.org/wiki/Dijkstra%27s_algorithm#Java


Windows 8.1 keyboard driver issue

Question: I have successfully reinstalled a keyboard driver after having an issue (NumLock acts as Volume up -- nothing too bad -- but SPACEBAR acts as volume down!). Without having to resort to disabling fast startup (maybe a better solution than installing an older version of BOOTMGR, really, to avoid the OS Choice graphical screen, which is the cause) how can I fix this?
A smaller, nonimportant thing, is starting an autohotkey script in all sessions (it's compiled, it changes a few shortcut keys on the session, namely two keys that I don't use and now could use as actual volume keys -- I don't have media buttons)
Answer: It looks like it is a Function Key. F1, F2 and other Functions keys allow you to adjust monitor brightness, volume and such.
You can use FN for the moment. Functions Keys are deep in the BIOS but could be re-mapped by most programs. Re-installing the keyboard would be the best way to solve the problem.
As for the Hotkey Script, it's because you added it as a startup item in the Boot Manager. You can ask it through Task Manager.
I would suggest not use Hotkey Scripts to remap. It's recommended in the Help Pages. You should use AutoHotkey to create Hotkeys solely or for automation.
Remapping keys with autohotkey is a common error.
Comment: Um, no. I don't have Fn, nor real Media keys. I have actually dismantled the keyboard, washed it, dried it, put it back and now the issue is different (the numpad keys are practically unusable). I have done a modification to the scancode map of Windows. Most of the numpad keys do nothing now. The top row has special functions (Assigned NumLock to Play/Pause, / and * to volume keys and - to "This PC". Also assigned RWin and the menu key to previous and next track.
Comment: Maybe I will dismantle the keyboard again and remake it in such a way it doesn't have these new problems either. The keyboard is a standard 102-key (or 101, I don't know, I didn't count the number of buttons there when putting each of them back...), without FN or the such (Doesn't have a (< >) key). The keyboard is over 6 years old, I forgot to say, and it started recently (I've seen the wrong scancodes in another micro operating system which could display what scancodes it was getting) So the problem was hardware now. No software errors.

Windows 8.1 keyboard driver issue


How do you handle data imbalance in SVM?

Question: If I am training a SVM on a lrge training set and if the class variable is either True or False, would having very few True values compared to he number of False values in the training set affect the training model/results? Should they be equal? If my training set doesn't have an equal distribution of True and False, how do I take care of this such that my training is done as efficiently as possible?
Answer: It's fine to have imbalanced data, because the SVM should be able to assign a greater penalty to misclassification errors related with the less likely instance (e.g. "True" in your case), rather than assign equal error weight which results in the undesirable classifier that assigns everything to the majority. However, you'll probably get better results with balanced data. It all depends on your data, really.
You could skew the data artificially to get more balanced data. Why don't you check this paper: http://pages.stern.nyu.edu/~fprovost/Papers/skew.PDF.
Answer: My experience is that standard SVM classifiers do not really work nicely on unbalanced data. I encountered that for the C-SVM and it is even worse for the nu-SVM. Maybe you want to have a look at P-SVM which offers a mode that is especially suitable for unbalanced data.


Wordpress - show specific page on main index instead of latest

Question: There are 3 latest pages displaying on my WP. Here's the code.
http://pastebin.com/nGn2AAfA
I want to put 3 specific pages that I want on the main index page. How do I tweak it?
Answer: If you are using a custom query you can specify page ids.  From the Codex;
<code>$query = new WP_Query( array( 'post_type' => 'page', 'post__in' => array( 2, 5, 12, 14, 20 ) ) );
</code>
To find your page ids you hover over the link for the each individual page in the Pages screen of the backend and you'll see the page id in the url
EDIT - OK, based on your comment you would change it to the following (let's say your page ids are 2, 5 and 12);
<code>    <?php $homepage_query = new WP_Query( array( 'post_type' => 'page', 'post__in' => array( 2, 5, 12 ) ) );
        while ($homepage_query->have_posts()) : $homepage_query->the_post(); ?>

            <div class="main_post">
                    etc etc
            </div>

    <?php endwhile; ?>
</code>


Could a planet much larger than earth have the same gravity if it were hollow?

Question: Now- this is probably a stupid question but hear me out.
If the planet I want to imagine were much larger than earth, would it have to have a massive difference in gravity?
It sounds extremely implausible to make it hollow (how would that happen naturally, etc.), but if the planet were packed with a large amount of dense, swirling air or gas, kept there by a sort of hard outer layer, would it change the gravity?
I know it couldn't be possible in the real universe, but with the inventions of a few new, extra hard minerals and the like to make it more plausible, I'd like to know the effects of a hollow planet.
(Afterthought: If some dense gasses gathered themselves naturally, could they slowly pull rocks and minerals from space and form a cover? Take into account this would be in a fictional world)
Comment: If you invented new minerals then that would be magic, and magic doesn't require any explanation, right?
Answer: Trivially, Yes
If you imagine some sort of supermaterial like the stuff of which Larry Niven's Ringworld is made, formed into a hollow sphere under however much crust you want, then you could spread all the Earth's mass (and then some, because of the increased radius) over this shell.
(I specify the supermaterial because there is no known material that would let you put a rocky shell on the scale of a planet over a void, and no gas that would allow the same effect.  If you have a planetary mass of gas, the core is solid, and if there were enough gas to gather solids, the solids would fall to the core, not form a shell.  So we'd have to assume that this planet was manufactured, maybe by the Magratheans.)
So if we assume the mass of the supermaterial to be negligible, and the faux-crust to be, say, 10km thick and of similar composition to Earth's crust ($2.6 g/cm^3$), then we could make a sphere of Earth's mass ($5.972 × 10^24 kg$) with a radius of 135 202km.
At that size, of course, surface gravity would be substantially lower than Earth's, so you could definitely go bigger; I suspect integration would get you the exact size at which you could get 1g.
Answer: Theoretically yes, since the strength of the gravitation field of any object is determined by its mass not its shape. The shape of the object will effect the shape of the field however. For example a cylinder with Earths mass would not have a uniform 1 G gravitation field but that's not the issue in this case since your planet is still roughly spherical.
If you want your world to have a earth like outer surface environment and temperature  however there would be issues with structural integrity, magnetic field strength & thermal equilibrium since there would be no (natural) way to maintain an Earth like mantle or core which is needed to maintain the Earths magnetic field, surface temperature & plate tectonics etc.
Basically to have the same gravity all the mass contained inside the Earths inner crust would have to be either (pasted) on to the inner surface or you have some kind of 'air gap.' between the inner and outer crusts of the Earth,
There would also be a upper limit on how big the circumference of your world could be before the gravitational field at any one point on the surface started to decrease  notably due to the distance separating it from the rest of the earths mass. (I have no grasp of the maths involved in working out the numbers involved above BTW.)
Frame check: It might be simpler to hypothesize some kind of 'Clarketech' level artificial construct (like a Dyson Sphere but on a smaller scale). Basically an artificial station that has been built to emulate Earth like conditions on its outer surface  with complex machinery inside dealing with issues like magnetic fields and heat distribution etc.
Comment: There's no upper limit on circumference as you suggest. Mathematically, the gravitational field of a hollow but spherical planet is indistinguishable from that of a solid planet at all points above the surface.
Comment: Would that apply to a hollow sphere whose shell had the thickness/density that equaled the Earth's diameter though? Assuming a relatively 'small' hollow core would not polar opposite points on the sphere be affected by additional gravitational forces generated by the mass of the opposing side?
Comment: No, it's a relatively straightforward application of integral calculus to show that it makes no difference. All that matters is the mass and the radius, assuming that the density everywhere is the same at the same depth.
Answer: The technical definition of a planet requires it to be large enough to compact itself into a relatively spherical form by its own gravity. If it's hollow, it thus obviously violates that definition, at least in terms of naturally occurring bodies. As for the artificial creation of such a hollow "planet" (here, meaning something that at least externally looks like a planet and would be generally called one by the less-scientific), you run into some issues.
Your idea of filling the centre with gases instead of minerals sounds nice in theory, but in reality it doesn't work on a planetary scale. The reason is simple: gravity. As overall mass goes up and gravitational pull increases, pressure on the centre materials (the gases, in this case) will increase due to the weight of everything above them. By the time you get near Earth's gravitational pull, that force will be easily sufficient to compress the gases to the point where they're no longer gases but liquid or solid, decreasing their volume. That reduction will create a relative vacuum (or at least lower pressure zones) under the crust, which under that strain will buckle and fall in (this is the principle behind underwater torpedoes in naval combat, incidentally, as the momentary vacuum caused by their explosion driving away the water can cause battleships to literally snap under their own weight no matter how much armour they have), being drawn towards the core. You get a vicious loop at this point, as the collapsing crust will then apply still more pressure to the core, compacting it further, and so on and so on until your planet is no longer hollow.
If you're willing to handwave some details, you could stipulate an arbitrarily tough crust that will somehow not buckle under planetary stresses for your fictional world; I don't think there is a material sturdy enough for the task in reality, but I'm not a materials scientist. This, however, runs into other complications. A crust that unbreakable won't permit normal planetary processes because the material from the mantle won't be able to reach the surface. You're going to miss out on any sort of plate tectonics, for instance, since this crust layer will be impossible to move: no earthquakes or volcanoes. I'm not an expert on geology, but I don't doubt there would be other likely-catastrophic consequences over longer periods.
Frankly, your goal is impossible without a completely artificial construction on a scale beyond sanity. Your best bet, as far as I can see, is to imagine building an outer shell around an ordinary planet (of whatever desired radius); Earth's gravitational field at the level of the ISS is around 90% of its strength at ground level, so you could start with a slightly larger planet than Earth and work from there. Fill the gap between your shell and the actual planet with whatever gases you desire: I doubt it matters much what you use, as long as you have suitable mass/volume. I have no idea what you'd make the shell out of to withstand the stresses on it, as noted before, so you'd have to handwave that. Give it a good push to set up its initial rotation and install mechanisms underneath to maintain that rotation in the face of friction from the gases below (note that literally attaching the outer shell to the planet would likely rip apart the planet or the shell due to inevitable differences in applied forces). If you want a realistic planetary surface for your outer shell, you're going to have to convincingly fake a planet's mantle between your shell and whatever its outer surface is, so that shell is likely to be dozens of kilometres thick due to the need for such secondary mechanisms. EDIT: I knew there was a term for these sorts of constructs. Look into Dyson Spheres if you want to do further research, as you'd pretty much be building one of those around a planet rather than a star.
Conclusion: this is a classical case of pleasant theory foundering on the harsh rocks of science and realism. You could technically get an Earth-like gravity on a much larger object if it were hollow, simply by picturing Saturn or Jupiter with an Earth-like crust layer above the gases. In practice, though, there is no outer shell that could possibly withstand the stresses involved of such a crust layer without breaking apart and being absorbed into the planet.
Comment: I'm not convinced by _"By the time you get near Earth's gravitational pull, that force will be easily sufficient to compress the gases to the point where they're no longer gases but liquid or solid, decreasing their volume"_. I recall being taught in high school physics that the gravitational force acting on an object inside a uniform spherical shell is always zero. Of course, there's no such thing as a perfect sphere, and then there's other objects in the universe also exerting a pull, so perhaps you're still right!
Comment: @Auspex The gravitational force is pulling everything towards the centre. Technically, yes, gravity at the centre is zero, but when you draw everything towards the centre, whatever is on the upper layers will compress everything closer to the centre. Pressure (and temperature) rises, and rapidly, as you go closer to the Earth's core; at any given point within the Earth, everything between there and the surface is pressing down on that point. This is why the Earth has a solid core, even though at several thousand degrees Celsius it would be pure gas if under normal pressure.
Comment: No, _anywhere_ within the sphere, if you sum all the force vectors it comes to zero. btw, the physics teacher who taught this was named "Moon" :)
Comment: The earth has a solid core because there _isn't_ a shell around the coalescing matter.
Comment: @Auspex In the sphere, you only get net-zero force vectors if you include the normal force, unless I'm mistaken. That's the force that keeps gravity from pulling people straight through the earth: it's the resistance of the ground, and if the downward force is great enough, it will break through the surface. In a hollow-Earth scenario, gases simply cannot offer sufficient resistance to balance the force of gravity, and the outer shell will then buckle under the strain; picture a house being dropped on a balloon, perhaps, for an idea of the relative forces and strengths involved.


How do I get nohup.out flushed more often?

Question: On Ubuntu 10.04, I have a long Python program that prints a bunch of output; I run this under "nohup". However, it waits until the end to put all the text in nohup.out. When I run similar programs under FreeBSD, each line gets sent to nohup.out. Is there a Ubuntu setting I can set to get the output faster?
Answer: Yeh, this is got to do with the way stdout is buffered by default on Linux. You need to explicitly run setbuf() in the code to override this behavior.
My suggestion is to avoid nohup, if you're using the bash shell, it allows you to disassociate the command from your shell
$ ( my_cmd > ~/output.log 2>&1 & )

You can also use disown for a similar effect on a currently running job.
Comment: Why would you recommend avoiding nohup?
Comment: I think because putting setbuf() in every Python script that might be nohup'd is silly.
Comment: This works, though I'm still getting buffering. That could be because of the program (server) i'm running though-- have to look into buffering it may be doing.
Answer: Since your program is python, you can run it with python -u. Alternatively you might find the unbuffer program useful.


What is zip (functional programming?)

Question: I recently saw some Clojure or Scala (sorry I'm not familiar with them) and they did zip on a list or something like that. What is zip and where did it come from ?
Answer: Zip is when you take two input sequences, and produce an output sequence in which every two elements from input sequences at the same position are combined using some function. An example in Haskell:
Input:
zipWith (+) [1, 2, 3] [4, 5, 6]

Output:
[5, 7, 9]

The above is a more generic definition; sometimes, zip specifically refers to combining elements as tuples. E.g. in Haskell again:
Input:
zip [1, 2, 3] [4, 5, 6]

Output:
[(1, 4), (2, 5), (3, 6)]

And the more generic version is called "zip with". You may consider "zip" as a special case of "zipWith":
zip xs ys = zipWith (\x y -> (xs, ys)) xs ys

Comment: The zip function using zipWith is both ugly and wrong. Function passed to zipWith is it's first parameter ... and it is far nicer to write zip as zip = zipWith (,)
Comment: Well then, it's not really "not equivalent", it's just that Scala doesn't have `zipWith`. Obviously, you can do either - define `zip` in terms of `zipWith`, or define `zipWith` in terms of `zip` and `map`.
Comment: It's hard to say what he's using, I mean "I recently saw some Clojure or Scala" is not exactly definite :)
Comment: not equivalent in scala. In scala you would have to do a zip, then a map
Comment: if the user is using Scala, and you give them Haskell, i'm pretty sure it won't compile, right?  That is what I mean by equivalent.
Comment: I don't know Haskell but in Python and Lisp, zip can take many sequences, not just 2.
Comment: Note also that in Scheme, zip is just a special case of map (which works for multiple input lists)
(map * (list 1 2 3) (list 4 5 6)) => (list 4 10 18)
Answer: zip is a common functional programming method like map or fold. You will find these functions in early lisps all the way up to ruby and python. They are designed to perform common batch operations on lists.
In this particular case, zip takes two lists and creates a new list of tuples from those lists.
for example, lets say you had a list with (1,2,3) and another with ("one","two","three")
If you zip them together, you will get List((1,"one"), (2,"two"), (3,"three"))
or from the scala command line, you would get:
scala> List(1,2,3).zip(List("one","two","three"))
res2: List[(Int, java.lang.String)] = List((1,one), (2,two), (3,three))

When I first saw it in Python, without knowing functional programming, I thought it was related to the compression format. After I learned more about functional programming, I've used it more and more.
Comment: Usually when do you use zip method, or in other words, what is the typical use case for zip in real projects?
Answer: Unfortunatley I don't have enough points to even leave a comment on the top answer, but
zip xs ys = zipWith xs ys (\x y -> (xs, ys))

is wrong, it should be:
zip xs ys = zipWith (\x y -> (x,y)) xs ys

or simply:
zip = zipWith (\x y -> (x,y))

Answer: You could use the following code in Python:

>>> a = [1,2]
>>> b = [3,4]
>>> zip(a,b)
[(1,3),(2,4)]

Answer: Pavel's answer pretty much describes it. I'll just provide an F# example:
let x = [1;2]
let y = ["hello"; "world"]
let z = Seq.zip x y

The value of z will be a sequence containing tuples of items in the same position from the two sequences:
[(1, "hello"); (2, "world")]

What is zip (functional programming?)


I accidentally closed the Raspberry Pi Setup Tool

Question: I accidentally clicked "Cancel" in the Raspberry Pi setup tool that runs on the first boot. How do I get it back? If I can't, which settings do I have to change to make the Raspberry Pi run as it is all setup? (ex. fix display not filling monitor)
Comment: Open an lxterminal and run `piwiz`.
Answer: As I understand it, the tool you accidentally cancelled is known as piwiz.desktop (also known as the "First-run Wizard"), and it is located here: /etc/xdg/autostart/piwiz.desktop.
You might first want to check to see if it's still there, and re-start it if you can.
Another alternative is to re-flash your SD card using rpi-imager. Follow these instructions, use the "Advanced Options", and select the "Skip first-run wizard" option. That should give you a system that boots as you want - without using the piwiz.desktop app.
You will of course need another operational RPi system to install and run rpi-imager. If you don't have one, and my first suggestion wasn't available (can't restart piwiz.desktop), you may need to start over with a freshly-flashed SD card using the tool you used to flash your card the first time.
Hope that's clear; I've only just learned of this craziness.
Comment: I wish the Raspberry Pi Foundation would at least write an article or add something to their documentation mentioning this, I wonder how many people made this mistake.
Answer: It should still be there, but not autorun.
Try running /usr/bin/piwiz in the Run Menu.
It doesn't really do anything that can't be done with raspi-config
Answer: I haven't tested it, but I remember that you can find the setup wizard on the desktop under the installed applications. Check the menu under "System", "Settings" or similar.


Can a strand not be synthesised in 5' -> 3' direction?

Question: I've been solving some biology questions, and according to one of them ( I have the responses too) the following phrase is false:
"Both strands are always synthesised in the 5' to 3' direction."
How can this be? From what I know DNA is always read from 3' to 5', and synthesised from 5' to 3'.
When is DNA not synthesized from 5' to 3'?
Comment: I have looked trough the book you have recommended me, and it still did not give me the response I needed.  According to this book "At a replication fork, both strands are synthesized in a 5′ → 3′ direction.". Which I agree with, my question was why according to my book, it says that it is false that strands are always synthesized like that. Unless, it was referring to the direction of growth, in which case the lagging strand grows in the 3' to 5' direction, but it doesn't because my book uses the word "synthesized" not "grow". This is where my confusion comes from.
Comment: Am I right in thinking your concern is as follows? All known DNA polymerases add NTPs to the 3'-OH of the deoxy-ribose so that the direction of synthesis is 5′ → 3. In most organisms the two strands grow in both directions by a complex mechanism at the replication fork involving RNA primers and Okazaki fragments etc. However small circular genomes use a different mechanism — the rolling circle mechanism (described in Wikipedia etc.) — in which growth is just in a single direction. If so, and you still have a question about this, could you clarify what your question is.
Comment: What do you mean "how can that be?"?  That's the way it is. Deoxy-ribose is not symmetrical. Enzymes have substrate specificity. And plasmids have no bearing on the matter. Search for Berg on NCBI Bookshelf, and read the section on DNA synthesis. Pay careful attention to the chemistry.
Answer: It sounds like your guess was right and the exception is the lagging strand. The statement is phrased poorly, but it seems like they were going for the lagging strand. Either they meant for you to think that
-the lagging strand is growing 3' to 5'
or, more likely,
-the polymerase is only synthesizing on one (leading) strand at a time
While technically the book was correct, it was a trick question and phrased unfairly.
You are completely right that DNA is synthesized from 5' to 3'. I don't know of any exceptions to this, but hesitate to say anything overly definitive because there are so many rare exceptions in science. I can say with some confidence that DNA polymerase cannot ever synthesize in the 3' -> 5' direction. If you haven't already, I highly recommend checking out the Khan Academy article, Molecular mechanism of DNA replication! Nature Education also has a pretty good article on the topic, Major Molecular Events of DNA Replication.
Comment: I don't even think the book was technically correct. It's odd to say that DNA synthesis occurs 3' to 5' even if you are referring to lagging strand growth.
Comment: I agree completely, I was trying to cover all the bases since it's so unclear what the book was going for. I edited my answer so hopefully it's a little more clear though!
Comment: text books are rarely written by relevant scientists, the person who wrote the question probably did not understand it.


Will space-based energy beamed to earth increase heat on earth?

Question: A Japanese paper on beaming energy from solar installation on the moon to earth via laser and microwave recently made the rounds in the media. Would this, or any space-based energy system cause a net increase of atmospheric temperatures?  To this layperson, it would seem like any such plan would pump energy into the atmosphere that otherwise would not have been there.  Would this be a real concern, or would the "clean" nature of the source offset it?
Answer: Yes, since they put it on the Moon, it would increase the total energy or "heat" as you call it being deposited on Earth.  By a small amount.  17 toe is about $7\times 10^{20}\,\mathrm{J}$.  The total solar insolation on the Earth from the Sun in a year is about $5\times 10^{24}\,\mathrm{J}$.  So the (incredible) 400 km wide swath of solar collectors on the Moon would add 0.01% energy to Earth's input.
That does not necessarily mean that the average temperature of the Earth would be increased, depending on what other activities it offsets and how the added energy is dissipated.
Note that nuclear energy also adds to the solar insolation.
Comment: Of course every form of fossil fuel power generation also adds heat to the atmosphere. Before burning coal it's chilling out under the ground. Post mining and burning you have the same amount of matter, but at a lower energy state (CO2, ash etc). The chemical energy unleashed by burning mostly ends up as heat.
Answer: Yes. Any system beaming power from space to the earth will add heat to the earth.
Most current plans call for solar power satellites ("powersats") located in geostationary orbit, about 36,000 km up. The sunlight they intercept would have otherwise missed earth, so the energy they beam down would not otherwise have been part of earth's heat balance.
If you are evaluating electrical generation systems, then the question becomes one of scale and comparison with other energy systems, both of the heat delivered and also the overall effect on the environment. In spite of the heat they add, powersats compare very favorably with other power generation systems.
I'll have to veer into speculation and opinions about energy policy, but I can pull in some specific backing details if they are requested. Since no powersat systems have been tested, everything about them is speculation to some degree.
As noted earlier, JAXA's beamed power demonstration is projected to have an end-to-end efficiency of only 22%, but researchers hope to achieve 80% at each end eventually. So somewhere between 20% and 50% of the microwave energy reaching earth will not generate electrical power but instead will create waste heat, primarily at the rectenna. The atmosphere is very transparent to the microwave frequencies being used, so very little of the energy will be lost directly to the air as it traverses the atmosphere.
This compares favorably with most power generation concepts currently in use. Coal, natural gas, and nuclear plants all generate more waste heat than electricity. A good reference is this: http://www.mpoweruk.com/energy_efficiency.htm
More importantly, the fossil-fueled plants also release carbon dioxide, a greenhouse gas that causes earth's atmosphere to retain heat rather than radiating it back into space.
So in decreasing order of environmental damage, you have coal (roughly 50% waste heat, plus CO2 release), natural gas (roughly 60% waste heat but less CO2), Nuclear (roughly 60% waste heat but zero CO2), Space Solar Power (20% - 50% waste heat and zero CO2), Wind (no waste heat) and terrestrial solar (converts roughly 25% of incoming sunlight to electricity, not heat). Hydropower is its own special case because it does not generate waste heat or CO2 in the conventional sense but does cause serious environmental damage through other mechanisms.
Wind and terrestrial solar are great from a waste heat perspective but it will be impossible to meet our energy needs with just those in the coming decades. (That's digressing from your question and into energy policy. I can discuss further in comments or PM if you like.)
Summing up, a utility-scale powersat system would add less waste heat per megawatt-hour of electricity delivered to the grid than most current grid-scale generation systems and zero greenhouse gases. If we can overcome the engineering challenges and get the cost comparable to nuclear, then it would be the hands-down winner for "green" energy on large scales.
Solar Power Satellites "SPS" or "Powersats",  remains an active area of research and development. Check out Wikipedia https://en.wikipedia.org/wiki/Space-based_solar_power, recent work by JAXA http://spectrum.ieee.org/green-tech/solar/how-japan-plans-to-build-an-orbital-solar-farm, and many other sources.
The best configuration for a powersat system remains under evaluation and debate. Most proposed systems use microwaves to beam power from a powersat located in geostationary orbit. System proposals also exist which beam the power from a lower orbit, decreasing transmitter size and improving efficiency but with other system trade-offs.
Comment: Excellent, detailed, and informed answer.  I guess the thing I am driving at in my question is "Which would result in a greater net gain of average temperature on the planet?  Unlocking rocks' energy (coal and nuclear) and releasing 50-60% into the atmosphere or beaming energy that would otherwise miss us down and releasing 20-50% of it into the atmosphere?

Obviously tricky to answer given the unknowns.  One big unknown I think would be "will it _really_ offset terrestrial generation or would _both_ continue"?  Hard to answer, but thanks for the details!
Answer: In principle, where is that 'heat' coming from?
Any solar area that collects energy intercepts photons, which excite electrons, which get converted to microwaves to be beamed to earth.  Incidental molecules that get excited by the beam vibrate and generate heat.
Each step along the way has efficiency losses.
All those photons would probably have hit earth anyway.  Instead, heat is being radiated at each stage, in high orbit, before a small portion of the energy is lost as heat in the atmosphere.
So I would say, not even worth worrying about.
Comment: Those photons hitting the Moon would not have hit Earth anyway.
Comment: I did not see the moon reference, in the question.  I guess it was in the link.
Comment: Um, read the question again.
Comment: Mark, well gee I should have read more carefully then.  :)


Sideshow Bob on Simpson's Tapped Out

Question: On the Simpson's tapped out, what is the point of sideshow Bob showing up all the time? Is it just for money and experience finding him? Also, is there a specific condition that needs to be met to see him?
Answer: He increases your Righteousness rating when you apprehend him. As far as I know this is the only way to do that, aside from cleaning up your friends' vandalism to your town, if you want to go into the "lol social gamez" side of things.
I'm pretty sure his appearances are just random to the tune of once every 1-2 weeks.
Comment: This past week, I actually saw him 1-2 times per day! Truly random I guess

Sideshow Bob on Simpson's Tapped Out


How do you explain variation in ledger close times?

Question: The average ledger close time is 5.3 seconds. https://dashboard.stellar.org/ A lot of the time, the close time is identical to the previous 5 or 6 closes. But then you see a close time that is faster, or a close time that takes 10 seconds or more.  What is the cause of the "sooner than I expected" close time and the "wow, that was a lot longer than expected" close time. I can't be the number of transactions since there are WAY to many examples of close times that are IDENTICAL (or appear to be identical from the graph). The reason I ask the question is for DEX trades.... I want to place my DEX trade RIGHT at ledger close time so I can incorporate the information gleaned from viewing transactions that are about to be processed but not yet posted.
Comment: I have a same problem and I set a valid NTP server for all of nodes. But it was not resolved. Maybe it depends on version of core. My network protocol version is 13.1.0 and should be update as soon as possible.
Answer: Given the nature of distributed systems, we aim for 5 seconds, but in reality a wide degree of items can come up that add random variability to the close time.
Essentially all nodes are supposed to reach consensus every 5 seconds - that's a hardcoded time that is subject to change. However, a few things might come up:

Even though every server uses NTP for keeping their clock in sync with UTC, there are occasionally times where nodes are out of sync just slightly and they cause weird overlaps when it comes to consensus. often increasing the time of a closure by a few seconds, or causing another consensus to complete right after another one.
When network congestion happens occasionally the "leader" node isn't able to respond with the closure time or their vote within the timeframe - at this point, the network chooses a new leader to establish the close time, and this timeout can add a few seconds to the network close.

There are likely a few other cases as well, but the essential nature of the system is that it's inherently unpredictable - you're likely better aiming for the intended time (5 seconds; which we're always working towards maintaining as close to as possible) and working around the edge case of a long or short ledger close.


Handling uninstall of Record Type components in a managed package

Question: When uninstalling a managed package the process fails with the message:

Unable to uninstall package
Component Type: Record Type
Problem: This installed component is referenced by a locally created component. (link to a particular record)

This makes sense, I need to remove the Record Type from local records that are currently using it before uninstalling it.
Can I do this with an apex uninstall script or does it need to be done manually by an admin before attempting the uninstall?
To remove references to the record type manually I mark it as inactive in the admin UI. This may require the additional steps, such as removing the record type as the default from any profiles that are using it.
I can set the RecordTypeId via apex, but I'm not sure what to change it to. I can't see the master record type as a valid value to assign and there may be no other record types for the sObjectType.
Another more drastic approach is to delete all the records that reference that RecordType (and then empty the recycle bin). This is fine for things like Product2 where in my case the records are only applicable to the managed package, but not so great when dealing with Accounts and Contacts.
Comment: I wouldn't recommend the deletion approach - unless you can hard delete them...since if you go over the 5000 limit, they go into a nether world where you can't see them in the recycle bin but they aren't actually considered deleted, so you still have to wait for SF to fully delete them before the reference is considered deleted (which can take 24-48 hours)

An another approach is to just create a new RecordType directly in the instance, move all the records from your packaged record type to that new 'local' record type, and then you can remove the package.
Comment: @BritishBoyinDC Calling `Database.emptyRecycleBin(deletedProducts);` immediately after deleting a list of products helps with the first issue. But you are right, as the number of records increases an uninstall script will run into limit issues.
Answer: SAFE HARBOR: best to double check if this works on a Sandbox, before executing this on your production data. I have just written this here without explicitly testing
What you will have to do is change your profile settings to include the --master-- record type in order to "see" it, you will also have to do this for every profile on your org, to make sure your Record Type isn't being used by other profiles, else you won't be able to delete the record type

Go to Your Name -> Setup
Administration Setup -> Manage Users -> Profiles
Select your profile, and go to Record Type Settings
Choose your SObject (Product2) -> Edit
In order to include --Master--, you will have to remove the other Record Types
Save
Repeat for every profile in your org

Side note:
I don't think it is actually necessary to move records to another recordtype with code, try going to your SObject -> Record Types -> Select your record type -> Deactivate -> And now try deleting it, you should get the option to move all the records with that recordtype to another.
If you would need to do it with code, this is probably the easiest way.
Now you have multiple things you can do, but either way you must update all your SObjects (Product2) with that recordtype in your database and put the RecordTypeId on (blank), you can do this via the dataloader, by first exporting, then clearing all the values in RecordTypeId, and doing an update.
But I find the easiest way to achieve this is by Apex, more precisely executing Anonymous Apex via the Eclipse IDE

Start Eclipse
Add your project
Next look for the View Execute Anonymous, it can be somewhere on your screen but if you can't find it go for: Window -> Show View -> Execute Anonymous

Make sure you select the correct Project when executing.
Execute the following code:

<code>List products = new List([SELECT Id, RecordTypeId FROM Product2 WHERE RecordTypeId != NULL]);
for(Product2 p : products)
{
  p.RecordTypeId = NULL;
}
update products;
</code>

Now you'll need to deactivate your recordtype, and then delete it
Comment: Thanks. I tried something very much like your code sample to set the Product2 RecordTypeIds to null and it didn't work for me. The RecordType values remained unchanged. I'll have another go when I'm back in the office to see if I missed something.
Comment: I just had to do this myself, I don't think you actually need to do any code executing, just remove the record type from the profiles, deactive it, and then delete. It just worked for me (one thing: I am not absolutely sure there was data with that record type, so you might still need to do the clearing)


ubuntu: profile.d and .bash_profile missing

Question: I have done some reading up on Linux startup, etc and I noticed that in my home directory it is not present a folder profile.d:

/home/user/profile.d/       # Doesn't exists

and nor a file .bash_profile:

/home/user/.bash_profile    # Doesn't exists

is there a reason for this?
Ubuntu 15.04, gnome
Answer: Short answer: it is ok so.
There are many initialization user files because an user can decide to log in a computer account in many different way, from console, with an interactive or a non interactive shell, with different kind of shells. It is not a prerogative of all the users, but with the need to keep a backward compatibility it finished to complicate a little the things. :-)

A directory profile.d should not to be under your home directory:
/etc/profile.d contains scripts with application-specific startup files, which are also executed at startup time by the shell.
It is a directory valid for all the users, for this it is created under the /etc/ path and not under each single user home directory.

The file ~/.bash_profile is one of the personal initialization files and when it exists is stored in each user home. But it is not needed that it exists. It should contain the bash-specific commands to be run when starting a login shell (~/.profile can be read from different shells too, that usually understand a syntax different from the bash one).

Reading more from the INVOCATION section of man bash

When  bash  is  invoked  as an interactive login shell (...) it first reads and executes commands from the file /etc/profile, if that file exists.
After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and
executes commands from the first one that exists and is readable.

So if you have a ~/.bash_profile file it will not be read the ~/.profile, if not called (or sourced) in one of the other files.
Note that

When  an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist.

From some version of Ubuntu 12 (and for sure from 13.10) in the .profile is sourced the ~/.bashrc.

This can cause unexpected behavior when running login shells (such as when ssh into the machine for example) where the user would not expect to have ~/.bashrc sourced.

Reference:

In the Bash (not so) Beginner Guide, the section about the Shell initialization files
Why does Ubuntu's default ~/.profile source ~/.bashrc?


Gas filled my engine

Question: I'm a little puzzled on my 33 I have a 302 ( stroker 363 )) Dart block with brodex heads with a small blower. after blowing up my power glide I pulled the engine and just now reinstalled it. after checking all I turned the key the fuel pump came on but kept running I steped out of the car to hear the bubbling sounds of my carb filling up and filling up my engine. I turned the power off and now will wait for the evap and drain. what could it be ?
Comment: Welcome to Motor Vehicle Maintenance & Repair! Sounds like you've got a float stuck in the carb. Not sure if your pump is pressure regulated. If it is and the float is stuck, it'll just keep filling the bowl(s) until you turn the key off.
Comment: Is there a fuel return on your carbs?  Have you connected the fuel feed to the fuel return by mistake?
Comment: Yes I do have a return thanks for asking   all fixed as it was the carb, I took it apart 3 times and finally saw the float level was set to high.
Answer: Check your carb.  Bad floats.  Bad float adjustment.  Bad needle and seat.
If we are talking Holley 4bbl - look down the throttle bores and see if your see the leak.  That will narrow down if its front or rear fuel bowl.
On other carbs, if the fuel bowl itself leaks, it can drip straight into motor.
Check your fuel pressure - 4psi at idle/no load.  On some race applications where the needle and seat are not large enough, you can boost fuel pressure under WOT to say 6-8psi.
Old motors with mechanical fuel pumps sometimes failed the pump and would fill the engine with gas.
Gas in oil is of course death to the bearings in the motor.

Gas filled my engine