Difference between convergence and idempotence in Chef

Question: What is the basic difference between convergence and idempotence in Chef?
Answer: Convergence and idempotence are not Chef-specific. They're generally attributed to configuration management theory, though have use in other fields, notably mathematics.
Let's start with the more basic, idempotent. We're going to ignore the mathematic use of idempotent, and focus instead on what configuration management people mean when they talk about it. That is: "multiple applications of the same action do not have side effects on the system state." A simple example of an idempotent operation is mkdir -p:
mkdir -p /var/lib/statedir/myapp

No matter how many times we run this command, it will result in that tree being created. Another way of stating this about idempotent operations is, "running the tool over and over doesn't change the system after the first time."
Now to contrast that with convergence. Generically, to converge means to bring [people or] things together. In configuration management, convergence means to bring the system state in line with a defined policy. That is, changes are made on the system only if they need to be made. A simple example of a convergent operation is:
if [ ! -d /var/lib/statedir/myapp ]; then
  mkdir -p /var/lib/statedir/myapp
fi

This is convergent because we're only executing the mkdir command if the desired directory does not exist. We also call this a "test and repair" operation. That is, we test the current state of the specific thing we're managing, and then repair it with a specific command or operation if it is not in that state. That is what Chef does behind the scenes with a resource like this:
directory '/var/lib/statedir/myapp' do
  recursive true
end

The way we (Chef) talk about this is that Chef takes idempotent actions to converge the system to the state declared by the various resources. Every resource in Chef is declarative, and performs a test about the current state of the resource, and then repairs the system to match that.
To get deeper into the weeds about how Chef works, it has a "compile" phase and a "converge" phase in a Chef run. In the "compile" phase, it evaluates the Ruby recipes on the node, and it is looking for resource objects that it adds to a "resource collection." Once it has evaluated all the recipes, it then enters the "converge" phase where it iterates over the resource collection, taking the appropriate action to put the resources into the desired state, whereby users are created, files are written, packages are installed, and so forth.
Comment: -1. I don't find this to be a particularly clear explanation; it makes idempotence and convergence sound like they are basically the same thing, since you the commands you use as examples of the two concepts are semantically identical. An example of an idempotent-but-not-convergent command (or a convergent-but-not-idempotent command, if such a thing even makes sense) would add clarity.
Comment: That was a really great explanation!! I was aware of convergence concept in chef but not idempotence. Thanks for articulation. :)
Answer: Definitions
To say that an operation is convergent roughly means that it puts whatever part of the system it manages into a specified state.
When configuration management people say that an operation is idempotent, they typically mean that if you run it a second time right after running it once, the second run will terminate immediately without doing any redundant work.
When a resource is described as idempotent in the context of Chef in particular, it means that subsequent Chef runs after the resource has already been put into the desired state don't count it as "updated" in the x/y resources updated message at the end of the run.
Note that most built-in resources satisfy this final, strictest definition of idempotence by default, and you can achieve it in your own recipes and custom resources by using only_if and not_if guards and converge_if_changed.
Some commentary, and a note about other definitions
Confusingly, the majority of definitions of "idempotent" you find on the internet will not match either of the ones I've just given. Rather than trusting what the experts say the definition is, I'm inferring it from observing how they actually use the term. It is infuriatingly common to find somebody give a definition of "idempotent" and then use the word in a way that clearly doesn't cohere with that definition a few paragraphs later.
To explore this, let's start by exploring definitions of "idempotent" that exist outside of the field of configuration management. Lots of such definitions are listed on Wikipedia at https://en.wikipedia.org/wiki/Idempotence. The ones that most frequently get (wrongly) given as the meaning of idempotence in a configuration management context are as follows:

In mathematics, a function f is said to be idempotent if f(f(x)) = f(x) for all possible values of x.
In mathematics, a whole slew of other sorts of mathematical objects are said to be idempotent if they meet some formal definition or other (generally with a common theme of "doing an operation repeatedly has the same effect as doing it once").
In programming, to say that a function or procedure is idempotent means one of two things:

In the case of a function that takes an argument and returns a value, exactly the same as the mathematical meaning.
In the case of a function that has side effects, that, after calling the function once, subsequent calls leave the system state unchanged.

A slew of confused sources give one of these definitions as the meaning of "idempotent" in a configuration management context, and then promptly go on to use the term in a way that makes clear that it's not really the definition they're using. Some examples:

Pace's competing answer to this very question. There he claims that:

A step is idempotent if, after multiple executions of the step on a system (whose underlying state has not changed), the result is the same as if the step had been executed once.

but then goes on to give this as an example of a step that isn't idempotent:
  rm -rf /var/log/myapp
  mkdir -p /var/log/myapp

Clearly this step does in fact meet Pace's definition of idempotence, since running it multiple times in a row gets us to the same final state as running it once (namely, a state where /var/log/myapp exists and is empty). However, it does redundant work when run a second time, and so Pace describes it as non-idempotent.

Mischa Taylor and Seth Vargo's book Learning Chef: A Guide to Configuration Management and Automation. In there, they claim:

When Chef code is idempotent, it can run multiple times on the same system and the results will always be identical, without producing unintended side effects.

but then later, commenting on one of their example recipes:

Does our recipe pass the idempotency test? Sadly, no. ... Chef mistakenly thinks there's still stuff it needs to do—2/3 resources updated in this second run. If the recipe were truly idempotent, we'd see 0/3 resources updated. Chef would inspect the state of the system, recognize that nothing had changed since the last run—no one touched the node between the two runs—and perform no resource updates

Again, they're stating a definition of idempotence based upon the system state being unchanged when a recipe is run multiple times, but actually using the word to mean that unnecessary work is avoided.

Ben Ford's Idempotence: not just a big and scary word on the Puppet blog, where he first gives this definition of idempotence...

Idempotence is simply a word that describes an operation that will have the same effect whether you run it once or 10,001 times. Adding one is not idempotent because the result keeps incrementing, but multiplying by one is idempotent because the answer is the same no matter how many times you multiply it!

Then he gives this example of idempotence, which, while it is consistent with the definition given above, is a little suspicious - because it focuses on subsequent executions not doing redundant work, rather than on them reaching the same result:

Imagine a time when you were 12 and your mom asked you to take out the trash. Being the good kid you were, you dropped the GameBoy and jumped right up to do as you were asked, yeah?
But then 30 minutes later when she walked back through the living room and saw you curled up on the couch playing "Super Mario Land," she told you again to take out the trash. I strongly suspect that you did not leap up to go take out an empty trash bag. Instead you said, "Already did it, Mom!" That's idempotence. The effect of being told once to take the trash out is the same as the effect of being told twice. You didn't do it again, because it had already been done.

Then finally he throws his definition to the wind and gives an example of an operation that he claims is not idempotent despite the fact that repeated executions of it will reach the same result:

So how about that time you were chastised for writing non-idempotent execs? People new to Puppet generally have shell scripts they're replacing, and they write code that looks sort of like this:
exec { '/usr/bin/curl http: //server.net/packages/package.tar.gz -o /tmp/package.tar.gz ': }

-> exec { 'tar -xf /tmp/package.tar.gz -C /tmp/package': }

-> exec { '/tmp/package/installer.sh': }

file { '/tmp/package':
    ensure  => absent,
    force   => true,
    require => Exec[ '/tmp/package/installer.sh'],
}

file { '/tmp/package.tar.gz':
    ensure  => absent,
    force   => true,
    require => Exec[ '/tmp/package/installer.sh'],
}

So what's wrong with that? It works, right? Download the tarball, extract it, install the thing, then clean up after yourself. It looks like it should run perfectly, assuming no typos or network issues. And it will. But it will run perfectly every time Puppet runs. In other words, it will download and run the installer script every thirty minutes!

But the result will be the same, Ben! Earlier, that's the detail that you told us the definition of idempotence revolved around!
Clearly, Ben is really applying the "avoid redundant work" definition of idempotence, despite what he claims.

Can an operation be idempotent but not convergent?
Yes. Such an operation would be one that doesn't bring the system to a specified end state, but does avoid redundant work on consecutive runs. Pace's answer gives an example of such an operation, and Thinking Like A Chef provides another:

A system can be idempotent without being convergent. For example if we had the pseudo code if file X does not exist, write the current timestamp to file X that would be idempotent, but it can't really be said to converge on a particular end state.

The best practical example I can think of of an operation that you could characterise as idempotent-but-not-convergent would be installing a package using a typical package manager's install command that:

installs the latest version if the package is not installed, but
doesn't update an older version if it's already installed.

The state (the version of the package you get) is not determined by the recipe, so it's arguably not convergent, but it successfully avoids unnecessary work.
Can an operation be convergent but not idempotent?
Yes, absolutely! A simple example is Ben Ford's one, already quoted above, of unconditionally downloading a file to some local path. It's convergent, because the end state is always the same (the file exists), but is not idempotent, because it does the unnecessary work of redownloading the file each time it runs.

For what it's worth, I find it frustrating that the configuration management community have appropriated a term that already had a clear meaning in the broader world of programming and then used it in a related but still clearly different way, without ever providing a formal definition of what it means in their world. A search of the Chef docs (https://www.google.co.uk/search?q=site%3Ahttps%3A%2F%2Fdocs.chef.io+idempotent) yields many uses of the term, but no definition. It's not surprising that this topic confuses people when most of the definitions of the term floating around don't match the usage.
I've only managed to find one person who has ever given definitions of idempotence that are consistent with the way the term is used, and that's coderanger (aka Noah Kantrowitz). In Thinking Like A Chef, which I quoted from previously, he writes:

"idempotently" ... means that the actor does as little as possible to achieve the desired state.

and in an IRC conversation from 2015 he writes:

Idempotent means not taking actions when they aren't needed, convergent means it "settles" on a specific final state.

Other than this one man, I have literally not been able to find anyone else who has ever given a definition of the term that matches how the whole configuration management community seems to use it.
Comment: What a great answer! Precisely dissects how the word "idempotent" is used to mean something a little different in practice in configuration management, despite people saying the same words to define "idempotent". This answer also made it immediately clear to me why they need the word "convergent" - because once "idempotent" ends up meaning "does not report changes / does not redo work", that makes "idempotent" useless for saying "results in the same end state", and suddenly you have to find another word that means the same thing.
Comment: My first taste of this was when someone told me my Ansible playbook was not idempotent, and I thought "what!? it messes up the desired state upon reruns!? well that's a serious bug that I need to fix!" - turned out they just meant that some of the steps reported "changed" instead of "unchanged". (To be fair, still a bug, just a superficial one - reporting changes when the resulting state is unchanged is misleading, and users have to be able to trust that the reported result does not indicate changed state unless state actually changed in a way that matters.)
Comment: Love how you think! We require database upgrade scripts to be idempotent (i.e. re-runnable, allow divergence); convergence (i.e. re/calculate desired state) is not required. idempotent="Has the 4.2 price markup script been run on this database?" convergent="Do the prices reflect the new markup that introduced in release 4.2?" The two are independent but can be combined to get to a desired state. combined=Don't run the price script more than once if the goal is to *initialize* the data to "4.2" state. convergent=>Run many times if the goal is to enforce pricing policy no matter what version.
Answer: @Mark Amery asked for a more satisfying example of the difference between the two so I will endeavor to provide that.
A step is convergent if, at the successful conclusion of the step, the system has been brought into a known state.
A step is idempotent if, after multiple executions of the step on a system (whose underlying state has not changed), the result is the same as if the step had been executed once.
Convergence without idempotence
A step that is convergent but not idempotent is:
rm -rf /var/log/myapp
mkdir -p /var/log/myapp

At the successful conclusion of the step we know for a fact that /var/log/myapp is an empty directory that exists.
It is not idempotent because it blows away the /var/log/myapp directory each time.  Idempotence is desirable because it reduces unnecessary churn on the system.  Obviously any applications writing to the /var/log/myapp directory would not be happy with the above step.
Idempotence without convergence
A step that is idempotent but not convergent is:
test "$(ls -A /home/foo 2>/dev/null)" || tempfile -d /home/foo

That script will create a file with a random name in /home/foo only if there are no files in /home/foo.  This is idempotent, after the first run the directory will not be empty so future runs will do nothing.
However, it is not convergent.  You could not say this step is putting the system into any kind of known state because the file that gets created will have a random name.
Convergence is desired because it helps to produce systems that are in identical states and thus be more likely to behave predictably.
A word of caution
These terms are like abstractions, they are not exact and they can leak.  For example, you could state that an operation isn't idempotent because it uses up CPU cycles.  You could state that one idempotent test-and-repair operation that does an expensive test is "less idempotent" than another operation that does a cheap test even though "less idempotent" is not a factual thing.
You could try and state that a step that installs MySQL version X is not convergent because, when run on different machines, it leaves a different timestamp on the files.  Alternatively you could say the step I posted above IS convergent because it leaves the system in the state "/home/foo exists and contains exactly one file".
This is what happens when math escapes the chalkboard.
Comment: I'm with @barny; your supposed example of "Convergence without idempotence" in fact perfectly satisfies your own definition of idempotence, making that chunk of the answer self-contradictory. The example of Idemopotence without convergence makes sense and is enlightening, though!
Comment: But, but... your definition of idempotence doesn't include "avoid unnecessary work" (which your example of Convergence without Idempotence asserts as an important aspect of idempotence). I think convergence is about applying idempotence across multiple facets of a specification until no further changes need be made. It's like trying to compare one rotation of a wheel (idempotence) with a journey by car (convergence). And your phrase "thus behave more reliably" might be better stated as "thus be more likely to behave more predictably". Good try :-)
Comment: I'm afraid I'll have to disagree.  Eliminating extra work is often a benefit of idempotent but I don't believe it is an essential requirement.  My example talked about reducing unnecessary churn and by that I meant reducing unnecessary changes because these could risk conflict or error.

I also disagree that idempotence is needed to define convergence.  I think the two are often complementary but I feel my definition is more accurate.

I agree with you on the phrasing.  I will clean that up.  You are welcome to submit your own answer regarding the other two points.
Comment: Hmm, I guess my thought with that example was that, any time you execute that operation, you risk crashing any application using `/var/log/myapp`.  In other words, the operation has a side effect which makes it non-idempotent.
Comment: @Pace But if an application has launched and put content into `/var/log/myapp` between the two runs, that would mean that the "underlying state" of the system has changed, no? Which means, per your definition, that crashing the application is not a violation of idempotence.
Comment: By the way, I've written an answer of my own after a whole load of confused research, and criticised your "Convergence without idempotence" example in the course of it; I thought I'd flag it up so that you have the chance to comment/downvote/upvote as you see fit.


"Did you see the match?" or "Have you seen the match?"

Question: When I was chatting with a friend he asked me "Did you see the match?"
I know this's completely right, but, it came to my mind was that wrong to say "Have you seen the match?" instead.
Answer: 'Did you see the match?' would be more common in American English, and 'Have you seen the match?' more common in British English. Both are right.

Speakers of American English generally use the present perfect tense
  (have/has + past participle) far less than speakers of British
  English. In spoken American English, it is very common to use the
  simple past tense as an alternative in situations where the present
  perfect would usually have been used in British English.

One Stop English
Answer: Because the match is over and you can't watch it anymore, it is simple past. The match is an event - you wouldn't say "have you gone to the match" so you don't say "have you watched the match"
Comment: Can you explain more than this please?
Comment: You can use the present perfect tense to talk about actions which were completed in the past, but which have an effect in the present. The time of the action is before now but not specified, and we are often more interested in the result than in the action itself. Have you (now) seen the match (in the past)? This is standard English, but is much more likely in British than American English.
Comment: So "did" is much better. is that the same to the following sentences
1- Have you eaten your breakfast?
2- Did you eat your breakfast?
Comment: "Did you see" is not "much better" than "have you seen". They are regional variations. One is more common in US and the other in British English.
Answer: Either wording can be correct, depending on context. With regards to a "match", usually some kind of sporting event, "did" is more likely to be appropriate.
In particular, "did you see the match?" should be used when there is only one time that someone would be likely to see the match. For example, a live event like a sport match is typically watched at the time it happens, and if you are wondering whether somebody watched a recent match (such as "yesterday's match") then you are most likely expecting that they watched it live, or not at all.
On the other hand, "have you seen the match?" implies that there are many opportunities to see it, and a common response might be "not yet" because the opportunities will continue in the future. For example, a recently released movie will have multiple show times in many theaters every day, and thus "have you seen the movie?" is much more likely. When talking about a sport match, "have you seen" would be reasonable if you are it's a famous match that someone would make an effort to find a recording rather than just the most recent one.


is buddypress out of wordpress family?

Question: they removed buddypress category from their showcase, lead developer Andy Peatling is not there, and there are some sad articles on buddypress but nothing specific. Do you know what the status is?
Answer: BuddyPress is still closely related to WordPress and continues to work with the platform.  Removing certain references merely helps distinguish between the two systems.
Answer: Maybe your not finding the BP resources your looking for because they are in the process of renovation... as well BP has never really been that well documented. ALTHOUGH the BuddyPress crew is the process of BETA testing (version 3)... and is pretty close to launching to the world. Make no mistake BP 1.5 is going to influence Open Source Development and get alot of attention... can you tell I'm on the band wagon? I wrote on article on the good parts about BP 1.5: http://www.simondelasalle.com/articles/buddypress-1-5-the-best-parts/

is buddypress out of wordpress family?


Using Magic Keyboard + Mouse with 2 MacBook Pros (MacOS Catalina)

Question: I have two MacBook Pros running MacOS Catalina. On my desk, I have an external monitor and a Magic Keyboard & Mouse. I'd like to easily switch the keyboard & mouse between the two laptops when I connect them to the external display. Right now, I have to re-pair the keyboard and mouse everytime I want to switch. Is there a way to automatically have the keyboard/mouse pair to whichever computer is awake and running?
Comment: This can be done with applescript, first detect when the computer wakes up and then connect to bluetooth device. You'll find examples for both here and in superuser.
Another solution would be using third party like barrier(on GitHub) that will allow you to share a mouse and a keyboard between your MacBooks, this means that the mouse and keyboard will always be connected to one macbook (for barrier, they need to be on the same network)
Answer: Update: I found AirBuddy (https://v2.airbuddy.app/) which has this exact functionality.
Comment: Please add some details which show *how* the application helps to solve the problem.


Inner Product Definition

Question: I've searched for the inner product definition and I saw that it should only satisfy some conditions (axioms) and thus there could be several operations representing an inner product, one of which is the usual multiplication, or the dot product.
the question is: why is the inner product of 2 functions is defined by $\int f_1(x)f_2(x)dx$? their choice of the operation is based on what? there could be other operations satisfying the inner product conditions so why this ?
Comment: On a related question how do you do the inner product < > in LaTeX?
Comment: \langle blah blah \rangle
Comment: @IttayWeiss cheers.
Comment: @AlecTeal You should have asked your question on tex.stackexchange.com, or at the very least in a separate question. Asking questions within the comments of a different (and quite unrelated) question isn't good style - it makes your question and its answers very hard to find for others.
Comment: @fgp It was a tiny question and asking "how do I do [something related to post]" in comments here is how I learnt.
Answer: In the vector space $V$ of real valued functions $f\colon \mathbb R \to \mathbb R$ (some variations are possible, but the gist remains the same) the standard inner product is defined as you describe. It is the standard inner product, not the only inner product. The reason is that it is a natural generalization of the standard inner product on $\mathbb R^n$, which itself is a natural generalization of the standard inner product on $\mathbb R^2$, namely $(x_1,x_2)\cdot (y_1,y_2)=x_1y_1+x_2y_2$. So, the question boils down to why is that considered the standard inner product. This is where geometry comes in. The Law of Cosines is a generalization of Pythagoras theorem relating lengths and angles between vectors. In more detail, in a triangle of side lengths $a,b,c$, one has $c^2=a^2+b^2-2ab\cos(\gamma)$ where $\gamma$ is the angle opposite $c$.
Now, using Pythagors to define the length of a vector in $\mathbb R^2$ as usual, and then pluging things into the law of cosines yields, after some canceling, a relationship between the sum of the products of the components of the vectors, their lengths, and the cosine of the angle in what is precisely the Cauchy-Schwarz inequality. This motivates the definition of the standard inner product.
Comment: thanks, but u mean that the inner product of 2 functions is a generalization of the usual inner product for n-dimensional vectors as a function can be thought of as a vector with infinite dimensions?
this means that $F_1(x).F_2(X)=\sum f_{1i}f_{2i}, and \int F_1(x)F_2(x)dx=\sum f_{1i}(x)f_{2i}(x) \Delta x$, there's a delta x missing
Comment: yeah, but where's the $\Delta$ x? I thought of this before and this is what I reached, how is the product denoted by the integral when the summation doesn't have a "dx" to turn it to an integral?
Comment: in a nutshell, yes.
Answer: The history of inner product began with a problem of being given a function $f$ and trying to determine constants $a_{n}$, $b_{n}$ such that
$$
        f(x) = a_{0}+a_{1}\cos(x)+b_{1}\sin(x)+a_{2}\cos(2x)+a_{3}\sin(2x)+\cdots,
               \;\;\;\; 0 \le x \le 2\pi.
$$
This came up in solving for vibrations of a string where the initial displacement of the string was $y=f(x)$. Amazingly, Euler and Clairaut discovered around 1775 that if you multiplied by one of the functions $\{ 1,\cos(x),\sin(x),\cos(2x),\sin(2x),\cdots\}$ and integrated over $[0,2\pi]$, all of the integrals on the right would be $0$ except for the one involving the function you multiplied by. This gave a way to isolate the coefficients $a_{n}$ and $b_{n}$. This trick was further exploited by Fourier in solving his Heat Equation using separation of variables. Fourier discovered orthogonality conditions for all kinds of equations.
Weighted integral expressions naturally arose in the work of Fourier:
$$
                          \int_{a}^{b}f(x)g(x)w(x)\,dx.
$$
In the 1830's, general Fourier problems with eigenvalue parameter $\lambda$, coefficient $p > 0$, and positive weight function $w$ were being studied by Sturm, Liouville and others:
$$
                   -\frac{d}{dx}\left(p\frac{df}{dx}\right)+qf = \lambda wf,\\
                          \cos\alpha f(a)+\sin\alpha f'(a) = 0,\\
                          \cos\beta f(b)+\sin\beta f'(b) = 0.
$$
It was found that there was an infinite sequence of real characteristic values
$$
                        \lambda_{0} < \lambda_{1} < \lambda_{2} < \cdots
$$
for which corresponding non-trivial solutions $\{ f_{n}\}$ would exist. And one would automatically have
$$
                           \int_{a}^{b}f_{n}(x)f_{m}(x)w(x)dx = 0,\;\;\; n\ne m.
$$
That allowed people to study generalized Fourier expansions in the eigenfunctions $\{ f_{n}\}_{n=0}^{\infty}$. This was an active area of research starting in the 1820's, especially the problem of when the corresponding Fourier expansions would converge to the original function.
So, many types integral "orthogonality" conditions were being studied in the first decades of the 19th century. Cauchy had proved what is now called the Cauchy-Schwarz inequality for Euclidean space in the 1830's, but, for some reason, no connection was made with the analogous integral expressions. It wasn't until the 1880's, in a paper of Schwarz, that a general so-called Cauchy-Schwarz inequality came into use for integrals, and that the paved the way for looking at general inner products in the early 20th century. The full abstraction of dealing with functions as points in a space, with orthogonality and distance, appears to be have been due to Hilbert in the first decade of the twentieth century. So, what started as a convenient type of integral 'orthogonality' condition for isolating coefficients in a generalized Fourier series eventually gave rise to general inner product spaces--the full abstraction took more than a century.
The particular choice of inner product has to do with the types of orthogonal expansions that you want to do.
Comment: Great info--do you have a reference for more on the history you have described?
Comment: @user45664 : J. Dieudonne *History of Functional Analysis*. https://www.amazon.com/History-Functional-Analysis-North-Holland-Mathematics/dp/0444861483/ref=sr_1_2?ie=UTF8&qid=1468013293&sr=8-2&keywords=J.+Dieudonne

Inner Product Definition


Is it true that todays crude oil is getting more 'dirty'?

Question: I heard that crude oil, which is used to make other products like gasoline, is getting contaminated more and more by atoms like nitrogen and metals, so that the catalysts have more difficulty making it clear for gasoline. If so what causes these contaminations?
Comment: It's not like it becomes more contaminated. It's like 'sweet' light and nice oils are not available in sufficient qualities and market demands deeper refinement, including heavy fractions, that were dumped in the past. The graphs of oil demand (readily available in the internetz) show steady growth for many years, and economical shocks are only a minor setback.
Comment: The other significant point is that modern cars have a catalytic converter to control emissions. The fuel has to be produced in such a way that it won't poison the  catalytic converter.
Answer: We've already extracted most of the easy-to-get, easy-to-use, relatively pure, oil, and are now digging up oil from other sources, like the tar sands of Alberta, which contain a lot more contaminants than most other sources we've drawn from in the past.
Comment: >We've already extracted most of the easy-to-get, easy-to-use, relatively pure, oil,  || I request a proof on this. As far as I'm aware, that's not true. There is a plenty of light oils on the market, (WTI, Brent); and arabian oil that is offered in plenties, is still very easy to process.  The offering is by no mean sufficient (and tails are gathered from many sources) but it is still significant, and there is no need to move to tar sands yet. (Afaik, tar sands are calculated to be profitable to use at oil prices on sweet oils above $80-120/barrel) .


Splitting lines that are not contiguous (Creating a leak detection dataset)

Question: I am having trouble with one of the steps of a very long model. The goal is to generate a dataset of the water lines that have been "inspected" by our leak detection devices.  The devices supposedly will "inspect" all pipe that is 500 feet from the detector, as long as it is connected within that 500 foot buffer.  See attached image.  The green star represents a leak detection device.  The resulting inspected pipe will be all pipe within the circle (500 foot buffer) except the ones highlighted in yellow because they connect outside of that 500 foot buffer.  I have tried many ways to achieve this in a model (I need to run this weekly for 3000 miles of pipe), but cannot find an automated way of doing this.  My plan was to merge the pipe that is inside the buffer, then remove the sections that are not contiguous with the portion that intersects with the leak detection point, but I have not found a way to do that.
Anyone have any thoughts on this?
Comment: What software, modeling environment, and/or programming language should possible solutions include?
Comment: What particular software, modeling environment, and/or programming language are you wanting to ask about in this question?
Answer: This is ArcGIS terminology but any GIS should have these tools.
Create the leak device buffer polygon, 500 ft Clip Water lines by the    device Buffer Dissolve Water lines, multipart Buffer Water lines, 1    foot Convert Water line Buffers Multipart-to-Singlepart  Select-by-Location Singlepart Buffers that Intersect device point Reverse  Selection Set of Singlepart Buffers Select-by-Location original Water    lines that Intersect Singlepart Buffers The unconnected lines should    now be selected
Comment: Yes, this did it.  I was missing the Convert Water line Buffers Multipart-to-Singlepart section. THANKS!!
Comment: One more question, if you don't mind.  I have written most of the models and all is working great until the step where I select the singlepart buffers that intersect with device point. The issue is that there are many device points.  How would you go about selecting the buffers that intersect with only the device point that is the centroid of the buffer?
Comment: If you create a Layer of just Devices, you might use "Iterate Feature Selection" to loop through a device at a time. Most tools will honor a Selected Set, these must be a Feature Layer of course.
Comment: I tried that, but the problem is that I need to iterate through both the devices and the singlepart buffers.  I tried creating three separate models to achieve that - iterate through devices, iterate through singlepart buffers, drag both of those outputs into new model and use those outputs for the selection, but the Select Layer By Location tool will not accept the output of a feature class iterator as the Input Feature Layer.


Can a virus attack my BIOS to disable the DVD drive?

Question: A friend's laptop DVD drive is suddenly no longer detected. It's going to be difficult to walk him through going into the BIOS (he's not local). I wonder if it is even worthwhile i.e. whether the BIOS settings can be corrupted by a virus. Are BIOS settings formatted in a standard way such that a virus writer would know what to alter? FYI, he did reinstall the OS and the drive is still not detected.
Comment: Please clarify: what OS? He did reinstall the OS using that DVD drive and it's not working from installed OS?
Comment: Why would a virus want to do that?
Answer: There are virusses that can flash your BIOS, but it's very much unlikely that a virus tampered with your BIOS to disable the DVD drive. On top of that, every BIOS is different, so a virus should know how to flash the specific type. A hardware issue is much more likely. It's probably a malfunctioning DVD drive or motherboard.
But I wonder, how did your friend reinstall the OS without a disk drive? If he installed the OS through that drive, it's probably a driver issue.
Answer: well...

viruses can flash your BIOS rending it unusable, but it is highly unlikely that it will temper with settings in your BIOS by changing the CMOS RAM configuration since the arrangement is different for different boards.
it is more likely that the DVD drive is broken rather than a uber-strange computer virus disabled it
Answer:
yes there is such a thing as a bios virus
stick a windows or linux live dvd in the drive and if you can boot from it, then the drive is not broken and the problem is probably down to the driver being absent as opposed to the bios having a virus in it


Confusion about し+なさい ("do + do"?)

Question: I've just been thinking that if verb + なさい constructions are a combination of verb stem + なさる's 命令形, how on earth is something like しなさい possible. they both mean "do", don't they ("do do!) perhaps I'm completely over-thinking this. Is there a reason as to why なさい can't be used its own?
Comment: Like so many other cases where the J-learner gets confused about a grammar point, the problem stems from "over-translating" rather than "over-thinking".  You need a verb in front of なさい and that verb happens to be する.  You just use the 連用形 of する, which is し as you would with any other verbs.
Answer: The suffix なさい does not function like the verb なさる ("to do").
Syntactically:

the suffix なさい attaches to the 連用形 of verbs
the verb なさる behaves essentially exactly like する: it is either is on its own, or attaches to the root of any suru-verb.

Semantically:

the suffix なさい makes the verb into an imperative and provides no honorification (it almost provides the opposite by indicating the addressee is in a position lower than the speaker)
the verb なさる means "to do" and provides subject honorification.

So to me, the なさい in しなさい is unrelated to "to do", it simply converts する into an imperative. (If you don't buy that a form of なさる can perform as a purely grammatical element, consider what function the "do" in "I do not know" is performing.)
Regarding the construction 漢語名詞+なさい (e.g., 結婚なさい), it is productive, and according to @TokyoNagoyaさん, it seems to have a different, slightly softer connotation than the 〜しなさい construction. I am not sure where exactly it falls on politeness spectrum of the various different imperatives (〜しろ、〜して、〜してくれ、〜してください、〜しなさい、〜なさい, etc.).
Comment: What is wrong with 結婚なさい?  Soft-spoken, older people would actually say it in real life.  It actually sounds very nice to the native ear.
Comment: That's A good point actually, the "do" I "I do not know" is virtually meaningless, I can't place a meaning on it even as a native speaker.

Thanks for answering my question.
Comment: It's called "do-support" if you want to look up more about the construction in English. It's not a parallel to what's going on here, but does provide some comfort that "do" can perform grammatical roles unrelated to its original verb semantics.
Comment: @TokyoNagoya I see, I was not aware of that, thanks. I will update my answer accordingly. Do you agree that it is a less common form?
Answer: Personally I'd avoid trying to do some deep grammatical analysis of this. Perhaps someone else can chime in on the historical and etymological aspects.
We simply say やめなさい or おすわりなさい. It was one of the first grammatical forms I learned after getting married to a Japanese woman. :-) These can be viewed as informal variants of やめてください or すわってください or おすわりください. It's simply the grammatical rule that the なさい is preceded by the 体言止め form such as やめ or すわり, which in the case of する is し. So yes, it's お掃除しなさい, for example.

Confusion about し＋なさい ("do + do"?)


Resize Photoshop windows that extend offscreen?

Question: After using Photoshop with an external display and having the "Layers" and other windows extended the full height of the display, when I unplug the external display, the bottom of those windows go offscreen, so I can't see the bottom of them, and can't get at the resize control in the bottom right of the window.  How can I resize them?

(Click image to enlarge)
Answer: Going to Window->Workspace->Reset Essentials worked.
Answer: The previous answer didn't really do it for me as the bottom of the Photoshop window was the problem and was still out of reach after reset essentials. What finally worked was moving the whole workspace down so I could get at the top edge with the cursor and get a vertical resize cursor to display so that I could shrink the workspace from the top (never knew I could do that!). After making it shorter, I then dragged the Photoshop window back up to the top of the computer screen and the lower right corner was again available.


why accuracy on training dataset is 100% using random forest caret , does it indicate overfitting?

Question: I tried to predict on training set but i got accuracy of 100%. However on the testset, i got an accuracy of 62%. Should i be worried of getting high accuacies on training dataset using caret?
why accuracy on training dataset is 100% using random forest caret , does it indicate overfitting?
Answer: Yes, those accuracies dont say anything.
You have overfitted to 310 data points which is pretty easy using RF. The fact is that you said you "predicted" on training data. Well, when you learned on training data and you ask prediction for points you already gave the model it simply knows them.
You need to use a cross validation technique (here i propose Leave-One-Out technique as you dont have much data points). RF is more robust than DT towards overfitting, but that is not applied to this setting. Here you getting an exam in which you ask a question you already gave to the student. He just simply knows the answer.
Answer: In my opinion it does indicate overfitting in the given case. Commonly overfitting occurs when one gets very good accuracy (or other score) on a training set, and a lousy accuracy on a test set. Moreover tree-like models are very easy to overfit.
However not always getting 100% accuracy means that the model is overfitted. If the data does not contain noise or the chosen features allow for absolute separation of classes, then 100% accuracy does not indicate anything bad. However such situation should occur for a training and test set as well.
In the given case, I would suggest cross validation procedure, or using validation set if you have enough data points.


Transforming Seq[(A, Future[B])] into a Future[Map[A,B]] in Scala

Question: I'm looking for a clean way to transform a Seq[(A, Future[B])] into a Future[Map[A,B]]. Is there a good way to do this? Thanks in advance!
Answer: or
val s = Seq( ("1", f1), ("2", f2) )
Future.sequence( s.map { case (k ,v) => v.map(fv => (k ,fv)) } ).map(_.toMap)

Answer: If you're allowed scalaz then yes:
val original:Seq[(String,Future[Int])] = Seq("a" -> Future.successful(1))
val transformed:Future[Map[String,Int]] = original.toMap.sequenceU

Answer: You can transform Futures using map and flatMap. Using that, you can just start with an Future computing the empty map and the use flatMap and map to aggregate the other futures:
val s = Seq("A" -> Future {1}, "B" -> Future {2})
val m = s.foldLeft(Future.successful(Map[String,Int]())){
  case (result, (key, future)) => result.flatMap{
    map => future.map{
      value => map + (key -> value)
    }
  }
}

Answer: This is not hard. You need three steps:
 //1. create a list of future tuples
 val futureTuples = Future.map { case (a, futureB) => futureB.map ( a -> _ }
 //2. Transorm it to a future list
 val futureList = Future.sequence(futureTuples)
 //3. Finally, convert list to map:
 val futureMap = futureList.map { _.toMap }


S&P 500 Longevity and ETFs

Question: According to this forecast S&P 500 companies longevity (the time they exist in the index) will reduce from 24 years to just 12 by 2030 mostly due to tech disruptions.
For an S&P 500 ETF investor, does this mean bad/good news or this doesn't affect returns at all?
Answer: Well it's certainly nothing new. If you look at the chart on that page, longevity is actually higher now that it was in all of the 2000s. They are just predicting that turnover will increase over the next 10 years, though I haven't read the paper in detail to understand why they predict that.
I would also posit that turnover is a result of market performance, not a driver of it. If the market underperforms, some of the S&P is going to underperform and get removed, while some companies will survive (or even outperform) and enter the index.
Answer: My first thought is, "so what?"  You want to be in a cap weighted index of roughly the largest 500 companies in the US public markets, you got it.  So companies are entering and falling out of the index a bit more frequently, so what?
But then you have to question some data.  Taking a brief skim of your link you get bullet point 1:

The 33-year average tenure of companies on the S&P 500 in 1964 narrowed to 24 years by 2016 and is forecast to shrink to just 12 years by 2027 (Chart 1).

Ok.  Then you look at Chart 1 and:

Chart 1: Average Company Lifespan on S&P 500 Index, Years, rolling 7-year average

Why 7 years?  Why not just average?  What constitutes tenure?  If the 450th largest company is acquired by the 40th largest company does that end the tenure of the 450th?  Does this just encompass companies shrinking to the point of being replaced by a company that grew in to the top 500?  And either way, so what?  The goal is to be invested in the 500 largest companies, that's what you got.  Does this mean something to market volatility?  Maybe, but the passive index investor doesn't concern themselves with the nuts and bolts of the markets.
Maybe an index of the largest 250 companies would have less turnover?  Would that be better?
But ALWAYS question data that uses weird or arbitrary boundaries.  Why not use 5-year rolling average, why not 10?
Answer: Short answer: S&P 500 Index ETF returns will not be affected in the long run.
Here are the reasons:

S&P 500 index is balanced and spread across different industries, thus it is impossible for all the industries to perform badly the same time.
There are 500 companies inside the index, that means individual company stock only weight 1/500 or  0.2% of the whole index.
If all the S&P 500 index stocks perform badly, that will mean all the industries is perform badly, so it will not affect the index position.
Those inside S&P 500 are selected according to capital and various factor. And a company with huge capital usually will not be wiped out overnight. Even during a panic sells, there are value buyer able to salvage the remaining asset value to support it.
Due to the above reason, S&P 500 index ETF can always take time to track and balance the stock, i.e. sell-off those stock drop out of S&P 500 index, buy the newcomer.
the S&P 500 index ETF tracking practice will cause matthew effect to involved stock(the loser stock will fall further, the newly entry stock will go higher). Since each company only weight 0.2%, it hardly dents the ETF coffer.
Comment: Counterexamples: Microsoft and Apple are each at 4%+ of the index, not 0.2%. The plain S&P 500 index isn't equal weighted.
Comment: S&P 500 index is balanced and spread across different industries, thus it is impossible for all the industries to perform badly the same time?  Ummm, 2000?  2008?

S&P 500 Longevity and ETFs


Would Zero-Knowledge Proof (ZKP) Remove the Need for Quantum Key Distribution? (QKD)?

Question: Would zero-knowledge proof (ZKP) remove the need for quantum key distribution (QKD) since we no longer need keys to be passed around?
Comment: What is you own research?
Answer: I do not immediately see how Zero Knowledge Proof could be used for secure transmission of information, and thus compete with Quantum Key Distribution (when trivially complemented with the One Time Pad for confidentiality and a Carter-Wegman hash for integrity).
Much less do I see how traditional ZKP could work absent some unproved mathematical assumption (like the difficulty of the Discrete Logarithm problem), when avoiding such assumption is the only advantage of QKD. In order to compete with QKD on these grounds, we would need a Quantum Zero Knowledge Proof; that has been studied.
Also, QKD is next to not used, with people far frow craving for it, thus removing the non-existent need for QKD is moot.


Retracting an oath

Question: I made an oath to Allah, saying that I swear by Him to abstain from a particular thing for a certain period of time, I managed to for a few days but I have now realised that I cannot keep up for the remaining time, can I retract this oath and then it becomes rendered null and void?
Answer: you want to break your promise  and break your oath! You must atone for this quit. This is a penalty for the bad promise man who breaks his oath.
The prescribed punishment for breaking an oath is the release of a slave or the feeding of ten poor people or the covering of ten poor people and, if incapacitated, the fasting for three consecutive days.

Retracting an oath


Elite: Dangerous. Maximum number of players?

Question: Which is the maximum number of players, that can be in the game in the same time?
Answer: From what I have read Elite Dangerous will use different instances. And each instance can hold up to 32 players.
source

Remember that instances are basically a bubble around your ship that
  is defined by your scanner/visual range. Although the size is somewhat
  adaptable. This means that there can be players in one instance and
  another group of players in another instance some distance away. If
  one player from the first instance starts to travel towards the
  seconds instance the players in the first instance will eventually
  drop of his radar due to distance and the other players will
  eventually come into view. So if the system works as intended this
  will feel seamless from the players point of view.

source 2

And it will be heavily instance in that regard. There might be
  hundreds, if not thousands of players in your vicinity at any one time
  but you will only ever see 31 other human players plus AI pilots. This
  might change as FD make further improvements to the networking model.
Comment: Thank you for your response. Thats mean I can see maximum 31 other human players? But the total number of all the players online has no limit?
Comment: @MikroDel see edits:)
Answer: Everyone is connected to the same game world, there is no global limit.
There is however a limit how many you can see within your radar range (32 currently), which is limited because of the twitch based nature of the combat system.
Comment: Why someone gave him -1? And without any explanation?
Comment: If  you not agree with this answer - please explain why
Comment: where have you find the information about "twitch based nature of the combat system"?


Alter table and set default as current date

Question: while creating a table I forgot to add a date of birth column. Is there a way to add a NOT NULL column to a table with default value being current date?
Answer: You can use alter table. In MySQL 8.0:
alter table mytable
    add datetime_of_birth datetime
    not null
    default (current_date);

In earlier versions, you can't however, have a date column whose value defaults to current_date. This feature is supported for datetimes a and timestamps column only. If you can live with a datetime column, then:
alter table mytable
    add datetime_of_birth datetime
    not null
    default current_timestamp;

You can then ignore the time portion of the column when querying it. If that's not an acceptable solution, then you need to implement the logic with a trigger.
Answer: Use alter table:
alter table t add column date_of_birth date;

Comment: i need the column to not have null values
Answer: If your table has rows of data in it, you must either add the column as nullable, or else give it a DEFAULT that will be assigned on every row.
If you don't give a DEFAULT, then a NOT NULL column will attempt to add the "default default." A date's default is '0000-00-00' which is an invalid date, and it will be rejected if you have strict mode set (which I do recommend):
mysql> create table mytable (id int primary key );
Query OK, 0 rows affected (0.02 sec)

mysql> insert into mytable values (1);
Query OK, 1 row affected (0.01 sec)

mysql> alter table mytable add column date_of_birth date not null;
ERROR 1292 (22007): Incorrect date value: '0000-00-00' for column 'date_of_birth' at row 1

The DATETIME or TIMESTAMP data types can be given a default of CURRENT_TIMESTAMP:
mysql> alter table mytable add column date_of_birth datetime not null default current_timestamp;
Query OK, 0 rows affected (0.13 sec)
Records: 0  Duplicates: 0  Warnings: 0

But you said you wanted a column that is DATE, which doesn't allow this:
mysql> alter table mytable add column date_of_birth date not null default current_timestamp;
ERROR 1067 (42000): Invalid default value for 'date_of_birth'

In MySQL 8.0, you can use expressions as defaults (note the extra parentheses around the expression, which are required):
mysql> alter table mytable add column date_of_birth date not null default (curdate());
Query OK, 1 row affected (0.04 sec)
Records: 1  Duplicates: 0  Warnings: 0

If you're using an earlier version of MySQL, then you can't do this in one ALTER TABLE. You must first add the column as a nullable column, then use UPDATE to backfill values into all the existing rows, then ALTER TABLE again to modify the column to be NOT NULL.


How to wire up potentiometer to subwoofer?

Question: I have an audio-taper potentiometer that I bought from RadioShack and would like to hook it up in-line to my sub woofer so my 5.1 surround sound's bass is not so loud.  However, the connection from the sub to the main receiver is a proprietary plug on the back of receiver so I can't tell which is positive or negative.  Does this matter for hooking up a potentiometer?  Where can I find a wiring diagram?
Comment: You need to understand a lot more about this situation - it seems you have bought a normal potentiometer (albeit with "audio taper", probably just meaning "logarithmic resistance scale"), which is for small signals. Your subwoofer connection, however, is most likely a LARGE (power) signal. The two cannot just be hooked up.
Comment: Datasheet? Specifications? I give you benefit of the doubt, but I wouldn't be surprised if @JohnU is right that the part is intended voor small signal, not power output stage levels.
Comment: I just googled "radio shack audio taper potentiometer" and a load of standard pots came up, nothing that looked like it could dump multi-watts, and frankly if there is such a product it's dumber than the USB heated slippers my boss bought me for Christmas.
Answer: Some audio taper potentiometer that you bought at Radio Shack is unlikely to be useful the way you imagine unless this "subwoofer" is really a lot more than just a subwoofer.  The impedance of the signal that drives a speaker, like a subwoofer, is very low, well under 8 Ω assuming a 8 Ω speaker.  Pots for volume control are much higher impedance, and can't handle that kind of power level anyway.
If this "subwoofer" really isn't, and actually contains a amplifier, then the pot might do what you want.  You can tell this case several ways.  If there are only two wires going to this unit coming straight from a power amp, then the pot won't work.  For the pot to have any chance of doing what you want there has to be separate power, like a line cord, connected to this box.  In that case the signal could be "line level" and is amplified as needed by the speaker inside the box.
If you have the latter case, then it should be pretty easy to figure out which wires are what.  Turn on the unit and put your finger on each line.  When you touch the audio line, the hum picked up by your body should be amplified and audible in the speaker.  Touching the ground line won't have that effect, and might even make any slight hum coming from the speaker weaker.  Connect the ground wires as usual, but break the audio wire connection.  Connect one end of the pot to the common ground, the other end to the audio line coming from the preamp, and the wiper to the audio line going into the speaker box.
Can't you just turn down the bass at the preamp so all this isn't needed?
Comment: I think Radio Shack sold (and perhaps still does) some "volume control" assemblies that were designed to adjust the volume of 8-ohm speakers; it looked like the assemblies had some sort of transformer on them.  I would guess the idea was that if one wires a low-voltage side of a transformer in series with a speaker and the high-voltage side to a rheostat, one may usefully employ a higher-resistance rheostat than could be wired directly in series with a speaker, but I think that was designed for lower power levels than would be typical of today's subwoofers.
Answer: If it is colored then most of the time the balck one is ground and red is the hot one.
If not colored then go ahead and try. You have 50% for success for first try and 100% for the second :-)
Comment: Speaker wires are often differential drive, treating either as "ground" is a poor idea.
Comment: If I hook it up backwards, will it fry the stereo or damage it?
Comment: The real danger is in wrongly connecting the potentiometer and shorting out the amplifier output. Colors come in many kinds, my cables are white and green for example. Whether the output is differential or not is not an issue here. Anyway without a spec sheet for the part we know too little, but it is probably spec'd for small signal and not output driver levels.


How does the philosophy of 'Emergent Gravity' differ from that of 'Quantum Gravity'?

Question: How are the two approaches of understanding gravity, the so-called 'Emergent/entropic gravity' and 'Quantum gravity' (String theory, LQG etc) differ from each other? I am very curious and will appreciate if somebody can sketch a summary.
Comment: Gravity can be called "emergent" in the AdS/CFT correspondence (a non-perturbative formulation of string theory with particular asymptotic conditions), where an ordinary non-gravitational but strongly-coupled quantum field theory is allegedly *equivalent* to a higher-dimensional theory with gravity. So when you distinguish between "emergent" and "quantum" gravity, do you really mean to distinguish between "entropic" and all other approaches?
Comment: Yes, entropic and quantum. But I am afraid of the terms such as 'AdS/CFT correspondence' etc.
Answer: Quantum Gravity is the description of gravity according to the laws of quantum mechanics. It uses fundamental principles of quantum physics (like quantization for example) and applies it to gravity. Quantum gravity is needed in situations when you cannot just ignore quantum effects (even though you are talking about macroscopic objects). An example would be the quantum effects found near black holes and in the early moments of the universe, jus after the Big Bang. Quantum gravity is still an unsolved mysteries, but candidates include string theory and Loop Quantum Gravity, which tries to quantize spacetime itself. But both are yet to be experimentally verified.
Emergent / entropic gravity is a rather recent theory. Emergence means that you observe some phenomena in an object at a macroscopic scale, but don't observe it when you look at tiny parts of the object. According to this theory, gravity is an entropic force, i.e. it arises as any system's tendency to increase its entropy.
The difference between quantum gravity and emergent gravity is that quantum gravity tries to describe gravity as another fundamental force, which can be explained by the fundamental principles of quantum mechanics and quantum field theory. It also predicts that there should be another fundamental particle, the graviton which is the particle 'communicating' the force of gravity. But entropic gravity does away with the idea of gravity as a force entirely. According to entropic gravity, gravity is just an emergent phenomenon (it is observed for large, macroscopic objects, but not for microscopic constituents of the large object). This theory actually comes from a consideration of the Holographic principle.
So the difference in philosophies between the two theories is: Quantum Gravity tries to describe gravity as a fundamental force (like electromagnetic, strong and weak forces), while Emergent/entropic gravity does not consider gravity a force but rather an phenomena observed in macroscopic objects due to the statistical behaviour at microscopic scales.
More details on both the theories can be found here and here.


WPA2 Enterprise TTLS PAP connection for iPad

Question: I can't connect to my university's enterprise wireless using my iPad. It uses WPA2 Enterprise with TTLS and PAP. When I enter my username and password it asks me to accept a certificate which is not verified, when I click accept it tells me that the username or password is incorrect (though they are correct). What should I do to fix this?
Comment: With WPA2 Enterprise we had problems if we didn't use full usernames: *firstname.lastname@example.com* instead of just *username*
Answer: Okay so I figured it out myself. Apple provides a configuration utility for configuring WiFi and some other settings.
For Windows - http://support.apple.com/kb/DL1466
For Mac - http://support.apple.com/kb/DL1465
I created a configuration profile using it and entered the WiFi settings there -
Security Type - WPA/WPA2 Enterprise
Protocols
EAP Types - TTLS
Inner Identity - PAP
Authentication
Username - yourusername
Password - yourpassword
I then emailed this configuration profile to myself and opened it from my iPad and it worked.
Answer: @Vlad is correct. Alternatively, it may require you to use this format for the username:
domain\username


Energy of central potential in QM

Question: A hydrogen atom (Coulomb potential) has energy that only depends on $n$ (if we ignore other effects like spin-orbit coupling). In general (not necessarily Coulomb, can be any V), does $E$ depend on both $\ell$ and $n$ (since the radial equation has both $n$ and $\ell$)? What about $m$? Since $m$ doesn't appear in the radial equation, does it mean that energy does not depend on $m$?
Comment: At higher order the energy does depend on m and manifests itself as fine-structure (the spin-orbit coupling term anyway), and at even higher order in the hyperfine structure.
Comment: Related: http://physics.stackexchange.com/q/116244/2451
Comment: But there is m because we use perturbation theory to 'add' those higher order effects, right? I wanna ask given a potential $V(r,\phi,\theta)$ in general, what does the energy depend by just solving the Schrodinger Equation (and ignore other higher effects that may appear in reality)?
Answer: The wave function of the hydrogen atom $\psi(r,\theta,\phi)$ is a product of the radial part, the angular part and azimuthal term
$$
\psi_{n,\ell,m}(r,\theta,\phi) = R(r)\Theta(\theta)\Phi(\phi).
$$
The radial part $R(r)$ obeys Laguerre polynomials or,
$$
R_{n\ell}(r) = Ae^{-\rho/2}\rho^\ell L^{2\ell+1}_{n-\ell-1},~ \rho = \frac{2r}{na_0},
$$
and $A$ is a complicated constant, The angular part $\Theta(\theta)$ is given by spherical harmonics $Y^\ell_m(\theta,\phi)$ and the azimuthal is $\Phi(\phi) = e^{im\phi}$, where $m$ is the projection of the angular momentum on the $z$ axis.
Answer: The  energy levels of the bound-states of a hydrogen atom only depend on the radial quantum number  n .
This is a special property of a  (1/r) type of  interaction potential .
For a general central potential, V (r ) the quantized energy levels of a bound-state  can  depend on both  n and l values.
The property  that the energy levels of a hydrogen atom only depend on  n , and not on l  and m, points to the feature  that    the energy spectrum of a hydrogen atom is highly degenerate.
By degeneracy of a state we mean that   there are many different states  of the system which possess the same   energy eigen value.
For a given value of  l , there are   (2l+1)  different allowed values of  m  (i.e.,-l , -l+1 , ...0  1 ,2, (l-1) ,+l ).
Likewise, for a given value of  n, there are n  different allowed values   of l (i.e. 0 , 1, 2, ,(n-1)).
Now, all states possessing the same value of  n  have the same energy (i.e., they are degenerate )
The total number of degenerate states for  a given value of  n comes out to be   n^2.
The above degeneracy  gets lifted if the interaction potential has such terms which can give rise to splitting of the degenerate states.
A common example is placing the atom in a magnetic field which splits the different m -states. or spin-orbit interaction term in the potential .

Energy of central potential in QM


Should indexes folder in data folder be removed every now and then?

Question: We had some issue with Lucene not indexing properly. Usually with the removal of the indexes folder within data folder and rebuilding the indexes through Control Panel's Indexing Manager helps; however, do people generally remove the indexes folder and rebuild indexes manually? What will be the best practice to help regulate performance of Lucene and indexing.
https://codebuildplay.wordpress.com/2014/04/08/lucene-merge-thread-error-unhandles-exception-detected-the-asp-net-worker-process-will-be-terminated/
Answer: From what I remember if you perform a full index rebuild from the Control Panel, index files will be removed. You don't need to do this manually.
And yes, sometimes indexes may become corrupted for multiple reason. Like network connectivity issues or application restart. Rebuilding the whole index may be the easiest option in some cases.
Comment: The full re-index does remove the data files for the previous index. Given this I would also suggest looking into the SwitchOnRebuildLuceneIndex provider, which will allow you to keep your preiouos index while the next one is generated (though that feature is of less utility when the existing index is corrupt).


OpenGL texture loading issue in Android device

Question: We are creating a cube on which we are loading textures. It is working fine in the emulator and in an HTC Desire device but in another device (LG Optimus,HTC Desire) the textures are not being loaded. Let us know if any one has solved this issue.
Answer: I'll bet my hat that it's the texture dimensions. The emulator for some reason supports (and some of the examples use) odd dimensions like 192 x 192 which certain hardware will not support. Try a texture with dimensions that are a power of 2 like 128 x 128, or 256 x 256 etc.
Answer: The issue seems to be with the size of texture and also the resolution. Might be the underlying hardware doesn't support the dimensions for the texture you are using.


Do I need to pay Estimated Taxes on Qualified dividend income if I fall in the 0% Long-Term Capital Gains tax bracket?

Question: Basically I make ~$21000 in income from work, and $1000 in dividends. So, being below $40k in income, I technically owe 0% on the qualified dividend income, but I'm not sure if I pay the IRS and get a refund for the full amount paid, or hold on to everything and just report it.
Answer: Unless you want to give the IRS an interest-free loan, hold on to everything, and file accordingly.
If your situation doesn't change significantly later in the year, you will not owe taxes, so you are fine.
Comment: Ok. I was just worried they wanted to hold the money until I filed end of year taxes. TY.


Sheva Berachot at third meal

Question: If sheva brachot occur at a seudah shlishit which finishes after sunset, is one allowed to drink the wine even though it is prior to making havdala?  If yes, who specifically would be allowed to drink it?  E.g. what about someone who was not the leader or one of the newlyweds, but just wants some for a segula?
Answer: Sh'miras Shabas K'hilchasah 59:17 reads as follows. The translation is my own and slightly free, and you should not rely on it; in any event, as always, CYLOR with any practical questions.

S'uda sh'lishis that they set up for a bridegroom within the week of sheva b'rachos, which extends until sunset or thereafter: So long as tzes hakochavim has not arrived, they say the b'rachos on two cups as usual, one for birkas hamazon and the other for sheva b'rachos.
And even if the meal ended only after tzes hakochavim, the custom is to say sheva b'rachos and to drink from the cup of birkas hamazon and [from the cup] of sheva b'rachos: it's permissible for the bride and bridegroom and all those present to drink from these cups. But some have the custom to say birkas hamazon and sheva b'rachos on two cups as usual but not to say the b'racha "hagafen" on either cup, and to leave the cups until after maariv and then to say havdala on the birkas hamazon cup, and then to taste from the sheva b'rachos cup as usual, namely that they mix the two cups and give it to the bridegroom, bride, and all those present.

He notes in footnote 65 that Rabbi Moshe Feinstein is quoted by Rabbi Efrayim Greenblatt as having said that the bride and bridegroom should drink from the cups but no one else. [The way the SSK quotes him, it sounds like he means this for the latter case (that s'uda sh'lishis extends past tzes hakochavim), but I haven't checked the RE.]
See also footnote 66.
(That's it for the SSK, but note that I seem to recall hearing from Rabbi Yisrael Reisman (Brooklyn, New York) the idea that the bridegroom lead birkas hamazon and drink immediately afterward. I don't recall whether that was his advice or something he had seen or what: I merely recall his mentioning the idea. It would seem to fit in with the discussion above: according to Rav Moshe, apparently, the leader of birkas hamazon shouldn't drink unless he's the bridegroom, whereas according to some others the leader can drink anyway, so this removes some doubt as to what to do.)
Answer: Regarding drinking the wine after reciting Birkat HaMazon over a cup of wine at Seudah Shelishit if it's already past sunset, some Ashkenazim are stringent not to. However, assuming Shabbat is not the final day of Sheva Berachot, then the Tzitz Eliezer (vol. 10 Siman 45) argues that even Ashkenazim who usually refrain from drinking may do so in the context of Sheva Berachot.
Rav Moshe Shternbuch cites how Rav Yitzchak Ze'ev Soloveitchik would not either, and testified that his father, Rav Chaim Soloveitchik was also stringent, but his grandfather, Rav Refael Shapiro was not (Teshuvot veHanhagot vol. 1 Siman 749).
At the same time, Rav Moshe Feinstein highly discourages anyone but the Chattan and Kallah from drinking in such a situation (Iggerot Moshe, Orach Chaim vol. 4 Siman 69), as does Rav Mordechai Willig. See also Emmet LeYaakov (Kamenetsky, Siman 62 fn 29).

Sheva Berachot at third meal


Can you create an implant that detects a person's thoughts and feelings?

Question: Is it possible to put, on a mentally ill person, a surveillance implant that detects said person's emotions and thoughts? This 'chip', 'implant' or other monitoring machine should be able to monitor movement, emotion, and thought.
Answer: Possibly. Your call when you build a setting.
In theory, the action of nerve cells is electrical and chemical, and could be tracked by a fine net of sensors in the brain. There are plenty of science fiction stories using that, making the mind-machine interface a familiar trope that can be used with little need for explanation or justification.
On the other hand, it is sufficiently not-there-yet that you can easily not have it in your setting if you don't want to. Simply says that it is too hard to do in practice, even if it could be done to something as simple as a frog or perhaps a roach.
Comment: Thank you very much for your answers
Answer: No, because the brain is too spread out: the functions of emotions and thoughts are spread throughout the brain and occur both in the electrical impulses and in the chemicals released / absorbed. There are also "network effects" and the differences in interconnections that individuals have. Thus, an implant can't measure the totality of the brain's function. At best, we get some indications of major actions / emotions. The implants that are being used to control outside tools use rough control, not fine measurement. That is why they take a good bit of training to use.
Look at the range of ways that we are investigating brain functions. We use EEG, MRI, MEG, PET scans, etc. What this range of methods shows is that brains operate on multiple scales with multiple methods. It is interesting to see PET scans in response to a stimulus. Widely spaced areas of the brain light up together. That shows that what we consider to be one reaction is really multiple areas of the brain working together on the response. An implant would need to be able to measure activity over the whole brain, not just where the implant is placed. It would need to measure electrical and chemical behavior. We don't have many chips that can measure chemical. In short, our current technology is not capable of building one implant that can sample or measure the wide range of brain activity.
Comment: Thank you very much for your answers
Answer: Yes, but.
It is possible (because it has been done) to detect thoughts and emotions, using fMR imaging to detect specific activity patterns in the forebrain.
To do this with an implant, though, you need an extremely invasive implant, because you need to reach a significant portion of the frontal cortex as well as the rest of the encephalic mass. This raises a host of problems, from biocompatibility to the surgical procedure's difficulties.
Then, you need to analyse the gathered information to perform the decoding. That is going to require significant computing power, so, almost certainly, an external device.
You'd probably be better off to restrict your use case. For example, just an example: to prevent an insensate serial rapist from acting on their impulses, you need only to detect when these impulses do arise, and counteract them. The needed surgery (and analysis) would then be order of magnitude simpler and more economical, and could be packaged in a sort of "intracranial pacemaker".
Update: could it be done, patient unaware?
Definitely NOT. As I said before, the procedure would be nightmarishly invasive. The surgeons would need to place electrodes in a lot of places, and then calibrate them over a long period.
Barring unexpected progress in microtechnics, I don't expect such surgery to even be possible for at least thirty to fifty years.
The required computing power, assuming Moore's law keeps holding, will be implantable in the body - probably in the belly, there's too little space in the cranium - in some twenty years, at which point it will just cost a bomb. At that point, or even earlier, a much simpler signal decoding and analysis will give back arms and legs to amputees. Other ten-twenty years and we'll give back almost-normal sight to blind people (currently, we can do black and white over about sixteen pixels).
Comment: @Lucie Chaussure This is pretty spot-on. If the person spent months in the hospital with an elaborate set of sensors on the head being analyzed by scientists who were continuously scanning their brain and asking them about their thoughts and emotions, maybe. And what would be implanted today would be quite large and spread out. Near-future, we may be able to do smaller, but then it would likely be more of an approximation. Brain responses are highly individualized, tough to apply to more than one subject, and require a LOT of coordination and time to calibrate. A person would know.
Comment: Thank you very much for your answers
Answer: I have such a machine.

source
I have a phone in my pocket. Because I choose to use my phone this way, my family can track where I am with my phone.  I set it up that way.  And they can monitor my emotion because sometimes I call them up and tell them how I feel.  I can tell them my ideas and sometimes I tell them the weird ones.  Or I can tell those things to a well-meaning stranger who will listen to me talk about my troubles.  I have the device and I use it to help me.
You probably have a phone too.  If you think that people who care about you want to know, tell them!   When you don't feel good, or you are worried, or thoughts are intruding on your life I hope you will use your phone to talk to someone.  Maybe a therapist or someone on a hotline or maybe even your parents or siblings.  Hearing things you think said out loud (by you!) makes them less scary, because they turn into words that can be shared.  It is like turning on the lights when you think something is in the room.  Things become clearer.
Half of reality is what you get because of where and when and who you are.  The other half is what you make of it.  Work on that second half.  You are able to write down your thoughts in a forum like worldbuilding stack.  That means you have control and that is good.  Flex your muscle. Use your control over the half you have to put that other half where it can't hurt you.  It will still be there, but you will be the boss of it.
Comment: Thank you very much for your answers
Answer: You can detect emotions.
The detection can be done because emotions are mostly chemical based.
You feel better when you eat certain foods.
There are anti-depressants, drugs that control (to some degree) emotions. Medicines are chemicals.
Perfumes also effect moods. They are also chemicals.
Endorphin, testosterone etc are chemicals produced by human body itself. They effect moods.
Future technology may be able to precisely identify and detect in time sudden surge of a chemical that lead to a suicide attempt within next ten minutes say, or a person getting angry enough to break furniture whatever. It would still be an indirect way to estimate current thoughts. Thats as far as one can expect to go with foreseeable technology.
Putting probes on head to detect electric currents to directly estimate thoughts wouldnt work because by its very nature everybody's brain has different wiring (connections between nuerons).
There is also Godel's Theorem preventing us (humans) understanding our brains because we are bound to use brains to understand brains and we dont have artificial intelligence yet.
Answer: Lets split it into a few sections to make it easier to consider.
Detailed thought detection
This requires a deep understanding of the brain and how the mind functions. This requires knowledge we do not have at this time.
I would rate this not possible in the next 10 to 40 years. Probably not reasonable for even longer then that.
Thoughts are occurring detection
Detection that the person is thinking/ has brain activity, is easier and doable today. But I would expect this to be nearly useless. as this will mostly be raw data points, not useful information. That is you could get cpu 80%, cpu 82%... but that's about it.
Being able to tell where the brain is active and a bunch of machine learning and bunch of questionnaires could probably start pinning down things like doing lots of balance work, now playing music(audio + muscle memory), now doing some symbolic thinking. That is, what general task category the person is doing might be possible.
Emotion detection.
All the strong emotions are broadcast into the body via hormones, neural transmitters etc. Lots of signals to pick up from various locations. An implant into practically anywhere could do this. Calibrating for the individual becomes one of the hardest things. Along with miniaturized sensors that can read the relevant compounds and their concentrations.
A basic implant to read emotions can be built today. The accuracy and completeness of emotion/feeling determination would be low. But being able to read off simple/basic emotions such as fear, anger, hunger, lust should be very doable.
Location detection
There are existing off the shelf solutions(external) for this. That is you can buy a device that periodically says: I am here. Taking the "monitor movement" to mean a persons location.
Conclusion
Could in the far flung future a device be created to read detailed thoughts; Yes it is not strictly impossible. However there are many difficult obstacles and this is very unlikely to exist for a very long time.
Getting how busy is the brain, is possible, but probably not so useful. Perhaps able to pick up general activity type.
Emotion detection could be created much sooner as it is simpler and much less subtle.
Answer: It's called a 5G phone
There are a number of "5G" formulations, but the one desired by the Pentagon as the object of a no-bid contract - as opposed to the option discouraged by the Pentagon - is the one which is in the terahertz range.  This is perhaps due to the many, many uses of terahertz in biological imaging - see this preprint references 12-16, or perhaps this paper about brain imaging with terahertz.  Basically, you can detect blood with 5G radiation, so you can do imaging like fMRI (see LSerni's answer for a bit on how that relates - to explain a little beyond that, the phone would measure exactly which areas light up when a spam call says "QAnon" in the background, then measure when it lights up without an audio cue, and whether that is correlated with good or bad sentiments in your insula and limbic system).  Well, not you - a spy apparatus that actually has rights and access to control the vast complexes of machinery hidden inside 'your' cell phone.
How is this done?  Beamforming.  The 'antenna' has many, many emitters that add up to a very narrow beam that only goes through one structure.  This is integral to how the signal works.  I should also note the apparent applications of this in having the phone or base unit deliver the energy all to one point in the brain to control future behavior.  The applications are endless...
Further reading:  pain ray (Active Denial System) 1 2.  Recently promoted in the news as a means to kill COVID in seconds.

For reference, the "harmless" wavelengths associated with 5G are 6 GHz to 300 GHz.  6 GHz = 6E9 waves/second.  Divide c = 3E8 m/s by that and get 1/20 m = 50 mm.  Divide c by 300 GHz and get 1 mm.  The Active Denial System (pain ray) is 95 GHz, right in the middle of the cell phone range.

Note that other applications, such as measuring differences in DNA or displacing transcription factors from particular regions of DNA, may be of more interest to some users.
Comment: Thank you very much for your answers


When labeling people in a picture, should I label them as they were or as they are at present?

Question: Let's say I am labeling a picture of me, my wife and my stepson, but the picture is of an occasion before we got married.
Is it misleading to label the picture: "me, my wife and my stepson" which is true now, but was not true at the time the picture was taken?
Edit:  Let's say in the context of a picture album that subsequently included our wedding pictures?
Comment: I have a picture of my mother when she attended school in the early 1930s, Mussolini era, I wasn't born but when I show the photo to friends I tell them "That's my mum when she was a girl" Likewise you could say "That's Jack, my stepson when he was 15 years old" or "two years ago."
Answer: You can label the picture (photo)

Me, my future wife, and her son

which makes it clear when it was made (taken), requiring no explanation.
Comment: As in the question, it would be misleading because it wasn't true, and requires explanation. But my suggestion tells the full story, making it clear he is *her* son, and implying that she is now your wife and he is your step-son.
Comment: So would you say it could potentially be somewhat misleading or cause confusion it the label simply said Me, my wife and my stepson?  Let's say in the context of a picture album that subsequently included our wedding pictures?
Comment: In the context of a larger album it might be better just to use their names, especially if pictures of the wedding are included. The change in relationship would be self-evident if it's arranged chronologically.
Comment: Well, the reader of my album will be a government officer who only knows  "petitioner" and "beneficiary" or "petitioner's wife" and "beneficiary's son" and "petitioner's step-son" and is unlikely to know or care about names.
Answer: It's not quite wrong to label it that way, but it might be best to add a clarification:

me, my wife and my stepson, before the marriage

Another option is to say:

me and my now wife and stepson

(with the extra "and" added so the one "now" applies to both wife and stepson). See the Wiktionary entry, particularly the 1908 example under "quotations" for adjective meaning 1.


What causes the magnetic field around a wire with current to be circular and perpendicular to the flow of current?

Question: I understand that a moving charge will produce a magnetic field, but what causes them to appear circular and perpendicular to the flow of current, as they are?
Answer: First, do keep in mind that a moving charge also produces an electric field. And Maxwell alone doesn't specifically attribute an electric or magnetic field due to any specific charge. But an example of a solution to Maxwell can be provided if both the electric and magnetic field are computed as the electric and magnetic parts of the electromagnetic field given by Jefimenko's equations:
$$\vec E(\vec r,t)=\frac{1}{4\pi\epsilon_0}\int\left[\frac{\rho(\vec r',t_r)}{|\vec r -\vec r'|}+\frac{\partial \rho(\vec r',t_r)}{c\partial t}\right]\frac{\vec r -\vec r'}{|\vec r -\vec r'|^2}\; \mathrm{d}^3\vec{r}'
-\frac{1}{4\pi\epsilon_0c^2}\int\frac{1}{|\vec r-\vec r'|}\frac{\partial  \vec J(\vec r',t_r)}{\partial t}\mathbb{d}^3\vec r'$$ and
$$\vec B(\vec r,t)=\frac{\mu_0}{4\pi}\int\left[\frac{\vec J(\vec r',t_r)}{|\vec r -\vec r'|^3}+\frac{1}{|\vec r -\vec r'|^2}\frac{\partial \vec J(\vec r',t_r)}{c\partial t}\right]\times(\vec r -\vec r')\mathbb{d}^3\vec r'$$
where $t_r$ is actually a function of $\vec r'$, specifically $t_r=t-\frac{|\vec r-\vec r'|}{c}.$
These reduce to Coulomb and Biot-Savart only when those time derivatives are exactly zero, which is statics. So Jefimenko is an example of proper time dependent laws for the electromagnetic field. Note that both the electric and the magnetic part of the electromagnetic field have parts that depend on the time variation of current.
But only the magnetic field depends on the current.
When the time variation of the current is zero, the magnetic field is solely determined by the current. Full stop. And if the wires are perfectly neutral (and stays that way) and the time variation of the current is zero, then the electric field is zero.
As for why it is circular. The field due to the current always points orthogonally to the current and the vector from the current to where the field is. To join fields lines together you note that the points that are equally far from a piece of current naturally join in a circle.
But the real issue is that you want the field due to other current elements to also be circular. A straight wire can do this.
But there is another deeper issue. Because there are no magnetic charges the fields line can only loop together or go out to or from infinity.


Rendering HTML in LWC via lightning-formatted-rich-text

Question: We are trying to create a custom LWC component to render the HTML content using content managed REST api. We are getting the content, but when rendering in LWC the HTML is rendered with unformatted tags. We are using lightning-formatted-rich-text render the HTML.
Comment: Which tags are not correctly rendered?
Answer: Edit: Only use this as a last resort if you desperately want to render all of the html coming from the external service.
Use the HTML directive lwc:dom="manual" more info here. Since you are getting a HTML string from an external service, appendChild() or modifying innerHTML appears to be a good fit in this use case.
LWC HTML template:
<template>

</template>

LWC JS module:
handleGetHtmlContent(htmlContent) {
    const container = this.template.querySelector('.my-content');
    container.innerHTML = htmlContent;
}

Comment: Allowing any HTML to be rendered exposes the page to HTML/JavaScript injection attacks (XSS or CSRF). This could be why some of the elements are not getting rendered for the OP when using the existing lightning components.
Comment: True. Assumption was that OP was attempting to render tags that are unsupported by the rich text component. Would advise sanitising the html to prevent XSS attacks.
Comment: There's probably a reason the tags are unsupported by the rich text component, where that reason is XSS or similar...
Comment: Right now the reason is that Salesforce have released a new accordian element to the knowledge article editor but this is not one of the tags supported by the lightning-formatted-rich-text component.


How to select a loop of faces

Question: I am trying to select the loop of faces that you see partially lit all around the sphere. Please note that I am able to do that for all the other loops by clicking on alt+rmb. Whith these thinner sliceses (that i obtained by adding loop cuts). I have tried in any way also searched the web and videos, but wasn't able to find a way out.
Any suggestions please?
Answer: you have two ways (each one is responsible in its case):
1- use loop selection*: Go to face-mode by pressing 3 (or vertex-mode by pressing 1); hold <Alt and click on one of perpendicular edges along the face-loop.

2- use shortest path: Go to face-mode by pressing 3 select one face. hold down Ctrl and select some other face and the shortest path would be selected. do this consecutively to select your desired faces.
Answer: This is an old question, but in case anyone else has this issue in the future:
Loop select with alt+click will choose which loop to select based on which edge the cursor is closest to.
To select smaller slices, hover the cursor over the shorter edges of the faces when selecting.
Answer: It's not quite as easy as selecting loops, but you can select one face, then ctrl-click another face in that same row part way around (to select everything between those two).  You can usually work your way around a sphere with ~3 clicks this way.
Answer: You can also select these faces by going in side view (3 on numpad) then set she shading to wireframe with shift+z and then select the faces using box select (ctrl+b).
And also your issue may come from double vertices. To delete them you can use the "merge by distance" in 2.8+ and the "remove doubles" in 2.79-. you should then be able to select your face loops.

How to select a loop of faces


Wilting fittonia

Question: kinda new to the whole gardening scene but I have a wilting fittonia and I'm not sure why, I thought it could be a lack of sunlight because the room that it's in is in an area in the house where there's not much sunlight but is well lit, however the other side of the plant seems fine (the right side)
Answer: They like some bright indirect light, to low light. They also need humidity. These are best for indoor terrarium since the humidity builds up. Bathrooms is where I keep mine. Misting it will help too.
Answer: Fittonia does not appreciate direct sunlight - the  best situation is bright daylight, but no sunlight. These plants aren't that easy to grow outside of a terrarium because they like  high humidity - growing clustered with other plants around it will help with that, but otherwise misting regularly will help, as well as making sure its not near any source of heat, such as a radiator. Further information here https://www.thespruce.com/grow-fittonia-houseplants-indoors-1902486

Wilting fittonia


Cycle length of a LP for a PWR reactor

Question: How to obtain the cycle length as a function of the loading pattern for a pressurized water reactor?
Comment: Consider to spell out acronyms.
Answer: In a French REP, REP is the French acronym for PWR (Pressurized Water Reactor), the loading plan has no direct influence on the cycle time.
The first goal of the loading plan is to try to obtain a power density as equal as possible over the whole core volume to avoid the appearance of hot spots.
For example, new fuel elements are placed at the periphery of the core where the thermal neutron flux is lowest, and partially spent fuel elements are placed in the core center where the thermal neutron flux is highest.
At each 12 to 18 month period, the reactor will be deliberately shut down for the installation of a new loading plan, and a fuel element will be moved 3 or 4 times during its lifespan of about 5 years.
Without this voluntary shutdown, the reactor could operate for another 2 or 3 years, depending on the average composition of the average 235U content.
The reactor remains a critical mass up to an average 235U content of about 0.7 to 1%.
If you use the French language, you can join Futura forum physique .
Answer: The short answer is that you put the loading pattern into a core simulator and let the core simulator calculate the cycle length.  It isn't something you can do by hand.
If you want to know how to design a loading pattern that will meet a certain cycle length, that is a lot broader question.  You might want to start with a book on "Nuclear Fuel Cycles".   There is quite a bit of research going on now to try to optimize the fuel cycle using different optimization techniques such as simulated annealing, neural networks, etc.

Cycle length of a LP for a PWR reactor


How can I access /storage/emulated/0/DCIM on android device?

Question: I recently lost the contents of a micro-SD card and hadn't backed up the contents recently enough. Luckily, I noticed that the pictures I was missing happen to be in /storage/emulated/0/DCIM/.thumbnails on my Android 5.1 device. The sad thing is I cannot get to those files to do anything with them on my device. The only way I even knew that they were there is because ASTRO File Manager brought them up when I searched for pictures. I would love to be able to put these in a safe place and hoped to be able to do so via my computer. Does anyone know of a way to get my computer (Windows 7) to recognize this file? (Naturally, I told my computer to view hidden files, so that's not the issue.) All I can see is /Internal storage and /SD card (not /storage). If you have a workaround, please let me know too. If I can move (or better yet copy) these photos to another place on my phone and then move them, that would be absolutely wonderful.
Comment: Try copying them elsewhere using ES File Explorer. In addition, as phyrfox said, it is likely these are just thumbnails (based on the name), rather than the full pictures. I'd recommend using a file recovery program on your SD card before writing anything else to it.
Comment: Ah, I'm sorry to hear that. Honestly, I don't have any ideas for how to extract the thumbnails from it, if they aren't visible in there. What app were you able to see the pictures in? Also, I'd recommend trying to ask the question over on the Android Stackexchange (android.stackexchange.com) as well... There might be more people knowledgeable about your situation there. EDIT: Just tried it out on my own phone, and the pictures are showing up in the .thumbnails file just fine. Do you have "Show Hidden Files" set to "On" in the menu of ES File Explorer?
Comment: I actually got it. Let this serve as another lesson to BACKUP YOUR FILES! Totally automatically backing mine up now! Thank goodness for thumbnails!
Comment: Very glad to hear! What ended up doing it for you?
Comment: Combination of using 3 apps and my computer to move stuff around. Only got the thumbnails, but I'm fine with that :).
Comment: I am facing the same issue. I can see the files on the phone but its under the emulated/0 directory which is mounted/hidden from windows interface on the laptop. File search is not an option too.
I need to backup my files before I hit reset. Would appreciate any answers that worked well for others. Cheers!
Comment: Try going to /Internal Storage/ in ES File Explorer. This may only work on pictures, but you can moven them to another location. I used a couple more apps to make them regular pictures and then back them up, but that's what I did... Hope it helps!
Answer: The "/storage/emulated/" folder does not really exist. It's what might be called a "symbolic link", or, in simpler terms, a reference to where the real data is stored. You'll need to find the actual physical location on your device where it is stored. Since it's in /storage/emulated/0/DCIM/.thumbnails, it's probably located in /Internal Storage/DCIM/.thumbnails/. Please note that that this folder probably only contains "thumbnails", which are very small versions of the real files. It's possible your real files are gone forever if your SD card is irrecoverable.
Edit:
"Never Say Never"
The link actually refers to an emulated SD Card on your device.
Access the data "directly"* as the SD Card, and you will have access to all the data on that card.
*Airdroid's file "app" will allow this. And, if memory serves, access via a USB data cable will also.
Comment: @J.A. I just checked my phone in Media mode, and I was able to see (my version) of those files in the location I suggested. You might need to enable "View Hidden Files" to get to them/get them to display. (View > Hidden Items in newer versions of Windows, or under Tools > Folder Options > View > Show Hidden Items in older Windows).
Comment: No. Sorry. It's a regular phone I got from my carrier. You might need to search several places, because each version of the OS might use a different place. It's really hard to tell exactly where it might be. Without the SD card, though, it's definitely in internal memory somewhere.
Comment: I would be perfectly fine just recovering the thumbnails. (The quality is not too bad.) Problem is, I can't see them (at least via my computer) in /Internal Storage/DCIM/.thumbnails/. Is there a way I could see if this is the correct "symbolic link"? Thanks for checking on this. I REALLY appreciate any help I can get!
Comment: Windows still doesn't seem to see the files... Is you phone rooted?
Answer: I could recover my files by going to "Settings -> Storage and usb -> Images -> Camera. There if you select a photo then the right side top menu changes to "Select All" and "Copy to..". First select all, then copy to a folder like "downloads" or whichever is visible in explorer. Once copied to the desired folder. Copy from that folder to your Computers folder.
Comment: Please read the question again carefully. Your answer does **not** answer the original question. The OP lost the contents of the SD card ...
Answer: I had the similar issue, only the folder didn't begin with a .. What solved for me was resetting Media Manager.
Go to Settings -> Apps, make sure Show System is checked in the menu, look for Media Store or something like that, click on it and Clear Data. Then reboot your phone and wait until Media Store rebuilds itself.
The rebuild takes several minutes. You can check whether it's done by monitoring the data usage in the same place where you cleared it. Once it stops growing for a couple minutes, it's done. For example, mine stopped on 21 MB.