Can we find out who has developed the app by looking on the signature?

Question: Is it possible that the published app is not signed by its developer andd if yes, How can we find out who is the app developer?
Answer: Yes it's possible, you can check by unzipping the APK, finding the META-INF/CERT.RSA file which contains the developer's public key and using the command openssl pkcs7 -in /path/to/extracted/apk/META-INF/CERT.RSA -inform DER -print.
For more info have a look at the first section of this link: https://www.evilsocket.net/2017/04/27/Android-Applications-Reversing-101/.
Comment: The way you describe only works for APKs that are signed with the old v1 signature scheme. For APKs that are only signed using v2 or v3 signature scheme you need `apksigner` tool for the Android SDK. See [this answer](https://android.stackexchange.com/a/218161/2241) how to to use apksigner to verify the issuer of an APK file.


Why do we think the graviton is not the photon?

Question: Why couldn't the photon be the graviton?  How sure are we that the photon could not fill the role of gravitons?
Comment: Let me turn the question around. How could gravity and electromagnetism be the same thing, against all evidence?
Comment: @my2cts Light shares many characteristics with gravity, like its speed being independent of wavelength/amplitude, traveling at c, having a 0 electric charge, having spin, and being massless/timeless. We do not have a theory of quantum gravity and specifically we do not have a theory of quantum spacetime. The electromagnetic aspect of light may not make it a leading graviton candidate, but perhaps the photon's spin or other physical properties could allow for the photon's replacement of the graviton as well as bridge quantum gravity with quantum spacetime.
Answer: Briefly, because the photon is a spin 1 boson and the graviton is spin 2 boson, so they can not be the same particle.  If the photon was the particle responsible for gravitation, then the classical limit of the theory would not be general relativity or anything like it.  And yet we have a great deal of evidence  that GR works in practice, extremely well, as a classical theory of gravity.
Comment: You can make this answer much better, and more self-contained if you explain what it means for a photon to have spin 1 or how we know it has spin 1, and why we know that a graviton would have spin 2.  For example, where are the three spin states for a photon?  There are only two polarization states ,,,
Comment: @garyp: yes, I think it would make it a better answer.  But (a) I'm not sure I'm competent to explain some of this (or even that I understand it any more: I think I do, but a lot of my memory of physics has been replaced by useless facts about now-obsolete computers), and (b) some of that would make it a very large answer I think.
Comment: @garyp The nature of spin for massless particles is already discussed elsewhere on our site, see https://physics.stackexchange.com/q/46643/50583
Answer: The photon does not have the properties required of a graviton, but the question in the form given by @my2cts does have an answer

How could gravity and electromagnetism be the same thing?

When I was still at school I was introduced to special relativity in a public lecture by Hermann Bondi at York university. Bondi made use of the $k$-calculus, as used in his book Relativity and Common Sense, and placed great emphasis on the fact that Minkowski geometry is determined by the process of photon exchange, described explicitly in the radar method, but which is also implicit in quantum electrodynamics, and is the process underlying electromagnetism, and with it the physical structure of everything we observe in our immediate environment (including the structure of rulers).
At the end of the lecture questions were taken and someone asked "What would be the implication if the reflection of light in radar were not instantaneous?". Bondi replied "Ah, that is the start of general relativity". At the time, I took it seriously, but I have never found a trace of this idea in the literature. I have been forced to conclude that Bondi was just giving an off-the-cuff answer. Nonetheless I still thought it was correct. Later, when I had studied quantum electrodynamics and learned that instantaneous reflection is actually not possible (it would require a 4-node vertex, and failure to exclude it from the integrations is the source of divergence problems in qed) I managed to complete the argument to show that gravity is actually a perturbation to geometry required by a rigorous treatment of quantum electrodynamics. I have given a treatment Mathematical Implications of Relationism and in my books (see profile).


Why do things float in space, though the gravity of our star is always present?

Question: In the solar system, things float around. We are so certain that the gravity of our sun exists. Still, why does that gravity not influence satellites and other objects there?
Our solar system is also orbiting the center of our galaxy, and the gravity of our black hole, but still many objects float around. I wonder why.
Comment: Things don't float. They fall and miss the ground.
Comment: It's not clear what you mean by "float". Are you asking why there's "weightlessness" in inertial scenarios such as a space station (or in an elevator where the cable has snapped)? Or are you asking why the Earth and all the other things orbiting the Sun don't fall into the Sun, and why the Sun doesn't fall into the SMBH at the centre of our galaxy?
Comment: @rghome Isn't that the HHGttG's definition of "flying"?
Comment: @Barmar tell that to the whale ...
Comment: [Obligatory xkcd explanation.](https://what-if.xkcd.com/58/)
Comment: @Barmar HHGttG's "flying" was basically a description of extremely low-Earth orbit.
Answer: It is not true that "objects float around" in the solar system.
Perhaps you have seen video from the space station, and you can see things floating. This is not because there is no gravity, but because everything in the space station going at the same speed in the same direction. This makes it look as if things are floating. In fact the space station and everything in it, is moving at about 7km per second around the Earth.
The Earth and everything on it is is also moving at 30 km/s around the sun. The satellites around the Earth are also affected by the sun's gravity, but because they are affect the same as the Earth, they are also moving at about 30km/s around the sun. If two things are moving at the same speed and in the same direction, it will look as if they are floating. In fact they are "whizzing".
The Sun, Earth and satellites are also whizzing around in the gravity of the galaxy.  The black hole is only a very small part of this; most of the gravity of the galaxy is in the dark matter that we can't see.  But we don't feel this pull because the Sun, Earth, the satellites and you are all being pulled at the same time.
Comment: You could add that not only is everything moving at the same speed in the same direction but everything is also subject to (almost exactly -- there are tidal forces within e.g. the space station) the same acceleration. The OP asks essentially "where is all the gravity that's supposed to suck us in !?" I'd answer "it tries, it tries, but we are on trajectories which -- even though we are constantly being pulled toward the sun -- fail to intersect with the sun (or the galactic center). Everything that was on less lucky trajectories *has indeed* been sucked in long ago so it's gone."
Comment: @CedricH. ["And wow! Hey! What's this thing suddenly coming towards me very fast? Very very fast. So big and flat and round, it needs a big wide sounding name like … ow … ound … round … ground! That's it! That's a good name – ground!"](https://www.goodreads.com/quotes/198068-another-thing-that-got-forgotten-was-the-fact-that-against) ;-)
Comment: @PeterA.Schneider I would add that, would we be on such a trajectory, it would also appear to us that we are "floating around", just that this wouldn't last very long.
Comment: @CedricH. Indeed, skydiving videos with multiple skydivers is another good example of "floating around" despite strong gravity. Imagine it like that, except you fall forever and there is no atmosphere.
Comment: The occasional odd leftover like [Shoemaker-Levy](https://en.wikipedia.org/wiki/Comet_Shoemaker%E2%80%93Levy_9) notwithstanding.
Answer: To help with James K's excellent answer, a visual representation might help. Let's look at a thought experiment - Newton's Cannonball.
Let's say you have a cannon, high enough that it's being held above Earth's atmosphere.
You fire it, and it falls to Earth a little ways away ("D" in the below diagram).
You fire another one with more power so it's moving quicker, so that it falls to Earth farther away. ("E" in the below diagram)

Eventually, you fire a cannonball with such extreme velocity, that it's "falling" around the Earth fast enough that it never reaches the ground.
This is orbit. Orbit isn't necessarily being really high up and moving slowly. More often than not, orbit is going sideways fast enough that you're falling without losing height.
So, why on places like the ISS, does it look like things are just floating around? Let's quickly go back to the cannonball.
Imagine the cannon fires two cannonballs at the same time, both going fast enough to be in orbit. These cannonballs are going blisteringly fast... but they were fired at the same time, going the same speed, so they stay together. If you can imagine being one of the cannonballs, the other cannonball would look like it's just floating next to you as you fly around the Earth. This is because, relative to each other, the cannonballs have next to no relative velocity.
The ISS, similarly, is traveling about 7.66 km/s, or around 27,600 km/h (about 17,150 miles per hour for those using imperial measurements). It's going fast. But when you're on there, everything is going the same speed, because you're all on the ISS together.
So if you let go of a pen on the ISS, it's still traveling the same speed as you - around 27,600 km/h. But because it's going the same speed as you, relative to you it just looks like it's floating.
Earth isn't just floating in orbit around the Sun, it's in orbit at (on average) 107,000 km/h (or 67,000 miles per hour).
Our Solar System isn't just floating around the center of our galaxy, it's in orbit at around 828,000 km/h (or around 514,500 miles per hour).
These are all hard to comprehend speeds - we can all agree though, that this isn't just floating around. Things are moving fast.
Things can appear to be just "floating" because their relative velocity to the observer is small. But I hope this all gives an explanation of how just because something appears to be slowly floating around, that doesn't mean it's not still moving fast from a different point of view.
Answer: Ok, gotta quote XKCD on this.
This is not how space works:

This is:

Gravity in low Earth orbit is almost as strong as gravity on the surface. The Space Station hasn't escaped Earth's gravity at all; it's experiencing about 90% the pull that we feel on the surface.
To avoid falling back into the atmosphere, you have to go sideways really, really fast.

The reason things in space tend to stay in space, or why things "float" in the international space station is because they're going so fast gravity doesn't do anything more than keep those objects moving around the planet: the parabolic trajectory that all falling objects have is so wide that it misses the horizon and comes back around again. Aka, orbit. As the space station and all of its contents are moving at the same speed, and are in constant in free fall, things appear to float: there's no object at rest for things to fall towards; everything is falling and everything is falling at the same speed, all the time.
If the ISS had an arm long enough1 and someone put something perfectly still in the center of the space at the far end, that object wouldn't stay there. It would be ever so slightly off the orbital path that the station would either catch up to it, or fall away from it. But it would be very, very slow. And it would happen because the ISS as a whole and the "floating object" would be in slightly different, intersecting, orbits.

Still, why does that gravity not influence satellites and other objects there.

It does. It just isn't very strong. Gravity falls off at an inverse-square relationship with distance, just like light does. Except that gravity is way way weaker of a force than electromagnetism is ("no its not, I can feel the Earth right now!" Yes, and the Earth is a few trillion-trillion times heavier than you are, how about a table? Can you feel the table's gravity?). The gravitational acceleration towards the sun is on the order of about 0.005m/s2 (and that's still 50 million times greater than the gravitational pull from all the spiders everywhere).

Technically this is already true, just that the effect is so subtle I'm not sure you'd see it in timespans less than "days." In either case, my google fu isn't strong enough to find any videos of such an experiment.
Comment: @PM2Ring True enough. I was simplifying things so it was easier to understand.
Comment: Good answer, except the trajectory of a falling body is actually elliptical, although we can approximate it as parabolic when the change in altitude is small enough to neglect the variation in the strength of gravity. See the answer [here](https://physics.stackexchange.com/q/332679/123208), and John Rennie's comment on the question. Of course, at the altitude of the ISS, the gravity is only a little bit less than what it is at sea level, but that's enough to affect the geometry of the trajectory.
Answer: The real answer is that, locally (strictly speaking, in an infinitesimal region), gravity is not a thing. Whatever your movement is relatively to earth or the sun (even without going "fast to the side" as previously stated), you won't feel any gravity in a local experiment. Even when forces enter into account (like air friction or the reaction of the ground), you can't say without looking at the window if you're act on by gravity or inertia coming from, say, thrusters from your rocket.
This is the equivalence principle, the one responsible for the miracle that astronauts in the ISS and the ISS fall at the same rate, leaving astronauts weightless, in Newton's theory, through the dubious force = mass x acceleration and gravitational force = mass x gravity field, hence m a = m g, so a = g for any mass.
Newton himself knew that the strict equality between inertial and gravitational masses for any body, whatever its mass, composition or whatever, could not come from something random. This laid the groung for general relativity.
Comment: Well, try telling that to a brick suspended above your head.
Comment: @Strawberry If the rope breaks, I will be accelerating towards it and it won't anymore, so at some point I will hit it with my head. ;)


Particle in a 2d box, using de broglie wavelength to find momentum of the particle

Question: Consider a proton in a 2-dimensional infinite potential box with widths, L and K.
a) Using de Broglie wavelength, find the momentum of the particle.
I find some online sources that finds the energy (not momentum) using the wavefunction and seperation of variables. But the question clearly states that we should find the momentum using the de Broglie wavelength
I am a bit confused actually. How can we find the momentum just using the wavelength ?
If the box was one dimensional, the momentum could be expressed as $p=hn/2L$
since we have 2 dimension we will have 2 momentum component ?
Can I express my solution as $p=p_x+p_y=hn/2K+hm/2L$ ?
I am thinking that this is wrong. But also thinking about what question asks, I get confused
Thanks.
Answer: Momentum is a vector. The norm is given by $p=\sqrt{p_x^2+p_y^2}$.
Comment: So I just have to take the norm of it ? And my answer is true ??


Transfer RAID drives from one NAS to another?

Question: My Patriot Javelin S4 NAS is pretty slow. I'm thinking about getting a new one, but I have about 7TB of data spread out across four 3TB drives in RAID 5 format. I don't want to have to buy more hard disks and let it transfer for multiple days. If I just plop the drives into a new NAS, will it understand the RAID format of the other Patriot Javelin S4 NAS? Is it standardized?
Answer: Shorter answer.
In short, no; you can't just pop the drives out of one RAID enclosure and pop them in another RAID enclosure and expect it to just work.
RAID array setups are not really standardized and the way each manufacturer—and even different RAID array models from the same manufacturer—deals with RAID metadata varies greatly. If that metadata cannot be read or is in an unexpected format, the new RAID device will simply see those old RAID drives as blank drives that need to be "wiped" before use.
Longer answer.
As explained in detail in this answer here on Server Fault, if the RAID systems are from different manufacturers the chances of simply reinstalling the drives from one RAID setup to another won't work.
You could potentially do drive a transplant like this when using a RAID setup from the same manufacturer, but that is still not really guaranteed because one manufacturer's RAID model could use a different RAID subsystem than another model.
That said, such transplants might have more success in higher-end enterprise-level RAID setups but there is still that "Might, maybe, who knows?" factor that could only be confirmed by the manufacturer themselves.


What do left handed F-16 pilots do about the right side stick?

Question: I was just watching a video about the Thunderbirds and Blue Angels doing their city fly overs and realized that the F-16 has a right hand side stick, which begs the question "what do left handed F-16 pilots do about it?" Adapt? Not get selected for that aircraft? These and other dumb questions for you
Comment: This has been asked before, search...
Comment: Any single-seat aircraft only has the throttle(s) on the left; none have them on both the left and the right.  All airliners have throttles only in the center.  This is an "every aircraft" issue, not an "F-16" issue.
Answer: It does not truly matter what hand the "stick" is in. It matters how you were trained. It matters to what you have become accustomed.
Case in point...
In general, the pilot in command of a side-by-side pilot aircraft sits in the left seat. This is the seat in which most people begin their initial pilot training. You will typically control the control yoke with your left hand while manipulating the throttle, mixture, propeller control, radios and avionics with your right hand. When you advance to being a Certificated Flight Instructor, you will move to the right seat. In the right seat, you will you will control the control yoke with your right hand while your left hand does everything else. If you go on to become a captain in an airline, you will move back to the left seat.
If the same pilot starts training in a helicopter, the pilot in command seat is typically on the right side. You would reverse again which hand controls what.
Your training for the particular aircraft and position you fill will dictate how you operate. Not with which hand you are more dominant. Both right-handed and left-handed pilots fly their respective aircraft the same way. They train for it.


How Thread uses software to protect datastructure

Question: Hii ALL,
         I started reading about Threads and came to know about Thread uses software and Process uses hardware to protect datastructure...But could anyone elaborate this fact more??
Answer: In Linux both threads & process are same, only difference between them sharing of Virtual memory. Threads run in address space of process. Threads also have a associated task_struct.


Can travelling alone for a short period of time to the US trigger red flags at the border?

Question: I am travelling solo for only week from the EU to NYC. I was looking at some questions on this website and others and it seems like that solo travelers often get questioned more extensively than others. Can travelling alone for a one week trip to NYC from EU trigger red flags at the border?
Comment: Why would you think so ? I have done the same and the border agent was least bothered about it other than my itinerary.
Comment: I travelled alone for one week from Europe to the US and the only thing the asked me at the immigration was the purpose of my visit, nothing else.
Comment: Travelling alone for a week is extremely common: most business travel is like that
Answer: Anything can trigger red flags at the borders but if your paper work is in order, you do not have to fear the interview.
There is no reason to expect problems at the border when traveling from Europe and having a return ticket and a good reason to return home.
One reason they interview young people traveling alone is that those sometimes cross a border to work illegally in the country they travel to. So the officers will ask questions that will show whether that is a real risk with this person traveling.
But the border officers would ask you the same questions if you came into the country from an intercontinental flight or when traveling with a group of people which looks like they have been just joined up for crossing border purposes.
Be prepared, have a copy of your flight itinerary near at hand in your (hand) luggage and tell the truth on all questions, just no more than they ask for.
And unless you expect to break the rules, you will be OK.
No links, as this is a personal experience answer, been across that border traveling alone as a young adult, in a train with a lot of young people and the only one that was interviewed long (and likely denied entry into Canada) had a lot of things that triggered the 'might stay for illegal work' sensors. She was US citizen, not a foreign tourist to the US and Canada.
Answer: NO, traveling solo is not in itself suspicious.  If it were, I and many here would be on every watch list worldwide. ;)
I would suspect thought that entry for elicit purposes is attempted more often by solo travelers hence a perceptible or non-perceptible level of extra scrutiny.
This concern should in no way impact you travel plans provided you know of no other issues that would make your entry suspicious.


Can't boot into Recovery mode. Can't get past HP logo

Question: Windows 8 HP. It goes directly into the HP logo. holding shift when restarting does nothing. Key combinations do nothing. How do you recover from this?
Answer: Have you tried the instructions of HP?

Turn off the computer.
Disconnect all connected devices and cables such as Personal Media Drives, USB drives, printers, and faxes. Remove media from internal
  drives, and remove any recently added internal hardware. Do not
  disconnect the monitor, keyboard, mouse, or power cord .
Turn on the computer and repeatedly press the F11 key, about once every second, until the Choose your keyboard layout screen appears,
  then follow these instructions:
  a) Click to select the keyboard layout.
  b) The computer restarts. If the recovery partition on the hard disk drive is
   functioning correctly, the Choose an Option screen appears. Click Troubleshoot .
Answer: If @VMai's answer doesn't work for you (it might, it might not - it's a perfectly good answer if your disk is not hosed) you recover by buying and installing a new hard disk, or having HP do that if a warranty still applies. Then you either reinstall from your backups or learn why you should have backups to restore from.
You say key combinations are not working - does that include the usual F2 (sometimes another Fkey) into BIOS setup? If you go in there and there are no hard disks listed, you can pray that a cable got loose, but you're more likely looking at a very dead hard disk.
If you cannot get into BIOS setup, there are fundamental problems with the computer (good news being this increases the odds you can get things back from your hard disk)
Answer: Have you tried booting into safe mode or last known configuaration?
You can tried accessing those by pressing F8 many times at booting state.
Comment: Turns out it's F11, not F8 as other laptop brands.
Answer: Remove the sata cables from the HDD and CD then try again - If this works either ther cd or hdd is at fault - If still nothing then pop the battery out (CR2032 flat mounted) remove power cable and wait 5 mins. Pop the battery back in and switch on. This should reset the bios and enable you to access the bios.


In Windows 10, how do you make icon text bold on the desktop. The size is fine

Question: I want to make the text bold beneath my desktop icons. I have Windows 10.  The size is fine.
Comment: Microsoft removed that ability in the creators update.  You can get 3rd party apps to do.  One of them in WinAero tweaker. https://winaero.com/download.php?view.1796
Comment: @essjae This should be an answer.
Answer: Microsoft removed the ability to change the icon text properties in the Creator's Update of Windows 10, which is version 1703.
There are third party apps are available to make these changes.
WinAero Tweaker is free and allows you to do this and more.
https://winaero.com/download.php?view.1796
It can be used without installing.
On the first page you should see Advanced Appearance Settings, under that click Icons.
Click Change font... and you'll get your font choices and styles, click to choose what you want and then click OK to apply the changes.

Instead of downvoting, please leave a comment on how the answer can be improved.


What is difference between filterable with result and Filterable with no result in magento Attributes

Question: Basically why magento uses filterable with result and filterable with no result in magento attribute.
What is the benefit of that attribute if that is  Filterable with no result.
Basically, I created more attributes in magento and all are filterable with result.
Now I want to do some changes in my attributes Because its not indexing properly.
I created 300 attributes in magento.Now i need to change this because on flat product its, not indexing.
Comment: when we use the option, "filterable with results", then we will get only the attribute- options available for the product . Similarly when use the option, "filterable with no results" , then we will get all the attribute-options.
Comment: @ Ajitha Ms Can You briefly explain in answer.
Answer: use for layered navigation.   Filterable (with results) means that links will only appear for values where the number of results (the number in parentheses next to each value) is greater than zero. Filterable (no results) means that links will appear for all values, whether the number of results is zero or greater.


Red and Green Ball Games

Question: Suppose we have a bag which has 1 red ball and N green balls. We randomly draw a ball from the bag: if this is red, we do not put it back and take one green ball from the bag and discard it too; if this is green, we put it back and put one red ball and one green ball into the bag. This will guarantee that we will always have N-1 more green balls than red balls every time. The game will stop when there are no red balls left. What's the probability that the game will stop?
Comment: what do you mean by "we put it and one green ball away" ?
Comment: This seems like some variant of a [Pólya urn model](https://en.m.wikipedia.org/wiki/P%C3%B3lya_urn_model)
Comment: Draw a quick sketch of the moves using (Green, Red) counts as Cartesian coordinates: this will immediately show the problem is a random walk along the line Green = Red + N - 1.  Choose a coordinate to parameterize that -- Red will do nicely -- and proceed to solve this simplified but equivalent version of the problem.
Answer: Partial answer:
If you rephrase your problem it becomes much easier to comprehend. Here is how I would write it down:

Suppose we have a bag which has x red balls and x+N green balls.
Each turn we randomly draw a ball from the bag:

If this is red, we discard it along with another green ball from the bag.
Now we will have x-1 red balls and x+N-1 green balls in the bag.

If this is green, we put it back and put one red ball and one green ball into the bag.
Now we will have x+1 red balls and x+N+1 green balls in the bag.

This will guarantee that we will always have N more green balls than red balls every time. In this alternative representation we have a variable $x$, with probability $\frac{x}{x+x+N}$ it decreases by 1 and with probability $\frac{x+N}{x+x+N}$ it increases by 1.
The game will stop when there are no red balls left or when $x=0$. What's the probability that the game will stop of we start with $x = 1$?
This situation is similar to The Dead Drunk Man but the probability of a step is not exactly 0.5 (only it's limit for $x \to \infty$) and variable instead.

This you might solve by using some sort of relation between the probabilities to stop when $x = 2$, $x = 3$, etc.
Let's define $P(k,m)$ be the probability that the game stops if we start with $k$ red balls and $k+m$ green balls.
If you are at some value $k$ then you have a possibility that you increase or decrease. The number $k$. And the probability to stop will be based on the values in those next cases.
$$P(k,m) = \frac{k}{2k+m} P(k-1,m) + \frac{k+m}{2k+m} P(k+1,m)$$
We can fill in $P(0,m) = 1$ but that is not enough to solve it. This is similar to the frog problem described here: The frog problem with negative steps That problem could be solved by using a difference $Q(k,m) = P(k,m) - P(k-1,m)$ (see fuether below) or by having a additional stopping condition at the other end ($k=0$ and also $k=K$) and let take the limit when that condition goes towards infinity $K \to \infty$.
You might possibly solve this as a diffusion problem or Markov chain with an absorbing boundary at $k=0$.

Working out the problem with the difference
In this case we might do something like define $$P(k,m)-P(k-1,m) = \frac{k+m}{2k+m} \left(P(k+1,m) - P(k-1,m) \right)$$
And with $Q(k,m) = P(k,m) - P(k-1,m)$
$$ Q(k+1,m) = \frac{k}{k+m} Q(k,m)$$
And if we define $Q_1 = Q(1,m)$, then
$$ Q(k,m) = Q_1 \prod_{i = 1}^k \frac{i-1}{i+m-1} = Q_1 {k-1+m \choose k-1}^{-1}$$
and $$P(k,m) = 1+\sum_{i=1}^k Q(k,m) = 1+Q_1 \sum_{i=0}^{k-1}  {i+m \choose i}^{-1} = 1+Q_1 \frac{m\left(1- {k+m \choose k+1}^{-1}\right)}{m-1 }$$
(I am not sure about the last step, but Wolfram alpha tells this)
The limit of this is $\frac{m+1}{m-1}$ and because $P(k,m) \in [0,1]$ we have a limit for $Q_1 \geq -\frac{m-1}{m+1}$ and $$P(1,m) \geq \frac{2}{m+1}$$.
A special case is $m = 1$ (we start with 1 additional green ball), then the lower limit equals one and so then the probability to return is 1. For other cases $m > 2$, I am not sure.
Comment: A relevant step in the frog problem was to show that the mean distance from the end is a decreasing function. And as a consequence the probability to remain in the game decreases to zero. This problem is more difficult because there are many positions for which the distance on average increases. In that frog problem there was only one position where the position increases on average, and it was only required to think two steps ahead to show that every two steps the mean position decreases by a factor 1/6. I imagine a similar strategy here but one will have to compute $N$ steps ahead.
Comment: Actually the position is an increasing function in every position. It is more likely to get further away from the end than closer. So certainly the probability to finish is not equal to 1.
Comment: Working out the case for N = 1 extra green balls, it appears that the probability to finish is actually one. So the argument in my previous comment was not correct. The mistake is probably that while the position is an increasing function, the difference will eventually approach zero and the probability for an infinite path might approach zero. Also, it is only the *average* position that is increasing, but that doesn't mean that the fraction of the number of paths that do not finish can't approach zero.

Red and Green Ball Games


When do bolts get "saved"?

Question: In playing through the game I'm noticing my bolt counter in the upper right hand corner is reset from time to time but when I go to purchase items from the store the bolt number is much higher. When do the bolts get "banked", and is there a way to find out what my banked bolt amount is?
Comment: I don't think this game is available on any systems aside from the PS3.
Comment: To augment the question I've discovered that you can get your total bolt count by hitting L2 (maybe R2?) on the PS3 controller during gameplay. (Not sure what the equivalent is on other platforms.)
Answer: Bolts get saved (and your current total reset to 0) when a Scanning Minion appears, causing the totals screen to show up.

When do bolts get "saved"?


Where can I find records of old FAA registrations?

Question: I know where to find details for FAA N-Number registrations. But where can I find records and details on older FAA NC, NR, NL, and NX numbers?
Comment: Its entirely possible that they aren't available electronically. Those prefixes were used prior to 1949 and may not have been digitized. You can probably try to request copies of those records through the FAA, but I'm sure it won't be easy, or cheap.
Comment: Resource location is off-topic as defined by the [help center](/help/on-topic).
Answer: NC, NR, NL or NX are not necessarily older aircraft. Any aircraft more than 30 years old can use NC instead of just N.
So, to find the a/c registration you just take out the C.
I own a glider that was built in 1965 so my numbers are NC and 5 digits.
It should be the same for R, L, and X, which are any aircraft that has a restricted, limited or experimental airworthiness certificate can use those letters after the N. See FAR Part 45.22.
Comment: This does not answer my question on where I can find info on these registrations
Comment: The point is that the premise of your question is incorrect. Only NC is for 30 yrs or older aircraft. For all of those registration marks, remove the C, R, L and X and search on that on the FAA web site.


Torsion-free abelian groups which admits infinitely many linear group orders

Question: Let $(G,+)$ be an abelian group and "$<$" be a transitive relation on $G$ such that for every $x,y \in G$ exactly one of $x <y , y<x , x=y$  holds and $x < y \implies x+z < y+z , \forall z \in G$ . Let us call such a relation on $G$ a strict linear group order . Can we characterize all torsion-free abelian groups which admits infinitely many strict linear group orders ? Can we give at least separate necessary and sufficient conditions ?
Answer: Note that any ordering on $G$ induces an ordering on $G\otimes\mathbb{Q}$, by saying $x/n<y/m$ for $n,m\in\mathbb{Z}_+$ iff $mx<ny$.  Conversely, any ordering on $G\otimes\mathbb{Q}$ induces an ordering on $G$ by restriction, and the original order on $G\otimes\mathbb{Q}$ can be recovered from the order on $G$ as above.  So the set of orderings on $G$ is in bijection with the set of orderings on $G\otimes\mathbb{Q}$.
So we may assume $G$ is a $\mathbb{Q}$-vector space.  Now the answer is easy.  If $G$ has dimension $0$ there is only one possible order, and if $G$ has dimension $1$ there are only two possible orders (the usual order on $\mathbb{Q}$ and its reverse).  If $G\cong\mathbb{Q}^2$, it has infinitely many possible orders: for any $q\in\mathbb{Q}$, take the lexicographic order with respect to the basis $(1,0)$ and $(q,1)$.  Explicitly, $(a,b)$ is positive in these orders iff either $a>qb$ or $a=qb$ and $b>0$ (this makes it clear the orders are distinct).  Finally, if $G$ has dimension greater than $2$, choose a two-dimensional subspace $V$ and a complement $W$ so that $G=V\oplus W$.  There are infinitely many orders on $V$, and combining them lexicographically with any order on $W$, we get infinitely many orders on $G$.
Thus a $\mathbb{Q}$-vector space has infinitely many orders iff it has dimension greater than $1$.  It follows that a torsion-free group has infinitely many orders iff it has rank greater than $1$.
Comment: The way you seem to write elements of $G \otimes_{\mathbb Z} \mathbb Q$ ; is it true that $G \otimes_{\mathbb Z} \mathbb Q \cong S^{-1}G $ where $S=\mathbb Z \setminus \{0\}$ ?
Comment: Yes, they are naturally isomorphic.  In general, for any commutative ring $R$, a multiplicatively closed subset $S\subseteq R$, and an $R$-module $M$, there is a natural isomorphism $M\otimes_R S^{-1}R\cong S^{-1}M$.


installed `default-jdk` but there is no `javac`

Question: I have a Debian Unstable VM which I used to package a Java project before. Today, the javac was gone somehow, so I installed default-jdk again. But still, there is no javac.
What could I do?
Answer: Check your $PATH environment variable to check if it contains /usr/lib/java/bin or /usr/lib64/java/bin on x86_64 systems. This variable is usually when you log in set via a shell script that the jdk package installs; it may help to log out and back in again. Check the value of $JAVA_HOME.
If your PATH does contain the path I mentioned, and type javac still doesn't give you anything, then try typing locate bin/javac and see what that returns. You may have to run sudo updatedb or sudo locate -u beforehand, if you just installed the package, so that the slocate database is up do date.
Answer: javac is managed by the alternatives system. /usr/bin/javac is a symbolic link to /etc/alternatives/javac which is a symbolic link to one of the Java compilers you have installed. The default-jdk package depends on openjdk-6-jdk which provides /usr/lib/jvm/java-6-openjdk-i386/bin/javac (on i386). This file is what /etc/alternatives/javac should link to. If it doesn't, run
update-alternatives --config javac

to configure the target of /etc/alternatives/javac interactively, or update-alternatives --auto javac to reset it to its default value.
Comment: I tried running `update-alternatives --config javac`, but it gave me `update-alternatives: error: no alternatives for javac.`. I just created the symlink by hand.


What is a good way to think about and estimate VIX half life?

Question: Would it make sense to run an AR(1) regression to estimate a beta and then estimate the half life as -ln(2)/beta?
Answer: First, we need to start with how to properly interpret the VIX itself and the correct answer might shock many people here. No, it's not an indicator of anticipated realized volatility. It is slightly different.
The most up-to-date commentary on the VIX can be found in a paper by Ian Martin published in the QJE in 2017 here. As a small recap for interested readers, the VIX is computed for the S&P500 index and its formula is a discretization of the theoretical fair value of a variance swap. The idea is that you can get a sense of Q-anticipated realized volatility over the next month by forming a suitably weighted portfolio of options maturing in a month, but over a whole continuum of strikes if the underlying price process is a diffusion. If you allow for jumps, the replication argument fails. In the paper above, Martin shows that the VIX formula actually capture the conditional entropy under Q when you allow for jump. You can express this as an expansion in the conditional cumulants under Q meaning jumps "pollutes" the estimate of future realized Q.
Now that this part is clear, we can talk about the "half-life" of the VIX. I am not sure exactly what you seek to capture here, but I can try to provide some guidance. Setting aside the interpretation for now, it is true that if you model the dynamics of the VIX as an AR(1) process, this is indeed the half-life of the process. Two issues then arise:

Why do you limit yourself to an AR(1)? You can solve for $h$ in $E_t(y_{t+h})=y_t/2$ for other models too. If you want to stick to simple stuff, stay with the class of ARMA models, but check if you can have a better fit with an ARMA(1,1) or using more lags in your autoregression. To be entirely fair, it's possible nonlinear models would fit better, but then you'd have to solve for $h$ numerically in many cases.
Then comes the issue of why you want to do this? The half-life is the point on the impulse response function for which the response has been halved, so you're capturing a sort of belief persistance with regards to the anticipations of investors, under Q, of the conditional entropy of returns. How is that going to be useful exactly? It might be useful, but you probably see how much of a mouthful it is.


For a polynomial $p(x)$ of odd degree, how many real roots does $(p(x))^2$ have?

Question: I know that an odd degree polynomial $p(x)$ has at least one real root; what about $(p(x))^2$? It is even, so can it not possess any real roots or have two real roots? Also, let $p(x)$ be an odd degree polynomial and let $q(x) = (p(x))^2 + 2p(x) − 2$. How many real roots does $q(x)$ possess?
Comment: $p(x_0)=0\implies p(x_0)^2=0$
Answer: The polynomial $(p(x))^2$ will have all the same roots, and only the roots that $p (x) $ possesses. If you have for some $x_0$, $p (x_0)=0$, then for $(p (x _0))^2$ just substitute in what you know about $p (x_0) $ to get that it equals 0 also.
The second part of your question is much more difficult and there's nothing that I know of that can generally be said about that (but I don't know everything; just know it's a lot more complicated :) ).
Comment: so is it like the roots of p(x)^2 has all roots of p(x) but with multiplicity 2
Comment: Yes. Remember exponents distribute over multiplication. So if you had $p $ in factored form you can easily see that $p^2$ has all the same factors but with double the multiplicity.
Answer: The answer here is yes, this always holds. Just think of it this way: if $p(x) =0$ for some $a$ then $p(a)^2 = 0^2 = 0$.  Your second question should fall to a similar analysis!


Should my first trip be to the country which issued my Schengen Visa?

Question: In case I get a multiple-entry Schengen visa in one of the embassies in Ukraine, Kyiv, should my first trip be to the country that issued the visa?
Any there any requirements of the sort? Does this condition vary depending on the embassy that issued the visa?
What are the possible consequences on not visiting that country first?
Does it somehow depend on the country where the embassy is (i.e. non-Schengen and not EU members)?
Comment: Other related question: http://travel.stackexchange.com/questions/9646/does-a-multiple-entry-schengen-visa-allow-visiting-other-schengen-countries-late
Answer: Your first port of entry does NOT need to be the country which issued you a Schengen visa. When deciding which country to apply for a visa, this is determined by which country you're spending the most time according to your filed itinerary. Once the visa is issued, it does not matter what country is your point of entry. Technically, you should also stick to your itinerary as filed but I don't think this is checked at any point.
Comment: *Technically, you should also stick to your itinerary as filed but I don't think this is checked at any point*. Bad advice. There **are** reports of travelers  penalized when the trip didn't match the declared itinerary. E.g. Finland border guards find the hotel bill from Germany on return from Europe and then future visa applications to Finland consulate are denied (for visa abuse).
Comment: Where can I find those reports?
Answer: Practically speaking, while most Schengen countries are quite lax about visas, some are extremely picky.
For example, there are lots of reports that the Finnish consulate in St. Petersburg systematically reprimands local applicants for 'illegitimate' usage of Finnish ME visas for traveling to Europe instead of Finland - sometimes by issuing a warning, sometimes by refusing new visa applications. A number of cases have been reported when holders of Finnish visas were turned back at the border and their visas cancelled when the guards found evidence of their plans to travel further than Finland.
What it all boils down to, is: attitudes vary.
Comment: As I've said in the other answer, I've also encountered reports about cases when the border guards discover the trip's real destination *at the end of the trip*. Of course, they still let the culprits out of the Schengen zone, but they create an incident report that complicates future visa applications and border crossings.
Comment: An excellent real-world report on the real-world Schengen scene.
Comment: @pranavk, Fairly easy if you are departing from Finland with a fresh tan on your body and a Scuba apparatus and an assortment of Spanish cured meats in your baggage.
Comment: @ach Haha. I am in a similar situation where I've to go to Rome right after arriving in Paris but I don't want to let the French know about it because my visa is issued by French. I would have flight tickets to Rome but I don't think they would search me for the tickets.
Comment: @ilya n. How would they find out the real destination as long as port of exit is same as filed in the visa application?
Answer: As others have already explained, there is no general requirement to enter through the country that issued the visa.
In fact, if you are travelling to several Schengen countries at once, you are required to apply to the country that will be your main destination and might therefore very well be different from the one you will enter first. So if you go for a week to Italy, a month to France and then a week to Spain, you would be entering Italy and visiting Spain on a visa issued by the French consulate. It's not merely something you can do in practice but is technically not allowed, that's precisely how the system is supposed to work.
By contrast, the fact that you are required to apply to a specific country also tells you that you are not really supposed to use a visa issued by a Schengen country to go wherever you please (otherwise what would be the meaning of this requirement?)
Beyond that, you ought to make a distinction between several scenarios:

You have a multiple-entry visa. Those are intended to cover multiple trips and multiple purposes, so going elsewhere is generally fine.

The best is to first use the visa to go to the country that issued it. After all, it's supposed to be a country you have reasons to visit frequently. Having the stamps to document that also shows that your visa is legit and that you really do travel to this country regularly.
If you have never been to this country, it's not forbidden to use your multiple-entry visa but it could raise some suspicion that you didn't have a good reason to get one in the first place. See also Can I use my Schengen visa for a completely different purpose and entry point?
In practice, you might not even be asked about it but it's a possibility. Unfortunately, this system is frequently being abused, which is perhaps the reason for the backlash described by Andrey Chernyakhovskiy.
Also when comes the time to renew the visa, it makes sense that not having been to the country that issued it at all should raise questions. You are not supposed to get a visa from one country as a convenient way to visit other countries, you are supposed to apply to a country you really intend to visit at some point.

You have a single entry visa. It has been issued for a specific trip, for which you had to submit an itinerary so going elsewhere than planned is not recommended.

If you are following your itinerary, then it's obviously fine. It can mean that you are entering the Schengen area through a given country with a visa issued by another one (as in my Italy/France/Spain example) but that's the way the Schengen system is supposed to work. No issues here.
If you added some last-minute changes to your itinerary (say add a short visit to another country at the beginning of your trip), you will usually be fine. To the best of my knowledge, there is nothing that would explicitly disallow that in the regulation. You might however get some questions when crossing the border and some countries appear to overreact to small changes so if you want to be careful, it's always best to stick to your itinerary. See Can I change my route and hotel reservation after getting a Schengen visa?
If you are using your single-entry visa for a completely different purpose, you are in a bit of a grey area. Deliberately applying to a country you do not intend to visit because it's easier/more convenient is definitely forbidden. If found out, it would be a valid ground to annul the visa, which means being forced to return where you came from immediately and more trouble getting another Schengen visa in the future. On the other hand, many people do get away with it and if you had a genuine change of circumstances, you might legitimately find yourself in this situation (see Use of unused Schengen visa to travel to Switzerland).
At the end of the day, border guards have some discretion here. Using a single-entry visa for another trip is not unambiguously allowed nor is explicitly forbidden as such. Depending on whether you still meet the conditions or whether it seems you deliberately committed fraud, your visa could be annulled or revoked or you could simply be denied entry. It's also possible to have luck and to be allowed to continue your trip but it's clearly a risk.

If you consider doing some changes to your itinerary and are concerned about the consequences, one approach to preempt any objection is to contact the relevant consulate and ask what you should do. Most likely, they will tell you they can't issue a new visa and you can use the current one but the upside for you is that you can print their answer and have it ready to demonstrate your good faith if some border guard asks about it during your trip (do not volunteer anything if it does not come up). See also Use of unused Schengen visa to travel to Switzerland for an example.
Comment: About last point of annuling visa, to avoid doubts that border officials may have (because they have some discritionality here) in case you're entrying Schengen through a different country of the issuing one *because your country destination does not have a consulate in your country* and thus you applied on a different schengen consulate acting as *Representing the other schengen state*, then make sure the issuing country does not forget to add that info to your visa sticker, it would be "R/TWO LETTER COUNTRY CODE OF THE REPRESENTED COUNTRY"..
Comment: .. so eg. "R/SE" should read on a visa issued by Consulate of Spain in Santo Domingo when that visa was done representing Sweden, which is a real case as Spain represents Sweden and other schengen countries that don't have consulates in Dominican Republic. If the border official does not see this info on the sticker he just sees a "dominican national flying to Sweden on a Spanish visa" and while this is technically legal he may see a migration risk here and deny you (because of the discretionality they have).
Answer: No, but...
As far as my knowledge goes, (and it goes far because I am staying in UK on a visa, so Europe's kinda' my backyard!), when applying for the visa you just have to think one thing:

Which is going to be the most important and longest stay destination of your trip?

That pretty much answers your question. Having said that, common sense prevails from that point onwards. If more than one destination fits the bill, and one of them also happens to be the intended port of entry, then that's where you apply. If even this doesn't solve the dilemma, or things change at the last minute, don't worry, as long as you have a plausible story for applying, staying and dining in three different countries, border control will let you off!
Some others on the wild wild web who think the same:

http://secure.hospitalityclub.org/hc/forum.php?action=showpost&IP=58085

Plainly put; it makes sense that if you're arriving in Frankfurt,
  you'd go to the German Embassy for a Schengen visa. Having said that,
  and when you've got a visa: plans could change and you could decide to
  arrive in Greece, for example. They don't punish you for doing that!

http://answers.yahoo.com/question/index?qid=20100603202959AAUJbTX

Your port of entry can be anywhere in the Schengen zone. The
  prerequisite of obtaining a Schengen visa via a particular country,
  say France, is that France would be the main destination (i.e. where
  you spend the most amount of time) and it is only if the amount of
  time is equal with one or more Schengen countries that then it would
  be the port of entry.

http://www.theschengenoffice.com/explained/schengen_visa.html

Generally speaking with a Schengen visa, you may enter one country and
  travel freely throughout the Schengen region during the validity of
  the visa. Internal border controls are limited with no or few stops
  and checks.
Answer: There is a corner case here not covered by the previous answers where it's NOT acceptable to arrive in a different member state...

A visa shall in principle be annulled by the competent authorities of the Member State which issued it. A visa may be annulled by the competent authorities of another Member State, in which case the authorities of the Member State that issued the visa shall be informed of such annulment.

Example: A Russian national holding a single entry visa issued by the Italian consulate in Moscow arrives at Brussels airport (Belgium) and has no proof of a connecting flight from Brussels to an Italian airport.
It may be assumed that this visa was fraudulently obtained and the Belgian authorities should annul the visa and inform the Italian authorities of this.

Source: Schengen Handbook
If the person has a single entry Schengen visa...
====> AND the person arrives in a different member state than the one that issued his visa...
========> AND the person does not have a connecting flight to the member state that issued his visa...
THEN his visa will be annulled by the officials of the member state he arrived in.
Source:  Article 34 of the Visa Code
(also exemplified in the handbook), which says in part...

A visa shall be annulled where it becomes evident that the conditions
for issuing it were not met at the time when it was issued, in
particular if there are serious grounds for believing that the visa
was fraudulently obtained. A visa shall in principle be annulled by
the competent authorities of the Member State which issued it. A visa
may be annulled by the competent authorities of another Member State,
in which case the authorities of the Member State that issued the visa
shall be informed of such annulment.
Comment: Does it have to be a connecting flight? Or would any plausible onward transport do it? (eg flying into Barcelona, Schengen visa from France, TGV ticket to Montpellier?)
Comment: On a slightly different example, assume you'd just flown into CDG from outside Schengen, wanting to go to Barcelona. Whether taking the train or flying, in both cases you'll need to clear Schengen entry formalities in Paris. You could well be right on what the French officers will do if you turn up with a Spanish visa in that situation, but it does seem a little strange to me that a CDG-BCN flight is OK, Paris-Barcelona TGV ticket + idea of getting the RER to catch that isn't. May be strange but true though!
Comment: This case is in fact covered in my answer (it's the last of my bullet points) but I don't think you can state with such certainty that the visa *will* positively be cancelled if the person cannot show a (plane) ticket. Planning to arrange transportation locally is perfectly legit and a ticket *leaving* from the other member state should also be perfectly acceptable as evidence. Conversely, having a throw-away ticket can be useful to bluff your way through the border but it does not mean a visa should not be cancelled.
Comment: Various official documents mention transportation tickets as a means to establish a person's intent in different contexts (in particular the handbook's Russian-national-in-Brussels example) but it's never a requirement, certainly not a legally binding one. What matters is whether the border guards think you just lied about your intents to get the visa (and in practice many people get away with it in any case, which also makes this answer inaccurate in another way).
Comment: @GayotFow those handbook examples are far from exhaustive.  They are examples, so they do not cover all possible reasons for taking or refraining from a given course of action.  If the traveler has a bus ticket or even a credible plan to take a road trip to Italy with his friend who lives in Brussels, the officers can admit him.
Comment: Also [here is the proper link to the visa code](http://eur-lex.europa.eu/legal-content/EN/ALL/?uri=CELEX:32009R0810)
Comment: @Gagravarr, the guidance explicitly mentions 'proof of a connecting flight', so I am *interpreting* it as a decision being made airside, i.e., I don't think the passenger would be landed.
Comment: @Gagravarr, thorny area...   incredibly, I have found *another* corner case and am now debating whether or not to update my answer.
Comment: @phoog right, agreed that it's not exhaustive, the answer takes up a corner case not given in the other answers.
Comment: Is this confirmed? Isn't an onward ticket to the actual destination happening few days after than the arrival date enough to prove what's the main destination?
Answer: I had a multiple-entry Schengen visa issued by the German embassy.  My first port of entry by air was Switzerland. I was admitted to enter the Schengen states through that port of entry. I once travelled by road from London to Germany.
I had a German Schengen visa too. My first port of entry was France. I was admitted into the Schengen states through France without being asked for my itinerary.
I think at the port of entry they know that with that visa you are allowed to enter the Schengen states so they will not deny you entry simply because you have sought to enter through a state different from the issuing state. All you need do is explain your circumstances.
Answer: Short answer, No.
I did almost the exact same thing in the past. I had a French long stay visa and entered the Schengen Region thru Amsterdam and then traveled to France via Train.
As long as you have a valid Schengen Visa, you should not have a problem at any Schengen port of entry.
Comment: A long-stay visa is a completely different beast.


Does Naruto consciously control his clones?

Question: I've seen when Kakashi was training Naruto with his elemental affinity that Naruto cannot see what his clone is doing until it is undone. How does he control the clone? Does it move and think like a separate entity? Can it think to try to kill the original?
Answer:
Does it move and think like a separate entity?

Yes, the clones are completely independent, apart from the fact that Naruto can undo any clone he wishes to.
This can be seen when they collaborate and the fact that they need to communicate in order to do so. Note that when Naruto creates them, they know what he knows so he can think of a plan, create the clones, and everybody knows their role in the plan without a need to discuss it—they are still independent.

Can it think to try to kill the original?

Possibly. But seeing as they have a short life and have just been cloned, Naruto would have had to be thinking about that kind of thing himself already in order for a clone to really do that. And of course, since Naruto can undo a clone at will, it would mean that as soon as he senses a threat from a clone he can undo it.
Comment: btw there is a filler episode in the anime, where his clones turn aginst him
Comment: @Vogel612 wasn't that a dream?
Comment: It's also shown multiple times in the anime that when Naruto takes sufficient damage, his clones disappear. I assume this is because he loses concentration, or something similar, so it seems like if a clone tried to kill him, the clone would disappear before doing anything too vital.
Comment: Seeing as Naruto has had schizophrenic tendencies on some parts of the series, based on what you answered, his dark self can manifest in one of his clones. Hmm....
Comment: @iKlsR yeah. forgot that... has been a while and since then i stuffed my brains with programming and a sh*tload of awesome anime ;)


How to increase the size of an existing metal hole in kitchen sink

Question: I want to install a sink soap dispenser but the existing hole in my sink is too small.  From what I've found the universal diameter of the threaded piece that inserts into the hols is 1 inch.  My hols is closer to 3/4 inch.
So, how can I increase the size of an existing metal hole in kitchen sink?
My research so far has led me to using a piece of clamped 2x4 as a guide for a drill bit but I cannot clamp the wood to the sink.
Any ideas?
Answer: You should be able to use a knockout punch.

These are inserted through a pre existing smaller hole, and can cut sheet metal including stainless steel. They come in a range of sizes.

Images and links are illustrative only, not an endorsement of goods or sources.
Comment: You'll need to remove 1/8" all around the perimeter. It will be easiest with a Dremel (or similar tool) and conical composite grinding bit. Not that it will be easy to do....stainless steel sheet is relatively difficult to grind. Use your bit at high speed and hold on tight as it will want to jump once it grabs the metal. Grind gently and don't force the bit into the edge. Good luck!
Comment: @KnobScratcher Sounds like an answer.
Answer: I did exactly this recently using a standard drill, small bits, and a cutoff wheel in a rotary tool (Dremel). I marked the circle and drilled a series of small holes using high-speed steel bits of around 1/8" in size. I then cut between the holes with the cutoff wheel. It leaves a somewhat jagged hole, but it was easy and free and isn't visible once the dispenser is installed anyway.


android design considerations: AsyncTask vs Service (IntentService?)

Question: I'm designing an android app which will need to do the following steps:

user pushes a button or otherwise indicates to "sync data".
sync process will use REST web services to move data to and from the server.
the data will be stored locally in a sqlite database.
the sync process should provide status updates/messages to the UI
the user should not be allowed to wander off to other parts of the application and do more work during the sync process.

The first time the sync process runs, it may take 10-20 minutes.
After the initial sync, less data will be transferred and stored and
I expect the process to take 1-2 minutes or less.
I've been doing a lot of reading about android's AsyncTask and various examples of using a Service ... But I don't fully understand the design considerations and trade-offs of choosing one design over the other.  I currently have my demo project stubbed out using an AsyncTask.  After watching (most of) Developing Android REST client applications:  http://code.google.com/events/io/2010/sessions/developing-RESTful-android-apps.html# I'm left confused the design patterns described here feel overly
complex, perhaps because I just "don't get it" yet.
I come from a java, spring, web and desktop application background.  Thinking and designing in terms of a handheld device is quite new to me. (What happens when the screen layout is changed? What happens when the phone rings while I'm running a sync?)  Taking 2 steps back, if the initial sync IS going to be such a long running process, is there a better way for me to think about the problem->solution, the user experience, the user expectations of an application running on a phone?
Would love to hear from some more experienced android developers out there who have already wrestled with these questions.
Comment: how long(typically) would the sync process take?
Comment: initial synch may take 10-20 minutes b/c of the amount of data that will be pulled down.  after that, the process may take 1-2 minutes or less.
Answer: In my opinion this is the most tricky/hard part of a mainstream/average Android development. For instance on BlackBerry this is IN TIMES easier.
Definitely you need to use a Service.
AsyncTask does not suit, because it is tightly "bound" to your Activity via a Context handle (otherwise you would not be able to update UI of the Activity from your AsyncTask). However an Activity can be killed by OS once the Activity went in background. An example reason of going to background can be an incoming call - user switches to Phone application so your Activity becomes invisible. In this case (depending on the current RAM state) OS may decide to kill one of the background (invisible to the user) activities.
Some devs workaround this by arranging a static stuff for having a long-running actions inside of. Some recommend to use Application instance. This is because static stuff and Application exist while the whole app process exists. However those are incorrect workarounds. Processes in Android are also may be killed when OS decides it is time to. Android OS have its own considerations about what it can kill and in what order. All processes are devided to 5 levels of "killability". Here is the doc where those levels are specified. It is interesting to read there:

Because a process running a service is
  ranked higher than one with background
  activities, an activity that initiates
  a long-running operation might do well
  to start a service for that operation,
  rather than simply spawn a thread —
  particularly if the operation will
  likely outlast the activity. Examples
  of this are playing music in the
  background and uploading a picture
  taken by the camera to a web site.
  Using a service guarantees that the
  operation will have at least "service
  process" priority, regardless of what
  happens to the activity.

Your Activity where users initiate a long-running action should show a ProgressDialog to make sure user does not do anything else while the action is running. The guide is here.
Also, you'd most likely want to use the NotificationManager for notifying the user about your long-running action completion (or failure) if your Activity is currently invisible. Here is the NotificationManager info to start from.
Comment: Just forgot to say `IntentService` is a really nice choice.
Comment: Never the less, it is worth mensionning that communication from activity-to-service is a bit tricky. The separation of UI and network features is quite deep and requires some coding effort as values will have to be passed through serialization, or parcelisation, or via AIDL. http://stackoverflow.com/questions/2463175/how-to-have-android-service-communicate-with-activity
Comment: @riza i see some good programmers around me use EventBus, so it's fully Ok. I'm a bit conservative, so I use LocalBroadcastManager. :)
Comment: Hi,@Arhimed i have a question in the same way? [here is](http://stackoverflow.com/questions/14760507/execute-long-running-operations-on-the-service), could you give me an advice. thanks.
Comment: Hi @Arhimed, dunno if its good or bad, I use [EventBus](https://github.com/greenrobot/EventBus) when in need of activity-service communications
Answer: There are multiple considerations that you must weigh in order to best decide how to approach your situation. It sounds like you need a good comparison between the two approaches... So here is a list of similarities, and differences and additional considerations that must be taken into account when working on a handheld device.
A Service is a part of your Application that has no UI. It may be called by a UI(Activity) to be started, or may be started by any other component of your Application. When developing, you have the freedom to place it on a different thread, or even run it in a different Task or Process. This allows you to ultimately separate it from your UI. Additionally, you may start the Service to run independently (startService) or bind your activity to it (bindService) depending upon your needs. By using custom Handlers, you can set callbacks to update the UI with your progress. A Service does not necessarily end if a User changes Activities, but may be ended at ANY time by the OS.
A AsyncTask is always instantiated from the UI thread. It only allows specific callbacks, but simplifies the process of multi-threading for the purposes of relatively short transactions (as compared to dedicated separate threaded services) that are inherently tied to actions performed by an Activity. Whenever a User changes Activities, the AsyncTask is put on "pause" and may even die because there is no UI thread for your Activity any longer.
The thing that I would be most concerned about is if the app is going to take 10-20 minutes the first time, I would ASSUME that the User will either change tasks temporarily or set the phone down until it completes (which can cause all of the same complications if the phone sleeps). Given this consideration, a threaded service bound to your activity may be your best choice. To protect your UI, I would make a Progress Dialog for your Activity that receives your progress callbacks. This limits user input in YOUR app and allows your service to continue the way that it needs to. Then override the Activity onResume to check the status of your Service and if it is running. Then you can reset the Dialog immediately.
Given that this is my preferred method, I would also take into account that the OS may kill the App at any time anyway. So make sure to have some way to detect an incomplete or partial sync. Then you may resume automatically when your Activity or Service restarts.
Answer: With AsyncTask if the user goes to another Activity you can't transfer that object to the other Activity so it dies.  There are tricks you can play when say the user rotates the screen or something like that, but that doesn't extend to general purpose destruction.  AsyncTask can randomly die.
Google Sync is run as a Service in the background because syncing can take a while to complete.  You might need to follow their path and create your own sync service that you can communicate with.  Here is some thoughts how to accomplish that:
http://mylifewithandroid.blogspot.com/2008/01/about-binders.html
You can definitely communicate between Service and Activity, but it's tricky to do it right.
Answer: The choice is mainly dependent on the app design. Since both AsyncTask and IntentService stands their ground, what you may want from the app(user experience) is more important and then choose either or both. Some scenarios are mentioned below (mostly what I experienced while developing apps)

Assume apps that have feeds pages - where more than one api calls are made to make the page presentable ( /getFriends, /getDates, /getPictures etc.) you can warp all such api calls to a single AsyncTask with executor which is multithreaded and the sequence of execution doesn't matter. In contrast to IntentService which runs all calls in sequence in a single worker thread. For a high end device with multi-core the call from AsyncTask is more effective. And if you start the AsyncTask on UI thread then updating IU is a piece of cakes(read less boiler plate code). And even if an user leaves the page, with intelligent use of not holding on to the context the app doesn't crash.
Assuming you are trying to write an app which doesn't need the user to be on view/activity/fragment and the total execution time to show something is not mission critical (assume sync service or user notification/alarm) then IntentService is a better choice. (no hassle to start Asynctask on UI thread so that you don't need to write a Handler to force changes on UI etc. etc. and less boiler plate code)

From my experience - write small app for both and compare the pros and cons to get a better idea. (p.s  I'd suggest take a look at the iosched app from google to get a better idea - they use both Asynctask and IntentService)
Comment: Great answer. Asynctask is easy, multitask. IntentService is hard, single task. Asynctask has its strong point, and should be used for certain implementation.
Answer: I tend to prefer the IntentService + BroadcastReceiver combo because they give you a really strong degree of control
You definitely have to make sure the UI is running if you are updating something on the screen. ASyncTask crashes were at once reported to be one of the top causes of Android crashes. This can be avoided by keeping some sort of "activityIsAlive" variable and skipping or delaying a UI update if the activity is dead.
The IntentService + BroadcastReceiver combo is a little more resistant to the crash because most tutorials tell you to shut off the BroadcastReceiver onPause or onStop. If you do not do this, again you'll have to turn off the UI update. There's a runOnUiThread command somewhere that will help you do UI updates.
The IntentService + BroadcastReceiver combo is also more extensible. You can create functions and extend BroadcastReceiver to make a more elegant REST processing solution. However, it does require more plumbing vs an ASyncTask
If you do delay the UI update, you may be able to rig it on OnWindowFocusChangedListener. When that function receives true, it means that the UI is alive.
tldr; Make sure the Activity and/or Fragment is alive before updating the UI if you are running something in the background
2015 Edit: check out Loaders as well. A little harder to grasp because there's a lot going on behind the scenes


Why are there no Bitcoin price/trade records before 2013?

Question: Example: http://www.livebitcoincharts.com/
On that chart, it starts at $135. That's quite a sum to start with. Why does it only start in 2013 when it started "blowing up" for the first time?
"All time" apparently means "since sometime 2013".
Comment: Check "BLX" Bravenewcoin Liquid Index for Bitcoin on https://tradingview.com/chart
Answer: This is a fascinating question and good catch. The only chart I could find listing anything before 2013 is 99Bitcoins. TradingView history begins in May 2014, and CoinMarketCap goes back to May 5, 2013. The bigger exchanges I checked don't go back that far except for Bitfinex, which starts in January 2013, and for dates during that period Bitfinex only charts weekly changes.
I don't have a definitive answer but will offer two possible explanations. The first is that this lack of price data is related to the March 12, 2013, "accidental hard fork" caused by an undiscovered inconsistency between versions 0.7 and 0.8.0, when a block created by a miner running the newer version was considered invalid by miners running the older one. This would mean that for a short time there wasn't a way to define a price because there wasn't consensus about what wallets held which coins (which led Mt. Gox to temporarily suspend deposits with a subsequent crash in exchange rate).
But the more plausible explanation for why there aren't trading records or a price prior to 2013 is that for there to be "a" publicly available price for any exchangeable asset, there has to be some sort of public market for the asset. BitcoinWiki has a table of prices for periods before 2013, but before March 2010 the price is listed as "basically none." The page also says that on Oct 5, 2009, the first public sale was offered on the New Liberty Standard stock exchange (at a rate of 1 USD/1,309.03 BTC), which is also mentioned in this review of Nathaniel Popper's Digital Gold: Bitcoin and the Inside Story of the Misfits and the Millionaires Trying to Reinvent Money. So before October 2009, there literally wasn't a price (if by "price" we mean the exchange rate denominated in fiat currency). There were no trades (denominated in fiat), hence no trade history.
On March 17, 2010, the first online market exchange, BitcoinMarket.com, began operating. Mt. Gox launched the same year and by 2014 was the largest exchange. Although both companies are now defunct and their trade histories (presumably) not publicly available, 99Bitcoins does list "the" price of bitcoin going back to the day BitcoinMarket.com began operations. For these two companies there likely isn't a publicly available record of trades that would allow for an accurate calculation of an average exchange rate in fiat currency for bitcoin before still-existing exchanges began publishing their trade histories. Exchanges may only publish pricing information from the date they begin operation, and the USD/BTC exchange rates on TradingView are all based on particular exchanges, which is why even their aggregate data may not go back before 2014.


Do amiibo cards require an amiibo reader/writer?

Question: I have an old 3DS XL, and I recently downloaded the new AC:NL update. I understand that the amiibo cards can now do some neat things, but I don't want to buy a $20 peripheral for 1 game. Can I just use a camera to scan the cards with the camera or do I need the reader/writer?
Comment: It's worth mentioning that the Amiibo reader/writer is usable with all amiibo, not just the cards for Animal Crossing New Leaf. You could use it for SSB4 or Fire Emblem Fates (assuming you have the appropriate amiibo), as well.
Comment: @Vemonus Hey, you never know. What's your friend code? (if you want to play Sm4sh or Animal Crossing sometime) Mines 0361-6682-4264
Comment: @Vemonus I know that the reader/writer can be used with other games, but I don't have any other use for amiibo besides this game. Nonetheless, I appreciate the answer, and you deserve top answer by far.
Comment: ah I see. Well, unfortunately you'll need the NFC adapter. Maybe you'll find another game you like in the future that you can use it for, though!
Comment: Oh, I never even thought of sharing that. I'll go put it on my profile, give me a second.
Answer: Amiibo Cards work the same was as regular Amiibo figurines, in that they require a special reader/writer. Meaning, if you don't have the new Nintendo 3DS that comes with this reader/writer built-in, you will need to buy the NFC adapter that you've mentioned.
For reference, see this tutorial on how to use the Animal Crossing Amiibo cards.
Namely, this step:

Follow the instructions and when prompted, place the Animal Crossing amiibo card of the animal you want to visit on the NFC area of the touch screen (New Nintendo 3DS system) or on the NFC Reader/Writer.

These are the only two ways to access the Amiibo Card, or an Amiibo, with a Nintendo 3DS for that matter.
It's worth noting that this isn't the only game that you would be able to use the NFC for. Two enjoyable games that you could use the NFC with applicable Amiibo for are Super Smash Bros. for the 3DS and Fire Emblem Fates.
Comment: The cards work exactly the same as the actual figurines. They work with an NFC chip. So even if someone tried to do a camera reader, they wouldn't be able to read the NFC chip with a simple camera.
Comment: @Karlyr thanks, I'll add that to the answer for completion


Thermostat wiring orange and blue wires

Question: I am changing thermostat but I see that I have both an orange and a blue wire in use coming from the zone board. I found the c wire hooked up at the zone board but not on the old t-stat. I assume I will use that wire now but I don't have single posts for the orange and blue wires on the new thermostat but I do have one that is labeled O/B. Any thoughts or advice? The new thermostat is a Honeywell T5 and the zone board is an EWC ST 2B
Comment: Can you post photos of the wiring at the zone controller and at the thermostat location?
Comment: Trying to figure out how to upload photos
Comment: I take it you only want the first (master) zone to control system changeover, right?
Comment: I am only changing the t stat on zone 1 now. Zone 2 will be changed later if I get through zone 1 without any issues. The new t stat directions say if you have an O and a B to put the B wire in the C post. I don't want to burn out anything though so I am reluctant
Answer: This is going to require a bit of...help.
Your problem is that your zone board uses its O and B inputs to determine how to run the underlying HVAC system, while the Y and W inputs are used to control the damper for the zone.  (Residential zone boards are basically very crude versions of what is called a Variable Air Volume, or VAV, zoning system in the commercial HVAC world.)
Your old (electromechanical) thermostat was able to provide these outputs independently of Y and W as it was...rather dumb, simply providing them through extra contacts on the thermostat's changeover switch.  However, while the T5 is a much more sophisticated thermostat overall, it makes some assumptions about the way HVAC systems work that aren't true for you.  In particular, it assumes that any O or B signal present is used to control a heat pump's reversing valve (some systems use O, others B, the difference being whether you need to energize the signal to get the thing to heat, or energize the signal to get the thing to cool), and thus you only need one or the other, not both at the same time, such as in your case.
So, we'll need to add some parts to adapt your new thermostat to work with your zone board.  In particular, we'll need:

4 DPDT HVAC (fan) relays (24VAC coils, quick-connect terminals, flange mount)
Some 18/8 thermostat cable you can shuck for 18AWG solid jumpers
Some wirenuts suitable for 18AWG wire, and some red (22-16AWG) female quick connects
Self-drilling sheet metal screws suitable for mounting the relays into the zone board's housing
A crimper (preferably of the ratcheting type) for attaching the quick connects to the wires, and a screwdriver and wire cutter/stripper (of course)

All these relays get wired as in the diagram below, where W, Y, R, C, R1, O, and B designate terminals on the zone board and corresponding relays in the circuit, and the wires are color-coded largely according to standard HVAC color codes, with green and black being used for internal functions.  What you are doing here is using a pair of stick circuits to create a memory of sorts that stores the last function (heating or cooling) the system was using until a call for the opposite function is made, which causes the system to change over between heating and cooling at that time.  Of course, if you aren't comfortable wiring this, this job is well within the domain of a skilled HVAC technician or controls electrician.
Comment: Thanks so much. I really appreciate the extensive effort you have put into this. If you were close by I would by you a beer or two. I am always up for a challenge. I will give it a try. 5 stars for you
Comment: @user109167 -- we thank folks around here by upvoting and/or accepting their answers :)

Thermostat wiring orange and blue wires


Biological significance of correlation between the radius of gyration and number of layers of convex hull of protein structure

Question: While going through the paper titled "GEOMETRIC ANALYSIS OF THE CONFORMATIONAL FEATURES OF PROTEIN STRUCTURES" by Manish Dutt, I came to know that there is a correlation between the radius of gyration and the number of layers of convex hull of each proteins 3D structure (convex hull layers are formed by forming the convex hull of a set of points, which forms the first layer, then removing them, and recalculating another set of boundary points, i.i., second convex hull, which form the second layer).
Now my questions is, what is the biological significance of this correlation? Or is there any?
Comment: What is a 'layer' of a convex hull? As far as I know, there is just one hull layer (the minimal bounding surface containing all the points)
Comment: Never mind I'm guessing that you can nest hulls by removing the points on the outer hull and re-calculating. Still worth describing this in your question, I think
Comment: @gilleain I have edited the question. Hope you can understand it now...
Answer: From reading the paper, I don't see any obvious biological significance. The abstract says:

Proteins exhibit intriguing diversity in their three-dimensional conformations that enables them to perform different functions

Which is great, but there is no connection in this paper between conformation and function - not surprisingly as this is a large part of structural protein analysis!
The way I look at this work is similar to the idea of a "descriptor" from the field of Cheminformatics. The radius of gyration is a descriptor, and so is this hull number. The author claims a correlation between these two descriptors, so... is one easier to calculate than the other?
This is interesting work, but I'm not sure at this point what the significance of hull number is for protein structural analysis. However I can say that the correlation between these two descriptors is not biologically significant - it's just a geometric relationship that would presumably hold for any set of 3D points.


How to disable CComboBox mfc keyboard navigation?

Question: How i can disable CComboBox mfc keyboard navigation, i need when i press key on keyboard with open dropdown list, item must not selecting. Thanks!
Answer: If you really just mean: "how do I disable the control from being changed?", then just call the EnableWindow method on the CComboBox.
But if you really mean you just want to block keyboard messages from hitting the control, then use window subclassing to swallow keyboard messages.  (Don't confuse the term "window subclassing" with C++ classes - not the same thing).  Basically, we're just going to intercept all WM_CHAR and WM_KEYDOWN messages associated with the combo box and let all the other messages pass.
Do this:
<code>WNDPROC g_prevFunc = NULL;

LRESULT MyWindowHook(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    if ((uMsg == WM_CHAR) || (uMsg == WM_KEYDOWN) || (uMsg == WM_KEYUP))
    {
        return 0; // swallow message
    }

    return ::CallWindowProcW(g_prevFunc, hWnd, uMsg, wParam, lParam);
}

void MySubclassWindow(HWND hwnd)
{
    g_prevFunc = (WNDPROC)::SetWindowLongW(hwnd, GWL_WNDPROC, (LONG_PTR)MyWindowHook);
}

// wherever your code gets initialized
CYourWindow::OnInit()
{
   // whatever other initialization you got going on...

  // I'm assuming your CComboBox is named something like m_combobox.

  ::MySubclassWindow(m_combobox.m_hWnd);

}
</code>
Double check to make sure this doesn't break tab key navigation.  I just tried and it seems to work fine.  You may not need to swallow WM_CHAR, just might need to swallow WM_KEYUP and WM_KEYDOWN.  Some experimentation on your part is likely needed.
There's also an MFC method on the CWnd class called SubclassWindow.  So if you want to go pure MFC, you can look into this as well.
Answer: A simple solution without subclassing the combobox is to set its first child window (which is the CEdit box) to readonly, like this :
GetDlgItem(IDC_MY_COMBO)->GetWindow(GW_CHILD)->SendMessage(EM_SETREADONLY, 1, 0);


How to apply ensemble clustering method?

Question: I need to use ensemble clustering method by using python in my data set. I already applied k-means clustering by using scikit learn library. I also applied different classification method also find ensemble classification method in scikit-learn. Now I am confused is there any library exist in scikit learn for ensemble clustering or how I can apply ensemble clustering method on my data set?
Answer: You might find the following libraries helpful:

Python: Cluster Ensembles
R: diceR
Answer: since the problem is to combine several runs different clustering algorithms to get a common partition of the original dataset, aiming for consolidation of results from a portfolio of individual clustering results. the solution is simple for there is no correct way to answer it we formally define the CDC problem as an optimization problem from the viewpoint of CE, and apply CE approach for clustering categorical data. Experimental results on real datasets show that CE based clustering method is competitive with existing CDC algorithms with respect to clustering accuracy.
Answer: As far as I know, scikit-learn has no library for ensemble clustering. On the other hand, you can apply the method on your dataset as follows:
import numpy as np
import ClusterEnsembles as CE

kmeans1 = np.array([1, 1, 1, 2, 2, 3, 3])
kmeans2 = np.array([2, 2, 2, 3, 3, 1, 1])
kmeans3 = np.array([4, 4, 2, 2, 3, 3, 3])
kmeans4 = np.array([1, 2, np.nan, 1, 2, np.nan, np.nan]) # `np.nan`: missing value

ret = CE.cluster_ensembles(np.array([kmeans1, kmeans2, kmeans3, kmeans4]))

print(ret) # output: [1 1 1 2 2 0 0]


Android Studio Emulator: Intel Atom x86 vs ARM

Question: What are the differences between Intel Atom x86 vs ARM emulator?
And what are the pros and cons between the two?
Answer:
Intel-based devices can run the full range of Android apps, even ones
  that were originally written for the ARM architecture. However, if an
  app contains ARM-specific code, then it must be translated before it
  can be executed.
This takes time and energy to do, so battery life and overall
  performance may suffer. Whether this is a serious problem is up for
  debate: our reviews indicate that Intel does tend to trail behind ARM
  in battery life, but the gap isn't huge, and overall performance is
  generally very good.
At any rate, Intel is working hard to encourage developers to produce
  Intel-native versions of their apps, so hopefully translation will
  become progressively less of an issue.

Source: http://www.alphr.com/features/390064/arm-vs-intel-processors-what-s-the-difference
Comment: The question is about what is different between the *emulators*. This answer is about differences between the various *device architectures*. The pros and cons of the different *devices* (being emulated) have nothing to do with pros and cons of selecting one of the *emulators*.
Answer: It says, "Running an x86 base Android Virtual Device is 10x faster"- while trying to run an arm virtual device. So I guess, x86 is faster.
Comment: You're pretty much correct. A good explanation can be found here: https://stackoverflow.com/a/30651276/443136
Comment: @ValerioSantinelli - the answer you link is not relevant, because it confuses the speed-benefit of running a 64-bit image on a 64-bit target device [e.g. when running on an actual atom-64 phone or table] vs. whether that choice matters when *emulating* (it doesn't).
Comment: @ToolmakerSteve actually the choice matters because the x86 based emulator images run faster than the arm based ones on Intel PCs. It's also true that switching to a qemu based emulator made a big difference in performances of the emulator.


What are the tradeoffs of performing static analysis on source code, byte code, machine code, etc?

Question: What are the various tradeoffs for performing static analysis on various levels of code? For instance for Java, why would someone perform static analysis on Java source code vs. Jasmin code vs. Java bytecode? Does the choice restrict or expand the various types of analyses able to be done? Does the choice influence the correctness of the analyses? Thanks.
Answer:
What are the various tradeoffs for performing static analysis on various levels of code? For instance for Java, why would someone perform static analysis on Java source code vs. Java bytecode?

From a user perspective, I'd say that, unless you have very specific, easy to formalize, properties to analyze (such as pure safety properties) go with a tool that supports Java source code.
From a tool-developer perspective, it may be easier to work with one level or another. I here present the differences that come to my mind. (Note that with a compiler and/or a decent decompiler a tool for instance operate on one layer and present the results on another.)
Pros for Java source code:

Structured language, i.e. loops etc, instead of arbitrary jumps. (This makes it a lot easier to create a weakest precondition calculus for instance.)
You can make more assumptions in the code (bytecode programs are more expressive).

Pros for Bytecode:

The language specification (the semantics of the bytecode instructions) are a lot simpler.
A more "pinned down" specification of the machine (the VM)
You can extend the analysis to legacy code and libraries.
Analysis allows for other languages targeting the JVM (Closure, Scala, JRuby...)
No need for a possibly complex parser

Pros for machine code:

You verify what you actually feed the CPU with. (No need to use a verified compiler or verified VM if you want a fully verified chain.)

State of the art tools such as Spec# etc (formal methods dialect of C#) usually go through an intermediate language (BoogiePL (neighter MSIL nor C#) in the Spec# case) specifically designed for formal analysis.

Does the choice restrict or expand the various types of analyses able to be done?

In the end... no, not really. You face the same fundamental problems regardless of which (Turing complete) language you choose to analyze. Depending on what properties you analyze, YMMV though.
If you're into formal methods and thinking about implementing an analysis yourself, I suspect you'll find better tool-support for bytecode. If you're a user or developer and want to perform analysis on your own code-base, I suspect you'll benefit more from tools operating on Java-source code level.

Does the choice influence the correctness of the analyses?

Depends on what you mean by correctness. A static analysis is most often "defensive" in the sense that you don't assume anything that you don't know is true. If you restrict your attention to sound verification systems, all of them will be "equally correct".
Answer: IntelliJ has static analysis for comments e.g. Javadoc and parameter names which is not available in the byte code. e.g. spelling mistakes and name inconsistencies. Analysis of code ensures you have line numbers and position within a line of any issue.
The benefit of analysing byte code is that its much simpler and may be all you need. You might have line numbers but you won't have the position. And you can analise compiled code which you don't have the source for, e.g. libraries.
Answer:
What are the various tradeoffs for performing static analysis on
  various levels of code? For instance for Java, why would someone
  perform static analysis on Java source code vs. Jasmin code vs. Java
  bytecode?

Think of it this way. If you get negative results (results indicating or suggesting a negative or detrimental attribute) from Jasmin or bytecode, what would you do about it? How would you go about addressing that in a manner that is timely and cost effective?
Now consider the scenario where static analysis on the source code (most likely your source code or code that you own) comes back reporting a negative/detrimental attribute that needs addressing?
Do you think you will have a harder time addressing this detrimental aspect that is being mapped to source code than doing the same to a detrimental aspect (possibly similar or related) but this time mapped to bytecode or Jasmin?
The thing is that 1) Jasmin is expected to be a one-to-one representation of legitimate bytecode, and 2) that bytecode has been generated by a bona-fide compiler. The chances that a problem in bytecode map directly to a problem introduced in source code in the presence of a well-behaved compiler are very minimal.
Independently of whether problems detected at the bytecode level are a result of problems introduced at the source code level or the result of a faulty compiler/environment, these problems are typically not actionable(sp?). You typically cannot act upon it, at least not directly.
Problems detected at the source code level, OTH, they are efficiently actionable. That is, you can get your hands on it and fix them (and by inference, removing any problems at the byte code derived from the former.)
There are things that can be detected at the byte code level, in particular in the context of packaging (ie. packaging unnecessary libraries.) But hardly you ever need to do verification at the byte code level.
Unless you are in the business of compiler and language design (in this case targeting the VM), for efficiency and practicality purposes, 1) you assume the compiler is correct, and that 2) given the way the JVM is spec'ed, you also assume the compiler performs verification at compile time and the JVM does verification at run-time.

Does the choice restrict or expand the various types of analyses able
  to be done? Does the choice influence the correctness of the analyses?
  Thanks.

How do you define correctness? What is correctness in this context? And how could it affect correctness? Are we talking correctness at the type system level? Partial and/or total correctness? Correctness with respect to attributes such as fairness, liveliness? Correctness of the analysis process itself? Correctness with respect to meeting one or more requirements?
Define your terms dude :)
Regardless, you have to assume the compiler is doing a sufficiently correct translation of your code into the target instruction set (again, unless you are in the business of compiler/language design.)
If you work on the assumption that the "native" representation of your code is correct (that is, it "maps" to it according to a desired target platform and a type system), then you narrow your field of verification down to your source code for the attributes you want to verify.
Answer: Another consideration is 'abstraction will lost high level informations'.
We are doing it with source code(high level), because we need where expression are occur in source code.
a source-to-binary mapping is very important in source code visualization area.