How to draw a probable outcome from a distribution?

Question: I have collected positional data. To visualize the data, I'd like to draw a 'typical' outcome of an experiment.
The data comes from a few hundred experiments, where I identify a variable number of objects at different positions relative to the origin in 2D. Thus, I can calculate the average number of objects, as well as estimate the empirical distribution of the objects. A plot of the 'typical' outcome would then have the average (or possibly mode) number of objects, say, 5. What I'm not sure about is where to position these 5 objects.
To simplify the problem, assume that the data follows a 2D normal distribution. If I were just to randomly draw 5 points from the distribution, I might get one point at [3,3], which would be a very rare outcome, and would thus not reflect the 'typical', or 'average' outcome. However, just drawing 5 points at [0,0] would also not make sense - even though [0,0] is the average position of the objects, 5 overlapping points are not an 'average' outcome of the process, either.
In other words, how can I get a 'likely' draw from a distribution?

EDIT
It looks like I should mention why I don't want to use the usual methods (like a 2D smoothed histogram, or plotting all the many points) to look at the 2D distribution.

The objects (which are vesicles (i.e. little spheres) inside cells) vary in number, size and position (distribution of the distance from the cell center, amount of clustering). I would like to display all these features in one graph. Since there are several hundred cells containing many vesicles each, it is not very useful to combine them all in a single plot. I am well aware that I could use a multipanel graph showing the distributions of all parameters, but this would be a lot less intuitive.
I would like to show a 'typical' cell that shows all the salient features that characterize a specific phenotype. This way, if I want to image a particular phenotype in a mixed population, I know what kind of cell I'm looking for.
I think such a plot would be a cool way to display a lot of information at once, and I just want to try.

Maybe it would be clearer If I said that I want to simulate a likely experimental result based on my measurements?
Comment: It is not clear what you want. Do you want a visualization of the 5 points you collected or a plot of the theoretical distribution that you feel generated the data? Please clarify the question so that an appropriate answer can be provided.
Comment: I'm not sure I understand. If you know they're distributed normally then... well they'll be distributed normally! If you don't know how they are distributed then plot your data and think of which distribution seems to be the more likely to fit them. Also, do you have any knowledge at all about the process you are analysing? Could you infer the distribution from that?
Comment: @Srikant: I tried to clarify the question. Better?
Comment: @nico: I don't know how the data are distributed. I mentioned the normal distribution only to help you understand the problem. Since we are trying to find out what process generates the distribution, we unfortunately don't know anything a priori about the distribution. I would like to visualize the data this way so that we can better identify patterns in the distribution and how the distribution changes with experimental perturbations.
Comment: Picking one of your actual experimental results randomly is a good way to illustrate a typical result and can be used for simulation as well (a'la bootstrap).
Answer: I also think that it's not clear what you want. But if you want a set of deterministically chosen points, so that they preserve the moments of the initial distribution, you can use the sigma point selection method that applies to the unscented Kalman filter.
Say that you want to select $2L+1$ points that fulfill those requirements. Then proceed in the following way:
$\mathcal{X}_0=\overline{x} \qquad w_0=\frac{\kappa}{L+\kappa} \qquad i=0$
$\mathcal{X}_i=\overline{x}+\left(\sqrt{(\:L+\kappa\:)\:\mathbf{P}_x}\right)_i \qquad w_i=\frac{1}{2(L+\kappa)} \qquad i=1, \dots,L$
$\mathcal{X}_i=\overline{x}-\left(\sqrt{(\:L+\kappa\:)\:\mathbf{P}_x}\right)_i \qquad w_i=\frac{1}{2(L+\kappa)} \qquad i=L+1, \dots,2L$
where $w_i$ the weight of the i-th point,
$\kappa=3-L$ (in case of Normally distributed data),
and $\left(\sqrt{(\:L+\kappa\:)\mathbf{P}_x}\right)_i$ is the i-th row (or column)* of the matrix square root of the weighted covariance $(\:L+\kappa\:)\:\mathbf{P}_x$ matrix (usually given by the Cholesky decomposition)
* If the matrix square root $\mathbf{A}$ gives the original by giving $\mathbf{A}^T\mathbf{A}$, then use the rows of $\mathbf{A}$. If it gives the original by giving $\mathbf{A}\mathbf{A}^T$, then use the columns of $\mathbf{A}$. The result of the matlab function chol() falls into the first category.
Here is a simple example using R
<code>x <- rnorm(1000,5,2.5)
y <- rnorm(1000,2,1)

P <- cov(cbind(x,y))
V0 <- c(mean(x),mean(y))
n <- 2;k <- 1
A <- chol((n+k)*P) # matrix square root

points <- as.data.frame(sapply(1:(2*n),function(i) if (i<=n) A[i,] + V0 else -A[i-n,] + V0))
attach(points)

#mean (equals V0)
1/(2*(n+k))*(V1+V2+V3+V4) + k/(n+k)*V0
#covariance (equals P)
1/(2*(n+k)) * ((V1-V0) %*% t(V1-V0) + (V2-V0) %*% t(V2-V0) + (V3-V0) %*% t(V3-V0) + (V4-V0) %*% t(V4-V0))
</code>
Comment: Thank you very much. This looks very promising! What if the data is not normally distributed? How bad is it to still use $\kappa=3-L$ ? Also, I guess if I wanted to have points with equal weight, I'd just disregard the first one, right?
Comment: The choice of $\kappa$ has to do with the properties of the *transformed* points (if you want to non-lineraly transform your random variables). A proper choice of $\kappa$ can also scale the points towards or away from the mean. You can safely select $\kappa$ so that $0\lt L+\kappa \lt k $ where $k$ the kurtosis of your distribution. Set $\kappa=0$ to disregard the point on the mean, without even changing the formulas.
Answer: To summarise (please correct me if I'm wrong):

You have a set of points for a number of parameters/states.
The points provide a joint distribution of the parameters states
You want to simulate from a model using some typical states.

The problem you have is that you can't write down a nice closed form density.
To tackle this problem you should use a particle filter. Suppose your model of a cell was this simple ODE:
\begin{equation}
\frac{dX(t)}{dt} = \lambda X(t)
\end{equation}
and your data consists of values of $\lambda$ and $X(0)$. Put this data in a matrix with two columns and $n$ rows, where $n$ is the number of points. Then

Choose a row at random, to get a particular values of $\lambda$ and $X(0)$
Optional step: perturb your parameters with noise.
Simulate from your model, in this case the ODE.
Repeat as necessary.

The key point is that step 1 is draw from the joint density of the $\lambda$ and $X(0)$.

This answer could be way off if I've misinterpreted what you mean about simulating from the model. Please correct me if I'm wrong.
Comment: Thank you for the suggestions. These are what I'd normally do with this kind of data. However, as I hope to explain in my edit, I really want to try something different.
Answer: Maybe you could use a smoothed scatterplot? It is an analogy to kernel density approximation, but in 2D.
Answer: One thing that you could do is to plot the position of all your experiments in the 2D plane, one point for each object, maybe colored by experiment (if you have a lot of experiments you may just plot a random subset of them).
If there is a pattern in the position of the objects it should emerge when doing this.
Also, depending on what you are measuring, maybe is not the absolute position that counts but the relative position of the objects. In that case you could rotate the positions around the origin so that for each experiment the first point always lies, for instance, on the x axis.


"treat 'em and street 'em"

Question: What does treat 'em and street 'em mean?
Answer: I believe it means "give them (medical) treatment and then get them out of the facility [and back on the street]."
Answer: As Hellion already mentioned, it's about medical treatment.
I believe it's used primarily in the U.S. where you're not covered by a national (or otherwise common) health insurance. If you lack medical insurance, the hospital is only required (by law) to treat the critical condition, and may then release you.
Answer: it is an emergency medicine term meaning to quickly treat them so that they can get out of the emergency room quickly.  It has nothing to do with insurance or inadequate care. it just means get their treatment done quickly so they can get out of the hospital

"treat 'em and street 'em"


animals that are not "primates"

Question: Is there a specific term to refer to all animals that are not primates? I have a text about the beginnings of brain research, in which the animals studied are divided into "simple animals" (mice, guinea pig, mole, rabbit, reptiles etc.) and "complex mammals and humans" (monkeys, apes, humans). The latter are primates, but I have no idea how to refer to the former group ("simple animals" is so imprecise). I tried on Wiki, but I got completely lost in all those Latin scientific classifications...
Comment: How about _non-primates_?
Comment: Sure, but I thought maybe there's some specific term.
Answer: Popular imagination, at least in the parts of the English-speaking world with which I can claim some familiarity, does not subdivide the world into primates and non-primates. This is not a traditional distinction— no traditional grouping would have included humans, orangutans, and lemurs in the same collective—and as a scientific categorization, the division is useful only so far as it is for any subdivision of animals: ungulates, annelids, hummingbirds.
Animals which are not primates are simply nonprimates (or non-primates), just as we might add non-ungulates, non-annelids, and non-hummingbirds to the conversation. Biologists may have more specialized terminology, but none that has made its way into popular usage. Nonprimate is certainly a term one can find in primatology journals.
Separate terminology is more common when the distinguishing characteristics are more readily observable than genetic maps, and when the groups are conceptually more equal. Traditional divisions include vertebrate and invertebrate animals and warm-blooded and cold-blooded animals, and more nebulously, the divisions between large and small animals and between higher and lower animals, the boundaries of which no two people will always agree upon.
Comment: But isn't it that _non-primates_ are first understood as _**mammals** that aren't primates_? I'd like to put non-primates, non-ungulates, the cold-blooded and invertebrate (etc.) under one term.
Comment: @shogun First understood among whom? The scope is established by context. Non-primates include not just sparrows and horses but spiders, archae, the planet Jupiter, and the completing the square method of factoring quadratic equations, for a certain kind of semiotician or philosopher.

animals that are not "primates"


Listening to an aperiodic inverse sound wave

Question: During the operation of noise canceling headphones, an inverse signal to the ambient noise is generated and is played through the speaker where every compression of the ambient noise is a rarefaction of the headphone signal and vis versa. If the ambient noise is an aperiodic signal (i.e. following the subsequent mathematical description) (let this signal's amplitude as a function of time be called $f(t)$), the headphone signal (call this signal $g(t)$ cannot be phase-shifted or time shifted in such a way that $f(t)=g(t)$ for all t. My question is: what would the headphone signal $g(t)$ sound like if it were isolated and played through a speaker independent of the ambient signal $f(t)$?
Comment: Do you have noise-cancelling headphones? I suggest you try it!
Comment: That is not what im asking. I am interested in what the inverse function would sound like without the original function destructively interfering with it.
Answer: An inverted sound signal would sound no different because that is simply a shift of the time origin. Our brains don't distinguish time shifts between two separately played signals. For example, a square wave which starts at zero and first compresses, then rarifies and repeats, even at changing frequencies, will sound exactly like one which starts at zero, rarifies, then compresses.
This is easily demonstrated with a sound mixing board which allows one to phase invert an input signal. The only thing one might notice is a "click" when the phase button is pushed.
Comment: @UniqueWorldline Trying to say there is a difference between "multiplying an aperiodic signal by -1", and "phase shifting all the frequency components by 180 degrees" is just arguing about terminology. There are a (very) small number of people who *claim* they can hear a difference in the sound caused by multiplying a signal by -1, and an even smaller number who have actually *proved* them can hear it. At least 99.9% of the human population wouldn't notice any difference at all.
Comment: In my question preamble, i specifically mention the case of an a periodic signal that cannot be phase-shifted. Would this case be different.
Comment: @UniqueWorldline Phase shift and time shift are not the same thing. "Phase shift" makes sense only for periodic signals, but any function of time $f(t)$ can be time shifted, i.e. $f(t - t_\text{shift})$.
Comment: I understand i conflated a time and phase shift. However, neither process should make it possible to "slide" the inverse aperiodic function such that the inverse function equals the original function. For example if the original sound function is $y=x^2$, the inverse function is $y=-x^2$. If this function y could be time-shifted using a substitution u=x-t such that y(u)=-x^2, it would make sense that the inverse function would sound like the original function. However, i cant see how such a substitution exists.
Comment: @UniqueWorldline : such a sound ($y=x^2$) almost doesn't exist. Most sounds can be put under the form constant plus a component having zero mean value, even on small scales (but not too small). You don't hear the constant part, so you don't need to annihilate it. You need only to annihilate the zero mean value part which can be done via time shift as mentioned by DanielShank.
Comment: @alephzero & @ claude chuber, please see my edits to my original question. Your arguments made sense for cases where f(t) is a periodic function. However, I guess I am failing to see how "phase shifting all the frequency components by 180 degrees" is a defined concept for an aperiodic function (a function for which a zero mean value factor cannot be defined). By definition (it would seem to me), there is no defined frequency at a given time. Also, (@ alephzero), do you have a linkable source for your claim that " There are a (very) small number of people who claim . . . "?
Comment: @UniqueWorldline : in theory you are right, but even with an aperiodic sound, unless it is really strongly aperiodic which is rare, there is a ressemblence between successive positive and negative "archs", which explains that an appropriate shift can induce a level reduction of many dB. @ alephzero: you could even push to 99.999999 :)
Comment: @UniqueWorldline Any signal which could be detected by the ear and interpreted as sound will have some periodic component, even if it's only 2-3 periods long. y=x^2 has no frequency at all and does not qualify as a sound. If you periodically repeat y=x^2, then you have a period. A sawtooth wave is simply y=x repeated over and over.
Answer: I suspect, based on experiments, that for any function $f(t)$, $-f(t)$ sounds the same in all but some very odd circumstances: in other words, it would sound the same.
I got interested in this because I'm interested in sound, and I am also deeply cynical about the golden-eared magic hifi stuff.  So I did some experiments, which I'll describe briefly below.
What I wanted to test was how sensitive, if at all, my ear was to the phase of sound, because golden-eared hifi people will claim it is but I don't believe them.  One reason that I don't believe them is that phase -- including the relative phase of different frequencies -- is aggressively dependent on your exact distance from the source of the sound (because the wavelengths are different), yet I don't observe any significant difference when I move my head by a few inches, but, say, at $2\,\mathrm{kHz}$, wavelength is about $17\,\mathrm{cm}$ so small movements will change relative phases hugely.
So here are the experiments I did.
The obvious test: wire speakers out of phase.  This is a famous mistake, and it is extremely obvious when you do it: if you wire two loudspeakers out of phase all the bass (low-frequency) goes away.  That's obviously because these have long wavelengths ($100\,\mathrm{Hz}$ is of the order of the size of many rooms), and these just cancel.  And you get the exact results you expect like this.  For both stereo and mono recordings you lose all the bass (it's easy to verify that low frequencies are strongly correlated between the two channels of a stereo recording).  For mono white-noise things sound a lot more hissy than they did, because the low frequencies in the noise are getting cancelled.  I did not try two uncorrelated sources of white noise: I should have, and I would expect them not to cancel in the same way (because uncorrelated).
Wire speakers in phase, but 'backwards'.  This means that, whatever $f(t)$ you were listening to before, you are now listening to $-f(t)$.  So I listened to a lot of music, tones, and various noise sources like this, and almost always this makes no difference.  But, interestingly, just occasionally it does seem to.  It never did for tones or noise, but for some musical sources it did, especiall when listening rather louder than I normally would.  It took me a long time to understand why, and I only have a theory backed by some slightly apocryphal evidence.
The theory is this: some sorts of music have big transients such as, for instance, bass drums.  These things are not anywhere near symmetric: think about what goes on when you hit a bass drum, for instance.  Well, speakers are pretty crap (even good speakers: essentially all the distortion in hifi systems is in the speakers, especially in the CD-and-later era) and become much crapper for large displacements as they fall off their linear range.  By hypothesis they are differently crap near the positive or negative limits of their displacement.  So, theory: big transient sounds like drums induce different distortion from the speakers when driven in different directions, and this is what you hear.
Well, the apocryphal evidence for this is that I never heard a difference for orchestral music, only for music with significant percussive content, and I only noticed it when it was played unpleasantly loud.
I like my theory, but it's clearly just a theory.  I can think of objective tests of it but they would all require much more equipment than I can muster.  A test would be to set up a very carefully positioned microphone, then play the same sound with the speaker wired each way, and see to what extent the waveforms were in fact the negative of each other, especially for high-volume clicks and bangs.  I don't have the equipment to do this, and nor am I willing to risk damage to my fairly expensive speakeers by doing these experiments (high-volume clicks and bangs are a good way to eat speakers).
However, understand that the effect, if there is one, is very small: I could, perhaps, sometimes, tell the difference, but I am sure I could not do so if I had not just previously listened to the same ten-second chunk of music many times over 'the other way up', and in many cases I could not tell.  I am absolutely sure I could not tell if you played it one way one day and the other way another day.  My experimental conditions were also awful: I had to grovel around behind the speakers to change the polarity. And finally and most importantly I knew the polarity had been changed which largely invalidates any result due to bias on my part.
There is a possible other phenomenon which is related to this: there is no reason to believe that your ears have identical responses to big transients with different polarities, either.  So really loud music with really loud percussive transients might actually sound different because of distortion coming from your ears.  An experiment to test this theory can't be ethically performed unfortunately.
So my conclusions from this were that I believe strongly that polarity does not make any difference to what you hear, but that to do the experiment properly would be beyond my ability (or interest).  If it does make a difference I think it is accounted for by distortions around transients as described above.

Notes: other than the caveats above, I'll repeat that my experimental conditions were awful, that I only tested my ears, that I have biasses.  I also didn't do any single-speaker tests, because I was interested in hifi aspects of it.
Comment: Your results are essentially what I expected since any sound wave in the real world has at least some periodic component in all but a few edge cases. It is interesting that it is the drums or other percussion, if any instrument, that violates this characteristic. In the times you thought you could hear a difference, could you describe what was different, or were the differences you were hearing extremely slight and you essentially were guessing that something was different?
Comment: @UniqueWorldline It's a long time since I did the experiments (I've given up arguing with hifi purists) but I think one way around sounded more toppy, which would make sense if the speaker cone was crashing into some limit.  You had to listen at quite high volume (much higher than I would normally listen at) to distinguish anything.  It was very slight if it was real.


How much does a house cost in Skyrim? Can I get one for free?

Question: How can I buy a house in Skyrim? How much do I have to pay? Can I put an alchemy table or an enchanter table in it? Do I've to solve a quest to get a house?
Comment: According to [the UESP wiki page on houses](http://www.uesp.net/wiki/Skyrim:Houses), the price range is 5,000 to 25,000 gold. The page also lists some free shacks with non-respawning ("safe") containers you can use.
Answer: You can buy several houses in Skyrim:

Whiterun*, 5000 septims. After completing the Bleak Falls Barrow quest.
Riften**, 5000 or 8000 septims. After performing several quests in Riften.
Markarth**, 8000. After completing either the Main Quest or Lvl 20, Red Eagle Redoubt and some miscellaneous quests.
Windhelm**, 8000 or 12000 septims. Available after completing the Stormcloak quests. Also becomes available after completion of the Imperial Army quest line. Available after completing the quest Blood on the Ice
Solitude**, 25,000 septims. Available after completing a miscellaneous quest (named Elisif's Tribute) for the Jarl.
Dawnstar*, free. Available after completing the Dark Brotherhood quest Hail Sithis! The Master Bedroom upgrade costs 3000 gold, purchased from Delvin Mallory, as part of a total 19,000 gold upgrade of the sanctuary.
Dawnstar*, 5000 septims. Available after installing Hearthfire, doing the completion Waking Nightmares, and doing the completion of Kill the Giant.
Markarth, free. Available after completion of The House of Horrors.
Winterhold, free. Available upon enrolling in the College of Winterhold.
Winterhold***, free. Available upon completing the The Eye of Magnus.
Morthal*, 5000 septims. Availible after installing Hearthfire, and completing Laid to Rest.
Falkreath*, 5000 septims. Available after installing Hearthfire, completing Black Briar Mead, and Kill the Bandit Leader.

*House can be upgraded to have an Alchemy Lab
**House can be upgraded to have an Alchemy Lab and an Arcane Enchanter
***House has Alchemy Lab and Arcane Enchanter
****Houses that need Hearthfire have land plot where you can create you're own house in the land by first planning it using the drafting table and creating it in the workbench. Interior workbenches are for the inside of homes.
Comment: Plus the cost for upgrades, as you can see on the Wiki page, count anywhere from 1800 (Whiterun) to 9000 (Windhelm) gold. You'll want them because they look nice, and include extra containers.
Comment: What does free Markarth house have to do with house of horrors? That abandoned house is unclean and doesn't have an enchanting or alchemy or anything else in that house.
Answer: The house listings above is great but here is the trick to get your houses for free.
You do actually need the money to buy the house but all can be bought for no gold out of pocket. When you're able to buy your house, save your game in front of the person. Now look for a chest/cupboard/dresser/container close to you. Click on buy the house then click confirm. Here's where the magic happens.
Right after you confirm buying, exit out of the chat and quickly run to the container.
"Sprint shout" is sometimes needed to achieve this since you only have around 6 second  to achieve this. Run to container open and drop ALL your GOLD in container, then exit container. If you pulled it off after exiting the container the chat should have now timed out and you received your House Key.
Now just go back to the container and get all your Gold back. This does not trigger stealing. You can't get your house furnishings for free but hey FREE HOUSES.
Comment: I think this doesn't actually answer the question.
Comment: really? did you read the header? How much does a house cost in Skyrim? Can I get one for FREE? see the FREE part? i think my answer gave him that solution...
Comment: You still need the 5000k gold to begin with to be able to get the house, which really doesn't make the houses "free". However the possibility of exploiting the game by hiding the gold away before it is collected is rather smart.
Comment: @Spoike so they mean getting a house without paying, not getting a house for free since you still need the money.
Answer: Like Wimpey, the first poster said, the minimum price for a house is 5000, and unless you use the exploiting method that Master said (that hasn't been confirmed yet, and you need all the gold anyway,) you can get a house for free.
I obtained the cheapest house that wasn't free, 5000; it's stationed in Whiterun and it comes with a storage chest. You can, of course, buy furnishings and upgrades to make it much nicer. However, to be allowed to buy this house, you must first complete the Bleak Falls Barrow quest by delivering the Dragonstone to the Jarl's Mage along the main quest.
Best of luck with your house search. Just a note that to become the Thieves Guild Guildmaster, you must own the 25,000 Septim manor in Solitude first.
Comment: I have gotten all of my houses free except for my first which was in whiterun before i figured out the trick i listed. I am the Thieves Guildmaster having gotten Solitude house for free so it did NOT effect it negatively just FYI
Comment: "Best of luck with your house search. Just a note that to become the Thieves Guild Guildmaster, you must own the 25,000 Septim manor in Solitude first." I don't know what you're talking about. This is about house costs and methods of getting them free, not about Thieves Guild stuff.


I forgot my phone PIN plz help?

Question: i forgot my Huawei g6 u10 PIN and i try too much time to open it but i'm not success to open it and i search about forgot-ting password on internet they said press volume up and power button in the same time and thing a logo will ...the logo is come for me and the option is not come me i think there is 4 or 5 option there is saying me(check sd update pkg is exist...make sure USB cable has been inserted!usb update starting...)plz help
Comment: Welcome to the Android Enthusiasts! Please check our [locked-out tag-wiki](http://android.stackexchange.com/tags/locked-out/info) for some first aid.
Answer: If you have root access and TWRP on your device it's quite simple:

You have to boot up into TWRP than start the (TWRP's) built-in file manager, navigate to /data/system and delete password.key and/or gesture.key and reboot.

If you have root access but TWRP not installed and you can access to FastBoot mode you can boot up into TWRP recovery with this:

fastboot boot twrprecovery.img

But it is just a temporary method.
Or if your device isn't rooted or there is no way to install TWRP on it, you have to hard reset (HR) your phone from the original recovery mode* or if you have an active internet access on your device and you activated ADM (Android Device Manager) you can add a new password to your lockscreen:

On a computer or other mobile phone, visit: google.com/android/devicemanager
Sign in using your Google login details that you also used on your locked phone.
In the ADM interface, select the device you need to unlock (if it isn't already selected).
Select 'Lock'
In the appearing window, enter a temporary password. You don't have to enter a recovery message. Now click 'Lock' again.
If it was successful, you should see a confirmation below the box with the buttons Ring, Lock and Erase.
On your phone you should now see a password field in which you should enter the temporary password. This should unlock your phone.
Now, before you go on with your life, go to your phone's lock screen settings and disable the temporary password.

*: If you do this all of your data will be purged, of course security reasons. So it must be your decision.
Answer: Have you tried a hard reset? If not, I would recommend trying that via the recovery. If you cannot, try using adb to reset it.
Comment: I think he can't even boot into recovery mode to do a HR. But if his phone is rooted there's another way too.

I forgot my phone PIN plz help?


Java Equivalent to Python Dictionaries

Question: I am a long time user of Python and really like the way that the dictionaries are used. They are very intuitive and easy to use. Is there a good Java equivalent to python's dictionaries? I have heard of people using hashmaps and hashtables. Could someone explain the similarities and differences of using hashtables and hashmaps versus python's dictionaries?
Answer: Python's dict class is an implementation of what the Python documentation informally calls "mapping types".  Internally, dict is implemented using a hashtable.
Java's HashMap class is an implementation of the Map interface.  Internally, HashMap is implemented using a hashtable.
There are a few minor differences in syntax, and I believe the implementations are tuned slightly differently, but overall they are completely interchangeable.
Comment: No example provided :(
Comment: @kami: I don't think that's right. The question doesn't ask "what is the equivalent Java code for some specific Python code". In fact the question doesn't contain any code at all. I'm not sure what the value would be of adding examples of using the Map API in Java; this answer already links to the canonical documentation. If you want to learn Java, start with a tutorial, not Stack Overflow. I certainly don't think this answer warrants a downvote just because it lacks a copy-pasteable code sample.
Comment: Any example that illustrates a java equivalent of python's dictionary in action. A useful answer include some example because most people come here to see examples and use them in their code.
Comment: Sad to read that comment saying "most people come here to see examples and *use them in their code*", I hope this is wrong.
Comment: Regardless of whether people want to copy-paste, an example usually helps in understanding anything better, in conversations in general, and programming. in particular. The number of upvotes on this answer is an indication of the level of interest among a population much larger than just the OP. But I do agree it doesn't warrant a downvote
Comment: @kami: What kind of example would you want?
Comment: @0xc0de unfortunately most people really do just copy and paste.
Answer: The idea of dictionary and Map is similar. Both contain elements like
key1:value1, key2:value2 ... and so on

In Java, Map is implemented different ways like HashMap, or TreeMap etc. put(), get() operations are similar
import java.util.HashMap;

Map map = new HashMap();
// Put elements to the map
map.put("Ram", new Double(3434.34));
map.put("Krishna", new Double(123.22));
map.put("Hary", new Double(1378.00));
//to get elements
map.get("Krishna"); // =123.22
map.get("Hary"); // = 1378.00

See documentation of HashMap in java8 https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html
Comment: Comments in Java are `//`, not `#` :)
Answer: One difference between the two is that dict has stricter requirements as to what data types can act as a key.  Java will allow any object to work as a key -- although you should take care to ensure that the object's hashCode() method returns a unique value that reflects its internal state.  Python requires keys to fit its definition of hashable, which specifies that the object's hash code should never change over its lifetime.
Comment: This is true, but it's not actually enforced by either language.  Obviously in either a Java `hashCode()` method or in a Python `__hash__()` method, you should try to return a unique value that reflects internal state.  In either Java or Python, if you have a mutable object, it probably shouldn't be a hashtable key, so it makes sense to throw an exception from the `hashCode()` or `__hash__()` methods.
Comment: In my experience, almost anything in Python can be a dict key ... what's the 'stricter requirement'?
Answer: As far as I'm aware (I don't actually use java) dictionaries are just another name for a hashmap/hashtable.
Grabbing code from http://www.fluffycat.com/Java/HashMaps/ it seems they are used in a very similar manner, with a bit of extra java boiler-plate.
Comment: Java even has a Dictionary interface which is implemented by Hashtable. HashMap is generally preferred, though.
Comment: @Michael Myers : Dictionary is deprecated, Oracle recommends to use Map instead http://docs.oracle.com/javase/7/docs/api/java/util/Dictionary.html

Java Equivalent to Python Dictionaries


Need to use both button and paperclip on ATX connector to power the pc

Question: I have some issue on a computer, and after several tests I found out that the only way to safely turn on the computer (otherwise it is dead) is to keep the paperclip on the atx connector and push the button on the front panel. This is the only way to fully boot the computer. After the computer is booted, I can take out the paperclip.
The motherboard has already been replaced once.
It is a PSU issue? What is going wrong?
Comment: do you have a spare power supply?  or another computer to borrow it from?  If so, test it with a different PSU
Comment: Terix - Did you figure out exactly what your issue was? I'm having the exact same situation, & using a spare power supply cord from another computer makes no difference, so I'm wandering if your situation was what Ramhound said, or something else.
Comment: Just replace the ATX power cable, sounds like the cable is defective, the paperclip is completing the circuit but having such a low quality metal doing so is just asking for trouble.
Comment: I've made an offical answer for this, and it's not good news. Hope it helps.
Answer: This issue is a symphtom of a failing PSU. After a couple of weeks of this mess, the PSU failed completely and died.


After OTA update all my data are in shell folder

Question: I have Acer Z530 with Lollipop 5.1, kernel 3.10.65+. I have the 16GB version, without external SD Card.
Today I have received an OTA update and after the restart all my data were gone as well as some 7GB of free space missing on the internal storage. When I connected using adb I have found all my data in folder /mnt/shell/emulated but the new data are being stored in /mnt/shell/emulated/0. So far I was able to find that the 0 is the default directory of the owner user. It seems that this update added the multiuser support, but failed to transfer the data.
How can I easily restore my data? Can I just mv everything to the 0 folder?
At this moment I'm pulling the folder to my PC, to have a backup, but I would rather do it correctly.
Answer: Using adb shell and mv command I was able to move all data to correct directory. After that, to be sure I did an restart and everything seems to be working correctly.


Is "I will" a plan or a promise?

Question: If my mom asks me to take out the garbage bag and I want to reply to her that I plan to do it soon how do I say it without making a promise?  Can I say "I will do it later." without it being a promise?
Comment: Best to avoid the entire issue by taking out the garbage immediately....
Comment: Your mom will hear it as an agreement (a promise) to do it later. If what you mean is you *might* do it later, that's what you should say. Then your mom will know where you stand, and can quite rightly respond that she *might* feed you today.
Comment: @Hellion nice...
Comment: I was just using that scenerio as an example(although my mom did ask me to take out the garbage bag for her and that's when I started stressing about the word "will").  I had every intention of taking out the garbage bag but because I am unsure of the future I was wondering if there was another way to say that I will try to get it done for her other than "I will try to do it" which I thought might sound like I wouldn't really try to get it done for her.
Comment: It depends on the context and the tone of voice.
Answer: The word "will" in English has a fascinating history that is often used as an archetype for the process of grammaticalization, where a word that once had clear semantic content comes to be used in a more functional way. See the wiki entry for more.
In short, "will" does not necessarily signal a promise or intent. For example, "I will see you later" is not usually taken to reflect the speaker's specific wish but, rather, the speaker's belief that a future meeting is simply likely. However, and depending on the context, many people will still interpret "will" as signaling a promise. Thus, if you specifically wish to avoid that implication it is best to avoid "will."
I suggest "I intend to take it out later." It still has the intentionality of "will" but a failure to follow through doesn't necessarily imply breaking a promise. You could have been held up despite your best intentions, for example.
Comment: "Will" signals a prediction.  If the future doesn't match then you didn't break a promise -- you showed that your forecast was unreliable.
Answer: To answer your question,
Just say,

"Mother, I plan to take the garbage out soon."

The sentence

"I will do it later."

can be a plan or promise, depending on the context.
Hope this helps!
Comment: In this case, context could refer to the party rather than the situation.  It will mean "plan" to you and "promise" to your mother, unless you have a reputation for not following through, in which case your mother would consider it a "lie".  :-)
Comment: Not sure what you're referring to for changing, but I was just making a lame joke playing off your "context" reference.  :-)
Answer: I'll do it later - the operative word here is 'later'.  And who knows what the future may bring?  You should say this if, in fact, you expect NOT to take out the garbage bag.
If you actually DO intend to take out the garbage bag it's probably best to leave out the 'later'.  "Yes, I'll do it" is more convincing as a statement of genuine intent.
It all depends what you want to say.
Why wouldn't you want to be clear... to your Mom!?
Answer: It means both depending on the context. Don't use "will". It will only get you into hot water! "might" is better.

Is "I will" a plan or a promise?


Is it possible to have my website change ip address?

Question: I was thinking about making a website on my Apache server. But it costs a lot to have a static IP/domain name and all of that. This probably sounds crazy, but does anyone know if it is possible to have your website change to whatever IP address your service provider gives you? Or is this something that has already been tried and failed? Probably sounds crazy since it would eliminate the need to buy a static IP address, just some random idea that came into my mind.
Comment: I don't think hosting a website on a home connection is a considered a breach of terms of service in 2015. It would be silly for any ISP to enforce that clause, if it still exists at all - with the advent of video streaming that uses much more resources.
Comment: Ouro below is correct, and hosting at home will be a breach of contract too.
Comment: @cloneman Most ISPs still have things in their agreements that you can not host services for commercial purposes. They want you to sign a business class contract to be able to do that.
Comment: @ScottChaimberlain the Internet is a big place, and most ISP's do not have those terms in there agreement - at least in this part of the world.  (and indeed those terms may be of no effect if they just in fineprint).
Answer: This is what dynamic DNS services are for. The reason they aren't used for production web servers is that, whenever the IP changes, the site will appear to be down briefly (minutes to hours depending on the service) while the DNS record is updated and redistributed.


What is a two-photon process?

Question: I am reading some introductory materials on modern optics, in which they mention two-photon processes everywhere. I know fundamental optics and a bit on quantum mechanics. Can anyone explain in a plain way what is a two-photon process or any simple introduction to a related topic.
Comment: have you looked at the wiki article? http://en.wikipedia.org/wiki/Two-photon_excitation_microscopy . This gives the diagrams http://en.wikipedia.org/wiki/Two-photon_physics for high energy but similar should hold for chemical processes too with interactions on the molecules.
Comment: Yes, I did. But that's too technical. There mentioned something on high-energy physics which is too hard for me to understand.
Comment: [My answer](http://physics.stackexchange.com/a/8651/520) to [Is energy exchange quantized?](http://physics.stackexchange.com/q/8633/520) includes a discussion of one process that is related to [Oli's answer below](http://physics.stackexchange.com/a/55275/520). There is a limit to how "plain" a discussion of these processes can be before they become simply wrong, as quantum mechanics is required to understand these processes.
Comment: Classical physics goes a long way to explain the concept of second harmonic generation in a nonlinear crystal. It is just one two-photon process. Other effects cannot be introduced that easily  and need a full quantum treatment from the start.
Answer: Here is a very basic explanation (hopefully not too much), which involves only basic physics.
Let's consider light passing through a piece of transparent glass. Under the influence of the oscillating electric field, the electric dipoles formed for instance by pairs of nucleus-electrons (i.e. atoms) will oscillate. These oscillating dipoles will in turn behave as antennas, which will radiate light, at the frequency at which they are vibrating. Macroscopically, the way the dipoles vibrate affects the optical index and the losses of the material.
In a linear medium, this effect depends linearly on the electric field. This means for instance that if you send twice the optical intensity on your piece of glass, you expect twice the intensity exiting it. It also means that if you send light composed of several colours, they will be well behaved and ignore each other.
In a nonlinear medium, the polarisation of some dipoles will behave differently. These dipoles will also have some response that depends on the square of the electric field. Let's consider an electric field at a frequency $\omega$ :
$$E(t)=E_0\cos (\omega t) $$
Through trigonometry, the square of this field can be rewritten as
$$E^2(t) = \frac{E_0^2}{2}(1+\cos(2\omega t))$$
This means that under the influence of a field at a frequency $\omega$, our second order non-linear dipole will  also start to oscillate at a frequency $2\omega$. It will then radiate light at this frequency. This effect is called second harmonic generation.
Looking at it another way, in this process 2 photons at a frequency $\omega$ now produce a single photon at a frequency $2 \omega$. This is an example of a two-photon process! More generally, photons at frequencies $\omega_1$ and $\omega_2$ could produce photons at frequencies $\omega_1+\omega_2$ (thus conserving energy). Other effect are also possible, for instance, starting from a photon at a frequency $\omega_1+\omega_2$ and creating a pair of photons at $\omega_1$ and $\omega_2$.
These effects need strongly nonlinear materials and/or very high intensities to be significant so they are not usually witnessed in everyday's life. However, one example would be those fancy green laser pointers. In them, there is a small laser producing infrared light which is then frequency doubled in a non-linear crystal, producing green visible light. The infrared laser is pulsed so that for the same average power, the electric field can reach much higher (peak) intensities, enhancing the non-linear effects greatly.
Amazing technology at a few bucks' cost!
P.S.  I simplified things a bit too much, so to clear things up:
Individual atomic dipoles can't pick up a second order non-linear polarisation (for symmetry reasons). In that case, it can be the result of dipoles formed by ions in some asymmetric crystals.
Comment: hi Oli, thank you so the simple explanation. I have few questions. 1) as my understanding, two-photon process is one photon at $\omega_1$ and one at $\omega_2$ can produce one photon $\omega_1+\omega_2$ or one photon at $\omega_1+\omega_2$ can generate two photons each at $\omega_1$ and $\omega_2$, but why this requires strong nonlinear effect? 2) If I have a photon at frequency $\omega$, could it be possible to generate two photons at $a\omega$ and $b\omega$ where $a<1, b<1, a+b=1$, so there could be many different photons at different frequencies generated?
Comment: 1) You need a non linear effect, which is usually week. Since the efficiency of second harmonic generation increases with the power, high power allows the effect to produce bright beams. Note that the efficiency of the opposite effect (creation of pairs of photons) doesn't increase with higher power of the pump beam, so you usually just create pairs of photons and not a bright two-color beam.  See http://en.wikipedia.org/wiki/Parametric_down_conversion. You can then put your crystal between mirrors to form a http://en.wikipedia.org/wiki/Optical_parametric_oscillator
Comment: 2) This statement is correct.
Answer: When we speak of photons we speak of elementary particles, that means that we are in the realm of quantum mechanics . Quantum mechanical problems can be solved using the Feynman Diagrams,. These are a pictorial way to allow one to write down the integrals that will describe the probability of a reaction to take place, either high energy or low energy.
They are simple conceptually but complicated in mathematical formalism.
Take this two photon to two photons diagram:

The curly lines are the photons, the dark straigth ones can be electrons, quarks etc, charged particles, the photons are neutral. There exists a one to one correspondence for every line and vertex in the diagram  to a specific formula which multiplied will give a long formula with integrals and functions within them, and the whole thing squared will give the probability of a photon hitting a photon, exchanging energy and two photons leaving the interaction. Probability means if I have N_1 photons on N_2 photons , how many of them will have interacted to produce N_3 +N_4 photons.
Now in the chemical/molecular two photon language, one can draw such Feynman diagrams.

Two-photon excitation employs a concept first described by Maria Goeppert-Mayer (1906–1972) in her doctoral dissertation in 1931, and first observed in 1961 in a CaF2:Eu2+ crystal using laser excitation by Wolfgang Kaiser.3 Isaac Abella showed in 1962 in cesium vapor that two-photon excitation of single atoms is possible.

Usually an atom can be excited by an electron being hit by one photon and going into a higher energy orbital. One in principle  could write a Feynman diagram where the two photons are incoming and hit an electron in its orbital as it is shown here on the left. The right side needs some thought, as it would need an outgoing excited atom but you should get the idea. Here is a whole thesis on the problem,  being treated with the Hamiltonian formalism. They find  in section 5.2.1 that there is a probability for two photons to excite one  atomic transition.
In this book they have developed specific Feynman diagrams for molecular processes, so this a subject that needs study, if one is serious in understanding it.
Comment: This is a good answer. A pure two-photon process at quantum level.
Comment: Thanks anna. Honestly, I don't fully understanding all but I am trying to read the related materials you give here. Hopefully, I can go a bit more deeper.

What is a two-photon process?


How to wire a ceiling light with 2 wires to ceiling with 3 wires?

Question: Our ceiling has three wires...one white, one black, and one green.  The new light fixture we bought only has a white and one black wire.  What should I do with the green wire in the ceiling?
Answer: The green is the ground wire.  If the work box is metal then the box itself should have a grounding screw and you should connect the green to that.  Otherwise you don't need to do anything with the green wire.
Comment: I would also recommend testing the wire to make sure that it's *really* grounded, before connecting it to the box.
Answer: Some fixtures dont have a ground wire - but do have a ground screw where you are supposed to connect to.  The installation manual should tell you if that is the case.


How to open Chosen via JavaScript?

Question: I need to open the Chosen dropdown via JavaScript so users do not have to click on the select to show it, how can this be done?
Answer: You can open a chosen select box via JS by doing:
$('#<id-of-your-select>_chzn').trigger('mousedown');

where <id-of-your-select> is the id of your <select> element.
For ex: if your <select> element is like <select id="foo" ...>, then the code above will become:
$('#foo_chzn').trigger('mousedown');

Comment: Hi thanks, this doesnt work for me for:
" style="width:350px; direction: rtl" multiple
                                    class="chzn-select-create-option chzn-rtl"  tabindex="8">

The JS code is:
Comment: Thank you so much, I've been trying to figure this out forever.
Comment: You are rocks awesome!
Comment: `$("#+div')` should work accross versions since they do seem to change the id suffix
Answer: It is very weird but i find answer is using timeout
it somehow neet to timeout first
maybe because my element is cloned
hope useful for others
setTimeout(function(){ firstElement.trigger("chosen:open"); }, 100);

Answer: you can add the below two lines to your code it will keep your chosen always open. It worked for me.
list_start is your select element id.
("#list_start").trigger('chosen:open');
$('.chosen-drop').css('left', 0);

Answer: In the updated Chosen jquery plugin following works fine with stopPropagation.

$("#selectbox").trigger("chosen:open");
event.stopPropagation();

$(document).ready(function() {
  $("#selectbox").chosen({});
  $("button").click(function() {
    $("#selectbox").trigger("chosen:open");
    event.stopPropagation();
  });
});
#selectbox {
  width: 140px
}
<link href="http://harvesthq.github.io/chosen/chosen.css" rel="stylesheet" />

<select id="selectbox">
  <option val="option1">Option 1</option>
  <option val="option2">Option 2</option>
  <option val="option3">Option 3</option>
  <option val="option4">Option 4</option>
  <option val="option5">Option 5</option>
  <option val="option6">Option 6</option>
</select>

<button>Trigger Chosen</button>
Answer: @tzvi's answer is valuable in the in the event that you're trying to trigger chosen so that it stays open after a selection is made (IE: making multiple selections in one go). Allow me to extend this a bit (updated for chosen 1.0, by the way):
$('#selectbox').change(function() {
  $('#selectbox_chosen .chosen-drop').css('left', '0');
});

$('html').click(function() {
  $('#selectbox_chosen .chosen-drop').css('left', '');
});

$('#selectbox_chosen .chosen-drop').click(function(e) {
  e.stopPropagation();
});

Essentially it forces the chosen dropdown to stay open by overriding some css that is usually in place by the "active" class. Then we have a couple of click events that will undo this if you click anywhere outside off the dropdown. Worked perfectly for me.
Edit:
By the way, if you really want to trigger the drop down via JS, use Chosen 1.0's API:
$('#selectbox').trigger('chosen:open')

In context of the original question, this will allow you to open the box or reopen the box after a selection is made. It will not, however, keep the box open after a selection is made (without closing for a moment).
Answer: This solves the problem,
just make sure chzn-select is the ID of your select.
chzn-drop will stay opened after users click on an option:
        $('#chzn-select').change(function(event)
        {
            $('.chzn-drop').css('left', 0);
        });

Comment: This is wrong since it doesn't add "active" classes' set to Chosen's markup. Techfoobar gave you a nice hint - "click" event would be more suitable to use in this situation though.
Comment: It works, I just checked it. Remember that you must trigger a click event on an anchor that resides in main container (.chzn-container > .chzn-single).

How to open Chosen via JavaScript?


Accuracy differences for artificial intelligence paper

Question: I read a paper about Rumor detection and they used BERT as an unsupervised language representation, fine-tuning it using a small dataset, and combining it with a supervised learning model to provide an enriched text representation of the content of the rumor, Now I achieved the same accuracy using sentence-Bert, what are the differences between these two models and I want to know if their model is slower than mine or not, they did not mention the speed on their paper.
they also have another paper with lower accuracy can I mention the paper that has lower accuracy to compare it with mine?
Comment: This question is about the content of machine learning research, and hence beyond the scope of this community. Perhaps try at crossvalidated.SE
Comment: What do you mean by "what are the differences between these two models" in the sentence? Could you please rephrase your question, it is currently hard to understand.
Answer: welcome to academia!
Now, you are the expert in the field and probably more in a position to answer "what are the differences between these two models" part than anyone here ;p
The only relevant to academia.SE bit needs addressing though. You are aware of their paper showing an accuracy same as yours and choose to cite a different one, with worse accuracy, to present your own results in a favorable light and possibly invent a reason for your work to have merit and be published. Nope-nope-nope.
It is a serious lack of integrity, you should never ever do such a thing (being a reviewer, I'd do you a favor and assume incompetence rather than malice but it's still not what you want, is it?).
You are supposed to be impartial with respect to who produced which result. If you can't find a legitimate reason for your work to exist, other than your lack of preparation/prior knowledge, keep working.
With all that said, however, your approach does not need to be strictly better than known results to be of interest: maybe what you did is easier to run on a new dataset, maybe it would likely generalize better, maybe there is a reason to think it'd run faster. To answer any of that, you have to figure out how what they did works, how is it different compared to what you did and what other relevant research exists in the field. Normally, you learn all that before you do the bulk of your own research but it's normal to find out more as you get some elbow grease. Just do not bend the reality in order to not have to work on conclusions and future research.
Comment: Thanks, So can I mention both papers and say my approach is only better than one of them? or do I just need to address the one with higher accuracy? the paper with higher accuracy is for 2020 but the other one is for 2021
Comment: @NargesSe If I were you, I'd look for other research on the topic and compare to that as well, unless the topic is super narrow (sorry, don't know enough of NLP myself to figure it out on my own). So 1) What's done in NLP to do feature embedding/representation of sentences in general? 2) What's so special about rumors making it harder or making it possible to do a better job than when considering text in general? 3) What these guys did and what have you done and why do you think your approach may be beneficial to develop/employ?
Comment: Cite one or both but crucially, do find and describe other relevant work as well, even if it's less tightly connected to yours. Grabbing one or two articles and saying "we did what those guys did but better, also not really sure what's the place of our work in the grand scheme of things" is just no bueno.


From where does a photon get energy to speed up when it travels from an optically rarer medium to a denser medium?

Question: The speed of light decreases when it travels from an optically rarer medium to a denser medium, similarly it increases back when it travels from rarer medium to a denser medium. The speed of light in glass is 2 x 10^8 m/s while in air is 3 x 10^8 m/s, from where does a photon get energy to speed up by 10^8 m/s if it travels from glass to air.
Comment: Worth a read? http://www.physlink.com/education/askexperts/ae509.cfm
Answer: The photons aren't even slowing down when they enter a medium.  The photons keep meeting atoms in the path and get reflected internally. This increases the total distance that s photon needs to travel. This in turn is what causes the photons to appear to have slowed  down.
There is no question of photons requiring energy to speed up when they leave the medium. Moreover, photons must always travel at the speed of light. This is a requirement for every massless particle.


Do I need to ask real locations' permission to use them in my story?

Question: I have written a children's book about dragons and the things they do in Texas. Do I need to ask i.e. the Lubbock Arboretum if it's okay that I mention them in my story? So my question is: When do I need to ask permission to use a location? Or do I even need to? Thank you!
Comment: Welcome to Writing.SE! Questions should only ask one thing at a time, so I've removed your secondary question about self-publishing. Feel free to ask a separate question about that if you need to, although we have [plenty of Q&As about self-publishing already](https://writing.stackexchange.com/questions/tagged/self-publishing) that may help you.
Answer: If by a "place" you mean a city, state, country, etc, then no. No one owns the name "Texas" that you could get permission from if you tried.
If by a "place" you mean an organization, like the headquarters of a company, things are a little more complicated.
There are two potential issues: libel and trademark.
If you portray a real organization as doing something illegal or scandalous, they could sue you for libel. Whether they could win depends on a variety of factors. 1. Did they really do what you said they did? If so, in the US it's case closed, truth is an absolute defense against libel. In other countries, like the UK, that's not the case. 2. Would a reasonable person believe you were saying this organization really did this, or is it obviously fiction? That can be tricky.
In general, the purpose of trademark law is to protect buyer and seller against the buyer being tricked into thinking this was the "real" product when really it's a copy. Like, if you made your own soft drink and called it "Coca Cola", and sold it in cans that resembled real Coca Cola cans, the Coke company could sue you and would almost surely win. You're tricking people into buying your product by making them think it's Coca Cola. But if you write a book and in it you say, "Bob drank a Coke", no sane person is going to confuse your book with a soft drink. No one is going to think that because your book includes the word "Coke" that therefore it is a soft drink.
Yes, sometimes this can get ambiguous. If your whole book is about Coca Cola and you have a picture of a Coke can on the cover, etc, Coke might be able to argue that you're giving people the impression that your book is an "official" Coca Cola product. They can afford better lawyers than you so maybe they'd win that one.
Comment: Would it still be libel if the organisation does these illegal or scandalous things in a fictional setting? I guess maybe if the author stated that the fiction is based on a true story.
Comment: @GiantSpaceHamster It depends if a court believes that a "reasonable person" would conclude the story was fiction. I don't have legal citations handy, but I recall a famous case a few years back where a porno magazine, Hustler, printed a cartoon depicting a then-famous preacher, Jerry Falwell, having sex with his mother. The preacher sued for libel. The court ultimately ruled that it was a cartoon, and a reasonable person would understand it to be fiction and not a claim to be factual reporting, and so killed the libel claim. ...
Comment: ... Many writers attributing sinister actions to a real-life organization toss in a few sentences about it being an "extremist faction" within the organization. This both helps believability for those who would say, "Oh, come on, I can't believe that the Boy Scouts are really part of an international conspiracy!", while also giving them some protection against libel. "Hey, I didn't say this is official policy, I said it was an extremist faction!"
Comment: Personally, if I was tempted to write a story where I said that, say, the Sierra Club was engaged in terrorist bombings, I wouldn't come out and say, "the Sierra Club". I'd make up some other name and make it clear to the reader that it's an organization LIKE the Sierra Club. Unless I had some reason why I wanted to publicly attack the Sierra Club.
Answer: As the author, you don't need to be concerned with obtaining permission to use the name of a city, building, or whatever.
This is a concern for a publisher -- which might be you if you self-publish. The situation that would matter to a publisher is if the author is using a trade-marked name without permission.
While it is very likely that Lubbock Arboretum has trade-marked its name -- to protect its brand if they sell merch, this protection is very specific as to the form. As in, Lubbock Arboretum on a hat or a tee-shirt or hoody. Maybe with some iconography. Since they have pay to register and maintain the trademark on each and every form.
Consider the Louvre. If you were to make and sell unlicensed "I <3 the Louvre" totes, you could find yourself on the wrong end of an infringement lawsuit, but you can mention the Louvre in your novel or short story without concern for infringement.
If your story brought discredit on the Louvre or the Lubbock Arboretum in a way that a reasonable person might believe is true, then you could get sued. But that wouldn't be for infringement but for brand diminishment -- egregiously hurting their earning potential with false and misleading statements.
Answer: I would absolutely avoid depicting any non-public place, non-public building or private company in any way differently from the most positive things anyone would expect to happen there in reality.
That is, if your story takes place at a private Arboretum and your protagonist goes there to look at the trees and meets a nice person there, no problem.
But if in your story that Arboretum is a place where dragons live, that is potentionally problematic. Because the owner of the Arboretum place might not want his business to be associated with dragons, no matter how positive you think your portrayal of the place was.
Photographers have to get a location release by the owner of a place if they want to commercially use photos they took of that location, and this is no different: You are commercially using someones private property, so absolutely avoid anything that can be construed as being less than positive.
Public places, state owned property, countries, and so on you can do whatever you want with.


Honda City 2009 : It would not start Start

Question: My honda city 2009 AT would not start. The gauges would light up. The power windows,radio and AC worked. I was able to turn the key but when I try to start it, it will just give a sound like it is starting but it will not really start. I als tried to start it while on Park and Neutral mode but it still would not start. Please help me.
Comment: You are saying the engine will crank over, but will not fire (come to life)?
Answer: if the engine cranks at the first time and then it stopped (like not enough of power), then you're run outta battery. but if the engine cranks but it wouldn't start then you have a problem around your fuel injection system or your igniton system.
Comment: Welcome to the site. While this may/may not be the issue, it really doesn't answer the question of how to get it running. You just aren't really giving any information. You may want to add to your answer. As it stands, it may get down voted.
Answer: Ok, I've a 2008 honda city, same as the honda jazz with the cvt transmission and one day i was driving along and the engine just shut down, i cranked several times it wouldn't just start, i did everything possible, added more petrol, changed spark plugs changed the crank shaft sensor thinking it has failed becos I noticed the plugs were not getting any spark, i just d crank shaft positioning sensor and camshaft sensor 2 times unfortunately the engine still didn't start, the fuel pump was working fine and it supplied fuel. But after several days of trials and electrical specialist working on the car we found out dat the wires harness had separated so the car wasn't getting any spark. The wire is directly under the battery on a 2007 honda city I believe it's d same as with that of the 2003 up to 2008 so if u are having the same problem with it car just look out for that wire harness b4 any other thing gets damaged while trying to start it. My case the auto electrician damaged my spark plug coils and starter
Answer: I believe I found the solution, once your battery is good simply do this. This may seem silly but it worked for me. Disconnect your car battery, go to you fuse box located under the steering wheel and use a thin flat head screw driver or pliers to remove all the relays one by one and resit them. To use the flat head screw driver, pry it at the bottom of relay and force it out. Strange enough it fix the starter problem. Be aware that the blue relay was not move. Reconnect the battery and try starting again. Honda City 2011


Will my pi run on a 5v 1A/2.1A MAX power bank?

Question: I have a SoundLogic solar-powered power bank which has a 5v @ 1A/2.1A MAX output, is it safe to use it with my pi 3? Im kinda worried about using it and it frying or breaking when the battery energy goes down.
Comment: The question would be the behavior of the power bank when the battery is drained. Does it have a mechanism to allow for a message through some interface to indicate low battery? It may be possible to pass a warning to the PI to do an orderly shutdown when the battery is low. Would the battery being low cause the power bank to shut off power to what ever is plugged in which would be similar to pulling the plug while the Pi is running? Can you provide a link to a data sheet on the product?
Answer: I have powered a Pi Zero from a power bank and when the power ran out the power bank cleanly cut power, no brownout. I would assume you will get the same behaviour and therefore not be a frying problem.
However, just cutting the power from any Pi is not recommended. If the Pi is writing to the SD card when the power goes down you could get corruption which proves fatal.
If you can run the SD card read only, then you should be safe.
Try googling "pi sd card read only" - eg Charles Hallard has a good tutorial for this. The only thing I would add is to use a USB stick to keep any logs etc on and if that becomes corrupt then the Pi can keep working.
I did this years ago with a Compact Flash card in an old PC running Slackware, so I know its possible, I've just never tried it with a Pi.


Mechanical Switch with electronic trigger/gate

Question: There are any part in market that consists in a mechanical Switch which can be turn ON or OFF by a person, and by a electronic? Something like a real switch with a tiny servo inside to push on or off?
My main porpouse is to avoid relay that consume some current and mosfet as well.
Need to deal good amount of current in AC
Comment: How much current? I have used 1kA contactor switches with solenoid assist or manual lever
Comment: 220V 16A Max, need a switch with that inbuilt if possible.
Answer: If the only problem with a relay is that you want to avoid the stand-by current while activated, there are variations called a latching relay.
They keep their state even when they are unpowered, and they are available in different configurations.

This was originally a comment, but apparently it was helpful.
Comment: Still need a push button that user can interact with, and if relay change state that button change position too, is that possible?
Comment: Related: http://electronics.stackexchange.com/questions/91842/resettable-mechanical-switch?rq=1 which talks about a rocker switch that can be turned off with an electrical signal.


What do the poles of a Green function mean, physically?

Question: Is there a physical interpretation of the existence of poles for a Green function? In particular how can we interpret the fact that a pole is purely real or purely imaginary? It's a general question but I would be interested in the interpretation in quantum systems.
Comment: To fully understand this topic you need to study bound states and resonances from the point of view of scattering theory (see e.g. textbook by Taylor) and also study Kallen-Lehmann representation and LSZ formalism in quantum field theory (confront for example Peskin, Schroeder for that)
Comment: for the relevant discussion in the case of quantum field theory, see [Positivity of residues and unitarity in scattering amplitudes](https://physics.stackexchange.com/questions/292611).
Answer: Let me expand a little more on what Craig Thone just said :
Consider the energy/frequency-dependent Green function :
$$
\tilde{G}(\omega)=\frac{1}{\omega-(a-\mathrm{i}b)}
$$
with one single pole in $\omega=a-\mathrm{i}b$ (with $b>0$), which is Fourier transform of the time-dependent $G(t)$ Green function such as :
$$
G(t)=\int\frac{\mathrm{d}\omega}{2\pi}\frac{e^{-\mathrm{i}\omega t}}{\omega-(a-\mathrm{i}b)}
$$
One can show, using complex analysis (I can eventually show some details about that if needed), that it computes to :
$$
G(t)=\mathrm{i}\,e^{-\mathrm{i}at-bt}\Theta(t)
$$
where $\Theta$ is an Heaviside step-function.
It means that :

The real part $a$ of the pole gives an oscillatory behavior to the solution. In the context of quantum systems, $a$ is often referred to as an eigen-energy.
The role the imaginary part $b$ in twofold :

It gives a damped behavior to the solution. In the context of quantum systems, $b$ will describe how one state, which is not an eigen-state of the system, will be depleted as a function of time in a superposition of eigen-states. In the limit of a perturbation theory, $b$ is the same rate given by the Fermi Golden Rule.
The fact that $b>0$ ensures that the function $\tilde{G}(\omega)$ has no pole in the upper complex plane (i.e. $\forall\omega\in\mathbb{C}, \Im({\omega})>0$). This analycity of $\tilde{G}$ implies by the Cauchy's integral theorem that :
  $$
\forall t<0,\,G(t)=0
$$
  which is needed to ensure the causality of the dynamics. To ensure such property, an Heaviside step-function $\Theta$ can be added to $G(t)$.

EDIT : Analyticity of $G$ and causality.
In order to evaluate $G(t)$ for $t<0$, one can consider the path $\Gamma_R$ which is defined as :
$$
\Gamma_R=\left\{\omega\in\mathbb{C},\,\omega\in[-R,R]\,\bigcup\,\mathcal{C}_R^0\right\}
$$
where $\mathcal{C}_R^0$ is half of the circle centered on $\omega=0$ with a $R$ radius.
$\forall t<0,\, G(t)$ is given by the integral :
$$
\forall t<0,\, G(t)=\lim_{R\rightarrow+\infty}\int_R^{-R}\frac{\mathrm{d}\omega}{2\pi}\frac{e^{-\mathrm{i}\omega t}}{\omega-(a-\mathrm{i}b)}
$$
Additivity of integrals gives you then :
$$
\forall t<0,\,\int_{\Gamma_R}\frac{\mathrm{d}\omega}{2\pi}\frac{e^{-\mathrm{i}\omega t}}{\omega-(a-\mathrm{i}b)}=G(t)+\lim_{R\rightarrow+\infty}\int_{\mathcal{C}_R^0}\frac{\mathrm{d}\omega}{2\pi}\frac{e^{-\mathrm{i}\omega t}}{\omega-(a-\mathrm{i}b)}
$$
Since there is no pole in the complex area enclosed by $\Gamma_R$ ($\tilde{G}$ is analytic in the upper complex plan), Cauchy's integral theorem gives you that :
$$
\int_{\Gamma_R}\frac{\mathrm{d}\omega}{2\pi}\frac{e^{-\mathrm{i}\omega t}}{\omega-(a-\mathrm{i}b)}=0
$$
Moreover, Jordan's lemma ensures that :
$$
\lim_{R\rightarrow+\infty}\int_{\mathcal{C}_R^0}\frac{\mathrm{d}\omega}{2\pi}\frac{e^{-\mathrm{i}\omega t}}{\omega-(a-\mathrm{i}b)}=0
$$
letting you with :
$$
\forall t<0,\,G(t)=0
$$
You have to realize this is the reason why sometimes you see people introduce some infinitesimal $\pm\mathrm{i}\epsilon$ which pushes the pole of a propagator out of the real axis : it ensures causality/anti-causality of the solution.
Comment: See edit for more details.
Comment: This is a good answer, and both this and David's are worthy of the bounty; I'm awarding it to him to encourage new contributors.
Comment: Thanks for your clear and helpful answer.

Has it a typo in the third formal ? a minus sign is omitted before "$iat$"?:

 $G(t) =\mathrm{i} e^{-\mathrm{i} at - b t}$
Comment: Could you clarify how the analycity in the upper half plane implies $G(t)=0$ for $t<0$?
Comment: Glad it helped! Yes, you are right! Thanks for pointing it out!
Answer: This is a somewhat broad question, because there are a number of different Green's functions in quantum physics. Perhaps the simplest one is the resolvent Green's function for a single-particle system. Its definition is $$G(\omega^{\pm})=\lim_{\delta \rightarrow 0^+}\left[ \omega \pm i\delta - H \right]^{-1}\equiv \frac{1}{\omega\pm i\delta - H},$$ where $H$ is the Hamiltonian. Ignoring the $\delta$, and replacing $\omega \rightarrow E$, you can see how this relates to the time-independent Schrödinger equation: $$H\left|\psi \right>=E\left|\psi \right> \longrightarrow \left[ E - H\right]\left|\psi \right> = 0.$$ Basically, if you apply the operator $G$ to a solution to the Schrödinger equation, $\left|\psi_n \right>$ with energy level $E_n$, you get a pole (the "denominator" vanishes) at $\omega \pm i\delta = E_n$. That is, $$G_{nn}(\omega^{\pm})\equiv\left<\psi_n \right|G(\omega^{\pm}) \left|\psi_n \right>=\frac{1}{\omega \pm i\delta - E_n},$$ has a pole. Then it is clear that the poles of (Tr = trace) $$\mathrm{Tr}\{G(\omega^{\pm})\}\equiv\sum_{n}^{\mathrm{all\,states}}G_{nn}(\omega^{\pm}),$$ give you the full spectrum. In fact, you can show that the quantity (Im = imaginary part) $$\rho(\omega)=-\frac{1}{\pi}\mathrm{Im}\{\mathrm{Tr}\{G(\omega^+)\}\},$$ gives you the density of states of the Hamiltonian $H$.
The resolvent Greens function is valid for a single-particle system, but the concept caries over well to many-body physics, and thus to quantum field theory. However, the definition of the Green's function is not as direct in those cases. The Green's function is given by the probability amplitude that a particle will be added to the vacuum state at a time $t$ and state $n$, and that after time evolution it will be removed at time $t'$ and state $n'$: $$\mathcal{G}(t',n';t,n)=-i\left<\Phi \right|\psi_{n'}(t')\psi_n^\dagger (t) \left|\Phi \right>,$$
where the factor of $i$ appears just as a convention, and $\left|\Phi \right>$ represents the ground state. This definition has a very transparent interpretation, because this quantity is the answer to the question: if in the quantum vacuum, which is (to quote Lawrence Krauss' favorite phrase) "a boiling bubbling brew of particles popping in and out of existence," a particle were to pop into existence at time-state $(t,n)$, what is the probability (amplitude) that it would propagate to time-state $(t',n')$? There are a number of different versions of this type of Green's function, each useful for a different thing. One thing all of these have in common is that handling them in this form is complicated, and it is much easier to work with their Fourier transforms $$\mathcal{G}_{n'n}(\omega^{\pm})=\int\mathrm{d}(t'-t)\,\mathrm{e}^{i(\omega\pm i \delta )(t'-t)}\mathcal{G}(t',n';t,n).$$ As you can see, a complex shift $\delta$ is introduced here, which has to do with the convergence of the integral. This is precisely the origin of it in the resolvent Green's function. In fact, if you have a system where the particles don't interact with each other, and instead each particle simply follows the Hamiltonian $H$ with energies $\{E_n\}$, then you can show that $$\mathcal{G}_{n'n}(\omega^{\pm})=\frac{\delta_{n',n}}{\omega\pm i\delta - E_n},$$ and you get a full analogy with the single-particle Green's function, and the answer to the question above is "if the particle is created at an eigen-energy of the Hamiltonian, and propagates to be annihilated at the same eigen-energy, you get a peak in probability (a pole); if not, you get zero."
However, things get more interesting when you do have interactions, and your Hamiltonian becomes $H + U$. For that case, it can be shown that $$\mathcal{G}_{n'n}(\omega^\pm) = \frac{1}{\omega - E_n - \Sigma_{n'n}(\omega^\pm)},$$ where $\Sigma_{n'n}(\omega^\pm)$ is called the self energy, and the equation above is called the Dyson equation. In many cases this will have a simple form when you calculate specifically $\mathcal{G}_{nn}$: $$\mathcal{G}_{nn}(\omega) = \frac{1}{\omega - (E_n + \Lambda(\omega) ) - i \Gamma_{n}(\omega) }.$$ This has a very simple meaning, when you compare it to the non-interacting case: first, if you ignore the $\Gamma$, you have that because of the interactions the pole has moved from $E_n$ to $E_n + \Lambda$. Then, if you consider $\Gamma$, you will find that the pole is not infinitely "narrow," but instead has a width $\approx \Gamma$. In fact, this expression is nothing but a type of Lorentz distribution. Basically, because of interactions, your energy level is not longer infinitely lived, but now decays into the vacuum in a time scale given by $\hbar/\Gamma$. $\Gamma$ is sometimes called the scattering rate, or decay rate. But because there is still an analogy with the resolvent Green's function, one says that this state, which has a finite lifetime, is an energy state for a new particle---a quasi-particle---that emerges from the interacting system.
Comment: Nice and clear answer. Yet, I suggest adding a paragraph also on the meaning/rôle of Green's functions in __linear response theory__. That will give poles another (rather different) meaning, and connects them directly to some observed phenomena.
Comment: That's a good point. I'll come back after work and add a few details on that, and perhaps on the connection to the path integral formalism. Thanks for the suggestion!
Answer: The pole of Green's function is related to the spectrum of the particle which is propagating. One dimension for example
$$\tilde{G}(\omega)= \frac{i}{\omega-(\epsilon+i\Gamma)}$$
If pure real, G(t) is some oscillation function which shows that the particle is stable. If pure imaginary, G(t) has some exponential decay behavior which shows that the particle is unstable.
Comment: For classical linear response the GF can be neither purely real nor purely imaginary on any finite interval because of Kramers-Kronig.  I.e., a real GF violates causality except in vacuum.  Is this not true in QM?
Comment: The picture is similar. For free case without interaction, GF is real. For intacting case, there is a imaginary part which is related to self energy. Linear response is some kinds of interacting.


Google Sheets Formula returning zero when it shouldn't

Question: I'm having an issue with a formula in my Google Sheet. I've searched the internet some to see if anyone's had the same problem and found a solution but it seems there's nothing so I'm hoping you all can help. Basically I have a bunch of cells which use the IFERROR() function to return the word "Blank" if the cell is an error, and there are 100+ cells where it works as expected, but for some reason I can't understand there are two rows where it's decided to return "0" instead of "Blank." The text in the formula is exactly the same as all the others, I've tried multiple times just copying and pasting one of the working cells in place of the broken ones, yet I get the same result. I've tried just deleting and manually rewriting the formula in the hopes it would reset itself but no luck there either. The strange thing is, when I'm editing the formula and it shows the little white popup with blue text that's meant to show you the output of the formula, it correctly shows as "BLANK". But upon hitting enter it just shows up as a 0 in the cell. And it's not just how it displays, other cells are reading it as a 0 instead of BLANK which creates problems. I'll attach a link to the document, but there's a whole lot going on so just ignore everything and scroll to Row 262, column K. The tables exist from K262 to AL289, and most of them are working properly, but R271, S271, R274, and S274 are the broken cells. You can see when the cells immediately underneath each respective cell (the ones they are referencing) contain errors, they return 0 instead of "BLANK", like all the other ones are doing.
Comment: HI, welcome to WebApps. Your spreadsheet requires permission to access. In order to have the greatest number of people read and consider your problem, I suggest that you share your spreadsheet so that anyone with the url can access it.
Comment: Sorry, I thought it was available for anyone with a link, I'll fix that
Comment: I had a quick look at the relevant formula in your spreadsheet. The formula relies on at least 80 (eighty) referenced cells and formulas. The spreadsheet as a whole is a extremely complex. My suggestion to you is to troubleshoot the specific formula by breaking down the results by referenced cell and identifying when the error value is created. Personally, I found the spreadsheet so convoluted that I couldn't justify spending more time trying to investigate your problem, let alone try to solve it.
Comment: Hi! it's not the error message that I'm worried about, those cells are supposed to return error messages. It's the ones above them that are meant to return the word "BLANK" when those cells are errors, and that happening isn't dependent on anything else in the document. The cells in question only reference the one cell to ask whether or not it's an error, which it is, and does not result accordingly. The issue is really just between those cells. Hope that makes sense.
Answer: you can try one of the below formula
1.This will return 0 if error
=iferror(value(mid($P$8,search(".",$P$8)-3,1)),"0")
2.This will give you a "blank call" if there is an error.
=iferror(value(mid($P$8,search(".",$P$8)-3,1)),"")
Similarly, you can do this for other formulas too.
Let me know if you need more help with this.
thank you
Regards
Supreeth
8904609867


GUI library for elderly people?

Question: I'm trying to develop a simple program in python (but this is not a requirement, I can switch to another language if worthwhile) and I'd like to make it very usable by elderly people, is there some GUI library already available?
Answer: Well, which OS platform are we standing in? If you are in linux or windows and using C# take a look at MonoDevelop. If in linux, I would stick with QT LAF and there's also GTK too.
Now, if I was in your position I would start making prototypes of the program and presenting them to the ederly, survey them through the process and make best of their inputs. It's not an easy task but it will do the work at the end of the process. Keep it simple and don't try to clutter up the ui design.
Answer: if your making a seperate GUI for elderly people it's probably best you make it yourself from whatever existing code/libraries you have.
Like increasing the element and text sizes, and increasing the contrast. But not too much that you make the majority feel patronised.
Answer: Most GUI libs support some kind of widgets that can be used for people that have some problem with their eyes or such. However, i don't think that there is a library that is particularly targetted to that. Hence, i would use GTK or Qt. In the end, it comes down to how you design your GUI.

GUI library for elderly people?


How do I rotate an object with a custom button and panel using python scripting?

Question: Im making a Boeing 787 model and I just finished rigging it however I thought that maybe I would go deeper and try make a custom panel to control the rig. I've got the panel itself done using one of the default templates but I'm a complete noob at scripting new text.
Basically what I want to do is use a code to create a button in the panel, and when pressed, it will rotate one of the bones used for rigging, say for example the rudder. I really need help with this. By the way, Ive never seen it done but what would be even better would be a slider. This would mean I have more control over the rotation.
Answer: One way might be a modal operator which tracks mouse movements and applies it to pose bone rotation. The operator modal template (Goto Scripting View -> Templates -> Python -> Operator modal) should be a good starting point.
Here is a small example:
<code>import bpy
from bpy.props import IntProperty, FloatProperty

class ModalOperator(bpy.types.Operator):
    """Rotate a bone with the mouse, example"""
    bl_idname = "object.modal_operator"
    bl_label = "Simple Modal Operator"

    first_mouse_x = IntProperty()
    first_value = FloatProperty()

    def modal(self, context, event):
        if event.type == 'MOUSEMOVE':
            delta = self.first_mouse_x - event.mouse_x
            self.pbone.rotation_euler.x = self.first_value + delta * 0.1

        elif event.type == 'LEFTMOUSE':
            return {'FINISHED'}

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):
        self.first_mouse_x = event.mouse_x
        self.pbone = context.selected_pose_bones[0] # <- put your bone here instead
        self.first_value = self.pbone.rotation_euler.x

        context.window_manager.modal_handler_add(self)
        return {'RUNNING_MODAL'}

def register():
    bpy.utils.register_class(ModalOperator)

def unregister():
    bpy.utils.unregister_class(ModalOperator)

if __name__ == "__main__":
    register()

    # test call
    bpy.ops.object.modal_operator('INVOKE_DEFAULT')
</code>
You can then add your operator to your panel
Comment: Thats good, however its too 'free'. I want a set number for it to rotate so that its more realistic. For example the most the flaps can move is I think 40 Degrees so I want to have a button that says: Flaps, 10,20,30,40. Then you would be able to press each one and the bone controlling the flap would rotate x about of degrees.