Does matter turning into energy, or vice versa, violate the Law of Conservation?

Question: I'm new to physics. And I have curiously wondering about the relationship between matter and energy. From what I understand, one can create the other, but is it truly creating or just aiding in the process?
Comment: What scale are you interested in, and how close to the truth do you want to get?  For normal human-scale activities, conservation is the law.  For very big (galactic complex scale) or very small (quantum mechanical), they get a little bit fluid and require a bit more math to wrap our heads around.
Answer: Matter can definitely be created without violating conservation of energy. All massive particles (e.g electrons, quarks, etc) have a minimum energy called their rest energy, which is given by $E=mc^2$. This energy is stored as the mass of the particle. A particle can be created as long as there is energy at least equal to its rest energy, so that energy is conserved, and all other conservation laws are obeyed (e.g momentum, charge, lepton number, etc). Matter can also be destroyed to release energy. The rest energy of the particles is released and photons are produced when a particle meets its antiparticle. The energy of the photons is equal to the combined rest energy and kinetic energy of the particle and antiparticle, so energy is conserved.
Comment: No, there is no law of conservation of matter. Baryon number and lepton numbers are conserved but because antibaryons have baryon number of -1 and antileptons have lepton number -1, creating or destroying a particle-antiparticle pair does not violate these conservation laws.
Comment: What about in regards to conserving matter itself? I'm guessing the particle distribution counts for conservation?


Lie brackets of automorphisms

Question: Let $F$ be the vector fields of a differential manifold $M$, let $[X,Y]$ be the Lie brackets of $F$, now let $a$ be an automorphism of $F$ for the structure of real vector space of $F$. I consider now the bracket: $$[X,Y]_a= a^{-1}[a(X),a(Y)]$$ A simple calculus shows that it satisfies the Jacobi identities, so $(F,[,]_a)$ is a new Lie algebra. My question is: when does this new Lie bracket come from the vector fields of a manifold $M_a$? For example, if I take $a=g_*$, with $g$ a diffeomorphism of $M$, I could say that $M_{g_*}=M$. Perhaps that a condition of a certain smoothness could be added for the automorphism $a$?
Answer: By Purcell and Shanks [Shanks, M.E., Pursell, L.E.: The Lie algebra of a smooth manifold. Proc. Amer. Soc. 5, 468-472 (1954)] the algebraic structure of the Lie algebra of smooth vector fields on a smooth manifold uniquely determines the manifold. Namely, a maximal ideal is exactly the set of vector fields which vanish to infinite order at some point, in the $C^\infty$ and compact case.
So for $(F,[\;,\;]_a)$ you can construct a manifold structure on the space of maximal ideals, and then $a = f^*$ for a diffeomorphism between the original manifold and the new one.
See also the remarkable paper
[J. Grabowski: Isomorphisms and Ideals of the Lie Algebras of Vector Fields,
 Inventiones math. 50, 13-33 (1978)]
which extends this to the Lie algebras of real analytic and holomorphic vector fields and the non-compact case.
Added:
For Poisson brackets see the paper
[MR0438390 (55 #11304a)
Kirillov, A. A.
Local Lie algebras. (Russian)
Uspehi Mat. Nauk 31 (1976), no. 4(190), 57–76.
58F05 (17B65) ] and papers citing this paper.
Comment: Perhaps, my automorphism $a$ is not smooth; for example I can take a vector field $X$ and define: $a(X)=-X$ and $a(Y)=Y$ otherwise with a choice of a basis of $F$. It doesn't seem to come from any diffeomorphism or manifold.
Comment: The two manifolds $M$ and $M_a$ are perhaps not diffeomorphic if $a$ doesn't exchange the maximal ideals? $a$ is not an isomorphism of Lie algebras.
Comment: I apologize, $a$ is an isomorphism of Lie algebras between $(F,[,])$ and $(F,[,]_a)$. Also, all is well defined.
Comment: Another question: is it also the case if we take the Poisson brackets $\{ f,g \}= \omega (df,dg) $ of functions over a symplectic manifold? The maximal ideals are the points too?

Lie brackets of automorphisms


details of MESI protocol for multicore processors

Question: The details of the MESI protocol for multicore processors would be really important for me, but I can't find them anywhere. Even http://www.intel.com/content/dam/doc/manual/64-ia-32-architectures-software-developer-vol-3a-part-1-manual.pdf doesn't contain enough detail. For instance: assume a private L1 and shared L2 cache. If the state of a line is exclusive in L1, then is it exclusive in L2 too (or invalid, because only in one cache could be the state of a line exclusive)? And clearly, if another core writes this line, the state of the previously exclusive line in L1 becomes invalid, but how is changing the state of the L2 cache line? If a modified line in L1 is read by another core, will be the new state of that line shared and is it written back to the main memory through the L2 cache, or stay modified in L2 too? etc.
Comment: I have a similar question. I Can't seem to find Details too.
Comment: similar question with an accepted answer can be found [Here](http://stackoverflow.com/a/8006202/403279)
Answer: The reason you are having trouble finding these answers is because the traditional protocols were not defined for hierarchical cache architectures so the MESI protocol by itself doesn't define what will happen when you have an L1 and  an L2 cache. It depends on three other system attributes.
If the L2 is designed to be exclusive of the L1 (i.e., it is guaranteed that L2 and L1 can never have common cache lines), then any line in the L1 will be invalid state (basically not present) in the L2.
If the L2 is inclusive of the L1, i.e., every line in the L1 must have an entry in the L2 as well, the entry in the L2 will contain a descriptor stating which L1 cache has the line in E state.
Whether or not the value is written out to L2 or memory on a read from E or W stage depends on whether your system supports cache-to-cache transfers or not. In old day, when each chip was a single core, and core-to-core communication was as expensive as read/write to memory, systems would write the data to memory and make the other processor read it (this allowed them to not support cache-to-cache transfers). In multi-core, talking via memory is insanely expensive compared to talking to other cores on-chip, so almost all multi-core chips today support cache-to-cache transfer. Thus, a read from E or W stage is not serviced by writing to memory.
I hope this helps.
Answer: I found this. It might help.
Third comment here might also be useful.


Creating dataset by scraping YouTube?

Question: I'm trying to build a large dataset of images for training a machine learning model. My idea is to generate these images by grabbing frames off YouTube videos. My question: would this violate copyright laws if the frame comes from, say, a movie? Would I be safe to openly distribute this dataset for other researchers?
Comment: Have you read YouTube's policies about botscraping and research use? Why are you asking the internet at large when the actual company is right there to email and call?
Comment: It depends in large part on your jurisdiction, so I think you should include that information. Even then, I'm not sure if this would be on topic here; if it's not, it might fit on [law.se] or [opensource.se].
Comment: Doesn't Google "botscrape" the entire internet (this very stack exchange post included) constantly so it knows what information exists where? That's exactly what I'm trying to do: look at the content offered by YouTube so I can learn something from it.
Comment: In addition to copyright questions and Terms of Service questions (which, regardless of what Google does, merit attention), there are additional ethical questions to consider. [This article](https://www.theverge.com/platform/amp/2017/8/22/16180080/transgender-youtubers-ai-facial-recognition-dataset) is a good example of ethical implications of use of public data for research. I also recommend reading the [Association of Internet Researcher's 2012 ethics statement](https://aoir.org/reports/ethics2.pdf).
Comment: @rodrigo-silveira and they can afford the lawyers when there is a dispute, which you cannot
Answer: According to this: http://tubularinsights.com/youtube-copyright-ownership/
People / Entities / Conglomerates still retain at least some rights to their own videos most of the time.
So yes, if you come across any licensed material, for eg. grabbing frames from videos of movies etc without seeking permission first and the original owners find out, then you could get into trouble.
You could handpick videos / create playlists that you want to scrape making sure that their content is not commercially licensed or is used with permission of the original creators (I think you typically do this with the publication that follows / describes your dataset, if you choose to do that)
Comment: Many YouTube videos are Creative Commons-licensed, and even though these licenses typically don't require asking permission, there is nearly always an attribution component that's required. If the images were just being used for an internal research project, I'm not sure how that would play out, but best practice would suggest that credit should be given to the creator of each video.

Creating dataset by scraping YouTube?


Conditional convergence for improper Riemann double integrals

Question: I'm reading Buck's advanced calculus. It says for improper integral of higher dimensions, conditional convergence is impossible, i.e., $\int\int_D f$ cannot exist without $\int\int_D|f|$ existing too.
Then book only gives a sketch of proof as follow.
Let $f_1=(|f|+f)/2$ and $f_2=(|f|-f)/2$. We may assume that the integrals $\int\int_Df_i$ are each divergent. Since $f_1f_2=0$, so that the sets where $f_1$ and $f_2$ are positive are disjoint. It is then possible to choose an expanding sequence of closed rectangles $\{D_n\}$ which favour $f_1$ over $f_2$, so that $\int\int_{D_n} f_1$ diverges faster than $\int\int_{D_n} f_2$, with the result that $\int\int_{D_n} f$, which is their different, also diverge.
But it feels like a almost exactly same proof can be used to show that single improper integral can not be conditional convergent too, but single integral can be convergent without being absolute convergent. For example, $\int^\infty_1 x^{-1}\sin x$ is conditional convergent but not absolutely convergent.
So what is the essential difference between single integral and double integral which makes the conditional convergence for double integral impossible? Thanks.
Answer: I don't know whether it is always possible to choose such a sequence of rectangles $D_n$.
In my view the difference with the one-dimensional situation is the following: For integrals $\int_0^\infty$ there is just one reasonable way to pass to the limit, namely looking at $\lim_{b\to\infty}\int_0^b$. The improper integral then is equal to this limit. But already for integrals $\int_{-\infty}^\infty$ there is the question whether you should consider the limit $\lim_{N\to\infty}\int_{-N}^N$ (sometimes called principal value) or the two independent variables limit
$\lim_{a\to-\infty, \>b\to\infty}\int_a^b$.
Now in the multivariable case there are infinitely many ways to define increasing sequences $(A_n)_{n\geq0}$ of subsets that exhaust ${\mathbb R}^2$, and depending on the case you may obtain different limits $\lim_{n\to\infty}\int_{A_n}$. Of course you could say: I definitely consider only principal values, where the integral is over balls $B_r\subset{\mathbb R}^2$. In such a setting you could obtain convergent improper integrals for certain functions with divergent $\int_{{\mathbb R}^2}|f(x,y)|\>{\rm d}(x,y)$. This might be fine in geometric settings, but is of no value when the variables $x$, $y$ are of different semantical types.
To sum it up:  In ${\mathbb R}^d$, $\>d\geq2$,  there is no single "canonical" type of exhausting space in order to define a "universal" improper integral. In the Lebesgue world one requires (also in the one-dimensional case) that $\int_{{\mathbb R}^d}|f(x)|\>{\rm d}(x)$ is finite.
Answer: Suppose $f : D \subset \mathbb{R}^d \to \mathbb{R}$ is Riemann integrable on every compact rectifiable subset of $D$. The  multiple improper integral is defined generally as
$$\int_D f = \lim_{n \to \infty} \int_{D_n}f,$$
where $(D_n)$ is a sequence of compact rectifiable sets such that $D_n \subset \text{int  } D_{n+1}$ and $\cup_{n=1}^\infty D_n = D$. The improper integral is well-defined if the limit does not depend on the choice for $(D_n)$.
Under such a definition, it must hold that the improper integral of $f$ over $D$ exists if and only if the improper integral of $|f|$ exists over $D$.
In one-dimension ($d = 1$), the improper integral can be conditionally convergent when defined specifically as a limit of integrals over nested intervals , such as $D_n = [0,n]$ where
$$\int_0^\infty \frac{\sin x}{x} \, dx := \lim_{n \to \infty}\int_0^n \frac{\sin x}{x} \, dx = \frac{\pi}{2}$$
However, even in one-dimension, the more general definition of the improper integral precludes conditional convergence.
For example, consider the  following sequence $D_n \subset [0,\infty)$ where each set is a finite union of intervals with gaps,
$$D_n = [0, (2n-1)\pi] \cup \bigcup_{k=n}^{2n}[2k\pi,(2k+1)\pi ]$$
It is easy to show that $D_n \subset D_{n+1}$ for all $n$.  Also, for any $c > 0$, there exists $n$ such that $(2n-1)\pi > c$ and $[0,c] \subset D_n$, and this implies $\cup_n D_n = [0,\infty)$.
The integral over $D_n$ is
$$\int_{D_n}\frac{\sin x }{x} \, dx = \int_0^{(2n-1)\pi }\frac{\sin x }{x} \, dx + \sum_{k=n}^{2n} \int_{2k \pi}^{(2k+1) \pi } \frac{\sin x} {x} \, dx,$$
which can be shown to converge to a value greater than $\pi/2 + \log 2 /\pi$.
The first integral on the right-hand side converges to $\pi/2$ and, since $\sin x \geqslant 0$ for $x \in [2k \pi,(2k+1) \pi ]$, it follows that
$$\int_{2k \pi}^{(2k+1) \pi } \frac{\sin x} {x} \, dx > \frac{1}{(2k+1)\pi }\int_{2k \pi}^{(2k+1) \pi } \sin x \, dx =  \frac{2}{(2k+1)\pi } > \frac{1}{\pi}\frac{1}{k+1}$$
Thus,
$$\limsup_{n \to \infty}\int_{D_n} \frac{\sin x }{x} \, dx > \frac{\pi}{2} +   \lim_{n \to \infty} \frac{1}{\pi} \sum_{k = n}^{2n}\frac{1}{k+1} =  \frac{\pi}{2}+ \frac{\log 2}{\pi}$$
There can be no unique value of the limit of the integral over $D_n$ for every choice of sequence $(D_n)$.
Comment: Thanks! It really makes things clear!
Comment: @Cathy: You're welcome.


Need help figure out a Fibonacci related math trick

Question: My math teacher used to do a trick where he would have a student write $2$ numbers on the board then add the first to the second to create the third then add the second to the third and so on until there were $10$ numbers. He would then turn around and add them up in $2$ seconds. How did he do this?
Comment: Have you tried a few simple cases to see the pattern?
Comment: have you heard of induction?
Comment: Check my answer, I think it is easy; the seventh number in the list multiplied by 11.
Answer: Hint:
$\begin{array}{rl} F(1) &= \color{blue}{F(3)}-F(2)\\
F(2)&= F(4)\color{blue}{-F(3)}\\
F(3)&=\color{red}{F(5)}-F(4)\\F(4)&=F(6)\color{red}{-F(5)}\\
\vdots\end{array}$

 $F(1)+F(2)+\dots+F(n) = F(n+2)-F(2)$
Answer: Try it algebraically starting with $a$ and $b$
\begin{eqnarray*}
a,b,a+b,a+2b,2a+3b,3a+5b,5a+8b, \\ 8a+13b,13a+21b,21a+34b.
\end{eqnarray*}
Now add these together and we get $55a+88b=11 (5a+8b)$.
So I guess your teacher took the first value multiplied by $5$ and added it to the second value multiplied by $8$ and then multiplied by $11$. Your teacher would have had plenty of time to do this calculation while then values were being added.
Comment: There's no need for the teacher to calculate $5a+8b$ - it's already written on the board!
Comment: Actually the teacher can calculate $5a+8b$ essentially faster than it will be written on the board, and have additional time to perform multiplication by $11$ (and check the answer twice).
Answer: That is because Fibonacci numbers have a number of properties, one of them being:
$$\sum_{i=0}^nF_i = F_{n+2} - 1 = 2F_n + F_{n-1} - 1$$
Proof is by induction
Hence, if the numbers are $0,1,1,2,3,5,8,13$, the sum will be $13*2 + 8 - 1 = 33$
Answer: Multiplying any natural number by $11$ is so easy, check here.
Now the solution for your problem is to multiply the $7^\text{th}$ number in the list by $11$

Have this example: our first two numbers are $16$ and $21$
So the list is:
$16$
$21$
$37$
$58$
$95$
$153$
$248$
$401$
$649$
$1050$
The sum of those numbers is just $248$ (which is the $7^\text{th}$ number) $\times 11=2728$.

The rule is: $\boxed{7^\text{th}\text{ number }\times 11}$
Answer: Well, to answer the question as to how he did it:  If the first number is $x$ and the second number is $y$ then every other number and the sum of all ten numbers will a combination of $x$ and $y$.  As you do the same thing every time the final sum will be the same combination.  Your teacher merely memorized that the final sum would be $55x + 88y$.
As to how we would know the final number is $55x+88y$ we can
1) Simply do it.  The ten numbers are $x,y,x+y, x+2y, 2x+3y, 3x+5y,5x+8y,8x+13y,13x+21y, 21x+34y$ and the sum is $55x+88y$.
2) Try to find a way  to generalize this without doing each sum.
We notice the number of $x$s involved are $1,0,1,1, 2,etc.$.  After a slow start once we have $1,1$ this has to follow the Fibonacci sequence.  So if the $k$th number is $a_k x + b_k y$ we know $a_k= F_{k-2}$, the $k$th fibonacci number.
We notice the number of $y$s involved are $0,1,1,2, etc.$ and those are the Fibonacci numbers too but with a quicker start.  $b_k = F_{k-1}$.
So the $k$th number is $F_{k-2}x + F_{k-1}y$.
The final total after ten numbers is therefore $(1 +\sum_{k=1}^8 F_k)x + (\sum_{k=1}^9 F_k) y$.
There's an interesting formula that
$\sum_{k=1}^n F_k =  F_{n+2} - 1$.
So the sum is $F_{10}x + (F_{11}-1)y$
======
Another answer states that the answer is that the sum is the $7$th number times $11$.
So does $11(F_{5}x + F_{6}y) = F_{10}x + (F_{11} -1)y$?
Well, $11(F_5x + F_6y) = 11(5x + 8y)=55x + 88y = 55x + (89-1)y$.
The Fibonacci series is $1,1,2,3,5,8,13,21,34,55,89$ so,  yes, indeed this is true.
So that's actually how the teacher did it so quickly.  You wrote down the $7$th term and he multiplied it by $11$ in his head.
Comment: Thanks everyone!


Using Shared Memory in a Dynamic-Link Library in Visual C

Question: I'm trying to use the dll in the link below that allows for shared memory between different process. Though for some reason it's not compiling.
http://msdn.microsoft.com/en-us/library/ms686958%28v=vs.85%29.aspx
First I have the dll compiled as written as a .lib. Then I create a new source file with the exact code as in the parent process. Just compiling I get the error
"Warning: empty declaration, syntax error found string constant expecting ;,unrecognized declaration"

for the line:
extern "C" VOID __cdecl SetSharedMem(LPWSTR lpszBuf)

what does this mean?
Answer: extern "C" VOID __cdecl SetSharedMem(LPWSTR lpszBuf);
                                                   ^^^

It seems You have Missed the semicolon while copy pasting it.


What is the angularjs way to databind many inputs?

Question: I'm learning angularjs and I want to be able let the user enter many inputs. When these inputs are entered the list array elements should change accordingly. I wanted to try using ngRepeat directive but I read that since it creates a new scope I cannot databind:

    Input {{$index+1}}:
    <input ng-model="item" type="text"/>

I was wondering if I should be using a custom directive to do this or approach it differently.
Comment: If one input box would work, with each item separated by some delimiter, see ngList. http://docs.angularjs.org/api/ng.directive:ngList
Comment: Although it is not intuitive for what I am currently developing, It's good to know angular has this feature as a directive that I may use in the future. Thanks!
Answer: The reason that databinding to a primitive "item" doesn't work is because of the way ng-repeat creates the child scopes for each item.  For each item, ng-repeat has the new child scope prototypically inherit from the parent scope (see dashed lines in picture below), and then it assigns the item's value to a new property on the child scope (red items in picture below).  The name of the new property is the loop variable's name.  From the ng-repeat source code:
childScope = scope.$new();
...
childScope[valueIdent] = value;

If item is a primitive, the new child scope property is essentially assigned a copy of the primitive's value.  This child scope property is not visible to the parent scope, and changes you make to the input field are stored in this child scope property. E.g., suppose we have in the parent scope
$scope.list = [ 'value 1', 'value 2', 'value 3' ];

And in the HTML:

Then, the first child scope would have the following item property, with a primitive value (value 1):
item: "value 1"

Because of the ng-model databinding, changes you make to the form's input field are stored in that child scope property.
You can verify this by logging the child scope to the console.  Add to your HTML, inside the ng-repeat:
show scope

Add to your controller:
$scope.showScope = function(e) {
    console.log(angular.element(e.srcElement).scope());
}

With @Gloopy's approach, each child scope still gets a new "item" property, but because list is now an array of objects, childScope[valueIdent] = value; results in the item property's value being set to a reference to one of the array objects (not a copy).

Using the showScope() technique, you'll see that the child scope item property's value references one of the array objects -- it is no longer a primitive value.
See also don't bind to primitives in ng-repeat child scopes and
What are the nuances of scope prototypal / prototypical inheritance in AngularJS? (which contains pictures of what the scopes look like when using ng-repeat).
Comment: @abbood, [tag:GraphViz].
Comment: hey man what software did you use to render the diagrams above?
Answer: You'll have better luck if your list is an array of objects (as opposed to an array of primitives). This works fine even though a new scope is created with ng-repeat:

    Input {{$index+1}}:
    <input ng-model="item.value" type="text"/>

with a controller of:
function TestController($scope) {
    $scope.list = [ { value: 'value 1' }, { value: 'value 2' }, { value: 'value 3' } ];
}

See this fiddle as an example.
On the other hand if you are trying to bind to an array of strings the new scope will cause a problem as the values you are modifying will not be tied to the original array string primitives (as in this fiddle example).
Answer: I found an interesting way of doing this, and it's allowing me to work on an array of primitives.
I'm using AngularJS 1.2.1, which is the only version I can make this work in.
HTML:

    Input {{$index+1}}:
    <input ng-model="item" type="text" ng-blur="editItem($index, item)"/>

JavaScript:
$scope.editItem = function(idx, eItem) {
    $scope.list[idx] = eItem;
};

Link:
http://jsfiddle.net/bxD2P/10/ (thank you to Gloopy for the starter Fiddle)
I'm sure there are easy ways of poking holes in how this works, and I would love to hear them. It would allow me to shore up my code.
Answer: Here's a way to do it.  I used textareas and a different structure to my repeaters, but the main concept is:

display a simple value based on index. (not bound)
on blur update the model
on model update re-render

It is essentially, faking the binding.
Working fiddle - http://jsfiddle.net/VvnWY/4/
The html:

    Here's a few strings:

{{strings[$index]}}

    Here's the strings as editable (twice so that you can see the updates from a model change):

    <form-textareas strings="strings"></form-textareas>
    <form-textareas strings="strings"></form-textareas>

The JS:
var myApp = angular.module('myApp',[]);
angular.module('myApp', [])
  .controller('MyCtrl', ['$scope', function($scope) {
    $scope.strings = [ "foo", "bar", "cow" ];
   }])
  .directive('formTextareas', function() {
    return {
        restrict: "E",
        scope: {
            strings: '='
        },
        templateUrl: "textareas.html",
        link: function( $scope ){
            $scope.blur = function( $event, $index ){
                $scope.strings[ $index ] = $event.currentTarget.value;
            };
        }
    };
  })
;

Answer: Consider using the ngList directive https://docs.angularjs.org/api/ng/directive/ngList


Conversion issue in dtsx package

Question: I have a dtsx package that does a data conversion task and import into SQL Server 2008 R2 database.  I am having an inconsistent problem with a user, and since I am unable to change their behavior, I would like to avoid the problem.  I have a column in an Excel worksheet that is created by the client.  The column is a comment field.  On a number of occasions, they have chosen to simply enter a numeric or currency value into the comment cell.  I have suggested that they use their words but my requests have not been well received.  What I need to do is have the package disregard what it is seeing and treat it as a string field regardless.  When I have a normal string in the cell, the system operates as expected.  I have tried doing a conversion to an unicode string(DT_WSTR), unicode text stream (DT_NEXT) and string (DT_STR).
If there is additional information I should provide I would appreciate knowing and I will endeavor to get it.
This is the first time I have done a dtsx package for this purpose, I have done mostly moves and deletes up to this point.
Comment: have you tried using IMEX in your connect string - look up IMEX and Excel and you'll find lots of examples. Forget about tying to change business process or trying to get Excel data clean.
Answer: In the Excel Source Data Source, I would change the Data access mode to SQL Command.  Then I would write a SELECT statement using CStr ( dodgy_comment) AS comment etc.  Note that column names need to be enclosed in back-quotes `.

Conversion issue in dtsx package


Insinkerator Hot Water Heater vent problem

Question: The vent tube on my white (latest model?) Insinkerator keeps detaching (blowing off under pressure?) causing leakage inside the cabinet.  Is the problem likely to lie in the faucet/tap or the heater itself.  Would it be safe to clamp the 1/8" tube to the heater to prevent it detaching itself from the top of the Heater?
Answer: There should be no pressure in a vent tube. so it should not blow off.
Find and correct the blockage in the vent path.


temperature and pressure relieve valve

Question: I had a plumber replace my T & P valve on a 08' 50gal. American water heater. It kept discharging water practically every other day. He replaced the T & P valve and water started relieving again 2 hours after the plumber left. Not much, but enough to indicate a problem still exists. What other troubleshooting solution is there, short of replacing the water heater. Should I just replace my water heater?
Comment: Is this a gas or an electric heater?  And what is its model number?
Comment: See if this might apply to your situation, and/or describe your plumbing in more detail. If you just asked the plumber to **replace the T&P valve**, I suppose he gets a pass, but you could certainly call and mention that it's leaking 2-hours later. If you asked the plumber to **fix the leak**, he should have seen this if it applies, and deal with it in any case if it leaks right after he worked on it. http://diy.stackexchange.com/questions/61103/why-would-a-gas-water-heater-discharge-water-in-the-winter/61126#61126
Comment: Is there large use of hot water on an "every other day" basis that would track with the releases? If it's an expansion issue, I'd expect a day of heavy hot water use to be followed by water release when the large amount of cold water (that refiled the heater as hot was drawn out) was heated up, and nothing was using water in the house.
Answer: There are four reasons a temperature and pressure valve will release water.
The valve was physically opened
If you; or somebody else, opens the valve, it will obviously release water.
Since you didn't mention holding the valve open, I'll assume that's not the problem.
Bad valve
If the valve is bad, or junk is stuck in it, it can cause water to be released.
Since a plumber just replaced it, I'd guess this is not the problem either.
Pressure is too high
When water is heated, it expands. This expanding water increases the pressure in the closed plumbing system. If the pressure gets to high, the valve will open to release some of the pressure.
You'll have to put a gauge on the system to determine if this is the problem.
Temperature too high
If the temperature of the water in the tank gets too hot, the valve will open to release some of the overheated water.
Again, you'll have to put a gauge on the tank to find out if this is the problem.

Since it sounds like it's only a small about of water, I'd lean towards high pressure.
To verify this, you'll want to connect a pressure gauge that can remember the maximum reading to the system. Then use the system as normal, checking the gauge from time to time.
Once you determine tha actual cause, then you can start looking for a cure.

temperature and pressure relieve valve


Hahn-Banach theorem for arbitrary locally compact fields?

Question: Does anyone know if the Hahn-Banach theorem is true for every locally
compact field?  Specifically, let $F$ be a finite algebraic extension of
either $Q_p$, the $p$-adic completion of $Q$, or of
$S_p$, the $t$-adic completion of $F_p\{t\}$, the field of
formal Laurent series over the field of $p$ elements.  Then is $F$
injective with respect to topological embeddings in the category of
normed linear $F$-spaces?
Answer: There exists a $p$-adic Hahn Banach theorem.
Reference Alain M. Robert. A course in p-adic analysis. Graduate text in Math.
Theorem (Ingleton)
Let $K$ be a spherically complete ultrametric field. $E$ a $K$-normed space and $V$ a subspace of $E$. For every bounded linear functional $\phi$ defined on $V$, there exists a bounded linear functional $\psi$ defined on $E$ whose restriction to $V$ is $\phi$ and such that $\|\phi\|=\|\psi\|$.
Comment: For those readers who do not have immediate access to that text, could you please state the theorem as given in the text?
Comment: I know what a complete ultrametric field is (and my fields are), but i have never seen the phrase "spherically complete" before.  If my fields are that, then this answers my question completely.  Never mind, I just googled it and, since the balls are compact, the result follows.  Thanks.
Comment: https://en.wikipedia.org/wiki/Spherically_complete_field


Check-in Luggage

Question: I will be travelling soon from Delhi to Washington DC with a 3 day stay in Dubai. I don't want my checked in luggage during my stay at Dubai, can I check in the luggage from Delhi to Washington DC even there is 3 day stay in Dubai?
Answer: No. The baggage system is not designed to store luggage for this period. You should arrange to store your bag in a left-luggage facility.
If you have concerns about customs controls for alcohol, pork, et c., there is a procedure whereby Dubai customs retains these items and return them to you when you leave the country again.
Answer: I would suggest to check with the Airline as some airlines (Ex. Emirates) does make arrangements as they are the official carrier of UAE an would most welcome any traveller to stay (as it's good for UAE's economy and promote tourism)

Check-in Luggage


Hide Technology Usage

Question: Just out of curiosity. Is it possible hiding technology usage from website profiler, e.g: w3techs.com or builtwith.com? Information to be hidden such as Content Management System, Server Side Programming Language, Web Server. If possible, any negative influences? Thank you.
Answer: Hide
To hide this, you have to change the standard behaviour of the plattform.
For magento e.g. you have to hide the js/varien/js.js (and all the other files)
You have to hide the images are loaded from /media, the assets are from /skin/frontend/package/theme/....
So I don'T think it is worth the time, to hide things.
Show
Maybe you can trick the crawler, add a wp-admin/wp-login.php (?), or any other Typo3, Joomla, etc. typical content.
Comment: Thanks Fabian for the idea. I added those things but still failed to trick the crawler. I doubt there is a way to achieve this.

Hide Technology Usage


Does the renal vein have a greater glucose concentration than the renal artery?

Question: My IGCSE markscheme says that the renal vein has a lower concentration of glucose? I would expect the renal artery to have lower glucose concentration as water is lost from the kidneys. Why is it so?
Comment: What is an "GCSE markscheme"? Can you add a quote of a few sentences to show the context?
Answer: The kidneys use glucose from the blood as a nutrient, so, this is the reasoning behind your source saying there is less glucose in the renal veins than in the arteries.
If the renal vein contains both less of water and glucose than the renal artery, the concentration of glucose in the renal vein still be lower. This agrees with Bioninja.com.au:

Blood in the renal vein (i.e. after the kidney) will have:

Less urea (large amounts of urea is removed via the nephrons to form urine)
Less water and solutes / ions (amount removed will depend on the hydration status of the individual)
Less glucose and oxygen (not eliminated, but used by the kidney to generate energy and fuel metabolic reactions)
More carbon dioxide (produced by the kidneys as a by-product of metabolic reactions)

On the other hand, an article in Scielo.br says:

Unlike the proximal nephron, cells in the distal nephron are fully
  capable of glucose utilization. In physiologic conditions, the amount
  of glucose utilized in the distal segments of the nephron equals that
  derived from the renal gluconeogenesis in proximal tubules. This is
  confirmed by the common finding that the arterial-renal vein blood
  glucose concentration difference in the post-absorptive state is near
  zero.

In conclusion, your source can still be right.


Where should I store a foreign key?

Question: If I have a relationship between two tables (both tables have their own primary keys) what should guide my decision as to which table should store the foreign key? I understand that the nature of the relationship probably matters (one-to-one, one-to-many, many-to-many, uni-directional, bi-directional), and probably access patterns matter too. What is a systematic way of making that decision though?
Comment: "What is a systematic way of making that decision?"  "understand that the nature of the relationship probably matters".  Correct.  The nature of the relationship matters.  I don't get the question.  Do you want to know how to define which is dependent on the other?
Comment: The [MySQL documentation of foreign keys](https://dev.mysql.com/doc/refman/5.5/en/create-table-foreign-keys.html#idm139680617903472) provides a simple example of the relationship between 2 parent tables: `customer`, `product` and one child table: `product_order`. In that example `product_order` is the child table which should contain the foreign keys.
Answer: Which table is the child in the relationship?
Answer that, and you know which table needs the foreign key column, referencing the parent's [typically] primary key.  That's for a one-to-many relationship...
A many-to-many would require you to add a third table, using the keys from both of the two tables as it's primary key.
Comment: Or it's a one-to-one relationship and OP should be asking himself why it's split into two tables in the first place.
Comment: ... and if there isn't a child / parent relationship. it's probably many-to-many in a join-table.
Comment: Now, what about the bi-directional many-to-many relations on self (1 links to 2,3,&4, so evidently 2 links to 1, but can also link to 3,6, or whatever), that's on I don't have a really good workable answer for. Either a fabricated relationship-id + some way to enforce only 2 rows with that relationship-id  in a (relationship-id,subject-id) table, or a 2 column table with a a join or union on self to get relationships 'stored the other way around'.
Answer:
"What is a systematic way of making that decision though?"

There appear to be two choices: The "One" side as FK's to the "Many side", or the "Many" Side has FK's to the "One" side.
Let's actually look a the choices.

All the rows of the "Many" side can easily reference one row on the "One" side.
The one row on the "One" side cannot ever reference ALL of the rows on the "Many" side.

Only one technique works: "Many" side has FK to "One" side.
There is only one actual implementation choice.  There's no "decision".
Comment: In short: it's a matter of cardinality.  If you have a many-to-one relationship, the key should reside on the 'many' side.  If it is one-to-perhaps-one, on the 'one' side.  If it is many-to-many, you need an intermediate table.  If it's one-to-one, you're free to choose.
Answer: A foreign key is simply a field in one table that refers to a key field of another table. It's not absolutely critical to identify the foreign key field as such. That is, you don't need to explicitly add the FOREIGN KEY ... REFERENCES constraint to the table for it to be a foreign key. When you join the two tables together, the primary key of the parent table will be set equal to the foreign key of the child table. Whichever one is not the primary key is the foreign key.
In one-to-many relationships, the FK goes on the "many" side. It can't go on the "one" side because that's where the PK goes and the definition of a primary key includes disallowing duplicates.
If you have a many-to-many relationship, you'll need to re-work the tables so you end up with two one-to-many relationships and an intermediate resolution table.
Answer: Like a primary key, a foreign key is also a type of constraint placed on one or more columns in a table.
The foreign key establishes a link between the key columns and related columns in another table. (You can also link the foreign key columns to columns within the same table.)
The table that contains the foreign key is considered the child table, and the table that the foreign key references is the parent table.
Key Points

The foreign key must reference a primary key or unique constraint, although that reference can be on the same table or on a different table
A foreign key must also have the same number of columns as the number of columns in the referenced constraint, and the data types must match between corresponding columns.
Unlike Primary key, Foreign key columns can contain NULL values.

Where should I store a foreign key?


Induction solution for game of coins

Question: Consider a game in which, initially, there is a pile of n coins placed on a table. There are two players who alternate turns. Each player, on her or his turn, removes either one, two, or three coins from the pile. The player who takes the last coin wins. Use the strong form of induction to prove the following statement: If the number of coins currently in the pile is congruent to 1, 2, or 3 modulo 4, then the next player to play has a winning strategy, and if the number of coins currently in the pile is a multiple of 4 then the player who is not next to play has a winning strategy.
Comment: Done, now what?
Answer: HINT: Show by induction on $k$ that if the statement is true for $n=4k$, then it's also true for $n=4(k+1)$. Then show that this implies the statement for numbers $n$ that are not multiples of $4$. In each part of the proof you need to think about what a winning strategy would be for the player who has one.

Induction solution for game of coins


Why did Schwinger [Phys. Rev. 74 (1948) 1439] choose a non-standard form of the Lagrangian density associated with the free electromagnetic field?

Question: This sounds like a science history question, but is not. It is about acceptable forms for the Lagrangian density of electromagnetism. There is also a second question on the distinction between total and partial derivatives in the Lagrangian equation.
I am presently studying Julian Schwinger's paper Quantum Electrodynamics. I. A Covariant Formulation [Phys. Rev. 74 (1948) 1439]. In his expression (1.9) for the Lagrangian density, Schwinger gives the expression
$$
{\cal L}_{\text{field}}^{\text{Schwinger}}=-\frac{1}{2}\left(\partial_{\nu}A_{\mu}\right)\left(\partial_{\nu}A_{\mu}\right)
$$
"for the term that refers to the electromagnetic field alone". Schwinger does not distinguish between covariant and contravariant 4-vectors; rather, he inserts an imaginary unit in the time-like part, which corresponds to the implicit use of the "East Coast metric" with $g^{\mu\nu}=\mbox{diag}(-1,+1,+1,+1)$. He furthermore works with Heaviside-Lorentz (HL) units. In this unit system the conventional form of the free-field Lagrangian density is
$$
{\cal L}_{\text{field}}^{\text{HL}}=-\frac{1}{4}F_{\mu\nu}F^{\mu\nu}
$$
These two forms give different contributions to the Euler-Lagrange equations
$$
\frac{\partial{\cal L}}{\partial A_{\beta}}-\partial_{\alpha}\left(\frac{\partial{\cal L}}{\partial\left(\partial_{\alpha}A_{\beta}\right)}\right)=0\quad (1)
$$
The Schwinger form gives
$$
\partial_{\alpha}\left(\frac{\partial{\cal L}_{\text{field}}^{\text{Schwinger}}}{\partial\left(\partial_{\alpha}A_{\beta}\right)}\right)=-\partial_{\alpha}\partial_{\alpha}A_{\beta},
$$
whereas the conventional form gives
$$
\partial_{\alpha}\left(\frac{\partial{\cal L}_{\text{field}}^{\text{HL}}}{\partial\left(\partial_{\alpha}A_{\beta}\right)}\right)=-\partial_{\alpha}F^{\alpha\beta}=-\partial_{\alpha}\left(\partial^{\alpha}A^{\beta}-\partial^{\beta}A^{\alpha}\right)
$$
In the case of Lorentz gauge ($\partial_{\alpha}A^{\alpha}=0$), the
two expressions coincide.
Furthermore, the electromagnetic tensor
$$
F^{\mu\nu}=\partial^{\mu}A^{\nu}-\partial^{\nu}A^{\mu}
$$
is invariant under a gauge transformation
$$
A_{\mu}\left(x\right)\rightarrow A_{\mu}\left(x\right)-\partial_{\mu}\Lambda\left(x\right)
$$
and so this is also the case for the conventional form ${\cal L}_{\text{field}}^{\text{HL}}$ of the Lagrangian density. However, it is not the case for the Schwinger form
$$
{\cal L}_{\text{field}}^{\text{Schwinger}}\rightarrow{\cal L}_{\text{field}}^{\text{Schwinger}}+\left(\partial_{\nu}\partial_{\mu}\Lambda\right)\left(\partial_{\nu}A_{\mu}\right)-\frac{1}{2}\left(\partial_{\nu}\partial_{\mu}\Lambda\right)\left(\partial_{\nu}\partial_{\mu}\Lambda\right)
$$
Schwinger rewrites the extra terms as
$$
-\partial_{\mu}\left[\left(A_{\nu}+\frac{1}{2}\partial_{\nu}\Lambda\right)\left(\partial_{\mu}\partial_{\nu}\Lambda\right)\right]
+\left(A_{\nu}+\frac{1}{2}\partial_{\nu}\Lambda\right)\left(\partial_{\nu}\partial^2_{\mu}\Lambda\right)\quad(2)
$$
and writes: ".. the first term has no effect on the equations of motion. Hence gauge invariance is restricted to the group of generating functions that obey"
$$
\partial^2_{\nu}\Lambda=0.
$$
This is incidentally the condition on gauge functions $\Lambda$ to stay within Lorentz gauge.
Let me now come to my questions:

Is the Schwinger form an acceptable alternative form of the Lagrangian density for the free electromagnetic field ? Or, why did Schwinger choose this term ?
Schwinger claims that the first term of $(2)$ does not contribute to the equations of motion. We know that for a point particle adding the total time derivative of a function $f(\mathbf{r},t)$ to the Lagrangian does not change the equation of motion

$$
\boldsymbol{\nabla}L-\frac{d}{dt}\left(\frac{\partial L}{\partial\mathbf{v}}\right)=0.
$$
This is because the function argument $\mathbf{r}$ refers to particle trajectory and is thereby time-dependent such that we get
$$
\frac{d}{dt}f(\mathbf{r},t)=\frac{\partial}{\partial t}f(\mathbf{r},t) + \mathbf{v}\cdot \boldsymbol{\nabla}f(\mathbf{r},t);\quad \mathbf{v}=\frac{d\mathbf{r}}{dt}
$$
Total derivatives do not seem to appear in the Euler-Lagrange equation for continuous systems $(1)$, or ? In the second edition of Classical Mechanics by H. Goldstein (12-23) we find the alternative form
$$
\frac{d}{dx_{\nu}}\left(\frac{\partial\cal{L}}{\partial\eta_{\rho,\nu}}\right)-\frac{\partial\cal{L}}{\partial\eta_{\rho}}=0;\quad \eta_{\rho,\nu}\equiv\frac{d\eta_{\rho}}{dx_{\nu}}\quad(3)
$$
So, which form of the Euler-Lagrange equations -- (1) or (3) -- is correct ? Alternatively, why does the first term of (2) not contribute to the equations of motion, as claimed by Schwinger ?
I would be particularly grateful if answers also provide appropriate references.
Answer:
This choice of the Lagragian is to make possible the quantization of the EM field. If you use the conventional writing, you cannot quantize the field as the field conjugate to $A^0$ is $F^{00}=0$.
It is shortly introduced in Quantum Field Theory of Mandl & Shaw, p75.


"and counting" "and holding" - what does this mean?

Question: When listening to Space Shuttle countdown I notice the endings "and counting" and "and holding". I can imagine what "and counting" means, but what is "and holding"? Countdown has stopped? Why?
Comment: It's old [Mercury program](https://en.wikipedia.org/wiki/Project_Mercury) countdown jargon.  "And counting" means that the countdown clock is ticking (downward).  "And holding" means that the countdown clock has been stopped.  It was common for there to be multiple "holds" in the countdown for a Mercury space launch, as items were checked in the checklist and problems were found.  (Of course, the idioms have been adopted by other domains.)
Comment: If they find any system that is not "go" (i.e., ready for launch), the launch becomes a "no-go". When the launch is canceled, it is said to have been "scrubbed".
Answer: Shuttle launches clock a countdown from T-43 hours (i.e., 43 hours before liftoff) to T-0 (liftoff).  The clock is important, not just to watch the time go by, but because dozens of activities are keyed to it.  For example, at T-2 minutes, the crew knows to close and lock their visors, and at T-6.6 seconds, they ignite the engine.  For details go here.
If things are going smoothly, the clock runs and is said to be counting.  If there's a problem, flight control stops the clock, and it is said to be "holding," from its meaning of grasping and not letting go.
Comment: No, if some issue arises and they can fix it in time, they resume the countdown.
Comment: Or, really? They stop and start countdown so easily for multiple times? I thought that if some issue arises, entire launch must be cancelled.
Answer:
"The ship is up to 5000 meters and holding, sir"

The ship has reached 5000 meters and is sustaining this altitude.
Comment: But that is a different sense of the word, not related to the space launch jargon.
Comment: Not really—it's holding steady, at the same value.  Clock or altitude, they're still "holding".


Does elevation change the temperature at which snow falls?

Question: I have read that snow falls at 32 degrees F. While at an altitude of nearly 8,000 feet above sea level, I found it snowing, but the temperature was more than 40 degrees F. Perhaps the indicator is broken, but the outside temperature did not seem cold. Does higher altitude, or thinner air, have some affect on what temperature it can snow?
Answer: Snow can only form at, or below, the freezing point of water.
It can form at any temperature below freezing.
(Of course, freezing point is pressure dependent).
Snow formation requires moisture in the air.
Warmer air can hold more moisture.
Snow flakes cool the air around them, allowing them to land on ground warmer than freezing point - they can then both cool the ground and insulate flakes landing above.
In short:  it can never be too cold to snow, but it can be too dry.
- I think you can derive the answers to your questions from that.


Efficiently Allocate Memory in Kernel

Question: I want to write a kernel module where I am getting TCP/IP packets near 8 mbps. I have to store these packet for 500ms duration. Later these packets should be forwarded sequentially. And these should be done for 30 members. What should be best approach to implement? Should I use kmalloc for once (kmalloc(64000000, GFP_ATOMIC)? Because each time if I do kmalloc and kfree it will take time, leading to a performance issue. Also if I allocate memory in kernel in one shot will the linux kernel will allow me to do that?
Comment: You can look at the `kmem_cache_create` and related.
Comment: The best thing is to try and measure. But 8Mbps is not a huge bandwidth these days... Most Ethernet connections are faster.
Comment: http://www.linuxjournal.com/article/6930?page=0,0 .....see if this can help
Answer: I once wrote a kernel module processing packets on a 10Gbs link. I used vmalloc to allocate about 1GByte of continuous (virtual) memory to put a static size hash table into it to perform connection tracking (code).
If you know how much memory you need, I recommend to pre-allocate it. This has two advantages

It is fast (no mallocing/freeing at runtime)
You don't have to think of a strategy if kmalloc(_, GFP_ATOMIC) can not return you memory. This can actually happen quite often under heavy load.

Disadvantage

You might allocate more memory then necessary.

So, for writing a special-purpose kernel module, please pre-allocate as much memory as you can get ;)
If you write a kernel module for commodity hardware used by many novice users, it would be nice to allocate memory on demand (and waste less memory).

Where do you allocate memory? GFP_ATOMIC can only return a very small amount of memory and should only be used if your memory allocation cannot sleep. You can use GFP_KERNEL when it is safe to sleep, e.g., not in interrupt context. See this question for more. It is safe to use vmalloc during module initialization to pre-allocate all you memory.
Comment: +1 for the code. And since that code uses round-to-power-of-two, see http://stackoverflow.com/questions/4398711/round-to-the-nearest-power-of-two - the kernel has `ffs()`, see ``.
Comment: Yes I am agree with you..Run Time kmalloc/kfree is very time consuming..But how to **pre-allocate** memory?
Comment: If you know how much memory you need, just allocate it in your `module_init` function. You need to manage this block of memory yourself then. But I guess a FIFO queue is a good way to store your packets. Just have two pointers into your large pre-allocated memory block. On pointing to the next free 'slot', the other pointing to the next packet that needs to be forwarded after 500ms have expired. This is also called a ring buffer.
Comment: Thanks corny..I am getting some hope on that..But I have one more question..If these packets are coming for 10 such canditate..And I have to store for all of them..Can I manage these situation using allocation a large memory block..Or will it be a good to allocate large memory for each of them?
Comment: I don't understand the question. What 10 'such candidate'? You mean like you have 10 'things' where packets are coming out? Depends on what you are doing. If those are 10 individual things that don't need synchronization, use 10 memory chunks, otherwise share one of appropriate size among them all.
Answer: Using vmalloc as in corny's answer  will be faster with Linux kernel 5.2 (released Q3 2019), because of kernel changes.
From Michael Larabel:

The Linux kernel's vmalloc code has the potential of performing much faster on Linux 5.2, particularly with embedded devices.
  Vmalloc is used for allocating contiguous memory in the virtual address space and saw a nice optimization merged today on the expected final day of the Linux 5.2 merge window.
As part of a pull (commit cb6f873) merged minutes ago from Andrew Morton are "large changes to vmalloc, yielding large performance benefits."
The principal change to the vmalloc code is keeping track of free blocks for allocation.
  Currently an allocation of the new VA area is done over busy list iteration until a suitable hole is found between two busy areas. Therefore each new allocation causes the list being grown. Due to long list and different permissive parameters an allocation can take a long time on embedded devices(milliseconds).
This patch organizes the vmalloc memory layout into free areas of the VMALLOC_START-VMALLOC_END range. It uses a red-black tree that keeps blocks sorted by their offsets in pair with linked list keeping the free space in order of increasing addresses.
With this patch from Uladzislau Rezki, calling vmalloc() can take up to 67% less time compared to the behavior on Linux 5.1 and prior, at least with tests done by the developer under QEMU.

The commit, as mirrored on GitHub, is here:
It introduces a red-black tree:
/*
 * This augment red-black tree represents the free vmap space.
 * All vmap_area objects in this tree are sorted by va->va_start
 * address. It is used for allocation and merging when a vmap
 * object is released.
 *
 * Each vmap_area node contains a maximum available free block
 * of its sub-tree, right or left. Therefore it is possible to
 * find a lowest match of free area.
 */

With the function:
/*
 * Merge de-allocated chunk of VA memory with previous
 * and next free blocks. If coalesce is not done a new
 * free area is inserted. If VA has been merged, it is
 * freed.
 */
static __always_inline void
merge_or_add_vmap_area(struct vmap_area *va,
    struct rb_root *root, struct list_head *head)

/*
 * Find a place in the tree where VA potentially will be
 * inserted, unless it is merged with its sibling/siblings.
 */

/*
 * Get next node of VA to check if merging can be done.
 */

/*
 * start            end
 * |                |
 * |<------VA------>|<-----Next----->|
 *                  |                |
 *                  start            end
 */
...
/*
 * start            end
 * |                |
 * |<-----Prev----->|<------VA------>|
 *                  |                |
 *                  start            end
 */

Efficiently Allocate Memory in Kernel


Is it ok to make non-unlikable like button?

Question: Is it OK with facebook policies to make a "like" button that will disappear for user when he use it?
If not - is there some other button that can be placed in other site (not on facebook) that will act like a "like" button but that cannot be "unliked"?
Comment: Flagged as off-topic.  Asking if Facebook permits a particular behavior is not a UX question.
Answer: Regardless of the Facebook policy, think about this in terms of user experience.
Given that users are so used to the standard Facebook "like" behaviour, if you change it so that they can't unlike it will seem cynical and rather irritating.
Comment: Your answer is good, but he is asking, specifically, for Facebook policies.
Answer: I think it is fine if a user can not unlike something.  This would be similar to online voting - like the survey questions on news sites that ask readers for their opinion.  Once the user picks their response, their vote is cast and they can't undo it.  Just think of the like button as the option to vote for "I like this" or "I don't like this".  This would be acceptable if they are likely to only see what they are liking once and probably won't return again, like a news story.  When they first see/read it, they can decide if they like it or not, and they probably will not go hunting to find it again to unlike it.
However, my response does not apply if this would control some kind of user preference that they may want the ability to change in the future.  For example, I can give a song on Pandora a "thumbs up", so it will be played again in the future (as well as others like it).  If the next time I hear the song, I don't like it anymore, I can click the "thumbs down" button instead so I won't hear it again.  Although, this is a bad example to illustrate my point, since you actually can't unclick the Pandora buttons.
Either way, I would not recommend making the button disappear (unless you replaced it with some text like "You like this").  This would be confusing to the user if it was suddenly missing, and they need the visual confirmation of their selection, even if they can't change it.  Instead, I would recommend disabling the button on click.
Comment: Your answer is good, but he is asking, specifically, for Facebook policies.


Why is there a Golden Gate Bridge and a road in "Star Trek: Picard" in San Francisco?

Question: Why is there a Golden Gate Bridge and a road in Star Trek: Picard in San Francisco? What travels on this road? Shuttle craft with wheels?
Comment: To be honest, it almost looks like it got re-purposed as a solar power field.
Comment: Perhaps it's just an ancient monument/tourist attraction, like the Pyramids
Comment: The bridge also features prominently in *Star Trek IV*.  However, due to the storms that engulf the Earth during the film, the bridge is empty of traffic, so it is not possible to determine what kind of vehicles in normally carries.
Comment: @Buzz  The bridge was destroyed/badly damaged in DS9 when the Breen attacked Earth so it's been rebuilt/repaired too.
Comment: There are also staircases in Star Trek: Picard (seen in one of the buildings at Star Fleet HQ). I thought steps would have been replaced by elevators and escalators by the 24th century.
Comment: In the real world [10 Oldest Bridges in the World](https://www.oldest.org/structures/bridges/) list its oldest bridge as being from around **1200BC**, so why should it be surprising that something like the GG bridge is still around after only a few hundred years?
Comment: What drives on them? Red Barchettas, of course.
Comment: Plus, you can see the [Cliff House](https://en.wikipedia.org/wiki/Cliff_House,_San_Francisco) in the background. I wonder if they serve [Gagh](https://www.startrek.com/database_article/gagh) there now.
Comment: It is probably there for sentimental reasons.
Comment: @A.bakkar - They put a glass roof over the roadway
Comment: @RobertF Or, more appropriately, [Anti-Gravity Boots](https://memory-alpha.fandom.com/wiki/Gravity_boot)
Comment: @PeterM Because the GG is steel, not stone, and considerably larger.  It requires routine maintenance, particularly because the zinc-based paint acts as a sacrificial anode, to fend off corrosion, or it will collapse.
Comment: -1 for the assumption that the only purpose of roads is cars.
Answer: Sept 2023 Update
It seems that the Golden Gate Bridge is mostly seen as some kind of monument. This is specifically discussed in Lower Decks, Season 3, Episode 1, Grounded:

Beckett Mariner: The longer I'm off a ship, the more useless I feel! Like that, that big dumb red thing.
Admiral Mariner: Beckett, you know that's the Golden Gate Bridge.
Beckett: Nobody drives anymore! Why do you need a bridge? This planet's wack.
Admiral: People like the bridge. I like the bridge.

Given that the argument between the Mariners was about something else they might have just glossed over the fact that the bridge is still used for other things, so this dialogue doesn't necessarily invalidate the older answers.
Original Answer
You have asked three questions, I will go through them one by one.
The Golden Gate Bridge is still there, there is no need to tear it down with no reason
We have seen the Golden Gate Bridge several times in Star Trek. I can't remember if we saw it in the future during "The Voyage Home", but we can see it clearly in Discovery's episode "Such Sweet Sorrow":

You can see that it's covered with solar panels. Note that we don't know if these solar panels are still in use, they could be historical remnants the same as the bridge itself. There is no reason why this bridge, even if it's unused, should be torn down - it's an iconic landmark and will still serve as a monument even if it's no longer used.
Nothing travels on these roads specifically
As you can see, nothing travels on that bridge because it's covered with solar panels. We don't know if they are still in use or if there was a point in the past where having them made sense (before the discovery of nearly unlimited energy sources such as matter/antimatter reactors), but they are there.
There are roads because cars are still a thing.
Cars are still a thing in the future. And why wouldn't they? It's just not feasible to take a shuttle everywhere, and there are people who are afraid of beaming. Also, people might still be driving cars because they enjoy them.
Even though it's in an alternative timeline, we can see that Kirk drives a car, that there is something similar to a motorcycle and that there are even still hitchhikers. This all pops up in this video:
Comment: @JanWindemuth - in the post-scarcity world of Star Trek, there will be plenty of people who will maintain the Golden Gate Bridge for fun.
Comment: In the Producing Picard short about the show's VFX, it's explained (out of universe) that they added the solar panels to the bridge just to cover up all the cars from the modern-day source video.
Comment: Also, it's not any old bridge, it's an iconic monument. But in general, you are right. Related: These solar panels look awfully new and in good shape. If they are still in use, then why? If they aren't, who keeps them in good shape?
Comment: There is a reason why unused bridges could be torn down: Maintenance effort/costs.
Comment: Yes, the Golden Gate Bridge might be maintained as a monument long after it stopped being useful because it is a beautiful and much loved marvel of engineering. It was the longest suspension bridge in the world when it was completed in 1937, and still is the ninth. Ironically, many of those who saw it being erected preferred the earlier view of the Golden Gate without the bridge.
Comment: Those are both valid points, I just wanted to add this in general, as the sentence in the answer was generally about bridges.
Comment: The panels appear to be *above* the lower roadway
Comment: @EdmundDantes Just as people today maintain and run vintage steam locomotives purely because they love them.
Comment: There's also that taxi in *Picard*.
Comment: I wasn't aware that there is a lower roadway, to be honest - so that bridge could even be still in use!
Comment: There's not a lower level on the golden gate. The bay bridge has 2 levels and they are rebuilding segments that appear to be eliminating the levels. As for solar panels, how do we know that's what they are? Could they not also be some kind of self contained unit that either makes use of solar harnessing or simply looks similar? Yeah, seems far fetched, but sometimes people just design things to look sci-fi like and don't care to plan out every conceivable detail as though the city were real and had to function. I say they are just fancy looking machine things. Good enough for me.
Comment: Yes, we saw it in "The Voyage Home"; the commandeered Bird of Prey almost crashed into it before ditching (presumably in the bay).
Comment: The Golden Gate Bridge is also seen in The Motion Picture, where the upper deck appears to be covered, maybe with solar panel structures. Blurry screen grab: https://imgur.com/a/xUD1V3E
Answer: As you can see from VOY: Endgame, the Golden Gate Bridge of 2394 houses some manner of travel system, comprising individual small cars traveling at high speeds inside a series of transparent tubes, possibly some kind of mass-transit facility.
Answer: Trains on the bridge
I can't cite canon for this, but you can plainly see the "urban density" of the Marin Headlands and Sausalito, and you can bet if those are that built-out, the Presidio is denser still.  This creates a transportation choke-point.
The devil is in the deconfliction. Yes, air is 3-D, but you need a fair amount of space to deconflict traffic to such a focused destination.  Simply because wind conditions could hurl a vehicle off course, aside from other failures like those who like to hand-fly.   Transporters, well how much "airwaves" does a transporter take? Can you have unlimited transporters in a high-density space? I doubt it.
We've seen the pods traveling on the bridge's upper deck in the Voyager scene.  However such pods simply lack the density required to bring in hundreds of thousands of workers in the Starfleet headquarters and Academy complexes. (To say nothing of ordinary commuters merely passing through between non-Starfleet activities in the City proper and their homes in Marin, Sonoma and Mendocino counties).  A train that handles 1000 people every 4 minutes, that's the kind of thing you need. And that's an ordinary subway train today.

So we can safely infer something like that exists, either tunneled (though the Golden Gate channel is fairly deep, making that hard) or on the lower deck of the Golden Gate, as per the original vision for the BART system.
It may, in fact, be precisely BART.  The trouble with changing out a tunneled rapid transit system to a totally new technology like pneumatic tube or maglev, is that transit system is there for a reason, and the reason doesn't take a holiday for a couple of years while everything is rebuilt, debugged,  torture tested and shaken down. The community simply cannot bear the cost of taking the system down that long.   It isn't modernized because it can't be.  So those 24th century commuter trains may be using grav-mag grapples to float above standard old 5'6" broad gauge steel railroad track, but standard they may still be.  The upside is the Historic Fleet gets to operate from time to time.
Comment: Underground transit access in San Francisco is seen in VOY 2x05 "Non Sequitur", when Harry runs from security. This suggests large scale mass transit exists in the 24th century. Whether or not it crosses the Golden Gate Bridge is anyone's guess, but for tunnels crossing the channel that really isn't too far fetched of an idea when considering habitation domes on the floor of the Atlantic were being planned five years prior in TNG "Family".


Admin Sidebar not appearing in one view in J5 component

Question: So I have rewritten one of my j3 components for J5, hopefully following the new standards (my first attempt)
All admin views work fine except for one where the admin sidebar does not appear (as if it was an edit view, which it isn't)
I cannot see any significant difference in Controller, Model, View, or tmpl between the broken view and the working ones.
The new view entry appears ok in the sidebar menu in the other views, but when the view opens there is no sidebar.
Namespace statement is correct (and the same in controller and model) for both faulty and good views
Use clauses in the faulty view are the same as in good ones (with some additions and unused ones removed per file as appropriate)
HtmlView extends BaseHtml view in both working and faulty views, same use clauses are present and same functions ( display() and addToolbar() )
Model extends ListModel for both working and the faulty view. The faulty one only has the same functions by name and signature as does another working one.
Controller extends AdminController in both cases and has only one function getModel() which is the same as others - it simply calls the parent getModel()
There is no Table or Form for the view - it is simply displaying static information - another very similar view works ok, as do conventional list views.
My surface question is for any clues as to what could possibly be going wrong, and underneath that what determines whether the Admin sidebar will be displayed or not?
Answer: Stupid schoolboy error by myself. Just in case anyone else does this I found I had
<code>Factory::getApplication()->getInput()->set('hidemainmenu', true); </code> set in the view code and it took me ages to spot it in the middle of a block of useful code.
The perils of copy and paste combined with word blindness when comparing with a working view. :Doh:


Is there any way that I can see what is on a phone that has a cracked screen

Question: My son was in a wreck and his phone was crushed is there any way I can find out what was on the phone if I connect it to my computer
Comment: The answer lies in the tag you used in your question. Please search it thoroughly.
Answer: Assuming the phone has no security lock enabled, you should be able to see the media it contains if connected to a computer. If it has a memory card, you can try and use it on another device.
Assuming the phone is synced to an online account, its contacts, messages, etc. may be accessed by visiting the account online through a computer, preferably.
The only other choice I see is to repair it.


Two 1099B for same stock

Question: In 2015 Mylan Labs changed their name to Mylan NV after they moved to the Netherlands.  Shortly after that I took possession of my stock and placed it with my broker to sell.
For my taxes I received two 1099 B forms.  Apparently, Mylan NV felt that issuing a stock for a name change constituted a sale.
I also received a 1099B from my broker for the actual sale.
So far, I've been told that I have to show the first sale as a long term (held the stock for about 20yrs.) and the actual sale as a short term.
Isn't there some way to waiver the first sale as just a name change and use a long term sale for the actual sale?
Answer: It looks like what you're calling a name change was registered as a merger that resulted in an exchange of stock.  If that's the case, then what you've been told is correct.  You've got one long-term sale and one short-term sale.
Based a quick read of the Form 8937 that was filed, it looks like there were multiple entities involved in this event, more than one of which existed prior to it.
https://www.mylan.com/-/media/mylancom/files/form%208937%20for%20mylan%20n%20v.pdf
Comment: A corporation is legally chartered by the country -- or in US, the state -- where it is nominally located, and that charter *can't* move, so the only way to change it is a sale/exchange to another, perhaps newly created, corporation.
Comment: @dave_thompson_085 It's not that simple. Wyoming (as one example) allows for a process called continuance, which is basically transferring a charter from another state/country to WY. "Continuation occurs when an out-of-state or out-of-country entity wishes to transfer its state or country of formation to Wyoming and become a Wyoming entity." http://soswy.state.wy.us/Business/Continuance_v_Domestication.aspx

Two 1099B for same stock


Best way to Display Responsive Tables on Small Breakpoints?

Question: I have a web-based dashboard with several tables spanning 80% of the page width.
Its a very typical responsive table design. A few columns (3-10), many rows (up to 100+), pagination, search filters etc.

S/N
Name
Status
Timestamp
Description
Type
Content
Comment

1
Placeholder
Enabled
2022-22-22
This is an example sentence
A
XYZ
This is a comment.

...
...
-
-
-
-
-
-

Due to the nature of our product, some users like to minimize this table (to approx. 500px width, or fill about 30% of the screen) to use as a supplement to another window which occupies most of the screen.
Without giving too much details, this is an example of how they like to use our dashboard (the window on the right)

The problem is that the table becomes a bit squished/compressed, especially if there are many columns (like 10). We implemented a page scroll but it becomes annoying to keep having to scroll.
Is there a best practice/guidelines to optimize the display of such tables for smaller screen displays, say,<500px? If not, how else would you render this table to not look 'squished'/ugly?
Answer:
A simpler approach to enhance the user experience is to freeze the first few important columns to provide context as user scroll horizontally. You can refer to Excel on this.
Another option is column grouping, however this might affect your data structure.
For example column name: (Sale Price, Cost Price, Total Quantity, On order, Available)

You can group the columns according to category:

Hope it helps


Motor Oil in Coolant Reserve

Question: 2004 Mercedes E500 - Yes, I am sure of it. In a moment of stupidity, I added about 8oz of motor oil to the coolant reserve. I have heard nothing will happen and I've also heard it can mess up the radiator. I have not started the engine yet - this just happened. How much trouble am I in? What do I need to do?
Answer: Have the coolant reservoir flushed and replace it with new coolant.

Motor Oil in Coolant Reserve


Is there any benefit to using outdoor faucet covers if the water to them is shut off?

Question: If I shut off the water supply to an outdoor faucet during cold weather, is there much benefit to also covering the faucet using a styrofoam faucet cover or similar? My guess would be no, but maybe the pipes conduct heat well enough that it would still be worth it.
Answer: Metal pipes conduct heat very well.
You have another question indicating that you have been insulating pipes.
If a pipe is insulated from the warmth in the house and has a turned off hose bibb sticking out into -10F weather, it's far more likely to freeze if that hose bibb is not insulated from the -10F weather.
In any case, given all your other posts about insulating the house, even if the pipes don't freeze here's a heat leak that's easy to fix that you'll be paying for even if it does not freeze the pipes.
Comment: Thanks a lot!! Nice of you to look into my situation.
Answer: Don't insulate - use better valves
Change the faucet out to a different type called a "hydrant" aka "sillcock".
There is a long shaft going the length of the assembly.  The spigot knob turns the actual valve at the other end.  This means the length of the assembly does not have water in it (if you follow the rules!) when the valve is shut.

So make sure you convert to this valve type if you don't have it already.  Note the distinctive arrangement with the spigot handle dead square-on to the wall, and vacuum breaker above.
Comment: If there's not enough heat getting to the pipe inside, these can still freeze the pipe beyond the valve. And there is evidently already an interior valve that has been shut off, per the question - these make it *more convenient* (if you remember to at least remove the hose...) but are no better than the "separate interior valve and exterior valve" setup if you remember to shut off the interior valve and drain the exterior one in the fall before it freezes.


What is so special about the Lebesgue-Stieltjes measure

Question: A measure $\lambda: B(\mathbb{R}^n) \rightarrow  \overline{{\mathbb{R_{\ge 0}}}}$ that is associated with a monotone increasing and right-side continuous function $F$ is called a Lebesgue-Stieltjes measure. But I am wondering, why it is not true that every measure $\lambda: B(\mathbb{R}^n) \rightarrow  \overline{{\mathbb{R_{\ge 0}}}}$ is a Lebesgue-Stieltjes measure?
Comment: Every Borel measure is a Lebesgue-Stieltjes, provided it is finite on bounded sets.
Comment: If you assume $\lambda$ to take only values in $\mathbb{R}_{\geq 0}$ then you have a bijection of Lebesgue-Stieltjes measures and equivalence classes of associated monotone increasing and right-side continous functions $F$. But I guess you already know that and you're asking for the case of $\overline{{\mathbb{R_{\ge 0}}}}$
Answer: $\mu$ being a lebesgue-stiltjes measure with corresponding function $F$ implies that $$
  \mu\left((a,b]\right) = F(b) - F(a) \text{.}
$$
Now take the (rather silly) measure $$
  \mu(X) = \begin{cases}
    \infty &\text{if $0 \in X$} \\
    1 &\text{if $0 \notin X$, $1 \in X$} \\
    0 &\text{otherwise.}
  \end{cases}
$$
We'd need to have $F(x) = \infty$ for $x \geq 0$ and $F(x) = 0$ for $x < 0$ to have $\mu\left((a,b]\right) = F(b) - F(a)$ for $a < 0$, $b \geq 0$. But then $$
  \mu\left((0,2]\right) = F(2) - F(0) = \infty - \infty
$$
which is

meaningless, and
surely not the same as $1$, which is the actual measure of $(0,2]$.

Note that a measure doesn't necessarily need to have infinite point weights (i.e., $x$ for which $\mu(\{x\}) = \infty$ to cause trouble. Here's another measure on $B(\mathbb{R})$ which isn't a lebesgue-stiltjes measure $$
  \mu(X) = \sum_{n \in \mathbb{N}, \frac{1}{n} \in X} \frac{1}{n} \text{.}
$$
For every $\epsilon > 0$, $\mu\left((0,\epsilon]\right) = \infty$, which again would require $F(x) = \infty$ for $x > 0$, and again that conflicts the requirement that $\mu((a,b]) = F(b) - F(a) < \infty$ for $0 < a \leq b$. Note that this measure $\mu$ is even $\sigma$-finite! You can write $\mathbb{R}$ as the countable union $$
  \mathbb{R} = \underbrace{(-\infty,0]}_{=A} \cup \underbrace{(1,\infty)}_{=B} \cup \bigcup_{n \in \mathbb{N}} \underbrace{(\tfrac{1}{n+1},\tfrac{1}{n}]}_{=C_n}
$$
and all the sets have finite measure ($\mu(A)=\mu(B) = 0$, $\mu(C_n) = \frac{1}{n}$).
You do have that all finite (i.e., not just $\sigma$-finite, but fully finite) measures on $B(\mathbb{R})$ are lebesgue-stiltjes measures, however. This is important, for example, for probability theory, because it allows you to assume that every random variable on $\mathbb{R}$ has a cumulative distribution function (CDF), which is simply the function $F$.
Comment: What if both $0$ and $1$ are in $X$?
Comment: @cQQkie Then the measure is $\infty$. Will make it say that explicitly.
Answer: If you have a measure $\mu$ in $\mathbb{R}$ that is finite in compact sets then we define the function
$$
  F(x) = \begin{cases}
     \mu((0,x])&\text{if $x > 0$} \\
    -\mu((x,0]) &\text{if $x < 0 $} \\
    0 &\text{if $x=0$}
  \end{cases}
$$
Then $F$ is increasing càdlag function and $\mu = \mu_{F}$.
This also shows that every measure in $\mathbb{R}$ which are finite in compact sets is regular.
Comment: Minor correction: It's "[càdlàg](https://en.wikipedia.org/wiki/C%C3%A0dl%C3%A0g)", continue à droite, limite à gauche.


Sniffing the Router for Packets

Question: I have used WireShark software to sniff my Network Interface. What if i wanted to sniff the router that what other computers on the network are doing? Is there any way to do that?
Computers are connecting through WiFi.
Answer: The router is a bit of a red-herring in the question as it is unlikely to have the ability to mirror the wifi data out to your PC. The best you could do with the router would probably be to put your PC between the router and the internet and sniff that traffic, but you would miss out on any traffic that stayed within the LAN.
A better approach might be to feed Wireshark the wifi passphrase and let it decrypt over the air. A guide to that is here:
http://wiki.wireshark.org/HowToDecrypt802.11

Sniffing the Router for Packets


Session is not started Laravel 5.3 Auth

Question: I am trying to authenticate user against an API in Laravel 5.3.  It is not working.  Auth does not persist once the user redirects after login.

Routes are configured like:
Route::group(['middleware' => 'web'], function () {
    Route::group(['middleware' => 'auth'], function () {
        Route::get('/', 'Users\DashboardController@index');
    });
    // Authentication routes...
    Route::get('login', 'Auth\LoginController@getLogin');
    Route::post('login', 'Auth\LoginController@postLogin');
    Route::get('logout', 'Auth\LoginController@getLogout');

});

In LoginController.php I'm using
protected $redirectTo = '/';
public function getLogin()
{
    return view('auth.login');
}

public function postLogin(Request $request)
{
    $this->login($request);
}

After login which is successfully saved in file, the session is not started for route '/'.
So on 'login' route:
dd($session);  in Illuminate\Auth\SessionGuard returns #started : true
Store {#153 ▼
 #id: "fo9Q8WuBio5BBus70WmzFPZmkXkjsYQlYEHsVHI4"
 #name: "laravel_session"
 #attributes: array:4 [▼]
 #bags: []
 #metaBag: MetadataBag {#144 ▼}
 #bagData: array:1 [▼]
 #handler: FileSessionHandler {#154 ▼}
 #started: true

}
but #started is false when the route is in 'auth' middleware group ('/' in my case).
I checked some and #started is also false when I put the '/' route outside 'auth' middleware group but calling Auth::check() in controller.
This problem seems to have existed in 5.2 (Auth not persisting in Laravel 5.2
), but the solution there not working for me.
Please help me understand why I can't access the '/' route after logging in.
Thank you!
Answer: change kernel.php 'api'
api' => [
            'throttle:60,1',
            'bindings',
        ],

to
'api' => [
            'throttle:60,1',
            'bindings',
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Session\Middleware\StartSession::class,
        ],

Session is not started Laravel 5.3 Auth


How would I take the average color of a material (lighting included) and turn that into a flat color?

Question: I know that's very specific. I think the best use case other than my very specific one would be if you were making a scene out of voxels, and wanted each voxel to be a flat color, but still wanted each to react to lighting. How would I turn the blended color from the object, into a flat material?
Comment: I think the best I can simplify this issue is:

Can I take a value output, which is actually a range of values depending on lighting, and turn that into a single value output, an average?
Answer: The only way I can think of achieving this would be to have each mesh assigned its own 1x1 image and use the UVs to Bake the image from the surface.
Since the image is just a 1x1 single pixel, the whole bake will be merged into that single pixel. The image can then be used to shade the surface.
Note that this would be Cycles only (for the baking - you can use the image in Eevee, just can't bake it there since Eevee doesn't (yet) support baking) and that there would be a great deal of setting up to create and bake an image for each material.
It would be feasible to use scripting to automate the creation and baking of the images to apply to a whole scene/frame.
Comment: I think I know what you mean, but I think this would only work with a full scene, in one lighting setup. I'm trying to find something like this, that also reacts to lighting.


What is $\sqrt{-4}\sqrt{-9}$?

Question: I assumed that since $a^c \cdot b^c = (ab)^{c}$, then something like $\sqrt{-4} \cdot \sqrt{-9}$ would be $\sqrt{-4 \cdot -9} = \sqrt{36} = \pm 6$ but according to Wolfram Alpha, it's $-6$?
Comment: This is because $a^cb^c=(ab)^c$ is for $a,b>0$.
Comment: It's complicated.. Conventional notation $\sqrt {r}$ for positive real numbers $r$ denote the positive $1/2$-th power of $r$.
Comment: Every positive real number has two square roots, but one of them is so much preferable to the other that we can get away with calling it **the** square root of the number. When we ask about square roots of negative numbers, there are still two of them, but it's no longer the case that one is far preferable to the other. Put it this way: though the square root function on nonnegative reals is continuous, there is no square root function that's continuous on the set of all complex numbers. Deal with it.
Comment: @Lubin I don't agree with your statement- "Every positive real number has two square roots, but one of them is so much preferable to the other that we can get away with calling it the square root of the number." There is nothing like one of the square root is preferable. Its a common mistake to consider the positive square root and forget about the negative square root.
Comment: @i707107 Why not for negative numbers?
Comment: If we can say things like $\sqrt{25} = \pm 5$, what stops me from saying $\sqrt{25}\sqrt{36} = -30$? What stops me from saying $\sqrt{25} + \sqrt{25} = 5 - 5 = 0$?
Comment: It's complicated how?
Comment: If we write $\sqrt{-r}$ for positive real $r$, this means $i\sqrt r$ where $i$ is the  imaginary unit.
Comment: The imaginary unit $i$ is a root of the equation $x^2+1=0$. In fact, the equation has two distinct roots in complex numbers. We fix a root and denote by $i$ or $\sqrt{-1}$ and the other root is denoted by $-i$ or $-\sqrt{-1}$.
Comment: https://en.wikipedia.org/wiki/Square_root
Answer: The property $a^c \cdot b^c = (ab)^{c}$ that you mention only holds for integer exponents and nonzero bases. Since $\sqrt{-4} = (-4)^{1/2}$, you cannot use this property here.
Instead, use imaginary numbers to evaluate your expression:
$$
\begin{align*}
\sqrt{-4} \cdot \sqrt{-9} &= (2i)(3i) \\
&= 6i^2 \\
&= \boxed{-6}
\end{align*}
$$
Comment: @ArukaJ It can hold for non-integer exponents provided that the bases are non-negative. However, if the bases are negative, then problems may arise, as your question illustrates.
Comment: It doesn't hold for non-integer exponents? Why not? Even if the bases are integers? Seems to work when I test it on Wolfram Alpha using non-integer exponents
Comment: @ArukaJ [Not all the time, of course.](http://bit.ly/2aHT4l4)
Comment: Those use negative numbers, I (meant to) refer to positive integers with my earlier comment
Comment: Re your remark "not all the time" (meaning not for all arguments), so write the function$f(a,b;c):a^c\cdot b^c\mapsto (ab)^c$, which has a domain $\mathbb{R}^2;\mathbb{R}$ (or $\mathbb{R}^3$), more or less. So what's the subset of $\mathbb{R}^2;\mathbb{R}$ for which $f$ works? For example, I guess we have to remove the lower-left (negative,negative) quadrant of $\mathbb{R}^2$ -- unless the $c\in\mathbb{R}$ exponent happens to be integer. So a somewhat goofy-looking region of $\mathbb{R}^3$. Is there a simple way to characterize it?
Comment: Who says $\sqrt{-4}=2i$ and not $\sqrt{-4}=-2i$?
Comment: @egreg  Then $\sqrt{-4}*\sqrt{-9} = (\pm 2i)(\pm 3i) = (\pm 1)^2(2*3)(i^2) = -6$.
Answer: Things to understand:

$\sqrt a \times \sqrt b =\sqrt ab$ is only valid when $a,b\geq 0$
The most common mistake I noticed in this thread is like $\sqrt{25} = \pm 5$ or $\sqrt{-4}=\pm 2i$. T. Bongers has mentioned it in his comment as well.

The correct way to think is the equation $x^2=25$ has two solutions $x=\pm\sqrt{25}=\pm 5$ or the equation $t^2=-4$ has two solutions $t=\pm\sqrt{-4}=\pm 2i$.
But nevertheless, $\sqrt{25}$ is just $5$ not $\pm 5$ and $\sqrt{-4}= 2i$ not $\pm 2i$
Comment: To typeset $\sqrt{ab}$, type \sqrt{ab} when you are in math mode.
Answer: For real numbers all numbers are either positive, zero, or negative.  And the square of a negative number is positive.
Thus only zero and positive numbers have square roots and positive  numbers have two square roots, one positive and one negative, but both equal in magnitude (i.e. absolute value).
NONE of this can be said about complex numbers.
As a result of these observations about real numbers we can make the following assumptions, none of which we can do for the complex:
When we write $\sqrt a$ then by definition $a \ge 0$; for $a >0$ there exist one $q > 0$ such that $q^2=a $ so $\sqrt {a} = \pm q $ and unless we specify in context we may as well arbitrarily define the $\sqrt {a}=q>0$.
And therefore $\sqrt {a}\sqrt {b}=\sqrt {ab} $.  Even if we allow square roots to be negative this is true as products of positive and/or negative numbers are positive or negative.
For complex numbers we can not make these assumptions.  But we can assume $|ab|=|a||b|$ and so $|\sqrt {a}||\sqrt {b}|=|\sqrt {ab}|$.
So $\sqrt {-4}\sqrt {-9} =\pm 2i * \pm 3i = 6i^2= -6$.  But it doesn't equal $\sqrt {-4*-9}=\sqrt {36}=6 $.
Comment: Unless you choose a particular branch cut, the expression is two-valued and, of course, the values are $6$ and $-6$.
Comment: Yeah, I was assuming we would pick a branch cut (do you mean either 2i, 3i or -2,-3i but not 2i, -3i or -2i, 3i?) but I didn't want to get bogged down in minutia.  I was hoping no one would notice and I wouldn't have to explain.
Comment: Somebody did. `;-)`

What is $\sqrt{-4}\sqrt{-9}$?


non-developer mgmt and outside developer

Question: I am the sole software developer in a company and I answer directly to the owner of the company. We also use the services of an outside developer. The owner isn't a developer but 'wrote software in qbasic' many years ago. He has reasonable abilities to spec projects.  The outside developer doesn't answer directly to me, and my boss is really a micro-manager and wants to keep it that way.
The outside developer likes to use layers of abstraction (frameworks and wrapper classes), but has implemented them when I was stuck on months-long projects. When I return, the boss now wonders why it is so time consuming for me to do maintenance on projects (including one that I initial wrote from scratch).
I'm unhappy reverse engineering his code and I'm having trouble articulating the fact that I must learn a complete different interface from code that looks alot different than what I wrote in the first place.  At the same time, the outside developer looks like a hero. Suggestions on how to articulate this to a technical/yet non-technical boss and how to put a lid on this happening in the future?
Answer: At the risk of sounding patronising, be careful that it is not just your perception of what you think your boss is thinking, which may be quite far from the reality.
Your boss may be wanting you to explain the situation not because he does not trust you, doubts your competency, or wishes to belittle you; but rather to understand where the difficulties are so that he can make an informed business decision on whether it is worth you reverse engineering this code- or perhaps be better to leave it as is and move on, on different aspects of the project.
Being honest and explaining that you have limited experience with these frameworks/wrapper classes may "buy" you time to not only learn these frameworks (which will hopefully benefit you greatly in the future), but may also mean that you are appearing to embracing and extend upon the other developers code, which is good team spirit if nothing else.
At very least, ask your boss to ask you if there are aspects of your explanation that he needs further clarification on. Keeping nice clear lines of communication will help everybody move forward faster.
Hope that helps!
Gav
Answer: I don't know if you can get away with this with your boss.. I could with mine, but not everyone can.
First, this has to be done respectfully, and the suggestion I'm about to give should be within the scope of a longer discussion.  When it comes to the point of having to explain the difficulty of working with this developer's code...
Type up a paragraph in English, have someone type up the same sentence in some language your boss does not know.  (Chinese, Spanish, Klingon, whatever.)  Give your boss a (language) - to - English dictionary and explain that while you are technically capable of translating this outside developer's code into something useful, it takes time, just like it would take him time to translate from (language) to English using the dictionary.
Perhaps this would work best in the context of trying to establish standards for working with outside agents and potential new hires.


Are dark troops practical to train at town hall 7?

Question: At Town Hall 7, you get a Dark Barracks and Dark Elixir storage. However, you do not get a Dark Elixir drill. Without this collector, is it practical to train these troops?
Answer: The answer is...  kinda.  DE troops aren't going to be the backbone of your army at TH7, but they can still be useful anyhow.
You can earn dark elixir, either through clan wars or via raiding other bases.  So if you train DE troops and use that to raid/win DE, technically that's a win.
Minions are by far the cheapest flying unit in the game, in terms of both resources and camp space.  Combining them with the barbs and archers in the "BARCH" farming strategy makes the also popular BAM troop combo.  The minions allow you to pierce deeper into bases your barbs & archers couldn't normally get into.  This can help you hit DE drills and storages you wouldn't normally be able to otherwise.
Also it's worth noting that you can use overtraining to store your DE in your Dark Barracks when you're not playing.  (the tip is about regular elixir, but DE works the same way)  Just queue up DE troops when your camps are full and the elixir will be spent, but you can cancel them and get the DE back later.
This can help you save up or protect quantities of DE that you would otherwise lose to raiding.  Whether or not you consider this "training DE troops" is kind of questionable, since you'll generally cancel the troops rather than train them.
In my personal experience at TH7, I used minions occasionally (usually I had around 10-15 trained at any given time) to hit DE storages during raids.  I managed to earn my Barbarian King this way before ever having a drill.
Comment: The "over training" tip was great. I have never heard this before, but is brilliant to reduce loss in attacks!
Answer: The answer is yes, You can be rushed town hall 7 however you can get dark troops if you have a dark elixir collector and you if you get a dark elixir drill if you really wan. And you can get dark troops if you get the dark barracks and if you do it correctly you will get the dark troops for sure.
Comment: What? Clarify your answer please.


I have bad eyesight, can I still be a commercial pilot in Malaysia?

Question: So, I have really bad eyesight (short-sighted): without my glasses, I can't read text unless it's near. So can I be a commercial pilot?
Comment: What is your corrected vision? (with your glasses)
Answer: According to the Civil Aviation Authority of Malaysia's medical standards:

(c) Distant visual acuity, with or without correction, shall be:
  (1)
  in the case of Class 1 medical certificates, 6/9 (0,7) or better in
  each eye separately and visual acuity with both eyes shall be 6/6
  (1,0) or better;
  (2) in the case of Class 2 medical certificates, 6/12
  (0,5) or better in each eye separately and visual acuity with both
  eyes shall be 6/9 (0,7) or better. An applicant with substandard
  vision in one eye may be assessed as fit in consultation with the DCA
  subject to satisfactory ophthalmic assessment;
  (3) applicants for an
  initial Class 1 medical certificate with substandard vision in one eye
  shall be assessed as unfit. At revalidation, applicants with acquired
  substandard vision in one eye shall be referred to the DCA and may be
  assessed as fit if it is unlikely to interfere with safe exercise of
  the license held.

The key words appear to be "with or without correction", i.e. it's completely fine if you wear glasses to correct your vision. That seems to be standard around the world, e.g. the US standards also allow correction.
Answer: This depends on your jurisdiction but the FAA will allow it so long as your eyesight can be corrected (i.e. with glasses) to 20/40. You can find the full vision requirement here.

Near Vision:
20/40 or better in each eye separately (Snellen equivalent), with or
  without correction, as measured at 16 inches
Comment: So I still need 20/40 eyesight?
Comment: And I am in Malaysia
Comment: @lpydawa 20/40 _corrected_ (with glasses). I dont know the Malaysian regulations but you could always train in the states.
Comment: Thanks, by states you mean the USA right?
Comment: @lpydawa yes the USA
Answer: I am in Malaysia as well.
Your visibility problems may not stop you from getting a CPL/multi engine/IR license but once you've got that in hand you need to pass thru the airline
interview.
Currently the job market for pilots in Malaysia is a bit soft in that there are more pilots than jobs, as such airlines can pick and choose. If you have two guys with the same license you will definitely choose the one with better health, better academics etc.
Not trying to kill your dreams but this is something you really need to think about before you pursue a commercial license.
Comment: yes, I know, I was just wondering. I actually only plan to get a PPL, just wanted to ask about eyesight so that I know if I want to pursue a professional career in Malaysia.


MapInfo Thematic Mapping - All other values?

Question: Relatively quick question here, how do I go about adding a style for all other values using individual value thematic mapping in MapInfo?
Answer: When you get to the "Create Thematic Map - Step 3 of 3 Window", click the "Legend.." button.  You will be shown the "Customize Legend" box - on the right handside of which is the range labels list, including at the bottom "all others" - highlight this row and below there is a check box for "Show the Range" - check it and that should be it
Comment: Thanks, it shows it on the legend but does not let me choose a style for it :S


Why do you set a hyperbola equation to 0 to find the equation of the asymptotes?

Question: I saw this solution to finding the equations of the asymptotes of the hyperbola of form $\frac{x^2}{a^2} - \frac{y^2}{b^2} = 1$. To find the asymptotes, you let the right hand side equal 0, then rearrange to get your equation. Like this: $\frac{x^2}{a^2} + \frac{y^2}{b^2} = 0$, then $\frac{x^2}{a^2}  =  \frac{y^2}{b^2}$, then $\pm\frac xa = \frac yb$, and thus $ y = \pm \frac bax$. I do not understand why you set it equal to $0$, though. I get that the asymptotes shouldn't be part of the graph, so we set it to zero to find the points not on the hyperbola, but why set it to 0?
Comment: Esssentially a duplicate of https://math.stackexchange.com/questions/3698030/where-does-the-equation-of-asymptotes-of-a-hyperbola-come-from , so also see the answers there
Answer: An asymptote denotes a tendency, when a variable goes to infinity.
When $x$ or $y$ tends to infinity the finite terms contribute  only insignificantly . Dividing by $y^2$
$$ \frac{x^2}{a^2 y^2} - \frac{1}{b^2} = \frac{1}{y^2} $$
In order to trace to what curve the graph tends to, we need to a priori set the small finite fraction ... including the increasing denominator ...  to zero.
Answer: Hint:
See $\#313$ of The elements of coordinate geometry
From the $\#324$ of the same, the equation to the asymptotes only differs from
any hyperbola by a constant.
So, here the equation of the pair of  asymptotes  here will be $$\dfrac{x^2}{a^2}-\dfrac{y^2}{b^2}=K$$ where $K$ is any arbitrary constants
Now use What is condition for second degree equation to represent a pair of straight lines?
$\begin{pmatrix} \dfrac1{a^2} & 0&0\\0&\dfrac1{b^2}&0\\0&0&-K\end{pmatrix}=0\implies \dfrac{-K}{a^2b^2}=0$