Question about "different" equations of motion in dependence of indices

Question: Let's have the action
$$
S = \int (\partial_{\mu}h^{\mu \sigma}\partial^{\nu}h_{\nu \sigma} - \Lambda h^{\mu \nu}T_{\mu \nu}) d^{4}x.
$$
For definiteness,
$$
h_{\mu \nu} = h_{\nu \mu} , \quad T_{\mu \nu} = T_{\nu \mu} \neq f(h_{\mu \nu}), \quad h^{\mu \nu} = \eta^{\mu \alpha}\eta^{\nu \beta}h_{\alpha \beta}, \quad \eta^{\mu \nu} = diag (1, -1, -1, -1).
$$
Let's take the variation of $S$ by $h_{\mu \nu}$ and set the surface terms to zero:
$$
\delta S = \int \partial_{\mu} \delta h^{\mu \sigma} \partial^{\nu}h_{\nu \sigma} d^{4}x + \int \partial_{\mu}h^{\mu \sigma}\partial^{\nu}\delta h_{\nu \sigma} d^{4}x - \Lambda \int \delta h^{\mu \nu} T_{\mu \nu}d^{4}x =
$$
$$
= -\int (\partial_{\mu}\partial^{\nu}h_{\nu \sigma}\delta h^{\mu \sigma} + \partial_{\mu}\partial^{\nu}h^{\mu \sigma} \delta h_{\nu \sigma} - \Lambda \delta h^{\mu \sigma} T_{\mu \sigma})d^{4}x.
$$
Then it's time to my stupid question. The expressions under the integral are scalar form and we may rename the indices. But when we take out the variation $\delta h^{\mu \sigma}$, all is changed. I can do that by the two "ways":
$$
\delta S = \int \delta h^{\mu \sigma}(\partial_{\mu}\partial^{\nu}h_{\nu \sigma} + \partial^{\alpha}\partial_{\mu}h_{\alpha \sigma} -  \Lambda T_{\mu \sigma})d^{4}x = \int \delta h^{\mu \sigma}(2\partial_{\mu}\partial^{\nu}h_{\nu \sigma} - \Lambda T_{\mu \sigma})d^{4}x \qquad (1)
$$
and
$$
\delta S = \int \delta h^{\mu \sigma}(\partial_{\mu}\partial^{\nu}h_{\nu \sigma} + \partial^{\alpha}\partial_{\sigma}h_{\alpha \mu} - \Lambda T_{\mu \sigma})d^{4}x . \qquad (2)
$$
By setting variation to zero I obtain different equations of motion $(1), (2)$. Where did I make the mistake?
Comment: Could you explain what you did in the second way, to get (2)?
Comment: @Siva :
I wrote
$$
\partial_{\mu}\partial^{\nu}h^{\mu \sigma}\delta h_{\nu \sigma} = \delta h^{\alpha \beta}\partial_{\mu}\partial_{\alpha}h^{\mu}_{\beta} = \delta h^{\alpha \beta}\partial^{\mu}\partial_{\alpha}h_{\mu \beta}.
$$
After that I only rename
$$
\mu \to \alpha , \alpha \to \mu , \beta \to \sigma
$$
for $(1)$ and
$$
\mu \to \alpha , \alpha \to \sigma , \beta \to \mu
$$
for $(2)$. Then I take out $\delta h^{\mu \sigma}$.
Answer: This question is related to quadratic form.
If for any symmetric variation $\delta h^{\mu\nu}$, we have
\begin{equation}
\delta h^{\mu\nu} A_{\mu\nu} = 0
\end{equation}
can we conclude $A_{\mu\nu} = 0$? The answer is NO.
The symmetric variation has only $n(n+1)/2$ degrees of freedom, a full matrix $A$ has $n^2$. The rest piece is the antisymmetric part of $A$. Notice that for any $A$,
\begin{equation}
\delta h^{\mu\nu} (A_{\mu\nu} - A_{\nu\mu} ) =  0
\end{equation}
The variation equation only makes the symmetric part of $A$ to be zero,
\begin{equation}
A_{\mu\nu} +A_{\nu\mu} = 0
\end{equation}
You choose the following variation to prove it
$$\delta h_{\alpha \beta} = \begin{cases}
\begin{array}{cc}
\epsilon & \text{if } \alpha =\mu, \beta = \nu \text{ or } \alpha = \nu, \beta = \mu \\
0 & \text{otherwise} \\
\end{array}
\end{cases}
$$
Symmetrizing the integrand makes your two equations of motions the same. So it always a good habit to make the integrand in the variational action symmetric, if you have a symmetric variation.


How do I get dust particles out from between the layers of my polarizer filter for my camera

Question: I have an expensive Hoya anti-static polarizer filter.  There is dust/spots between the two pieces of lens.  How do I get them out???
Comment: Why would you want/need to remove dust from between the two plates? It will have little to no effect on image quality, even when very narrow apertures are used.
Comment: I wonder if I will ever see convex/concave polarizer.
Answer: Well, first make sure you really need to get the dust off... Dust on the filter probably isn't going to be visible on your images even at the smallest apertures, unless you're using a superwide angle lens or a fisheye (unlikely).
Having said that, and with the understanding that there's a good chance you'll destroy the filter trying to save it, this is what you can do...
The outermost filter is held in place with a retaining ring that has two small notches on opposite sides of the ring. You will need to unscrew that ring. I've been able to use my fingernails, one on each side, to unscrew these sorts of retaining rings.
Take out the front polarizer plate and gently blow out any dust between the filters. Liquid cleaners may destroy the filter material. When you've gotten as much crud out as you can, reverse the disassembly process.
One warning- with circular polarizers the front plate must go back facing the same way it came out. If you reverse the plate (put what was the outside on the inside) it will not work.
Again, you probably won't see any difference in your images- the front filter is simply too close to have any effect, even at high f-stops.
Comment: obligatory Roger Cicala blog posts: [large "dust" on front element vs. rear element](https://www.lensrentals.com/blog/2011/08/the-apocalypse-of-lens-dust); [front element "issues" and relative lack of effect on picture quality](https://www.lensrentals.com/blog/2008/10/front-element-scratches); [spider & web in the lens](https://www.lensrentals.com/blog/2014/09/the-itsy-bitsy-spider).
Comment: Yep... I tried to make that clear. If he's gotten 'wet stuff' between the plates there may be contrast and/or flare issues (much more so than dust)... But 'wet stuff' may not be clean-upable.
Answer: Lens cleaning tools are a blower, a microfiber cloth, and lens cleaning fluid. Try to blow up dust off the lens with the blower or canned air. Finger prints can be detached with a circular wipe of the micro fiber cloth.
Comment: That's fine generic lens cleaning advice, but it does not answer the OP's question at all, which is how to get dust particles out from *between the elements of a circular polarizer?*


Insufficient Privileges for partner portal user

Question: I have created a Vf page and created a tab to view Vf page. But when i try to go to this tab i am getting message - (Insufficient Privileges. You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. )   This user is partner portal user. Can anybody guide me what i need to change to get this page access for partner portal user .
Comment: Have you ensured the user's profile has access to the VF page?
Comment: No i am looking over it. Can you please guide me how to give access to VF page to partner portal user
Comment: If you find a partner portal user record inside Salesforce, it should have a link through to their profile. I'm not sure if you can customise the standard one, you might need to clone it, reassign the user, and then edit the cloned profile to add access to the particular VF page (there's a VF specific section).
Comment: Was it through updating the profile? If so I'll write up the answer, if it wasn't then you should write up an answer so others can learn from this in the future.
Answer: I think you have to give access to the user for that page and class as  a partner user created by a account and contact record, you just open the users list and click on the partner user and the go to profile of that user and check the access of the tab , vfp and class associated with tab.
How give the access to the page
http://ap1.salesforce.com/help/doc/en/users_profiles_orig_ui_editing.htm
Answer: I change the the security setting and added the profile to access the VF page.


Torah Study in English

Question: Will one receive the reward of Learning Torah if they read the Tanach, Gemara, Shulchan Aruch, etc. in English if English is their mother tongue? Please cite sources.
Comment: Just as you receive s'char for praying in a language you understand, you receive s'char for learning Torah in a language you understand. (That's my hava amina.)
Answer: The Torah was written in all 70 languages available at the time in order for everyone to be able to learn it in all languages and fulfill the commandments as written in Sotah 32a:

ואחר כך הביאו את האבנים ובנו את המזבח וסדוהו בסיד וכתבו עליו את כל דברי התורה בשבעים לשון שנאמר (דברים כז, ח) באר היטב

There are only a few Mitzvos that must be read from the Torah in Lashon Hakodesh (Hebrew) ibid:

ואלו נאמרין בלשון הקודש חמקרא ביכורים טוחליצה ברכות וקללות יברכת כהנים וברכת כהן גדול כופרשת המלך לופרשת עגלה ערופה מומשוח מלחמה בשעה שמדבר אל העם.

In fact one only gets the full Mitzva of Learning Torah if one  understands the meaning and clarifies all the details of the Torah (in ones own language if Hebrew is not a natural tongue), Rambam Talmud Torah 1,11:

וחייב לשלש את זמן למידתו. שליש בתורה שבכתב. ושליש בתורה שבעל פה. ושליש יבין וישכיל אחרית דבר מראשיתו ויוציא דבר מדבר וידמה דבר לדבר ויבין במדות שהתורה נדרשת בהן עד שידע היאך הוא עיקר המדות והיאך יוציא האסור והמותר וכיוצא בהן מדברים שלמד מפי השמועה. וענין זה הוא הנקרא גמרא
Comment: BUT a translation is never perfect.  To get all the nuances you need the original text, which is typically in Hebrew or Aramaic.  (But for something that was written in e.g. Arabic Hebrew is not necessarily better than English.)
Comment: The rambam also wrote on the mishna in arabic.
Comment: The gemoro zohar is also not written in hebrew but aramaic
Answer: I know you asked for sources, but I'll answer you anyway in my own language.
The answer is: absolutely!
The mitzvah of Torah-learning is to know the Torah; distinguishing between what is permitted and what is forbidden. We get to this point by reading, analyzing, and understanding the Torah(both Written and Oral).
While it is better to learn in lashon hakodesh, this is only true if one would understand their learning better that way. If they learn better in english, chinese, or spanish; then that's the best way to learn because that's the best way they will understand the Torah...and that's what God wants from us, because then we can keep and fulfill the Torah with a full understanding of what's required of us.
In fact, the majority of the Talmud Bavli(which is the basis of our current way to keep the Torah) is written in Aramaic, which was the language of the Jewish people then in Bavel(an area in and around modern-day Iraq).
If someone learned all of the Talmud in english and fully understood it, it would not diminish their stature as a Torah giant; because they would still know more than most of the generation.
Another interesting and related fact(which is also a halacha); is that the Shema can be recited in any language as long as they understand it(see Shulchan Aruch Orach Chaim 62:2 and Ba'er Heitev 1, there; based on the Talmud in Berachot). Interestingly enough, the shema is also the source of the mitzvah of Torah-learning!

Torah Study in English


Irreducible component of a scheme over a DVR

Question: Let $\mathcal M$ be a (reduced) quasi-projective scheme over a DVR (of mixed caracteristics), $R$. Suppose that the generic fiber $\mathcal M_{\eta_R}$ is (nonempty) smooth and irreducible of dimension $n>0$ and that the special fiber $\mathcal M_{x}$ is (nonempty) smooth of dimension $n$ also. Can one find an irreducible component $\mathcal M'\subset \mathcal M$ such that $\mathcal M'_{\eta_R}$ contains an open subscheme of $\mathcal M_{\eta_R}$ and $\mathcal M'_x$ contains also an open subscheme of $\mathcal M_x$?
Answer: Not necessarily.
E.g. let $\mathcal M_{\eta}$ be a curve over $K$ (the fraction field of $R$), let $\mathcal M_x$ be a curve over $k$ (the residue field of $R$), and let $\mathcal M$ be the disjoint union of $\mathcal M_{\eta}$ and $\mathcal M_x$.
You'll need an extra flatness or properness assumption to get what you're asking for.


Elliptical orbit changing as a star's mass increases

Question: I'm studying Kepler's Laws, specifically the orbit of the Earth around the Sun. I know that if the Earth was more massive, the orbit would not be significantly affected. If the Sun was more massive, I know the velocity of Earth's orbit around the Sun would increase, but how would the shape of the orbit change? This is a theoretical case, neglecting conservation of mass and assuming the Sun's radius and volume don't change.
Comment: What do you wish to keep constant? Energy, angular momentum? At what point in the orbit is the mass added?
Answer: I think the answer is rather complicated and depends on (i) the timescales of the mass gain; (ii) the initial eccentricity; (iii) the position of the object in its orbit when the mass gain occurs.
The case of "adiabatic" mass changes is dealt with in Veras et al. (2011). In this instance, the mass loss timescale is much longer than the orbital period. If this is the case then they provide an analytic solution of the form
$$ e(t) = e_0 - \frac{P \dot{M}}{2\pi \mu} \frac{\left(1-e_0^2\right)^{3/2}\sin f}{1 - e_0 \cos f},$$
where $f$ is the true anomaly, $e_0$ is the initial eccentricity, $\dot{M}$ is the time derivative of the stellar mass and $\mu = (M+m)$ (the total mass of star and planet). For a positive $\dot{M}$ the eccentricity decreases with time as the orbit shrinks.
If however you mean, assume that some parameters of the Sun-Earth system are kept the same whilst others are instantaneously changed, then that would be different. You need to specify what is being kept constant -- energy, angular momentum, both?
I'll assume you want to keep angular momentum constant. Thus if $M_1 \gg M_2$, we can say the angular momentum before the mass gain
$$ J_0 = M_2 (a_0[M_{1,0} + M_2](1 -e_0^2))^{1/2} \simeq M_2 (a_0 M_{1,0}(1 -e_0^2))^{1/2}$$
and this equals the angular momentum after the mass gain
$$ J = M_2 (a[M_1 + M_2](1 - e^2))^{1/2} \simeq M_2 (a M_1(1 - e^2))^{1/2} $$
Here, $M_{1,0}$ is the original stellar mass and $M_1$ is the new, larger stellar mass; $e_0$ is the original eccentricity and $e$ is the new eccentricity; $a_0$ is the original mean separation and $a$ the new mean separation. Equating these, we have
$$1 - e^2 = (1-e_0^2) \left[\frac{a_0 M_{1,0}}{a M_1}\right] \tag{1}$$
To work out what happens to the eccentricity we need to work out what happens to the trailing factor.
The energy equation for an elliptical orbit tells us that
$$ -\frac{GM_{1,0}M_2}{2a_0} = -\frac{GM_{0,1}M_2}{r} + \frac{1}{2}M_2 V^2 \tag{2}$$
where $V$ is the instantaneous orbital speed at instantaneous separation $r$
and again I assume $M_2 \ll M_{1,0}$.
A similar equation applies after the mass gain:
$$ -\frac{GM_{1}M_2}{2a} = -\frac{GM_{1}M_2}{r} + \frac{1}{2}M_2 V^2 \tag{3}$$
where we assume the same instantaneous speed and position.
Using equation (2) to get an expression for $r^{-1}$ and substituting this into equation (3), I get
$$ \frac{1}{a} = \frac{1}{a_0} +\frac{V^2}{GM_{1,0}} - \frac{V^2}{GM_1} \tag{4}$$
This tells us that as the mass is increased then $a<a_0$ and the orbit shrinks. Substituting equation (4) into equation (1)
$$ 1- e^2 = (1-e_0^2)\left[ \frac{a_0 V^2}{GM_1}\left(1 - \frac{M_{1,0}}{M_1}\right) + \frac{M_{1,0}}{M_1}\right] \tag{5}$$
For a circular orbit, $e_0=0$, $a_0 V^2/GM_{1,0}=1$ and
$$ e^2 = 1 - \left[ \frac{M_{1,0}}{M_1}\left(2 - \frac{M_{1,0}}{M_1}\right) \right]$$
e.g. If $M_{1,0}/M_1= 0.5$ (the mass doubles), then $e=0.5$.
For other initial eccentricities, the result depends on the instantaneous value of $a_0 V^2/GM_{1,0}$, which can be bigger or smaller than 1. So if the mass change takes place with the Earth as perihelion, than $a_0 V^2 = GM_{1,0} (1+e_0)/(1-e_0)$ and
$$ 1- e^2 = (1-e_0^2)\left[ \frac{M_{1,0}}{M_{1}}\left(\frac{1+e_0}{1-e_0}\right)\left(1 - \frac{M_{1,0}}{M_1}\right) + \frac{M_{1,0}}{M_1}\right] \tag{6}$$
If the mass loss occurred at aphelion
$$ 1- e^2 = (1-e_0^2)\left[ \frac{M_{1,0}}{M_{1}}\left(\frac{1-e_0}{1+e_0}\right)\left(1 - \frac{M_{1,0}}{M_1}\right) + \frac{M_{1,0}}{M_1}\right] \tag{7}$$
So for concrete examples - let's increase the the mass of the Sun by 10%, for the Earth with $e_0=0.017$.
Using equation (6), if this occurs at perihelion then $e = 0.084$, at aphelion $e=0.100$.
Answer: If the existing orbit were already circular then any changes like you describe would immediately result in an elliptical orbit. After that the orbit would tend toward a circular orbit. How long that takes depends on the total tidal forces. A rigid body would take longer than a pliable one as tidal forces are exchanged.
Answer: Kepler's laws are not correct:
No area law, no elliptical orbits, nor period. Starting with Newton's mechanical laws, Kepler's area law does not exist. Newton's universal attraction force is radial. $F=F_r$. A side force component, a perpendicular force does not exist $F_p=\frac {m dV_p} {dt}=0$. Then when integrated , we get $V_p=Ct$ . Kepler says $r V_p=area=Ct$. Newtons equation is a prove. Kepler's area law is an estimation.
When using $V_p=Ct$ in the differential form of the energy conservation equation,we get
$r=-4*{t^2}+4 t T-4 \frac {T^2} 6 $ as the equation of celestial motion. This is a spiraled orbit and not an ellipse.
When to the validity of the period law: Newton says period law is valid for circular motion with non accelerated velocity. Kepler says period law is valid even for elliptical orbits with accelerated velocity. High velocity at perihelion low , velocity at aphelion. And no body feel this acceleration?
Comment: @NecatTasdelen You know, that the area law is a reformulation of the conservation of angular momentum? Are you implying, that angular momentum is not conserved according to Newton's laws?
Comment: Welcome to Physics SE. Look around, and take the [tour]. Note that formatting of equations is easily done in the TeX style. And, I'm not sure what your problem is with elliptical orbits is, since they are well described in classical mechanics.
Comment: Hi Jon Custer,My problem with elliptical orbits is a complaint about Kepler's celestiasl orbit Laws.
Comment: @NecatTasdelen : you must focus on the question and introduce the area issue in another question else you'ld be downvoted again or not read


Infinite matrices and the concept of "determinant"

Question: Suppose we have an infinite matrix A = (aij) (i, j positive integers). What is the "right" definition of determinant of such a matrix? (Or does such a notion even exist?) Of course, I don't necessarily expect every such matrix to have a determinant -- presumably there are questions of convergence -- but what should the quantity be? The problem I have is that there are several ways of looking at the determinant of a finite square matrix, and it's not clear to me what the "essence" of the determinant is.
Comment: I take it you're not just talking about matrices that are eventually 1 or 0 on the diagonal.
Comment: Not necessarily. I don't have any particular restrictions (or lack thereof) in mind, though I would be interested to find out what you can say when you impose certain restrictions.
Answer: There is a class of linear operators that have a determinant.  They are, for some strange reason, known as "operators with a determinant".
For Banach spaces, the essential details go along these lines.  Fix a Banach space, X, and consider the finite rank linear operators.  That means that T: X → X is such that Im(T) is finite dimensional.  Such operators have a well-defined trace, tr(T).  Using this trace we can define a norm on the subspace of finite-rank operators.  If our operator were diagonalisable, we would define it as the sum of the absolute values of the eigenvalues (of which only finitely many are non-zero, of course).  This norm is finer than the operator norm.  We then take the closure in the space of all operators of the space of finite-rank operators with respect to this trace norm.  These operators are called trace class operators.  For such, there is a well-defined notion of a trace.
(Incidentally, these operators form a two-sided ideal in the space of all operators and are actually the dual of the space of all operators via the pairing (S,T) → tr(ST).)
Now trace and determinant are very closely linked via the forumula etr T = det eT.  This means that we can use our trace class operators to define a new class of "operators with a determinant".  The key property should be that the exponential of a trace class operator should have a determinant.  This suggests looking at the family of operators which differ from the identity by a trace class operator.  Within this, we can look at the group of units, that is invertible operators.
So an "operator with a determinant" is an invertible operator that differs from the identity by one of trace class.
For more details, I recommend the book "Trace ideals and their applications" by Barry Simon (MR541149) and the article "On the homotopy type of certain groups of operators" by Richard Palais (MR0175130).
But defining the determinant of an arbitrary operator is, of course, impossible.  One can always figure out a renormalisation for a particular operator but there just ain't gonna be a system that works for everything: obviously det(I) = 1 but then det(2I) = ?
(I should also say that I picked Banach spaces for ease of exposition.  One can generalise this to locally convex topological spaces, but that involves handling nuclear materials so caution is advised.)
Comment: It should perhaps also be pointed out that in the Hilbert space case, this notion of determinant is known as the Fredholm determinant: http://en.wikipedia.org/wiki/Fredholm_determinant
Comment: It is not a good idea to try to define trace class operators on arbitrary Banach spaces, it is better to restrict yourself to Hilbert spaces. Indeed, there is an issue in your claim "We then take the closure in the space of all operators of the space of finite-rank operators with respect to this trace norm." What you can do is take the completion, say $P$ for "projective", of the finite rank operators for the (correctly defined) trace norm. On $P$ there is a well-defined notion of trace. There is also a norm $1$ map $P \to B(X)$, and its images are called the nuclear operators...
Comment: ... (continued) but the problem is that this map is not injective in general. This map is injective if and only if $X$ has the Approximation Property (AP) ( http://en.wikipedia.org/wiki/Approximation_property ). Hence it is not possible to define a reasonable notion of trace on the nuclear operators on a Banach space without AP. This difficulty is completely overlooked in Simon's book. By the way, the wikipedia page on AP also contains mistakes, I will have to clean it when I have time if nobody does it before.
Comment: But det(2I) obviously should be 2.
Answer: There are a lot of subtleties that you need to watch out for.  First of all, "infinite matrices" aren't well-defined as linear transformations without additional hypotheses.  A typical case in combinatorics is that the matrix is triangular and you're only interested in how it acts on a space of formal power series; the t-adic topology is what gives you convergence here.  A typical case in analysis is that you're describing a bounded linear operator between separable Hilbert spaces, and then there is the notion of orthonormal basis to work with.  In any case you need a topology on the underlying vector space to make sense of infinite sums.
If you define the determinant of a matrix to be the product of its eigenvalues, then you run into immediate trouble: "infinite matrices" don't necessarily have any, even over an algebraically closed field.  And in the nicest case, e.g. compact self-adjoint, the eigenvalues tend to zero and their product is zero.  I also believe one can show that there is no nontrivial continuous homomorphism GL(H) -> C for H a Hilbert space.  Finally, if you think of the determinant in terms of exterior powers, then it's not hard to see that for an infinite-dimensional space H, however you want to define the exterior powers of H they should always be infinite-dimensional.
Having said all that, there is a notion of regularized determinant in the literature, but I'm afraid I couldn't tell you anything about it.
Comment: There are many regularization procedures.  One popular one in the physics literature is called "zeta-function regularization".  I don't particularly understand it, but I posted the definition and some questions about it at http://mathoverflow.net/questions/183/zeta-function-regularization-of-determinants-and-traces


Why don't the bullies ever get in trouble for throwing slushies at Glee Club Members?

Question: In the TV Show Glee, why don't any of the bullies ever get in trouble for throwing slushies at members of the Glee Club?
Comment: I never watched *Glee*, beyond bits and pieces that were on in the background when my sisters watched it, but would the bullies happen to have been members of Sue Sylvester's sports team?
Answer: This is a combi of two different tv tropes

The Bully

A person who is cruel to others, especially those who are weaker or have less power." This sums this character up in a nutshell. They will target anyone who is less popular than they are, those who are unable to fight back, or anyone who won't fight back. Comes in different flavours as listed below.

And

Adults are useless

In some shows that revolve around teenagers, preteens, or younger children, adults can't do anything right — if they appear on-screen at all. Teachers tend to be annoying sticks-in-the-mud who do nothing but spoil people's fun. Parents are clueless, no longer care, or are either over- or underprotective. And any other designated authority figures the kid might come across? Forget it.

Glee is another teen tv show, and thus revolves around teens solving their own problems, if adults did anything to punish and even expel students, there would be no tension, or show.


Querying when a value changed in a DE

Question: I'm attempting to query when a value changed in a particular data e.g. when the email address for subscriber 12345 was changed, if ever. Is there a way to query this information?
Answer: One possible solution would be to write a query to copy everything from your data extension into a new data extension. You could then check the new data extension against the original to see if any values have changed.
This could all be run inside of an automation to run at an interval of your choosing. The first query in the automation will check to see if the copy data extension has any differences on the "emailaddress" field from the master/original data extension. The second query will copy the "master" data extension records to the new data extension (as overwrite) so that it can be compared against the master on the next run of the automation.
Step 1.1:
SELECT a.subscriberkey,
a.emailaddress,
a.otherfield1,
a.otherfield2
FROM Copy_Of_Master a
WHERE NOT EXISTS
(SELECT b.emailaddress
FROM Master_DE b
WHERE a.emailaddress = b.emailaddress)

The above example will pull any records from the "copy" data extension that no longer have an email match on the Master data extension, effectively giving you records that have had a change made to their emailaddress field. You would likely want to have this target a third data extension so that you can review the results.
The second query would then copy everything as it currently exists in your main data extension over to the copy.
Step 2.1
SELECT subscriberkey,
emailaddress,
otherfield1,
otherfield2
FROM Master_DE

As noted above, this can be run at any interval you'd like.
Comment: `a` is an alias for the table `Copy_Of_Master`. (`FROM Copy_Of_Master a` - sets the alias) The `a.` before each field is an identifier to show which table those fields belong to. So basically if you did not set the alias, you would need to put `Copy_Of_Master.emailaddress` etc. for each field.  This is to remove any conflicts where a field exists in multiple tables and it is not declared which one is the one to be pulled.
Comment: Thank you! I think this should work. Also I have one question. In the Query language, I'm wondering what the 'a.' is before each field and it's purpose? I'm pretty new with SQL, so forgive me if that's a novice question.

Querying when a value changed in a DE


Creating image for google map tiles from KML file

Question: I am totally new to this. I have a KML file of zip code boundaries. I want to create image from this KML, so that can use to overlay google maps. Can someone please guide me here?
Answer: Google Maps natively supports KML layers, you simply need to create a new google maps kml layer. Here's an example.
As a side note, using Google Earth you can view your kml by simply dragging and dropping the file onto the globe.
Comment: but how to convert it into tiles to use with MapTIles?
Comment: Are you using a 3rd party program? The example should be sufficient to view your layer.
Comment: The problem is I want to draw my huge map using Tiles, I am not sure If I will use kml layer it will be loaded as tiles.


I transcribed 50 interviews = 200 pages, enough for analyses?

Question: I just finished transcribing my interviews for my PhD thesis and I got a total of  200 pages as data to analyse, is this enough?
I only transcribed what is relevant to my research scope. Also, English is my second language. One of my friends told me that it is not enough,
Comment: This should have been decided by conducting a power analysis prior to data collection.
Comment: That's not a valid excuse.
Comment: I'm in the social science faculty
Answer: Hopefully you have an advisor. That is the person (and probably the only person) who can answer such a question. Fifty interviews may be plenty or it may be woefully inadequate. Four pages per interview may be plenty or it may not be nearly enough.
Ask someone who can actually see your data and who has the experience to make such a judgement in your field.
However, you can at least do preliminary analysis. That might guide you to understand if you need more - or different - data to answer the research question(s).
Comment: This varies too much be both field and by the nature of the questions you are researching. No numeric answer from strangers could actually provide you any guidance.
Comment: Thank you for your reply, I'm interested to know other experiences in this regard and how much they had had after finishing their transcriptions.
Answer: Note: My background is Statistics.
Whether you have enough data to analyze, in other words, have a large enough sample size, depends entirely on what you want to do with your data, and what your data is.
One of the things you can do to find out if you have enough is a power analysis. Power is the probability that you will reject the null hypothesis (i.e, the status quo) when the alternative hypothesis (the thing you are most likely trying to show) is true. In simple terms, power is the probability that if your hypothesis is true, then you will be able to give evidence in support of it given your data.
Since I don't know your data's distribution, I can't really give an idea on how to calculate the power for your specific case, but if you have access to SAS software, or R Studio (free to download) you can use either of these to do the calculation for you.
Generally, this is done before the study even begins, but it can be done after the study is concluded. This is called a post hoc analysis. Generally, it's not a good idea to alter your study based on a post-hoc, since it makes your sample no longer random.* However, if you fail to mathematically support your hypothesis, but your power was only 0.1 to start with, you can simply say your sample size was not large enough to detect the effect you were looking for, and that for future research you plan to increase your sample size.
Before I go, I feel it's worth it to add that your sample size as it currently stands appears to be 50, and not 200. It seems to me that each interviewee is your experimental unit, and even if each page was taken at a different time, these would count either as duplicates or replicates.
*The reason that altering your study makes your sample no longer random. You start with a population of size N, from which you take a sample of size x. The probability of being selected is x/N. You then decide you need more data, so you exclude the original x, so now your population size is N-x. (This assumes the population does not change size). You need y more for your sample, so now the probability of selection is y/N-x, which can never realistically be equal to the first probability of selection, x/N. (I have the proof for the last claim, but I feel it is too far outside the scope of this question to include here. If you are interested, feel free to ask for it in a comment.)
Comment: It is also possible, and not stated, that the analysis required isn't statistical. And even possible that the sample taken isn't random.
Comment: @Buffy. True, but inherently the question of "is X enough for [fill in blank]" is statistical. I gave this answer because I personally know people in Social Sciences who could use it if they had a similar question.
Comment: I wasn't complaining, only pointing it out.
Comment: @Buffy, my bad :P.
Comment: Well, no, so you can reel in your tongue. ;-)


3-Toggle to 2-Toggle

Question: I'd like to replace the three toggle switch with a two toggle switch. The leftmost switch (as shown in the below photo) does not control anything in my bathroom. I'd like to replace this leftmost switch a blank face plate. What do I do with the wire on the left switch? The middle switch controls all the lights and the rightmost switch controls the bathroom fan.
Comment: Do you see any other unused wires in there?  Typically the third switch is either for a different (e.g. more mild) light, or for a heat lamp or heater.
Comment: What does that third switch actually control? You'll want to figure that out first before you go changing things here...
Comment: @ThreePhaseEel Leftmost switch does not control anything. Rightmost controls the bathroom fan.
Comment: @Harper-ReinstateMonica Originally, the switches were wired differently. First two switches for different lights and rightmost for fan. Now both the lights are controlled via the middle switch and the fan is still controlled via the rightmost switch. I don't believe there are any other unused wires.
Answer: Power off obviously. You can just patiently twist and tug the wire out of the backstab, and then put a wire-nut over it, and tape the wire nut so it stays. (Wire nuts are supposed to stay on splices without help, and shouldn't be taped then; however when capping a single wire they don't work properly and need help.)
Pulling a wire out of a backstab destroys its spring strength;  (even when using the release tab). The backstab cannot be reused.  Throw the switch in the trash.  Unless (like most of us) you are a member of the "never use backstabs, ever" club, in which case the switch is fine; put it back in stock. (backstabs are unreliable and create maintenance headaches later, which is why we shun them).
They make blanking plates that bolt to the same yoke screws as the switch did, and neatly fill that hole in the switch plate cover.  They also make switch-switch-blank switch plate covers, though they are rare, which is why I mentioned the first thing.

3-Toggle to 2-Toggle


Qt: define Tab Order programmatically

Question: I've created 2 widget with Desinger (Widget1 and Widget2) , each one has it's tab order defined.
A third widget (Widget3 )is defined programmatically and contains the above 2 widget in a vertical layout.
In on a symbian non touch device.
When I focus on widget3 I want to give the focus to widget1. Then go from widget1 to widget2 using the phone arrow when I reach the end of the widget1 tab chain.
What is the proper way of doing this?
Answer: From Qt Documentation for,
void QWidget::setTabOrder ( QWidget * first, QWidget * second )   [static]

which states that, Puts the second widget after the first widget in the focus order.
So for you, the first widget will be your Widget3 and second widget will be your Widget1. (if i understood the question correctly)
Besides that, there are examples available regarding the usage of this function in the link I provided above. You can use it.
Hope it helps..
Answer: It is also possible to take advantage of the default tab order by set by item construction order.
So just edit the .ui file XML:
<item>
     ... //Automatically assign with tab order X
</item>
<item>
     ... //Automatically assign with tab order X+1
</item>

In the order you wish the tab order to be.

Qt: define Tab Order programmatically


How to install half pieces when doing subway tiles

Question: When installing a subway tile layout in a shower, how does one install the half pieces that will occur on the ends?  Do you just cut the tile in half, flip it so the flat side is facing towards the corner (and not out) and hope that the grouting hides the flat side of all those pieces?
Answer: If you're asking about inside corners, yes. You simply lap the two walls. Normally you'd put the grout line on the wall that is parallel to the most common viewing angle so it's less conspicuous. I tend to use slightly smaller grout lines in that situation to conceal them even more.
If you have any reason to believe you'll get movement at the corner, use caulk instead of grout there.
Comment: Do those work with a normal glazed tile or only solid stone tiles?  Seems like filing it would just expose the unfinished part of the tile
Comment: I'm talking about both.  I was assuming to have to caulk the corners (I mean, when will the walls really not shift, especially in a basement), but I was also wondering what to do on the sides as well.  i.e. if you were going from the corner to the door, every other row you'd have a half piece that you're going to have to cut.  What do you do in that situation?
Comment: Yeah, cut edges almost always go outward. You want grout lines between adjoining tiles to have factory edges.
Comment: Right, that's my dilema.  So when I'm tiling the side walls, when I get to the front (aka not the corner) I'm going to have half that are going to be complete [full size - 4 factory edges] and the other half are going to be half size, 3 factory edges.  Seems like my only options are to put the cut edge from the half piece to either be towards the opening or towards the corner.  Seems like I'm either going to have to grout against the cut side or have the cut size exposed, neither of which seem ideal.
Comment: you can ease over the edge  just a little with a tile sanding stone or file.


Spherical symmetry of Cooper pair wave function

Question: Can someone please explain to me how the wave function of a Cooper pair is spherically symmetric?
Answer: Summary: There's an attraction, mediated by the material lattice vibrations (phonons), between electrons. Considering that this attractive potential depends only on the distance $r$ between the electrons, we have an atomic like situation, where the lowest energy level is spherically symmetrical.

[comment] I would like to see a step by step explanation, starting from the explicit form of the wave-function

According to Kadin's very didactic Spatial Structure of the Cooper Pair (arXiv), a wave-function for the pair is
$$ \Psi(r) = \cos{(k_F r)} \,K_0(r/\pi\xi_0), $$
where $k_F$ is the "Fermi wave-vector at the top of the Fermi see", and s the zeroth-order modified Bessel function. Since $\Psi$ depends only on the radial distance, the wave-function is spherically symmetrical.
Note that that's the s-wave and that

there has been considerable discussion of d-wave pairing symmetry as applied to the cuprates [7], as well as p-wave symmetry in ruthenates [8].  It is straightforward to modify the spherically symmetric quasi-atomic orbital to include one or more angular nodes

Edkins' PhD. thesis (mirror) describes a similar picture (p. 7):

In the simplest case, the wave-function of the Cooper-pair can be written as a product of orbital and spin parts. [...] If we were to expand the orbital wave-function in spherical harmonics (which is valid in free space),
  spin-singlet pairs will have angular momentum quantum number $l=0,2,\ldots$, which we call s- and d-wave  respectively, by analogy  with  the  orbitals  of  the  hydrogen  atom. Likewise, spin-triplet superconductors will have $l=1,3,\ldots$ corresponding to p- and f-wave respectively.

$\Longrightarrow$ And this description is not only valid for free space, since, according to Fossheim and Sudboe Superconductivity: Physics and Applications (my emphasis):

The lowest order square lattice harmonics [...] have common properties with the lowest spherical harmonics functions that are the basis functions for the isotropic case.

And there's also Kai Hock's explanation (pdf):
Comment: Sorry, but it is not clear at all from that page. I have not found a book that explains it properly either, which makes me think that some authors don't really understand it. I would like to see a step by step explanation, starting from the explicit form of the wavefunction.
Comment: @dgwp, check my new answer.
Comment: Thank you very much. Do we have to assume that the angular momentum is zero then? The sketchy explanations I have seen in textbooks seem to write the $e^{i\mathbf{k}\cdot\mathbf{r}}$ as a plane wave expansion, then integrate (rather than sum) over $\mathbf{k}$ to get something like $\int\;dk\sin(kr)/k$, but I don't know what has happened to the anguar dependence. And it seems that they have already assumed that $l=0$!
Comment: @dgwp, I think some authors are indeed assuming the symmetry from non-rigorous arguments, while others are solving Schrödinger's equation in 1D, but the best argument is that the lowest order of the expansion in harmonics is spherically symmetrical.
Comment: So, if I understand correctly, you are saying that the wavefunction for the relative motion of the Cooper pair contains the ground state and higher-energy states within a single wavefunction?
Comment: @dgwp, As I understand it, the lowest order expansion represents the ground state of the pair. But I'm wandering quite far from my specialty and, if there's something in the sources in the answer you can't follow, you should probably post a new question.


Bitcoin is not sending to correct address

Question: While trying to send bitcoin I keep putting the correct address in the 'pay to' section but it keeps sending the bitcoins to the wrong address. While clicking the preview section on electrum the 'output' says a different address, is this why it isn't sending to the right address?
Comment: Can you give examples? If you don't want to reveal the exact address, blank them out apart from the first few characters (as there are different types of addressrs which have distinct firdt characters).
Comment: 1) Do a malware scan 2) Download the non-scam version of electrum from the [official website](https://electrum.org).
Answer: You have a malware version of electrum. Did you update it recently because you were prompted to do so by in app popups? Check your browser history for the download URL. electrum.org or download.electrum.org are the only legit places to get electrum.


Use string indices with colon (lua programming)

Question: I am learning the lua programming from a online book.
It talks about string indices for an array

If the indices are strings, you can create a single index
  concatenating both indices with a character in between to separate
  them. For instance, you can index a matrix m with string indices s and
  t with the code m[s..':'..t], provided that both s and t do not
  contain colons (otherwise, pairs like ("a:", "b") and ("a", ":b")
  would collapse into a single index "a::b"). When in doubt, you can use
  a control character like `\0´ to separate the indices.

https://www.lua.org/pil/11.2.html
I don't understand what is wrong with index "a::b".  What is the difference between "a:b" and "a::b".
What's the trick behind it?
Comment: Both pairs `("a:", "b")` and `("a", ":b")` would result in the same index.  But you have only one storage for them: `m["a::b"]`.  That's a collision.
Comment: I think you are right. The Ambiguity issue is the key.
Answer: What the documentation you linked is describing, is a way to represent a multidimensional matrix in a single dimensional table. After giving an example of how you can do this with number indices:
mt = {}          -- create the matrix
for i=1,N do
  for j=1,M do
    mt[i*M + j] = 0
  end
end

they describe a way to do the same thing with strings: "If the indices are strings, you can create a single index concatenating both indices with a character in between to separate them." A code snippet that would fit the description would look like:
str_idxs = {"foo", "bar", "baz"} -- table of the string indices
mt = {} -- matrix
for 1,N do
  for 1,M do
    mt[str_idxs[N] .. ":" .. str_idxs[M]] = 0
  end
end

print(mt["foo:bar"]) -- 0
print(mt["foo" .. ":" .. "bar"]) -- 0
print(mt["foo::bar"]) -- nil

As you can see in this example there is nothing special about the ":" character, you can choose any string to be a separator (including "::" if you really wanted). The reason why "foo::bar" is wrong in this case is because you never gave a value to "foo::bar."


Apply template to a specific page

Question: I have a requirement to apply template to a specific page and not to the pages following the same url pattern.
For example I have a page with the path /asia. I also have pages with the paths /asia/india, /asia/china etc. I would like to create a template which applies only for /asia and not for other paths. I created the template file page--asia.tpl.php but it is getting applied for /asia/india and /asia/china as well. Is there a way to specifically map the template to this specific path?
Answer: To overwrite Drupal defalut suggestion, You can make your own suggestion for template.
In your case you have defined a menu called asia for that specific template is required, to implement this use this code
<code> **
 * Implementation of hook_preprocess_HOOK().
 */
function mymodule_preprocess_page(&$variables){
  if(isset($variables['asia']) && arg(1) == '')
    $variables['theme_hook_suggestions'][] = 'page__asiapage';
}
</code>
create a tpl file in theme called page--asiapage.tpl.php, it will work.
Comment: Thanks Ramesh! This worked.I used the condition `if(arg(0)=='asia' && arg(1)=='')` instead of the one specified above.
Answer: Follow the below points:

Create a file with the name "page--node--nodeid.tpl.php" template.
Replace nodeid with the node you want to theme.
Clear the performance.
Comment: Thanks for the reply Astha! This solution doesn't work in my case since the page is an empty pagecallback and not a node.

Apply template to a specific page


How will my java come to know if anything gets updated in database?

Question:
Possible Duplicate:
Oracle table change monitor

This is the question that is asked to me in one of the interviews:

I need to call some java method as soon as something gets updated in
  database. Can I call some java method through SQL trigger?
Comment: possible duplicate of [Oracle table change monitor](http://stackoverflow.com/questions/337335/oracle-table-change-monitor), see also http://stackoverflow.com/questions/812233/getting-events-from-a-database
Comment: My solution was my SQL Trigger will generate a particular file on hard drive, One of my java thread will continuously poll for same location if some file has got generated as soon as file comes we can execute our work in run method's while loop.
Comment: Don't write more details about question in comment, you can edit your question.
Comment: http://docs.oracle.com/cd/B19306_01/java.102/b14187/chthree.htm#CACEGFCH
Answer: instead of polling main table, I would suggest to have one more table(with columns time stamp, reason) which contains summary of changes to main table. This improves the query performance.
Top 1 query on summary table gives the answer.
Comment: I somehow got your answer, but would you please explain it in detail?
Answer: Generally, you should avoid filling the db ffom multiple apps. That's not always possible, so you need some ad-hoc mechanism. Polling is the best you can do, but you can simply poll the table you need, or another table populated by a trigger.
Invoking java from the database would violate your layer bounderies, and is a bad thing. Even if the DB somehow supports a magic callback mechaniam, I'd still be hesitant to use it.


Can IOTA Smart Contracts access IOTA Streams channels or vice versa?

Question: I am currently learning how IOTA Smart Contract Protocol works. From what I have been able to read, the ISCP is a second layer protocol which off-Tangle executes smart contracts. However, its state is updated in the Tangle as a hash based on a commitee computation result. Also, I read that you can interact with a smart contract by sending it a transaction and here is where my doubt comes out.
It is possible to interact with a smart contract from a IOTA Streams channel? Or vice versa, can IOTA smart contracts access IOTA Streams channels?
Thank you very much!
Answer: Smart Contracts can't store any secrets.
You'd need a middleware to access the streams from Smart Contracts trigger.


How can I fit my table of contents into a single page?

Question: When I use \tableofcontents I get all my contents in a single page except for a line that goes on the other page, how can I make all in the same page?
Comment: I have the same problem for another reason: the page next to the ToC is text only (plus one line of ToC), the page after that starts with a section title. The last line of ToC seems to be forced here by LaTeX in order to avoid getting the section title at the bottom: it can put a space between the ToC and the text rather than between paragraphs.
Answer: Add the following code line in the main text immediately before the chapter/section entry that starts a new ToC page:
\addtocontents{toc}{\protect\enlargethispage{\baselineskip}}

This will enlarge the first ToC page by the value of \baselineskip (i.e. one line), which should make the last ToC entry fit on this page.
EDIT: For top-level-entries (e.g. chapters in books) that add some vertical space before their respective ToC entry, a larger value (say, 2\baselineskip) may be needed.
EDIT 2: I have no satisfying answer why the page number is still positioned the way it is, but a workaround. Ignore my first answer and instead add the following to your preamble:
\usepackage{etoolbox}
\makeatletter
\patchcmd{\l@chapter}{1.0em}{0.8em}{}{}
\makeatother

This will reduce the vertical space between chapter ToC entries from 1.0em to 0.8em, which hopefully is enough to make your ToC fit on one page.
EDIT 3: And here's a "satisfying" answer for the observed behaviour of my first solution -- quoting from source2e:

\enlargethispage{<dim>} [a]dds <dim> to the height of the current
  column only. On the printed page the bottom of this column is extended
  downwards by exactly <dim> without having any effect on the placement
  of the footer; this may result in an overprinting.
Comment: I wrote
\addtocontents{toc}{\protect \enlargethispage{\baselineskip}}
\addcontentsline{toc}{chapter}{Bibliography}

but it remains always with a line in the second page where it's written Bibliography.
Comment: @Peter: As I wrote in my edited answer, try a larger value (e.g. `2\baselineskip`).
Comment: It worked but now I have: Bibliographi    1    124
where 1 is the number of the page of the table of contents. How can I fix this?
Answer: You could try making your table of contents in a slightly smaller font:
{\small\tableofcontents}

Or if some of your contents entries have long names and break onto a second line, you could give them a shorter optional name that appears in the contents:
\section[short name]{The longer name that appears only where the section heading goes}

There is also the option to try and make your contents be two columned. Several packages do this (e.g. biblatex's documentation is like this) but I can't remember how to do this.
Comment: I find it very wrong to change the font size of the toc. I think it is ok to have e.g. the captions in a smaller font, but whole pages should look consistent in the document
Comment: If I use
    {\small\tableofcontents}
it remains the same, always with a line in the second page
Comment: @Marting H I often put my bibliography in a smaller font. I don't think it looks inconsistent...
Answer: Yet another way to forcibly make ToC fit into one page is to put
\addtocontents{toc}{~\vspace{-3\baselineskip}}

right after the \tableofcontents command. This will reduce the vertical space between the title (i.e. "Contents") and the first entry in ToC by 3\baselineskip, thus making room for the line that was sent to the next page.
It's maybe not elegant, but something will have to give, and this is one more option. The advantage is that you don't reduce the vertical space between the text and the footer, which is in most cases smaller (thus less flexible for changing) than the space between the title and the first entry. Hope it helps!
Answer: Another possibility is to change the line spacing of your TOC.
Simply add the following package to your preamble:
\usepackage{setspace}

Then replace your \tableofcontent with:
\begin{spacing}{0.95}
    \tableofcontents
\end{spacing}

You can try and adjust the spacing (0.95) to your needs.


How to attack defending balloons?

Question: I was attacking an enemy base and in their Clan Castle they had Balloons. My barbarians got their ass kicked. How can you attack the balloons in battle?
Comment: Use air based troops like minions that balloons can't defend against. If you don't have access to these, lure the loons to a corner and make a circle of archers (at least 10) around the loons. Alternatively you can clump the loons and place couple of wizards.
Answer: Treat balloons like any melee troops with a splash attack, except they fly.  So, lure them into a corner and then hit them with spread out archers, minions, or wizards (most common units that can hit air).

Archers are cheap but will take them down slowly, which gives them a chance to fly over a group and take them out on death.
Minions I believe will not die from the bombs dropped upon death, so you can take out an entire castle full of balloons with a couple if you can spare the time.
Wizards will take them all down at once if they're clumped together and minimize how much damage they do on death.
Comment: OK I only ave archers so far so I'll use those.
Comment: Minions fly and can attack flying troops. The bombs will only affect ground troops over an area, not air troops.
Answer: Any airborn troops (dragons or minions) or use archers and wizards to shot them down. The positive of uses dragons or minions is balloons cannot damage them.
Answer: If you can, draw them all out then use lightning spells to take them out. They will eliminate the pesky balloons and lower the health of the buildings around them, making them easier to take off. Try to lure the balloons to frustrating defensive buildings for even better result. Always keep two if you can just in case the first lightning spell fails.
Using minions will also help (and be less expensive) since the bombs can't harm them and they can attack air troops like the balloon. Poison spells will also work but will take a while to kill them off.

How to attack defending balloons?


Using the a multiple of the x coordinate as a private key

Question: ECDSA specs require private key ($d$) to be a random integer ($r$) in the range $[1, N-1]$, where $N$ is the order of the base point ($G$). What if the private key instead is set to the x-coordinate of the EC point $r \cdot G$ (i.e., $G$ added $r$ times)?
Comment: That's effectively the formula for the public key. You'd need to pretty much change everything.
Answer:
What if the private key instead is set to the x-coordinate of the EC
  point $r\cdot G$

Then your "private" key is the x-coordinate of your public key and thus public, unless you also want to redefine how the public key is constructed.
Additionally, the idea of ECDSA / Schnorr signatures is to prove knowledge of a solution to the discrete logarithm problem at the example of a message hash and if your private key is the x-coordinate of a point, you don't know said discrete logarithm and thus also need to come up with a new signature scheme.


Memory leaks in libxml2.2

Question: I am using libxml2 to parse xml content in my iPhone app. The xml content is downloaded from a server similar to the Apple's own TopSongs sample app. When I check for leaks using the Instruments tool, I see memory leaks being reported on xmlNewParserCtxt, xmlNewInputStream and xmlAllocParserInputBuffer. I have called xmlFreeParserCtxt(context) at applicable places (dealloc).
Am I missing something else ? Is this a known issue to contend with when using libxml2 parsers ?
Answer: I don't know enough to go into detail about the SDK, but I often get "memory leaks" from the SDK libraries. There is nothing you can do to correct things in the compiled libraries, however.
What I experience is that if there are any leaks in your code, it can often manifest itself as leaks in the API's you call from your leaky code. (Like if you pass a delegate to an SDK API, then the SDK ends up calling your leaky code using that delegate).
Usually I ignore it until it is time to optimize the application and when doing so, removing my own leaks, usually make the SDK leaks also disappear.

Memory leaks in libxml2.2


How can I connect to the kathmandunet in pytezos?

Question: I'm using pytezos and trying to send 1 xtz from one account to another account using pytezos and I want to do this transaction on kathmandunet and I don't know how to initialize the pytezos instance for kathmandunet?
Answer: Have a look at the example bellow:
<code>from pytezos import pytezos
pytezos_client = pytezos.using(shell='https://rpc.kathmandunet.teztnets.xyz')
</code>
Comment: I have answered it in your other question. You can also use an indexer. (tzkt API should provide all the information you need https://api.tzkt.io/#operation/Operations_GetTransactionByHash)
Comment: can you tell me that how I can find the details of a transaction by using the transaction hash in pytezos?
Comment: can you explain indexer?
Comment: @ShahbazAli an indexer is a very key part of working with a blockchain. If you are new to this space i'd encourage you to google some topics and do more research. Many of the questions you are asking are easily found online. e.g. here are some tezos related docs on indexer, also see the "TZKT" tab under this sub heading for further info: https://wiki.tezosagora.org/build/blockchain-indexers


Setup master-master replication using mariabackup

Question: Can please advise how I do master master replication?
How can I get the exact position while the production server is keep on running and busy?
To SCP to another server took about 7,8h , after waiting and waiting I dont see it replication or syncing correctly. I guess it couldnt catch up with the master A gtid.
Can please share with me the steps?
Comment: How many GB of data?  What parameters did you use for replication, such as multiple-threads?  Show us the backup command.  SCP may not be necessary.
Comment: roughly 60GB to 160GB. im using mariabackup. mariadb version 10.2
Answer: With the software already set up on the Slave, but without Replication set up, this may be the most efficient way:
<code>mariabackup --host the-master ... | mysql --host the-slave-to-be ...
</code>
Note that there is no SCP, and the dump never touches the disk.  This one-line script can be run on either server or even a third server.


EXC_BAD_ACCESS while accessing some files

Question: I have a bunch of .gif files that I am displaying, in turns, in a UIImageView.
On the click of specific buttons, the respective gif images are to be displayed.
Some of the gifs display just fine when i click the button but for most of the cases, the App crashes without any error message.
Debugging shows 'EXC_BAD_ACCESS' but when I add a breakpoint and step through the program, all the gif  files display correctly on clicking Continue.
Anybody knows what could possibly be going wrong?
Its something related to memory management i suppose but i have no clue as to where i should go looking for the problem area.
Thanks
Comment: Post code or this is likely to be closed
Answer: This is probably about memory management, yes. You might want to turn "Zombies" on for further investigations in that direction. However, this will only tell you if there are messages being sent to prematurely dealloced objects, not how to prevent it.
See this document to learn more about proper memory management:
Memory Management Programming Guide
These two links explain more about enabling and using NSZombie and handling EXC_BAD_ACCESS errors:
NSZombie and XCode Oh My!
SO Question about EXC_BAD_ACCESS


Quantum confined stark effect

Question: As far as the stark effect is concerned, I imagine that the quenching of the emission spectra occurs because of the increase in the distance between the expected values of the electron and hole cloud, but suppose, I have quantum dots in the strong confinement regime, wouldn't that mean I do not see quenching of my spectrum, since my excitons are already squeezed?
Answer: The quantum confined Stark effect is about red shift of optical spectra. Yes, we observe less quenching in 3D quantum confinement, because applied electric field reduces overlapping between electron end holes wave functions less. Additionally, applied electrostatic field decrease the energy gap between electron and hole states, that results in the quantum confined Stark effect. Take a look on this reference and wikipedia page on the quantum confined Stark effect
Comment: yes, i think you are right
Comment: so my question is that, the reduced overlap is not a must, because in the strong confinement region the excitons are already packed into spaces smaller than their confined radius, so an electric field might not be able to spatially remove them further....right?

Quantum confined stark effect


Power from 2 USB ports for faster device charging?

Question: Use 2x5V from USB ports to speed up device battery charging? Do we get enough current (1A) from this 2 USB ports as well as from AC charger? I assume that voltages need to be the same, but what'll happen if they are not?
Comment: It's also important to consider that unless your device negotiates with *both* USB ports for the full 500mA each, then you are only allowed to draw at most 100mA from each port (200mA total)
Comment: There is "faster" and "more current". If your device draws less than what your USB port is capable of, there is no point in trying to increase the current capability of the power supply, it won't make it any faster. Certain chargers do not have the features allowing the full 500mA of USB; then you would need more current but your first try should be to enable maximum current. Not sure how you can double the current capability, it's not as simple as 2 diodes in series with cathodes connected.
Comment: I saw a few devices which are using 2 USB ports as power supply, thats the reason why I'm asking this.
Comment: It might be as simple as a parallel connection if the voltages are exactly the same. Each output has its own current limiter, so theoretically after enumeration you can have up to 500mA (100mA without successful enumeration) from each, giving 1A total. Incidentally, you can get up to 1.8A from a wall charger with the right resistance between D- and D+.
Comment: Can you provide a block diagram or part numbers of whatever parts you are considering using? There could be some difficulty involved in using higher charge current. How do you communicate to the charger that more current is available?
Comment: What if enable high current mode(500mA)?
Answer: Supplying a device from two USB ports (but at one PC) is very common with a Y cable:

You have some idealized view to the modern products, in our reality:

rare mainboard implements current limiting capabilities (beginning from the design); and
yet rare mainboard uses such capabilities even it implements them.

Typical mainboard has a simple PTC resettable fuse in series of the VBUS circuit.  Frequently, one fuse is used to protect two ports, e.g. in a backpanel 2xUSB+something jack. Therefore, the greed degree of a device is a good will of that device. An intelligent charger may limit itself if it fails to negotiate with the host, but again, rare host can intelligently limit it.
Also, a non-charging USB 3.0 socket should solely provide 0.9 A and is backward compatible with same type USB 2.0 plug.
To charge faster it is preferred to use a shorer cable and/or a cable whose power pair has a larger square resulting in lesser resistance in series between the power source and the burden.
Relating to your scenario, of course, not in all possible cases, the different voltage problem exists only with supplying from two different sources (supplies) and the only right way to solve the problem is to avoid such connections for power feeding.


If we cloned an extinct animal, what would become of its gut biome?

Question: If we cloned an extinct animal like the mammoth, what would become of its gut biome?
Comment: Seems like it would depend on the animal rather than an absolute answer that applies to everything.
Comment: Got like seven questions here. Would be easier to give a straight answer if you narrow it down a bit.
Comment: any one of these questions would be a good question, but you need to pick one.
Answer: The gut biome would be populated from whatever the environment was of the newly "cloned" animal.
Presumably the baby animal would be born by birth from a live host mother, which would be the likely source for microbiota, similar to other animals.
Comment: @gaspanic there is some work on coevolution of gut microbes and host, but I find the work somewhat unconvincing as a general rule. There are some specific [hybrid lethalities in wasps](https://www.nature.com/articles/nature.2013.13408) driven by microbiomes, and a little evidence for [human genetic variation associations](https://www.pnas.org/doi/10.1073/pnas.2200551119), but it seems very case specific. Mice will [grow transplanted human microbiomes just fine](https://www.nature.com/articles/s41598-018-25300-3).
Comment: @gaspanic I think that we can expect there to be some dropout relative to the mother. But that's true even of mother-child pairs of the same species! For example, the fecal/gut/vaginal microbiomes of the human mother are contributors to neonatal gut microbiome. that doesn't mean that the infant gut is exactly those communities! As they say in ecology, ["everything is everywhere but the environment selects"](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4898794/), which isn't exactly true but is a good way to think about colonization.
Comment: Right, I agree that mother and child will by no means have identical microbiomes. I was more thinking in terms of whether co-evolution between host and microorganisms could have led to some of the microbiome species being directly *incapable* of thriving in the "cloned" species gut. But maybe it's too far-fetched to think that a "cloned" species that is similar enough (evolutionary speaking) to develop in its host, would be different enough to significantly affect the ability of some of the host's microorganisms to colonize its gut.
Comment: Thanks @MaximilianPress, will check these out! Not my field of expertise.
Comment: I think this is about as good of an answer to this question one can givd. But out of curiosity: is it really safe to assume that any microorganisms capable of populating the gut of the host species, are also able to populate that of the (extinct) cloned species? Are species separated by (say) tens of millions of years of evolution typically able to host similar microbiomes?


How to print / echo environment variables?

Question: How do I print the environment variable just being set?
NAME=sam echo "$NAME" # empty

You can see here using eval it works. Is this the way?
NAME=sam eval 'echo $NAME' # => sam

Comment: `NAME=sam echo whatever` does not change the value of `NAME` in the shell.
Answer: These need to go as different commands e.g.:
NAME=sam; echo "$NAME"
NAME=sam && echo "$NAME"

The expansion $NAME to empty string is done by the shell earlier, before running echo, so at the time the NAME variable is passed to the echo command's environment, the expansion is already done (to null string).
To get the same result in one command:
NAME=sam printenv NAME

Comment: Note that only the `printenv`-based command preserves the semantics of the OP's command: defining `NAME` as  a _command-scoped environment variable_, which only the invoked command and its child processes see, but no subsequent shell commands. The other commands do something very different: they define `NAME` as an _until-the-current-shell-exits shell-only variable_, which all subsequent _shell_ commands see, but _no external utilities_.
Comment: I added a note about `printenv`. Hope it's OK, @heemayl
Answer: To bring the existing answers together with an important clarification:
As stated, the problem with NAME=sam echo "$NAME" is that $NAME gets expanded by the current shell before assignment NAME=sam takes effect.
Solutions that preserve the original semantics (of the (ineffective) solution attempt NAME=sam echo "$NAME"):
Use either eval[1]
(as in the question itself), or printenv (as added by Aaron McDaid to heemayl's answer), or bash -c (from Ljm Dullaart's answer), in descending order of efficiency:
NAME=sam eval 'echo "$NAME"'  # use `eval` only if you fully control the command string
NAME=sam printenv NAME
NAME=sam bash -c 'echo "$NAME"'

printenv is not a POSIX utility, but it is available on both Linux and macOS/BSD.
What this style of invocation (<var>=<name> cmd ...) does is to define NAME:

as an environment variable
that is only defined for the command being invoked.

In other words: NAME only exists for the command (child process) being invoked, and has no effect on the current shell (if no variable named NAME existed before, there will be none after; a preexisting NAME variable remains unchanged).
POSIX defines the rules for this kind of invocation in its Command Search and Execution chapter.

The following solutions work very differently (quoted from heemayl's answer):
NAME=sam; echo "$NAME"
NAME=sam && echo "$NAME"

While they produce the same output, they instead define:

a shell variable NAME (only) rather than an environment variable

if echo were a command that relied on environment variable NAME, it wouldn't be defined (or potentially defined differently from earlier).

that lives on after the command.

Note that every environment variable is also exposed as a shell variable, but the inverse is not true: shell variables are only visible to the current shell and its subshells, but not to child processes, such as external utilities and (non-sourced) scripts (unless shell variables are designated as environment variables (too) with export or declare -x).

[1] Technically, bash is in violation of POSIX here (as is zsh): Since eval is a special shell built-in, the preceding NAME=sam assignment should cause the the variable $NAME to remain in scope after the command finishes, but that's not what happens.
However, when you run bash in POSIX compatibility mode, it is compliant.
dash and ksh are always compliant.
The exact rules are complicated, and some aspects are left up to the implementations to decide; again, see Command Search and Execution.
Also, the usual disclaimer applies: Use eval only on input you fully control or implicitly trust.
Answer: This works too, with the semi-colon.
NAME=sam; echo $NAME
Answer: The syntax
variable=value command

is often used to set an environment variables for a specific process. However, you must understand which process gets what variable and who interprets it. As an example, using two shells:
a=5
# variable expansion by the current shell:
a=3 bash -c "echo $a"
# variable expansion by the second shell:
a=3 bash -c 'echo $a'

The result will be 5 for the first echo and 3 for the second.
Answer: On windows, you can print with this command in your CLI
C:\Users\dir\env | more
You can view all environment variables set on your system with the env command. The list is long, so pipe the output through more to make it easier to read.


Primer dilution verification

Question: I just received a primer (details are displayed in the picture). Since this is my first time doing this, I want to do it correctly. My goal is to make a 10µM primer.
So, If I get it right and based on the paper I received, should I have to add 665μl Sterile distilled water (Inside the primer tube) and then aliquot 90μl Sterile distilled water with 10μl of primer tube mix?
Answer: Yes, this is correct. Note that it is not important that the water has been sterilized, it needs to be nuclease free.
Also, for long term storage TE buffer might be a better choice. This will not result in inhibition of your PCR by the EDTA component of the buffer, since the amount of it in the final reaction is neglectable.
Comment: Thank you very much for the response as well as for the tip!!!!
Comment: @KGee If this answer helped, make sure to accept the answer by clicking the checkmark

Primer dilution verification


Operating relay above coil voltage

Question: I want to power some accessories in my car using illuminated switches on the dashboard. These switches will be wired to the dash illumination circuit, which is normally 12 V but can drop as low as 6 V when fully dimmed.  Can I use a 6 V relay here to give 12 V power to the accessories? According to this datasheet, its max. switching voltage is 16 V, so I think this should be safe.
Comment: What is 6V? Coil voltage has nothing to do with contact voltage. If you want to wire a 6V coil to 12V the just add a resistor to limit the current so nthe 12V can't push more than the rated coil current through the coil.
Comment: Are you sure it's a steady 6V when dimmed? There could be some switching action going on for dimming instead. A DMM will "average out" PWM for example.
Comment: It just occurred to me I can switch ground instead of positive, then the relays will always get 12V and it will avoid this issue.
Comment: Switching ground should work as long as the illumination lamps in the switches are not polarity sensitive. Bulb types should work, LED types may not.
Answer: The coil and contacts of a relay are electrically isolated from each other. Powering the coil with mechanically actuate the contacts. The voltages can differ between the two (e.g. 24VDC coil with 230VAC contacts).
The coil requires a specific voltage to turn the relay on and off. This voltage is selected on page 4 of the document you've provided. Looks like your options are 6, 9, 10, and 12 VDC. EDIT: It would be in the best interest that this coil voltage is not fluctuating, and instead, a constant voltage source. Powering a 6 VDC coil from a 12 VDC source will cause the coil to become quite hot.
The contacts are what will be providing power to your accessories. They have a max rating of 16VDC, 35A (page 3). So, 6 to 12 VDC on your contacts will not be a problem, so long as you have a constant voltage on your coil.
Comment: You have not dealt with the issue of coil power at higher coil voltages. Although, to be fair, the data sheet doesn't either. Using a 6-volt coil at 12 volts will dissipate 4 times the nominal power, and that is hardly ever a good idea. Using the "Coil Temperature Rise" graph, and figuring on about 2 degrees per 0.1 watt increase, a 6-volt relay driven by 12 volts will have a coil temperature of about 160 degrees C. Again, hardly ever a good idea.
Comment: That's a great point. What I was attempting to explain was that the contacts would be connected to this "dash illumination circuit" with the varying 6-12 VDC, and the coil should be connected to a consistent voltage. I'll edit your point in for clarity.
Comment: Actually the coil will be connected to the dimmable 6-12VDC and the contacts will have constant 12V.  Page 7 of the data sheet shows a coil voltage graph for the 9V model, but not for the 6V model.  Looks like the 9V relay can tolerate 12.5V at 50ºC.
Comment: @ElliottB, that's a mistake on my part -- definitely misunderstood. Why can't the coil be connected to direct 12VDC? To me, you'd connect the dimmer voltage to the light on the switch, then 12VDC to the contact of the switch to the coil. Then another 12VDC to the contacts of the relay + accessories.
Answer: According to the datasheet, there are two series of relays FBR51 and FBR52.
Both are available in 6, 9, 10 and 12 volt versions.
For the FBR51 series, the coils are rated at 0.6 watts
6V^2/60Ω = 0.6W
12V^2/240Ω = 0.6W
For the FBR2 series it's 0.8 watts
6V^2/45Ω = 0.8W
12V^2/180Ω = 0.8W
See page 4 for the voltage and coil resistances.
What happens if you run the 6V version at 12V?
FBR51 series: 12V^2/60Ω = 2.4W
FBR52 series: 12V^2/45Ω = 3.2W
Since the wattage is related to the square of the voltage you see that doubling the voltage quadruples the wattage.
In layman's terms, they're probably gonna go up in smoke.
Answer: The relay DC coil voltage rating on most relays is continious .Also the relay manufacturers have made allowances for practical lead Acid battery systems .For example if you put a relay with a coil nameplate rating of 12 VDC would be fine in a car that is driving along with a charging voltage of say 14 VDC .Normal relay coils have lots of turns of fine copper wire with significant thermal mass unlike certain fragile semiconductors .This means that they are reasonably idiot proof .If you overload a 6V relay with 12V it will take minutes to cause thermal problems . Long before the enamel       insulation on the copper wire flakes out the plastic housing will distort which mucks up contact alignment causing fail .So in summary you can overvolt the coil for seconds without punishment. In other words a 24V relay is not going to explode if pulses of 48 V are applied .This means that you could use 6V relays in your 12V system with some RC scheme or some PWM scheme that allows tempory 12VDC but enforces steady state 6VDC.

Operating relay above coil voltage


$dW=P\,dV$ or $dW=-P\,dV$?

Question: In thermodynamics work done = 1) $P\,dV$ or 2) $-P\,dV$ or both at certain situations. I'm confused what's right as in some sections the former is used and in some the latter.
Comment: Related: http://physics.stackexchange.com/q/91197/2451 , http://physics.stackexchange.com/q/37904/2451 and links therein. More on [sign conventions for work](http://physics.stackexchange.com/questions/tagged/thermodynamics+conventions+work).
Answer: Physics equations always have well-defined sign conventions, but it is not always easy to remember them.  Hence, in practice, it is generally advisable to manually apply the signs that make sense.  The difference between PdV and -PdV is simply that the first is the work done by the gas on its surroundings (you can imagine a piston, for example), and the second is the work done on the gas by the surroundings.  The easy way to tell which is which is to simply ask yourself, if a gas expands and so V increases, does that remove energy from the gas or add energy to the gas?  Think about the particles bouncing off a receding wall, that should be enough to get the sign right.
Answer: The sign depends on whether you are concerned about the system or the surroundings. The conventional approach in thermodynamics is that we speak everything with reference to the system. If the system do work, then energy has to be compensated from the system for the work and so the energy of the system decreases. Hence work done by the system is negative. Now, if the work is done on the system, then energy is added to the system. The energy of the system increases and hence the work done on the system is positive.
Whatever be the form of energy you supply (or extract) to (or from) the system, the above formalism is valid. For example, if the system liberates heat (as in the case of an exothermal reaction), then the heat is written as negative since the energy of the system decreases. If heat is supplied to the system, it is expressed as a positive quantity.
So, in general, if the nature of work increases the internal energy of the system, then work is done on the system and is hence positive. if the nature of the work is such that the internal energy of the system decreases, then the work done is negative, which means the work is done by the system.
Answer: Both are correct, but have a slightly different meaning. Depending on your conventions, one of them is the energy inserted in the system, while the other is the energy extracted from the system.

$dW=P\,dV$ or $dW=-P\,dV$?


Adding labels to grid lines in QGIS

Question: I'm building a custom map for ATV trails in QGIS 3.4.  Is it possible to add a label to a gridline on the map surface in a layout?  I've already labelled the gridline around the frame but would like to add one on the map itself.  Example attached.
Comment: Do the gridlines have coordinates as attributes?
Comment: Yes, the gridlines correspond to UTM or lat/long coordinates. I haven't decided which way to go.
Answer: You can add a second grid in the layout, with an offset for the coordinates. Indeed you may need two, one for the latitude and a second one for the longitude, if you want to properly align both labels.

The alternative would be to construct the grid as a vector layer, which you can label as you wish.
Comment: The first approach is the simplest and would work except that my map is rotated -37 degrees to optimize layout of area on page.  The labels do not remain aligned with the grid when shifted inside the map area.  The second would work better in my case and i will go that direction.  Thank you for the suggestions.

Adding labels to grid lines in QGIS


how to resize thumbnail image

Question: I am using this function to re-size my thumbnail  ,
 add_image_size( 'portfoliolarg', 120, 120, true);
 the image is corp and resize I just want to resize my Image
Comment: If the images were already uploaded before you added that image size, you will need to either find and download a plugin that will reupload your images or do so manually.
Answer: First of all: add_image_size() is to ADD a new image size into your WordPress installation.
Now, as you said:

I just want to resize my Image

You need to enter into your wp-admin panel. Then Settings » Media, and change the thumbnail size there.

Just change the thumbnail size there. Now use the plugin: Regenerate Thumbnails by Viper007Bond to make your new image sizes.
So, after then, if you use:
the_post_thumbnail( 'thumbnail' );

it will echo the new thumbnail image (120 x 120).

WARNING: Changing image sizes and regenerating new image sizes, doesn't delete previously created sizes, just add new sized images into the server space. So the process is somewhat space-killing theory, if not smartly handled.

how to resize thumbnail image


What is the difference in the implementation of a monad in a purely functional language with respect in an imperative language?

Question: For a long time, the use of these Monad structures has been restricted to a very small circle of languages, many of them purely functional (mainly due to problems related to the management of the IO). Recently, these structures have also been adapted to imperative languages
My question is: we talk about same design pattern, Monad, but what is the difference in the implementation of a monad in a purely functional language with respect to the same design pattern but implemented into of the imperative programming ? What change? Sure not change the idea, but if we talk about of same design pattern implementation but into 2 different programming paradigm something must be different, probably the same information will come back, but we are using identical idea but in 2 different paradigms contexts so the side effect cannot be the same otherwise it would not have occurred to us to implement the monad for imperative language
Comment: "Recently, these structures have also been adapted to imperative languages" Are you asking about code that *generalises over* (all) Monads, or code that *uses* something that is a Monad? The latter has been present in imperative languages for a while, however *talking* about it's monadic properties is relatively recent
Comment: code that generalises over (all) Monads because I want to understand better the *difference* between 2 implementation that comes out when we choose 2 different programming styles, In imperative programming we have side effects but for me is not clear why if 'function' in functional programming representation can use a model to allow to describe function itself to a *series of steps*, that is a way to produce side effects that is that say that imperative update is a functional model
Comment: For example In a pure functional language, such as Haskell, all functions are without side effects, and state changes are only represented as functions that transform the state, which is explicitly represented as a first class object in the program
Comment: so do you mean whats the difference between e.g. haskell typclasses and scala implicts? or e.g. how do you do higher kinded types in Java (spoiler: you can't)?
Answer: The main thing I can think of is that in e.g. Haskell Monad can be captured as a typeclass in a library and so does not have to be just a design pattern. This also means you can write functions on Monads once e.g. http://hackage.haskell.org/package/base-18.104.22.168/docs/Control-Monad.html exists and the functions in it do not need to be rewritten for each type of monad
Comment: This doesn't have anything to do with being functional or not, though. It is a feature of the type system, not whether or not the language enforces referential transparency. E.g. Scala is an OO language that doesn't enforce referential transparency, and it can express the type of a Monad (all you need for that is higher-kinded generics), and it can even express type classes as a design patterns (using implicit objects and implicit parameters). There are research languages that are essentially Java + higher kinds, and those can express monads, too.
Comment: @JörgWMittag but if although pure functional languages are non-imperative, they often provide a facility for describing the effect of a function as a series of steps. Ok, but what this 'conversion method' is used to describe it as a series of steps? For example In a pure functional language, such as Haskell, all functions are without side effects, and state changes are only represented as *functions* that transform the state, which is explicitly represented as a first class object in the program.
Comment: I don't understand if 'function' representation use a model to allow to describe function itself to a series of steps
Comment: @JörgWMittag you are, of course right, this isn't strictly speaking related to functional nature of a language but HKTs, I think its still a valid observation though as OP seems to be comparing pure functional languages (which probably means Haskell) to imperative langauges that have recently added monads (which I took to mean C# & Java)
Answer: An Imperative Monad is an Object
Every time a function on an object is called, its representation is updated, causing the next function call to possibly respond differently.
The difference you are looking for is in how that Object maintains its state.

A Functional style Object would maintain an append-only internal representation.
An Imperative style Object would maintain a mutable data structure.

Append Only Data Structures
The big advantage of an append only data structure is that it support transactions, and data-sharing out of the box. For Read Only operations this is a free lunch multiple threads can be reading the same version of the data without needing any synchronisation because the data will not change.
For writers this can be fine too, as long as the only individual interested in the modifications is the writer itself. Each writer simply grows the structure in their own direction, only sharing the common past. When those updates need to be shared you will need a synchronisation mechanism to serialise, verify updates, and publish a reference to the new version.
There is a disadvantage to these append only structures, their memory is never released under active load. This leads to a massive memory leak if there is never a point in time when the slate is wiped clean. Database engines suffer from this issue, and go to great lengths to monitor who is using what version so that the engine can free memory that will never be read from again.
Mutative Data Structures
Conversely Imperative Style Objects have the exact opposite benefits. They can only safely be used by one thread (unless some very careful design is used), they are historically amnesic, and excluding a coding error they keep a tight rein on the memory they consume.
This makes them great for situations where:

memory is constrained,
they are only infrequently shared,
up to the moment state is necessary


most effective ( progsize/speed ) SD card usage

Question: I am making a project with several modules and libraries involved. I just tested the SD lib example, and got a binary at ~14KB  - way too much. I'd like the SD bits to go below 8KB, since it's just for logging from an NFC and RTC module. I notice some 'stabs' debug bits in my Makefile, and wonder if I could do something with that. Besides that, perhaps the experts here can recommend a smaller library for my SD bits, so I won't exceed my ~27KB flash capacity. I am using the SD example for creating/deleting files. Ask me to clarify if needed.
Answer: For AVR + SDCard you should check FatFs from Chang. It is widely used and proven C library. You can tweak the configuration file to get minimal size (8K shall be easy). Check wrapper library for Arduino here (6K with default options).
There is also even smaller version called Petit FAT (2-4K) but it doesn't support file delete feature.
If you would like to get smallest possible code, there is option to use Atmel Studio for programming Arduino boards, but you will loose the convenience of Arduino libraries (re-implement the libraries or find AVR versions of them, work with registers directly etc).


How was St Edwards Crown fixed after Blood flattened it?

Question: In 1671 Thomas Blood tried to steal the crown jewels. To do this he flattened the crown with a mallet. There are many sources that said he did flatten it but I cannot find anything about the aftermath. How was the crown fixed? There is nothing about a new crown being made so I assume the must have fixed it somehow.
Comment: Could you edit your question to clarify where you've searched and what you found already, complete with links and references, and context if applicable? In particular, please let us know what you find missing or unclear about the Wikipedia entry on the topic, if one exists. This allows those who might want to answer to do so without needing to redo the work you've already done. You might find it helpful to review the site [tour] and [help] and, in particular, [ask].
Comment: I have read somewhere that the crowns of the UK such as the coronation crown "Saint Edward's Crown"  and the Imperial state crown used for state opening of parliament, are often modified slightly to fit the head of the monarch who will wear them. I presume that un flattening the crown after Blood bashed would be comparatively easy, since gold is very malleable. Someone could put their fingers inside the space that was left and pull until the crown was rounder, or maybe insert levers to pry the crown wider, etc., etc..
Comment: Thank you MAGolding. Very helpful
Comment: This might be better addressed to a jeweler's StackExchange site, if there was such a thing.  You'd straighten it out just as you would any other piece of jewelry.  Gold is quite malleable, so it would be much easier than say automotive bodywork.
Answer: Gold is quite malleable, as shown by Blood's ability to flatten the crown with a few moments' work with a mallet. Reversing the damage would have been done slowly and carefully by a skilled jeweller, but there's nothing fundamentally hard about the job. My practical jewellery experience is limited, but the process would have been something like this:

Make a catalogue of all the semi-precious stones in the crown, and their positions. It's likely that a few would have fallen out during the flattening, and those would have to be searched for. The precious stones were hired for coronations (until 1911), so would not have been present for the theft.
Carefully remove all the stones (they're held in by small metal claws, often on the inside of the crown) and store them safely. Remove all the padding, fur and other trimming, and any removable parts of the gold structure. Arches of a crown are sometimes removable.
Carefully and slowly work the gold structure back into shape. This might be done by pulling with fingers or use of levers for the first stage of the unflattening. Later stages would probably have used a succession of wooden formers, which would gradually approach the shape of a head, and a soft-headed mallet to gradually bend the gold into shape.
This would also be how a crown was re-shaped to fit a new monarch's head. British coronations since the time of Charles II are held at least a few months after the new monarch succeeds, so there's plenty of time for such work.
Once the crown is in the right shape, the stones and any removable parts are re-fitted, and new trimmings are made.

This would have been a few weeks of work for a skilled jeweller and his assistants.


Can I sue my landlord if my landlord lied about which tenant they caught smoking?

Question: Long story short, I've been fighting with my landlord because my neighbor has been smoking all day and in all hours of the night (2-6 am). We share ventilation so when they smoke all their smoke comes into our room. And our room has no window and we cannot turn on the AC due to shared vents (otherwise we blow more smoke in). So in short we have been living in smoke for hours every day. My landlord went into their room once and caught them smoking. They told me if they caught them they would evict them as it is written in the contract. However they gave them another chance and when I went back to tell my landlord they still smoke, my landlord changed the tenants that she caught smoking to my other side neighbor . I told her I was sure I saw her go in to the other neighbors room, but she keeps denying it and to this day they are still smoking because she is lying and will not evict the proper neighbor.
Comment: Where are you renting? Because in a lot of jurisdictions, it is illegal to offer a room without window for rent - such a room might be considered uninhabitable.
Comment: Laws, regulations and ordinances vary around the world. If you would like a specific answer to your question then please add the relevant jurisdiction tag.
Comment: Does the smoking still interfere with you because of shared ventilation? And could you add a country?
Answer:
Can I Sue my landlord if my landlord lied about which tenant they caught smoking?

It appears that you are entitled to injunctive relief under a legal theory of landlord's breach of contract or something akin to breach of the implied warranty of habitability. Claims of constructive eviction require that you as a result of recurrent nuisance(s) leave the premises within reasonable time, which so far is not the case. Only the non-smoker neighbor would have standing to sue the landlord for his false statements of fact.
From a contract-law standpoint, any terms of your lease prohibiting smoking create a reasonable presumption that the landlord would enforce similar terms in neighboring units in order to protect you from that nuisance.
Even if your lease is devoid of language supporting the aforementioned presumption, you may sue the landlord on grounds akin to Sholberg v. Truman, 852 N.W.2d 89, 92 (2014) "[a] defendant held liable for the nuisance must have possession or control of the land", more so that now the landlord is resorting to false statements for the purpose of eluding his assurance(s) or duty to you. The landlord obviously knows that the existence of shared ventilation subjects you to adverse conditions and consequences of the tenant's recurrent violation of his lease.
You might also want to inform your non-smoker neighbor about the landlord's false statements. To avoid a situation of unverifiable "he said, she said" statements, hopefully you have (or can get) evidence in writing of the landlord's lies. In turn, you should ask the non-smoker neighbor to execute an affidavit rebutting the landlord's false statements. That affidavit will strengthen the merits for injunctive relief.
At this point the non-smoker neighbor would obtain only an award of nominal damages if he were to sue the landlord for defamation. However, this neighbor's awareness of the landlord's conduct might help the neighbor to preempt landlord's other misconduct that in the future could be detrimental to him, the non-smoker neighbor. After all, you yourself would like to become aware of false statements that other is spreading about you.


Is there a decent application for personal finances that support multiple currencies on OSX?

Question: I'd like to keep track of my finances better and wondering what good options there are out there. Preferably something that isn't geared towards Americans as my dollars tend to be Singapore ones and it'd be nice if also could track my finances in other countries in their native currency. :)
Answer: iBank sure does:

Go global. Just like your Mac, iBank works worldwide. With multi-currency support, you can set a default currency for any account, download exchange rates and calculate transfers between accounts automatically. iBank supports localization for British English, and now includes full French language support as well.

MoneyWell does as well:

Transaction-Level Exchange Rates
  Do you bank in multiple currencies? MoneyWell has you covered. You can track your spending in your primary currency while having accounts in several other currencies and store both amounts in each transaction.
Answer: Squirrel does as well.
It's got a clean interface and is easy to work with. If you're on Lion, you might want to grab the version from the Mac App Store (0.8.8 at the time of writing) instead, but that one does not currently support syncing with the iPhone version of Squirrel. iCloud based syncing will be in a coming update.
The version on the web site (0.8.7) has some small issues on Lion but can sync. It works like a charm on Snow Leopard.