How does finding a cycle start node in a cycle linked list work?

Question: I understand that Tortoise and Hare's meeting concludes the existence of a loop, but how does moving tortoise to the beginning of linked list while keeping the hare at the meeting place, followed by moving both one step at a time make them meet at the starting point of the cycle?
Comment: Another explanation: https://marcin-chwedczuk.github.io/find-cycle-start-in-singly-linked-list
Comment: I wonder if anyone can find the start of the cycle easily if Brent's algorithm is used.
Answer: Let me try to clarify the cycle detection algorithm that is provided at Wikipedia - Tortoise_and_hare in my own words.

How it works
Let's have a tortoise and a hare (name of the pointers) pointing to the beginning of the list with a cycle, as in the diagram above.
Let's hypothesize that if we move the tortoise 1 step at a time, and the hare 2 steps at a time, they will eventually meet at a point. Let's show that first of all this hypothesis is true.
The figure illustrates a list with a cycle. The cycle has a length of n and we are initially m steps away from the cycle. Also, let's say that the meeting point is k steps away from the cycle beginning and tortoise and hare meets when tortoise has taken i total steps.  (Hare would have taken 2i total steps by then.).
The following 2 conditions must hold:
1) i = m + p * n + k

2) 2i = m + q * n + k

The first one says that the tortoise moves i steps and in these i steps, it first gets to the cycle. Then it goes through the cycle p times for some positive number p. Finally, it goes over k more nodes until it meets hare.
A similar thing is true for hare. It moves 2i steps and in these 2i steps it first gets to the cycle. Then it goes through the cycle q times for some positive number q. Finally, it goes over k more nodes until it meets the tortoise.
As the hare travels with double the speed of the tortoise, and time is constant for both when they reach the meeting point.
So by using simple speed, time and distance relation,
2 ( m + p * n + k ) = m + q * n + k

=> 2m + 2pn + 2k = m + nq + k

=>  m + k = ( q - 2p ) n

Among m, n, k, p, q, the first two are properties of the given list. If we can show that there is at least one set of values for k, q, p that makes this equation true we show that the hypothesis is correct.
One such solution set is as follows:
p = 0

q = m

k = m n - m

We can verify that these values work as follows:
m + k = ( q - 2p ) n

=> m + mn - m = ( m - 2*0) n

=> mn = mn

For this set, i is
i = m + p n + k

=> m + 0 * n + mn - m = mn

Of course, you should see that this is not necessarily the smallest i possible. In other words, tortoise and hare might have already met before many times. However, since we show that they meet at some point at least once we can say that the hypothesis is correct. So they would have to meet if we move one of them by 1 step, and the other one by 2 steps at a time.
Now we can go to the second part of the algorithm which is how to find the beginning of the cycle.
Cycle Beginning
Once tortoise and hare meet, let's put tortoise back to the beginning of the list and keep hare where they met (which is k steps away from the cycle beginning).
The hypothesis is that if we let them move at the same speed (1 step for both), the first time they ever meet again will be the cycle beginning.
Let's prove this hypothesis.
Let's first assume some oracle tells us what m is.
Then, if we let them move m + k steps, the tortoise would have to arrive at the point they met originally (k steps away from the cycle beginning - see in the figure).
Previously we showed that m + k = (q - 2p) n.
Since m + k steps is a multiple of cycle length n, hare, in the meantime, would go through the cycle (q-2p) times and would come back to the same point (k steps away from the cycle beginning).
Now, instead of letting them move m + k steps, if we let them move only m steps, the tortoise would arrive at the cycle beginning. Hare would be k steps short of completing (q-2p) rotations. Since it started k steps in front of the cycle beginning, the hare would have to arrive at the cycle beginning.
As a result, this explains that they would have to meet at the cycle beginning after some number of steps for the very first time (very first time because the tortoise just arrived at the cycle after m steps and it could never see hare which was already in the cycle).
Now we know that the number of steps we need to move them until they meet turns out to be the distance from the beginning of the list to the cycle beginning, m. Of course, the algorithm does not need to know what m is. It will just move both tortoise and hare one step at a time until they meet. The meeting point has to be the cycle start and the number of steps must be the distance (m) to the cycle beginning. Assuming we know the length of the list, we can also, compute the length of the cycle of subtracting m from the list length.
Comment: Your Equation `m + k = (q - 2p) n` can be further simplified to `m + k = q*n`. This is because the number of loops tortoise takes will always be zero since the hare can never overtake the tortoise without meeting it. Think about it.
Comment: I don't think so its true that when they meet that's the starting point see comment below : http://stackoverflow.com/a/19209858/1744146 Please let me know If I am wrong
Comment: @Gopichand Read the last para again...you just assume that there is some m (if it is already proved that there is a cycle)..but you don't know the value of m
Comment: First part of explanation is flawless. But Second part has a flaw as far as I know. You are assuming that "some oracle says m", but if m is known, you already have the beginning of the cycle. How can you just assume the answer when you never know where is the start of cycle?? Please let me know.
Comment: I wanted to ask even if the fast pointer is thrice as fast as the slow pointer or four times or n times as fast as the slow pointer, the slow and fast pointer would still meet, right?
Comment: @ankitG : Yes they will meet if we advance it thrice as fast. However they will now meet 2*offset away from the starting node. So to find the location of the start cycle, we will have to move the pointer in the cycle at speed 2x compared to the one in the beginning of the list. Why ? Because now the faster pointer has a 2*offset headstart in the list.
Comment: @rajaditya_m : I am not really concerned about finding the starting node of the cycle here. My question basically is that once both the tortoise and the hare are in the loop, will they necessarily meet irrespective of the speed of the hare? Why? Why not?
Comment: Thank you for the explanation. Assuming that we know a linked list is circular, I was wondering why we can't just use a Set to keep track of visited nodes in the linked list? [something like this](http://hastebin.com/ibiluqotez.coffee)
Comment: @Mido the `set` solution requires additional `O(n)` spaces while this one doesn't.
Comment: In the second part (cycle beginning), you said that `m + k = (q - 2p) n`. But that equation was derived when hare moved at twice the speed of tortoise. Now that they move at the same speed, does the equation still hold?
Comment: This is the best explanation in simple words. Could you please do the world a favor and edit the Wikipedia page for this algorithm? https://en.wikipedia.org/wiki/Cycle_detection
Comment: @CEGRD In the first part of explanation of how it works, could you please elaborate more on how you **derived** the solution set consisting of `p=0` and especially `q=m` to satisfy the final equation?
Answer: Refer this image:

Distance travelled by slowPointer before meeting = x + y
Distance travelled by fastPointer before meeting = (x + y + z) + y
                                                                                = x + 2y + z
Since fastPointer travels with double the speed of slowPointer, and time is constant for both when the reach the meeting point.
So by using simple speed, time and distance relation
                     2(x+y)=  x+2y+z
               => x+2y+z = 2x+2y
               => x=z
Hence by moving slowPointer to start of linked list, and making both slowPointer and fastPointer to move one node at a time, they both have same distance to cover .
They will reach at the point where the loop starts in the linked list.
Comment: This does not take into account the case that fastPointer travels the cycle n times before slowPointer enters the cycle. Use l to denote the length of the cycle. __Distance travelled by fastPointer before meeting__ = (x + y + z) + y = x + 2y + nl + z. And the resulting relation will be x = nl+z.
Comment: this diagram is over-simple.  the fast pointer can move many times through the cycle before the slow pointer reaches it.
Comment: @JingguoYao: Here is the explanation for [that case.](http://stackoverflow.com/a/36214925/1835769)
Comment: @Warren MacEvoy: It is a good thing that this diagram is simple. It helps to understand the base case. The next case is [here](https://stackoverflow.com/a/36214925/1835769). That case is equally simple to understand.
Comment: @Warren MacEvoy "the fast pointer can move many times through the cycle before the slow pointer reaches it." Isn't the fast pointer that meets the slow pointer at the same place, and not the other way around? It could be perspective though.
Answer: This is Floyd's algorithm for cycle detection.  You are asking about the second phase of the algorithm -- once you've found a node that's part of a cycle, how does one find the start of the cycle?
In the first part of Floyd's algorithm, the hare moves two steps for every step of the tortoise.  If the tortoise and hare ever meet, there is a cycle, and the meeting point is part of the cycle, but not necessarily the first node in the cycle.
When the tortoise and hare meet, we have found the smallest i (the number of steps taken by the tortoise) such that Xi = X2i. Let mu represent the number of steps to get from X0 to the start of the cycle, and let lambda represent the length of the cycle.  Then i = mu + alambda, and 2i = mu + blambda, where a and b are integers denoting how many times the tortoise and hare went around the cycle. Subtracting
the first equation from the second gives i = (b-a)*lambda, so i is an integer multiple
of lambda.  Therefore, Xi + mu = Xmu.  Xi represents the meeting point of the tortoise and hare.  If you move the tortoise back to the starting node X0, and let the tortoise and hare continue at the same speed, after mu additional steps the tortoise will have reached Xmu, and the hare will have reached Xi + mu = Xmu, so the second meeting point denotes the start of the cycle.
Comment: I think there is a small problem in your proof. Since the meeting point `i` is at some point of the cycle, I think the equation should be `i = mu + k + a*lambda` and `2i = mu + k + b*lambda`, where `k` is the number of step from cycle start to the meeting point. Subtracting both equations give the same result though.
Comment: @Passionate: Take mu steps from the start point to get to `X_mu`, the start of the cycle (by definition of mu).  Then if you take i more steps, where i is a multiple of the cycle length, you end up back at the cycle start: `X_mu + i` = `X_mu`. But addition is commutative, so this is equivalent to taking i steps to get from the start to the first meeting point `X_i`, then mu additional steps to get back to `X_mu`, the start of the cycle.
Comment: @Jim Lewis It would be great if you could explain about how having i as multiple of loop length results to mu as distance between first meeting point and loop beginning.
Comment: @ankur:  The meeting point is X_i, and we have shown (third paragraph in my answer) that i must be a multiple of the loop length.  After mu additional steps past the meeting point, you are now at X_(i + mu).  But we have shown that X_(i + mu) = X_(mu + i) = X_mu, because of this special property of i, so mu steps past the meeting point must take you to X_mu, the start of the cycle. Basically modular arithmetic, plus the commutative property of addition.
Comment: @Jim lewis The meeting point will not be a starting point of course, but as I said shifting one of those two to beginning of linked list and moving both at same speed will make them meet at the starting point of cycle.
Comment: @Passionate: Hope this edit clarifies the situation.  The key insight is that the number of (tortoise) steps to the first meeting must be a multiple of the cycle length, and that mu steps from either this position or the start position will take you to the start of the cycle.
Comment: @ankur: Perhaps it would have been clearer if I had written "X_(mu + i) = X_mu" (with (mu + i) being the subscript).  If you start at node X_mu (by definition, the first node of the cycle), then take i steps, you will end up at node X_mu again, since i is an exact multiple of the cycle length.  Does that help?
Comment: @JimLewis : i understood the part that i always has to be multiple of cycle length but the step "X_mu + i = X_mu" in which you are adding the value of mu to the i is not clear to me. Well why you added the value of mu to the i ? Can't it be any other value ? That part is not clear to me. It would really a great help if you can elaborate it.
Comment: @JimLewis : Sorry but i am still not smart enough to understand it. Still my mind is not able to understand why the distance is mu from the meeting point to loop start point. why it is not any other distance?
Answer: Old Monk's simple and under-upvoted answer explains finding the cycle when the fast runner completes only single  full cycle. In this answer I explain the case when fast runner has run the loop multiple times before the slow runner enters the loop.

Using the same image:
Let's say the fast runner has run the loop m times before slow and fast meet. This means that:

Distance run by slow: x + y
Distance run by fast: x + m(y + z) + y i.e. extra y where they meet

Since fast runs with twice the speed of slow, and that they have been running for same time, it implies that if we double the distance ran by slow, we get the distance ran by fast. Thus,

2(x + y) = x + m(y + z) + y

Solving for x gives,

x = (m - 1)(y + z) + z

In real scenario it would mean, x = (m - 1) complete loop runs + an extra distance z.
Hence, if we put one pointer at the start of the list and leave the other one at the meeting point, then moving them by the same speed will result in the in loop pointer completing m - 1 runs of the loop and then meeting the other pointer right at the loop beginning.
Comment: One doubt.. how  its guaranteed that slow and fast will meet before slow takes more than one cycle?
Comment: @siraj: Slow won't run in cycles, fast would as it is running faster than slow and will enter the loop before. And it's guaranteed that they would meet. If slow is at j + 1 and fast is at j, they will now meet at j + 2. And if slow is at j and fast at j + 1, it means that they already met at j - 1.
Comment: the math still works if slow goes around loop: x+(y+z)m+y = 2(x+(y+z)n+y), where n is # of times around loop for slow before they meet. This solves to (m-2n-1)(y+z)+z=x. Which means starting at meeting point, go around (m-2n-1) times, you are back at meeting point, an then go z, you are at start of loop. And to do this it is the same as starting at the head node and going x nodes.
Comment: x = (m - 1)(y + z) + z this can be  generalized as loop length is y+z and since are only concerned about position.
So x = ((m - 1)(y + z))%(y+z)) + z
Which is effectively x=z;
Comment: @mayas_mom: Math may be working out but slow will never be able to go around the loop. It will always be caught either right at the start or somewhere mid-way.
Comment: @displayName - In "Hence, if we put one pointer at the start of the loop"... shouldn't it be "at the start of the list"? It is throwing me off a bit.
Comment: @srinivas.naik: You are right. I have corrected my mistake.
Comment: @WarrenMacEvoy: If you follow the exact steps of the answer, the slow and fast pointer will meet at **loop beginning**, not the starting point.
Comment: @displayName, You said in your comment to siraj: " If slow is at j + 1 and fast is at j, they will now meet at j + 2. And if slow is at j and fast at j + 1, it means that they already met at j - 1". Suppose when slow is at j, fast is at j-m and they will meet at j+k. What is the proof that k<n where n=total step length of the loop ?
Comment: @displayName, " There are only two cases possible - either fast lands over slow in every iteration or it lands over slow in every other iteration. (1/2)" - can you expliain a bit more ?
Comment: "Hence, if we put one pointer at the start of the list and leave the other one at the meeting point, then moving them by the same speed will result in the in loop pointer completing m - 1 runs of the loop and then meeting the other pointer right at the loop beginning." Terrible explanation. The two nodes start at the beginning.
Comment: @AleksandrH: They start at the head node but after they have met each other inside the loop, then you have to bring one of them to head again and leave other one at the meeting point. And then move both of them one node at a time. That is how they will meet again at the loop beginning. (Feel free to edit and update the answer if you can make it better.)
Comment: @Tommy: Yeah.. I tried to understand the solution to this problem from CTCI. But it was so tedious. I understood the [solution above](https://stackoverflow.com/a/32190575/1835769) in one go. Then after seeing the missing case in the above solution, I ended up writing this addendum.
Answer: It's very very simple. You can think in terms of relative speed. If the rabbit moves two nodes and tortoise moves one node, relative to tortoise rabbit is moving one node(assume tortoise at rest). So, if we move one node in the circular linked list we are sure going to meet at that point again.
After finding the connected point inside the circular linked list, now the problem is reduced to finding the intersection point of two linked list problem.
Comment: I tried very hard to appreciate this answer, but this statement makes no sense to me "_if we move one node in the circular linked list we are sure going to meet at that point again_"
Answer: Approach:
There are two pointers:

A slow pointer that moves one node at a time.
A fast pointer that moves two nodes at a time.

If the two pointer meet, it proves that there is a loop. Once they have met, one of the nodes will point to the head and then have both proceed one node at a time. They will meet at the start of the loop.
Rationale:
When two people walk down a circular track, one of them at twice the speed of the other, where do they meet? Exactly where they started.
Now, suppose the fast runner has a head start of k steps in an n step lap. where will they meet? Exactly at n-k steps. When the slow runner has covered (n-k) steps, the fast runner would have covered k+2(n-k) steps.
(ie, k+2n-2k steps ie 2n-k steps). i.e.(n-k) steps (The path is circular and we are not concerned about the number of rounds after which they meet; We are just interested in the position where they meet).
Now how did the fast runner get the head start of k steps in the first place? Because it took the slow runner that many steps to reach the start of the loop. So the start of the loop is k steps from the head node.
Note: The node where both pointer met is k steps away from start of loop (inside the loop) and the head node also is k steps away from start of loop. So when we have pointer advancing at equal pace of 1 step from bot these nodes, they will meet at the start of the loop.
I believe it is straightforward. Please let me know if any part is ambiguous.
Comment: Please post the full answer here instead of just a link which may break in the future
Answer:
At the time of the first collision, tortoise moved m+k steps as show above. Hare moves twice as fast as tortoise, meaning hare moved 2(m+k) steps. From these simple facts we can derive the following graph.

At this point, we move tortoise back to the start and declare that both hare and tortoise must move one step at a time. By definition, after m steps, tortoise will be at the start of the cycle. Where will hare be?
Hare will also be at the start of the cycle. This is clear from the second graph: When tortoise was moved back to the start, hare was k steps into its last cycle. After m steps, hare will have completed another cycle and collided with tortoise.
Comment: @WarrenMacEvoy At no point did I suggest that they meet at the starting point. They meet again at the *start of the cycle* as the figures clearly point out.
Answer: Okay so lets assume the hare and the tortoise meet at a point which is k steps away from the starting of the cycle, the number of steps before the cycle starts is mu and the length of the cycle is L.
So now at the meeting point ->
Distance covered by tortoise = mu + a*L + k    - Equation 1
(Steps taken to reach the beginning of the cycle + steps taken to cover 'a' iterations of the cycle + k steps from the start of the cycle)
(where a is some positive constant)
Distance covered by the hare = mu + b*L + k     - Equation 2
(Steps taken to reach the beginning of the cycle + steps taken to cover 'b' iterations of the cycle + k steps from the start of the cycle)
(where b is some positive constant and b>=a)
So the extra distance covered by the hare is = Equation 2 - Equation 1 = (b-a)*L
Please note that this distance is also equal to the distance of the tortoise from the starting point since the hare moves 2 times faster than the tortoise. This can be equated to 'mu+k' which is also the distance of the meeting point from the beginning if we do not include multiple traversals of the cycle.
Thus,
  mu + k = (b-a)*L
So mu steps from this point would lead back to the beginning of the cycle (since k steps from the start of the cycle have already been taken to reach the meeting point). This could happen in the same cycle or any of the subsequent cycles.
Thus now if we move the tortoise to beginning of the linked list, it will take mu steps to reach the starting point of the cycle and the hare would take mu steps to also reach the beginning of the cycle and thus they would both meet at the starting point of the cycle.
P.S. Honestly, I had the same question as the original poster in my mind and I read the first answer, they did clear out a few things but I could not get to the final result clearly and so I tried to do it my own way and found it easier to understand.
Comment: they usually do not meet at the beginning of the cycle
Answer: A simple explanation using the idea of relative velocity taught in high school - Physics 101 / Kinematics lectures.

Let's assume distance from start of linked list to start of the circle is x hops. Let's call the start of circle as point X (in caps - see figure above). Also let's assume total size of circle is N hops.
Speed of hare = 2 * Speed of tortoise. So that is 1 hops/sec and 2 hops/sec respectively
When tortoise reaches the start of the circle X, the hare must further be x hops away at point Y in the figure. (Because hare has travelled twice the distance as the tortoise).
Thus, length of the remaining arc clockwise from X to Y would be N-x. This also happens to be the relative distance to be covered between the hare and the tortoise for them to be able to meet. Let's say this relative distance will be covered in time t_m i.e. time to meet. Relative speed is (2 hops/sec - 1 hops/sec) i.e. 1 hops/sec. Thus using, relative distance = relative speed X time, we get, t = N-x sec. So it will take N-x to reach the meeting point for both the tortoise and the hare.
Now in N-x sec time and at 1 hops/sec speed, the tortoise who was earlier at point X will cover N-x hops to reach the meeting point M. So, that means the meeting point M is at N-x hops counterclockwise from X = (which further implies) => that there is x distance remaining from point M to X clockwise.
But x is also the distance to reach point X from the start of the linked list.
Now, we don't care what number of hops x corresponds to. If we put one tortoise at the start of the LinkedList and one tortoise at the meeting point M and let them hop/walk, then they will meet at point X, which is the point (or node) that we need.
Answer: Reduce the problem to a loop problem, then go back to the initial problem
I find the following explanation more intuitive.

Take two pointers (1 = tortoise and 2 = hare) that start from the head (O), 1 has a step length of 1, 2 has a step length of 2. Think about the moment when 1 reaches the start node of that cycle (A).
We want to answer to the following question "Where is 2 when 1 is in A?".
So, OA = a is a natural number (a >= 0). But it can be written in the following way: a = k*n + b, where a, k, n, b are natural numbers:

n = the cycle length
k >= 0 = constant
0 <= b <= n-1

It means that b = a % n.
E.g.: if a = 20 and n = 8 => k = 2 and b = 4 because 20 = 2*8 + 4.
The distance covered by 1 is d = OA = a = k*n + b. But in the same time, 2 covers D = 2*d = d + d = OA + d = OA + k*n + b. This means that when 2 is in A it has to cover k*n + b. As you can see, k is the number of laps, but after those laps, 2 will be b far from A. So, we found where 2 is when 1 is in A. Let's call that point B, where AB = b.

Now, we reduce the problem to a circle. The question is "Where is the meeting point?". Where is that C?

In every step, 2 reduces the distance from 1 with 1 (let's say meter) because 1 is getting further from 2 with 1, but at the same time 2 goes closer to 1 by 2.
So, the intersection will be when the distance between 1 and 2 will be zero. This means that 2 reduces the n - b distance. In order to achieve this, 1 will make n - b steps, while 2 will make 2*(n - b) steps.
So, the intersection point will be n - b far from A (clockwise), because this is the distance covered by 1 until it meets 2. => the distance between C and A is CA = b, because AC = AB + BC = n - b and CA = n - AC. Don't think that AC = CA, because the AC distance is not a trivial mathematical distance, it is the number of steps between A and C (where A is the start point and C is the end point).
Now, let's go back to the initial schema.
We know that a = k*n + b and CA = b.
We can take 2 new pointers 1' and 1'', where 1' starts from the head (O) and 1'' starts from the intersection point (C).
While 1' goes from O to A, 1'' goes from C to A and continues to finish k laps. So, the intersection point is A.
Answer:
If the pointers met at a point P as shown in the figure, the distance Z+Y is point P and X+Y is also point P which means Z=X. Which is why keeping moving one pointer from P and moving another from start(S) till they meet, which means moving an equal distance(Z or X) to the same point M(distance Z from P and X from S) will be the starting of the loop. Simple!
Answer: There are already plenty of answers to this, but I once came up with a diagram for this which is more visually intuitive to me. Perhaps it can help other people.
The main aha-moments for me were:

Split T (tortoise) into T1 (pre-loop) and T2 (in-loop).

Subtract T from H, where they visually overlap. What remains (H - T = H') is equal to T.
The remaining math is quite simple.
Answer: -there are k steps before the loop.  We don't know what k is and don't need to find out.  We can work abstractly with just k.
--After k steps
----- T is at cycle beginning
----- H is k steps into cycle  (he went 2k total and thus k into loop)
**  they are now loopsize - k apart
(note that k == K == mod(loopsize, k)  --e.g. if a node is 2 steps into a 5 node cycle it is also 7, 12 or 392 steps in, so how big the cycle is w.r.t k does not factor in.
Since they catch up to each other at the rate of 1 step per unit of time because one is moving twice as fast as the other, they will meet at loopsize - k.
This means it will take k nodes to reach the beginning of the cycle and thus the distance from head to cyclestart and collision to cyclestart are the same.
So now after first collision move T back to head. T and H will meet at cyclestart if you move at rate of 1 each.  (in k steps for both)
This means that the algorithm is:

from head move T = t.next and H.next.next until they collide ( T == H) (there is a cycle)

//take care of case when k=0 or T and H met at the head of the loop by
calculating the length of the loop
--count the length of the cycle by moving T or H around it with a counter
--move a pointer T2 to head of list
--move pointer length of cycle steps
--move another pointer H2 to head
--move T2 and H2 in tandem until they meet at start of cycle
that's it!
Answer:  image credit
Call distance the number of links a pointer follows, and time the number of iterations the algorithm takes of moving the slow pointer one link and the fast pointer two links. There are N nodes before a cycle of length C, labeled with cycle offset k=0 through C-1.
To reach the start of the cycle, slow takes N time and distance. This means fast takes N distance in the cycle (N to get there, N to spin).  So at time N, slow is at cycle offset k=0, and fast is at cycle offset k=N mod C.
If N mod C is zero, slow and fast now match and the cycle is found at time N and cycle position k=0.
If N mod C is not zero, then fast now has to catch up with slow, which at time N is C-(N mod C) distance behind in the cycle.
Since fast moves 2 for every 1 of slow, reducing the distance by 1 on every iteration, this takes as much additional time as the distance between fast and slow at time N, which is C-(N mod C).  Since slow is moving from offset 0, this is also the offset where they meet.
So, if N mod C is zero, the phase 1 stops after N iterations at the beginning of the cycle.  Otherwise, phase 1 stops after N+C-(N mod C) iterations at offset C-(N mod C) into the cycle.
// C++ pseudocode, end() is one after last element.

int t = 0;
T *fast = begin();
T *slow = begin();
if (fast == end()) return [N=0,C=0];
for (;;) {
    t += 1;
    fast = next(fast);
    if (fast == end()) return [N=(2*t-1),C=0];
    fast = next(fast);
    if (fast == end()) return [N=(2*t),C=0];
    slow = next(slow);
    if (*fast == *slow) break;
}

Ok, so phase 2: slow takes N more steps to get to the cycle, at which point fast (now moving 1 per time step) is at (C-(N mod C)+N) mod C = 0.  So they meet at the beginning of the cycle after phase 2.
int N = 0;
slow = begin();
for (;;) {
    if (*fast == *slow) break;
    fast = next(fast);
    slow = next(slow);
    N += 1;
}

For completeness, phase 3 computes the cycle length by moving once more through the cycle:
int C = 0;
for (;;) {
    fast = next(fast);
    C += 1;
    if (fast == slow) break;
}

Comment: Note that, if N <= C, the iteration stops after C iterations. In any case it must stop in less than N+C steps and is unlikely to stop at the beginning of the cycle.
Comment: Link to google doc to simulate algorithm: https://docs.google.com/spreadsheets/d/1LXEBc3EqrkQkUycx5oA_yqEZRbjBMIvrW5rt9oxb-IY/edit?usp=sharing
Answer: With all the above analysis, if you are a learn-by-example person, I tried to write up an short analysis and example that help explains the math everyone else attempted to explain. Here we go!
Analysis:
If we have two pointers, one faster than the other, and move them along together, they will eventually meet again to indicate a cycle or null to indicate no cycle.
To find the starting point of the cycle, let ...

m be the distance from head to the beginning of the cycle;

d be the number of nodes in the cycle;

p1 be the speed of the slower pointer;

p2 be the speed of the faster pointer, eg. 2 means steps through two nodes at a time.
Observe the following iterations:

 m = 0, d = 10:
 p1 = 1:  0  1  2  3  4  5  6  7  8  9 10 // 0 would the start of the cycle
 p2 = 2:  0  2  4  6  8 10 12 14 16 18 20

 m = 1, d = 10:
 p1 = 1: -1  0  1  2  3  4  5  6  7  8  9
 p2 = 2: -1  1  3  5  7  9 11 13 15 17 19

 m = 2, d = 10:
 p1 = 1: -2 -1  0  1  2  3  4  5  6  7  8
 p2 = 2: -2  0  2  4  6  8 10 12 14 16 18

From the above sample data, we can easily discover that whenever the faster and the slower pointers  meet, they are m steps away from the start of the cycle. To solve this, put the faster pointer  back at the head and set its speed to the speed of the slower pointer. When they meet again, the node is the start of the cycle.
Answer: Working this with a diagram would help. I am trying to explain the problem without equations.

If we let the hare and tortoise run in a circle and hare runs two times tortoise then, at end of one lap for hare tortoise would be at half. At end of two laps from hare tortoise would have done 1 lap and they both meet. This applies to all speed like if hare runs three times, hare 1 lap is equal to 1/3 of tortoise so at end of 3 laps for hare tortoise would have covered 1 lap and they meet.
Now if we start them m steps before loop, then it means the faster hare is starting ahead in loop. So if tortoise reach the start of loop the hare is m steps ahead loop and when they meet it would be m steps before the loop start.
Answer: I don't think so its true that when they meet that's the starting point. But yes if the other pointer(F) was at the meeting point before , than that pointer will be at the end of the loop instead of the start of the loop and the pointer(S) which started from the start of the list it will end up at the start of the loop. for eg:
1->2->3->4->5->6->7->8->9->10->11->12->13->14->15->16->17->18->19->20->21->22->23->24->8

Meet at :16

Start at :8

public Node meetNodeInLoop(){

    Node fast=head;
    Node slow=head;

    fast=fast.next.next;
    slow=slow.next;

    while(fast!=slow){

        fast=fast.next;
        fast=fast.next;

        if(fast==slow) break;

        slow=slow.next;
    }

    return fast;

}

public Node startOfLoop(Node meet){

    Node slow=head;
    Node fast=meet;

    while(slow!=fast){
        fast=fast.next;
        if(slow==fast.next) break;
        slow=slow.next;
    }

    return slow;
}

Answer: lets say,
N[0] is the node of start of the loop,
m is the number of steps from beginning to N[0].

we have 2 pointers A and B, A runs at 1x speed, B at 2x speed, both start at the beginning.
when A reaches N[0], B should be already in N[m].
(Note: A uses m steps to reach N[0], and B should be m steps further)
Then, A runs k more steps to collide to B,
i.e. A is at N[k],  B is at N[m+2k]
(Note: B should runs for 2k steps starting from N[m])
A collide B at N[k] and N[m+2k] respectively, it means
k=m+2k, thus k = -m
Thus, to cycle back to the N[0] from N[k], we need m more steps.
Simply saying, we just need to run m more steps after we found the collision node. We can have a pointer to run from beginning and a pointer running from collision node, they will meet at N[0] after m steps.
Therefore, the pseudo code are as follow:
1) A increase 1 step per loop
2) B increase 2 steps per loop
3) if A & B are the same node, cycle found, then go to 5
4) repeat from 1
5) A reset to head
6) A increase 1 step per loop
7) B increase 1 step per loop
8) if A & B are the same node, start of the cycle found
9) repeat from 6

Answer: After spending two hours trying to read all the answers, I found this comment on leetcode. Safe to say, it saved my night.
https://leetcode.com/problems/linked-list-cycle-ii/discuss/44774/Java-O(1)-space-solution-with-detailed-explanation./44281
Answer: I see that most of the answers giving mathematical explanation for this "how does moving tortoise to beginning of linked list while keeping the hare at meeting place, followed by moving both one step at a time make them meet at starting point of cycle?"
The following method also does the same like floyd cycle detection behind the scenes but the rationale is simple but at a cost of O(n) memory.
I would like to add an easier approach/rationale to find the beginning of the cycle. Since this method was not mentioned anywhere, I tested this here: https://leetcode.com/problems/linked-list-cycle-ii/ and It passed all the testcases.
Let's consider that we've been given head reference of the LinkedList.
     public ListNode detectCycle(ListNode head) {

            // Consider a fast pointer which hops two nodes at once.
            // Consider a slow pointer which hops one node at once.
            // If the linked list contains a cycle,
            // these two pointers would meet at some point when they are looping around the list.
            // Caution: This point of intersection need not be the beginning of the cycle.
            ListNode fast = null;
            ListNode slow = null;
            if (head != null) {
                if (head.next != null) {
                    fast = head.next.next;
                    slow = head;
                } else {
                    return null;
                }
            }
            while (fast != null && fast.next != null) {
                // Why do we need collection here? Explained below
                Set<ListNode> collection = new HashSet<>();
                if (fast == slow) {
                  // Once the cycle is detected,
                     we are sure that there is beginning to the cycle.
                  // In order to find this beginning,
                  // 1. move slow pointer to head and keep fast pointer at
                        the meeting point.
                  // 2. now while moving slow and fast pointers through a
                        single hop, store the slow reference in a collection.
                  // 3. Every time you hop the fast pointer, check the fast
                        pointer reference exits in that collection.
                  // Rationale: After we moved slow pointer to the head,
                     we know that slow pointer is coming behind the fast
                     pointer, since collection is storing all nodes from the
                     start using slow pointer, there is only one case we get
                     that fast pointer exists in the collection when slow
                     pointer started storing the nodes which are part of the
                     cycle. Because slow pointer can never go ahead of fast
                     pointer since fast pointer already has an head-start, at
                     the same time, the first occurence will always be of the
                     starting point of the cycle because slow pointer can't
                     go ahead of fast pointer to store other nodes in the
                     cycle. So, the moment we first find fast pointer in that
                     collection means, that is the starting point of the
                     cycle.
                    slow = head;
                    collection.add(slow);
                    while (!collection.contains(fast)) {
                        slow = slow.next;
                        collection.add(slow);
                        fast = fast.next;
                    }
                    return fast;
                }
                fast = fast.next.next;
                slow = slow.next;
            }
            return null;
        }

Answer: I know there is already an accepted answer for this problem but I'll still try to answer in a fluid manner.
Assume :
The length of the Path is 'X+B' where 'B' is the length of the looped path and X of the non looped path.
    Speed of tortoise : v
    Speed of hare     : 2*v
    Point where both meet is at a distance 'x + b - k' from the starting point.

Now, let the hare and the tortoise meet after time 't' from beginning.
Observations:
If, Distance traveled by the tortoise   = v*t   = x + (b-k) (say)
Then, Distance traveled by the hare     = 2*v*t = x + (b - k) + b (since the hare has traversed the looped part once already)
Now, there meeting times are same.
=> x + 2*b - k = 2* (x + b - k)
=> x = k
This of course means that the length of the path that is not looped is same as the distance of the starting point of the loop from the point where both meet.
Comment: You can't assume that the tortoise travelled exactly x+b-k by the time they meet. Also, I don't understand how you got x+2*b-k for the hare's distance.
Comment: Because the hare would have traversed the looped part once already to have to met the tortoise.. I didn't explain it there :/
Answer: Suppose your pointers meet at the intersection of point y and z.
n and m are the numbers of loops faster and slower pointer takes respectively before meeting.
Refer to the image for the rest of the proof.
Find the starting point of loop in linked list


decompressing Multibit wallet private key in another wallet

Question: I have some bitcoin amount in my Multibit wallet. unfortunately i can not figure the password I put on it for transferring coins for the life of me despite trying all possible passwords i could think of. But i do have a back up copy of my private key and if you are familiar with multibit wallet you know upon backing private key it asks you to password protect your backup and i do have that password. so how can i impart this private key in another wallet and decompress it there? is there any wallet that can do it?
I do appreciate your help and comment.
Answer: Check out https://github.com/gurnec/btcrecover/blob/master/TUTORIAL.md#btcrecover-tutorial to brute-force the password, however, you will need many CPUs. If you need help, contact me.


Reducing TTL in DNS

Question: What stops us from reducing the TTL of all DNS entries to 1 minute or something less?
If that is done we won't have to wait mych for DNS changes to propagate so what all things force us to not do it.
Answer: If you have control over your own DNS TTL then there is nothing that stops you from setting it to 60 seconds.
Be aware though that some caching DNS servers will ignore your TTL and use their own so the changes you make may still take a long time to be seen.
Answer:
What stops us from reducing the TTL of all DNS entries to 1 minute or
  something less?

Nothing, happens all the time during major changes.

If that is done we won't have to wait mych for DNS changes to
  propagate so what all things force us to not do it.

Correct.
On a serious note this is a very poor quality 'question' for this site, it's not a discussion forum, please raise your game.
Answer: Some company already do : They keep all their DNS ttl at 300 second.
It can be useful when you rely on dns gslb to get datacenter redundancy.
There are some caveats, but without datacenter outage, everything works very well.
Answer:
What stops us from reducing the TTL of all DNS entries to 1 minute or something less?

The short answer:
It would hugely increase the load on many servers, without gaining any substantial benefit.
The longer version:
Nothing stops you, and your nameserver software may already support enforcing a maximum TTL (for example BIND has configurable "max-cache-ttl" and "max-ncache-ttl" options, which control the maximum TTL value for caching positive and negative responses respectively.)
But it's not generally a good idea, as setting an arbitrarily low TTL defeats much of the value of caching, needlessly and significantly increasing the load on both authoritative and recursive servers.
The thing is -- most of the information in the Domain Name System doesn't change very quickly at all.  For the information that does change frequently, the TTL can be set low.  In short, the system is already designed with a mechanism for properly expiring rapidly changing DNS information, which works quite well if operators set the TTL on their resource record sets appropriately.

Reducing TTL in DNS


How do I use machine learning to build a credit scoring model?

Question: There are currently a lot of ways for credit scoring. The most popular one is the FICO score, and its variants. For my masters thesis, I would like to work on making my own credit scoring system using machine learning. The idea would be to obtain some real life data, and evaluate the credit scores, not necessarily in the 300-850 range as in the FICO score. What are some good resources to understand how to go about doing the same? Any new ideas are appreciated! Also, what are some places I could get free data (or not so expensive data) to build my model?
Comment: This is too broad and depends very much on what you know. I recommend you talk to your advisor.
Comment: My advisor has asked me to work on precisely what I mentioned in the question. I have to build a credit scoring model using machine learning techniques. Any kind of new ideas or good resources on the topic would be very useful for research purposes.
Answer: One excellent resource is to try Kaggle and to examine some of the competitions, some of which are specifically on the application of machine learning to credit scoring.
https://www.kaggle.com/c/GiveMeSomeCredit
You wil see that the winning solution is made public, including source code and output.
https://github.com/IdoZehori/Credit-Score/blob/master/Credit%20score.ipynb
There are other problems in addition to this one so you should spend some time looking around. Here is another.
https://www.kaggle.com/c/loan-default-prediction
The preferred ML libraries are either in R or increasingly it seems that Python's Scikit learn is becoming very popular.
Also note that there are a number of p2p loan platforms in the US (and now in the UK) that provide some loan data for such analysis. Google Prosper and Lending Club. One final point is that if there is a data field with high predictivity, the p2p providers may prefer to keep it proprietary. As a result it may be hard to find models for these loans with good AUC statistics.
Stanford University also runs an ML course that covers credit scoring in the student projects submitted. Look here.
http://cs229.stanford.edu/
I hope that is enough to get you started.


obviate extreme gain noise

Question: Anyone knows about the lack of preamps to provide extreme gain setups? Even my sound devices 702 gets very noisy at the end of the gain range. Today i stumbled across this little device. It's a pre-preamp by Triton Audio. It provides the signal to the recorder preamp with very low noise and a hotter signal. Did anyone of you test this device?
Here's the link: http://bit.ly/1sev521
Comment: Thanks guys. I already own two of mkh8040 but i was thingking about if i can improve them even more. I ordered two of this amps via ebay and will post my results. Maybe we can get something great oit of them !
Answer: I've no experience with this type of gear, but functionality depends on the use-case.
This device (and there are several others available with similar function) is mostly useful on ribbon and dynamic mics. But in most cases, as a sound designer or sound engineer, those types of mics are used on loud objects (drums, guns, explosions, cars).
If you want to capture really quiet sound sources (i guess you want to crank more dBs out of your mics) a phantom powered condenser mic (large or small capsule) with a very low self noise (Sennheiser mkh series, rode nt1a, Neumann TLM103) are what you need.
I've recorded very soft sounds with my mkh50/60 paired with a Sonosax recorder.
Hiss will not be an issue until you step into an anechoic chamber.
Perhaps you can elaborate on what you want to record and which mics you use?
Answer: There is a great article on http://chromonaut.ch/2013/boost-zoom-h4n-recordings/
I have the same problem but haven't tested yet. They speak about problems with the Rode NTG-2, portable recorders and the Fethead phantom, anyone experience with that? Is there a problem with all condenser mic's?

obviate extreme gain noise


DB2 Integrity Checks and Exception Tables

Question: I am working on planning a migration of a DB2 8.1 database from a horrible IBM encoding to UTF-8 to support further languages etc. I am encountering an issue that I am stuck on.
A few notes on this migration:

We are using db2move to export and load the data and db2look to get the details fo the database (tablespaces, tables, keys etc).
We found the loading process worked nicely with db2move  import, however, the data takes 7 hours to load and this was unacceptable downtime when we actually complete the conversion on the main database.
We are now using db2move  load, which is much faster as it seems to simply throw the data in without integrity checks. Which leads to my current issue.

After completing the db2move  load process, several tables are in a check pending state and require integrity checks. Integrity checks are done via the following:
set integrity for . immediate checked
This works for most tables, however, some tables give an error:
DB21034E  The command was processed as an SQL statement because it was not a valid Command Line Processor command.  During SQL processing it returned:
SQL3603N  Check data processing through the SET INTEGRITY statement has found integrity violation involving a constraint with name "blah.SQL120124110232400".  SQLSTATE=23514
The internets tell me that the solution to this issue is to create an exception table based on the actual table and tell the SET INTEGRITY command to send any exceptions to that table (as below):
db2 create table blah_EXCEPTION like blah
db2 SET INTEGRITY FOR blah IMMEDIATE CHECKED FOR EXCEPTION IN blah USE blah_EXCEPTION
NOW, here is the specific issue I am having!  The above forces all the rows with issues to the specified exception table.  Well that's just super, buuuuuut I can not lose data in this conversion, its simply unacceptable. The internets and IBM has a vague description of sending the violations to the exception tables and then "dealing with the data" that is in the exception table. Unfortunately, I am not clear what this means and I was hoping that some wise individual knows and could help me out and let me know how I can retrieve this data from these tables and place the data in the original/proper table rather than these exception tables.
Let me know if you have any questions. Thanks!
Comment: Monday morning bump! Any thoughts?
Answer: The long and short of the solution to this issue is that there are characters in the database that violate constraints on specific tables after being converted to UTF-8 from the IBM-1252 encoding. The constraint is almost always a character limit. Once this data was fixed we did not experience an issue converting data.  This is however a long and awful process.


What is the difference between subvolcanic rocks and plutonic rocks?

Question: I'm studying Plutonic (Intrusive) rocks and I really don't understand the difference between Plutonic Rocks that form in Sills and Dikes from the so called  subvolcanic rocks, also known as a hypabyssal rocks. Aren't they the same? Why?
Answer: Main difference between a subvolcanic verses a  plutonic is depth at which the rock solidified at from its molten state.  Plutonic implies a depth greater than subvolcanic by definition but I am sure there is some overlap between shallow end of plutonic and subvolcanic.  Depth of emplacement for plutonic would mostly be much greater than 2 km.
Plutonic is an igneous rock formed by solidification at considerable depth beneath the earth's surface.
Subvolcanic rock, also known as a hypabyssal rock, is an intrusive igneous rock that is emplaced at medium to shallow depths (<2 km) within the crust.
Comment: Interesting, I had no idea. But in the last line shouldn't it be "(<2 km)"?
Comment: What confuses me is that dikes and sills are by deffinition plutonic structuctures ( at least from where i am studying; Tarbuck). And it says that they DO form at shallow depths. So, they should be subvolcanics.


recovery script for oracle database

Question: I have been told I need to create an sql script that recreates all of the tables/procedures/triggers/views/sequences, etc of my current database. Does anybody have any idea how I go about doing this? It is an oracle 10g express database.
Answer: DBMS_METADATA.GET_DDL is your friend.
And then invest some time in learning a source control tool such as SVN or GIT.
Answer: Another option is to go old school and do a no rows export via the exp command.
Setting ROWS=N in the exp parameter file will mean metadata only is exported, no actual data.  You would use the imp command to restore that metadata.
Be aware exp generates a binary dump file - if you want SQL scripts use DBMS_METADATA as mentioned by Gary.
Answer: If you don't fancy getting to grips with DBMS_METADATA then you can use Oracle's free developer tool called SQL Developer which can create this script for you in a few clicks, either for the whole database, an object type, or just one object.
I'm all for learning the DBMS packages but in this case you'll be done and enjoying a hot beverage of your choice in less then the time it'll take to read up about GET_DEPENDENT_DDL.

recovery script for oracle database


What is the word for a property no more necessary but still present in a object?

Question: As an example the small ring in the maple syrup bottles: now too small to be usefull but still present
Comment: I was going to say "vestigial", as it sounds like just what you are looking for, but that applies to live things, but maybe you could (in a poetic whim perhaps) use it for an object.
Comment: I'll just come out and ask it: what purpose did the ring serve?
Comment: Reading your question title, I thought of _obsolete_. But from your example, I _think_ (not everybody knows what an "acer syrup bottle" is!) you might mean something else. Are you referring to something that is part of a design, but does not serve any functional purpose?
Comment: @oerkelens yes! exactly this... something left in the design but not more functional as in the bottle here: http://cdn6.bigcommerce.com/s-xizoo/products/286/images/1579/syr12__89623.1441782888.300.300.jpg?c=2
Comment: @user1717828 from Brooklin Brainery: "the handles are a remnant from when most jars were large earthenware containers. The handle's useful when you're carrying five pounds of liquid, but not so much when you can easily grab the whole bottle in the palm of your hand."  :D
Comment: @user1717828 now is just a reference or a simbol to make the maple syrup bottle more recognisable
Answer: For parts of the human body such as the appendix, the term vestigial is often used. Here is a definition:

Used to describe something, especially a part of the body, that has not developed completely, or has stopped being used and has almost disappeared

Note that the definition does not exclude its usage for things that are not parts of the body. Here are a couple of examples of its non-medical usage which definitely carry the meaning that they no longer have a purpose:

As it turns out, these vestigial urban remnants that serve absolutely no purpose have a name. They're called "Thomassons" - 6sqft
..a doorway like an ancient castle narrowing to a sort of stone tunnel as if for defense — one of those vestigial architectural features which Lanny had explained to Leutnant Rörich at the Château de Belcour Presidential Agent

The first article also proposes the term Thomasson for architectural features that serve no purpose yet are still maintained.

The term "Thomasson" has its roots in Gary Thomasson, an American baseball player who was traded to Tokyo's Yomiuri Giants. Thomasson was paid a fortune for a two-year contract, but eventually lost his luster and was benched for most his contract. For Akasegawa, Thomasson was both "useless" and "maintained."
Comment: The part itself could be referred to as the **vestige**.
Comment: @PCARR: I am not sure that vestige has the **stopped being used** sense: looking at Ngram instances, it is mainly used in the sense of **a small part** or **the last trace**. https://www.google.com.eg/#q=%22vestige%22&tbm=bks&tbs=cdr:1,cd_min:1827,cd_max:1838&lr=lang_en&gws_rd=cr
Answer: At first, I saw no problem calling it

a vestigial ring, or a vestige
an ornamental ring, or an ornament
a remnant.

However, after searching around, I found this:

According to Brooklyn Brainery, who asked themselves the same question, those tiny handles are remnants from a time when maple syrup jars came in large five-pound earthenware containers, when the handles clearly served essential functional roles. But over the years, due to the fact that we associate that container shape with maple syrup, the handles have been retained as a design element in the shrunken version we now buy, even though they don't serve any real function. In fact, maple syrup handles are a classic example of a skeuomorph, a "retained but no longer functional stylistic feature."  (Source.)

From Wikipedia,

A skeuomorph  is a derivative object that retains ornamental design cues from structures that were necessary in the original.

Skeuomorph is not a widely known word. A quick search for some idea of the comparison gives the following.

So although skeuomorph has the definition we seek (and apparently it was precisely the word you were looking for), your audience is more likely to understand what you mean if you call the ring a vestige, or vestigial. They'll get the idea that the ring is left over from a previous design or purpose, but that it is no longer necessary.
Comment: Brilliant! I learned a new word today. Maybe [this wikipedia link](https://en.wikipedia.org/wiki/Skeuomorph) is handy to add to your answer, with a small quote from it defining the word _skeuomorph_?
Comment: skeuomorph is the word I was searching ( I have heard it long time ago in my mother language and then forgot). thanks
Comment: Wow, perfect. This, in my view, would be the word to use for an object, and "vestigial" for live things...since an object can't really evolve a feature out, this word acknowledges that. Great answer!
Comment: Skuemorphism also applies to using icons that no longer fit... Pad of paper for notes or... Floppy for save files.  Lots of articles related to skeu and computer/phone icons
Answer:
ornamental (adjective):
  serving or intended as an ornament; decorative.

"Ornamental" conveys the basic idea that the handle is not functional, and would be appropriate for all audiences.

vestigial (adjective):
  forming a very small remnant of something that was once
  much larger or more noticeable.

"Vestigial" conveys that the ornamental handle was functional in an earlier incarnation of the object. This term would be appropriate for an educated audience.

skeuomorph (adjective):
  an ornament or design on an object copied from a form of the object
  when made from another material or by other techniques

"Skeuomorph" is a delightfully precise term, indicating that the vestigial feature is an intentional design cue.  However, since its introduction circa 1890, it has not been widely used by laypersons. As such, this jargon is best employed when speaking to an audience specializing in design, marketing, engineering or a related field. Also, most definitions of skeuomorph require the traditional object to be made from another material rather than simply a larger scale. That said, this is still a very young word and could benefit from expanding usage.
Comment: Queue ->  Cue . . .
Comment: @peterG: fixed.
Comment: I note that SE's spellchecker things that "skeuomorph" is a misspelled word, to emphasize how little it is used.
Answer: As @oerkelens noted in his comment on the question, obsolete may be a useful descriptor, but it often refers to a whole object that is outdated and may have a newer version available.
I also thought of deprecated, but I think this word is primarily used in programming to refer to properties or algorithms that should not be used because newer versions exist that should be used instead.
Answer: Speaking more generally - superfluous is a good word to describe something extra but unnecessary
Comment: In general, you're asked to provide evidence whenever possible in order to provide high quality answers. - [From Review](http://ell.stackexchange.com/review/first-posts/44159)
Comment: I could have included a link through to dictionary.com, but assumed that if the OP was savvy enough to use StackExchange such a link would be superfluous!


How many Apple IDs should one household have?

Question: To date my wife and I share one Apple ID for all Apple purchases and devices. We currently own a first and third generation iPod, iPhone 4, and will own an iPad 2 in the morning. Thus far having the one account has not been an issue, but with more Apple purchases to follow at what point does it make sense to have more than one Apple ID? What are the advantages and disadvantages of having one or multiple accounts? If we each had an iPhone would multiple Apple IDs be required? What's the relation to iCloud?
Answer: There is no limit and having more is not necessarily better. Having all your devices registered under one Apple ID has the benefit of having all your purchases pushed to them without having to manage multiple accounts. So your wife can enjoy an app on her iPhone 4 just the same as you can enjoy the same app on your iPad 2, without needing to purchase the app a second time (once for each device), or constantly logging in and out of various Apple IDs to install and update.
I find it is always better to pool your purchases to one account and register your devices under that single account. Having multiple Apple IDs requires that one micro-manage each account (iTunes will only check for updates for the current Apple ID), which can be bothersome at the best of times and a nightmare at the worst of times.
One advantage of having separate Apple IDs, however, is that each account belongs to its respective owner and can be registered to their own payment methods. But if you share your finances, that is of little value to you.
iCloud is bound to its respective Apple ID, so if you have just the one, all the features of iCloud would permeate through any device registered to that account. That means if you downloaded an app on your iPad 2, it would appear on your wife's iPhone 4. You would also share documents, pictures, music, etc. (anything supported by iCloud and expressly enabled by you) across all your devices as well—email as well. iCloud would essentially unify them and their content.
Multiple Apple IDs are not required. You may also find this article on managing multiple devices (although somewhat dated when iCloud launches).
Comment: Absolutely. Devices are registered by their unique serial numbers. So you could have 4 iPhones under one Apple ID if you wish.
Comment: @GEdgar sure. But the store is digital. It doesn't run out of stock or close. Moreover buying something literally takes 2 seconds (unless you have an obscenely long password), so I would say that it wouldn't really be an issue. You could make the purchase in the time it takes for her to pick up her iPad ;)
Comment: Perhaps info on "Family Sharing" should be included? http://www.apple.com/ca/icloud/family-sharing/ That allows each person to have their own AppleID for their own devices, but still share most (virtually all) purchases.
Comment: Very detailed answer! One question is it possible to have multiple devices of the same type associated with a single account? I know that at one time their was a restriction against doing that.
Comment: excellent then I'm happy we've stuck w/ the one Apple ID for all these years.
Comment: I suppose there could be some desire for privacy from each other.  Say you buy her a birthday present, but she sees it on the Apple account before the big day...
Answer: FaceTime can't be used to call each other on the same iTunes account, for this reason alone you must have a separate apple ID to make use of this great tool.
Comment: @Matt You can use any email address as an Apple ID, but the address has to be an Apple ID in order to use it with FaceTime. However, you can use multiple Apple IDs for various parts of iOS (i.e. one for iCloud, another for FaceTime, another for the App Store, etc)
Comment: Doesn't FaceTime also work with Gmail addresses? That would provide separate identification while using the same Apple ID. I cannot prove this however.
Comment: I use one Apple ID but I can FaceTime between devices by adding additional e-mail addresses and "calling" those addresses. See http://apple.stackexchange.com/questions/45666/use-facetime-with-the-same-apple-id  This is particularly easy with Gmail which allows you to use multiple addresses to ref. the same account: http://evernotefolios.wordpress.com/2012/04/27/multiple-email-addresses-with-one-gmail-account/
Answer: Check out this excellent FAQ from Apple on Apple IDs and iCloud: http://support.apple.com/kb/HT4895
Of particular interest are the sections:

Using the same Apple ID for Store purchases and iCloud (recommended)
Using one Apple ID for iCloud and a different Apple ID for Store
Purchases
Answer: I actually think multiple ids are a good idea.  I too assumed that if I bought an app from one account the other account would not be able to use the app.  But if you sync the app from the same iTunes installation (Windows7 for me).  The paid app works on all the iOS devices. Facetime & Messages are also a great reason to have multiple accounts.
Answer: You can use one Apple ID for FaceTime across multiple devices that have distinct Apple ID for app purchase. I can contact my son's iPod Touch with my iPhone using the same ID, all I did was change what email I can contact him on because it's not a phone (gmail). Works perfect for us with no confusion.
Comment: Not a good standalone answer as it doesn't relate to the original question. IMHO this should have been a comment to the Lee's answer instead.


Installing Silverstripe on 000webhost.com (free web host)

Question: I'm trying to learn how to work Silverstripe so I extracted the tar file to my free hosting account. I then went on install.php and edited the permissions to meet the requirements set out in install.php but I still get two warnings from the 'webserver configuration' section:

I can't tell what webserver you are running. Without Apache I can't tell if mod_rewrite is enabled.
I can't tell whether mod_rewrite is running. You may need to configure a rewriting rule yourself.

I looked in phpinfo() and mod_rewrite appears to be installed. I contacted the web host and they said it was to do with virtual directory paths, and I should add 'RewriteBase /' to the top of my .htaccess file in the public_html directory. However I did this and still had the same problem. The install.php script says that I can install it even with these warnings but when I press 'install' it just refreshes the install.php page. It doesn't even overwrite the .htaccess file. 000webhost.com says they have successfully installed Silverstripe on their user accounts without much configuration but I can't seem to find out how.
EDIT: I managed to get to the next page but now there is another warning which is stopping it installing:

Friendly URLs are not working. This is most likely because mod_rewrite isn't configuredcorrectly on your site. Please check the following things in your Apache configuration; you may need to get your web host or server administrator to do this for you:
  * mod_rewrite is enabled
  * AllowOverride All is set for your directory

I also get this error message from the server:

Warning: unlink(mysite/_config.php) [function.unlink]: Permission denied in /home/a2716553/public_html/install.php on line 701
Answer: It looks like your webserver user can't write to .htaccess and to mysite/_config.php.
Try changing the permissions of these files to 777 (rwxrwxrwx), and changing the back again after a successful installation.


Is there an optimum for swimming stroke rate?

Question: I started swimming and trying to swim 1500m nonstop (as a first goal). I gradually increased my set distances. After 4 weeks I can swim 1000m nonstop. I guess I will reach 1500m in 2 weeks. One thing I observe is; my stroke count per 50m decreased from 59 to 48 in 3 weeks period. But it stopped there. (I can now swim 1:52 100m)
My question is: Is 48 strokes per 50m a good rate or should I try to lower the stroke count by lengthening the stroke length?
Answer: The world record holder on 1500m is Sun Yang, an analysis of his stroke per length and stroke rate can be found at Sun Yang. His stroke rate (or frequency) is 0.96 (almost a stroke per second) and his strokes per 50m length is 27.
Your stroke rate is 0.85 (48 strokes per 56 seconds) or 51 strokes per minute, i.e. slower than Sun Yang (58 strokes per minute), and you need 48 strokes (1.04 m/stroke) where he needs 27 (1.85 m/stroke).
In figure 1, I have plotted the two points and one of my own measurements: {{1.85, 0.96}, {1.04, 0.85}, {1.78, 0.68}} and also - assuming constant speed - the Stroke frequency as a function of Stroke length, that is Speed = Stroke frequency * Stroke length
Here, you can see that if Sun Yang had a shorter Stroke length (e.g. not have as long arm as he has), he has to increase the Stroke frequency to swim with a the same speed. For me to approach Sun's speed (not likely to happen :-)), my focus should be to increase the frequency.

Fig 1. Constant speed as a function of Stroke frequency and Stroke length
Whether you want to change speed or keep the speed constant and work with a frequency, length combination, depends on your overall goals for swimming. Two references that can help you are:

An analysis from an Total Immersion instructor, Mediterra Swim - Smart speed part 1 and 2, there is no good/bad answer there but a framework for analyzing and thinking about the problem.
Based on Swim Smooth, your stroke rate is just about right for your
100m speed, se Swim smooth stroke rate.

Assuming that you want to go faster, I would experiment with the stroke rate, e.g. through getting a tempo trainer, e.g. Finis tempo trainer. However, my own experience as almost beginner, is that if I increase the effort beyond my technique, I get really tired very fast.
Comment: Just wanted to add that you can "artificially" lower your stroke rate by extending the glide phase, but that's not really accomplishing what you want. As you get more efficient with your stroke, your rate will naturally lower. If you would really like to improve, then you may need to take some lessons. Swimming is *extremely* technique driven, so once you get as fast as your fitness will allow, any further improvements will have to come from stroke refinement.
Answer: Would like to add the "glide" phase is the most misunderstood portion for the stroke. No matter what type of swimming learning / teaching you follow there should be a constant movement on the front end of the stroke. What appears to be gliding is simply a swimmer that has gotten very good at full extension with a seamless transition to a catch and then either pull or push depending on what you believe. If done properly its really a push but a great majority will call it a pull. Never focus on pause or glide, focus on the feeling of full extension which will feel like a slight pause as the hand moves forward, shoulders and body rotates to achieve full extension then immediate catch propel. And please dont think about the rotation, it should be seamless, not thought about during the stroke and simply executed.
Answer: Glide phase is important.  So on each stroke, you want to hold it for a minimal amount of time to enjoy the benefit of the glide.
I was taught to bring your arm forward, stretch out, for maximum length, hold that hand forward for a pause, then bring the other arm back, holding that one forward.
Same on breast stroke, you need to hold the glide for a moment.  (I cannot define the length of that moment).


Can we compare the color reproduction accuracy of 2 camera sensors only by looking its sensor spectral sensitivity curve?

Question: I have the camera specifications from the manufacturer. The RGB quantum efficiency curve (I think it is also the spectral sensitivity curve) is provided. How can we compare these two cameras's quality of color reproduction directly from the curve? Or we need set up an experiment to do this? Thanks.
Comment: What exactly do you mean by *quality of color reproduction*? At the end of the day, we 'reproduce photos' by storing just three pieces of data for each pixel: RGB. In general, there will be (uncountably) infinitely many combinations of frequencies which will be assigned the same RGB value. It's the pidgeon-hole principle.
Comment: You could use a monochromator to generate a beam of light with a very narrow wavelength range and measure the output of the sensor as you change the wavelength. Or alternatively you could use a diffraction grating and look at the range of colours across the sensor - I would expect a smoother transition for better colour capture. No model has a true RGB value as such, RGB is just one model to represent colours. There's also HSL, CMYK and almost certainly others.
Comment: @Rob What you describe is roughly how her graphs were generated. They represent the efficiency of the sensor to reproduce a generated wavelength through as series of generated wavelengths in a device called a spectrophotometer.
Comment: It seems to me this entire question is based on a false premise: That every specific color we perceive has a specific wavelength. That is not the case. Further, the 'true' RGB value of various items in the scene varies based on the properties of the light illuminating them. Broad spectrum light centered on 5000K (essentially D50) will make the same things look a vastly different color than narrow band 2700K sodium vapor lights. The RGB channel overlap in camera sensors that you seem to think introduces inaccurate colors works exactly the same as human vision does.
Comment: @Myridium Human eye also divide whole spectra to three-colour + brightness signals. That's why RGB colourspace works. If the eye would work with *n* types of colour receptors, we would have *n*-dimensional colour spaces for display and *n+1*-dimensional spaces for so-ho printers.
Comment: Yes, true, this is why we use RGB. [However...](https://en.wikipedia.org/wiki/Tetrachromacy#Humans)
Comment: The quality of color reproduction here I mean is: when capture the image of an object, which camera can get the RGB value closer to the true RGB value of the object, less RGB channel overlap
Comment: If the scales of the two graphs were equalized the comparison might be more meaningful.
Comment: You are discussing sensor not camera characteristics, per se. Please modify the question and title to deal with this. It will modify existing answers possibly.
Comment: For more, please see: [Can all colors be described with RGB?](https://photo.stackexchange.com/q/87240/15871)
Answer: tl,dr: No, you have to set up proper experiment and evaluate it using calibrated display/printer.
Spectral sensitivity is only one part of the whole process. Between the capture and the print things that alters the "image":

Filters (UV, polariser, colour, neutral grey)
Lens
Sensor mask and sensitivity
In-camera algorithms
Postprocessing
Print

Let's say we may neglect filters, postprocessing and print effects.
Still there may be differences among lenses and lens manufacturers regarding spectral transmissivity of their products.
Note that when the sensor is exposed the signal is analoguous - the higher charge in the well, the more light was captured. This signal is then digitalised and converted to RGB values. The digitalisation method and RGB conversion algorithm may differ among manufacturers.
Comment: @ZhaoHuang Yes, but any differences are pretty meaningless with regards to photography since one must use at least a lens, sensor, demosaicing algorithms and other postprocessing steps to obtain a viewable image.
Comment: @ZhaoHuang You already have that data presented with your question. Your two graphs compare the two sensors and their response across the visible spectrum. They tell you nothing about accuracy. You cannot use photography to accurately record colour; but, it's great for perceptual rendition.
Comment: Is there any way to compare the camera sensor chip only? not include the lens and filters, etc. Just compare how good the sensor can response to light
Comment: I would repeat items 4 and 5 about three times each :-). Those are (one hopes) specifically designed to compensate for all differences between the Bayer filter spectral curves and the human eye's retinal spectral curves.  (yes I know about the many magical neurological adjustments to perceived color.)
Answer:
How can we compare these two cameras's quality of color reproduction directly from the curve?
"which camera can get the RGB value closer to the true RGB value of the object, less RGB channel overlap"

A comparison of color reproduction potential based on quantum efficiency of the sensor filters is possible.
As others have mentioned, there are many contributing factors to the final color reproduction of a full color camera system. However, the sensor RGB sensitives are perhaps the largest contributing factor to color reproduction accuracy and their color reproduction performance can be measured.
What is true RGB
First we have to answer, what is the "true RGB" of a scene? A good definition of "true RGB" would be the relative responses of a human's three retinal cones to the scene. These cones are called LMS, long medium and short.

A spectrum of light integrated over these three sensitivity curves yields three LMS values that can be thought of as human RGB values, these are the target RGB values we want to reproduce with our camera if our goal is accurate color reproduction.
More commonly, we could also target the sensitivities of the XYZ color matching functions. These are linear combinations of the LMS functions so they are effectively interchangeable with the LMS functions.

Color Correction
In a digital camera, when a spectrum is integrated against the camera sensitivities (like the ones you posted) the resulting RGB values are called "camera RGB".
In most digital cameras there is processing step where a color correction algorithm (M) will be used to convert cameraRGB into humanLMS (or XYZ).
M(cameraRGB) = humanLMS
In this case, humanLMS will be a guess. It will not be perfect, and the difference between the guess and the real LMS value a human would have perceived is your color error.
Designing a good M is difficult because it is an under determined problem, some cameraRGB values have multiple potential humanLMS values (this is called metamerism) so it's not always possible to know exactly what the correct LMS is, but we can use natural image statistics and machine learning to make a guess at the most likely correct answer.
The most common implementation of M is a 3x3 linear transformation matrix, but if the camera sensitivities are not linear combinations of LMS then the transformation will contain errors. If the camera sensitivities happen to be linear combinations of LMS then the color error would be zero, this is called the Luther Condition. In practice digital camera sensitives never satisfy the Luther Condition so there is always color error.
Comparing Color Reproduction
There are now two factors that play into how accurate our LMS guesses are.
1) the design of our color correction algorithm M
2) how similar our sensor sensitivity curves are to the LMS sensitivities
This gets at the heart of your question: some sensitives will result in quantifiably more accurate colors than others because they are closer to the LMS sensitivities which makes it easier to guess the LMS value, which is the "true RGB" we desire

Or we need set up an experiment to do this?

What might be helpful is "ISO standard 17321, Sensitivity Metamerism Index". This calculates color reproduction accuracy based on spectral responses.
https://www.dxomark.com/About/In-depth-measurements/Measurements/Color-sensitivity
http://www.iso.org/iso/iso_catalogue/catalogue_ics/catalogue_detail_ics.htm?csnumber=35835
This index tells you the average perceptual difference between colors recorded by your camera that have been linearly corrected by a optimized 3x3 matrix, and the known colors of a test scene.
The only problem is this procedure is done with a full camera so it's measuring the color error of the the sensor and the color correction matrix and the optics etc, not only the sensor.
If you truly only want to quantify the error of only two different sensors you could do the SMI procedure with the same camera and only change the sensor. Or instead of a physical experiment with a real camera you could simulate your camera in software and not include any optical or demosaicing  contribution to the simulated cameraRGB values.
There are many papers on camera simulation for more info on that: http://color.psych.upenn.edu/simchapter/simchapter.pdf
"CIE Special Metamerism Index: Change in Observer" is another relevant standard meant for comparing color reproduction in humans with slightly varying spectral responses. I think you could apply this to camera spectra as well.
http://link.springer.com/referenceworkentry/10.1007/978-3-642-27851-8_322-1#page-1
Comment: I read the articles you cited. The links you provide dispute your claim. The question was about the use of the sensor data, not about the post processing required for human perception which your articles address (most notably the last one cited). The last article explicitly states that it is not possible without a "calibration" phase. (my term and quote emphasis). According to the articles, it is only theoretically possible when the sensor has characteristics that exactly conform to the "ideal independent observer."
Comment: @stan As far as I can tell, the fundamental question here is: given two RGB sensors with different spectral responses curves can we say anything about which can reproduce colors more accurately.

That question is well understood and the answer is yes, the sensor with spectral curves closest to a linear combination of human LMS spectral responses will have less uncertainty when you go to apply a color correction from camera RGB space to CIE perceptual space.
Answer: You have the answer in the curves you present for comparison.
You can compare the response of one sensor to another directly at any common point to the two sets of data. For example, the efficiency of each of the sensors at 550nm can be given and compared. That's the only statement that can be made with the given data.
A statement about whether one sensor is "more accurate" than the other cannot be made. The only statement that can be made is already given (plotted)—the relative quantum efficiency.


Why did the USA invade Okinawa instead of one of the many other islands in southern Japan

Question: There are many other islands in southern Japan that seem large enough for B29 runways (the current runway is 2 miles). Why didn't the USA pick the island of least resistance? I'd assume Okinawa was the most fortified due to its size and local population.
Answer: The Allies weren't taking Okinawa for B-29 runways. They had those already in the Mariana Islands. A B-29 airfield was built on Okinawa, but the first attack from it against Japan happened on the last night of the war.
The primary reason for taking Okinawa was as a base for the invasion of Japan, both for ships and shorter-ranged aircraft. Okinawa has harbours, and Kadena Air Base had already been built by the Japanese.
This required taking all of the Ryukyu Islands, and that's what was done. The Battle of Okinawa is the famous part of this campaign, because the Japanese concentrated their resistance there, knowing that while they held the main island, the other islands would be of limited use. You can't set up mobile fleet bases while the enemy are still within artillery or small-boat attack range. The other islands in the group were taken comparatively easily, so the combats are not famous.
Sources: Okinawa, 1945: Final Assault on the Empire, Simon Foster, 1996 and  Okinawa: The Last Battle, the relevant volume of the US official history, available here.
Addendum: Of course, once you have a base, other uses for it emerge. In July 1945, Halsey's Third Fleet attacked the Tokyo area, and then, as best the Japanese could tell from radio intercepts and direction-finding, moved south. This was confirmed when carrier aircraft attacked Kyushu, the southernmost main island of Japan, and Japanese aircraft were moved south for a counter-strike on the Third Fleet. But it wasn't there. The radio intercepts had been staged from the USS Tucson, which had separated from the fleet, carrying radio operators from Halsey's staff and sailed south, imitating Third Fleet's traffic. The carrier aircraft had flown from Okinawa.
Third Fleet was located again when it attacked steel plants and rail ferries in Hokkaido and northern Honshu, and the Japanese were unable to retaliate effectively. This raid sank eight and damaged four of the twelve rail ferries that carried coal from Hokkaido to Honshu, cutting the amount of coal that could be transported from the mines in Hokkaido to industry in Honshu by 80%, and crippling Japanese war production. Source: Holt, The Deceivers, pp. 769-770.
Comment: A quick glance at p.419 of https://history.army.mil/html/books/005/5-11-1/CMH_Pub_5-11-1.pdf might help improve this answer. It would be a shame to waste all those lovely up-votes. :-)
Comment: @AgentOrange: Better?
Comment: *"...the last night of the war."* Was this the bombing of Tsuchizaki, which at least in recent years is currently a part of Akita City?
Comment: (1) Okinawa was the key island in the Ryukyu group, with the important port, anchorages, existing airbases, and Japanese defenses, as you said. (2) The US wanted bases in the Ryukyus for the invasion of Japan, and for the projection of power into Asia (ie. China), so the B-29 basing was important. (3) Okinawa itself was initially deemed unsuitable for airbase development and a small number of other islands in the group were intended to be occupied in follow-up operations for airbases, including the B-29 base. It was never intended to occupy all the islands in the group.
Comment: (4) After Okinawa and Ie Shima were occupied it was discovered Okinawa was in fact very suitable for airbase development, and so follow-up operations were cancelled. Only one additional island was occupied (for an early-warning station). The number of airbases scheduled for Okinawa was increased from 8 to 18, including the B-29 base. So I think only three islands in total were occupied in the Ryukyu group. Which brings us back to the original question... I think the importance of the naval bases, and the elimination of the key Japanese defenses in the group were probably the actual reason.
Answer: Okinawa is the largest (by far) of the Ryukyu Islands. Given the importance of these islands, as discussed in the rest of the answer, this made Okinawa the one to own. That is, Okinawa had room for "runways," harbors, and other facilities, in addition to its strategic importance.
A large part of the importance of the Ryuku Islands stems from the fact that it is a chain of islands that more or less link Japan to Taiwan, and points south and west. With the possession of those islands, America could completely cut off the Japanese Home Islands from its possessions in China. Had the atomic bomb not been dropped, the year 1946 might have featured an invasion of Japan simultaneously with the liberation of Japanese held China.
From an "invasion" perspective, the Ryukyus generally, and Okinawa particularly, were close enough to the main Japanese islands for both ships and short-ranged aircraft to be a menace to Japan, and yet not so close as to meet the "main force" of the Japanese defense. This made them an ideal target for a "preparatory" invasion in 1945.
Comment: @philn:Okinawa https://en.wikipedia.org/wiki/Okinawa_Island has ten times the area of Saipan in the the Marianas, which didn't have quite enough "room" for everything the U.S. needed.Okinawa was also the 5th largest island of Japan (after the four main ones).
Comment: How important was "room" to the USA? Is there an estimate for how much of  Okinawa would have been used?
Comment: @philn Initially the US was proposing to build just 8 airbases on Okinawa, as the terrain of the island was regarded as largely unsuitable, and they intended to occupy other islands in the Ryukyus in follow-up operations to allow for additional airbases, including basing for B-29s. Having occupied and surveyed Okinawa they soon realized there was a much greater potential for airbase construction on Okinawa itself than had been anticipated. They cancelled the proposed follow-up operations and increased to 18 the number of airbases to be constructed on Okinawa, including the B-29 field.


How to make Okular open in predefined screen?

Question: I hope you can help me in this really painful problem.
When I open several pdf from firefox, Okular always appears exactly where I am currently working (trying to open new pdfs). This behavior is really annoying as I am forced to put the newly opened pdfs to the right side of the screen before continuing with my work.
I think it be really helpful to make Okular open either on a certain side (left oder right) of the active screen or in another (inactive) screen. Does anyone know how to do that?
Answer: I knew that Compiz can be configured to do that via CCSM, seems like KWin can do that too, even better.


Can I use glue instead of nails to install shoe molding?

Question: I installed engineered bamboo flooring in my home office and have quarter round shoe molding to install to cover the expansion gap. Given how hard the trim is (I've bent nails installing the carpet reducer), can I use glue to fasten the molding to the baseboard? If so, what glue do you recommend?
Comment: Try using one of the nails itself to predrill the hole.
Comment: Are you predrilling the nail holes?
Comment: I predrilled the holes in the carpet reducer. Used a 1/16 bit for 6d x 2" nails. Would using 4d x 1.5" nails help with pre-drilled holes?
Comment: Have a nail gun, 3 in fact. They don't work installing bamboo quarter round molding. Love the floor which required 18 ga. Cleat nailer. No luck with quarter round. Looks like I will have to return trim and stain my own molding....not bamboo!!
Answer: Shoe molding may have to be removed in the future to work on the floor or the wall. That's fairly easy with nails. It's fairly difficult with glue, unless you use something like hide glue that's specifically intended to allow disassembly ... and the techniques used for that would be hard to apply in situ to parts of a house.
Generally, don't glue anything that may need to be serviced, unless you're willing to risk having to destroy it to remove it.
Answer: If you where going to glue it
You would need to use timber white glue from your local hardware.
The problem with glueing is that you can't get the glue on the floating floor since it needs to be able to move.
An another problem is that if you have painted stuff the glue won't stick as well
So saying that you are better off hiring a gas / or air nail gun. If you don't have one.
You will get it done in no time.
An dont need to worry about making a mess with glue
You can also pre drill a pilot hole
Use a drill bit a tiny bit smaller then the nails.
You won't have a problem bending nails this way.
Comment: Just depends if he wants to spend the money hiring a nail gun. Next best thing is pre drilling the nails.
Comment: I agree that a finishing nail gun would work fast and easy.
Answer: We have the base already installed and are adding a shoe base to cover a small gap created by the floating and expanding and contracting bamboo floor.  We plan to glue it to the existing base that was attached with a brads and a air stapler.  Since it will be glued only to the base, not the floor, all could be easily removed.