QFT symmetry breaking and CP violation

Question: Since the weak interaction violates CP symmetry but electromagnetism doesnt,does it mean that the electroweak fields also violates CP symmetry?Can a field which violates some symmetry be the product of a field at lower energies which doesnt violate the same symmetry?
Comment: @CosmasZachos the EM and the Weak interaction come from a more general field the Electroweak field.The seperation of the Electroweak field happens at low energy into the Weak and EM field.EM field preseves CP symmetry while Weak Interaction field doesnt.
Comment: @Andrew Christensen At high energies there are no effects of the Higgs condensate to generate masses in the Yukawa's and give meaning to CKM mixing which underlies CP violation. ...
Comment: I'm puzzled by your question: electromagnetism preserves P, C, and CP at high and low energies, equally. Nothing about it gets it close to CP violation, which is a "fluke" inherent in charge current (charge altering) couplings of the weak interactions. Hell, you cannot  violate it for weak neutral currents either!
Comment: Indeed, but there is nothing in weak mixing that "contaminates" photon couplings, which preserve charge, with CKM matrix elements which contain CP violation. Waving arms and expecting CP violation to jump into charge-preserving vertices can't work....
Comment: Did you mean "the product of fields at _higher_ (not lower) energies which doesn't violate the same symmetry"? Most people believe the U(1) and SU(2) symmetries are the "more fundamental cause" of electromagnetism and the weak force. If so @CosmasZachos I think the question is fine - it's asking if the high energy theory with a U(1) and SU(2) unbroken symmetry/force have CP violation. And I dont know the answer :(. You'd have to look at the high energy theory and see if there's a 3X3 matrix like the CKM matrix.
Answer: I'll collect some of my comments above. The SM traces its CP violation to the complex phase of the three generation CKM mixing matrix quantifying fermion Yukawa couplings.
That is, CP violation is not a property of the gauge fields, but of their couplings to many (!!) fermions in currents with a discord between mass eigenstates and weak coupling (flavor) eigenstates. To have fermion masses, you need a Higgs v.e.v., so you might argue that CP violation is effaced at high energies.

But note, no matter what, the CKM matrix does not and cannot enter in gauge couplings to fermions of the same charge, so neutral bosons. Hence, it cannot enmesh CP violation with either the photon or the Z! Both electromagnetism and neutral current weak interactions respect CP. Weak mixing has nothing to do with CP violation...

You might then say that EM preserves CP at all energies.

QFT symmetry breaking and CP violation


important or importantly

Question: This is an important empirical properties.
This is an importantly empirical properties.
Which one is correct? Do they mean different things?
Answer: You need important.
But more importantly: neither sentence is correct due to the plural properties.

These are important empirical properties

or

This is an important empirical property
Answer: As mplungjan noted, you need to use the plural form (or the singular form) consistently, but in either case, important is the word you want to use.
Important and importantly are two different words: the first is an adjective (similar to quick, happy, stunning), the second is an adverb (similar to quickly, happily, stunningly). As a general rule (there are exceptions), adverbs can be created from adjectives by adding the -ly suffix: so usually (although again, there are exceptions), if you see a word ending in -ly, it is an adverb.
Adjectives describe nouns (He is quick), while adverbs describe verbs (He runs quickly). Since property is a noun, you need to use an adjective in your sentence.
So, the two correct sentences would be:

These are important empirical properties.
This is an important empirical property.

That said, you could also use importantly in two similar-looking sentences:

Importantly, these are empirical properties.
Importantly, this is an empirical property.

Here, the word in question is modifying the verb (is), and not the noun. However, the meaning of these sentences is different: in this case, you're not saying the properties are important, but that the fact that they're are empirical properties is an important fact.
Answer: [I prepared this but the question was migrated before I updated the screen...]
Neither is correct, and they do mean different things.
Correcting is easy: This, is and an are singular so properties needs to be singular as well (property); or, if there really are properties, then you should have These are or perhaps These are some.

This is an important empirical property.
  This is an importantly empirical property.

Important is an adjective and describes a noun, property. The property is important as well as being empirical.
Importantly is an adverb. Adverbs do not describe nouns in the same way; but they can modify adjectives. Using importantly describes empirical; it does not say anything directly about the property. We might infer that the property is important, but what is definitely important is that it is empirical. It's not a particularly good example to try to explain the difference, because importantly empirical doesn't mean very much.
A better example might be

This is an important packaged product.
  This is an importantly packaged product.

In the first sentence, the product is important and packaged. In the second, importantly describes packaged: the package makes the product look important.
The difference might be made clearer with commas and hyphens, but the usages of adjectives and adverbs fix the meaning well enough without them.

This is an important, packaged, product.
  This is an importantly-packaged product.

important or importantly


Find wrapping angle of helix on a torus

Question: I need some help in calculating the wrapping angle of a spiral helix wrapped on a torus with constant angle against all the meridians of the torus.
The wrapping angle (or the angle measured around and/or against the torus circular cross-section See here a (13,6)tori knot) always remains constant as the helix curve spirals around the torus. In layman's terms means it spirals with the same angle always. if I were to know the arc length of one such turn, my solution will be trivial: $$Arclen = {2\pi R_2\over cos(wrapping\_angle)} .(1)$$ I know this formula is counterintuitive to be true and valid regardless of R1 (torus major radius), but it is. I have an algorithm to test it out and it is true beyond any shadow of a doubt. It took me a while to figure it out, but indeed it does seem to suggest that the helix is on a cylinder, but it's on a curved cylinder (a torus). It doesn't make sense, but the formula is correct. I have a way to test it out. I'm trying to see that the tangent of any point on the curve is constant (derivative=0?? i don't know) so it projects(unwinds) as a straight line in a 2D plane. All i know is that equation 1 is correct. From here i can find my wrapping angle, where R2 is torus minor radius. This formula is valid only for 1 turn spiral helix and ONLY if I have constant wrapping angle. The thing is I don't know the arc length of one turn, but I do know R1, R2 and the azimuth angle of 1 turn (or 1 turn step-angle or the angle measured around torus central axis see it here). I want to find the arc length of 1 turn of the helix as a function of step-angle and using such formula in combination with the one I already have, I can find my wrapping angle. I don't know how to integrate but I see something in my mind along these lines: $$Arclen={ \int_0^{stp} \pi {{ \int_0^{2\pi}(R_1-R_2cos(\theta) )d\theta }\over 180} }\beta d\beta =something .(2)$$ I don't know what this is. I believe it's some sort of a double integration in polar coordinates(?) of infinitesimal circle-arcs which i know nothing about. stp is my step_angle, $\theta$ is the infinitesimal angle made by R2 in respect to equatorial plane of torus, and $\beta$ is supposed to be the step_angle chopped down into infinitesimal bits. I know equation (2) is wrong, but let's say it's not, then i write: $$equation(1)=equation(2) => wrapping\_angle=arccos({{2\pi R_2} \over something})$$ Since equation(2) is wrong, I also see in my mind something like this: $$Arclen=\int_0^{stp} (\sqrt{(\pi [\int_0^{2\pi}(R_1-R_2cos(\theta)) d\theta]*{\beta \over 180})^2+(\int_0^{2\pi}{{\pi R_2\alpha} \over180}d\alpha)^2})d\beta . (3)$$ I don't know how to integrate. Please don't ask me where i got these equations. Maybe they can provide a place to start for you to help me. I just need a little bit of help to correct this mess. Can you help?
Comment: This is a nice question, but consider using MathJax to make it more easily readable :)
Comment: Although it's immediately obvious to me that your constant wrapping angle interpretation of constant torsion would be correct on a (flat) cylinder, it's far from obvious to me on a torus sitting in $\Bbb R^3$ (or are you thinking of a flat torus in $\Bbb R^4$?), since its curvature varies as you go around the cross-sectional circles. I guess I'd like to start by asking you what you mean by a helix on the torus (unless it's in the $\Bbb R^4$ interpretation).
Comment: I have no idea what you just said to me. I know equation 1 is counterintuitive to be true and valid regardless of R1, but it is. I have an algorithm to test it out and it is true beyond any shadow of a doubt. It took me a while to figure it out, but indeed it does seem to suggest that the helix is on a cylinder, but it's on a curved cylinder (a torus). It doesn't make sense, but the formula is correct. I'm trying to see that the tangent of any point on the curve is constant (derivative=0?? i don't know) so it projects as a straight line in a 2D plane. All i know is that equation 1 is correct.
Comment: I'm trying to work out the parametric equation of a curve that makes constant angle with the (small) circles on the torus. That's what you're calling a wrapping angle. Helices on cylinders are *totally* different, as cylinders are the same everywhere around; this is far from true on a torus. On the torus, the curve must twist around the torus faster on the inside of the torus than it does on the outside of the torus. I'll write down an explicit parametric equation in a minute. Then computer algebra can compute the torsion ...
Comment: "On the torus, the curve must twist around the torus faster on the inside of the torus than it does on the outside of the torus". Not always true. There are exceptions. See the pictures attached. The curve in the pictures (torus knot with constant torsion) can clearly see it doesn't twist faster on the inside of the torus than on the outside. The twist (torsion) remains constant because the wrapping angle is constant.
Comment: I finally realized that you're not using the word "torsion" in the usual sense of differential geometry. Nevertheless, I've written down a quite complete solution of your question. It's pretty complicated.
Comment: The question should be edited to remove the word _torsion_, since it has a wholly standard meaning in the context of curves in $\Bbb R^3$ that does not agree with the meaning intended here.
Answer: The curves you have described do not have constant torsion (in the usual technical sense of differential geometry). The condition that the curve make a constant angle with the meridian circles on the torus leads to a very complicated parametric equation. For any value of the constant $c$, here is such a curve on the torus obtained by rotating a circle of radius $1$ around a circle of radius $2$:
$$\alpha(t) = \big((2+\cos t)\cos\theta(t),(2+\cos t)\sin\theta(t),\sin t\big),\quad \text{with }\theta(t)= c\arctan\Big(\dfrac{\tan(t/2)}{\sqrt3}\Big).$$
You could replace $2+\cos t$ with $2+\cos at$ for some constant $a$. I haven't had the fortitude to work everything out in that generality.
Now, for the constant value $c$ appearing in the formula above, we find that the speed of $\alpha(t)$ is $\sqrt{1+c^2}$, and the arclength of one trip around the torus will be
$$L=\int_0^T \|\alpha'(t)\|dt = T\sqrt{1+c^2},$$
with $T$ given by $\int_0^T \theta'(t)\,dt = 2\pi$. So this gives us
$$2\pi = \theta(T) = c\arctan\Big(\dfrac{\tan(T/2)}{\sqrt3}\Big), \quad\text{so ... drumroll ...} \\
T = 2\arctan\Big(\sqrt3\tan\big(\frac{2\pi}c\big)\Big).$$
Finally, the arclength is
$$L=(\sqrt{1+c^2})T = 2\sqrt{1+c^2}\arctan\Big(\sqrt3\tan\big(\frac{2\pi}c\big)\Big).$$
I should add that your wrapping angle is given by
$$\cos(\text{wrapping angle}) = \frac1{\sqrt{1+c^2}}.$$
Comment: "The condition that the curve make a constant angle with [ALL] the meridian circles on the torus..." FINALLY someone understands me and what I'm after.
"[such a condition]... leads to a very complicated parametric equation" Yeah...I know. Obviously ...that's why I'm here.
Comment: I'm scratching my head like crazy here. You don't know who you're talking to. I'm as dumb as a rock and have a complete nonsensical terminology. That's why nobody seems to understand me. Anyway I'm trying to decipher your equations, and I just can't visualize them. What exactly is c? where did that $\theta (t)$ came from? that sqrt(3) smells strange to me. Where did that came from? What is "speed of α(t)" ? Never heard of such a concept. Is someone chasing my curve and it's on a run? I'm confused and a complete idiot. How do I visualize "speed of α(t)"?
Comment: What is this new variable T that came out of nowhere? Is that my step_angle? (see pictures in the original post) I need to picture all these variables in my head and what they represent in 3D space. That's when I can say I finally understand your reply.
Comment: You've lost me at defining the parametric equation:
α(t)=
(
x=(R1+R2*cos(t))cos(u)
y=(R1+R2*cos(t))sin(u)
z=R2*sin(t)
)
where
u=c*atan(    tan(t/2) / sqrt(3)    )
R1 is torus major radius
R2 is torus minor radius
t - the incremental unit angle forming the curve. It's values are from 0 to k*2*pi ; where k is number of full 360degrees trips around the torus main axis my curve does. (See what I'm doing? I'm explaining all my variables and what they represent in 3D space such that any simpleton like me understands the math behind it)
Comment: c - an unknown mysterious constant (unable to visualize in my mind in 3D space what this c is and does)
All these I believe are the parametric equations for the Cartesian coordinates(x,y,z) of any given point on my curve in 3D space. I'm just extremely confused why you haven't wrote them like I did from the very beginning? I'm as dumb as a rock. Why confuse me even further?
Comment: Can I yet again call upon your kindness to elaborate a little bit upon what all these variables mean? In which formula or equation do I plug my step_angle,R1 and R2 variables to get my wrapping angle?
Comment: Agh. I just answered and lost the whole thing looking at your insert. You really should NOT use the word torsion, as it means something else to mathematicians. As I said at the end, the wrapping angle has its cosine related to $c$ as I said. I'm using the standard parametrization of the torus, but putting in a curve that goes at speed $1$ around the circle of radius $1$ and goes at variable speed $\theta'(t)$ around the large circle so as to keep your wrapping angle constant. (That's why there's a crazy formula for $\theta(t)$.  I had to solve for constant angle and then do an integral.)
Comment: As I said, $T$ is the value of $t$ I need to make $\theta$ start at $0$ and end up at $2\pi$, so I've made one trip around the torus (horizontally viewed). I assume that's what you intended.
Comment: One last comment: I'm sorry if I have to use multivariable calculus here. It's hard to do precise mathematics like this without it.
Answer: Ted Shifrin answer to my original question is incomplete and I can't use it the way it is. The almost-complete version is like this:
$$\alpha(t)=\begin{pmatrix}
x=\Big(R_1+R_2\cos(t)\Big)\cos\biggr(c\arctan\Big(\dfrac{(R_1-R_2)\tan(t/2)}{\sqrt{R_1^2-R_2^2}}\Big)\biggr)
\\y=\Big(R_1+R_2\cos(t)\Big)\cos\biggr(c\arctan\Big(\dfrac{(R_1-R_2)\tan(t/2)}{\sqrt{R_1^2-R_2^2}}\Big)\biggr)
\\z=R_2\sin(t)
\end{pmatrix}$$
I have injuries for scratching my head trying to more or less do semi-educated guess what extra terms goes where by trail and error (https://en.wikipedia.org/wiki/Trial_and_error)
That's because I'm an engineer not a mathematician which should make sense to as why I did it like this.
Using "consecrated" math terminology from here: https://en.wikipedia.org/wiki/Toroidal_and_poloidal
(I hope it's ok to use the word "consecrated" in the meaning to "to devote to a purpose with deep dedication" (according to Merriam-Webster dictionary) english is not my native language so I'm asking for leniency)
Let there be the term : "toroidal direction step angle" or the angle done in toroidal direction by only 1 poloidal turn of my curve (a STEP in the right way - literally).
Therefore I can't show mathematically, but have proven undoubtedly in numerous tests and experiments that:
$$c=\frac{\text{step angle°}}{180} $$
$$\text{1 poloidal turn wire length}=\frac{2\pi R_2}{\cos(\text{wrapping angle})}  $$
$$\text{step angle°}=\frac{360R_2\tan(\text{wrapping angle})}{\sqrt{R_1^2-R_2^2}}$$
$$\text{wrapping angle°}=\arctan\biggr(\frac{\text{step angle}\sqrt{R_1^2-R_2^2}}{360R_2}\biggr)$$
Again, emphasis on how these equations were determined: semi-educated guesses, trial and error a dose of madness and insanity and lots of dedication and perseverance.
These formulas never failed me so far for any value of $R_1$ , $R_2$, c, step angle or wrapping angle.
Of course for the answer to be complete, I would have to replace $R_1+R_2\cos(t)$ with $R_1+R_2\cos(at)$ for some constant "a" representing how many turns in the poloidal direction my curve does in the same step angle, the final goal being to generate a special family of closed curves tori knots (with curve tangent(aka velocity vector) always constant against all meridians and parallels of the torus)
I was asked to provide more context to my question:
https://www.researchgate.net/publication/311742883_Visualization_in_3D_of_Dynamics_of_Toroidal_Helical_Coils_in_quest_of_optimum_designs_for_a_Concordian_Mandala
I would like to add some sentences (which most likely will be deleted by someone):

Nothing less than a miracle or a fluke for a professor like Ted Shifrin answering my question.
My question was written with sloppy terminology.
It would have been amazing to have seen the math he did behind the scenes for the parametrization of such curves.
Can I hope for yet another miracle?

Why is speaking like this forbidden on this forum? Reading between the lines 1st sentence shows gratitude towards altruism, respect and awe. 2nd- introspection, constructive self-criticism and honesty. 3rd mild regret, call for compassion and desire. and 4th expectation and hope
Why speaking (in and with) these terms illegal on this forum? Aren't these aspects extremely important in any form of communication? As a newbie on this forum I'm very confused... Yes... stick to the math and disregard and delete everything else...monstrously strict and rigid.

Find wrapping angle of helix on a torus


File Drop Automation can't work

Question: I have an automation triggered by File Drop. when the file is dropped , it will be imported to a staging data extention(overwrite).
now here is an odd thing: when I upload a file name as
"AAA_TEST_%%Year%%%%Month%%%%Day%%_%%Hour%%.csv" , it can trigger the automation, and automation runs successfully. However, the data in the staging DE still can't be overwrite and still previous data ,seems the import activity doesn't work.
I have tried many times but still keep failing.
Comment: Can you share the whole automation and the import activity? does the import work correctly?
Comment: Add your email to receive the notifications from the Import Activity - it will send you a summary each time the import runs and you will get all the details of what happened and if there were any errors. Without it, it's impossible to troubleshoot. Once you have those details, please include them in your original question.
Comment: As @SebOB pointed out this is how your import activity is configured and not the file drop trigger
Comment: Did you manage to try out my suggested solution?
Answer: You should replace your personalisation string with %%BASEFILENAME_FROM_TRIGGER%%.csv - this is IMHO the most solid solution, as you avoid issues with time zones etc. you can get more details here

File Drop Automation can't work


Generating n statements from context-free grammars

Question: So not to reinvent the wheel, I would like to know what has already been done about generating random statements from a context-free language (like those produced by yacc, etc.). These grammars are primarily for parsing, but maybe someone has done some generation for testing the parsers?
Thanks
Comment: Similar to "fuzzing" (http://en.wikipedia.org/wiki/Fuzz_testing), perhaps some of that work can be leveraged.
Answer: Check out this blog post. Basically, it randomizes the RHS chosen at each rule application.
Answer: There's an ancient but still interesting article here that shows why you need a few more constraints for effective generation of random sentences than you do for parsing -- it also suggests a simple way of providing those extra constraints and gives a complete example program (...in Fortran IV... but, hey, it is over 40 years old...!-).
Unfortunately I am not aware of any more recent work on this subject (or implementations in more modern languages -- but transcoding the Fortran dusty deck to whatever language you like best shouldn't be as hard as coming up with these concepts on one's own;-) -- this is just the kind of already-ancient stuff I perused in actual paper-based libraries back when I was in college, and I'm amazed that the ACM's online search facilities allowed me to locate the reference I vaguely remembered, so rapidly (kudos, ACM!-).  I have never done any original research on this subject.
Answer: Generation of a sequence of random tokens like this is sort of strightforward; starting with the goal symbol, pick any random expansion of unfilled nonterminals.  You probably want some kind of branch-and-bound search down any branch of generated parse tree so you can control depth/size.
But I don't see a lot of value in testing parsers this way, at least not if your parser generator accepts the context free language description directly.   This happens when you use a full context free parser generator/tool such as GLR (which is what we use in our program transformation system, DMS) or an Earley parser.
You have another problem: if you want to test a parser, you need to feed it what it wants, and surely that isn't tokens.   Now you have to generate valid lexemes for the terminal leaves.  That's not too hard either, but it you wanted to be purist about this approach you'd write your grammar in scannerless style.
But the last problem is that it is hard to find a context free grammar for most languages.  So now you have to debug your gold grammar too; how will you do that?
Once you get to that stage, you're likely to just give up, debug the parser, and get on with your life.
Generation of random subtrees is useful in error recovery, if you can splice in the random tree to fix the source stream.  We do a simplified form of this for DMS's parser, which means we have only one piece of error handling machinery.


God Shiva's Beeja Mantra

Question: Please let me know the correct pronunciation of God Shiva's Beeja or moola mantra- is it hauh or hraum or haum?
Comment: Moola Mantra and Bija of a deity are not the same.. Haum is the Shiva bija and not the other two. The other two may be found in some Shiva mantras as supporting Bijas but the Shiva Bija is Haum only. Take for e.g Hamsa (parabrahman) Mantra .It is formed by adding Shiva bija (Haum) and Parashakti Bija (Sauh).
Comment: @Rickross thanks. Can you please put the same in answer and let me know the moola mantra as well and  if possible can you give the name of the scripture where Haum Beeja is mentioned.
Answer: Finally was able to get the needed reference from the book Sarva Devdevi Mantrakosha.
(This book gives numerous Mantras from the Tantras first in the coded forms and then decodes them into their chantable/recognizable forms. The drawback of this book is it's completely in Sanskrit without Bengali/English translations and it also does not specify which particular Tantra the verses given are from).

Atha Shiva MantrAh:   --- (Coded) SAntamaukAra samyuktam Bindu bhustimastakam | PrAsAdAkhyo manuh prokto bhajatAm kAmado manih |
  (Decoded) Haum |

So, as you can see first the Shiva Beejam or Mula is given in the code. To decode it we proceed as follows:
The 51st/last letter in Sanskrit is Ksha, so last but one (Sa+anta) is Ha. Add to it Au-kAra and finally add Bindu at the end/top :  - This gives us Ha+au+m=Haum as the Shiva Bija Mantra.
Note that it also states that Shiva Bija is known as "PrasAda" too. That's why the Hamsa Mantra is known as ParAprAsada Mantra (ParAshakti+Shiva/PrasAda) in KulArnava Tantram.
I am giving few other Tantric Shiva Mantras along with:

Mantra1:
Coded - Bhuvaneshi pranavam namaha shivAyah bhuvaneswari ||
Decoded - Hrim om namah shivAya hrim ||
Mantra2:
Shadaksharah shaktiruddhah kathithohashtAksharohaparah  .... ||
Decoded - Om hrim hauh namah shivAya ||
Mrityunjaya Mantra (short form) -
Coded -- TAram sthiro sakarnendubhriguh sarga samanvitah |
  TryaksharAtmA nigadito mantro mrityunjayAtmakah ||
Decoded - Om jum sah ||
Mrityunjaya (full form) -12 lettered
Om jum sah pAlaya pAlaya sah jum Om ||
DakshinAmurty Shiva Mantra -
Coded - Pranavam hridayam pashchAttato bhagavate padam .... ||
Decoded - Om namo bhagavate dakshinAmurtaye mahyam medhAm prajaccha
  swAhA ||

Note - Chanting these Mantras should not be done without first taking them from the Guru. Mantra chanting without knowing the limbs is also useless (and I have not given the limbs here). So, the info given here is only for the sake of answering.

God Shiva's Beeja Mantra


erfc lower bound

Question: I've seen the following lower bound for the complementary error function (erfc) but I haven't been able to prove it.  Does anyone know how to establish the following?
$$erfc(x) > \frac{ x \exp(-x^2) }{ \pi(1 + 2x^2) }$$
Answer: Paradoxically, it is quite easier to prove stronger bounds.
Let $X$ be a random variable with gaussian distribution and density $$ f(x)=\frac{1}{\sqrt{2\pi}}\exp(-x^2/2).$$
Now let, for any $k\in\mathbb{R}^+$,
$$A_k = \sqrt{2\pi}\;\exp(k^2/2)\;\mathbb{P}[X>k] = \sqrt{\frac{\pi}{2}}\;\exp(k^2/2)\;\operatorname{Erfc}\left(\frac{k}{\sqrt{2}}\right).$$
Since $\mathbb{E}\left[\left(X-\mathbb{E}[X]\right)^2\right]\geq 0$, $\mathbb{E}[X^2]\geq\mathbb{E}[X]^2$, and the same holds for the conditional expected values, under the hypothesis $X>k$. That gives, in terms of $A_k$:
$$ (1-k\; A_k)^2 \leq A_k\;\left(-k+(1+k^2)\; A_k\right), $$
that can be restated as:
$$(\heartsuit)\quad A_k^2+k\;A_k-1\geq 0.$$
From:
$$ A_k \geq \frac{2}{k+\sqrt{k^2+4}}, $$
we immediately have a lower bound for the $\operatorname{erfc}$ function:
$$ e^{k^2}\;\operatorname{erfc}(k) \geq \frac{2}{\sqrt{\pi}}\left(\frac{1}{k+\sqrt{k^2+2}}\right).$$
An interesting fact is that the "reverse inequality"
$$(\spadesuit)\quad (1-k\; A_k)^2 \geq \frac{2}{\pi}\;A_k\;\left(-k+(1+k^2)\; A_k\right), $$
equivalent to:
$$(\spadesuit_2)\quad\pi\left(\int_{k}^{+\infty}(x-k)\;e^{-x^2/2}\;dx\right)^2\geq 2\int_{k}^{+\infty}e^{-x^2/2}\;dx\int_{k}^{+\infty}(x-k)^2\;e^{-x^2/2}\;dx,$$
holds, too. Since:
$$A_k =\int_{0}^{+\infty}\exp\left(-x^2/2-kx\right)\,dx, $$
by using the Fubini-Tonelli theorem and switching to polar coordinates one can see that $(\spadesuit_2)$ is equivalent to:
$$\int_{0}^{+\infty}\rho^3 e^{-\rho^2/2}\int_{0}^{\pi/4}(\pi\cos(2\theta)-2)\; e^{-k\rho\sqrt{2}\cos\theta}\;d\theta \; d\rho\geq 0, $$
also equivalent to (by integrating by parts):
$$\int_{0}^{+\infty}\rho^3 e^{-\rho^2/2}\int_{0}^{\pi/4}(\pi\sin\theta\cos\theta-2\theta)\;k\rho\sqrt{2}\sin\theta\; e^{-k\rho\sqrt{2}\cos\theta}\;d\theta \; d\rho\geq 0, $$
that is trivial since over $[0,\pi/2]$, by the concavity of the sine function, we have $\sin\phi\geq\frac{2\phi}{\pi}$. Following the line of the previous proof, the $(\spadesuit)$-inequality can be used to have tight upper bound for the $e^{k^2}\;\operatorname{erfc}(k)$ - function. Moreover, from the $(\spadesuit_2)$-inequality the convexity of $\frac{1}{A_k}$ follows.
Answer: Durrett, Probability: Theory and Examples, 3rd edition, p. 6 gives
$$(x^{-1} - x^{-3}) e^{-x^2/2} \le \int_x^\infty e^{-y^2/2} \: dy $$
The proof Durrett gives is from the observation that
$$ \int_x^\infty (1-3y^{-4}) e^{-y^2/2} \: dy = \left( x^{-1} + x^{-3} \right) e^{-x^2/2} $$
which I suspect can be found by integration by parts, although I haven't written it out; in any case, differentiate it to check.
After this, some changes of variables give
$$ \left( {1 \over z} - {1 \over 2z^3} \right) e^{-z^2}/\sqrt{\pi} \le erfc(z). $$
Finally, $z/(1+2z^2) < 1/z-1/(2z^3)$ for $z > 2^{-1/4}$, giving your bound for $z > 2^{-1/4}$ if $\pi$ is replaced with $\sqrt{\pi}$.
Obviously this is a hack trying to get your proposed bound in the form of the bound I already knew, but hopefully it helps.
Answer: Here's an approach that will establish the inequality, but it doesn't provide any insight into where the inequality came from.  Let f(x) be the left side minus the right side, i.e.
$f(x) = erfc(x) - \frac{ x \exp(-x^2) }{ \pi(1 + 2x^2) }$
Clearly $f(x) > 0$ and $ \lim_{x\to\infty}$ $f(x) = 0.$ A calculation shows that $f'(x) < 0$ for all $x > 0$, and so $f(x)$ must be positive for all $x > 0$. See these notes for details.  The notes also state improved bounds but without proof.

erfc lower bound


How to recover Ubuntu partition after computer failure?

Question: Recently my computer broke down and the Linux Ubuntu 10.04 partition could not be loaded back. What should be done to recover it back? What could be the possible error?
Comment: Could you explain exactly what you see when you turn ont he computer and exactly what it does. Could you also explain any steps you've taken to bring your computer back, such as reinstall windows etc.
Answer: Testdisk may be helpful for you.
A video can be reached on: http://www.youtube.com/watch?v=EncqYP1ijFg&feature=player_embedded
NOTE: Testdisk will bring back any partitions you accidentally erased or lost. But some data may not come back with the partition. However, you can gain access to that data when the partition table is available again.
Good luck!
BTW: Testdisk and useful information related can be reached clicking here: http://www.cgsecurity.org/wiki/TestDisk
Answer: Boot from a "rescue" disk or just a live CD and run fsck on all of your partitions.
To do fsck:
Type fsck partitionname in terminal


Custom Notification now showing in production

Question: I recently played around with the process builder in a sandbox, and managed to create a scheduled event that would send a custom notification to a user. I finally have a purpose for this feature, but it simply doesn't show up under actions in the flowbuilder in production. Picture of the feature in the sandbox attached.
Comment: You created the action in sandbox but are looking to find it in production?
Answer: This is a feature that is new in Summer 19. When your production org is upgraded, you'll be able to use this feature in production.


Banner Stats and Google Analytics Using PHP

Question: I have created an affiliate banner script which is, from what I have seen, is quite unique.  I am limited by an NDA so please understand if I cannot provide actual pages or the domain name.
The affiliate has an option of eight different banners of various sizes.  The code provided to the affiliate is all in CSS layout - simple divs and paragraphs - with a single anchor containing no onclick call and the src contains no query string.  The affiliate code also provides a call to a javascript file on my client's server.  The anchor text (keywords) varies based on affiliate_id.  The src of the script call defines the banner type and the affiliate id in the format: http://www.somedomain.com/banner_dir/affiliate_id/banner_id/.  Using .htaccess, the index page in the banner_dir has the extension .js but interprets PHP code.  The index.js parses out the directory structure to extract the affiliate_id and banner_id.
If you can follow this so far, the index.js using PHP creates a session on the client's server which assigns the session vars affiliate_id, banner_id, keywords and referring domain.  Statistics are saved to a couple of stats tables.  The script drops out of PHP, then writes to the affiliates page the style sheet for the banner using document.write().
In summary, what I have done here is to create a cross-domain cookie using every trick in I could come up with with the intent of creating content on a remote server which will maximize SEO for my client, with minimal negative SEO.  And, yeah, it works.
When the banner is clicked, there is interpretive code on the client's server to record a click of the banner pulling the values from the session.
So far  have met every requirement by the client except one.  He wants to pass the statistcs to his Google Analytics account.  I need to be able to generate stats for the display and click of the banner based on affiliate_id, banner type, and keywords.  The client needs to be able to evaluate the efficacy of keywords and banners and performance of affiliates.  Ideally, we would be able to track the customer from a banner view to the successful sale.
In the past, I have used tracking code using a link structure similar to that I am using for the JS call to client's server, though, in this situation, I think a campaign would be more effective in generating the stats.
I can pass the initial GA code when the index.js script exits but I have some problems with the click thru event.  I want to avoid using a click event when the anchor in the banner is clicked, keeping the code as clean as possible.  Ideally, I would like to make a background call when my client's site is accessed, since the code which interprets the session data involves a PHP redirect and nothing can be written prior to the redirect without error.
Any questions, comments or suggestions?
I haven't quite gotten the hang of the interface of this venue, so please excuse post lower in this thread.  Anyway, this is the code I am using.  The data is being posted from the click and display scripts via cURL and I know it is being called.  However, the data is not getting to Google Analytics.
<code><?
$f = $_POST['banner'];
$a = $_POST['affiliate_id'];
$r = urlencode ($_POST['referrer']);
$k = $_POST['keywords'];
// $_POST['c'] = the click event
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
     <title>GA Display script</title>
<script type="text/javascript">
var _gaq = _gaq || [];
function loadtracking() {
_gaq.push(['_setAccount', 'UA-XXXXXXXXXX-X']);
_gaq.push(['_setCampNameKey', 'banners']);    // name
_gaq.push(['_setCampMediumKey', '<?=$f?>']);  // image
_gaq.push(['_setCampSourceKey', '<?=$a?>']);  // source
_gaq.push(['_setCampTermKey', '<?=$k?>']);   // term/keyword
_gaq.push(['_setReferrerOverride(<?=$r?>)']);
_gaq.push(['_setCampContentKey', '<?=$k?>']);  // content
_gaq.push(['_trackPageview']);
<?if ($_POST['c'] == 1){?>
_gaq.push(['_trackEvent', 'banners', 'Click', 'Banner Click-thru']);
<?}else{?>
_gaq.push(['_trackEvent', 'banners', 'Display', 'Banner Display']);
<?}?>
(function() {
    var ga = document.createElement('script');
    ga.type = 'text/javascript';
    ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(ga, s);
  })();
}
loadtracking();
</script>
</head>
<body>
</body>
</html>
</code>
Answer: This sounds like a job for ajax. You state that you don't want to be dependant on a click event so instead you want to act when your client site is accessed. If you create a remote javascript file and add a reference to it on the client's site, would this not serve your intentions?
Let me know if I understood you correctly or if that helps in any way.
Comment: Just a followup here. I have everything working except for the GA tracking code.  It is another hybrid PHP/JS script which is called from both the banner display and click scripts.  I am using cURL to post the variables (which are assigned in the first few lines of the following code for clarity).  I know the script is being called successfully as I had it email me with the post array in the development process.  However, the data is not being received by GA.  It is likely something silly I am not seeing.


Legal situation for Parkour in the EU

Question: I often wonder if it's even legal to practice Parkour in the cities of the EU? The runner is kind of trespassing the plots, isn't he?
Comment: Depends on where their doing it. Trespass law is the same regardless of what activity you do.
Comment: I would migrate to Law, but the question is too old. You could ask it on Law if you like.
Comment: Would this be moot for an experienced practitioner, because the police wouldn't be able to keep up or catch them?
Comment: Depends on the city... On buildings etc. I doubt the Houses of Parliament would appreciate you running up against their limestone and often in repair walls just so you can do a backflip or something. Even if there is not legislation to stop you.
Comment: As Liam mentioned, it is up to whether you (i.e. the public) have access to the area. Parkour specificly it depends on the particular rules within that area and maybe some kind of "public disturbance" law that might be applied to Parkour.
Comment: Trespass law is very different across the countries of the EU (eg in Scotland we don't really have a trespass law as such) and in many cases stopping parkour is really only done where damage occurs
Answer: This will vary from country to country - I can only speak for the UK.
In practice you are likely to be OK provided you are responsible and apply common sense.
Obviously, if you are on private land without permission you are trespassing and breaking the law. So ask the owner or stick to public land.
If you are on public land you could still cause criminal damage to structures and surfaces. Section 1 of the Criminal Damage Act 1971 states:

A person without lawful excuse destroys or damages property belonging to another intending to destroy or damage any such property OR BEING RECKLESS AS TO WHETHER ANY SUCH PROPERTY WOULD BE DESTROYED OR DAMAGED SHALL BE GUILTY OF AN OFFENCE.

So check that structures are stable and don't be reckless.
You could also be charged with causing obstruction if you train in areas with heavy footfall, or with breach of the peace if you disturb or frighten other users of the space.
Parkour UK also point out that you have a responsibility to be aware of young children nearby who may be unduly influenced by your actions.
If you don't cause damage or annoy anyone, it's unlikely that the police will become involved. If the police do turn up, just be polite and respectful. In the opinion of one freerunner turned police officer: "I would say there is VERY little they can go on to actually arrest you." (http://goo.gl/jmlYii)
Some people find it helps to be wearing a T-Shirt with the logo of a club or association, to make it clear that you are athletes and not just yobs.
Comment: The OP asking about EU and the only answer being about UK is quite ironic :P
Comment: Well, we're still part of the EU for the time being!
Comment: +1 but can you give a source for the police quote?
Comment: Source added as requested.

Legal situation for Parkour in the EU


Unable to stop TOSHIBA TransMemory

Question: I have a USB,when I choose safety remove, occur this error message.How to solve the problem?
Unable to stop TOSHIBA TransMemory
Error detaching: helper exited with exit code 1: Detaching device /dev/sdb
USB device: /sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2)
SYNCHRONIZE CACHE: synchronize cache(10):  Fixed format, current;  Sense key: Key=9
 Additional sense: Logical unit not ready, cause not reportable
  Info fld=0x0 [0]
FAILED: No such file or directory
(Continuing despite SYNCHRONIZE CACHE failure.)
STOP UNIT: start stop unit: transport: Host_status=0x07 [DID_ERROR]
Driver_status=0x00 [DRIVER_OK, SUGGEST_OK]

FAILED: No such file or directory
Answer: Maybe you could try manually unmounting the usb drive from the terminal.
Identify
First you will need to know the mount point or the device. You have a few options but in your case I think the first will tell you what you need to know.
1.To see information about currently mounted systems, simply run:
mount

2.To see a list of your USB devices (the vendor and device ID's), run:
lsusb

3.To see all attached storage devices and their partitions, run:
sudo fdisk -l

Unmounting
Unmounting is done through the "umount" command, which can be given a device or a mount point
sudo umount /dev/sdb1

or:
sudo umount /media/external

Would both unmount the filesystem on /dev/sdb1 if it is mounted on /media/external.
Remember that a filesystem cannot be in use when it is unmounted, otherwise umount will give an error. If you know it is safe to unmount a filesystem you can use:
sudo umount -l /mountpoint

To do a "lazy" unmount
Reference Links
https://help.ubuntu.com/community/Mount/
https://help.ubuntu.com/community/Mount/USB

Unable to stop TOSHIBA TransMemory


Deriving the Lorentz factor $\gamma$

Question: Recently, I learned how to derive $E_0 = m_0c^2$. However, to do so, one must accept the relativistic mass equation. How does one derive the Lorentz factor $\gamma$?
Comment: I'm pretty sure you just let $p=\gamma m_0v$ and the rest sorts itself out from there
Comment: @Jimnosperm This might sound dumb, but I never learned how to derive the Lorentz factor. So, how do you?
Comment: this might answer your question: http://physics.stackexchange.com/a/171121/75518
Comment: Or this: http://physics.stackexchange.com/q/80511/23473
Answer: After some searching, I found a very simple way to do so.

The blue disks shows show light traversing up a rod. If the rod were stationary then the light would reach the top in ct where t starts at t' = 0. However, with the horizontal motion of the rods, the light takes a diagonal path, indicated by the red line. By the Pythagorean Theorem, we get $$d^2 = l^2 + (vt)^2$$ (d being the distance of the first half of the red line)
Since l = ct, we get $$d^2 = c^2t^2 + v^2t^2$$
Since d = ct', we get $$c^2t'^2 = c^2t^2 + v^2t^2$$
Solving for t', we get $$t' = \dfrac{t}{\sqrt{1-\dfrac{v^2}{c^2}}}$$
Divding by t, we get $$\frac{t'}{t} = \dfrac{1}{\sqrt{1-\dfrac{v^2}{c^2}}}$$
Which is the Lorentz Factor
Comment: @Jimmy360
This is incorrect. At the [Since d=ct'] step you made a mistake.
The distance is not proportional to t, but to t' like this:
(ct′)^2 = (ct)^2 + (vt')^2
Comment: Small typo: 'Since l = ct', we get' should be 'Since l = ct, we get'
Comment: Where from do you suppose that the length of the moving rod (normal to its motion) is the same as the length of the rest rod $\ell'=\ell$  ???
Comment: This explanation is lame and gives the correct answer just by coincidence (just to 'fit' into Pythagorean Theorem). Why rod is dragging light within itself? Speed of light doesn't depend on motion of its source. In this example it DOES.
Comment: @m8labs c doesn't change with the speed of the source. That's why this derivation works in the first place. The thing that must change is time, not c.
Answer: We can use the fact that the speed of light is the same in every inertial reference frame:
$$c=\frac{dx}{dt}=\frac{dx'}{dt'}$$
From that we can construct the space-time interval:
$$(ds)^2=c^2dt^2-dx^2$$
The space-time interval is invariant in every inertial reference frame.
$$(ds)^2=(ds')^{2}$$
In proper frame, the space-time interval has the following form:
$$(ds)^2=c^2dt^2$$
where $dt$ is usually written as $d\tau$ and it is called the proper time.
We know that the space-time interval is the same in every inertial reference frame, so we can write that the space-time interval in our proper frame is equivalent to any other inertial reference frame:
$$c^2d\tau^2=c^2dt^2-dx^2$$
Divide both sides by $c^2dt^2$:
$$\frac{d\tau}{dt}=\sqrt{1-\frac{v^2}{c^2}}$$
so:
$$d\tau=dt\sqrt{1-\frac{v^2}{c^2}}$$
or:
$$dt=\frac{d\tau}{\sqrt{1-\frac{v^2}{c^2}}}=\gamma\cdot d\tau$$
Comment: This should be accepted answer.
Answer: I think the Lorentz factor is wrong because it's based on Einstein's 2nd postulate which implies that the speed of light is constant irrespective of the motion of the emitting body. However, most people apply it as if it were constant for all observers.
In any case, it's a postulate i.e. an assumption. Einstein used the speed of light as constant after Maxwell calculated its value from the permeability and permittivity of free space which are constants and cannot vary under any circumstances.
If you move an electric charge in front of a magnetic field detector, it would detect the presence of a magnetic field. More importantly, if you move a magnetic field detector in front of a static charge, it'll also detect a magnetic field. Hence, electromagnetism is subject to relativity as Galileo implied. Well, he said that everything is relative.
Now light is made of photons which are electromagnetic particles. That means that velocity will interfere with the strength of the magnetic field. And it's either the velocity of light relative to the observer or the observer's velocity to that of light - they're equivalent. Maybe that's how the Doppler shift happens. We don't know what wavelength refers to. Maybe it's inversely proportional to the strength of the magnetic field component of the electromagnetic field.
Keeping the strength of the magnetic component of the electromagnetic field invariant across all frames of reference, may be a mistake. This means that all forms of relativity may be wrong. I'm certain of it. It could turn out that Galilean transformation was the right one to use after all.
Comment: If you really believe that Einstein was wrong you need to propose the alternate hypothesis and show how it explains all the same phenomena that SR and GR do.  Personal speculation with no justification has no place in answers at this site.
Comment: If a photon is ahead of you and you try to accelerate to catch up with it, you'll fail because, according to SR, the photon will always be travelling at the speed of light in front of you and the distance between you anf the photon will always be greater than 300,000 km and will keep increasing at the rate of 300,000 km per second.
Comment: @KasimMuflahi relativity is a bit about different phenomena, which is most people have no idea of, but still trying to wrap their heads around (including you and me). As I understand it, you will MEASURE it still 300000 km/s, but outside observer will of course see you (say take video of you) travelling with the same as light speed. And you will be frozen on that "video", making your measurements for infinite amount of time. From your POV it's ok, it's just the observer live its life 'fast'.

Deriving the Lorentz factor $\gamma$


Can radiation affect gravity?

Question: I was wondering if the sun's radiation affects the gravity when it passes through space? Like can radiation strengthen or weaken the force of gravity?
Answer: Radiation has energy, and energy exerts gravity. You could say that it "strengthens the force of gravity" (it definitely doesn't weaken it), but it would be more appropriate to say that it contributes to the total gravitational field.
The effect it immensely small, however, and is in almost all circumstances completely insignificant compared to the gravity of other forms of mass/energy. But most of the radiation in the Universe is the so-called cosmic microwave background, and because this radiation is gradually redshifted with time, it used to be more energetic, and hence exert more gravity. It is fairly easy to calculate that until the Universe was roughly 50,000 years old, radiation actually dominated the gravitational field.
Prologue:
As Zephyr points out below, the term "exerting gravity" is not really the correct way of describing gravity. In general relativity, objects are assumed follow straight lines in space, unless a force (e.g. electromagnetic) acts upon it. What we interpret as "gravity" is the deviation from what we think is "straight ahead", caused by a geometrical change in the space (and time) — and thus in the mathematical rules we use to calculate e.g. how parallel lines behave, how many degrees there are in a triangle, etc — around a massive object. The deformation of space is given by the Einstein field equations, in which the so-called stress–energy tensor appears. This is a mathematical object consisting of 16 numbers, of which one number (the "$T^{00}$'th component") holds the energy density of everything, i.e. radiation, dark matter, dark energy, stars, planets, bicycles, and — in particular — your mom.
Comment: Just to add to this, the phrase "energy exerts gravity" is a very Newtonian description of gravity. A phrase more in line with GR might be "energy bends space-time". It all depends on how you want to think about it.
Comment: @zephyr: I initially included a description of the stress-energy tensor, but ended up deleting it, to keep this answer at a level I think is appropriate. But, by request, here you are :)

Can radiation affect gravity?


How do I save a pose in 2.8?

Question: I'm trying to figure out how to use the pose library in 2.8 as I never learned how to use it in the last version. For some reason the "+New" icon is grayed out and I can't select it. Any help?
Comment: is it still grayed when you switch to Pose mode?
Answer:
Choose the tab at the top of the screen that says "Animation". This will put a narrow "Timeline" panel at the bottom. Change the Timeline panel to "Dope Sheet"
The "Dope Sheet" panel has another drop-down menu near the panel-changing menu you just accessed. From this drop-down menu, change it from "Dope Sheet" (or whatever it may be) to "Action Editor".
This next step assumes your model is rigged to its intended armature. Select that armature and press CTRL + TAB. This will put you in "Pose" mode and the armature will turn a light blue color. In the top-middle of the Action Editor panel, there is a button that says "+    New". Click that to create a new action. You can also rename it.
Now, This is important, click that little icon near that button that looks like a gray shield. The program does not indicate this (and they should have, sine at least 2.79) but this is the button that saves your animations. I am telling you to press it now because if you don't, you will start posing your character, save your scene, exit the program, and be startled to find it's gone when you return. You don't have to save the animation immediately, but you have to before you change Actions or close the program, so be in the habit of doing it immediately.
Comment: Excellent response, thank you. I'd just like to reiterate the part about selecting the  entire armature because I missed it and it only saved the pose for my selected bone.
Comment: when you have a single bone selected in pose mode and you have the cursor in the "Modeling" viewport, and press the "i" key, keyframes are only added for the selected bone. However, if the cursor is in the "Timeline" panel or "Action Editor" panel, you will get a prompt to set keys for only the selected bone ***or*** the entire armature. You will get smoother animation if you only set keys for the specific bones you pose (the bones' parenting takes care of the rest automatically). Otherwise animation will be stiff when you set new keys.  Setting keys has nothing to do with saving an Action.

How do I save a pose in 2.8?


Ruby: convert proc to lambda?

Question: Is it possible to convert a proc-flavored Proc into a lambda-flavored Proc?
Bit surprised that this doesn't work, at least in 1.9.2:
my_proc = proc {|x| x}
my_lambda = lambda &p
my_lambda.lambda? # => false!

Answer: This one was a bit tricky to track down.  Looking at the docs for Proc#lambda? for 1.9, there's a fairly lengthy discussion about the difference between procs and lamdbas.
What it comes down to is that a lambda enforces the correct number of arguments, and a proc doesn't.  And from that documentation, about the only way to convert a proc into a lambda is shown in this example:

define_method always defines a method without the tricks, even if a non-lambda Proc  object is given. This is the only exception which the tricks are not preserved.
 class C
   define_method(:e, &proc {})
 end
 C.new.e(1,2)       => ArgumentError
 C.new.method(:e).to_proc.lambda?   => true

If you want to avoid polluting any class, you can just define a singleton method on an anonymous object in order to coerce a proc to a lambda:
def convert_to_lambda &block
  obj = Object.new
  obj.define_singleton_method(:_, &block)
  return obj.method(:_).to_proc
end

p = Proc.new {}
puts p.lambda? # false
puts(convert_to_lambda(&p).lambda?) # true

puts(convert_to_lambda(&(lambda {})).lambda?) # true

Comment: Fun question time: how do you do this in jruby?
Comment: Answer to my fun question: http://stackoverflow.com/questions/13239338/convert-bloc-to-lambda-in-jruby
Comment: Thanks! Very helpful :) The fact that define_method ultimately produced a lambda was what prompted my confusion.
Comment: If you're interested in getting this to be a stable interface. Can you please comment on this issue with why you wanted to convert a proc to a lambda in the first place? https://bugs.ruby-lang.org/issues/9777#change-46353
Answer: It is not possible to convert a proc to a lambda without trouble. The answer by Mark Rushakoff doesn't preserve the value of self in the block, because self becomes Object.new. The answer by Pawel Tomulik can't work with Ruby 2.1, because define_singleton_method now returns a Symbol, so to_lambda2 returns :_.to_proc.
My answer is also wrong:
def convert_to_lambda &block
  obj = block.binding.eval('self')
  Module.new.module_exec do
    define_method(:_, &block)
    instance_method(:_).bind(obj).to_proc
  end
end

It preserves the value of self in the block:
p = 42.instance_exec { proc { self }}
puts p.lambda?      # false
puts p.call         # 42

q = convert_to_lambda &p
puts q.lambda?      # true
puts q.call         # 42

But it fails with instance_exec:
puts 66.instance_exec &p    # 66
puts 66.instance_exec &q    # 42, should be 66

I must use block.binding.eval('self') to find the correct object. I put my method in an anonymous module, so it never pollutes any class. Then I bind my method to the correct object. This works though the object never included the module! The bound method makes a lambda.
66.instance_exec &q fails because q is secretly a method bound to 42, and instance_exec can't rebind the method. One might fix this by extending q to expose the unbound method, and redefining instance_exec to bind the unbound method to a different object. Even so, module_exec and class_exec would still fail.
class Array
  $p = proc { def greet; puts "Hi!"; end }
end
$q = convert_to_lambda &$p
Hash.class_exec &$q
{}.greet # undefined method `greet' for {}:Hash (NoMethodError)

The problem is that Hash.class_exec &$q defines Array#greet and not Hash#greet. (Though $q is secretly a method of an anonymous module, it still defines methods in Array, not in the anonymous module.) With the original proc, Hash.class_exec &$p would define Hash#greet. I conclude that convert_to_lambda is wrong because it doesn't work with class_exec.
Answer: Here is possible solution:
class Proc
  def to_lambda
    return self if lambda?

    # Save local reference to self so we can use it in module_exec/lambda scopes
    source_proc = self

    # Convert proc to unbound method
    unbound_method = Module.new.module_exec do
      instance_method( define_method( :_proc_call, &source_proc ))
    end

    # Return lambda which binds our unbound method to correct receiver and calls it with given args/block
    lambda do |*args, &block|
      # If binding doesn't changed (eg. lambda_obj.call) then bind method to original proc binding,
      # otherwise bind to current binding (eg. instance_exec(&lambda_obj)).
      unbound_method.bind( self == source_proc ? source_proc.receiver : self ).call( *args, &block )
    end
  end

  def receiver
    binding.eval( "self" )
  end
end

p1 = Proc.new { puts "self = #{self.inspect}" }
l1 = p1.to_lambda

p1.call #=> self = main
l1.call #=> self = main

p1.call( 42 ) #=> self = main
l1.call( 42 ) #=> ArgumentError: wrong number of arguments (1 for 0)

42.instance_exec( &p1 ) #=> self = 42
42.instance_exec( &l1 ) #=> self = 42

p2 = Proc.new { return "foo" }
l2 = p2.to_lambda

p2.call #=> LocalJumpError: unexpected return
l2.call #=> "foo"

Should work on Ruby 2.1+
Answer: Cross ruby compatiable library for converting procs to lambdas:
https://github.com/schneems/proc_to_lambda
The Gem:
http://rubygems.org/gems/proc_to_lambda
Answer: The above code doesn't play nicely with instance_exec but I think there is simple fix for that. Here I have an example which illustrates the issue and solution:
# /tmp/test.rb
def to_lambda1(&block)
  obj = Object.new
  obj.define_singleton_method(:_,&block)
  obj.method(:_).to_proc
end

def to_lambda2(&block)
  Object.new.define_singleton_method(:_,&block).to_proc
end

l1 = to_lambda1 do
  print "to_lambda1: #{self.class.name}\n"
end
print "l1.lambda?: #{l1.lambda?}\n"

l2 = to_lambda2 do
  print "to_lambda2: #{self.class.name}\n"
end
print "l2.lambda?: #{l2.lambda?}\n"

class A; end

A.new.instance_exec &l1
A.new.instance_exec &l2

to_lambda1 is basically the implementation proposed by Mark, to_lambda2 is a "fixed" code.
The output from above script is:
l1.lambda?: true
l2.lambda?: true
to_lambda1: Object
to_lambda2: A

In fact I'd expect instance_exec to output A, not Object (instance_exec should change binding). I don't know why this work differently, but I suppose that define_singleton_method returns a method that is not yet bound to Object and Object#method returns an already bound method.

Ruby: convert proc to lambda?


Would a 1km edge length solid tungsten cube sink through the Earth crust?

Question: This question was inspired by this question on worldbuilding SE. Suppose you have a giant cube with $1$km edge length made out of pure tungsten and you put it somewhere on the ground. This is the size of a medium mountain and tungsten has much higher density than rock so it would definitely sink in quite a bit. But how far would it sink? Is this massive enough to just sink through the earth crust and eventually end up in the center of the earth? Or would it just think half way in or something like that? Does this depend on whether the ground is a solid rock surface or some loose sand? I don't even know what kind of model one would use to answer a question like that.
Comment: Highly related - my answers to these questions https://earthscience.stackexchange.com/q/16730/725 and https://earthscience.stackexchange.com/q/246/725
Answer: To determine if the cube is going to sink or not, we care about the pressure it exerts on the ground and whether it's enough to make it break and sink. Let's do a quick back of the envelop calculation, because I don't know enough about earth's crust to do actual computations !
Tungsten has a density of $19.3g/cm^3$, or in more convenient units $19.3\times 10^{3}kg/m^3$. According to a quick google search, the average rock density seems to be of the order of $2.65\times 10^{3}kg/m^3$. Now, the pressure exerted on a point where the cube touches the ground is simply $height*density*g$, in this case with $g\approx 10 m/s^2$ we get $$P \approx 20\times 10^3kg/m^3*1000m*10m/s^2= 2\times 10^8 Pa \approx  2000 atm$$
Now let's take the other example of a big rock : the mount everest. The peak pressure it would exert on earth's crust would be right below its top which towers at around $9 km$. So we have by the same formula as before : $$P_{everest}\approx 2.5\times 10^{3}kg/m^3*9000m*10m/s^2 = 2.25\times 10^8 Pa \approx 2250 atm$$
Of course the real answer will be lower since the mount everest is obviously not a liquid so the internal tension forces of the rock will redistribute the pressure more evenly, but it's just to have an order of magnitude.
So your block exerts a pressure on earth's crust which is roughly of the same order of magnitude than Mount Everest. So it is quite a lot for such a small object, but definitely not enough to sink through earth crust and plunge to the core of the earth. To determine exactly if it would sink a little bit, a lot, or not at all is very difficult to answer and it will of course depend on the type of ground you are resting on.
But with this comparison we can more or less confidently say that it will not plunge to the center of the earth.
Comment: The difference is that Mount Everest lies on quite a bit of more rock than the tungsten cube does. Might that matter?
Comment: So this is accounted by the fact that I compute pressure, and not force, exerted on the crust. Since pressure is $Force/Surface$, I account for the fact that force is distributed on more surface for the case of the mount Everest. Of course, I cheated, because I assumed that mount everest is not a cohesive piece of rock, but rather that it is made of liquid of the same density. To refine the computation it would be better to compute the full volume of mount everest and divide its full weight by the surface it rests on. But of course, this didn't fit on the back of my envelop ;)
Comment: It's not just a matter of density, but of the strength of the underlying material, so you can easily have a sizeable block of something heavy - iron, say, or bricks - sitting on a sheet of styrofoam without sinking in.  Say the cube reaches granite after sinking into a few meters of soil.  Granite has a compressive strength ~200 Mpa, while atmospheric pressure is ~0.1 MPa.  So granite should just barely support a 1000 m tungsten block.  In addition, there's viscosity to be considered: even if the block fractures the granite beneath it, it still has to displace it.
Comment: Of course I never claimed it was just a matter of density. My answer just compares order of magnitude of pressure of something we know doesn't sink (mount everest) with our block. Since the order of magnitude coincide, my conclusion was that it sould not, in general, sink. Of course I am no geologist so I cannot answer the question precisely, and I think it will anyway greatly depend on where you place it on earth, since even the deeper rock composition seem to vary greatly from place to place, ex see : https://en.wikipedia.org/wiki/Kola_Superdeep_Borehole


Does skeletron prime have more defence with the limbs alive?

Question: I've hard this question for a while I was playing Terraria with my friend and we fought skeletron prime and regular skeletron he said that the boss had more defense with the limbs is this true?
Answer: No, Skeletron Prime does not have more defense while its limbs are alive. This is a common misconception, as the limbs intercept attacks and take the damage instead of the head, leading to the illusion that Skeletron Prime has more defense when the limbs are flailing around.
The only time Skeletron Prime has a higher defense is when its head begins spinning.
Focusing on the limbs is an advisable strategy, as it reduces the risk of you taking more damage, and allows you to damage the head more accurately.


Using a project file as a parameter in MSBuild with Hudson

Question: I'm currently using the Hudson build system with MSBuild steps. As part of the build, I have a project file with various targets in, one of which is to start a build with visual studio. However, I need to pass through a seperate project file to this target in order for it to build, but I keep getting the exception 'MSBUILD : error MSB1008: Only one project can be specified.'
I believe this is because the system is unable to calculate which project is supposed to be the parameter, and which the top-level target? If so, is there anyway to resolve this.
Here is a snippet of the target project file:
<code> <Target Name="VisualStudioTask">
    <!-- Required Properties:
    $(BuildType)
    $(ConfigurationSetup)
    $(Solution)-->
    <Exec Command="C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe $(BuildType) $(ConfigurationSetup) $(Solution)" />
  </Target>
</code>
The MSBuild step calling this looks like this:
<code>/t:VisualStudioTask -p:BuildType="/Build" p:ConfigurationSetup="Release" -p:Solution="%22..\MyProject.vcproj%22"
</code>
Many thanks
Chris
Answer: I have figured it out, the problem was that I'd left out a '-' when declaring the 'ConfigurationSetup' parameter, so if you look in my original example it has this:
<code>/t:VisualStudioTask -p:BuildType="/Build" p:ConfigurationSetup="Release" -p:Solution="%22..\MyProject.vcproj%22"
</code>
When it should have this..
<code>/t:VisualStudioTask -p:BuildType="/Build" -p:ConfigurationSetup="Release" -p:Solution="%22..\MyProject.vcproj%22"
</code>


Does a wave-function always expand over time in free space (no obstruction)?

Question: I have watched several videos and have read quite a bit on this, and I have never seen an example of a wave-function getting smaller over time. If nothing interacts with it after it "forms", will it always expand? By expand I mean we have less and less certainty on where it would be if measured over time. Are there any counterexamples where it would not (more certainty on space)?
Answer: No. As an example, look at a translating Gaussian wave packet:
$$A \mathrm{e}^{- (x - vt)^2 / (2\sigma^2)}.$$
For a field that obeys the classical wave equation where waves propagate with speed $v$, this packet does not spread. You can construct similar wave packets for Schrodinger, Dirac, and Klein-Gordon equations.
For wave equations, in fact, any twice differentiable function of the form
$$f(x \pm vt),$$
will satisfy it. That's a pattern translating at speed $v$ without spreading.
There is also the more advanced study of solitons that don't spread even in the presence of non-linear dispersion relations.
Comment: wouldn't the non-linear dispersion count as "obstruction"?
Comment: I interpreted obstruction as pertaining to spatial or temporal non-uniformity in the medium. Non-linear dispersion relations, including ones that have dissipation effects, can be uniform in time and space.
Comment: yes it's a little ambiguous as to what that means.  I interpreted this as just fee-wave dispersion...  Good answer nevertheless.  I thought  Schrodinger had found some such solution but I don't remember the details...
Comment: This is going a bit above my head but you gave me alot to research so thanks! By "obstruction" I simply meant anything that could cause the wave function to collapse. I wanted to simply imagine an "evolving" wave.    On another note, do any of you know a good place to start with the math behind  all of this? I have read a ton but still cannot answer questions like these myself because I don't know where to start learning the math. Thanks!
Answer: I'm not aware of any such examples, and I wouldn't expect to find one because of the uncertainty principle. A particle being confined in an ever-smaller space would have an ever-larger uncertainty in momentum, making it less likely to remain confined in that space; it would need to be being "squeezed" by some external potential with ever-increasing force to trap it. Contrast this to the likelihood of something spreading out over a larger volume as time goes on.
The best you can hope for is the wavefunction of an eigenstate of the Hamiltonian, which will remain constant over time (up to its oscillating complex phase). This is the situation in e.g. a hydrogen atom.
Comment: I'm hesitant to add that I suppose falling into a black hole might do the trick, but in that case you've got bigger problems figuring out what's going on...
Comment: This isn't right. Consider any wavefunction spreading out over time; its time reverse will contract.
Comment: That is actually what I was getting at Knzhou. I didn't understand why there was no direction to time at the quantum level if there was always expansion as a wave-function evolved, but if it can contract then this isn't right. I didn't expect to be right, just to be told why I was wrong!  Rwold: I don't care how odd the measurement is (in terms of what it produces), I am just looking for a pattern that can only be reversed by measurement. Is this what you are saying?


If a block contains no SegWit transactions, does a miner send an (empty) witness?

Question: Also, would that block's Coinbase contain some kind of empty witness commitment?
Answer: BIP141 only requires a commitment to the witness tree to be present when there is at least one segwit transaction (= a transaction that spends a witness output) in the block.
This means that old miners in theory can keep working after segwit activates, as long as they don't include segwit transactions (easy, as they are nonstandard to them) and don't build on top of invalid blocks (harder, as it requires an updated full node).
Comment: I'm playing with this in `regtest` mode, but I'm seeing a SW commitment in an empty block. `getblock`: http://pastebin.com/eDeXGHEx and `gettransaction` of the coinbase tx: http://pastebin.com/3DxSFArc The block has an extra 36 bytes (size - stripped size) and the coinbase tx has an `OP_RETURN aa21a9ed...` Is it counting the coinbase tx itself as a SW tx? Making the whole block SW?


beatbox._beatbox.SoapFaultError: 'API_DISABLED_FOR_ORG' 'API_DISABLED_FOR_ORG: API is not enabled for this Organization or Partner'

Question: Is there anyway to check the API enabled checkbox in the free trial version of Salesforce?
Answer: Free trail version of salesforce is being professional edition api is an add on feature there. You will not be able to enable that during your trial. You need to contact with salesforce team to get this feature enabled.
if you need to experiment api callout why don't you use a developer edition which is free and holds api access.


Using aerosol cans for sanding sealer on bare wood

Question: I'm new to woodworking, but I am starting to dabble in building my own guitars from scratch (just a slab of wood). I have been reading up on things, and it appears a lot of people that build guitars use a product from Behlens called Vinyl Sanding Sealer, and it's been highly recommended as the 'Go-To' product for such an application. My problem is that it's not readily available in my area. I'd have to order some online. I have no issues with doing this, but I'm just wondering: can regular clear coat be used as a sanding sealer, or do I need to stick with a product like the one that Behlens makes? I know there's other brands out there, but Behlens is promoted (and reviewed by guitar builders the world over) as "the cream of the crop." I've got a couple of cans of Minwax poly (black label aerosol can) laying around at home, and I was wondering if that could be used as a sanding sealer. Thanks for your input!!
Answer:
I'm just wondering: can regular clear coat be used as a sanding sealer

Yes, the first 'sealing' of the wood can be done with any standard finish and in fact the first coat of whatever finish you're using does effectively act the same as something sold as sealer.
"Sanding sealer" has a secondary function and that is to be easy to sand, and to facilitate this they often have a wax-like component in their mix, e.g. zinc stearate, but this isn't really necessary (or sometimes advisable).

Behlens is promoted (and reviewed by guitar builders the world over) as "the cream of the crop."

A point worth noting is that before the current crop of guitar builders their predecessors were doing work of at least the same standard without access to many modern conveniences and pre-made products, which includes sanding sealer.
Given the budget and need for them there are many things one would not wish to be without now that they are around, such as the very high quality modern abrasives (including Abranet) and a few of the modern finishes, but "sanding sealer" is really not one of those.


Activate Rigid Body Physics at certain time?

Question: I've been trying to make a wrecking ball smash through a figure of sorts, not really sure what exactly but I made an example.
The problem I'm having is that the figure does indeed fall apart, but I would like it to stay put together until the ball hits it. I achieved this by using Cell Fracture on the figure and just using Rigid Body. Again, I just need a way for the figure to stay still until hit by the ball, and then have all of its pieces come apart.
Comment: Related - http://blender.stackexchange.com/questions/8483/activate-physics-by-keyframe
Answer: If you are running a single simulation,
Keyframe the Rigid Body World Speed.

This is the simulation starting from frame 1.

Go to frame 1 and keyframe the Speed property of the Rigid Body World to 0. Keyframe it to 1 (or any other) on the desired starting frame.
Set the keyframe interpolation to constant.

The resulting simulation won't move untill the desired starting frame. (It moves with a speed of 0.)

Keyframe the Animated property
If you only want some objects to start simulating on a specific frame use the Animated option on these objects (as suggested by Mr Zak) as explained in this answer.
Setting and keying the animated property for each object individually may be tedious. Use this script.
<code>import bpy

# get the current frame
fr = bpy.context.scene.frame_current

# get the selected objects
objs = bpy.context.selected_objects

# cycle through the selected objects
for o in objs:

    # set the "Animated" property to unchecked
    # change "False" to "True" if you want to check it
    o.rigid_body.kinematic = False

    # keyframe the "Animated" property
    o.rigid_body.keyframe_insert(data_path='kinematic', frame=(fr))
</code>
Paste the code into Blenders text editor. Move to a frame where the objects should remain stationary. Select them and (hovering over the text editor) press AltP to execute the script. The selected objects will now have a keyframe on the "Animated" Property of their rigid body.
Comment: @p2or Haha, thanks.
Comment: I was following your steps and ran into a new problem, and it's my fault for not specifying. When making the speed 0 it also freezes the wrecking ball because it to is using rigid body. I also attempted to make a sphere similar to what you did, and can't get the sphere to interact with my object, what physics need to be applied to the sphere to interact with the object that's going to be shattered?
Comment: @ketchupboy2002 I updated the answer with more information. Concerning the interaction between objects, you should post a new question as it differs from this topic.
Comment: I'm not sure if this is worth creating a new post over but if you think so, I'll definitely make another (Referring to what I'm about to ask), but how do I insert a keyframe for the scene? Specifically for the speed of the Rigid Body World. (Through pressing 'I', I can't seem to find anything)
Comment: Hover over the checkbox where it says "Animated". Then press "I". Or use the script. You can view created keyframes in the dopesheet.
Comment: Even 4 years later, the only upvote on this pretty nice answer is mine. Good job @Leander


Friendly url scheme?

Question: One of the many things that's been lacking from my scraper service that I set up last week are pretty URLs. Right now the user parameter is being passed into the script with ?u=, which is a symptom of a lazy hack (which the script admittedly is). However, I've been thinking about redoing it and I'd like to get some feedback on the options available. Right now there are two pages, update and chart, that provide information to the user. Here are the two possibilities that I came up with. "1234" is the user ID number. For technical reasons the user name unfortunately cannot be used:

http://< tld >/update/1234
http://< tld >/chart/1234

or

http://< tld >/1234/update
http://< tld >/1234/chart

Option #1, conceptually, is calling update with the user ID. Option #2 is providing a verb to operate on a user ID.
From a consistency standpoint, which makes more sense?

Another option mentioned is

http://< tld >/user/1234/update
http://< tld >/user/1234/chart

This provides room for pages not relating to a specific user. i.e.

http://< tld >/stats
Answer: If you go with this scheme it becomes simple to stop (well-behaved) robots from spidering your site:
 http://< tld >/update/1234
 http://< tld >/chart/1234

This is because you could setup a /robots.txt file to contain:
 Disallow /update/
 Disallow /chart/

To me that is a nice bonus which is often overlooked.
Answer: Option #1 matches the common ASP.NET MVC examples.  Some of the examples at Model View Controller model have the form  {controller}/{action}/{id}.  The .NET 3.5 quickstart on routing has a table showing some valid route patterns:
Route definition
-- Example of matching URL
{controller}/{action}/{id}
-- /Products/show/beverages
{table}/Details.aspx
-- /Products/Details.aspx
blog/{action}/{entry}
-- /blog/show/123
{reporttype}/{year}/{month}/{day}
-- /sales/2008/1/5
{locale}/{action}
-- /en-US/show
{language}-{country}/{action}
-- /en-US/show
Comment: actually it just matchs the demonstration that you found.  MVC has nothing to do with the URL writer.
Comment: Updated to include other options.  Thanks for the catch.
Answer: I'd be gently inclined toward leading with the userid -- option #2 -- since (what exists of) the directory structure is two different functions over a user's data.  It's the user's chart, and the user's update.
It's a pretty minor point, though, without knowing if there's plans for significant expansion of the functionality of this thing.

Is everything going forward going to be additional functions foo and bar and baz for individual users?  If so, option #2 gets more attractive for the above reason -- the userid is the core data, it kind of makes sense to start with it semantically.
Are you going to add non-user-driven functionality?  Leading with a header directory might make sense then -- /user/1234/update, /user/1234/chart, /question/45678/activity, /question/45678/stats, etc.
Comment: I don't anticipate that the functionality will increase a whole lot, as the goal of the page is to provide functionality that's lacking from StackOverflow itself. There are a few other scripts that aren't public yet that deal with overall stats of the service. Your /user/1234/verb is appealing.
Answer: I personally like this style, because it keeps the user the same, but gives you specific insight in to them.

http://< tld >/1234/update
http://< tld >/1234/chart

If you went the other way I would expect to be able to see everything under /update or /chart and then narrow in by user.
Answer: Go with the latter; URLs are meant to be hierarchical (or, at least, users read them that way by analogy to local directory paths).  The focus here is on different views of a specific user, so "user" is the more general concept and should appear first.
Answer: I just replied to the question "How do you structure your URL routes?" with my opinions about making URLs RESTful, hackable and user friendly. I think it would be better to link than to write something similar in this question, hence the link.
Answer: I agree from a context standpoint, the application followed by the parameters make much more sense to me than the surrogate key for an item followed by the context of what the item is.  Ultimately I'd suggest which ever is more natural for you to program.
Comment: #1 is easier because I use MultiViews with Apache to translate the verb to a script name. However, if it makes more sense to refer to it the other way I can get something to work.
Answer: Convention says object/verb/ID, so it should be:
http://< tld >/user/update/1234
(I just noticed that matches your updated question :)
So yes, #3 is the best choice.
This supports non-user operations as you mention (stats/), as well as multi-user operations:
http://< tld >/user/list/
Answer: If there's a way of listing users I'd introduce a users segment:
http://< tld >/users/ <--- user list
http://< tld >/users/1234/ <--- user profile, use overloaded POST on this to update.
http://< tld >/users/1234/chart/ <--- user chart

If you can only see your own details, ie users are invisible to each other, you don't need the user id since you can infer it from the session, in which case:
http://< tld >/user/ <--- user profile, use overloaded POST on this to update.
http://< tld >/user/chart/ <--- user chart

Friendly url scheme?


Where is android syncing my photo's to?

Question: I just got an android and have it synced to my google account, the problem is that it is syncing my photo's to I don't know where on my google account, which is very bad because I take pictures of sensitive documents for my job. Every once in a while I get a notice that these synced photos are ready to share. I've looked in drive and don't see them, I've looked on plus and only see the ones I've said it's ok to share, but it's syncing them somewhere online which in the case of these particular articles is illegal no mater how "Secure" this may be.  So where the heck are these going?
Comment: What version of android are you running and on what phone?
Comment: Ice cream sandwhich, LG l9
Comment: Also, what is the exact message in your notification? For example, my Galaxy Note 2 says "Google+ Auto-backup, x photos ready to share".
Answer: Your Android phone may sync photos on Google +, Dropbox, Google Drive and Facebook.
 On Google + got to https://plus.google.com/photos/search/%23AutoBackup (Photos> AutoBackup), here are photos whose automatically synced through your android phone. How to Enable/ Disable auto sync on Android
Next is Dropbox, check this article for dropbox sync enabled www.dropbox.com/help/82/en
Next is Google Drive which may auto sync your photos & data to server.
& Facebook is also sync photos in private folder in your albums folder.
But in my opinion your photos are being synced by Google + in Auto Backup section.

Where is android syncing my photo's to?


delphi pointer address

Question: In Delphi:
How do I get the address (0x2384293) a pointer points to?
var iValue := Integer;
    iptrValue := PInteger;

implementation

procedure TForm1.Button1Click(Sender: TObject);
begin
  iptrValue := @iValue;
  iValue := 32342;
  //Should return the same value:
  Edit1.Text := GetAddressOf(iptrValue);
  Edit2.Text := GetAddressOf(iValue);

So what is GetAddress in reality :)
Comment: GetAddressOf does not exist. it was pseudocode as stated in "in reality" :)
Answer: To get the address of something, use the @ operator or the Addr function. You've already demonstrated correct use of that. You got the address of iValue and stored it in iptrValue.
To display an address, you can use the Format function to convert a pointer value into a string. Use the %p format string:
Edit1.Text := Format('%p -> %p -> %d', [@iptrValue, iptrValue, iptrValue^]);

That will display the address of the iptrValue variable, then the address stored in that variable, and then the value stored at that address.
The iptrValue variable declaration reserves some bytes in memory and associates a name with them. Suppose the address of the first byte is $00002468:
       iptrValue
       +----------+
$2468: |          |
       +----------+

The iValue declaration reserves another piece of memory, and it will probably be adjacent to the previous declaration's memory. Since iptrValue is four bytes wide, the address of iValue would be $0000246C:
       iValue
       +----------+
$246c: |          |
       +----------+

The boxes I've drawn are empty for now because we haven't discussed what values those variables hold. We've only discussed the variables' addresses. Now to the executable code: You write @iValue and store the result in iptrValue, so you get this:
       iptrValue
       +----------+    +----------+
$2468: |    $246c |--->|          |
       +----------+    +----------+
       iValue
       +----------+
$246c: |          |
       +----------+

Next, you assign 32342 to `iValue`, so your memory looks like this:

       iptrValue
       +----------+    +----------+
$2468: |    $246c |--->|    32342 |
       +----------+    +----------+
       iValue
       +----------+
$246c: |    32342 |
       +----------+

Finally, when you display the results of the Format function from above, you would see this value:
00002468 -> 0000246C -> 32342

Comment: Hi @Rob, I think your diagram is misleading. It gives the reader a feeling that the memory address the pointer points to is not the box at $246c. Imo, it's better to draw it like this: https://i.imgur.com/qXSWa3y.png
Answer: Just cast it to an integer  :)
IIRC, there's also a string format specifier (%x? %p?) that will automagically format it as an 8-character hex string.
Answer: Here is my own example of address function:
function GetAddressOf( var X ) : String;
Begin
  Result := IntToHex( Integer( Pointer( @X ) ), 8 );
end;

Example of using 2 variable's same data:
type
  TMyProcedure = procedure;

procedure Proc1;
begin
  ShowMessage( 'Hello World' );
end;

var
  P : PPointer;
  Proc2 : TMyProcedure;
begin
  P := @@Proc2; //Storing address of pointer to variable
  P^ := @Proc1; //Setting address to new data of our stored variable
  Proc2; //Will execute code of procedure 'Proc1'
end;

Comment: That's not always correct due to the size differences between pointer and integer
Answer: GetAddressOf() will return the address of the variable.
GetAddressOf(iptrValue) - the address of the iptrValue
GetAddressOf(iValue) - the address of iValue

What you want is the value of the pointer. To do so cast the pointer to an unsigned integer type (Longword if I remember it right). Then you can convert that integer into a string.
Answer: It actually is a ULong you need:
procedure TForm1.Button1Click(Sender: TObject);
var iValue : Integer;
    iAdrValue : ULong;
    iptrValue : PInteger;
begin
  iValue := 32342;
  iAdrValue := ULong(@iValue);
  iptrValue := @iValue;

  //Should return the same value:
  Edit1.Text := IntToStr(iAdrValue);
  Edit2.Text := IntToStr(ULong(iptrValue));
  Edit3.Text := IntToStr((iptrValue^); // Returns 32342
end;

I did not find the GetAddressOf function in Delphi 2006. It seems to be a VB function?

delphi pointer address


How do I install one Android phone's apps to another Android phone without rooting?

Question: How do I install one Android phone's apps to another Android phone without rooting ? I need to install the Samsung Galaxy S Duos Internal Music Player on a HTC Desire 620G. Please help me, and thanks in advance.
Comment: Please tick the answer as the correct answer if it helped you.
Answer: To your problem, you cannot do so, unless you root both your phones.

Samsung Galaxy S Duos's music player is a System App, if I remember correctly. System Apps can't be copied like normal Application Packages unless you are rooted. You have mentioned that you need a way to do so without rooting, and it is not possible.
If it is a User App i.e. if you have installed them yourself, then you can just copy the APK file present in the data folder and install them onto another phone.
Instead of doing so, I would recommend you to use the Shuttle music player. It has many features, and can be used as a replacement for any device's music player.

If you prefer rooting by any chance, then you can do so (there will be a few bugs, because of porting System Apps from a Samsung TouchWiz UI based ROM to a HTC Sense UI based ROM) by using the Link2SD app and the following procedure :

Open the Link2SD App
Convert your specific app into a User App
Get the APK file of that app, using an APP backup tool or any similar one which converts installed apps into installable APKs
Copy the APK to your other device (in this case, your HTC Desire 620G
Install it as a System App using the Link2SD App.
Use it.

Note that the App might have a possibility of crashing when being converted into a User App, and because of the dependencies of the app on the specific frameworks of the specific devices, it might not work at all, and might even brick your device. Do so with caution.


Snap store can't upgrade "snap-store" despite being prompted to

Question: How do I go around this? Do I have to install synaptic? I already upgraded via terminal.
Comment: Does this answer your question? [Unable to update "Snap Store": (null): cannot refresh "snap-store": snap "snap-store" has running apps (ubuntu-software) in Ubuntu 22.04 LTS](https://askubuntu.com/questions/1412546/unable-to-update-snap-store-null-cannot-refresh-snap-store-snap-snap-s)
Answer: You have to kill snap-store process and then upgrade snap-store in particular. Then run the refresh command.
sudo killall snap-store
sudo snap refresh snap-store

Answer: You can't update snap-store from within snap-store, because snap-store needs to be closed in order to update. Snaps should auto-update, so you should be able to just forget about it and let it do its thing when the time comes. But if you don't like to wait for an auto-update to finally show up, you can update it from the terminal:
sudo snap refresh snap-store

Answer: Most users don't need to do anything at all. Snapd will automatically update/refresh snap-store without any action needed by you.
Snapd checks for updates several times each day, including at startup.
Snap application updates cannot happen while the application is running, which is why snap-store cannot update itself. Simply Quit out of the snap-store application when you are done using it...and don't worry about it. Snapd will handle the update automatically.
For folks who really want to be hands-on:

Quit out of the application. Not minimize, not 'X' the window, it must be a real Quit. The application cannot be running.
sudo snap refresh. Wait for the command to complete.
(Optional) Re-launch the application.


Visual Basic data set not updating with mdb file

Question: I have a .mdb (Access) file that I am using in my VB program. The program is basically just querying out data from the file. I prefer to update the database through access and then my vb program will just automatically be up to date upon saving the .mdb file. I have a data connection connected to the .mdb file and using the data set on my form. For some reason when I update the .mdb file, the program will not be updated with the new items....even if I right click and refresh the data connection and data set.
Is there a way I can fix this so that when I wont have to worry about deleting the connections and resaving in VB and creating an executable. I'd prefer my end result to just always work upon the .mdb file being updated.
Answer: When adding the connection and dataset there is a part that prompts you about it being a local file and if you want, you can have a copy saved to the projects directory. Clicking no will make sure that the local file will be used and not the copy in the project folder.


As a viewer of a YouTube video, can one see whether the video received a copyright claim?

Question: I saw a video on YouTube. I am just a viewer: I have not uploaded that video to YouTube. Can I see whether the video received a copyright claim?
Answer: Sometimes:

Videos with claims on music may have a "Music" section in the description where the music titles and cover art are listed out.
Videos using movie clips may have a "buy/rent the full movie" box to the right of the video player.
Videos with any claim may have a "recommended by <rights holder>: <video title>" inside the description (before the description even is opened up).
Videos with any claim may be blocked in your country, with a message stating just that in place of the video player.
When embedding the video, videos with claims may state that you have to watch on YouTube due to a claim by the right holder. This feature is the only one on this list which also can by applied by the video uploader, in which case it'd say "... disabled by the video owner".

It also is possible that a claim shows none of those options. The presence of one of the above points confirms that a video is claimed by someone, but the absence of it does not confirm the opposite.
Additionally, sufficiently large corporate channels (those with access to Content ID) may claim their own videos to apply any of the above features. So a claim doesn't necessarily mean it's a claim by a third party either.


Blower turns on and off even though the unit is satisfied

Question: My heater works fine when I set the temperature to 69 and the temperature hits the desired temp it shuts off, then about 2 mins later the blower turns on like the heater is going to start up again, but since the desired temp is still satisfied the heater never comes on, the unit recognizes the fact that the system is satisfied so it then shuts off the blower.
Comment: By the way this goes on throughout the day, I tried changing the T-Stat and the same thing happens. There is also a 1 degree differential in the settings, it has always been like that and I have never had this issue.
Comment: This should be added to your post and not as a comment. Also, you never asked a question so please do so. I assume you're wondering why it turns back on.
Comment: What make and model is said heater?
Answer: Welcome to DIY!
The blower runs when the heat exchanger goes over a set temperature and turns off when it goes under it as I bet you already know. However, heat is still transferring from where the fire was burning so it can warm back up and turn back on for a minute or so. The blower doesn't care if your thermostat is satisfied or not as it goes by it's own temperature control to make sure the furnace doesn't get too hot. That is probably your issue.
Comment: I believe hazardousglitch is saying there may be a sensor that detects heat and it is turning on the fan. If this sensor is getting flakey it could be the cause. I was thinking the same thing.
Comment: I would have to get back to you on the make and M# on the heater. But the blower motor comes on quit a few times and this has never happened before, so it doesn't sound like it would be to hot inside the furnace for the blower to come on so many times. I would think that the fan limit switch would be bad or maybe a circuit board, I will have to get into the attic and get the info of the unit.


Logic board swap

Question: I have a T Mobile iPhone 4 that I'm having proximity sensor issues with. Can I take my logic board and install it in a AT&T iPhone 4 that I have laying around?
Answer: I haven't personally attempted to (never dealt with a T-Mobile iPhone) however since both are GSM based I believe it should be possible and fairly straight forward.
iFixit has a great guide on replacing the iPhone 4 logic board.  I would follow that guide, tearing down both iPhones at the same time, looking for any differences.  If you come across a difference with the antenna connections, battery connection, etc then I would stop and use your best judgement on whether or not to continue.
An alternative option, if the logic boards are too different to swap, would be to remove and install the AT&T iPhone's display assembly onto your T-Mobile iPhone. This part is less likely to be different than the logic board.
Hope that helps, good luck!

Logic board swap