How do I activate the Genocide Route in Undertale Ruins

Question: I am playing Undertale at the moment, and so far I have done Pacifist and Neutral a couple of times, but now I want to do genocide. But, for some reason, I cannot activate the genocide route. Why is this? I cannot get the 'But nobody came' thing. Is it because I didn't do a true reset? I just reset. I killed Flowey in a neutral 'no mercy' run. Please answer! Also, does it matter that I only reset, I didn't do a true reset? Thanks! By the way, where is the best spot to find monsters to kill?
Answer: You can start a genocide run whatever you did in your previous runs. To activate a genocide run, you first have to kill all the enemies present in the Ruins (a total of 20 enemies). When you will do so, the message "But nobody came" will appear during your next battle, as you said. The music will also change and will confirm that you are ready to go kill Toriel, and thus start your genocide run.
What usually happens when you are trying to start a genocide run in the Ruins is that you end up not finding any monster anymore because they become really rare. You have to keep walking until you kill all of them though. It can take a bit of time, so don't worry if you walk for several minutes without meeting any monster.
Do note that you are allowed to spare some monsters, but you still have to kill the amount required (20 in the Ruins as said) to unlock the genocide run.
Comment: Another sign that you're on the Genocide route is Toriel dies in one hit when you fight her.
Comment: @Bagahnoodles I feel like this is an unnecessary spoiler. It may be better to say something like "Another sign that you're on the Genocide route is Toriel's dialogue is drastically different when you fight her."
Answer: My opinion is that you should reset the game and once you met Flowey for the beginning, you should try to avoid all the pellets, and after he has been attacked by Toriel, you just keep killing all the monsters and leave no one behind.


What is the difference between ultrafast laser and normal laser?

Question: I was reading an article of latest innovation and i came across this 'ultrafast laser' term. What is the difference between it and the laser we normally refer?
Answer: Laser in the "normal" sense is continuous wave.  Meaning that it is always on and shining light.  An ultrafast laser is a special class of pulsed laser systems, where the laser light is pulsed on for a short period of time, typically in a cyclical fashion.  The idea being that when you build up the population inversion for the laser, you can extract all of the energy in a shorter time period, which allows for laser pulses at much higher intensity than you could otherwise get from a continuous wave laser.  This is useful for a variety of applications, including probing the dynamics of things that have very short time scales.  Ultrafast lasers could be useful for probing the dynamics of the nucleus for instance, which occurs on very short timescales ($\sim 10^{-18}\ \text{s}$ if I remember right).
Comment: Ultrafast lasers use mode locking to generate pulses of a picosecond or less; when chirped pulse amplification (CPA) is used it is also possible to obtain high power: a train of pulses one millisecond apart, each with a milijoule of energy corresponds to 1 watt average power; but if each pulse is 100 femtoseconds long, when focused you can convert steel directly to plasma, a form of laser cutting with no heating. Thus the physical response to ultrafast pulses is quite different than that of longer pulses, or CW lasers.
Comment: I wouldn't consider a CW laser more "normal" than pulsed. Typically the first lasers made in any new technology (including Maiman's first laser ever, the first diode lasers, etc) are pulsed. CW lasers are only possible once the technology improves enough that CW operation doesn't overheat the laser. Of course these lasers have pulse widths that are only short on thermal time scales, and there's a different technical challenge in reducing the pulse width down to picoseconds or femtoseconds.
Comment: The attosecond pulses are generated by femtosecond lasers, typically 10 fs pulses; the excitation generates electrons which in turn generate the x-ray pulses; this is very leading-edge science.
Comment: @ThePhoton I agree.  I had to infer what the OP meant by "normal", which I took to mean a laser pointer type laser, which is CW, which is something that one is more likely to come across in everyday life.  I take it based on the acceptance of this answer that this is, in fact, what the OP meant.  But your point is well taken.


If $|OA| + |OB| =|AB|$, then $\overleftrightarrow{AB}$ passes through $O$.

Question:
Being $A = (x_1,y_1)$, $B = (x_2,y_2)$, and $O = (0,0)$ in the Cartesian plane, demonstrate that, if $|OA| + |OB| = |AB|$, then $\overleftrightarrow{AB}$ passes through $O$.

"$|PQ|$" is the Euclidean distance from $P$ to $Q$.
Answer: $|OA|+|OB| = \sqrt{x_1^2+y_1^2} +\sqrt{(-x_2)^2+(-y_2)^2}\ge \sqrt{(x_1+(-x_2))^2+(y_1+(-y_2))^2}= |AB|$ by Minkowski inequality. Equality occurs when $x_1,y_1$ are proportional to $x_2,y_2$. Translate this statement into proportion we have: $x_1 = k(-x_2), y_1 = k(-y_2)\implies \dfrac{y_1}{x_1} = \dfrac{y_2}{x_2} = -k\implies OA, OB$ have equal slope $k$, thus $O,A,B$ are collinear. Note that this question can be tackled in various ways such as completing squares, AM-GM inequality and even CS inequality. I tried to give it some new treat !!! by involving the Grandpa Minkowski !
Answer: $$\sqrt{x_1^2 + y_1^2} + \sqrt{x_2^2 + y_2^2} = \sqrt{(x_1-x_2)^2 + (y_1-y_2)^2}$$
And square both sides, cancel out the terms:
$$2\sqrt{x_1^2 + y_1^2}\sqrt{x_2^2 + y_2^2} = -2(x_1x_2 + y_1y_2)$$
Cancel out the 2, and square both sides again:
$$(x_1^2+y_1^2)(x_2^2+y_2^2) = (x_1x_2 + y_1y_2)^2$$
Expand and cancel out the terms:
$$x_1^2y_2^2 + x_2^2y_1^2 = 2x_1x_2y_1y_2$$
$$(x_1y_2 - x_2y_1)^2 = 0$$
Then assuming $y_1,y_2 \neq 0$
$$\frac{x_1}{y_1} = \frac{x_2}{y_2}$$ which means the slope of $OA$ and $OB$ is the same. Also $A$ and $B$ must lie on opposite quadrant because if they ere to lie on the same quadrant, then $x_1x_2 +y_1y_2$ would be positive, therefore our second equation cannot hold. Thus, $AB$ passes through $O$.
If $y_1=0$ then $x_1y_2=0$, and since $x_1$ cannot be 0 (otherwise $A$ is just $O$) then $y_2 = 0$, which means both $A$ and $B$ lie on the $x$-axis. Then the problem becomes easy.
Answer: Consider $\triangle OAB$.
The lengths of the 3 sides are $|OA|, |OB|$ and $|AB|.$
Euclid:
The sum of the lengths of
2 sides of a triangle  is greater than
the length of the 3rd side.
$\Rightarrow: $
$OAB$ is NOT a triangle .
Hence points  $A,O, B$ are collinear.


I can't log onto servers

Question: I can't get into ANY servers in MCPE. I've tried loads of servers, but I still can't get in! It just says "locating server".
Answer: Check that your screen name doesn't use any strange characters.
My sons both have a Galaxy tab. While one of them could connect to the Lifeboat Server instantly, the other could not. It was rather frustrating, and an answer was nowhere to be found, an answer that solved the problem that is. So we installed MCPE on my Galaxy tab as well, and tried to connect to the server. It worked in an instant.
So why would two tabs work just fine, while the third one wouldn't? In our case it was my son's screen name that would not allow him to connect to the world. To make sure we were on the right track we changed the screen names on all three tabs, and BINGO, it was the screen name indeed. My son now has a new name, and with that he can connect.
Comment: Could you define what you mean by 'strange characters'? Do you mean accented letters (é, æ, ñ...) or punctuation, or other symbols (§, ¶...)? What characters were causing you problems?
Answer: From what i've read this is actually because A LOT of servers are purely fake, taken down, full or under construction,
It seems that there is a real issue of servers just being down completely,
I dont think this is a technical issue on your end, it is just significantly harder to find a server that is actually on, Try joining a server that maybe your friends are in and is not full,
If you are on android you can also try clearing the data of the minecraft app which results in the app reverting to a "Fresh" version,
Answer:
This question is from 2014, but I will answer from my experience in mid-2020.

There are 2 reasons why this could be possible:

The server might have certain bugs and issues still not fixed or mismanaged leading to a bad experience logging in to a server. This happened to me in Lifeboat.
You have a high ping. In my sorts, playing a game with 300+ ping could be a buggy experience especially logging in to servers. Using ping less than 150 is suitable.

I can't log onto servers


How to find a control or page a control is embedded In

Question: I've written a web user control which I want to be able to drop into the markup for either aspx pages or other web user controls.
I need my user control to be able to easily and efficiently work out if its inside another user control or an aspx page. My initial idea is to do it recursively with checks on the Parent property - continue looking up the nesting hierarchy until I find either a web form or a user control - but I'm not sure this the best way of going about this.
Can you suggest an easier way? Thanks.
Comment: What spawns the need for your control to be "aware" of its parent? If it is simply because you need custom event handling based on events of either the page or other controls, than perhaps delegates are the way to go... It is possible to have a more graceful solution...
Comment: It's for something that I'm working on so I'd rather not say yet ;-)

I wanted to make something simple for developers to be able to easily drop into their code so its deliberately kept as self-contained as possible with a requiremment being zero-config, hence the need to make the thing 'aware' of where it is without having to do additional hooking-up.
Answer: Recursively check the type of your Parent until Parent.GetType() is either typeof(UserControl) or type(Page)
private bool IsAncestorTypeOf(Control c, params Type[] typesToCheck)
{
   var parent = c.Parent;

   if (parent == null) return false;
   if (typesToCheck.Contains(parent.GetType())) return true;

   return IsAncestorTypeOf(parent, typesToCheck);
}

Or the same without recursion
private bool IsAncestorTypeOf(Control c, params Type[] typesToCheck)
{
   var parent = c.Parent;

   while (true)
   {
       if (parent == null) return false;
       if (typesToCheck.Contains(parent.GetType())) return true;

       parent = parent.Parent;
   }
}

Call it like
var isAncestorPageOrUserControl = IsAncestorTypeOf(this, typeof(Page), typeof(UserControl));

or
var isAncestorPage = IsAncestorTypeOf(this, typeof(Page));
var isAncestorUserControl = IsAncestorTypeOf(this, typeof(UserControl));

Comment: This is exactly the sort of thing I was thinking of, although I was probably going to do it with some LINQ-type goodness ;-).

I do worry a little about performance in the scenario of a Page that hosts multiple user controls containing my widget all making this recursive call at runtime. Any thoughts?
Comment: well, you can run a loop instead of recursion. guess it will theoretically perform better because you're not filling up the stack... but one way or the other you have to crawl through every parent until you find the types you're interested in.
Answer: Generally, components should be unaware of their arbitrary containers, although the containers must know their components (unless it's a strong dependency situation like list items are always in a list type and you can make a strong two way relationship). However it sounds like you are reaching out into the general surroundings. You might find many cases to code for doing this and accidentally miss others.

By making the user control aware of its surroundings and the larger world you may be introducing dependencies that make your control less reusable and harder to maintain.
If something the control needs is outside of itself, you might move toward composition by forcing the developer to provide a reference to the needed thing on a property of your user control. This is the way, for example, that validation controls in ASP.NET do it, to reference an external control to validate by id.
Of course what I specified is practical only some of the time. Is there a specific reason or edge case why you need to make your user control look around itself, or can you get away with providing instructions to the developer about where the control should be used?
Comment: all depending of the specific scenario i really don't see it as to root of all evil. There are a lot of built-in asp.net controls that to exactly the same. Try for instance to drop an  or  into your page without a  and you'll see them complain loudly!
Comment: Indeed Microsoft's control reliance on the form is a very special and important edge case.  You're right, not the root of all evil, just another evil among many, that we all but too often participate in.
Answer: This should work:
C#
bool inPage = (this.NamingContainer == this.Page);

VB.NET
Dim inPage as Boolean = Me.NamingContainer is Me.Page

Edit: it seems to be not as simple as i hoped. If the usercontrol resists in a control like a GridViewRow, the NamingControl of it would be the Row and not the Page.
This takes it into account:
C#
public static bool isControlInPageOruserControl(Control uc)
{
 bool inPage = uc.NamingContainer is Page;
 if (inPage) {
  return true;
 } else if (uc.NamingContainer is UserControl) {
  return false;
 } else {
  return isControlInPageOruserControl(uc.NamingContainer);
 }
}

VB.NET:
Public Shared Function isControlInPageOruserControl(ByVal uc As Control) As Boolean
    Dim inPage As Boolean = TypeOf uc.NamingContainer Is Page
    If inPage Then
        Return True
    ElseIf TypeOf uc.NamingContainer Is UserControl Then
        Return False
    Else
        Return isControlInPageOruserControl(uc.NamingContainer)
    End If
End Function


os.path.getmtime of shared files in Dropbox

Question: I want to run a script to check whether certain files in my Dropbox folder have changed. I am currently using os.path.getmtime() to check that the modified time is in some window of time.time(). The problem is that if I modify a file in my Dropbox folder from a different computer than where the script is set to run, the modified time does not change on that latter computer. Is there a good way to watch shared files that doesn't run into this problem?
Thanks for any help! I am just getting into python.
*******UPDATE*******
I have been playing more with how Dropbox handles file timestamping. It only updates the mtime if the file changes. If you open a file, modify it, but save it unchanged, the mtime stays the same.
Comment: How do you save it unchanged?
Answer: It looks that Dropbox preserves mtime when synchronizing files. Try to detect changed file by changed file size and/or checksum (MD5, SHA1 or so) instead of modification time. Or just ask Dropbox :) (I don't know if it has any API for this).


Can I tweet only to a select group of people?

Question: I need to send Twitter messages to groups and if I do will the tweets be private and not re-tweet-able?
Comment: I don't know if this adds any value to the answers already given, but I think it boils down to a matter of perspective about what Twitter is. You are seemingly attempting to use it like an email list, but it is more like a radio station... you broadcast, people tune in.
Answer: As of now short answer no.  A possible solution would be to create another twitter account.  Protect the updates and have the people you want to communicate follow that account.  As far as retweeting... I believe this is always possible.  Even with protected updates.
Alternative would be to send a bunch of direct messages.
Might need to choose a different medium for communication if this is necessary.  Such as email.
Answer: Yes, it's right there in the settings under Tweet Privacy:

☐ Protect my tweets
Only let people whom I approve follow my tweets.
If this is checked, your future tweets will not be available publicly. Tweets posted previously may still be publicly visible in some places.
Answer: While you can protect your tweets so that only those you approve of can receive them, there is nothing you can do to stop those same people re-tweeting you.


Need help Creating a texture in photoshop

Question: hi guys im looking to make a similar texture seen in the youtube thumbnails of "Our changing Climates"'s youtube chanel. if you could help provide information on what the texture is, how to make it or provide me with a sample that would be a great help.
strong text
Comment: What have you tied? Where is that failing?
Comment: Please don't vandalize your posts. By posting on the Stack Exchange network, you've granted a non-revocable right, under the [CC BY-SA 4.0 license](https://creativecommons.org/licenses/by-sa/4.0/), for Stack Exchange to distribute that content (i.e. regardless of your future choices). By Stack Exchange policy, the non-vandalized version of the post is the one which is distributed, and thus, any vandalism will be reverted. If you want to know more about deleting a post please see: [How does deleting work?](/help/what-to-do-instead-of-deleting-question).
Answer: The texture isn't uniform or some kind of repeating pattern, so it's probably not something created in Photoshop from scratch. It looks like they probably used a photo of an actual texture, perhaps some kind of paper texture like this. If you want to make your own to avoid the cost of purchasing one or any copyright infringement problems, then take a photo of a texture you like, and convert it to black and white.
Here's an example using the texture in Photoshop. I have a background with a simple radial gradient. Colours were sampled from your example image. The B&W texture is on a layer above with the blending mode set to Overlay.
Answer: As shown already in an earlier answer something resembling can be got by blending a grey texture layer over a red gradient layer. The problematic thing is to get the right looking grey texture. One idea is to have a photo of a watercolor painting which doesn't present anything recognizable, even ordinary recognizable brush strokes should not be used, the color should be spread by other means.
In this case the colors of the painting are not important, because you need only a grayscale version. In the next image one painting is downloaded from a site which has "free modern abstract acrylic texture images":

The source site is this: https://unblast.com/free-modern-abstract-acrylic-textures-jpg/
The texture has a gradient layer mask which fades it in the middle. The texture has blending mode "Overlay" and its opacity is reduced. On top there's a black&white mixing adjustment layer with "the next layer only -switch =ON"
If it's too flat you can insert with blending mode Hard Light an embossed version of the texture image (=Filter > Stylize > Emboss). Here'a a high zoom in screenshot

The surface scratch is a black 2 px wide brush stroke.
If you are going to publish or sell something: Websites which say they have free content to download can contain illegally uploaded copyrighted stuff or there can  somewhere be a small print which says it's not actually free. To be sure you avoid copyright problems read the license carefully. If it's not free or there's no clear license available which allows you to use the image as you wanted purchase a commercial texture image or paint your own. I guess making it with on real paper is much easier than trying to find a way to make it rich enough in Photoshop.


What is the so-called eigenvariable or parameter in natural deduction?

Question: I am reading the Wikipedia article on Natural Deduction. In section 6, the presentation of intr and elim rules for the universal and existential quantifiers, it mentions a concept called eigenvariable/parameter without further discussion. What is it? What's the difference between the eigenvariable/parameter $a$ and the bound variable $x$ introduced by $\forall$ or $\exists$? What's it used for? The side conditions for the $\forall$ intr and $\exists$ elim rules also puzzled me. Could anyone explain a little bit more? Thanks.
Comment: This is covered in standard undergrad logic textbooks and is off-topic for cstheory. Please read the FAQ if you haven't.
Answer: The eigenvariable condition is used when want to introduce the forall connector.
If you want to introduce forall a, then you need to make sure that a is not free in the assumptions. Therefore you can be forced to rename a free a the assumption with new name.
In http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.94.9463&rep=rep1&type=pdf by Alwen Tiu you can read :

In proof search for a universal quantified formula, e.g.,
  ∀x.Bx, the quantified variable x is replaced by a new constant c, and proof search
  is continued on Bc. Such constants are called eigenvariables, and in traditional
  intuitionistic or classical logic, they play the role of scoped constants as they are
  created dynamically as proof search progresses and are not instantiated during
  the proof search.

See page 2 for more details
Comment: Does this concept exist with another name in lambda calculus/type theory?
Answer: The usual formalisation of first-order logic needs to distinguish between letters that stand for things that can be substituted by any term and letters that are taken to be particular terms.  The eigenvariables are the latter sort of letter, which cannot be substituted for in the forall-intro / exists-elim rules.
This is a very tricky concept when learning predicate logic and the move to natural deduction has the capacity to confuse things still further.  To get a handle on the inference rules, most people find they need to be somewhat formalist about the distinction, viewing the distinction as a syntactic marker saying which are the leaves of a formula that can be substituted into.  But at this formalist level, you do not really grasp the why of it.
The key is that the two kinds of letter can be seen to be variables that derive their meaning in the judgement expressed at that point in the derivation.  The semantics of the variables has their being bound, with regular variables being universally quantified and eigenvariables being existentially quantified.  The constants then are equivalent to the Skolem constants that arise from the Skolemisation of the formula expressing the judgement.
The above is tricky, and properly grasping it requires that you (i) are comfortable with the application of Skolemisation (see Wikipedia on Skolem normal forms for a decent discussion), and (ii) figure out how to apply it to express the judgement at each formula in a natural deduction proof.  But then, this is no more than the complexity of variables and constants in first-order logic.
It would be nice to recommend a text that covers this ground, but none come to mind.
Comment: Thanks, Charles. Concerning your third paragraph, my question is it seems to me that in the intr or elim rule for a single universally quantified formula, these two kinds of variables don't occur at the same time, above the intr node no universally quantified variable but only what you called existentially quantified one, below vice versa. How do you explain this? Another question, your first sentence mentioned "the usual formalization", I suppose there are unusual ones? Could you point to me one? Thanks.
Comment: @plmday - *at the same time*: You need the whole proof above the rule to determine this; subderivations will constrain how the various letters are related to each other. *unusual ones*: There are variable-free axiomatisations of predicate logic, such as combinatory logic.
Answer: The eigenvariable conditions preserve the scope of the variables, i.e., no binding of a variable is added or removed in the substitution process.
This is usually ensured by the condition that the variable doesn't occur in the set of hypotheses.
Creating new/fresh variables (which do not occur in the set of hypotheses) is one technique for satisfying this restriction:

where y is a variable not previously used in the proof

(p. 25 of
    http://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-130.pdf)
See also the eigenvariable conditions:

*Eigenvariable conditions:
  ∀I: provided x not free in the assumptions
  ∃E: provided x not free in B or in any assumption save A

(p. 19)
The general concept is valid in all mathematical logics, not only in natural deduction.
See, for example, the higher-order logic Q0, which is a Hilbert-style system based on type theory using lambda calculus (lambda notation).
For the introduction of the universal quantifier, cf. the Rule of Universal Generalization (Gen) (Theorem 5220 in [Andrews, 2002, p. 222]).
For the elimination of the existential quantifier, cf. Rule C (Theorem 5245 in [Andrews, 2002, p. 230]).
The restrictions in these rules have their origin in the substitution procedure of Rule R', which is valid only provided that it is not the case that "x is free in a member of [the set of hypotheses] H and free in [A = B]." [Andrews, 2002, p. 214].
This restriction on Rule R' is also implemented in the logic R0, cf. pp. 386, 487 of
    http://www.owlofminerva.net/files/formulae.pdf.
The corresponding (derived) rules for ∀I and ∃E are A5220H (Gen) (pp. 76 ff.) and A5245 (Rule C) (pp. 122 ff.).
For the references, please see: http://doi.org/10.4444/100.111


Kohen Entering the Taj Mahal

Question: Can a kohen enter the Taj Mahal? When visiting India is a kohen allowed to enter even certain parts of the Taj Mahal? The tombs themselves are of non-Jews, of course, and they are buried beneath the earth.
Comment: According to [Wikipedia](https://en.wikipedia.org/wiki/Taj_Mahal) most of the area is a memorial and not a tomb. You would first need to identify the tomb area and the mosque before considering what halachos apply. `The tomb is the centrepiece of a 17-hectare (42-acre)[5] complex, which includes a mosque and a guest house, and is set in formal gardens bounded on three sides by a crenellated wall.` Even the tomb area may have only a small section that would be a problem.
Answer: This is taken from a different question (Issues of Tumah vis a vis non-Jewish human remains)
Original source DO THE REMAINS OF A NON-JEW CONVEY TUMAT MET?

The remains of a non-Jew convey tumas meis if they are touched or
  carried. Although all agree that the halacha is that the remains of a
  non-Jew convey tumah through touching and carrying, there is a dispute
  as to whether the remains of a non-Jew convey tumas ohel. The Shulchan
  Aruch rules that it is proper to be stringent (Yoreh Deah 372:2).

Therefore it seems as though it is proper (according to the Shulchan Aruch) for a Kohen to be stringent and avoid the Taj Mahal as it represents an "ohel" for a corpse. As always, one should consult their LOR.

Kohen Entering the Taj Mahal


Why does Soda Pop after Shaking

Question: Why does shaking a soda can and opening it make the soda jump out of the can?
Comment: Add the word "oversaturated", and that would be the complete explanation.
Comment: Soda contains carbonated water, and by shaking it, the carbon dioxide is released which generated the pressure and the soda jumps out. Even when you open the can without shaking, the gas will come out but slowly. $$\ce{H2CO3 (aq)<->H2O (l) + CO2 (\uparrow)}$$ [Not enough information so posted as comment]
Comment: And the nominal oversaturation is possible due to the can being pressurised under CO2 to begin with.
Answer: Soda drinks are carbonated meaning that carbon dioxide is dissolved into it. When carbon dioxide dissolves, the following reaction occurs: $$\ce{CO2(g) + H2O(l)~ \leftrightharpoons ~H2CO3(aq)}$$ As you can see, carbonic acid (a weak acid) is formed. This is responsible for the 'fizziness' of the drink.
Note that this reaction is in equilibrium, meaning that not all of the carbon dioxide dissolves to form carbonic acid, but only a certain percentage of it. Usually, the percentage of carbon dioxide that is dissolved is constant, however this can be changed by doing certain things to the system.
For example, by decreasing the pressure, the equilibrium will shift to the left, meaning that the percentage of carbon dioxide that is dissolved will decrease. This will result in an increase of gaseous carbon dioxide in the bottle. This reason for this is explained by the Le Chatelier's principle. You can also imagine it as a piston pushing the gas into the liquid as shown in the below image. Image (a) is at low pressure while image (b) is at high pressure.

Normally in soda bottles, the pressure inside the bottle is relatively high, to ensure that more carbon dioxide dissolves into the drink. So when you open a soda can you decrease the pressure. This results in more carbon dioxide gas being produced. It is the release of this gas that causes that pfffftt sound.
Now, when you shake the bottle, due to turbulence, small bubbles containing carbon dioxide form. The formation of these small bubbles allows even more carbon dioxide gas to form. So if you shake a soda can and then open it soon after, the soda will jump up quite violently, as there is now a lot of carbon dioxide being released.
However, if you shake a soda can, and then wait a while before opening it, it will most likely just create the normal pfffftt sound. This is because you give the system some time to go back to its original equilibrium position, meaning that some of the carbon dioxide gas will redissolve back into the solution .
Comment: Well this isn't quite right. In truth $$\ce{CO2_{(g)} <-> CO2_{(aq)} <-> H2CO3_{(aq)}}$$ Most of carbon species in water is dissolved gas not carbonic acid.
Comment: No worries, I am glad that I could help.
Comment: I think the key here is fluid mechanical: shaking moves the fluid around, reducing the effective pressure, then the carbon dioxide tries to make up for it, per Le Chatelier.
Comment: Shaking does not change the pressure It simply distributes small bubbles of CO2 throughout the liquid that all expand more or less together entraining liquid. when the bubble is on the top only gas escapes. try opening the bottle upside down and see what happens.
Answer: I was watching a Vertassium episode where Dr. Muller was holding a soda bottle with a pressure gauge atop that registered a rather high pressure. He guaranteed that the bottle was still a long time and equilibrated and asked what would happen to the pressure when the bottle was vigorously shaken. I thought about it and said Nothing. He shook it and the pressure did not change.  The reason a shaken soda erupts seems to be the distribution of microgas bubbles thruout the liquid that expand when the pressure is released, not conversion of carbonic acid to CO2 or even CO2 being released from the solution. Champagne seems to require additional research. Maybe by New Years Day that research can be finished.
Answer: Soda or other cool drinks like Coke, Pepsi etc. contain water along with dissolved carbon dioxide (aerated). Since the solubility of carbon dioxide increases with increase in pressure (Henry's law), the Soda is bottled under pressures higher than the atmospheric pressure.
When we open the soda bottles or cans, the pressure drops again to atmospheric pressure and the dissolved carbon dioxide will escape out into the surroundings. It occurs all of sudden so that soda will jump out with fizz. The scenario will be even more worse if we shake the bottle before opening due to thrust created.
Remember that soda can be referenced as carbonic acid, H2CO3. For more information see carbonate and bicarbonate chemistry.
Comment: Explain thrust created!

Why does Soda Pop after Shaking


Save location for pinned items in office 2016

Question: The company I work for decided to upgrade everyone from Win 8 with Office 2013 to Win 10 with Office 2016 and since we have an encryption client, doing a simple upgrade is out of the question.
Therefore we reinstall their devices completely. However users often complain that the pinned items they have in Office 2013 don't show up in Office 2016.
Which is why I'm writing a PS script to export the reg key.
I already found out that the pinned items are stored under the following reg key in Office 2013:

HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Word\User MRU\%user Identifier%\File MRU

Likewise for Excel and Powerpoint.
However I was unable to find the location where the pinned items are stored within Office 2016.
I checked the reg key for similar locations under the Office 2016 location, but the items that I pinned do not show up under any of those reg keys.
So my question is, where does Office 2016 save the pinned items for Word/Excel/Powerpoint?
Answer: They're in the 16.0 folder instead of 15.0


Can ab wheel replace crunches?

Question: Are an ab wheel and plank exercises a good replacement for the good old but boring crunches? What effects are better and what it cannot replace?
Comment: That depends on what your goals are.
Answer: The ab-wheel and products like it can give you much faster results than crunches and sit-ups alone. I would advise that you have to have almost perfect form when using wheel type products and must hold your abdominal muscles tight when pulling and pushing as well as focusing on maintaining a solid posture and working slowly. It is easy to hurt yourself when using these types of aides, I would not recommend them if you are not already in fairly decent shape with good to very strong arms, chest walls, abdominal muscles and supporting lower back musculature. They can be very challenging, consider first a sit-up bench. They are designed for ergonomics and with some care taken can easily give you the same results as well as offering the options to add weight on your chest or in your hands and being able to target "spare tires".
As far as planking goes if you are not attempting very dangerous places to plank then it is always a good exercise for any spare time. I find in between television programs and during commercials its a good time killer. Always keep your core tight, back straight, and work on breathing and maintaining as long as possible.
Comment: Not bad products, just annoyed that ads show very fit folks using them with ease. The average american even in shape will struggle if using a wheel properly. And stress put on wrists and shoulders can be uncomfortable and dangerous if underlying issues exist, IE. carpal tunnel, tendinitis, cuff weakness/tears, neck and shoulder strains, etc. Had two clients swear by an ab-roller and seemed to maintain nice form, however, i will mention both were amateur wrestling and spent close to thirty hours in the gym a week faithfully. They we also amateur lifters with other fitness related activities.
Comment: I'll admit to some curiosity... do you have a basis for it beinf more effective?
Comment: Physical Trainer, Coach, Firefighter 11+ years. On the job injury 9 years ago pushed me to attempt every product out there to keep up with abs and lower back without increasing back pain. Ab roller was horribly painful until i had my supportive muscles built properly. still a very hard exercise, many clients have trouble with it as well. The benches and planking together have repeatedly given same results and many better than a wheel or sit-ups and crunches alone.
Comment: great answer, i completely agree that ab wheels are on the advanced side, and i've stopped recommending them for anyone who can't do dips/heavy-ish squats/etc. welcome to stackexchange @L.Samson

Can ab wheel replace crunches?


Are car sharing applications patented

Question: Are there granted patents for car sharing systems? Assuming Uber, as an early entrant has such patents, how could competitors like Lyft and careem  have surfaced after Uber?
Answer: The specific patent publication US20120330696A1 mentioned in the original version of this question is a publication of an application, not an issued patent. One way to see this is to look at the upper right of the document and see "Pub. No.:" before that number. Also, application publications have numbers that start with a year followed by a yearly sequence number. Issued U.S. patents have a monotonically increasing sequence number from patent 1 to hitting 11,000,000 in May of 2021.
If you look up US20120330696A1 in google patents you will see it went abandoned. Looking in the Global Dossier (linked from the google patents page) it was abandoned 11/13/2013.
To answer the larger question - patents cover what is in their claims, the numbered passages at the end. To infringe a patent, a product or service needs to have all elements or perform all steps in at least one claim. It is usually possible to work around a patent to proved a similar result. Claims are not for results but for specific structures or steps to achieve a result.
The abstract and specification need to back up the claims and are almost always much more expansive than the claims that end up issued.
To the broader question you will need to do a comprehensive search to see what companies have what granted claims.
Comment: No they may own any number of issued patents, both any invented by their employees and purchased from other inventors and assignees.
Comment: You might ask how to find patents owned by a particular entity as a new question. You might mention why you are looking for that information.
Answer: One doesn't patent the concept "car sharing", one patents a specific thing, which is described by things known as "Claims".
Part of the invention process, and why patents are granted (in the US, at least) "to advance the Arts and Sciences" is to encourage people to come up with other ways of solving the problem "how can people share cars?"
So long as businesses (or individuals) can keep coming up with different ways to solve the problem "how can people share cars?", and those solutions satisfy the things like the "novelty" problem, there will be no end to the number of patents issued for "car sharing".

Are car sharing applications patented


Identify encryption algorithm for .enc files

Question: I need to identify the encryption algorithm used to encrypt some files. I have the key, but I can't decrypt it using OpenSSL, because I don't know what algorithm was used to encrypt it. Is there any way to identify these files' encryption algorithm?
Comment: So, it's not possible !!
Comment: Unless there is metadata in the file headers that gives this information, then no, you don't know what was used.
Answer: You can identify:
a) metadata embedded in the encrypted file by many encryption tools - including algorithm name and mode
b) several old, weak encryption algorithms (so weak, that it's possible to detect them by patterns or by statistic analysis in encrypted file - for example Caesar Cipher, but also many more algorithms used in 20th century even for military purposes)
c) what algorithms were possibly/impossibly used to encrypt the data, based on the encryption key structure (sizes of individual parts of the key, or simply metadata embedded in the key file)
Unfortunately that's all.
If you have "raw" encrypted file, without any headers, then you can try to analyze the internal key structure, and then try to decrypt the file using all algorithms that use decryption key with the same sizes of individual parts.
However, it's also possible, that your encryption key is not "raw" but just an input data to some transformation, eg. PBKDF2. If so, it might be impossible to decrypt your encrypted file without knowing all details about used encryption mode.
Comment: Caesar Cipher is indeed a very old one! :-)


Can I take pictures on a Canon T6i with no lens fitted?

Question: Currently I am trying James Millar's method of transferring old Super 8 movies by DSLR 1080p video of film in projector gate: https://vimeo.com/20950590  With projector lens still in place, Canon DSLR T6i (no lens) close to projector lens, I can get sharp image of tiny movie frame 6mm x 4mm in gate, lit from desk-lamp behind gate. However, I would appreciate input re best settings on Canon 6Ti?
Answer: Yes, it's typically possible to take pictures with no lens attached. You can even make a digital pinhole camera by having a lens cap with extremely small hole in it!
The camera knows there is no attached lens, so it may omit the picture in the live view mode and replace it with a dark image.
Note if you're using external optics (projector lens), you need the image to be in focus at the sensor. Not sure how easy that's to achieve with the projector lens.
Comment: while technically you've answered the question (is it possible), I imagine the OP really wants to know _how_ to do it. Typically there's some setting that must be enabled in order to release the shutter when there's no lens attached. I'm not familiary with the setting in this case. Do you know what it's called and where it's accessed?
Comment: Thanks to Juhist who raised some of the potential issues. In fact, getting a sharp image with this projector lens was NO problem. Juhist unfortunately did not clarify the steps to take pic or video with Canon EOS T6i DSLR, As noted by osullic, that is my real question. Perhaps someone else can clarify how to do this?


How does "see votes" privilege work?

Question: Recently I earned the "see votes" privilege. What does it do and how to use it?
Answer: If you click on the number of votes on the left side of a post, it will expand to show you the number of upvotes and downvotes rather than just the end total. More details on the "established user" privileges.
Comment: @FrancisL. [Looks like you have to use the desktop site or the app](https://meta.stackoverflow.com/q/292208/3511560)
Comment: This doesn't seem to work on mobile devices
Comment: @FrancisL. I just tested and it works on both the mobile website and the app, however there is a difference. The mobile website seems to work best with a quick tap, where as I find I need to press and hold a moment in the app.

How does "see votes" privilege work?


How to remove all binary files from a SVN Repository to decrease it's size?

Question: We would like to decrease the size of a repository by purging all binary files usually zip files that are not development oriented.  Any easy way to remove them?
Comment: Decrease the size of the repository, or the checked out version?  The latter would be fairly easy, the former could cause consistency problems.
Comment: Yes I love it when someone checks in Eclipse!  And yes, dump/filter/load is the way it's (un)done.
Answer: i assume you wnat to decrease size of repository [ on the server ], not just content checked out.
as far as i know only way to remove something permanently from svn is to:

run the dump of repository
manually remove unwanted files/changes to those files from the dump
recreate repository

in this way you'll preserve history and all meta-data yet you'll get rid of unwanted files [ eg binaries ].
Comment: check also this: http://stackoverflow.com/questions/560684/svn-obliterate
Answer: Unfortunately, no.
There is currently no simple way to completely remove files from a SVN repository. This feature (usually called obliterate), has been requested since 2001, but it is not yet implemented. See the  bug report for all the details.
The workaround for the moment is to dump the repository, filter the dump, then reimport.
This is explained in the standard book, Version Control with Subversion.
Comment: Mercurial or git capable of this?
Comment: Mercurial not, apparently: http://www.selenic.com/pipermail/mercurial/2008-March/017803.html . Git can do it, it seems: https://wincent.com/wiki/Obliterating_a_Git_commit
Answer: The best way to prevent people checking in files you don't want is to use the pre-commit hook. Reject (ie return a non 0 value) if any of the files in the commit match a pattern. The user will receive the message when they try to commit. You can set the global-ignores, but that only applies to the client, if a client is installed without setting the ignores, they will happily attempt to checkin whatever they like.
eg. (using windows batch files, you'll be better off with perl) to restrict specific file extensions, and return the bad files with a message to the user:
<code>@echo off

svnlook log -t "%2" "%1" | d:\tools\grep -c "[a-zA-z0-9]" > nul
if %ERRORLEVEL% NEQ 1 goto DISALLOWED

echo Please enter a check-in comment 1>&2
exit 1

:DISALLOWED
svnlook changed -t %2 %1 > c:\temp\pre-commit.txt

rem ** remember to set the TruncatedExtensions registry setting to 0 **
rem ** or .resx will be matched as if it was .res **

findstr /G:"%1\hooks\ignore-matches.txt"  c:\temp\pre-commit.txt > c:\temp\precommit-bad.txt
if %ERRORLEVEL% NEQ 0 exit /b 0

echo disallowed file extension >> c:\temp\precommit-bad.txt
type c:\temp\precommit-bad.txt 1>&2
exit 1
</code>
Where ignore-matches.txt is:
<code>^[^D].*\.aps$
^[^D].*\.vbw$
^[^D].*\.obj$
^[^D].*\.ncb$
^[^D].*\.plg$
^[^D].*\.bsc$
^[^D].*\.ilk$
^[^D].*\.exp$
^[^D].*\.sbr$
^[^D].*\.opt$
^[^D].*\.pdb$
^[^D].*\.idb$
^[^D].*\.pch$
^[^D].*\.res$
^[^D].*\.suo$
^[^D].*\..*scc$
^[^D].*\\Debug
^[^D].*\.user$
</code>
Answer: You can also prevent users from adding binary files by ignoring them
you have to edit  ~/.subversion/config and look for global-ignores. If the line is commented, remove the pound character.
<code>global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store ._* *.log *.bak
</code>
so you can add what you want i used it to keep my repository clean from mac os temporary files.
Hope that will help you.


How to convert a list to a csv in python

Question: I have a list: ['1','2','3'] and want to convert it to 1,2,3 i.e. no brackets or quotation marks.
Comment: Do you just want a comma separated list in text form or a csv file?
Answer: ",".join(lst)

will do it, but that's not really csv (would need escaping and such).
Answer: You can convert almost any list to csv using pandas like this:
import pandas as pd

list1 = [1,2,3,4,5]
df = pd.DataFrame(list1)

Depending on what you want to do with this csv, you can either keep the csv in a variable:
csv_data = df.to_csv(index=False)

Or save it in your filesystem like this:
df.to_csv('filename.csv', index=False)

Here index=False will remove unnecessary indexing/numbering in your csv.
Answer: If you want to generate a canonical CSV file, use the csv module.

Example from the docs:
>>> import csv
>>> spamWriter = csv.writer(open('eggs.csv', 'wb'), delimiter=' ',
...                         quotechar='|', quoting=csv.QUOTE_MINIMAL)
>>> spamWriter.writerow(['Spam'] * 5 + ['Baked Beans'])
>>> spamWriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])

Comment: IMHO a "canonical" CSV would use comma as a delimiter, not `' '`, and probably `'"'` as the quotechar, not `'|'`.
Comment: Sure.  It's added to the answer.  Just use `foo.writerow(list)`, where `foo` is your `csv.writer` object.
Comment: True.  In that case, you can omit those two options.
Answer: import csv

def writeCsvFile(fname, data, *args, **kwargs):
    """
    @param fname: string, name of file to write
    @param data: list of list of items

    Write data to file
    """
    mycsv = csv.writer(open(fname, 'wb'), *args, **kwargs)
    for row in data:
        mycsv.writerow(row)

mydat = (
    ['Name','Age','Grade'],
    ['Teri', 14, 7],
    ['John', 8, 2]
)

writeCsvFile(r'c:\test.csv', mydat)

Comment: Why do you have the `'b'` (binary mode) mode for the file `open`?
Answer: I think you need to split out the file opening part of your code so that you can close that later, separately. In this case, you are trying to "close" the writer object. Although the better way is to use "with", this example is more similar to the way you have it:
csvfile = open('test.csv', 'wb')
csvwriter = csv.writer(csvfile)
for item in pct:
    csvwriter.writerow(item)
csvfile.close()

Answer: Carl, whenever you write data into a file what Python actually does is buffer the data and then does its I/O operation with the file (writing the data into the file). This operation is called 'flushing' (the buffers). You have to make sure you are close()ing the opened file, if not, buffer won't be flushed and thus you won't have anything written in the file.


Why does my camera insist that my Nikon 50mm f1.8 be locked at its lowest aperture setting?

Question: I just got this lens and I really love it, but I can't seem to figure out why it will only take pictures at f/1.8. If I attempt to change the lens aperture setting, it says the aperture must be set at its lowest setting.  The lens is AF but I can only manual focus on the D3200.  Is there a setting I need to change, or a special way to set up the camera to be able to change the aperture setting on the lens, or is that just how it is for this camera?
Comment: If your lens has an aperture ring you need to set it to f22 and engage the physical slider lock. Then the camera body will control the aperture. See http://photo.stackexchange.com/a/8345/19059.
Comment: You rotate the aperture ring on the lens to F22 then lock it in place. Then you adjust the aperture as needed on the camera body.
Comment: the camera wont let me set the lens to anything but it's lowest setting, 1.8.  If I move the slider on the lens, the camera pops a message saying to set the lens to its lowest setting and it will not work unless I do.
Comment: not sure which 50mm you have but you can check here if it is compatible with your cam.
http://imaging.nikon.com/lineup/dslr/d3200/compatibility02.htm
Answer: @Scott Reed I have the same lens in Nikon F100. In my camera I have always set aperture to f22 in order to be able to set the aperture from the camera. Try to lock the lens in f22. Which exactly 50mm lens, do you have?  Nikkor 50mm 1.8G or nikkor 50mm 1.8D? I am guessing that you have 1.8D which came without auto-focus motor. Moreover, neither the lens nor your camera have got auto-focus motor, thus it's normal that you can't auto-focus.
Comment: The G lens doesn't have an aperture ring. It could be the D or any of several non-D versions of the lens -- none of which have a built in AF motor.


What connection type (mysql_connect, mysql_pconnect, PDO) should we use for multi-server database system?

Question: Short description:
We have multiple standalone database instance (rdbms) for mysql and RESTAPI server for each, on different region. Each RESTAPI server will need to connect other DB instance to grab data. We are also unable to move on no-sql DB now so mysql is our only choice.
What strategy would be better if we want grab data from other instance?
Currently we are using mysql_connect() for each request to connect & fetch data as we've a single instance and single rdbms now.
Is there any benefit is we rewrite our code using mysql_pconnect or pdo and create one connection for each server before starting processing request & then grab data from that specific server ?
Details:
We already developed a RESTAPI service with a single server instance and a separate rdbms instance.
Now we are expanding the server as the number of active users are increasing rapidly. Also all the users are grouped by region and we are not allowed to store his data outside of his region. So we can't use a centralized DB system.
We know which data is stored in which DB. Problem is how we will connect to the remote database and grab data from there.
Which strategy will be better for designing a heavy traffic multi-instance server?
If there are four(4) DB instance & each time we use mysql_connect() function to connect remote db then there will be 1x4 socket (port) allocation. then if we need to process >10000 request concurrently the more than 40000 port or resource need to allocated (not sure if works that way).
I'm a newbie on multi-server system and not interested to reinventing wheel again.
Any suggestion will be appreciated.
Please help me to over come this problem?
Thanks.
Answer: Short answer:
MySQL is deprecated, so PDO is the answer.
Long answer:
Someone else may provide ;p.


made with a and b (exclusive)?

Question: If one makes a product with method A and a different product with method B, then is it correct to say that 'Two products are made with A and B.'?
Answer: As stated it would be ambiguous, you could add the word "respectively" to make the meaning entirely clear:
"Two products are made with A and B, respectively"
Here the adverb "respectively" means "considered individually or in turn, and in the order mentioned".
Comment: thank you for the answer. If a data is processed with method A and method B so that two different outcomes are obtained, then can I say 'A data is processed with method A and B respectively.' the same way ?
Comment: Yes, although data is plural in English (the singular is datum) so there is no article, however you'll often find it acceptable (but technically wrong) to use a singular verb "The data is collected". "Data are processed with method A and B respectively" could mean you took the data and processed it with A, and then you took the same data and processed it with B. Although in this case it could also mean A followed by B, as it's not connecting one thing (a datum) to one thing (a method), but one thing (the dataset) to two things (method a and method b). I would probably reword it.
Comment: @james Yes, I would suggest something along the lines of "Processing the data set using method A produced result Alpha and using method B produced result Beta". My personal preference is, usually, to sacrifice brevity for clarity if there is any conflict at all.

made with a and b (exclusive)?


Why is meta-nitrophenol less acidic than para-nitrophenol?

Question: My professor said while explaining the acidic nature of phenol that meta-nitrophenol is less acidic than para-nitrophenol, and gave the reason that resonance doesn't play on meta, but I didn't get it.
Comment: Hi Rishabh, welcome to Chemistry Stack Exchange! Have you tried drawing the resonance structures of the meta-nitrophenol and para-nitrophenol ions? Hint: you should be able to draw 2 for the para one but none for the meta one.
Answer: The acidity of nitrophenols (or any acid for that matter) is determined by the stability of the conjugate base. In the case of m-nitrophenol and p-nitrophenol, the relative stability can be determined by looking at the resonance structures.

You can see that p-nitrophenol has an additional resonance structure where the negative charge is delocalised onto the oxygens of the nitro group, which are highly electronegative and therefore stabilise the charge effectively. This stabilisation is not possible in the case of m-nitrophenol because there is no opportunity via resonance for delocalisation onto the nitro group.
Answer:
Refer to the structures the negative charge never gets over META position and hense resonance does not affect the  electron density at META.
and hense nitro on META will not be able to pull electron from ring via (-M) and hense there would be negligible efffect on polarity of O-H bond.
Comment: The oxygen in phenol definitely doesn't carry a partial positive charge. It is still very electronegative and bears a negative charge.


Need to determine log space required for a large transaction (MSSQL)

Question: I need to update billions of rows in a partitioned table; it's also likely that the updates will move data between partitions. I'm trying to figure out how much additional log space I would require to do this as a single transaction (I realize that I would be better off batching this work, but am trying to avoid that). I want to experiment with a smaller set so I can see what it would take at scale. Is there any system management view I could monitor that would help me figure this out?
Comment: Does this answer your question? [How to monitor SQL Server data and log file growth?](https://dba.stackexchange.com/questions/13252/how-to-monitor-sql-server-data-and-log-file-growth)
Comment: @Aaron, long story but if I'm looping I have to know which records have been changed and I don't have anything on the record I can use for a dirty indicator. Adding a column for this purpose would be a big change all on its own.
Comment: Great article there! Thank you. Problem here is that the update is not idempotent, I can only execute it once per record. I was going to use a last updated column as the control, selecting N remaining untouched records and populating it as I went so I knew which records had been touched. It occurs after looking at your examples that I'm being too strict in my thinking.  I can loop on one of the natural keys instead, with a transaction surrounding each one. Thanks for the help - please put your article as the answer if you'd like.
Answer: I don't think you want to try updating billions of rows in a single transaction, and frankly I don't think it's worth the effort to try to extrapolate how much time that would take or how much transaction log churn it would burn through.
Batching is the way to do this... it allows you to minimize the impact on the transaction log, pause the process between batches for verification or maintenance, allows users free access to the portions of the table not currently locked by the current batch, and provides for a much smoother rollback in the case of a problem with the batch (or any problem on the server, some of which won't really impact you until the service restarts, like someone tripping over the power cord).
There is no reason to store a dirty flag in the table. Assuming you have an immutable key (and you aren't intentionally changing the key, or at least you are changing it to some predictable thing that won't make a current row conflict with the future version of a different row), you can simply scan the table once to pre-determine batches/ranges of rows that you will update exactly once. So let's say you have a table with a bigint key, like this:
CREATE TABLE dbo.MyBigTable
(
  MyKey bigint NOT NULL,
  -- OtherColumns here,
  CONSTRAINT PK_MyBigTable PRIMARY KEY (MyKey)
); -- Partition stuff here

And you have a billion rows in there, you can determine the low and high boundaries of each batch you want to update with a single pass of the table:
DECLARE @BatchSize int = 10000; -- find your sweet spot (see article below)

;WITH x AS
(
  SELECT rn      = ROW_NUMBER()       OVER (ORDER BY MyKey),
         ln      = ROW_NUMBER()       OVER (ORDER BY MyKey DESC),
         MinKey  = FIRST_VALUE(MyKey) OVER (ORDER BY MyKey),
         MyKey
    FROM dbo.MyBigTable
)
SELECT BatchNumber = ROW_NUMBER() OVER (ORDER BY rn),
       RangeStart  = COALESCE(LAG(MyKey,1) OVER (ORDER BY MyKey)+1, MinKey),
       RangeEnd    = MyKey,
       Processed   = 0
INTO dbo.UpdatingQueue
FROM x WHERE rn % @BatchSize = 0 OR ln = 1
ORDER BY BatchNumber;

CREATE UNIQUE CLUSTERED INDEX CIX_UpdatingQueue
  ON dbo.UpdatingQueue(RangeStart, RangeEnd);

Now your batch can say:
DECLARE @BatchNumber int;
SELECT @BatchNumber = MIN(BatchNumber)
  FROM dbo.UpdatingQueue
  WHERE Processed = 0;

WHILE @BatchNumber IS NOT NULL
BEGIN

  -- need try/catch here obviously

  UPDATE mbt SET { whatever your update is }
  FROM dbo.MyBigTable AS mbt
    INNER JOIN dbo.UpdatingQueue AS q
    ON mbt.MyKey >= q.RangeStart AND mbt.MyKey <= q.RangeEnd
    WHERE q.BatchNumber = @BatchNumber
      AND q.Processed = 0;

  UPDATE dbo.UpdatingQueue
    SET Processed = 1
    WHERE BatchNumber = @BatchNumber;

  SELECT @BatchNumber = MIN(BatchNumber)
    FROM dbo.UpdatingQueue
    WHERE Processed = 0;

  -- add a delay, explicit checkpoint
  -- / log backup here, what have you
END

It may be worthwhile determining if a batch crosses a partitioning boundary and manually changing the batch windows so that a batch only ever handles a single partition. Assuming the thing you use to identify a row matches the partitioning key, which isn't always the case, this is easy; if the clustering key is something else (like leading on datetime), it's a little more complicated.
Anyway, that batch can be interrupted, because if you stop it and start it again tomorrow or next week, it will pick up where it left off (this is why I don't use #temp tables here). If you have the processing power, you could get creative and have multiple processes working through the queue simultaneously, as long as they were each configured to work on their own partition (but you'd only really see any gains here if they weren't saturating the I/O, e.g. the partitioning is physical as opposed to just logical).
I put together a quick example of this here:

Example db<>fiddle

But you should also bookmark this article, which talks about some other aspects of batching (even though the article is geared to deletes, it applies to updates, too):

Break large delete operations into chunks


How to get Touchpad settings retained after boot

Question: Hello I am running Ubuntu 14.4 LTS (`3.13.0-68-generic #111-Ubuntu x86_64 x86_64 x86_64 GNU/Linux') and I am one of the many who experience palm detection / too high sensitivity with the touchpad, sending the cursor around while typing.
I have already found many advice by reading around (there are many posts, I quote a few References below), and tested some solutions, but I have not yet achieved a solution which continues to work after reboot.
In particular I have already followed those present on AskUbuntu and StackExchage (see references below) about "how to correct this and that syndaemon setting".
All those I have read basically reduce to the following two steps:

play around with syndaemon settings until you are satisfied
--> and this works fine, e.g. with commands
/usr/bin/syndaemon -i 0.5 -d -K, but only until the end of the session
put a proper line in "Startup Activities" (whatever it's named, in Italian it is "Applicazioni d'Avvio") so that it will be automatically done for future sessions. For this I also took into account that it needs a prepended sleep, in order to run when all the required process background is properly setup. the full line is: /bin/bash -c "sleep 10&&/usr/bin/syndaemon -i 0.5 -d -K"

Even doing so, I still experience those issues again, and when I inspect the syndaemon process by means of htop or ps -ax | grep syndaemon, I find:
2005 ?        S      0:04 syndaemon -i 1.0 -t -K -R
2224 ?        Ss     0:04 /usr/bin/syndaemon -i 0.5 -d -K

See the unwanted line is still there (it's the first).
What does it mean Ss in the second line?
What can I do to fix it once and forever (and for all users?)
PS. On every user account where I have made such tests changes, there also happen the following side-effect: from time to time the touchpad goes inactive, in such a way that I cannot toggle it on by pressing Fn+F5. Rather it needs a synclient TouchPadOff=0 to revive.
That's all. I thought I would find more complete information by asking the forum directly.
A few References:
[syndaemon] Where to configure syndaemon settings?
[retain] How to make touchpad settings stick on Ubuntu 14.04.1 (Trusty)
Answer: You have two instances of syndaemon running. That can cause cursor lockups, etc.
One of the instances could be started by checking "Disable while typing" in system settings. You need to disable it if you use another command.
Comment: How can I update the command in "startup activities" so to kill the unwanted instance, while at the same time launching the new one?
Comment: You need just uncheck the setting in System Settings -> Mouse


Calibre: Can't get regex to populate columns with meta data by lookup name on Import

Question: I need some help with regex, or maybe templates if regex isn't the best way. I know nothing about Python and am just getting into Regex because of Calibre.
Trying to add some metadata to columns during import.
I have a magazine collection with 2 levels of folders, 1 root level and 1 sub level folder with all the magazines from that year. The top level is the magazine name such as "Make", then underneath the year folder(s) with the issues inside for each year. Each issue is named with the month and year, such as: December 2018.pdf
What I have done is just pulled out all the magazine files and placed them flat in another folder.
I am looking to Parse the filename for the month and year and place that data into .
Tried A lot of regex things and have got as far as matching some data with various regex experiments. Everything just goes into the Title field on the regex test page. How come something like this doesn't populate  with the year ?
(?P[^_0-9-]+)
I understand as far as parsing the filename to find a match. I am at a loss as to the high level next steps as well.

Assuming I have found a matching filename, do I need to "capture" the data, or is it captured when parsed ?

I am thinking of doing a column with just the year, and trying the month Year and using series to sort each mag chronologically.

maybe just putting each item into it's own column.

Any help would be appreciated.
Answer: You might try using the existing Path column, which can be parsed for files already added to the Calibre library, as well as new additions.

Define a Custom Column, and create a Template parsing the Path and Title as you wish.


Is there a website or free downloadable program to identify and remove malware from an ISO file?

Question: Is there a website or free downloadable program that allows a user to identify and remove multiple types of malware from an ISO file?
Comment: Can malware infest an image file?  I mean, beside naming an executable on Windows NudeJenniferLopez.jpg.exe and praying someoe is dumb enough to click it, does any image file format have enough executable or interperable parts to carry malware?
Comment: The image could exploit a vulnerability in a popular image viewer or codec, like the old [ANI vulnerability](http://technet.microsoft.com/en-us/security/advisory/935423) in Windows.
Answer:
it could issue updates through fully functioning bitmap

So you're talking about stripping out steganography rather than neutralizing malware - in which case you'd get some mileage out of converting the file format (then possibly converting it back again). However it is technically possible to embed the content in such a way that it is still recoverable (IIRC the hidden WoW user id is extractable from a photo of the screen in addition to a direct image grab) e.g. if the image is of a barcode, then converting the format is not likely to disrupt the value embedded in the bar code.


Displaying error message from Apex Code

Question: How to display error message at the top of page in Salesforce from Apex? (I'm not using Visualforce)
Answer: You can display error messages using the addError method on sobject or its fields.
Salesforce docs on the sobject instance addError method: https://developer.salesforce.com/docs/atlas.en-us.198.0.apexcode.meta/apexcode/apex_methods_system_sobject.htm#apex_System_SObject_addError
More info on exception handling: http://wiki.developerforce.com/page/An_Introduction_to_Exception_Handling
Comment: Other ways you could go about it are to call addError on a specific field like Account.Name.addError('').  This would give you a different, but smaller prefix to the error.  Additionally, you could write a validation rule on the sobject to show an error instead of handling it in Apex.  This would show a Validation error instead of Invalid data.  If none of those suffice, the only other route is more customization through either Visualforce or Javascript.
Comment: Thank you for your answer. addError works, however it appends "Error: Invalid Data. Review all error messages below to correct your data." before the error message. Any ideas how to disable that?
Comment: I think using Visualforce would be too much for this scenario. Then I would need to add a page and a controller. I am searching the web how to call JavaScript from Apex class but couldn't find the solution. Is it even possible? (Regular Apex class, not controller)
Comment: Fixed link in case someone else will try to click the first link in the answer above: https://developer.salesforce.com/docs/atlas.en-us.198.0.apexcode.meta/apexcode/apex_methods_system_sobject.htm#apex_System_SObject_addError

Displaying error message from Apex Code


What model of Cannondale road bike is this

Question: I'm seeking a road bike in my size and this one is (47-49cm). Seller knows nothing about bikes and doesn't know the model, year, or materials. It's a Cannondale, all original except seat and pedals.
Comment: Aside - it is suspicious and sketchy that someone is selling a bike and has no idea about anything.   Excuses like "someone gave it to me" are suspect.   You could ask for the serial number (probably stamped under the bottom bracket or into the chainstay on a cannoodle) and trust your instincts.  There will always be other bikes if something smells bad about this one.
Comment: How did the seller end up having it?
Comment: "Seller knows nothing..." would make me back off, screams illicit!
Comment: I agree with proceeding with caution, but if my wife went to sell any of our bikes (perhaps after my passing), she would know nothing. Even if I'd spent _hours_ raving about all the details.
Comment: Not a dupe, but there are a lot of relevant points on avoiding buying a stolen bike at https://bicycles.stackexchange.com/questions/743/what-should-i-look-for-when-buying-a-used-bicycle
Comment: The model is a Synapse. 2013? Aluminium with carbon fork. 105 groupset.
Comment: I urge you to have a look at this question: https://bicycles.stackexchange.com/questions/74549/is-my-rim-cracked the questions seems not related to yours, but it will be, especially after reading updates #2 and followings.
Answer: It's a 2014 Synapse Womens 5 105
Comment: Thank you. That's definitely it.
Comment: Its a Synapse 2014 for sure.I bought one for my girlfriend.
Answer: I don't know Cannondale's models well. However, I have some approximate guesses about roughly what type of bike this and what year.
Due to the lighting, we can't see the exact componentry. I can't read the component model name on the rear derailleur. It could be an 11s 105 (3rd from top, and this one would be the generation released in 2015 if it is one), 10s Tiagra (one step down from 105), or 9s Sora, or possibly 8s Claris (these are in descending order of price). The front derailleur looks like the same generation. I think that the rim brakes make it a bit more likely to be a model earlier than 2018, as even the entry level models had started to transition to disc brakes. The fact that you have brake cables under the bar tape and what looks like internal down tube routing is consistent with this. In any case, I'd guess between 2015 and 2018.
The frame looks like an aluminum one. I would infer this because the carbon frames tend to be pricier, and Cannondale would be less likely to substitute a budget crankset in, and because I think I can see weld lines by the head tube. The CAAD series of aluminum frames generally have level top tubes, whereas you have a sloping top tube. It's possible this is a Synapse. Those were made in aluminum and carbon. Versions equipped with 105 exist, as do versions with Tiagra and Claris.
We don't give bicycle valuations per our FAQ. I'm not sure how much I trust Bicycle Blue Book's prices, because the used bicycle market is thinner than the used car market (so poorer price discovery). However, here's their page for the 2016 Cannondale Synapse 7 Sora, which does look a bit like this bike. I think bikes with this specification would have retailed for about US$1,000-1500 when new.
The Synapse is an endurance road bike. That is, an all-purpose road bike for leisure or sporty riding, and it actually won't really slow you down in a race if you decide you actually want to do road racing (which is not necessary to enjoy the sport, just offered as an example of what you can do with that bike). Basically, this is a perfectly fine beginner's road bike. If you don't like the sport, you can sell it to someone who might. I suspect it may lack mounts for racks (on which you can mount panniers to carry stuff) or fenders (for riding in the rain, remembering that many of us don't usually do this).
Comment: Wow, thank you! I am probably going to view the bike so I'll know more about the components, but you answered my most important questions: Is it a decent beginner's road bike (yes), and is it overpriced (yes, very). I used to ride about 10 years ago and had a Specialized Dolce that I liked quite a lot, as well as a Surly steel road bike.
Comment: For a new or returning road-bike rider, the expected extra comfort of an endurance bike could be beneficial compared to a more aggressive posture
Comment: @Kate Actually, I did *not* answer if it's overpriced, because a) we don't do valuations here, as stated in our FAQ and b) I don't know what the seller is asking, anyway. If you want to go there, you could check eBay and Facebook marketplace for sales of similar Cannondales (Synapses, preferably with 105, probably years 2013-2018 or so, make sure you look at rim brake Synapses). You could check similar bike models also, e.g. from 2016, Specialized Allez (unisex) or Amira (women's specific) from similar years, Giant Defy, Liv Avail
Answer: In many jurisdictions, you do not commit a crime by buying a stolen good if you honestly think it is not the result of a criminal action.
However, with this answer, I am exactly warning you that such a good bike sold by someone having no clue about it apart reading the obvious brand name it may be stolen, unless the contrary is somehow proven, i.e.:

the seller provides you with the serial number;
the seller provides you a receipt of the time he/she bought it, or it shows the will of providing a written sales agreement (it can be just a hand written undersigned piece of paper "I, Bike Eisenhower, residing in the White house around the corner, confirm that I sold a B-29 bike to Kate");

So good luck, it may be a good deal, or you may be providing an incentive to bikes thieves in general.
Disclaimer: I am not morally judging you, I just do not want to give any incentives to bike thieves. Yes, someone else will buy it, but: the less demand (willingly or honestly ignoring its provenance) there is for a certain good ("stolen bikes") the less rentable it will be the commerce of such good ("stealing bikes").
Comment: Anyway in most jurisdictions, even when unknowingly buying a stolen good, you may be compelled by law to hand it back to the rightful owner if they claim it. You cannot lawfully own a stolen item.
Comment: @Carel, it can be even worse. For example in Switzerland: you are the buyer of a stolen thing (for example a car) from a shop, but the shop did not know it was stolen, you as the new buyer have to give back the stolen object to the owner **but** the shop can keep the money. Unbelievably absurd. But real.


Can I give out my e-mail here?

Question: Can I give out my e-mail address here, or are users not supposed to do that?
Answer: You are welcome to put your email in your profile, but please don't spam the Q & A site.
Comment: This seems to be the closest match to the advice offered in http://meta.stackexchange.com/questions/89965/what-to-do-when-questioner-posts-email-address-for-responses i.e. OK in profile, but not in questions and answers.  I don't think it should be OK in comments either but I have not yet seen that case covered anywhere.
Answer: As everyone else has said, you can post your email if you want, but its a good idea to take precautions.
However, if you're asking if you can post your email and request users to email you directly rather than go through the answer system, then no. Your email address will be removed and you'll likely get comments about how bypassing the Q&A system defeats the purpose of the website. Answers should be posted on the site for the benefit of everyone, private help is usually discouraged.
Answer: It's never safe to publish your email address on an open web site.  If you want someone to get in touch set up a new temporary address and use that until you're sure you can trust them.  Even if the people on the site are trustworthy there are people out there harvesting every publicly available email address and selling them to the spammers and mass marketers.
Comment: Your email provider probably does the same thing, too.
Answer: If you really want to give out your e-mail you can either in a question, answer or better still in your profile.
However, it will be publicly visible and readable by spiders etc. so you might want to make it harder (but not impossible) to work out what it is.
Comment: Meh. Spam filters are remarkably good these days. My email address is everywhere... I use Google hosted mail, I get 500+ spams a day and maybe one every two weeks makes it past the filters. I don't even have to maintain them.
Answer: You can if you want to. You should probably keep yourself safe and try to obfuscate it in some way. Use something like myusername [at] whatever dot com instead of just saying email@example.com. It will at least keep the dumbest email scraping bots away.

Can I give out my e-mail here?


Trailing dots effect

Question: I am making a "Don't touch the spikes" remake in unity C#.
I want to make the effect of the dots behind the bird like in the image below. How can I do this?
Comment: Have you used particle system?
Comment: Look into Unity's particle system.  This is a very trivial thing to add to your game.  Add a Particle Component, and play around with it.
Comment: M totally agree with Jon as he said that particle system is a very trivial thing. So you will have to find some documentation and tutorials for that then you can sort out your problem. Best Luck
Answer: Unity has a readily available Trail Renderer. That's all you need.
The Trail Renderer is used to make trails behind objects in the scene as they move about.
From the source:

The Trail Renderer is great for a trail behind a projectile, or
  contrails from the tip of a plane's wings. It is good when trying to
  add a general feeling of speed.
When using a Trail Renderer, no other renderers on the GameObject are used. It is best to create an empty GameObject, and attach a Trail
  Renderer as the only renderer. You can then parent the Trail Renderer
  to whatever object you would like it to follow.

In other words, it is best to create a child object and add TrailRenderer component to it instead of adding directly to the main game object.
Answer: You will need to create a particle prefab with the small circles as the image that get more transparent and smaller as they travel away. There's quite a lot more to it than that but to go into I feel would take an extremely long answer. Maybe when I get home and can take screenshots but there are a lot of tutorials on the particle  system that would probably do a better job than me

Trailing dots effect


Is it possible to hear a nuclear blast first from the ground, and afterwards through air?

Question: Since a mechanical wave travels faster in the solid, and if you were able to put your ear on the ground, on the same surface that the bomb hit, would you hear the shockwave first from the ground?
Does the air in between the soil particles ''absorb'' or ''delay'' the shockwave?
I know that the composition of the soil is not that uniform and that might oblige us to make approximations.
I tried making some research on google and couldn't find anything about it.
I hope I was clear enough, I'm from Brazil, so my English is not the best.
Comment: *Since a mechanical wave travels faster in a denser medium* This is not true. All other things being equal, a mechanical wave travels more *slowly* in a denser medium. The speed depends on both density and stiffness.
Comment: Much of the energy released is in the form of photons, which travel faster than sound. There is then a complex interaction of the photons and the medium to consider.
Comment: Thanks, Ben, I'm going to edit the question.
Comment: Earthquake waves travel at >10x the speed of sound in hard rock https://en.wikipedia.org/wiki/Seismic_wave
Comment: Do you want to know about actual "shock waves" (i.e. propagating faster than the speed of sound) or just mechanical waves in general?
Comment: Related:  https://physics.stackexchange.com/q/282912/59023
Answer: It is possible- in fact, high-speed photographs of atomic bomb blast tests close to the ground clearly show that the sound wave travels faster through the ground than through the air, at least during the first fraction of a second after the bomb explodes. This presented a significant problem for blast photography because this "precursor effect" would kick dust into the lenses of the cameras close to the blast point while they were supposed to be filming the initial phases of the fireball expansion.
Now, as to whether or not you would hear this effect, to be close enough to the blast to do so would also mean you would die.
During the second world war, soldiers near the beach would hear the sound of a cannon (on a distant ship that was firing at a target on the land) emerging from the water before hearing it through the air, because the speed of sound through the water path was quite a bit faster than that through the air.
Comment: A shock wave may be somewhat of a special case, since it specifically involves a supersonic wavefront.
Comment: Related to heartquake bangs, too.
Comment: @Alchimista- "Heartquake bangs"? please explain... -NN


Software-Center Error

Question: Software center does not work for me. How to fix this problem? I cant reinstall, remove, uninstall software center...
And here is a log from terminal.
derianfox@hp-dv6:~$ sudo apt-get autoremove [sudo] password for
derianfox:  Reading package lists... Done Building dependency tree
Reading state information... Done 0 upgraded, 0 newly installed, 0 to
remove and 0 not upgraded. 3 not fully installed or removed. After
this operation, 0 B of additional disk space will be used. Setting up
gconf2 (3.2.6-0ubuntu2) ... /var/lib/dpkg/info/gconf2.postinst: 81:
/var/lib/dpkg/info/gconf2.postinst: gconf-schemas: not found dpkg:
error processing package gconf2 (--configure):  subprocess installed
post-installation script returned error exit status 127 Setting up
software-center-aptdaemon-plugins (0.1.6build1) ...
/var/lib/dpkg/info/software-center-aptdaemon-plugins.postinst: 6:
/var/lib/dpkg/info/software-center-aptdaemon-plugins.postinst:
pycompile: not found dpkg: error processing package
software-center-aptdaemon-plugins (--configure):  subprocess installed
post-installation script returned error exit status 127 dpkg:
dependency problems prevent configuration of software-center:
software-center depends on software-center-aptdaemon-plugins; however:
Package software-center-aptdaemon-plugins is not configured yet. dpkg:
error processing package software-center (--configure):  dependency
problems - leaving unconfigured No apport report written because the
error message indicates its a followup error from a previous failure.
Errors were encountered while processing:  gconf2  software-center-aptdaemon-plugins  software-center
E:Sub-process /usr/bin/dpkg returned an error code (1)

Answer: Found solution.
sudo apt-get -m --reinstall install python python-minimal dh-python
sudo apt-get -f install

then:
sudo apt-get remove software-center
sudo apt-get update
sudo apt-get install software-center

Software-Center Error


How are corporate training different from college education

Question: As said in the title, my question is how corporate training is different from college education. Does it have major differences? I think both way we learn the same things.
Comment: I think that you need to get more specific in what your problem is, if you want a useful answer.
Comment: @JoeStrazzere >>training my company will provide for me to help me do my job better

Yes
Comment: Yes, that's my question
Comment: The cynical me says: corporations don't want to train anyone. They want people to be able to do the job immediately.
Answer: College training, you will find, focuses on building the base skills of a trade, and broadening your understanding of that trade so that you will be prepared to apply it in any way a company requires.
Corporate training is practically the opposite - when you are hired for a position, a corporation will want to hone your skills in a specific area, so that you can focus on solving their problems for that area.
The area that they will have you hone in on depends on the field you are in - if you're a programmer, it could be a specific coding language or a specific application you are expected to maintain.  If you are in marketing, you may be trained in providing presentations and reports.
Basically, college training provides you a broad base of knowledge, but in the corporate world, your on-the-job training is to focus that knowledge and produce finished work.
Note: This is different than job training that you may get outside of regular work - often corporations that want to help their employees fill knowledge gaps will send their employees to job training, and at these training sessions you will be expected to learn a broad variety of ways to apply a particular skill, but, that skill will likely still be focused on the job you're expected to do when you return from training.
Answer: Your college education is about what you want - you choose your major and even within a major, you have some freedom to choose the courses you want to take.
Corporate training is about what THEY want from you and what THEY need from you to be of better use to them. In other words, they train you to fill their needs and your happiness/sense of fulfillment either in life or on the job is certainly not a priority let alone a consideration in their Weltanshaung (world outlook)
In addition, corporate training is typically very focused on immediate benefits to the organization and very narrow in scope. Basically, they want you to go out there and just get the task done.
Answer: Corporate or corporate deposited training is very specific to your job function, or anticipated function (an upcoming upgrade or new application to support etc...). You come away with skills you can use right away.
College is a foundation - in many cases you learn "how to learn", and other "soft skills" like time management... Many people wind up in careers unrelated to their degree.  I was a Computer Science major, and a bunch of us approached the dept. head(s) to suggest they change the intro level programming language to one that was actually in wide use; that way we'd get the theory as well as the practical knowledge.  The dean responded, "This is an institute of higher learning, we don't teach practical skills; you're to learn those after you graduate".
Answer: In my experience at both IT and non-IT employers, a major difference between corporate training and a university education is that students in corporate training programs are expected to pass.
Many university programs have so-called "weeder" courses designed to filter out those who "don't have what it takes" to move on, and many non-"weeder" courses also require sustained effort as well as some level of innate ability and background knowledge (often obtained in prerequisite courses, or previous levels of education). For example, to succeed in a graduate-level course on research methods, one must not only have some aptitude, but must also have a firm grounding in both basic statistics as well as the subject-matter of the field being studied (e.g. psychology, medicine, education, etc.). If you don't have these, you are very likely to fail.
Most of the corporate training courses that I have taken do have final exams, and some even have projects or homework. The difference is that the instructor sets things up so that it is essentially impossible to fail. If you seem to be struggling, the instructor will invite you for a "study session" in which they will essentially give you the answers so that you can move on and stop costing the company more training dollars. In fact, at the last training course I took, most of the class was actually spent studying the actual final exam, with only the question order changed, and we were explicitly told that this was the case. If this wasn't enough, we were told that we were allowed unlimited repeats of the final exam if, somehow, we still didn't pass after being told all of the answers in class.
Online training modules I have taken are also "gimme" courses, but in a slightly different way. The final exams (again, at multiple employers) are essentially basic reading comprehension exercises. If one of the exam questions is "Are employees permitted to foo the bar without the explicit permission of their supervisor?", the chances are 99%+ that somewhere in the course materials is the sentence "Employees are permitted to foo the bar without the explicit permission of their supervisor" or "Employees are not permitted to foo the bar without the explicit permission of their supervisor". There are no synthesis, higher-order thinking, or even logical reasoning questions like you often find in a university class - it is literally "snarf and barf" memorization all the way.
Abstract, creative, and original thinking is similarly rare in corporate training in my experience - they really only care that you know it is against the rules to foo the bar and that chemical safety gowns are kept in the red closet. They don't test whether you know what fooing the bar really is, where the exact borders are between fooing the bar, reticulating the spline, and reorienting the negative parallel matrix, why fooing the bar is wrong, how historians have explained the process of how fooing the bar evolved from a synthesis of the medieval practices of fish slapping, doofus dunking, and fork flinging by a group of 13th century Celtic monks, and especially not whether you can handle complex real-world cases where actually going ahead and fooing the bar might actually be the most rational choice because you live in the real world where most things are gray, not black and white.
Think about it this way:

Corporate training: Fooing the bar is allowed only if you have obtained permission from your supervisor and are wearing a chemical safety gown. Answer the following question: "What are the two requirements that you must meet before you may foo the bar?"
Undergraduate course: Fooing the bar is the process by which a bar is prepared for retransmogrification. Chemical safety gowns are typically worn during this process to protect against blowback. Complete the exercise on Page 10 of your lab manual.
Graduate school: Recall yesterday's reading in which you learned about how best practices in fooing the bar evolved side-by-side with advances in chemical safety gown technology. Today we will be discussing Dood (1984)'s Five Layer Theoretical Model of Bar Fooing. Propose a methodology by which you can use this model to predict the effectiveness of chemical safety gowns at each stage. In your paper, clearly define and explain the terms "chemical", "safety", "stage", and "the". Quantify your result.
PhD candidacy: Tell me something I don't know about fooing the bar.
Answer: Depending on the specifics, there can be some similarities and some big differences:
Some courses I took in university could be passed by someone taking the old exams and using those to get a passing grade. In this case, the person never had to go to the lectures given or read the textbook. The exams were multiple choice which can be quite different from a corporate environment where you don't have only 4 possible choices before you to consider in how to get something done. How well does someone have to know the material after the final exam would be another way to see this.
Some corporate training may not have an exam as it may be about being present to hear the company's harassment policy or have some other orientation that may be viewed as training or on-boarding. All of my undergraduate university courses had a final exam in contrast.
Some corporate training may be outside of regular working hours that isn't necessarily the case of university courses that generally follow a schedule. I can remember going to the office on a Saturday morning to learn about ITIL and how my employer was going to bring that into the organization with this specific tool that was to be used in this way.
Answer: corporate training is current, college education not so much.
corporate training courses change every day to keep up with standards and new things that someone needs to learn.
college education although current, may lack the On going new processes that are happening out there.
That's why a 3 week corporate training course cost more than a year at college.


Angle between pair of vectors from two planes at an angle mutually.

Question: Suppose I have 2 planes mutually at an angle to each other. Then two vectors, one from each, would make same angle between them. Is that so?
Answer: To ease the problem, assume that one of the planes ($P$) is $z=0$ and the hinge is $r:y=z=0$.
The equation of the plane that cuts $P$ at $r$ with an angle $\alpha$ is $Q:y\sin\alpha+z\cos\alpha=0$. We can assume that $0<\alpha\le\pi/2$.
Now, a generic vector in $P$ is $(u,v,0)$ and a generic vector of the same length in $Q$ is $(u,v\cos \alpha, v\sin\alpha)$, so the cosine of the acute angle $\beta$ between them is
$$\cos\beta=\frac{u^2+v^2\cos \alpha}{u^2+v^2}\ge\frac{u^2\cos\alpha+v^2\cos \alpha}{u^2+v^2}=\cos\alpha$$
So $\beta\le \alpha$.
That is, the acute angle between two vectors is at most the acute angle between two planes that contain them.
Comment: @Sufyan The correct sign is $\ge$. Note that $u^2\ge u^2\cos\alpha$ and that the cosine is *decreasing* from $0$ to $\pi/2$.
Comment: The two vectors that you've chosen aren't exactly "generic" since they have the same $x$-coordinate. Your summary at the end, while correct for such pairs, is incorrect in general.
Answer: If I've understood your question,
call the two planes you described plane A and plane B.
Then consider a vector in plane A, but that is also completely contained in the 'hinge line'.
Also consider a vector in plane B, but that is also completely contained in the 'hinge line'.
Clearly these two vectors do not have an angle between them of 30 degrees.
Answer: The (acute) angle between pairs of vectors can be anything from $0$ to $180°$. Consider a pair of vectors that are both in the hinge—pointing in the same direction along the line of intersection of the two planes. Clearly, the angle between them is zero. Now, rotate one of these vectors in its plane. The angle between them will change continuously until it reaches a maximum of $180°$ when the vector is back in the hinge, but pointing in the opposite direction.
Comment: Unfortunately, ajotatxe didn't consider all possibilities. He only looked at pairs of vectors with the same $x$-coordinate, for which the dihedral angle is indeed maximal. Now that you mention it, however, the acute angle between a pair of vectors at the hinge can be *anything*. I've modified my answer accordingly.
Comment: @SufyanNaeem You'll have to tell me what "the plane of field" and "the plane of motion" mean in this context. The force, as you know, is proportional to the cross product of $\mathbf B$ and $\mathbf{\dot r}$, so perhaps the text is referring to planes for which these two vectors are normals?
Comment: @SufyanNaeem The force is always perpendicular to both the velocity and $\mathbf B$. If $\mathbf B$ is perpendicular to the page, then the resulting force will always be parallel to the page. Being perpendicular to $\mathbf{\dot r}$, the force is a pure deflection, but the particle is only going to move along a circular arc if $\mathbf B$ is constant. (Well, there is an "infinitesimal" circle in general, but I'm not going to go there. :))
Comment: Is your argument not contrary to what ajotatxe said in last. He says the acute angle between vectors $\beta$ can be no more than the acute angle between planes $\alpha$ but it may be equal or smaller. Or maybe you are telling something different and I am mixing it because I haven't got it yet?
Comment: Actually my book tells me that the magnetic force on a charge moving with velocity v in a magnetic field B is given by, $F_B = |q|vB\sin{\theta}$ and it further says that $\theta$ is the angle between the plane of field and the plane of motion. However as far as I know, $\theta$ is the angle between directions of velocity and magnetic field and not their planes. Now I suppose, or maybe I am sure that my book is wrong. If you know something to tell me, I would be really grateful. I could ask this on Phy.SE but I think the sentence in book is mathematically wrong so I should ask this here first.


How to set up bidirectional replication with Postgresql

Question: I have two Linux servers having Postgresql-10 on each of them. On both of them, there is a database, say dbexample, having same schema, table, everything. Both of them are capturing data from an application and storing them on their database (dbexample).Let me tell you since both are capturing data from the same application, there is no mismatch in data at a time.
Now, what is my problem? At a time server 'A' fails due to any reason. That moment it is not able to capture data from the application. But since second is UP and have captured all the data on its database, it must have captured all the data for that time being when server A was DOWN.
Now, When Server A is UP I want all the data to be replicated on this server A from server B for that time, so that I can have all the data same on both the servers.
Considering the same scenario in case of failure of server B, I want the things to work in the opposite direction, i.e. data from Server A to be replicated to Server B.
I have gone through many tutorials and have come-up with below solutions:

To set Logical replication between both servers and make Publisher and Subscriber of each other. (But that is possible one way not bidirectional, if I am not wrong). So please suggest what could be the possible solution.
To arrange a server C and restore the schema only of database, and make Server A publisher and Server C its subscriber. Server C publisher and Server B its subscriber. Server B Publisher and Server A its subscriber. It will be like:-

A will pull data from B,
B will pull data from C, and
C will pull data from A.
Is it feasible when A and B already have data in their databases?
Which approach is better, or is there any other solution?
Comment: You're looking for [bidirectional replication](https://wiki.postgresql.org/wiki/Multimaster), also known as multimaster.
Comment: I have read bidirectional replication also, but didn't get how to apply that in this case.
Answer: You don't need bidirectional replication and its additional complexity.
Simply use standard replication, and setup B as a standby for A.
If A fails, let B take over as master, and then reconfigure A as standby for B, possibly using pg_rewind to do this.
Repeat as necessary should either node fail.
Comment: Thanks for your response. Let me check how pg_rewind works.