Does a player having one hand increase the likelihood of other players also having that hand?

Question: Say a deck of cards is dealt out equally to four players (each player receives 13 cards).
A friend of mine said he believed that if one player is dealt four-of-a-kind (for instance), then the likelihood of another player having four-of-a-kind is increased - compared to if no other players had received a four-of-a-kind.
Statistics isn't my strong point but this sort of makes sense given the pigeonhole principle - if one player gets AAAAKKKKQQQQJ, then I would think other players would have a higher likelihood of having four-of-a-kinds in their hand compared to if the one player was dealt AQKJ1098765432.
I wrote a Python program that performs a Monte Carlo evaluation to validate this theory, which found:

The odds of exactly one player having a four-of-a-kind are ~12%.
The odds of exactly two players having a four-of-a-kind are ~0.77%.
The odds of exactly three players having a four-of-a-kind are ~0.03%.
The odds of all four players having a four-of-a-kind are ~0.001%.

But counter-intuitively, four-of-a-kind frequencies appear to decrease as more players are dealt those hands:

The odds of two or more players having a four-of-a-kind when at least one player has four-of-a-kind are ~6.24%.
The odds of three or more players having a four-of-a-kind when at least two players have four-of-a-kind are ~3.9%.
The odds of all four players having a four-of-a-kind when at least three players have four-of-a-kind are ~1.39%.

The result is non-intuitive and I'm all sorts of confused - not sure if my friend's hypothesis was incorrect, or if I'm asking my program the wrong questions.
Answer: First off: there are
$$\frac{1}{4!} \cdot \left(\begin{array}{c}52\\13\end{array}\right) \cdot \left(\begin{array}{c}39\\13\end{array}\right) \cdot \left(\begin{array}{c}26\\13\end{array}\right) = 22,351,974,068,953,663,683,015,600,000$$
distinct combinations of four thirteen-card hands drawn from a deck of 52 cards. If each combination takes just one nanosecond to examine, it would take thousands of years to examine any significant fraction of the possibilities -- and about 700 billion years to examine every combination. It seems likely that your Monte Carlo simulation just didn't have enough time to get an accurate statistic here. Did you get the same values from running the simulation multiple times?
Since the probability space is so large, we'll probably need to approach this based on theory. Inconveniently, analyzing four-of-a-kinds with thirteen-card hands is complicated, so let's simplify to a smaller deck. Consider a deck of cards with just two ranks (A and 2) and two players. In that case, if one player has a four-of-a-kind, then the other player automatically does as well. This extreme case suggests that your friend's hypothesis is correct.
To test the idea, let's step it up a little: three ranks (A, 2, and 3) but still two players. Then the probability of one player having a four-of-a-kind is given by
$$\frac{3}{11}\cdot\frac{2}{10}\cdot\frac19 \cdot \left(\begin{array}{c}6\\4\end{array}\right) = \frac{1}{11}$$
but the probability of the second player having a four-of-a-kind given that the first player does is $1/2$ (as long as the leftover two cards in the first player's hand match, the second player automatically has the other four-of-a-kind).
This pretty clearly highlights the trend: one player having a four-of-a-kind does increase the likelihood of other players having four-of-a-kinds. It's just a difficult phenomenon to see in a large deck.
Comment: Thanks.  The Monte Carlo thing was just to get an estimate - I only ran through about 250,000 iterations.  The end game of the program was to see exactly how much more likely other players were to have same-content hands.  I guess that would be more of a question for Stack Overflow.
Answer: You have to be careful what question you are asking.  What your friend seems to be claiming is if you draw a hand of $13$ cards for one player and it has four of a kind, the chance of a second hand you draw from the rest of the deck having four of a kind is increased.  My intuition agrees with that.  Distributing all the cards and asking the chance of two four of a kinds given there is one four of a kind is a different question.  It seems likely you could modify your program to ask the first question.
For a comparison, I imagined four players each flipping a coin with $0.05$ chance to come up heads.  Clearly here your friend's question has player $2$ getting heads with chance $0.05$ regardless of what player $1$ does.  The chance at least one player gets heads is about $0.1714$.  The chance at least two players get heads, given that at least one did, is about $0.07558$, which is less than the chance of at least one getting heads.
Comment: Yeah - I could take that approach.  My first pass approach was to count how many times I see an instance of 0, 1, 2, 3, or 4 players having a hand, and dividing by `iteration_count * 100` - *then* taking those data points and adding/dividing etc.  I was having (and still am) having a hard time translating the equations into plain English.
Answer: Without even doing the calculations you can see intuitively that this must be true.  If one player has four-of-a-kind then they have taken all four cards with the same number/face out of the deck, which means that the remaining deck now has heavier concentrations of each of the remaining numbers/faces.  Conditioning on this event clearly increases the probability that another player will have four-of-a-kind.  The increase in probability will not be huge, and it will still be a rare event, but your friend is correct.
Comment: Yep - I mentioned in my question that I suspected the pidgeonhole principle would apply here.  I was a little bit more curious about the math part - like, if you have a program that tells you the odds of 0/1/2/3/4 players being dealt some hand (respectively), if you can use those probabilities to infer how much more likely it is for players to be dealt those hands.  I guess I would need to "stack the deck" for one player, run it again, and examine the deltas.


Ampere's law for circular loop and solenoid

Question: Ampere's law is used to find the magnetic field B in a solenoid but not in a circular current loop. Take infinitesimal current elements on a circular loop, applying Ampere's law and summing up the B yields a different B as obtained by Biot Savart. However, in a solenoid, finite current wires are allowed in the application of Ampere's law. What makes the difference?
Answer: See this recent question. You can't apply Ampere's law to isolated finite segments of current-carrying wire. Such finite segments can't exist by themselves, and Ampere's law relies on the full circuit to work. Without the full circuit, by choosing different surfaces bounded by the amperian loop, you can get contradictory results. The result of Ampere's law applied to a solenoid is only strictly valid for an infinitely long solenoid: it won't give the accurate magnetic field in a short solenoid.
The Biot-Savart law on the other hand is formulated as an integral along the loop, so we can speak of magnetic field contributions of finite pieces of wire, although you still need to integrate along the entire loop to get the actual magnetic field. Ampere's law and the Biot-Savart law are equivalent in magnetostatics, however the Biot-Savart law is often more useful in evaluating magnetic fields other than in the simplest of geometries.
Comment: But in a solenoid, finite current segments are still used no matter how long the solenoid is. Imagine how one calculates the B field in a solenoid and where the current terms come (from finite current segments).
Comment: In a solenoid, you don't apply Ampere's law to each small piece of the wire the solenoid is made of, you apply it to the solenoid as a whole. If you have questions about that problem specifically, you might want to post it as a separate question.
Comment: What do you mean by applying it to the solenoid as a whole? The solenoid (ideal) is infinitely long.


Reason of effect of continuity and discreteness on periodicity of signal?

Question: We know that a sine signal in continuous time is a periodic signal with a period $2\pi$ whereas the same sine signal in discrete time is aperiodic.
My question is how changing just a type of signal (by sampling) can affect the signal's periodicity and why this happens whereas we have just omitted some real values between samples and how can we make use of this fact practically?
Comment: What makes you think the discrete signal is aperiodic in general? For example, if I sample a sine wave with frequency 1 Hz at 4 samples per second, the result is periodic.
Comment: @MBaz, it's a weird esoteric thing that doesn't really matter, but sampling a continuous-time periodic signal that has a period equal to an irrational number of sampling periods, that sampled discrete-time signal will not ever satistfy $$ x[n+P] = x[n] \qquad \forall n \in \mathbb{Z}$$ for any integer $P$.
Comment: @robertbristow-johnson That's my point; you have to really go out of your way to have an aperiodic discrete signal when sampling a periodic signal.
Comment: @MBaz My question is still there !! Sine signal is just one example. there are many other examples showing above-mentioned phenomenon and there must be some practical significance of this fact.
Answer: To claim that "sampling changes the continuity and periodicity of a signal", implies that given a signal $x(t)$ and its sampled version $q(n) = x(n \cdot T), n \in \mathbb{N}, T = \frac{1}{Fs}$ there is a way to "transform" $x(t)$ in an aperiodic $q(n)$ just by periodic sampling.
This is impossible, especially for linear systems that cannot go into oscillations out of their own accord.
The only thing that you do with sampling is "tuning in" to a part of a signal's spectrum. Here is why, given a periodic signal at some frequency:
$$x(t) = sin(2 \pi f t)$$
We are going to sample it with a periodic train of pulses:
$$q(t) = \text{III}_T(t) \cdot x(t) \implies \frac{1}{T} \sum_{n=-\infty}^{n=\infty}e^{i 2 \pi n \frac{t}{T}} \cdot x(t) \implies $$
$$\frac{1}{T} \sum_{n=-\infty}^{n=\infty}\left( \cos\left(2 \pi n \frac{t}{T}\right) +i \cdot \sin\left(2 \pi n \frac{t}{T}\right) \right) \cdot x(t)$$
This expression by itself, does not guarantee that $q(t)$ is not going to be aliased and this is why $x(t)$ is first going through a low pass anti-aliasing filter. After this operation, sampling, is putting a "canvas" over that antialiased spectrum (discretises it).
How it is then possible that the operation described above can generate an aperiodic $q(t)$ for a periodic $x(t)$?
The only thing that this operation does is sample from the already existing components of $x(t)$ which are periodic functions. If $x(t)$ contained discontinuities, so would $q(t)$. If $x(t)$ was aperiodic, so would $q(t)$.
At the end of the day, what you do here is a straightforward mapping. You don't change any "type of signal".
The case that robert-bristow-johnson mentions is a result from number theory, transposed to periods of sinusoids. You cannot compose an irrational number out of integers and this tiny little difference that remains after each period presents itself as a "running phase" of the sinusoid.
There are however cases where sampling can have an effect on the signal, BUT that is entirely resonable. In the integration of non-linear differential equations by naive schemes such as Euler's method, the "sampling" that is effected by choosing a fixed step size can lead to large errors in the reconstructed waveform and more often than not in cases like this, the sampling becomes irregular. More dense around areas of large errors and vice versa. But even in that case, periodic regions (in the input) would remain periodic in the output.
Hope this helps.


Why four-point vertex function in $\phi^3$ theory?

Question: So as I understand it the order of $\phi$ in a scalar Quantum field theory is indicative of the number of lines entering a given vertex. For example for $\phi^3$ this leads to vertices like the one shown with 3 lines entering it. My question is why do we talk about $n$-point vertices $iV_{n}(k_{1},...,k_{n})$ in $\phi^3$ theory when $\phi^3$ means that vertices have 3 lines entering them?
Comment: When you say "n-point *vertices*", do you mean n-point *functions*?
Comment: For example a three-point vertex function $iV_{3}(k_{1},...,k_{n})$ means the sum of all one-particle irreducible diagrams with three external lines, with the external propagators removed. This concept is then extended (for example srednicki pg. 115 printed version) to higher order 1PI vertices.
Answer: A $\phi^n$ scalar field theory usually refers to a theory which contains in its Lagrangian a term proportional to $\phi^n$. This means that in a Feynman diagram the vertex where $n$ fields/lines meet is allowed. This does not mean that only $n$-point functions are nonzero.
In fact, for the $\phi^3$ example you gave, I can draw the following graph with two lines "entering" the diagram, and where the vertices are "cubic":

which is a contribution to the two-point function (at one-loop order) of $\phi^3$ theory.

EDIT (after comment):
Similarly, although one cannot directly join four lines at a point since there is no $\phi^4$ term in the Lagrangian of $\phi^3$ theory, one can find contributions to an effective 4-point vertex, such as:

at one loop.
So, while you cannot draw a diagram like this:

You can draw one like this (at higher loop order):
Comment: @boson: You're right that you cannot draw a quartic vertex directly in the diagram since it is not in the original Lagrangian, i.e. there is no "tree-level" contribution, as Srednicki points out in the beginning of chapter 17. Nevertheless, you can draw a loop diagram with 4 $\phi$s going in, as in his Figure 17.1. This diagram works effectively as a 4-vertex, since you can include it as part of a bigger diagram (which generically will have more loops).
Comment: Right but the vertices are still cubic. I'm talking about the vertices being quartic in $\phi^3$


Can tests written in Visual Studio / Selenium / Nunit be made available to non technical QA folks?

Question: We have a few QA folks that do not code.  I am writing test cases in VS and was asked if there is a way to make them available to them.  Maybe an .exe that lists all the test scenarios and they can pick and chose?  I know about the Selenium IDE but that is not their preferred method.  Thoughts?
Answer: "they can pick and chose"
Do you mean to run them?
You can create a CLI application that lets they run a command and execute scenarios by tags, or any other categorisation you want.
E.g., if you have a tag for tests related to login, you can run them with a UI like this:
<code>myAutomation --tag "@login"
</code>
Comment: Can you please explain more. I am not familiar with this concept.  Yes, they would need to pick and chose which tests they want to run.
Comment: I've added a link on creating CLIs in C# and a possible UI for your CLI program. The details of the tagging or categories will depend on what tools you use alongside Selenium, but they should be more or less similar,
Comment: Thank you.  I will look at it
Comment: You are welcome. If the you found the answer satisfactory, could you please mark it as accepted, so the community will see it as answered?
Answer: This is a common requirement nowadays in most professional automation testing services organizations where automation test scripts are done by one team and it's batch execution is done by other. There can be 02 possible ways for this requirement -

Command Line option - Use NUnit Console Runner to execute your scripts through Command line where you can execute a group of test cases in batch or target based test cases. Few mentioned below documents can be helpful -

Official Document

NUnit GitHub

Note:- You can also create a batch file of your final NUnit command and share it with your non-technical team.

Jenkins - You can configure your project in Jenkins where you can create schedules for your script execution. Also, Jenkins provide a feature where on completion of scripts, corresponding email will be auto-triggered. In this case manual team has minimum work of just monitoring if job is triggered or not. Here also, you can execute picked test cases as per your requirement.


Can we have a civilization living at close to the speed of light?

Question: Imagine many ships traveling close to the speed of light. If they diverge paths to explore distant galaxies, they could calculate their travel so that the same amount of time passes for all ships. Since traveling close to the speed of light will substantially slow down the passage of time for those on board the ship, this whole ensemble would allow many observers to simultaneously visit arbitrarily distant points in the universe in reasonable amount of time and without worrying about diverging time scale for those on different ships. I don't see any immediate holes in this idea but I wanted to see if anyone can spot some.
Comment: *visit arbitrarily distant points in the universe in reasonable amount of time* This may be problematic, as "visit" implies slowing down to look around and then accelerating up to cruise speed again.  That would completely change things as these encounteres would essentially be random for each ship/direction and hence they would be out of sync.  If by "visit" you meant "whizz by without slowing down" then that would be less of a problem.
Comment: "I didn't see much, going too fast, what did you see?" "Not much, too fast, how about you? "Everything whizzed by. Saw nothing, You?" "Everything was a blur."... "Complete waste of time,"
Comment: I've edited your tags to better fir the nature of the question, feel free to revert if you see fit. (but I'd recommend keeping the [tag:reality-check] tag). We invite you to take our [tour] and read-up in the [help] as and when for guidance as to our ways.
Comment: As an aside, this reminds me of the plot of Poul Anderson's "[Tau Zero](https://en.wikipedia.org/wiki/Tau_Zero)", except in that novel, things go wrong and get a bit out of control for a [spoiler] amount of time. We invite you to take our [tour] and refer to the [help] as and when for guidance as to our ways. Welcome to worldbuilding.
Comment: one issue could be collisions with objects in space.
Comment: A large part of the universe is moving away from us at speeds greater than the speed of light. The closest galaxies are still very far away even when traveling close to the speed of light, I think you won't reach reasonable timescales.
Comment: @StephenG right, but I think you can compensate for all these stops, as long as everyone has a schedule planned out ahead of time.
Answer: The one problem I can see with this scheme is it's very critical.
I mean: to have a significant time contraction effect you need to get very near to speed of light (effect is highly non-linear); this means a very small deviation in the projected path can result in severe desynchronization with little or no way to keep synch because of rapidly increasing distance between different "explorers" (they would recede from each other at speeds very near to 'c', with all implications on wavelenght red-shifting and such).
If you plan to have "round trips" and then meet again at start point (or somewhere else) you can easily miss your mates by centuries.
Of course this is (almost) the only way to "keep in contact" because any message sent (even if you are able to detect such red-shifted photons) would keep chasing after spaceship and arrive at a very slow rate (depending on actual speed); in practice you would get all them at an accelerated rate (and with no red shift) on the way back home (unless you postulate some kind of FTL messaging, of course, but that would defeat purpose of the whole construction).
Comment: However, if party A does get there early then (delta V permitting) they can leave a message at the RV and go on "short" accelerated trips out and back until party B makes the rendezvous.  See the end of Joe Haldeman's classic The Forever War for a very early example.
Comment: @KerrAvon2055: true, but I was not trying to solve the problems, just to point out problems exist. Solution is very story-dependent; your one is valid only if underlying technology allows for very fast acceleration to near-speed-of-light, OTOH if acceleration requires a sizeable amount of time (~one year or more) or need expensive resources  the "polling" method might rapidly become unfeasible, while still usable for long haul trips.
Answer: I see two main issues. One is the observations.
As you fly towards the target at a velocity close to speed of light, all the emitted light will be severely blueshifted.  Per my calculation moving at 99.99% speed of light (299,762.4788km/h) should give you a time dilatation factor of about 70 (70ly journey feels like a 1year) which I think would be a bare minimum for this to be feasible. However, as you are moving at this speed, all the receiving light is severely blueshifted. Using this calculator https://keisan.casio.com/exec/system/1258042695
our nice and cozy 570nm is transformed into 4nm which is somewhere around x-ray radiation. You can't really do an observations at these speeds. You would need to slow down. (also worth pointing out, that you also need to shield the ship from all this high energy radiation)
Which brings us to the second problem. The time dilatation is funky subject. Nothing happens for the longest time and than it shoots off on the exponential. This means, that the crafts need to be perfectly synchronized. My example of 99.99%c will turn a 5 day pitstop into a 1 year delay behind everybody else. At 99.9999% one day puts you at 2 year delay. Any uncertainty will have serious effects. 0.0005% difference will influence the delay by almost a factor of 3. Technological precision necessary is mindboggling.
Connect these two and the level of planning necessary becomes troublesome. You need to synchronize at what time they need to slow down how long will they perform observations for, the rate of acceleration and finally they can begins slowing down only after all the ships have reconvened, lest some will be left behind. Other than that, yes. It is viable method (as far as I can see).
Comment: To reach such uncertainty  of 0.0005% at 0.999999c u probably have to spend more energy than you need to reach 0.99c. As numbers those are close, but as energy levels those ara galaxies apart
Answer: Yes, it is possible
One of critical points with that situation I did come by is - conservation of impulse.
It does not have immediate effect on them, but considering that they are in slow time, slower their common time is faster they move to the point when they observe that or can't sustain that anymore(if they are not careful). (They can move to a black hole as well, to keep that slow time, but it is a loss of mobility)
There are generally 2 ways - they can use reactive propulsion, or some kind of interstellar inter galactic metro massdriver type system, which may be more efficient than reactive propulsion, but may have the same problem if overstressed, and sure it uses energy all the time. Energy usage is not necessarly a big deal, as stars waste it constantly, but it is a thing to be avare of as well.
It easier to see the problem for ships case, as they accelerate their exhaust track is basically some sort of reactive mass which moves with significant speed, for fusion something up to 0.1c maybe, in direction of A point and B point.

like a line of gas cloud between A and B points where some portion of mass of that cloud moves past point B , and nother "half" past point A

Considering that orbital velocities in galaxies aren't that high, stars move 10's of km/s, any meaningfull exchaust velocity exceeds galaxy escape velocity. So if you roam around you constantly loose energy and mass of that galaxy.

fundamentally it is a result of following problem -  it easier to push mass to greater distance, than pull mass from greater distance.

For pulling from great(anything above a billion plus km) distance you have more or less only one option - gravity.
Partially you can overcome the problem and prolong existance of such system, by modifying your galaxy, converting stars to some kind of statites, like some versions of dyson swarm, statites/stars around your galaxy black holes. Where your galactic metro network helps to keep the distances of those stars and all that, or maybe helps controllable compaction of the galaxy or something in that direction.
Then you have some treshold, how much mass can be mobile at any given time, the rest hast to wait, or more likly to live in orbits of blackholes, obiviously supermassive ones. How big is treshold for non-modyfied, natural galaxy - for our standarts it probably humongous, but it not necessarily so for galactic civilisation.

not sure what is the best configuration of those metro routes, but probably looks like some plant roots type thing, with a center of mass of a galaxy and supermassive BH's to be at the core of that system. There probably are some things in beetween those roots as well for travel and technological purposes.

But for intergalactic routes, those routes will push galaxies away. And there is no forces, or better to say ways(there are some options but, applicability is limited by distance which is big but not infinite), to pull them together, and probably no ways to create statite version of galaxies, but there is a great attractor, and a place like that can be used for to be a core of such intergalactic system, maybe with a goal in mind to collect all those galaxies, as BH's have some value for survivial beyond the time, when all the stars go puff. Take look at Isaac Arthur youtube channel, there are good episodes on that BH's topic.
Sustainability is a problem, because if you slow time just a billion times, a year of subjective time means a billion in regular space. You go to school, and when you go to university our sun is puff, no more.
But travel to nearest galaxy still takes 8 hours(million ly), what a waste of time, eh.
So maybe not a critical problem, with a carefull approach, but it does not allow mindless mistakes, or there will be a point of no return very soon(in subjective time).
Time framework
Central BH's and that metro thing represent some common timeframe, which let's say slowed down a billion times compared to regular space.
And sure enough if you plan to visit some planet, it will have some consequnces.
You have been there on a vacation last year and there was such a beautiful beach there, well, there is no more of it, you know a space faring civilisation evolved and collapsed, you know, only radioactivity and robots there. So due geological activities each visit as a new thing.
You do need to ascend from slow time to a regular one, and here I not ready to make statements, may be wrong, but your two weeks vacation in to wilderness will look like few miliseconds of absence, or could look like it, depends on how fast are the means to ascend and dive to and from normal time to regular space time.
Soo on two weeks vacation you probably can raise a civilisation from scratch, as it around of 40 million years in regular space.
Meaning moving in and out of frame will have consequences, as one can age and die faster than a human capable to notice thing, not talking when they actually notice someones absence. So it won't be exactly one time for everyone all the time.
So as being in the framework but a distance apart, let's say different sides of a galaxy, does not mean you can have a real time chat(emails may work, with complex routing prediction system). One can have an annual gathering at some date at hub place despite being few galaxies apart prior that, hangout for few days together and move back to your home galaxies.
So there are some nuances which need their own investigation.
pros and cons
To have all that, there should be some goal. A goal which is important for the civilisation. Convinience of work commutes from galaxy to galaxy, sounds fun and an interesting topic to investigate which differences it brings and all that, but it is wasted opportunity without a goal.
Let's say they made a ring in our galaxy, idk 50'000 ly diameter of that ring, a billion times slowdown of time - Hooperloop V5billion
Being in the loop, for subjective time your cycle time is aroud 2-3 hours. Let'say the ring goes trough a million stars, and each star hosts K2 super computer cluster. Each 2 or 3 (let's say it 2) hours you gather information and upload information to each cluster, which are in regular space and it means they, from your perspective, work a billion times faster than if they would be in your framework. So if you solve some problem, let say working on unification theory, technology development, etc then if things are done rigth you can have ample benefits from the situation.
But humanity also is somwhat a supercluster which could benefit from a billion times faster information processing, meaning being in regular time also has certain benefits, for a civilisation as it has more time to evolve before some points of no return for possible strategies.
If a civilisation waits for galaxies to arrive at great attractor place, or most likely they are on the move there as a civilisation, to be there and ripe the fruits of that place according their future oriented strategical plans of development for next few hundred billion years - break trough to a different universe, prepare for ripoff of space, outlive last free atom in universe etc
I mean goals should be grand, and other conviniences is just side product, so as it not always beneficial to be in slow space, if you did not set things in motion properly, etc.


On-the-fly CPU overclocking

Question: I was wondering if it would be possible to control the Raspberry Pi's CPU frequency on-the-fly, allowing me to adjust for temperature. (I would be using this for overclocking.)
Answer: Assuming you mean being able to overclock it and have the effects applied instantly, without a reboot, I don't think it's possible - most full computers can't even do this yet. There are a couple programs that can do it for desktops, but they tend to be rather finicky, and they would almost definitely not work on the pi anyways.
Comment: Allot of desktop computers can be over clocked from the OS now using vendor specific software even GPU's. Also Intel use speed stepping built into processors. So I don't agree with that but on the Pi side, it only seems to be adjustable during boot, for now.
Comment: @ppumkin - I am aware of this. I have used a couple of these programs myself. However I have noticed that you don't get as much fine control over them as you do from BIOS, and the system is generally more unstable when you overclock from the OS as opposed to from BIOS.
Answer:
adjust for temperature

When you describe adjusting for temperature, it sounds to me like you have one of two goals:

Prevent the temperature from climbing to dangerous levels (ex. 80 C) when the Pi has a workload saturating its CPU.
Prevent the temperature from climbing like this when the Pi is running at idle.

For #1, the way the Pi's base frequency and boosting work should be enough to ensure this goal is met with you just leaving the Pi's settings to their default. You could even overclock your Pi's boost CPU frequency and still achieve this goal.
This is because the Pi will run at its configured base CPU frequency (which is quite low, below 1 GHz) until it needs to boost to run a workload. When it has a workload, it will boost up to the configured boost frequency for as long as it needs to complete the workload or until its detected temperature reaches about 80 C. Then the CPU clocks back down to base when the workload is complete, allowing the temperature to reduce.
So there's no need to adjust the CPU frequencies on the fly. Simply set a boost frequency high enough for your expected workload and rely on the CPU throttling to ensure the temperature doesn't climb beyond 80 C. It will already be adjusted "on the fly". If 80 C is too high for your liking, this value can be adjusted too. You can make it lower.
For #2, you could adjust the base frequency so it's lower than default. This should allow your Pi to settle down to a lower frequency when it needs to because it detected that even running at idle, the CPU temperature climbed too high.

On-the-fly CPU overclocking


How to measure gigaohm resistors?

Question: I've got an issue that appears to be caused by damaged resistors that are either open circuited or of too low a value due to contamination.  The problem is that they're gigaohm resistors, so to a multimeter, they're always open-circuited.  How can I measure the resistance, or, at least, test the continuity?
Comment: @Kristoffon: Working voltage is less than 1 V in this case.  :)  Just the leakage current of an FET gate times the resistor's value, max.
Comment: Beware that you must test the insulation at a voltage close to working. What appears to be insulated at 500V might show kohms resistance at 1000v.
Answer: Many Fluke meters (e.g. 87,287) have a nanoSiemens conductivity range which will measure up to 100 GigaOhms - it needs to be manually ranged up from the ohms range. \$\mathrm{1 G \Omega  = 1 nS}\$, \$\mathrm{10 G \Omega  = 0.1 nS}\$.
Alternatively, most DMMs have with a 10M input impedance (easily checked with a second meter), so a resistor with value R in series with the millivolt range will form an R+10M/10M voltage divider. So applying 10 volts through a 1 gigohm resistor will read around 99 millivolts.
A close-enough approximation for high value resistors from a 10V supply would be resistance in gigohms = 100/millivolts.
Comment: The divider method is fast and easy with a 9 V battery. `R = Rmultimeter*(Vbattery - Vdivided)/Vdivided`.  Just don't touch more than one of the metal parts with your fingers.
Answer: You need insulation testers. The ones I've seen had 2 GOhm range.
Not necessary Flukes, there are cheaper ones.
And for the future, I would try to add some protective insulation on top of such nasty things :-)
Comment: What kind of protective insulation?
Answer: I'll assume that you're able to isolate the resistor from the rest of the circuit.
You probably need to construct a high-impedance analog buffer.  It doesn't need to be super-fast, but it does need to be high impedance.  A very high impedance amplifier is National's LMP7721, requiring only 3 femtoamps of bias current.
Once you have your buffer, get another resistor with a resistance comparable to the one you want to test (a known value).  Connect one side of this resistor to ground, and the other to a probe and to your buffer.  Then, apply a voltage to one side of your resistor, and connect your buffered probe to the other side.  Measure the voltage at the output of your buffer and solve the voltage divider to determine the unknown resistance
You may not need a buffer if your meter has extremely low impedance when measuring voltage.
Comment: Higher voltage will definitely help in that case. You need to go lower than 1 pA though. Check out http://www.national.com/pf/LM/LMP7721.html, especially some of the application circuits. You will have to be VERY careful about contamination on your board, any kind of flux will create a leakage path.

Also, you'd be much better off with an alternate circuit than a voltage divider. Noise will dominate your measurement. Check out a transimpedance amplifier.
Comment: @Chris - Thanks for the advice! My answer was just a first shot at solving the problem, and unfortunately I didn't know anything about transimpedance amplifiers before tonight.  Want to throw an answer up?
Comment: 1V across 1Gohm is 1nA of current rather than 1pA.  I think you'd have to be very careful with your buffer design and make sure it has strong high frequency rejection.  Its not hard to generate currents on the level of 1nA from stray EMI especially with probe leads in the mix.
Answer: There is special equipment for this. Couple of weeks ago someone showed me one that can do > 500G and in this particular case was used to test 10kV breakers. It was called a Megger. Basically what it does is measure resistance, but where your multimeter does this with 3V, these thing slowly increase the voltage to test in the range of kV's. https://en.wikipedia.org/wiki/Megger
I expect there are other vendors for similar equipment.
Answer: "If you use a battery operated DMM, and keep it isolated, you can use 1000s of volts for the test."
DONT TRY THIS !!!
Most of GigaOhm resistors, including 200 GigaOhm resistors in glass tubes have a rating of maximum 500 volts, and the maximum voltage for a digital voltmeter is 1000 volts. Thousands of volts across such a resistor will only be sparking around the resistor and instantly fry your digital voltmeter!
Comment: even 1/4 watt carbon resistors had a 500V rating. Normally they are longer and rated > 1~10 kV Since we are talking long after the question. I think the accepted answer missed the hidden more important point of doing root cause failure analysis and simply answered how to measure a normal resistor. Failures occur from non-linear V vs I characteristics that lead to failure as you indicated @Marc. Zapp! by contamination is a major flaw. the material must be well sealed and moisture proof. THat takes variable Hipot testing with a current limiting R to protect the device and uA meter to measure it
Answer: What you would want is a megaohmmeter. These are just another permutation of the V=IR Meter which exploit high voltage to produce a measurable current across a high resistance. If you have access to a high voltage source and a DMM with a current mode, you could measure the resistance but placing the resistor, DMM, and high voltage in series, then math-ing it out.
If you use a battery operated DMM, and keep it isolated, you can use 1000s of volts for the test. I used to calibrate the leakage current readings of 1-200KV Hi-Pots using just a normal fluke DMM with this method.
You can find megaohmmeters on ebay as "Hi-Pots", "insulation tester", "oil tester", "dielectric tester".
Also, the opposite of a megaohmmeter is a digital low resistance ohm-meter(DLRO), these use a high current (1-100+ amps) to measure very low resistances.
Answer: I have just tried to measure 10 Gigaohm resistors with my DMM and a 10 volt power supply with success.
My DMM is a 4 1/2 Digit with a stated 10 Megaohm imput impedance. The DMM has an accurancy of 0.05 % for voltages measures. I first adjusted my power supply so that the voltage shown an my DMM was exactly 10.000 volts, then put the 10 Gigaohm resistor in serial with the DMM on it's 200 mV range. The reading was 11.35 mV.
In fact, the only thing that is not stated as precise with my DMM is it's imput impedance! I tried to measure it with another multimeter (not digital) and found that the real imput impedance of my DMM is in fact above 11 megaohm, so there are about 10 % error.
The 10 Gigaohm resistors I measured (I have 4 of them) have only a 5 % tolerance, but they all gave me about the same reading on my DMM. If I had one of 0.1 % tolerance, I could adjust my power supply so that the DMM would read exactly 10 mV to compensate for it's 11.35 Megaohm impedance, in this case the voltage from the power supply would be adjusted to 8.81 V and I would have a precise gigaohm meter.
Another thing to note is that the probes of the DMM have lot of leakages. I had to put the DMM on a separate table with the probes and the resistor to be measured hanging on the air. I then tried to put the 10 volts from the power supply across the PVC part of each probes and had a voltage reading of 0.05 mV on the DMM, corresponding to a resistor of about 2 Teraohm...
Time to buy teflon insulated wires...
Answer: I great trick I learned from reading the HP 3478A DMM Service manual (section 3-119 extended ohms operation) is to first measure a 10M resistor, and then put the 10M in parallel with the unknown high resistance and measure the parallel value. The formula unknown=(reference value * measured parallel value) / (reference value - measured parallel value) does the trick. As an example, say you used a 10 ohm reference, and say you are measuring a 10 ohm unknown. The two 10 ohm resistances in parallel would measure 5 ohm, so running the formula gives 10 * 5 = 50 and 10 - 5 = 5, and 50 / 5 = 10 ohms. This works for any reference value, and the measured value will always be less than the reference value. Some of the other answers point out some of the limitations of any high resistance measurement. You also run out of digits of measurement precision at some point.
Comment: Recalculate your measured 1 Gohm resistance with min and max tolerance of your measurement and see how wide the uncertainty range is for said 1 Gohm resistor, then report back.

How to measure gigaohm resistors?


How to not converge or diverge from the runway when there aren't checkpoints?

Question: When flying circuits under VFR, if there is no clear distinct checkpoint available, what can you do/use as a checkpoint? I suspect the runway but please correct me if I'm wrong. How do you make sure you don't converge, diverge from the runway or stray away from the centreline?
Comment: Guys, thank you so much for the feedback. But I think I may have used the wrong word or phrase in "checkpoint". I think the actual phrase I was looking for was "reference point". The "reference point" (at a distance) at which when you takeoff, you use to maintain a straight and constant heading. The "reference point" at which you use, just before you turn, to turn onto and again, maintain a heading. Your feedback would be greatly appreciated once more.
Answer: I'd like to add something to Ron's answer.  Use of geographic checkpoints is used a lot in initial training but it can become a debilitating crutch that leaves you in the lurch as soon as you go to another airport.  I teach in gliders where getting the circuit right is fairly critical the first time, there being only one chance to land.
The really important checkpoint or turnpoint is the turn from downwind to base.  Learn to recognize the presentation of the runway when at a 45 degree aspect to it, which is normally the proper turn point for downwind-to-base unless you are extending or shortening your downwind for a specific reason.  I always weaned my glider students from dependence on geographic points as soon as possible, and certainly before solo.
You are at 45 degrees to the runway when the extended line of the lengthwise edge and an extended line of the threshold are "even" relative to the horizon.   This can be pretty tricky to discern at first but over time you'll learn to recognize this just by the appearance from your vantage point, and you will no longer care about ground landmarks.
Answer: I assume by checkpoints you mean visual cues for position. A "checkpoint" is different in the aviation world and is used by VFR pilots to report locations to controllers. These are denoted with a "Flag" on VFR maps.
The runway you are landing on is really all the visual reference you need. When flying a circuit you take off and follow centerline, which means you use the heading as a reference and add any cross-wind correction to stay on track. This takes some practice so don't be discouraged if you start drifting with the wind. Adding the appropriate cross-wind corrections directly after your wheels leave the ground is a skill, and then realizing that it changes about 50-100 feet above the ground is another skill.
300 feet below pattern altitude you should start your cross-wind turn. Usually by the time you get to pattern altitude it is almost time to turn downwind. The goal when you turn downwind is to be about 1/2 mile from the runway. In a 172 at pattern altitude, this means that the runway will cross your strut about half-way up (provided your seat is adjusted properly, this is important in flying patterns/landing).
The next "checkpoint" is mid-field downwind. This is when you start running your landing checklist. After that your next checkpoint is when the runway touchdown zone is about 45 degrees behind you, this is when you start your base turn and descent.
The last tricky turn doesn't really have a "checkpoint", the goal is to turn from base to final and roll out on extended centerline. You need to take into account if you have a tail wind or a head wind. For a tail wind you want to turn sooner, a head wind you'll turn later. Again this is a skill that comes with time. Extending your downwind can give you more time to correct any alignment errors. Starting your downwind too early will cause you to overcorrect or overshoot the turn.
After that your eyes should be focused on airspeed, altitude, and aiming point.
Really these are just a skill you develop as you train. Don't expect to be perfect in the first 20-30 landings/take-offs. Some pilots require hundred(s) to master the skill... Then they change aircraft and have to start again.


Are there any non-mesh packing cubes, if not what can I use?

Question: I love mesh packing cubes for my large suitcase which I check on flights.  For my backpack however, I want to put my emergency change of clothes in something liquid-resistant, since I often also pack food and beverages in there. Know of any brands out there, or another equivalent solution?
Answer: What you seem to need are waterresistant rolling bags like that. Ortlieb is a well-known brand name, but also a bit expensive. If you look out in outdoor stores or motorbike stores (they have often inexpensive bags which are used to store things which should not get wet), you should be able to get an inexpensive brand.
Comment: I had never heard of these, interesting option +1.  Because they are more geared for heavy-duty liquid protection, I think my particular needs are better served by a traditional packing cube due to the ease of packing and unpacking clothes. I've since found a cube that fits the bill (see answer).
Answer: The Eagle Creek Specter cube series seems to be just what I am looking for.  Still a packing cube design for easy access, but non-mesh for liquid protection. On top of that, it is translucent to allow cursory inventorying, and is supposed to be especially light. I'll let you all know how my purchase fares.
Comment: I assumed the worst case with a broken bottle inside and a rugged ride... :).
Comment: Just an update here. The Specter is a great lightweight packing cube, and is not mesh so solid dirt would stay separated. But it would provide almost no protection against liquids.  For that I now use the Eagle Creek Pack-It Clean/Dirty Split Cube which has a water resistant section.


foam roller vs brush for fiberglass door

Question: painting a fiberglass door with semi-gloss latex.  Looking for that smooth glossy finish (yes I know spray would be optimum).  Would it be best to use a foam roller or a brush?
thanks
Comment: You have to play with it and see what results you can get with that paint, those rollers, and various levels of dilution with the paint.   It also helps to lay the door flat so it is drying horizontal not vertical.  You can also try a technique called ["roll and tip"](https://www.google.com/search?q=roll+and+tip+painting&ie=UTF-8&oe=UTF-8&hl=en&client=safari).  See also oil paints and techniques found under "$50 Rustoleum paint job".  It's all in the technique.  Also, using gloss paint helps for that glossy look and for cleaning.
Answer: Use a smooth foam roller, maybe sand and second coat, then buff. But yes spray would be better.


Rule about repeating citations

Question: Sometimes I get papers for translation, larded with repeated citations of publications of the authors' friends and teachers, two to three times within a paragraph and as often as possible throughout the manuscript….I try to replace with "the latter", "the former" etc, but is there any tried and tested rule about how often and within which distance references may be re-cited?
Comment: When you refer to the authors' friends and teachers, you imply that you see this as simply trying to boost each others' citation indices. However, it makes no difference how many times a particular paper is cited within a single source, so repeated citations are not an issue. In fact, if a work is being cited multiple times in a short space, that implies it *is* relevant to the current manuscript and not just bolted on as an afterthought.
Answer: The golden rule of citation is that you attribute everything that you did not invent yourself to the right person(s).
The golden rule of boring writing is to repeat yourself as often as possible.
Just make sure that it is clear what came from whom. If you say: "In the following paragraph we describe the main ideas of [2]", you do not need to repeat [2] in that paragraph, but if you compare two approaches it might be necessary to mention the papers/people more often.
Comment: You could also use "In the following paragraph we describe the main ideas of A, B and C [2]" and subsequently refer to "A, B and C" rather than "[2]" where necessary

Rule about repeating citations


Are two $f, g \in \mathbb{C}[x_1, \ldots, x_n]$ equal if $f(\mathbf{a}) = g(\mathbf{a})$ for all $\mathbf{a} \in \mathbb{R}^n$?

Question: Suppose I have two polynomials of equal degree $f, g \in \mathbb{C}[x_1, \ldots, x_n]$  that satisfy  $f(\mathbf{a}) = g(\mathbf{a})$ for all $\mathbf{a}  \in \mathbb{R}^n$. Does this imply $f = g$? I know this is true if the values are equal for all $\mathbb{C}^n$, but was not sure about this case. Thank you!
Comment: If there are infinite sets $S_1,S_2,\ldots,S_n$ of $\mathbb{C}$ such that $f(\textbf{a})=g(\textbf{a})$ for all $\textbf{a}\in S_1\times S_2\times\ldots\times S_n$, then it already follows that $f\equiv g$.  If you know that the degree of $x_i$ in both $f$ and $g$ is less than a certain positive integer $d_i$, you can even require that $|S_i|\geq d_i$ for each $i=1,2,\ldots,n$.
Comment: @JohnnyT.  See Theorem 1.2 and Lemma 2.1 of this article: https://www.cs.tau.ac.il/~nogaa/PDFS/null2.pdf.
Comment: Standard trick: Polynomials being equal means their difference is zero. Polynomials being zero is much easier to work with, generally.
Comment: @Batominovski How do you prove this?
Answer: Yes, this is true. For simplicity, let's study the polynomial $h=f-g$, as a function $\Bbb R^n\to\Bbb C$. It is constantly equal to $0$.
The function $h$ may be Taylor expanded at, say, the origin. As it is the zero function, the Taylor expansion is trivial. But any polynomial is equal to its finite Taylor expansion. Thus $h$ must be given by the zero polynomial.
One might object and say "But expanding $h$ to a polynomial function $\Bbb C^n\to \Bbb C$ might give you more room to manoeuvre and make other polynomials". To address this, note that the real partial derivatives of $h$ as a function $\Bbb R^n\to\Bbb C$ are always equal to the partial derivatives of $h$ as a function $\Bbb C^n\to\Bbb C$. So expanding the domain of $h$ in this way cannot change the Taylor expansion.
Answer: I realized this after reading Arthur's answer.
Let us write $f = f_1 + i f_2$ and $g = g_1 + i g_2$ where $f_1, f_2, g_1, g_2 \in \mathbb{R}[x_1, \ldots, x_n]$. Then for any $\mathbf{a} \in \mathbb{R}^n$
the real part of $f(\mathbf{a})$ is $f_1(\mathbf{a})$ and the imaginary part $f_2(\mathbf{a})$ and similarly for $g$. Therefore
$f_1 - g_1$ and $f_2 - g_2$ are real polynomials which vanish at all values of $\mathbb{R}^n$, hence they are the zero polynomials. Thus $f = g$.


Is there any indication that Gon will get his nen back?

Question: If he can't that essentially renders the main character useless right. Also if he gets his nen back do you think he'll get a different type since he came back from almost being dead. Is there any chance he'll get a different nen nature.
Comment: Still reading the current arc and from until the chapter I've read, no indication whatsoever. Regarding the follow-up questions, they seem to be primarily opinion-based and is asking for speculations of a future event, which are not allowed here so an edit might be needed.
Answer: No.
There have been no blatant indications in the manga or anime to show that he will get his Nen back.
In most other shonen manga's you would expect a protagonist who loses their powers to eventually regain them stronger or in a different way.  This is best seen in Bleach where Ichigo and his allies does this many times. As Hunter x Hunter frequently is designed to subvert expectations, however, there is no reason to presume Gon will get his powers back.


Writing a trilogy and editing

Question: I planned out to write a trilogy and the first draft of book one is now completed. I want to know if I should edit this draft before starting on the second book.
Answer: In my opinion, you should.
It's a good thing to plan ahead for sequels, but a first draft is not a finished book.
There are at least two reasons that I can see to edit before going forward:

You may want to start sending your book one to an editor. In that case, it's way better to get out of the way any error, at least, the most amateurish ones. Don't get me wrong - drafts will always have errors (even simple typos) but the first one is particularly vulnerable. You may want to be sure that there is no major issue in the structure of the story, in character development, no inconsistencies in the plot and so on. Also, it would be nice to rework your introduction to "hook in" any potential reader.
Before you continue with book two, you may want to be sure that you have solid ground to build upon. Even if now you may have the impression that book one is perfect, this is not always the case. Make sure that book one is "solid" in terms of plot and characters, and that it stands on its legs without any major issue. It's better to rewrite some chapters now rather than risking to rework an entire trilogy from the start (as small the risk might be).
Answer: Trilogies are rarely, if ever, published back-to-back. Instead, first one book is published, then, if it is successful, the second one, then the third.
What this means is, when you query an agent, you have Book 1 finished to a T (as you would with a stand-alone book, when querying an agent). You also mention that you already have books 2 and 3 of the trilogy outlined. ("Outlined" is a flexible term, but since you're planning it to be a trilogy, you definitely should have something - you can't just realise mid-way that things aren't working and you'd need to scrape the whole thing.) Since querying an agent takes a lot of time, you will be making progress on Book 2 while attempting to get Book 1 published.
Why mention that Books 2 and 3 are already in progress, when you're only querying with Book 1? Because you intent to write a trilogy, so the agent would need to know that this intention is not an amorphous sort of intention, but an "already started working" intention. From the experience of now successful writer Jim Butcher:

[editor] was wavering until she heard that I had three books already finished, and then she was a lot more interested. (source)

(To clarify, Jim started querying agents when he had only the one manuscript. In the time it took him to find an agent willing to represent him, he had finished two more, and had the outline for several more to come.)
So, since you need to have Book 1 finished to a T in order to start querying agents, edit it now, start writing the second book after you're completely 100% finished with the first.
Answer: If you are a strong plotter, you have likely been sneaking ahead and laying the groundwork for themes and subplots that will not be resolved until much later in the series. With the first draft of Book 1 complete, make course-corrections to your master plot and timeline.
You now have a much better idea of the pace and characters. Touch up the the other two outlines, and check for themes that come later that could be seeded or hinted in the first book. Also, give some thought to how these later books will subvert what you have "promised the reader" in the first story. You may want to exaggerate or lean into an aspect that later gets dismantled.
This is not writing Books 2 and 3, this is making sure everything is included in Book 1 before your begin the re-write. The priority is Book 1, so you also need to balance "the future" with the themes and character arcs that are self-contained. Make sure characters are not anticipating what happens later. Make the present the thing that matters most as if there are no sequels planned.
If you are a discovery writer, you hopefully still have a master outline otherwise you would not be saying you are writing a trilogy. While you leave hints and germinate seeds for later plots, the priority is a sense of closure within Book 1. It should "land" on a relatively stable status quo after the plot and character arcs in the first book.
I ended up moving certain anticipated plot points to later books because they weren't being thematically addressed within the first. I also do this with chapters, move plot points so they are contained within the part of the story that tackles them thematically.
For me, 2nd draft is mostly throwing things out and simplifying so the action is direct, and the characters are defined habitually rather than through big events and major crises. The Big Action Scenes™ are where we should see characters revealed as themselves, not debating who they want to be – that debate into their true selves is what the rest of the book is for. I don't get a true sense of what they've learned about themselves, and how they apply what they learn in the final resolution, until I've gotten through the 1st draft and the story has been scrubbed.
This leaves a discontinuity going into the later books because even as a chronic plotter who skips ahead, my master outline is nowhere near as nuanced as the characters I've discovered writing Book 1. The later outlines are still half-baked scenarios and Mary Sue moments that feel a bit silly by comparison, but that's a good thing for me because I want the open-ended optimism of a fresh Book 2, rather than a continuation of the end-tone and themes from Book 1. In Book 2, the characters are starting fresh at the beginning of a new journey. While I have been plotting ahead, I'm not writing ahead. I like that each book in the series will have its own character arcs and themes. They build on each other, rather than continue where the previous left off.
Answer: Write at least part of your second book before editing your first.
I'm going to take a slightly different slant than most of the other contributors and suggest that you write about half of your second book before you go back and do a serious rewrite of the first.
The reason?  Because almost inevitably, as you start writing your second book, you'll realize that you need or want to make some changes to your previous book.  You'll realize that you want to include a little bit more foreshadowing at the end of book one to set up the plot for book two; or you'll want to change the result of a scene or even an entire arc.  You might find that the scene in which the trusted sidekick sacrifices his life for the hero should come at the climax of the second book rather than the first.  Or that your villain, who was setting up Plan A at the end of the first book, should really be setting up Plan B instead, because the first half of the second book needs to deal with Plan B, saving Plan A for later.  You might find halfway through the second book that you don't really have three books of material, only two and a half, so you'll need to rewrite significant chunks of the first book for your final opus to fit into an whole number of books.
If you go back and do your serious editing now, you'll almost invariably find that a lot of your fine-tuning gets wasted.  Even worse, you might not be willing to make the necessary changes because you've already spent so much time perfecting those scenes that cutting them is just too painful.
To avoid this extra work (and unnecessary pain), I suggest writing more than just the first book before doing an editing sweep.  Personally I find that I almost never want to go back and change events that happened more than half a book ago; hence my recommendation of writing half the second book before editing the first, but you might find that a quarter or a third is sufficient for your purposes.  Once the second book is well underway -- once you don't just suspect but actively know that you won't need to make significant changes -- then is the time to prepare the first book for publication.
Answer: You have to do what works for you, and that includes listening to the advice of others, but then doing what works best for you.
I've personally done both.
The advantage of finishing one book before starting the next is that you get it out the door and making money for you.
The advantage of completing at least the first draft of the entire trilogy is that you then have the entire work available for improvements. Remember: no plan survives first contact with the enemy. So that plot twist you wrote in Book 1, Chapter 17 may really, really screw things over somewhere in Book 3. Likewise, you may decide that you need to introduce a new character, and you don't want to do it in the void. Or remove a character that makes a brief appearance but never shows up again.
A danger of publishing book 1 first is that if you get pulled in other directions, your book 2 might not come out for a while, and your readers could become quite testy if it's taking what they feel is too long.
In other words: both answers are perfectly legitimate.
Note that I do what works at the time. If I'm in a mood to create, I write. But at some point, I go back and edit. I let my moods drive me. It does no good to stare at a screen, with the words not flowing. On the other hand, it can cost you valuable creative time if instead you edit.
So do what works for you.

Writing a trilogy and editing


Stalled Yeast Stirred

Question: I stirred what I thought was a stalled yeast and I think I stirred too hard.  What are the down falls of introducing oxygen after the fermentation?
Answer: You have the potential for oxidized beer.  It may not happen, or if it does it may not be too bad.  But the best thing to do would be to drink the beer soon, before potential oxidation has a chance to get worse.
Comment: Oxidation can add a stale, paper or cardboard flavour and in some beers it increases the caramel flavour. Old Ales require a bit of oxidation.

Stalled Yeast Stirred


When a recipe calls or 1/2 cup of raisins, should the raisins be packed or not packed?

Question: You can get more raisins into a 1/2 cup if you pack them tightly.
So, when a recipe calls for 1/2 cup of raisins, should I loosely pour them into the cup measurer, or pack them tight?
Answer: If the writer has chosen not to mention this, it implies that either it doesn't matter (most likely, for example if the exact amount of raisins is a matter of taste), or it's badly written, in which case all bets are off.
I did an experiment using British style sultana raisins (which are slightly different from US sultanas) and a 200ml cup. I found that 1 cup of loosely packed raisins was 120g and tightly packed was 155g.  So for a 118ml ½ cup, loosely packed raisins would be 71g and tightly packed raisins would be 91g.
For comparison the website linked in another answer gives 80g for a half-cup  The variation of -9/+11g would hardly be noticeable in a fruit cake.
Raisins, are a natural product and will vary depending on the variety of grape used, some will be slightly sweeter, or more acid.  So even if you use exactly 80g, you will get some variation in result.
So for ½ cup of raisins you are free to pack them in, if you like a slightly more raisin-y mixture, or not if you don't.  You are also free to use 80g on the scales, or go crazy and see what the result of using ¾ cup in the recipe.  It probably won't be a disaster.
Comment: Wait, where did 80g come from?
Comment: From the OP in their self answer, https://www.howmany.wiki/vw/--1%7C2--cup--of--raisins--in--gram rounded to a reasonable accuracy.
Comment: @FuzzyChef Just a guess. but in the USA a cup is 240 mL (actually 236.6. mL and even that is rounded.) Anyway, 134 grams in 200 mL would be approximately 160 grams in 240 mL. So half a US cup would be 80 grams of the 134 grams mentioned in the answer.
Comment: can you add that to your answer, just for posterity?
Comment: I've rewritten that part to make my measurement more directly relevant to the OP's context


Finding corrupted data in R

Question: I have got a file that contains 1024 subjects, each have 3 data points. I need to find a corrupted data among them. I know for sure that there is just one data that is corrupted and it is quite evident when I look at the data but how do I do it through R? Need to find the row number that has the corrupted file.
Thanks!
Comment: What do you mean by "corrupted"? An invalid data point? A large value? What data structure?
Comment: An invalid data point.
Comment: As given this is too broad to reasonably answer. As phrased it is primarily about writing code "*how do I do it through R? Need to find the row number...*" which is [off topic](http://stats.stackexchange.com/help/on-topic) (see under Programming, and as also see the same link under *homework* -- whether you consider this homework or not, the statements there apply. If you can edit to make this narrower/clearer, to be about statistics rather than R code and to follow the guidelines for `self-study` posts, then it might be reopened.
Answer: Okay, so say that your dataframe is Patients.
In R just click ...
<code>> View(Patients) # This gives you a spreadsheet view of your dataframe.
> summary(Patients) # This gives you tabulated distribution of your columns.
</code>
Then you just click with your computer mouse on the top of the column that might be giving you the issue and it will realign all rows so that the highest datapoint is given in the first row and then the lowest data point is at the last row.
You didn't specify if the issue is a maximum or minimum outlier, but that's probably the issue.
You can also reorganize your data-frame with the order function with the argument ", decreasing = TRUE" in it, and sort.default is also a good way to do it particularly with respect to singular columns.
You can also use a boxplot to find the range of your error, so that you can use discretionary deletion.
If R is too advanced for you, then you can export your data.frame to a file as a comma separated values file (.csv) with "write.csv()", and edit it in Microsoft Excel or LibreOffice Calc, and then re-read it into R with "read.csv()" after you made some changes. If you do edit your data in a spreadsheet make sure every column has the same number of rows, or when you ask R to make a dataframe of your file then R will just proverbially scream at you.
Comment: Can you describe what your corrupted data is like? You don't need to know what the invalid point is. A boxplot, a summary, and View will tell you. It will be the first row if you interactively sort your dataframe with respect to one suspect column.

If your invalid point is the greatest point, then View() sorting will solve it. The corrupt point will be in the first row. If you make a boxplot, then the outliers will be trailing dots which you can see fit between the y-axis range of your boxplot. If you make a histogram, your outlier will be large peak with with no distribution.
Comment: I don't really know what the invalid point is. The question just says there is one corrupted data.

Finding corrupted data in R


Is it possible to create a Super Soldier based on the following ways?

Question:
Is it possible to create a "Super soldier" by artificially creating and implanting a device in the hosts body that would pump or increase the amount of adrenaline released in the Host's body exponentially?
If so can there be a way the Soldier can control the device on when to activate it or not? And by control I don't mean like a "physical switch" but more like "conscious switch". So, that the Soldier is not always in a "powered-up" state. He has the choice to activate it or not.
How is it possible to increase the soldiers muscle mass slightly to increase his physical strength, durability and endurance? Is it possible via pumping steroids?
Comment: What is your definition of a super solider?  In most situations, an overdose of adrenaline is detrimental compared to the measured amount a well trained solder's body will produce.  Very very rarely in combat do you want to be out of balance in any way, including chemically.
Comment: Not ethically. Expect many dead "super soldiers" followed by some that are very ill. Many attempts will be needed to improve performance.
Comment: What's the goal of the 'super soldier'? Punch through tank armor? Jump high enough to grab onto aircraft? Nimble enough to dodge rifle bullets? Perceptive enough to hear frequency-hopping radio? Clever enough to decrypt enemy signals?
Answer: You could theoretically implant a device into the brain of you super soldier candidate that agonized the neurotransmitters for adrenaline, giving the soldier a boost. You could wire that chip to another part of the brain, allowing it to be flipped on and off with a thought. We already have implants that let us send basic signals, like turning the lights on and off, by thought. See How to switch on a light with your mind for more information.
How effective this would make a super soldier is up for debate, because while adrenaline gives you strength and pain resistance, it also gives you tunnel vision, making it not the best for fighting enemies from all sides and when it wears off, the soldier would feel effects similar to that of coming down off any stimulant, the effects of the battle hitting them harder. It would basically only be good for short engagements with guaranteed support afterwards.
Answer: You can make it, but the payoff is high:
Whenever you pull this trick off you burdening your heart furthermore, the long term effects will include:

Cardiac Arrest, AKA: The reason why to not choose sports as a life
career, unless you want to die horrible deaths.
Exhaustion beyond any reasonable measure.

Also, why'd you do it? This is a natural stuff, that will always kick in, whenever your life is threatened.
If you seek to increase stamina, my best recommendation is to ask questions about an "ATP replenishing, and Lactic acid filtering device."
Answer: 1) Can such a device be made? Sure why not but it won't neccesarily help to create a better soldier.
2) Sure, we're getting much better and brain-computer interfaces. If we can make a chip that lets you control a robotic hand with your brain we can make a chip that moves a switch in your brain.
3) Yes? For increased muscle mass you can suppress the myostatin gene. This of course requires to be done before birth. But this will lead to greatly increased muscle mass.
This won't help you with endurace though. For that you might want to look at lactic acid breakdown. By creating a more efficient lactic acid breakdown you will reduce muscle fatigue. Do this enough and you could theoretically eliminate ot all together.


Arch: Wiped out /etc/group/, is there a way to recreate groups?

Question: I recently wiped out /etc/group by being dumb.
I have taken care of obvious missing groups, such sudoers and audio, but is there any way for me to determine if there are more groups missing?
Comment: You first could reinstall the `filesystem` package with `packman -S filesystem` which installs the */etc/group* file. After that you could try to reinstall each package, which should create needed groups. Unfortunately the GIDs are not deterministic and those could change and would mismatch with the associated GIDs in the filesystem. So very likely that you have to fix some things afterwards, but you should get all needed group names.
Comment: After that, run `sudo find / -nogroup -ls` to see which files are still in groups that aren't in `/etc/group`.
Comment: On my Arch, there is a file calle `/etc/group-` that has the same content as the `/etc/group` file. If it's still present, that could help you. You could also try a `getent group` as it's supposed to have a database with your groups.
Answer: Check to see if /etc/group- (with a tailing dash) exists.  That's a backup of the groups file.
I'm more familiar with Debian and Red Hat than Arch, but in general,  groups are configured:

In the base system installation.
As packages are added to the system requiring specific segregation.
As new users are added to the system.

Under Debian, forcing a reinstall of all package would take care of the first two instances, and looking at /home the remainder.
And primary user GIDs are the fourth /etc/passwd field by passwd(5).
After taking care of the obvious system groups, take a sweep through /home and maybe run a find looking for any GIDs that aren't in your /etc/groups file.  That will tend to point to to any unrestored data.
Meantime, you should also be asking yourself:

Why did you delete /etc/group in the first place?
Why don't you have /etc under revision control?
Why don't you have backups?

I'd focus strongly on addressing all three issues.


Did anyone ever actually take home the goat from "Let's Make A Deal"?

Question: After reading today's XKCD, I've actually become curious.  Is there any record of a contestant actually wanting to go home with the goat (or other Zonk!) on Let's Make a Deal?
Comment: Are game shows even on topic here?
Comment: @RLH: News and current events shows are not on-topic, and they are a huge part of television. And game shows seem more closely related to talk shows than to scripted shows.  But then reality TV I suppose is on-topic... so... *shrug*
Comment: I've never seen the show, but I'd guess the goat is not actually a prize, simply representative of 'losing'.
Comment: @DisgruntledGoat, they were considered an "undesirable prize".  As such, contestants would have had legal claim to the animals, but most contestants would choose the cash equivalent.
Comment: @Flimzy Hard to say, but it seems so. Might even deserve a meta discussion?
Comment: I'm not sure why they wouldn't be.  Game Shows are a very large part of "Television".  Please add a meta-link if a post is made.
Comment: @Flimzy... That's interesting.  Personally, I've always classified game shows as "the original reality TV".  That, and Candid Camera.  IMHO, these types of shows were the beginning of the "essence" of what is modern reality TV.
Answer: From the Wikipedia Page for Let's Make a Deal:

Prizes generally are either a legitimate prize, cash, or a "Zonk".
  Legitimate prizes run the gamut of what is typically given away on
  game shows, including trips, electronics, furniture, appliances, and
  cars. Zonks are unwanted booby prizes (e.g., live animals, large
  amounts of food, fake money, fake trips or something outlandish such
  as a giant article of clothing, a room full of junked furniture,
  etc.). Sometimes Zonks are legitimate prizes but of a low value (e.g.,
  Matchbox cars, wheelbarrows, T-shirts, grocery prizes, etc.). On rare
  occasions, a trader appears to get Zonked, but the Zonk is a cover-up
  for a legitimate prize.
Though usually considered joke prizes, traders
  legally win the Zonks. However, after the taping of the show, any
  trader who had been Zonked is offered a consolation prize (currently
  $100) instead of having to take home the actual Zonk. This is partly
  because some of the Zonks are intrinsically or physically impossible
  to receive or deliver to the traders (such as live animals or the guy
  in an animal costume), or the props/employees are owned by the studio.
  A disclaimer at the end of the credits of later 1970s episodes read
  "Some traders accept reasonable duplicates of Zonk prizes."

To back this up, this is from an interview with Monty Hall, one of the first presenters:

Interviewer: People who got stuck with the "zonks," the joke prizes, were they
  good-natured about losing out?
Monty Hall: In 4,700 shows, I got kissed 50,000 times. Even when they
  lost, they were very nice about it. But you know the law in game shows
  - if you go on a show and you win a donkey, that's your prize. You're entitled to it. So if a person won one of our zonks, they could take
  it home. But in 99 percent of the cases, we would offer them something
  after the show - a washer and dryer or a color TV or something,
  instead of that very valuable zonk, and they would take it. In 1
  percent of the cases, they didn't.
There was a time when a farmer won five calves and he wanted the
  calves. That cost me a fortune because when you rent them from the
  animal place, they're expensive. And there were other cases like that.
  Like people won dogs; they would keep dogs. They wouldn't keep cats.
  They would keep dogs. It was a very genial atmosphere, over 27 years.

So despite the "zonks" being joke prizes, people did indeed take them home on rare occasions. I'm sorry to say I haven't found an example of a goat being taken home, but I'm hoping a calf will do!
Comment: Wow! I'm not sure how I missed the notification that you had answered my question.  This is what I had hoped to find.  Thank you!
Answer: Once I saw a Zonk on the old "Let's Make a Deal" it was some kind of Animal (maybe a baby elephant or something) and I guess it was actually worth so much money Monty Hall let her trade it for a chance at the Big Deal at the end of the show, I only saw this happen one time on all the old "Let's Make a Deal" reruns I've seen, so it's obviously very rare that a Zonk was worth a lot of money like that.
Comment: Hello and Welcome to Movies & TV Stack Exchange! While your answer appears to be helpful, it would benefit from having a reliable source, otherwise it comes off more of comment. Eventually you will have enough reputation to leave an actual comment in the comment section.
Answer: Zonks are not actually prizes.  You get $100 (or was it $200) in lieu of the Zonk.  I know because I have been in the back room during prize paperwork time. :)
Comment: Monty Hall begs to differ.
Comment: This isn't an unreasonable response, however, you may need to provide a bit of clarification.  Why were you backstage?  Was this for the original show, or the newer one?  Did you (or do you) work for the television station that produces LMAD?  I'd be interested in finding out more, but for this to be an acceptable answer, you need to give a better, more objective response.


Nissan-appropriate jahrzeit observances

Question: The jahrzeits of both of my grandfathers zq"l fall during Nissan and I am always unsure of how to commemorate them, as I lack an halachic obligation to do so. (Furthermore, my paternal grandfather was German, thus diaqualifying El-Male further). What are some typical things done in just such an instance?
Comment: It's not. However, I feel that I should do something, despite lacking an obligation.
Comment: My grandfather (my father's father) passed away on the first day of Pesach.  As both my father and I are first borns, when my father was alive, we would sponsor the breakfast at our shul for the siyum for the first born on the morning before Pesach.  I also usually do the haftorah on the first day of Pesach.
Comment: Why is it necessary to observe the Jahrzeit of a grandparent?
Comment: @AvrohomYitzchok Why is it necessary to observe the Jahrzeit of anyone?
Answer: The main things done for a yahrtzeit are:

Getting Maftir on the Shabbos before
Getting an Aliya to the torah
Davening from the Amud
Learning mishnayos l'ilui nishmas the niftar
Lighting a yahrtziet candle
Saying Kaddish
Going to the kever and reciting certain pirkei Tehilim
Reciting Kel Maleh Rachamim
Fasting

Of all the above listed items, the only ones proscribed because of chodesh Nissan is Kel Maleh Rachamim and fasting. (see Sefer Pnei Baruch for more details)
Comment: @NoachmiFrankfurt Saying Kaddish might be a bit of a problem, but the rest seem totally permissible for anyone.
Comment: And how many of those for someone who isn't chayav l'aveilut after the petirah?
Comment: @NoachmiFrankfurt These are all observances that are prescribed for children of the niftar. I don't believe there are any specific customs for grandchildren, but none of these can hurt. Again though, none of them are proscribed because of chodesh Nissan except for fasting and Kel Male Rachamim
Comment: @Scimonster The only possible problem that I can think of with saying kaddish is if both the parents of the one saying kaddish are alive, and even there if they give express permission there is no problem. Also, that problem is not germain to Noach mi Frankfurt's question which pertained to chodesh Nissan specifically
Comment: @Scimonster, unless no-one is saying, Kaddish should always be said.

Nissan-appropriate jahrzeit observances


Is Third-Person Present Tense Common and Popular in Adult Novels?

Question: I was wondering if third-person present tense was common and popular in adult novels. I know when I'm reading Young Adult novels that this tense is like the norm. I mostly write YA novels so I can attest to this and it really works for the voice. But for my adult novels, I'm starting to doubt my use of third-person present after receiving feedback from a random person on the Internet. My other beta-readers didn't have a problem with this. But anyway, this random beta-reader I found said that people don't like third person present novels. Is this true or is he delusional?
Comment: For what genre or style?  Third Person Present is very common for Scripts (plays / films / tv shows), but much less common for Historical accounts.  Plus, with a *past* tense, it's usually pretty obvious that your protagonist will survive the danger unharmed...  For this reason, Clive Barker and Stephen King have both used Present for horror novels.
Answer: As I mentioned on the "passion project" question single data points don't mean much by themselves - if one of your multiple beta readers says something, then in the absence of any particular reason to give their opinion more weight it's probably of little consequence.
While there probably as many people bemoaning use of present tense in "adult" novels as there are people writing in it  (and that's a good many of both), like many technique choices it's a tool and the difference between getting the choice "right" is more matter of choosing the right tool for the job. The different tenses all have their pros and cons and the story and what you're trying to achieve by the use of the particular tense should drive it.
A bad novel written in the present tense is going to be bad if you write it in the past tense as well. Writing in the same story in a different tense can certainly ruin it - but it can't save a bad one.
Present tense has certainly enjoyed a relative wave of popularity in recent years, perhaps driven by the wide reaching successes of The Hunger Games, Fight Club and The Time Traveller's Wife to name but three - but it's not a new innovation - Dickens' Bleak House is an example dating back over 150 years ago. And perhaps much of the backlash is built upon the large numbers of people who have used it unwisely - attempting to imitate what Hunger Games etc did without understanding why it worked for the books they are trying to ape.
Present can bring a certain sense of immediacy to the action, it can intensify the emotions of the moment and couples well with a Deep-POV. But this comes with a cost - the flipside is that you narrow the scope, it can feel like you're watching the world through  a camera viewfinder with the zoom turned up. It's easy to get lost in mundane details and you either greatly restrict or outright lose a lot of narrative tools, time shifts are awkward and it's difficult to convey stories that play out over longer time frames.
What also cannot be ignored is good old human bias - there are readers out there who hate present tense, to the degree that they will abandon a novel as soon as they discover it's written in it. In this sense past tense is very much the "safer" choice.
So ask yourself - what does the use of present tense bring to my story? if you don't have a compelling answer to that you may want to re-evaluate.
Comment: @DM_with_secrets Yes, it's the most natural style for me to write in but as a novelist, I had to seek additional feedback to know whether or not something was working. This helped me smooth out the edges to insure my book reads like a novel and not a script.
Comment: I've read through my novels thoroughly and objectively and have given it to beta-readers for their review. My use of it is good and it certainly adds to the story being told. Thank you for your thoughtful response.
Comment: @JRosebrookMaye Out of interest, what is your actual reason for doing so (i.e. the answer to motosubatsu's question)?
Comment: @DM_with_secrets It's the most natural tense that I can actually write in. I come from a film background.
Comment: @JRosebrookMaye Ah, okay - so it's more about you and your personal style rather than this story in particular?


What is the use case of program's secret key after initial deployment?

Question: Is there any other use case of the program's secret key once the program is deployed? If I am correct, subsequent updates don't require the program's secret key. Can anyone do anything to the program if the program's secret key gets leaked ?
Answer: The secret key of the program address is only needed for the initial deploy. Once it's deployed (to all networks) there is no need for it. As of now, at least.


"different eras in history" or "different eras in the history"

Question: The Ngram says here that both expressions are used; however, I think "the history" is the correct expression because there is one history like when you write "the sun". On the other hand, my gut is telling me that "in history" is the word. I think only a native English speaker can tell which one I should use in formal situation.
Comment: You're completely mistaken in your logic. We would ***never*** include an article when referring to all of history collectively unless it was "qualified" in some way - ***The** history **of Earth** is very different to that of Mars or Venus*. That's to say you can only refer to ***the** history **of** [something / someone]*. In contexts where you're referring to all of [human] history, such as *History teaches us to be wary of new ideas*, you don't include an article. Think of it more as a kind of "proper noun" (referring to a single thing).
Comment: @FumbleFingers Great explanation my fellow developer! you just made it clear that "actually" there are more than one history, and this is strange but clear.
Answer: It depends on whether you mean "history" as the broad concept, or as a concrete example with a narrower focus.  Both are fine in a formal context.

He is the greatest general in history
He is the greatest general in the history of Europe

Additionally, you can still reference the concept, but limit to a particular subset:

He is the greatest general in European history.

Note there are many English nouns that act in the same way, for example "cuisine":

It is the most difficult dish in all cuisine.
It is the most difficult dish in all of the cuisine of India.
It is the most difficult dish in all Indian cuisine.


Integration in the context of modelling with the Meixner Process

Question: I failed to evaluate the integral of $\frac{e^{ax}}{x\sinh(bx)}$ with respect to $x$ from negative infinite to positive infinite. What techniques can I use to evaluate the integrals of such kind for the Meixner Levy process for the purpose of numerical analysis?
Comment: could you perhaps provide some more context ? Why do you need to integrate the function mentioned above in order to model the process ?
Comment: Is this question relevant to quant finance?
Answer: The integral diverges, hence numerical integration will not yield a meaningful result.
Indeed, using the Taylor expansion of the hyperbolic sine one has that  $$x \sinh (bx)= x\frac{e^{bx}-e^{-bx}}{2}=bx^2+\frac{b^3x^4}{6}+...$$
Therefore, at the vicinity of $x=0$
$$\frac{e^{ax}}{x \sinh (bx)}\sim\frac{1}{bx^2}$$
which is a non-integrable singularity even in terms of the Cauchy principal value.
Comment: I must humbly concede that you are correct


Something Wrong With elementary appcenter

Question: Today i've noticed my appcenter is not installing removing or cheching for updates. When i try to install something the bar just shows "starting" and then nothing happens.I tried to reinstall it but its still the same. I dont want to use other package managers since appcenter is more integrated and simple please help.I also tried to remove ppas related with elementary and write sudo apt-get update- upgrade but still no chance
Answer: Would it be worth a try to open the terminal and type
<code>sudo apt update
</code>
Then reboot the machine and see if that works?
Comment: I tried that dozens of time. I think the problem related with installing other package managers but synaptic.
Comment: I'm not sure what steps you have taken to get to this stage. Some apps in the app centre don't seem to be compatible which is why you are receiving the "starting" followed by the slider moving back to the left.

What was the reason for you removing the ppas related to elementary?


Interpreting PCA where the lower PCs have low variance

Question: Normally I expect most of the variance or at least a quarter of the variance to be explained in the first 2 dimensions of the PCA.  However, recently I came across a PCA where the first was only about 12% and the 2 about 6%.  What does this mean exactly? Does this mean that the PCA in question is not good enough to explain most of the variance?
Comment: How many variables were there? If you have enough variables, 12% might be impressive.
Comment: I don't mean the number of *points*, I mean the number of *variables*.  1500 points is fine.
Comment: @gung-ReinstateMonica hmm I never thought about that.  What would be consider many?  I have a total of ~1500 points.
Answer: The PCA is not good or bad. The values you have, where two principal components do not explain a big part of variance, mean that the data is far from being near a 2 dimensional subspace.
I can understand your data have many dimensions, as the variance of the second component only explains 6% and rest of components must explain even less each.
Here is an example. I create 1000 points in 5 dimensions with center (0,0,0,0,0) and different covariance matrices. In the first case, they are all distributed equally along each of the 5 dimensions. In the second case, points are also in 5 dimensions, but mostly near a plane in 2d. You can see the explained variance of each component.
<code>data_5d = mvrnorm(1000, c(0,0,0,0,0), diag(5))
summary(prcomp(data_5d))
# Importance of components:
#                          PC1    PC2    PC3    PC4    PC5
# Standard deviation     1.027 1.0064 0.9928 0.9604 0.9511
# Proportion of Variance 0.216 0.2076 0.2020 0.1890 0.1854
# Cumulative Proportion  0.216 0.4236 0.6256 0.8146 1.0000

data_almost_2d = mvrnorm(1000, c(0,0,0,0,0), diag(c(1,1,0.1,0.1,0.1)))
summary(prcomp(data_almost_2d))
# Importance of components:
#                           PC1    PC2     PC3     PC4     PC5
# Standard deviation     1.0074 0.9724 0.32140 0.30981 0.30016
# Proportion of Variance 0.4511 0.4203 0.04591 0.04266 0.04005
# Cumulative Proportion  0.4511 0.8714 0.91729 0.95995 1.00000
</code>
Comment: Agreed: It's all about what is and what is not there in the data. I'd argue that the most successful applications of PCA are with a bundle of variables known to be measures of, if not the broadly the same thing, then of two or three similar things. Very often PCA is a kind of fishing expedition in which people throw in all the data to hand and hope that PCA will discover structure they didn't know about. Also, as another answer makes plain. nonlinearities won't  help.
Comment: Let's focus on the case of PCA from a correlation matrix or equivalently on variables each standardized first so that each variance is 1. Then if all the variables are pretty much uncorrelated with each other, then each PC will also have a variance near 1. But if there are strong correlations the highest PCs will have variances much bigger than 1 and the lowest PCs may have variances much closer to 0. So, it's not so much about whether the lowest PCs have low variance -- that could be a good thing! -- but about the variation of the variances. For variance, here read eigenvalue too.
Comment: Thanks for the post javierazcoiti and thank @NickCox - so if understand what you said, having a lot of uncorrelated values could result in lower variance in the lower PCs?
Comment: Not what I said. Uncorrelated variables (not values) means all PCs have the same variance. Samplng variation will mean that eigenvalues will differ somewhat.
Comment: @NickCox ok got that makes much more sense.  Thank you this is helpful.
Answer: If the goal is dimensionality reduction, PCA may not be a good option in this case according to the variances you found. Some non-linear coordinate transformation may be much more effective.


Create KeyValuePair from columns in a single data row

Question: I have the following table in Sql Server that stores the permissions the Foreign Key UserId has to the Foreign Keyed BlogId. What I would like to do is write a query with Dapper that takes each column after BlogId and returns it as a KeyValuePair<TKey, TValue>.
CREATE TABLE [dbo].[UserPermission] (
    [UserPermissionId]     INT IDENTITY (1, 1) NOT NULL,
    [BlogId]               INT NOT NULL,
    [UserId]               INT NOT NULL,
    [CanCreateNewPosts]    BIT NOT NULL,
    [CanEditExistingPosts] BIT NOT NULL,
    [CanDeleteExistingPosts] BIT NOT NULL,
    [CanPublishDraftPosts] BIT NOT NULL,
    CONSTRAINT [PK_UserPermission] PRIMARY KEY CLUSTERED ([UserPermissionId] ASC),
    CONSTRAINT [FK_UserPermission_Blog] FOREIGN KEY ([BlogId]) REFERENCES [dbo].[Blog] ([BlogId]),
    CONSTRAINT [FK_UserPermission_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([UserId])
);

I would like to query via Dapper like this:
using (var connection = new SqlConnection(this.connectionString))
{
    string sql = "SELECT * FROM [Permission] WHERE UserId = @UserId";
    await connection.OpenAsync();
    IEnumerable<KeyValuePair<string, bool>> results = await connection.QueryAsync(
        sql,
        new { UserId = this.userId });
}

var p1 = results.First();
var p2 = results.Skip(1).First();

In the above example, I would like p1 to result in a KeyValuePair with the Key being CanCreateNewPosts and the Value being the column value, either true or false. Same applies with p2, where the Key would be CanEditExistingPosts, with it's corresponding value.
The underlying need for this is to simplify transforming the record into a list of Claims in Identity, one claim per column.
I looked at splitOn:, to try and split after the UserId column but that doesn't seem like it's what I want. It would require n-generic arguments for each column I split. Ideally I'd like to add columns to this table in the future and my security/data/servicing layer just handles turning it into a Claim - letting me just focus on the Controller Action that needs to check for the claim. Having the query and Dapper return map the column-name/values into a collection of KeyValuePairs would facilitate that need for me.
Answer: You can use the SQL UNPIVOT operation to transform columns into column values. Here's an example for your particular case:
SELECT u.BlogId, u.permission
FROM UserPermissions up
UNPIVOT
(
    permission for perms in (
        CanCreateNewPosts,
        CanEditExistingPosts,
        CanDeleteExistingPosts,
        CanPublishDraftPosts
    )
) u;

Comment: Close; what I essentially wanted was the column names to be returned as keys, and the column values returned as my value for that key. So I'd have a KeyValuePair for instance with the key being "CanCreateNewPost" and a value of "1". Not including BlogId, UserId and UserPermissionId


Upgrading Windows with applications currently on multiple drives

Question: I am considering upgrading a legitimate version of 64 bit Windows 7 to Windows 10 (or possible future versions if generally compatible). These days, with ever faster solid-state drives coming along and common storage of large files and applications on another drive, is it okay to upgrade Windows without having to uninstall and re-install applications on other drives? I know their registry entries will be associated with the drive the OS is currently installed on, so don't expect any broken registry entries. I  assume the process would be the same as if the applications were installed on the drive the OS is on (whether 32 or 64 bit applications). To be on the safe side, it should be possible to re-install these applications from scratch, but is a far more time consuming process. I know Windows does a good job of reporting the extent of the upgrade process to users and system changes made.
Answer: From my understanding of your question, you have two main things. One would be upgrading your main HDD to an SSD and upgrading from Windows 7 to Windows 10. Normally, if you update your Windows from 7 to 10, you should be able to do it without any problems in regards to the applications. But, since upgrading to an SSD means you have an all new "main OS drive", no one can assure you that the applications on the other non-OS drive will work flawlessly. One solution might be trying to clone your main drive to the new SSD and than update from Windows 7 to Windows 10 on that one. But to me it seems, it might be less of a hassle if you install Windows 10 on the SSD and simply try to repair or reinstall all your applications on the non-OS drive. Even with Windows upgrade process, there some settings, things, that are very hard to clone or be copied from one drive to the other.
After seeing your comment, I would say that according to this microsoft site, such an update is possible without data loss, meaning in theory, all your applications should work. All you need to do, is follow the link and download the "update assistant" windows update tool, start upgrade with that. At one point, you will be asked if you want to keep your files or not. Select to keep it and in some time, windows 10 should be up and running. It might be good keeping in mind, that even though Microsoft itself says that no data loss will occur, they advice to making a backup.
Comment: Thank you for the comment. I do not need to upgrade/change the drives (that has already been done: HDD to SSD for OS). Only update the OS to work well with all functional drives and installed software. My motherboard/Intel chip is too old now for latest tech such as M.2 NVMe or thunderbolt.