Why don't phasors give the transient state?

Question: I don't understand why phasor analysis doesn't tell us anything about the transient state. At exactly what part of the analysis is the transient part "lost"?
Comment: The magnitude of \$Ae^{s}\$ is always \$A\$, so not exactly (in the case above, \$A = 1\$). If you have an exponential raised to a scaled imaginary value, you retrieve a sinusoid in both magnitude and phase (steady-state); when you have an exponential raised to a real value, you retrieve an exponential growth/decay in magnitude with zero/180-degree phase (transient). Raising to a complex number results in just the product of both cases (the combination of transient and forced responses).
Comment: In short, when converting from \$s\$ to \$j\omega\$. Note that, in general, \$s = \sigma + j\omega\$. What happens when you evaluate \$e^{s}\$ for both, \$\sigma\$ zero and non-zero?
Comment: @Shamtam Oh I see - so you are essentially not considering the possibility where the magnitude isn't 1? (since in order for the magnitude to be something other than 1, the real part would have to be non-zero)
Comment: @Shamtam Makes sense, thank you. Could you post your comment as an answer? I'll be glad to accept it.
Answer: Phasor analysis allows us to analyze a circuit's response to a sinusoidal steady-state response at a given single frequency. We represent a time-domain voltage \$V(t) = V_{0}cos(\omega t + \phi)\$ in phasor form by transforming it into a complex exponential via Euler's formula...
$$A\cos(\omega t + \phi) = Re\{Ae^{j( \omega t~+~\phi)}\} = Re\{Ae^{j\phi}e^{j\omega t}\}$$
...and then ignoring the frequency/time dependence (since we assume everything in the circuit is excited by a steady sinusoid of the same frequency). Thus,
$$V= Ae^{j\phi}$$
This \$V\$ is what we call a phasor. We can represent any current or voltage as a phasor. In order to recover a time-domain representation from a phasor, you can multiply it by \$e^{j\omega t}\$ and then take the real part. Note that sometimes for the sake of brevity/familiarity in calculating power, we also convert the amplitude of the phasor into RMS values (divide magnitude by \$\sqrt{2}\$ for a sinusoid). Phasors allow us to use analogous DC analysis techniques to recover transfer functions of linear circuits (by using impedances). Using superposition, we can use Fourier analysis to analyze a circuit's complete steady-state response as a sum of its steady-state response due to different frequency components.
It's useful to note the relation of phasors to the Laplace representation of a circuit. The Laplace representation of a circuit uses the variable \$s = \sigma + j\omega\$. Note that for \$\sigma = 0\$, the transfer function of the Laplace representation of a circuit reduces down to the phasor representation. This is a good indication that the real part of \$s\$ represents a transient response (and this can be easily observed by noting that \$e^{at}\$ for any real \$a\$ will result in a real value that either exponentially grows or decays). Note that the Laplace representation is a more general representation of a circuit that includes both transient and steady-state responses. Likewise, it's good to note that the Fourier transform is just a special case of the more general Laplace transform (the case where \$\sigma = 0\$ in \$s = j\omega\$).
Answer: Mathematically, nothing gets lost. Phasor analysis gives you the value of every voltage and current in the circuit for all time, in the form of cosine functions:
$$V_a = A_1 \cos (\omega t + \phi_1)$$
$$V_b = A_2 \cos (\omega t + \phi_2)$$
$$I_c = A_3 \cos (\omega t + \phi_3)$$
$$etc.$$
You specify \$\omega\$ and the amplitude and phase for at least one voltage or current, and phasor analysis gives you \$A\$ and \$\phi\$ for all the rest.
The problem isn't that the transient behavior gets lost, it's that you never put it in! By definition, phasor analysis works on unchanging eternal sinusoids at a single frequency applied to a linear time-invariant system -- the so-called sinusoidal steady state. "Steady state" is the opposite of "transient". You can extend this to cover exponential growth and decay, but again, this is eternal growth and decay. The math only works because your voltages and currents are complex exponentials, which aren't distorted by linear differential equations.
To describe a situation where you flip a switch at t = 0, you need to use a step function. Step functions cannot be represented by a single frequency, so phasor analysis breaks down. To handle this, you need to use Fourier analysis.
Comment: Sidenote: w.r.t. the last paragraph, Laplace transform is also valid, and of course time-domain analysis.
Answer: I know this is a late answer, but I want to give a different insight as to why phasors only give the steady state response.
Consider the well known RC circuit, with a driving source \$v_s=\text{V}\cos(\omega t + \phi)\$, then you have the differential equation:
$$ \text{RC}\dfrac{dv_c}{dt} + v_c=\cos(\omega t + \phi)$$
From a mathematics point of view, you can solve this differential equation by finding the homogeneous solution and a particular solution and when you add them up you get the general solution. So far so good.
Phasors give you a particular solution only (it doesn't give you the homogeneous solution, which is the transient solution) and the particular solution is what we call the steady state response.
In other words, the homogeneous solution (transient or natural response) is the solution to
$$ \dfrac{dv_c}{dt} + \dfrac{1}{\text{RC}}v_c=0$$
which you can find by the integrating factor method.
And the particular solution, using the fact that you can write the input source as \$\Re\{\text{V}e^{j\omega t}e^{j\phi}\}\$, where \$\Re\$ means the real part of. For the particular solution, we make a 'guess', based on the forcing function:
$$\dfrac{dv_c}{dt} + \dfrac{1}{\text{RC}}v_c= \dfrac{\text{V}}{\text{RC}}e^{j\phi}e^{j\omega t}$$
If you guess that your particular solution has the form \$v_{c,p}=\text{A}e^{j\omega t}\$, where \$A\$ will be a phasor too (it will have a magnitude and a phase in the end), just like \$\text{V}e^{j\phi}\$ is, by the definition of a phasor.
$$j\omega \text{A}e^{j\omega t}+ \dfrac{1}{\text{RC}}\text{A}e^{j\omega t}= \dfrac{\text{V}}{\text{RC}}e^{j\phi}e^{j\omega t}$$
which you can simplify by dividing by \$e^{j\omega t}\$ and factoring the \$\text{A}\$ terms
$$\text{A}\bigg(j\omega+\dfrac{1}{\text{RC}}\bigg)= \dfrac{\text{V}}{\text{RC}}e^{j\phi}$$
$$ \text{A}=\dfrac{\text{V}e^{j\phi}}{j\omega\text{RC}+1}$$
And in the end, \$\text{A}\$, will be a phasor of the form:
$$\text{A}=|\text{A}|\angle{\theta} $$
So when you find \$v_{c,p}\$, you only have the particular solution (forced response, steady-state). You'd still need to find the solution to aforementioned homogeneous equation to have a full response.
In short, phasors give you a particular solution to the differential equation.
Comment: Hi, so what would happen if you included  $$e^{j \omega t}$$ in the phasor. Since now we are dealing with a quantity which includes time variance, would we now be able to find the general/transient solution?
Comment: @Resquiens I don't know if I quite understand your question. Once you find the particular solution (\$v_{c,p}=\text{A}e^{j\omega t}\$) where A is the phasor found in the post, that's still the particular solution. To find the general response, you need to find the solution to the original differential al equation with the right hand side set to zero (transient) and add it to the particular solution. The general solution could also be found altogether by using laplace transform.
Comment: Let me precise a thing: The homogeneous solution is NOT the transient solution: the latter is the sum of both the homogeneous solution plus the particular solution). Or, in more "circuital" terms, the transient response is the sum of both the free and forced responses.

Aside from that: I think this is the best response, because it's precise and simple: The phasor analysis does not give the transient response because the transient response involves the natural response, and this is not obtained by phasor analysis.
Comment: Thanks for the comment @OrestesMas. It's been a while but my recollection is that the transient response is what decays to zero exponentially for a stable system and then you're left with the steady state response after all the transients have died out. I do remember for sure that the **complete** solution is either the homogeneous + particular solns (what a mathematician would do), or the free + the forced response (EE), or the zero input + the zero state response (EE/Control systems), all of those forms add up to the same final result but the individual terms may be different.
Comment: See here :) : https://en.m.wikipedia.org/wiki/Transient_(oscillation)
Comment: @Big6. That Wikipedia article seems to link transient with oscillation, which is misleading, as circuits can have other kind of transients (mainly exponential, but others are also possible).
Answer: Although I think that @Big6 answer is a good one, I'd like to answer the OP from the Laplace transform point of view, for the sake of completeness.
So, suppose you have a linear SISO system that has a generic transfer function \$H(s)\$ which satisfies:

Is of order \$N\$, so it has \$N\$ poles.
Is stable, so all its poles have negative real part (they lie on the left-hand side of the complex plane).
The system does not have initial conditions (this is not mandatory but will shorten the explanation).

Also, suppose you feed the system's input with a generic sinusoidal function \$e(t)=A\cdot\cos(\omega\;t+\phi)\$.
Our first goal will be to find the system's time response using the Laplace Transform technique. To do so, we use the relation,
\begin{equation}
  R(s) = H(s) \cdot E(s) \tag{1}
\end{equation}
where \$E(s)\$ ans \$R(s)\$ are the Laplace transforms of input and output signals, respectively, and \$H(s)\$ is the transfer function.
We start using basic trigonometry relations to find the Laplace transform of equation \$(1)\$:
$$
A\cdot\cos(\omega\;t+\phi) = A\cdot[\cos(\omega\;t)\cdot\cos(\phi) - \sin(\omega\;t)\cdot\sin(\phi)]
$$
so
$$
E(s) = \mathcal{L}\left\lbrace e(t) \right\rbrace = \mathcal{L}\left\lbrace A\cdot\cos(\omega\;t+\phi) \right\rbrace = A\cdot\left[\frac{s\cdot\cos(\phi)}{s^2+\omega^2} - \frac{\omega\cdot\sin(\phi)}{s^2+\omega^2}\right]\tag{2}
$$
Combining equations \$(1)\$ and \$(2)\$ we have:
$$
R(s) = H(s) \cdot A\cdot\left[\frac{s\cdot\cos(\phi) - \omega\cdot\sin(\phi)}{s^2+\omega^2}\right]\tag{3}
$$
We don't know much of \$H(s)\$ but, as it has \$N\$ poles, we can write them explicitly. Also, we write explicitly the two poles of \$E(s)\$. after that, we write the partial-fraction expansion of R(s):
$$\begin{align}
R(s) &= \frac{N(s)}{(s-p_1)\cdots(s-p_n)}\cdot A\cdot\left[\frac{s\cdot\cos(\phi) - \omega\cdot\sin(\phi)}{(s-j\omega)\cdot(s+j\omega)}\right]\\
     &= \color{blue}{\frac{k_1}{(s-p_1)} + \cdots + \frac{k_n}{(s-p_n)}} + \color{red}{\frac{k}{(s-j\omega)} + \frac{k^*}{(s+j\omega)}}
\end{align}\tag{4}
$$
where \$k_1 \cdots k_n\$ are the residues associated with poles \$ p_1\cdots p_n\$ and \$k, k^*\$ are the (conjugate) residues associated with the conjugate poles of the input signal.
Now the key part: Note that the blue terms correspond to the free or natural response of the system (due to system poles) and the red terms correspond to the forced response (due to poles introduced by the external input). Note also that because the circuit is supposed to be stable, the natural response will decay to zero after some time, and only the forced (red) response will remain, which will be the steady-state response of the whole circuit to that input.
So, if we're NOT INTERESTED in calculating the transient, we can obviate the blue terms and calculate only the steady-state (red) response, which we will denote \$R_{ss}(s)\$:
$$
\color{red}{R_{ss}(s) = \frac{k}{(s-j\omega)} + \frac{k^*}{(s+j\omega)}}\tag{5}
$$
We calculate now the residue \$k\$ using the Heaviside Cover-Up method on equation \$(3)\$:
$$
\begin{align}
k &= (s-j\omega)\cdot H(s) \cdot A\cdot\left[\frac{s\cdot\cos(\phi) - \omega\cdot\sin(\phi)}{(s-j\omega)\cdot(s+j\omega)}\right]\Biggr\vert_{s=j\omega} \\
  &= H(j\omega) \cdot A \cdot\left[\frac{j\omega\cdot\cos(\phi)-\omega\sin(\phi)}{2j\omega}\right]\\
  &= H(j\omega) \cdot \frac{A}{2} \cdot \left(\cos(\phi) + j\sin(\phi)\right)
\end{align}
$$
or, in polar form:
$$
k = \bigl|H(j\omega)\bigr| \cdot \frac{A}{2}\cdot e^{j(\measuredangle{H(j\omega)}+\phi)} \tag{6}
$$
If we substitute this residue into equation \$(5)\$ (the conjugate is straightforward), find the Inverse Laplace of the two fractions and use Euler's formula to eliminate complex exponentials we obtain:
$$
r_{ss}(t) = A \cdot \bigl|H(j\omega)\bigr| \cdot \cos\bigl(\omega\;t + \phi + \measuredangle{H(j\omega)}\bigr) \tag{7}
$$
Bear in mind that \$(7)\$ is the steady-state response to the input signal \$e(t)=A\cdot\cos(\omega\;t+\phi)\$. So, what has to do this result with phasor analysis? The answer is that if we express the input and output in phasor form we have:
$$
\begin{align}
 \overline{\mathbf{E}} &= A\cdot e^{j\phi} \\
 \overline{\mathbf{R}}_{ss} &= A\cdot \bigl|H(j\omega)\bigr|e^{j(\measuredangle{H(j\omega)}+\phi)} = \bigl|H(j\omega)\bigr|e^{j\measuredangle{H(j\omega)}} \cdot A\cdot e^{j\phi}
\end{align}
$$
so
$$
\overline{\mathbf{R}}_{ss} = H(j\omega) \cdot \overline{\mathbf{E}} \tag{8}
$$
Equation \$(8)\$ is the same you obtain by phasor analysis, which explains why you don't obtain the transient response with it: because the entire phasor analysis procedure is designed to ignore the free or natural response, and goes directly to the forced response.
Answer: Like Adam and Auston already pointed out transient information is never included in phasor analysis, at least not in 2D. Putting it in would require an additional dimension, like this 3D phasor envelope of an amplitude modulated sine wave.

A transient, like the decay of a damped oscillation would look like a cone-shaped rotating vector decaying in an exponential fashion. Complex numbers would also no longer be suitable.
Answer: Phasors assume a sinusoidal waveform, sinusoids go on forever, they don't have any transient behavior. The transient part is lost the same way you can assume a capacitor that has been charging for "a long time" is fully charged.


Why didn't the EDL mic record sound during the entry and descent of Perseverance?

Question: This NASA webpage says that the EDL mic wasn't able to record sound during the descent, but has been able to record sound from the surface of Mars. So the mic is functional. But why couldn't it record sound during the descent? The webpage mentions the turbulence of the entry and descent, but is rather vague on the subject.
Comment: @JonCuster I wonder why it was called the **EDL mic** if it wasn't supposed to be on during, um, EDL.
Comment: Perhaps having non-essential things on during a complex operation is not a good idea?
Comment: Because there is less risk (and more available power) while just driving around as opposed to falling out of space.
Comment: @JonCuster Then why did they have an EDL mic in the first place?
Answer: There's an interview with the audio engineer for the mission, Jason Achilles Mezilis, on the Naked Scientists Podcast.  The system was supposed to record five and a half minutes of audio during the descent.  He has a brief mention of the problem around 43:00 on the podcast.  He didn't go into great detail.

By the end of the first day it was relatively known that ... that the audio was lost.  It was basically a problem between the digitizer and the software.  Things not talking to each other.

Technology Review has an article with a similar quote from "NASA Officials"...

The [EDL] microphone unfortunately failed to collect data properly. It does not seem to be a hardware issue, and NASA officials speculate there was a communication error between the system that converts sound from analog to digital and the onboard computer.
Comment: The podcast has some other comments.  It seems to be a "last-second" edition as an external request.  NASA basically telling them they could stick the microphone on as long as they did it in a way that didn't endanger the other mission goals.  So it wan't really part of the project the way other instruments were.
Comment: Interesting, wonder how that slipped through testing.


Exponentiation in Non-Commutative Rings

Question: I'm fairly new to abstract algebra and in an exercise I was asked under which conditions it is true that $(ab)^n = a^nb^n$, for $a,b \in R$ and $n$ a positive integer, where $R$ is a ring. It can be easily shown that the statement holds if $R$ is commutative but I am stuck on the reverse implication. I have shown that if $R$ contains no zero divisors then the statement implies commutativity. Indeed, taking $n = 2$
$$(ab)^2 = abab = a^2b^2 \Leftrightarrow a(ba-ab)b = 0 \Leftrightarrow ba = ab$$
Does there exist non-commutative rings with zero divisors such that $(ab)^n =a^nb^n$ or is this property equivalent to commutativity?
Comment: If for you "ring" does not mean "ring with $1$", then matrices with entries in $X^N(\Bbb Z[X]/X^{4N})$ should be an example because squares of products as well as products of squares (or any product of four factors) are zero
Comment: $a(ba-ab)b = 0 \Leftrightarrow ba = ab$ is not a correct equivalence.
Comment: Why? If $a,b \neq 0$ and $R$ has no zero divisors then surely the equivalence should hold? Or am I missing something?
Comment: Oh, I didn't realize you said "no zero divisors"!
Answer: Hagen von Eitzen gave a noncommutative nonunital ring with this property in the comments. However if your ring has a unit, this is impossible.
The proof below is a mess of algebra, so let me briefly explain the idea.
The problem is that the equalities we are given are homogeneous equations of degree at least $4$, like $abab=a^2b^2$, and we want a homogeneous equation of degree 2, $ab=ba$. Thus we need to somehow dehomogenify these equations, which we can do by substituting $a=1+a$ or $b=1+b$ and seeing what we get. This is the idea of the proof below.
Edit:
I will leave my original proof below, but darij grinberg suggested an excellent way to simplify the calculations by phrasing things in terms of commutators in the comments below.
Observe that the condition $abab=a^2b^2$ for all $a$ and $b$ is the same as saying $$a[a,b]b=0$$ for all $a$ and $b$. Now note that substituting $1+a$ in for $a$ gives $$(a+1)[a+1,b]b=(a+1)[a,b]b=0,$$ since $[1,b]=0$. Similarly, we also get $$a[a,b](b+1)=0\text{, and }(a+1)[a,b](b+1)=0.$$ Now add the first and fourth equations and subtract the middle two to get:
$$a[a,b]b - (a[a,b]b + [a,b]b) - (a[a,b]b+a[a,b]) + (a[a,b]b + a[a,b] + [a,b]b + [a,b]) =0,$$
or, on simplifying, $$[a,b]=0,$$
as desired.
Orignal proof
Consider
$$a^2+2a^2b+a^2b^2=a^2(1+b)^2$$
$$=(a(1+b))^2=(a+ab)^2 = a^2+a^2b + aba + abab.$$
Now use that $a^2b^2 = abab$, and cancel $a^2+a^2b+abab$ from both sides to get
$$ a^2b = aba.$$
By symmetry, we must also have $ba^2=aba$, by considering $(1+b)^2a^2$.
Now consider $(1+a)^2(1+b)^2$.
Expanding this directly, we get
$$(1+2a+a^2)(1+2b+b^2)$$
$$ = 1+2b+b^2 + 2a+4ab + 2ab^2 + a^2 + 2a^2b + a^2 b^2$$
On the other hand, we also have
$$(1+a)^2(1+b)^2=((1+a)(1+b))^2 = (1+a+b+ab)^2,$$
which expands to
$$ 1 + a + b + ab + a + a^2 + ab + a^2b + b + ba + b^2 + bab + ab + aba + ab^2 + abab
$$
$$ = 1 + 2a + 2b + 3ab + a^2 + a^2b + ba + b^2 + bab + aba + ab^2 + abab.
$$
Now use that $bab=ab^2$, $aba=a^2b$, and $abab=a^2b^2$ to rewrite this as
$$ 1 + 2a + 2b + 3ab + a^2 + 2a^2b + ba + b^2 + 2ab^2 + a^2b^2.
$$
Thus we end up with the equality,
$$ 1 + 2a + 2b +4ab + a^2 + b^2 + 2ab^2 + 2a^2b + a^2 b^2$$
$$=1 + 2a + 2b + 3ab + ba + a^2 + b^2 + 2a^2b + 2ab^2 + a^2b^2.
$$
Cancelling $1+2a+2b+3ab+a^2+b^2+2a^2b+2ab^2+a^2b^2$, we end up with
$$ab=ba,$$
as desired.
Comment: Nice! I'm seeing a way to simplify the computations, though. Rewrite the axiom $\left(ab\right)^2 = a^2b^2$ as $a\left[a,b\right]b=0$, where the square brackets denote a commutator. Now, substitute either $1+a$ for $a$, or $1+b$ for $b$, or both. None of these substitutions changes the commutator $\left[a,b\right]$ (since both $\left[1,c\right]$ and $\left[c,1\right]$ are $0$ for any $c \in R$). So you get $\left(1+a\right)\left[a,b\right]b = 0$ and $a\left[a,b\right]\left(1+b\right) = 0$ and $\left(1+a\right)\left[a,b\right]\left(1+b\right) = 0$ and (your original ...
Comment: ... equation) $a\left[a,b\right]b = 0$. Now, adding together the last two of these four equalities, and subtracting the first two equalities from the result, you obtain $\left[a,b\right] = 0$, which is equivalent to $ab=ba$.
Comment: @darijgrinberg, very nice! I might edit that into my answer in a bit, since you're right, that'll drastically simplify the algebra!
Comment: Now, I remember a m.se post that disproves the analogous claim for $n = 3$ (that is, the claim that any unital ring $R$ satisfying the axiom $\left(ab\right)^3 = a^3 b^3$ must be commutative). Can anyone find it?

Exponentiation in Non-Commutative Rings


How to use thematic layer for supervised classification in eCognition

Question: I'm classifying vegetation in eCognition. From ArcMap I already have a shapefile with training polygons that I would like to use for this but so far I was only able to insert this as a thematic layer and use for the segmentation process. Also, is eCognition able to handle the attribute table information where the classes for the polygons are stored or will I have to split the shapefile with all the information into individual shapefiles?
Answer: If you want to use training polygons as samples in eCognition you need to add them as a TTA mask (Training and Test Area), also this can be used in Accuracy Assessment process.
A TTA mask is a raster layer with training classes as integers. You also need to create a .csv file with Class name, ID, Red, Green and Blue (0-255 value for coloring each training class).
I've been using an R code for this purpose, it could help you:
<code>require(rgdal)
require(raster)

# Load training shapefile
shp <- readOGR(dsn="/path/to/folder", layer = "layer_name")

r <- setValues(raster("/path/to/sample/layer/used/in/eCognition"), values = NA)

Class_Names <- unique(shp@data$Class_name_field)
id <- as.numeric(unique(shp@data$Integer_ID_field))
Red <- round(sample(0:255,length(Class_Names),replace = T))
Green <- round(sample(0:255,length(Class_Names),replace = T))
Blue <- round(sample(0:255,length(Class_Names),replace = T))

TTAconversor <- data.frame(id,Red,Green,Blue,Class_Names)

write.table(TTAconversor,file = "/path/to/TTAMask.csv",quote = F,row.names=F,sep = ";") # sep = ',' if this csv doesn't work

TTAr <- rasterize(shp,r,field=as.numeric(shp@data$Integer_ID_field),background=255)

writeRaster(TTAr,filename ="/path/to/TTAmask",format = "GTiff", overwrite= T, datatype="INT1U") #same name than .csv file
</code>
Finally, add TTA mask by selecting Classification / Samples / Load TTA Mask and a dialog box will appear asking if you want to use this mask as training samples.
Comment: "I also need to do supervised classification. I will try to follow your method"


Corroded brake levers

Question: I think this corrosion comes from sweat. How can this be removed?
Comment: Remove it?  Why?  It's a badge of honor!
Comment: (There is a slight chance that what you see is staining of the anodized layer, but I don't know of a way to remove the stains without damaging the surface.)
Answer: I don't think you can. It looks to me like the anodized surface layer has worn off, exposing the plain aluminum.
Answer: I have exactly the same 'stains' on my 2003 Centaur Ergopower levers, which I also attributed to the layer of anodization wearing off. It is not corrosion.
Different thermal expansion rates of the oxide and the alloy underneath could damage the layer of anodization. Not sure if the presence of mildy acidic human sweat could accelerate the process significantly.
You cannot 'clean' the lever, although technically you could get it anodized again (or buy new carbon levers which do not have THIS problem -- they have a protective veneer which chips away..).

Corroded brake levers


AWS API Gateway authentication error IncompleteSignatureException using JWT with Auth0

Question: Where I'm At
I'm currently working through setting up Auth0 delegated authentication for AWS API Gateway. I've followed the documentation and tutorials below with the exception that I have an app in place rather than their example apps:
https://auth0.com/docs/quickstart/spa/angular2/aws
https://auth0.com/blog/2015/11/10/introducing-angular2-jwt-a-library-for-angular2-authentication/
https://auth0.com/docs/client-platforms/angular2
https://auth0.com/docs/integrations/aws-api-gateway/part-2
What is Working

Auth0 sign on from my Angular2 app is working correctly and I'm getting a token.
Auth0's AuthHttp component is attaching the bearer token to the Authenticate header when I call the AWS API Gateway.

What is Not Working

Status 403 response from AWS API Gateway indicating a Cloudfront IncompleteSignatureException; "Authentication header missing equal-sign".

The authentication header is
Authentication: Bearer edJ0e...[I've truncated for brevity]

Could AWS be expecting a different type of authentication which uses key value pairs? How to I tell AWS API Gateway that it should be looking for a JWT?
Answer: I'm guessing you have AWS_IAM authentication enabled for your API Gateway endpoint. You need to disable that if you aren't planning to use it. If you plan to use AWS_IAM authentication in addition to JWT then you will have to send the JWT token using a different field.
From part 5 of the Auth0 tutorial you linked:

The final step is to pass the JWT to the method from the browser
  client. The standard method is with an Authorization header as a
  bearer token, and you can use this method if you turn off IAM
  authorization and rely solely upon the OpenID token for authorization
  (you will also need to map the Authorization header into the event
  data passed to the AWS Lambda function). If you are using IAM, then
  the AWS API Gateway uses the Authorization header to contain the
  signature of the message, and you will break the authentication by
  inserting the JWT into this header. You could either add a custom
  header for the JWT, or put it into the body of the message. If you
  choose to use a custom header, you'll also need to do some mapping for
  the Integration Request of the POST method
Answer: Based on the error message, it sounds like you've configured your API for AWS_IAM authentication. This requires your request be signed with AWS Signature Version 4.
In order to execute API Gateway functions you will need to do 1 of 3 things:

Get AWS credentials via IAM/STS as noted in the auth0 example and use those to sign your request.
As noted in Mark B's answer, follow the instructions in step 5 of the tutorial from auth0 and disable AWS_IAM auth and do the validation inside your Lambda.
Switch to use a custom authorizer to validate the JWT directly at the API Gateway layer. This would require you to take the code Auth0 provides to validate the token then build your own authorizer result.
Answer: (Posted on behalf of the question author).
Update
Both Mark B and Bob Kinney are correct. What I did (and you may have as well) is jump around in the various Auth0 links I posted at the top of this question and attempt to use their angular2-jwt library (with the AuthHttp component) to adapt the tutorial to Angular2 while following along with their 5-part example of setting up Auth0 with AWS API Gateway. The AuthHttp component will automatically put the JWT Bearer token in the "Authentication" HTTP header which is incompatible with an AWS API Gateway call secured by IAM authorization. As these gents showed me, this is explained in part 5 of the tutorial. If you only made it to part 4 and it's not working hopefully this answers your question as it did mine.
Update 2
The Auth0 Angular2 tutorial has been updated to reflect Angular2 rc 1. https://auth0.com/blog/2015/05/14/creating-your-first-real-world-angular-2-app-from-authentication-to-calling-an-api-and-everything-in-between/


Can contact.BirthDate be encrypted in Platform Encryption?

Question: Platofrm Encryption Documentation doesn't include "Birthdate" as one of the standard fields that can be encrypted and I don't see the option to encrypt the field in the org. Is there any way to encrypt it? One solution I can think of is to create a custom field and encrypt that.
Answer: Thank you for your interest in shield encryption.
Unfortunately, supporting standard date fields is very challenging because they're stored as dates in our database, giving no option for replacing them by their corresponding ciphertext that require a varchar column.
Custom date fields, on the other hand, can be encrypted, thanks to the way they are stored in the database.
Comment: do you mind answering this one too please? I'm having difficulty encrypting contact.name field
http://salesforce.stackexchange.com/questions/161352/encrypting-contact-name-when-using-owasp


Normality test of latent residuals (Heckman) Probit?

Question: I am running a Heckman Probit. Both steps assume normal errors of the latent variable, correct? My data is from a survey and a lot of variables are strongly skewed, so I am worried whether this assumption holds. Is there any test I can use? The sample is 10 000, does it help?
Also, can I make the errors closer to normal by transforming the data in some way? Say, taking logs?
Answer: The distribution of the explanatory variable is immaterial for the distribution of the residuals. Since this is at its core a probit model with some additional bells and whistles the residuals that your model cares about cannot be observed, so you can forget about checking these directly. It is easier to think about this assumption as an assumption on the functional form of the relationship between the probability and the explanatory variables and (graphically) check these.
Comment: Thanks! How do I check it graphically? Do you suggest plotting actual dependent variable vs predicted for the variable of interest at mean of other controls?


Will it be possible to use Java 8 on Glassfish 3?

Question: We currently use Glassfish 3 and I really want to use Java 8.  I tried upgrading to Glassfish 4, but I experienced two bugs in the Glassfish 4 code so I had to revert back to Glassfish 3.  Will Glassfish 3 work with Java 8 or will I have to upgrade my application container?
Comment: @Coffee what does that have to do with Glassfish **3**?
Answer: No, it won't be possible (at the moment, maybe a workaround will occur later).
I tried Glassfish 3.1.1 and Glassfish 18.104.22.168 with the final Java 8 JDK which was released today. It doesn't even start the server, some OSGI exceptions are thrown.
As the comment to your question showed, it doesn't even work with earlier builds of Glassfish 4.0.
Update 2015:
It looks like there is a way to make it work with Glassfish 22.214.171.124.
Open the file /glassfish/domains/domain1/config/osgi.properties of your Glassfish installation and add the following line at the end of the file: jre-1.8=${jre-1.7}
This should make the server start with JDK 8. It still doesn't work for Glassfish 3.1 or 3.1.1.
See also:

JDK-8020071 Unable to start Glassfish 3.1.1. with JDK 8
GLASSFISH-19363 GF fails to start on jdk8
Comment: Actually, I've found osgi.properties in `/[GF-3.1.2HOME]/glassfish/config`.
Comment: I got Glassfish 4 to work with Java 8 but you need to update glassfish with the update-tool and then start glassfish with a Java 8 vm. There seem to be some problems so don't use it in production environments!
Comment: Looks like the bugs you listed got resolved. Anybody knows if it's working now?
Comment: I've modified `/[GF-3.1.2HOME]/glassfish/osgi/felix/conf/config.properties` file
Answer: Stopped by an error after upgrading my Java 7 to Java 8.
Glassfish 126.96.36.199 just won't start.
Found a solution:
edit osgi.properties file in the glassfish/config folder and add this line at the end:
jre-1.8=${jre-1.7}

Comment: just had a quick test with some sample apps, got on deployment gf is logging Exception while visiting xxxx.class of size 11939
java.lang.ArrayIndexOutOfBoundsException: 28954 on of the apps (ear) while one other war file seems ok... might be some config or import conflict... dunno if anyone has tried with more detailed tests?
Comment: So glassfish starts up and your app works correctly after this minor change?
Comment: This change does allow GF3 to start. Does anyone have any experience beyond this to say if this is the only change needed?
Comment: Yup, this hack worked for me. (Win 7, GF Open Source Edition 184.108.40.206,
JRE: Java HotSpot(TM) 64-Bit Server VM, version 25.40-b25). Thanks! (My webapp is still built with Java 6, though).
Comment: This solution indeed makes glassfish start.... BUT: when I deploy a java 8 war, the app is deployed, but any classes that contain java 8 references are not loaded with a "Exception while visiting xxxx.class of size..." error
Comment: @Vova For the application to point to jdk 8, the path has to be changed in the admin config page of glassfish server.
```
Configuration-> Server config - > JVM Settings-> JAVA_HOME
````
Answer: After fixing the osgi.properties as mentioned in the other answer, the HTTPS listeners will not work anymore until a patch is applied as mentioned here.


Videogame like object variant switcher

Question: Is there an addon for Blender that allows a person to switch out parts on a model car like you can in a videogame? (One click selection that shows one part variant and hides the previous, and also lines up the parts so when they switch, it doesn't look off kilter)
Comment: Have you thought about using group instances on parent empties?
Comment: Just watched a part of a youtube video on them, I'm not wanting to copy objects multiple times (in this case). I'm trying to have two objects share all the same information except for material and topology, if that makes sense.(I don't know if group instancing allows for that because I've never to my knowledge used them)
Comment: You can switch witch group they reference aka switch the part
Answer: If you have different parts/part groups that you would like to switch out, then group those parts, and reference them from empty objects:

This forms a good basis for using drivers in the future to automate the switching by mixing drivers with the use of Custom Properties:

Videogame like object variant switcher


Salting the same value many times

Question: If someone were to hash the same value with a different salt many times, would it be possible to find the original value?
Comment: You need to read a little about the [properties of a hash function](https://en.wikipedia.org/wiki/Hash_function#Properties).
Comment: You should probably clarify that you're talking about a _cryptographic_ hash. Irreversibility is not a necessary (or even desirable) property of hash functions in general, and many of them are reversible to differing extents.
Answer: If the hash size is smaller than the plaintext size, as is usually the case, of course not. No amount of salting can ever restore what is no longer there.
If the two sizes are the same, but the hash function is not bijective, then again it is not always possible. Given that H = h(s?, v1) = h(s?, v2), knowledge of H and s1 will not give the certainty that v1 and not v2 is the value you seek. On the other hand, either value might work as well for your purposes. This phenomenon is kept to a minimum in hash functions because reducing the output space increases the risk of collisions, which is bad.
In the remaining case, when your hash function is actually an encryption, then depending on the salt values yes, this might happen - but the key here is that you would not know. The amount of work required to discover a value s*, such that h(s*, h(s?, v)) gives back v for that specific value of v, is of the same order of magnitude of the brute force discovery of v in the first place, or worse. Basically you have the hash H, and try all possible s*'s until h(s?, h(s*, H)) = H. When you do, then h(s*, H) = v .
There is a last sub-case, when there exists a function g(s?) which will output exactly the desired value of s*. That function is known as a backdoor and a hash function allowing a backdoor is considered badly broken; using this g() it is trivial to invert the hashing.
To make a simplistic example, you will probably know those mind tricks in which you're asked to get your age, multiply by some number, twist the digit in some way, and get a number which is your age "hashed" and has apparently no relation with the original number. Yet the trickster, upon hearing this hash value, is immediately able to get your age back.
Answer: No, it should not be possible. A hash function were it would be possible should be considered as broken.
To see why it is not possible, look at how the hash is applied. A common way to do it when you are e.g. hashing password is to XOR the password and the salt. If the salt is random, the value that ends up getting hashed - that is password XOR salt - will be equally random. So having a bunch of them isn't really any help.

Salting the same value many times


Finding court cases involving some organization

Question: How can I find court cases that involve a given organization (e.g. some company)?
Comment: In what country?
Comment: Trial court or appellate court? Knowing both the country and the likely state or county would help a lot. In the U.S. knowing if it was in state or federal court would likewise be crucial. In some places, the search tools exist but are unavailable to people who aren't lawyers or private investigators without a fair amount of inconvenience. No harm in trying Google to see if you can find it before doing a more complete search.
Answer:
How can I find court cases that involve a given organization (e.g.
  some company)?

Based on other inquiries you have posted, I gather that you refer to the US.
A very useful, cost-free resource is leagle.com, where you can search for court opinions by court, party name, citation, and so forth.
Another free resource is https://www.justia.com/courts/ . To me it doesn't seem as flexible as Leagle from the standpoint of its search form, but maybe I just haven't explored it enough.
LexisNexis allows for more sophisticated search criteria. You would need a paid subscription unless you can access it from a public/county/community college. Learning the search commands & syntax is not hard. Although its sophisticated functionality is quite useful, I should mention that it not always fetches all the cases it should. LexisNexis was for a while the only resource I used for my legal research. But once I started using Leagle.com, I realized that LexisNexis was missing a case that was extremely important to my litigation.
The aforementioned sites only display court opinions. Many county courts have implemented systems such as Odyssey (example: see here), where you can search from home whether (and if so, the case history) an organization has sued or been sued in that court. To read the parties' briefs, motions, evidence, etc., you would need to go to the courthouse and request to see the case file.
PACER displays the contents of pleadings, motions, briefs, etc. filed in federal court. I am not sure whether there's a type of cost-free account or whether PACER starts charging after requesting the nth page or record.


Is it OK to run SER Cable in gap created by sill plate?

Question: I need to run SER cable from my main panel to a subpanel in an attached garage.  The run will be perpendicular to the first floor joists.  Can I run the SER cable without conduit in the 1-1/2 inch gap created by the sill plate between the top of the basement wall and the bottom of the first floor joists, instead of drilling a hole through every joist?  I am also assuming it would have to be fastened to the sill plate some how.  See picture:
Comment: SER never requires conduit.  In some installations it requires physical protection against damage.  You can use any tough material for that, see 300.4.
Comment: to my eye the plate constitutes a running board, and the recess is also protection.
Answer: That could be an improper exposed location.
You are allowed to run wire through the joists and thus away from the face of the joist, but to run it against the front face or against the plate or concrete wall you need to run it in conduit if the wire is 6 AWG or smaller.
This has to do with the risk of physical damage.

In exposed work, except as provided in 300.11(B), cable shall be installed as specified in 334.15(A) through (C).

(C) In Unfinished Basements and Crawl Spaces
Where cable is run at angles with joists in unfinished basements and crawl spaces, it shall be permissible to secure cables not smaller than two 6 AWG or three 8 AWG conductors directly to the lower edges of the joists. Smaller cables shall be run either through bored holes in joists or on running boards. Nonmetallic-sheathed cable installed on the wall of an unfinished basement shall be permitted to be installed in a listed conduit or tubing or shall be protected in accordance with 300.4.

You could install a running board against the joists (1x3 lumber or strips of plywood) and nail smaller wire to it.


Access to good research communities without being in the university

Question: I'm interested in research in the field of educational sciences. I may enroll in a Ph.D. course in the future. But right now, I'm not a student anywhere and I want to do research in my interested field even without being in the university.
I think one of the most important benefits of being a Ph.D. student is access to scientific community. You have access to professors and other students, and you can engage in a group scientific research work.
My question is that what are the possibilities for an independent researcher (in a developing country) to have access to scientific communities? To have discussions, get reviews, etc. ?
Comment: Where are you based? Where I'm from, you need to have both a bachelors and a masters degree in order to start a PhD, and doing a those would already integrate you into an academic environment.
Comment: I have gotten my BS many years ago and in an unrelated field. My MS is relatively new, but it was not from a good university and it doesn't help me about the above concerns.
Comment: Also, important question: are you a teacher? Most schools should have someone in charge of professional development.
Comment: No, I'm not a teacher. In addition, in my country schools do not provide such opportunities.
Answer: One of your best bets would be to find some active SubReddits, Discord, and GitHub communities. Without university infrastructure, it's a very steep challenge. Even with my suggestions, you become increasingly limited by what you're able to do.
Comment: GitHub communities?
Comment: Yes. GitHub communities exist. For example, Ethereum is a decentralized blockchain network that has active research from a wide variety of people. Keep in mind, there are insanely intelligent people who also look at serious academics with derision. What matters is the quality of the content that is produced, everything else is just administrative.
Answer:
My question is that what are the possibilities for an independent researcher (in a developing country) to have access to scientific communities? To have discussions, get reviews, etc. ?

To get reviews, you need to submit manuscripts to journals.
In addition, setting up a profile at scholarly 'social media'-like sites might help, e.g. ResearchGate. Some people have concerns against such profit-oriented (but free-to-use) platforms, but it might help with finding a small initial network.
To discuss with an informal "community of attention", well, many scholars are on Twitter. You could see what is discussed under the hashtag #HigherEducation, and follow like-minded people to exchange ideas. You can tweet about novel papers you read in your discipline; the authors will notice that and thank you for spreading their ideas (and thereby raising their Altmetric Scores).
Some Twitter accounts are specifically designed to introduce 'earliest career researchers' into the community, e.g. @AcademicChatter.
Answer: It is possible, but difficult. Possibly very difficult. On the other hand, if you can get the process started it can accelerate moderately quickly.
The problem is to make the first contact and convince someone that you have interesting ideas and who will be willing to communicate with you over the long run. Blind emails to people are a poor strategy, since people are busy and it is hard to convince them that working with you will have any value without personal contact.
If you can work independently then you can submit papers to appropriate journals and conferences and make contacts that way, but working alone is, as you say, difficult in itself.
If you can use other social contacts to get you in touch with some academic, and the people recommending you will vouch for you, then you can get started. But, once it happens, make expanding the circle of contacts and even collaboration a major effort. Co-authors, for example, will be happy to introduce you to others.
Note that publishing in academic journals doesn't require that you be associated with any academic institution. The review process tends (most cases) to focus on the papers themselves, not the affiliation of the author.
But, find a way to make some personal contact. Find a way to interest them in some idea you have for research/publications. Expand from there. Not easy, though.
Answer: One silver lining of the pandemic is that most conferences and workshops have gone online, eliminating travel expenses, and cut registration fees, doubly reducing barriers to entry.  You could look for some in your field to keep abreast of what is happening, present your work, and network.


Should I use Chocolate Bars to Enchant?

Question: Should I use chocolate bars to enchant, or save them?  If so, what are the best enchants?
Answer: Definitely enchant your items. There's no really "best" enchantment. You'll trash most of them, eventually, except for the Knight Armor and the Spoon. You can get enough chocolate bars to get all the enchantments anyway.
Basically, for starters:
Red gloves: Shoot fireballs. They do 15 damage. Useful for taking down enemies from a distance. Unfortunately, they have no set direction.
Pink gloves: Give life regen. Useful for getting your health back (obviously).
Octopus crown with Jaspers: Shoot bigger fireballs in every direction. Once you have this, you'll trash the Red gloves.
Octopus crown with Obsidian: Summons an octopus, occasionally. They have a ton of health, and do a decent amount of damage. Their major flaw is that they will come towards you and block your path unless you have the pogo stick.
Answer: Yes, use them, you need to enchant your items.
All enchants are generally good. Some items can be enchanted multiple times if you get that item again (EG the gloves or octopus crown. Make sure you keep one Octopus crown unenchanted) You can only wear one at a time, though.

Should I use Chocolate Bars to Enchant?


XSLT for-each select syntax

Question: I've inherited a gross xslt project - I can't figure out how this line of code reads
<xsl:for-each select="*[local-name()='CustomerOrderLine'][count(. | key('orderline-by-ShipAddress', *[local-name()='CustomerOrderPostalAddresses']/*[local-name()='CustomerOrderPostalAddress']/*[local-name()='PostalAddress']/*[local-name()='Line3'])[1]) = 1]">

I understand that this for-each is selecting 'CustomerOrderLine' nodes based off something to do with the 'orderline-by-ShipAddress' key and some kind of union between it and the current node.
I'm looking to understand how this code "reads" so I can better understand how it's working and what I'll need to change in order to re-use the technique.
Comment: Can you post the xslt snip and the xml?
Answer: This looks like Grouping Using the Muenchian Method
Basically it is a way to group elements.
Answer: Read about Muenchian grouping here: http://www.jenitennison.com/xslt/grouping/muenchian.xml. It is used together with an xsl:key to group and identify the first item in each group. So that for-each processes the first CustomerOrderLine in each group where the grouping is based on the value of the Line3 descendant.

XSLT for-each select syntax


Difficulty Adding .Lib files in VS 2010 C# Forms Application

Question: To start, I'm pretty rusty in programming.  I'm trying to link an external library (FFMpeg) to my C# forms application in VS 2010, and I'm having difficulty.  All signs point to using "Property Sheets" but mine looks more empty than everyone elses in the examples I've found online (such as http://www.youtube.com/watch?v=5AmwIwedTCM).  This is what mine looks like: https://i.stack.imgur.com/oH9ZR.jpg .  Is there something I've been doing wrong, or did I mess up my property sheets in the past and now I'm suffering the consequences?  Please help.  Thanks in advance.
Answer: You can't add .lib files to C# projects directly. Either you have to P/Invoke them, make an interop for COM assemblies or make a managed wrapper using C++/CLI.


List Date/Time column only shows times as "12:00"

Question: I have a list that has a date/time field, which is set to display date and time (not Date Only).  However, whenever times are captured in this field, the time always shows "12:00".  Is there something I'm missing in order to make this show the correct time?
Answer: This is the default value if you don't select the time you need.
You could change the time as needed:

Or if you want to capture the current time, go to list settings> choose the date column> set the default value as now:

After this, when we add a new list item, the date and time column will show current time as default value:


Which javascript minification library produces better results?

Question: Between Yahoo! UI Compressor, Dean Edwards Packer and jsmin, which produces better results, both in terms of resulting footprint and fewer errors when obfuscating.
Answer: A great way to compare the best compressors is The JavaScript CompressorRater by Arthur Blake.
What you're usually interested in is the size after compressing with GZIP (you should configure your web server to perform the compression).
The best results are usually from the YUI Compressor or Dojo ShrinkSafe. The differences were so small that after a while I stopped comparing and I just use the YUI Compressor.
EDIT:
since the original time this question was asked, 2 new minifiers have been released. They're both usually at least as good as, if not better than, the YUI Compressor.

Google's Closure Compiler. Includes an aggressive advanced optimization mode that's sometimes applicable.
Microsoft's Ajax Minifier (search this page for "minifier")

EDIT 2:

UglifyJS, chosen by the jQuery team for the official 1.5 release
Answer: Better is a bit subjective here, since there are multiple factors to consider (even beyond those you list):

Compressed size doesn't tell the whole story, since an aggressive compressor can result in slower run-time performance due to the additional time needed to run unpacking code prior to browser interpretation.

Errors are easiest to avoid when you control the input code - judicious use of semicolons goes a long way. Run JSLint over your code, and fix any problems reported.
The style and size of the code itself will affect the results, of course.
And finally, it's worth keeping in mind that server-side gzip compression will always result in a smaller download than any code compression, although some code compression tools will combine with gzip more effectively.

My recommendation is to run the code you intend to compress through several compressors (an automated comparison tool such as CompressorRater helps...), and choose based on the results - remembering to test, profile and compare the actual page load times afterward.
Comment: It's generally a good idea to time performance and see the effect, but in the case of JSMin, Dojo ShrinkSafe, and the YUI Compressor they only decrease file size (replace symbols, remove dead code) - they don't modify the behavior. Dean Edward's packer does increase processing time.
Answer: Definitely check out Dojo Shrinksafe. It was reworked recently and apparently the performance has been improved.
Comment: +1 because I don't have to download it like Yahoo's.
Answer: Full disclosure, I'm behind this: http://www.toptensoftware.com/minime which does minification, obfuscation and a reasonable set of lint style checks.  Currently it produces smaller output than Yui, not quite as good as Closure.
Answer: This is an old question and the Google Closure Compiler didn't exist then. I haven't used it yet, but it looks really good.
Answer: As a Mootools user, I notice that Mootools has replaced Dean Edwards' Packer by YUI Compressor.  I also remember there was a discussion on Ajaxian.com where Julien (Compressor author) pointed out the areas where YUI Compressor did better.  I used Compressor and have never seen any problem, but I have never studied to which produces fewer error when obfuscating.
Answer: YUI Compressor compresses more safely and compactly than Packer does. I believe Packer needs the JavaScript to be perfectly formed otherwise it will cause a JavaScript error when the script is loaded. Still, regardless of which you use, you'll get the biggest performance increase by Gzipping your file.
Answer: There's also a port of the YUICompress for .NET (which includes a build task for TFS) on Codeplex.


Generating set of a group and relation to diameter?

Question:
Is there an efficient algorithm to test if a given subset of symmetric group generates the symmetric group?
Drawing the Cayley graph and testing for all pairs reachability is one way however that scales in the size of the group.
Is there a relation between maximum distance between generating elements where distance betwee two elements of generating elements is with respect to transpositions and diameter of Cayley graph of the group with respect to the generating set?
Comment: From the theoretical side, a theorem of Jordan states that a subgroup of $S_n$ which is transitive, primitive and contains a large enough cycle is the symmetric group (see ie Dixon's article "The probability of generating the symmetric group" https://link.springer.com/article/10.1007%2FBF01110210)
Comment: These questions might find more answers on mathoverflow where people doing group theory.
To partially answer (1), you might first rule out some trivial cases where the answer is no by computing the signature of your permutations and check if all points are moved (ie if the group is transitive).
Answer: The answer to the first part of your question is yes.
Given a permutation group $G = \langle S \rangle$, there is a polynomial time algorithm (clearly more efficient than the brute force approach which has factorial complexity), the Schreier-Sims algorithm (https://en.wikipedia.org/wiki/Schreier%E2%80%93Sims_algorithm) which computes a base and strong generating set (BSGS) that can be used to compute the order of the group (hence decide if $G=S_n$).
A good reference seems to be Seress' Permutation Group Algorithms and especially chapter 4.
Also, this question can be solved in practice by using GAP $\texttt{IsSymmetricGroup}$ (https://www.gap-system.org/Manuals/doc/ref/chap43.html), which implements this method.
Comment: My reading of the manual suggests that the right function is `IsNaturalSymmetricGroup` (while also checking `NrMovedPoints`) rather than `IsSymmetricGroup`. For example, `IsSymmetricGroup` should give a false positive answer for a group generated by an arbitrary involution, as it is isomorphic to $S_2$.


What are the replacement patterns or tokens for Profile2 URL of a particular user?

Question: I just need to know how to key in token replacements for any given users different profiles. In my projects a user can have multiple profiles associated with the account. I am just having problems with tokens on how to locate or recreate those urls.
Answer: Try like this

First Install Pathauto Module.
Login in drupal as administrator, and goto Configuration. Under 'SEARCH AND METADATA' select 'URL aliases'.
Select 'Pattern' tab and goto 'USER PATHS' and click on 'REPLACEMENT PATTERNS' a list will appear.
Select 'Users' and again some more option will be displayed, select 'name' and the 'pattern for user account page paths should be displayed as '[user:name]' and save it.
In the same window 'Bulk update' tab and check mark the User Paths and click Update.

The following output will be http://example.com/username.
Comment: The thing is there are more than one profile and I need replacement patterns for either profile based on either the name of the user name or the secondary profile name that is unique.
Answer: Old question, but since it's still unanswered...
This is still a lingering issue in the Profile2 issue queue. As yet, there's no official module that lets you use tokens with Profile2. mohit_rocks answer really only applies to the core profile module AFAIK.
To get custom URLs without token, you can simple create a profile, export it, edit the URL in the export, and then import it.
Details here: https://drupal.org/node/1054740 (response #1)
And here: https://drupal.org/node/1149636#comment-5320062
That second thread mentions a sandbox project that " is a quick-and-dirty integration between Pathauto and all the entity types that have an Entity URI." See https://drupal.org/sandbox/damz/1332096
And having written all that up, I just saw there's a similar answer here: Profile2, url rewrite


sfGuardAuth across multiple apps

Question: I've got 3 apps: Backend, Frontend and Members.
And I've got 2 credentials: Administrators and Members.
Administrators are imported by default but Members are created in the Backend.
When a Member is created, an event handler also inserts this Member as a sf_guard_user and of course, the proper relations in sf_guard_user_group and sf_guard_user_permission.
That's the boring part, now the fun:
Frontend is not secured, but Members is and using these credentials: [administrator, member].
According to all this, Members created in the Backend that also get inserted (correctly as far as I can tell) should be able to login to the Members secured app, since they get the member group/permission/credential.
This is not happenning, the only ones that can login to the Members app are the administrators, which is not wrong, but either is the fact that correctly created Member users can't login to it.
The error thrown by the guard is the classic: The username and/or password is invalid.
Now that I edit the error, the salt comes to mind: How would one emulate the inserting of the salt as the guard does it? Maybe that's what I'm not inserting correctly (or inserting at all) and thus the password invalid error (and in fact everythine else I've described is ok! omg)
And that's my problem.
Thanks in advance :)
Answer: [administrator, member] means both are required, I believe.
I think you want [[administrator, member]] for the credential requirement.
Also, yes, you will want to make sure you use a salt, and set the algo.
<code>    parent::_set('password', call_user_func_array($algorithm, array($salt.$password)));
</code>
Salt before password, as well.
Comment: I wasn't correctly adding the salt, but that didn't solved the main issue ):

sfGuardAuth across multiple apps


How can I calculate the "stability state" of air from a given set of data?

Question:
I would like to know the answer for the above question, it is about how to find whether atmosphere is stable or unstable using DALR (dry adiabatic lapse rate), SALR (saturated adiabatic lapse rate) and ELR (environmental lapse rate). The table also lists RH (relative humidity).
Comment: What have you tried so far? Where do you get stuck?
Comment: All I know is if ELR > DALR , its unstable and ELR<SALR, then its stable. I tried using DALR = 3 C / 1000 ft and SALR = 1.8 C / 1000 ft and ELR = 1.98 C/1000 ft
Comment: I'm unable to proceed from step-1
Comment: I have an answer below, but really, if you are studying for a licence (of any sort) figuring this stuff out is key to understanding how atmosphere works. Luckily it's not actually that hard when things finally click. It's simply about energy embedded in the airmass. Compare that energy to the surroundings, and if there is difference, tadaa: you get weather.
Answer: You should calculate the environmental lapse rate (ELR), not use a fixed value. In the table you presented, the ELR is:
$$ \frac{T_{alt_1} - T_{alt_2}}{alt_2-alt_1} \cdot 1000$$
Compare this calculated value to dry and moist (or saturated) adiabatic lapse rates.

If the value falls between them, the air is conditionally unstable.
If the value is larger than the dry adiabatic lapse rate, the air is
absolutely unstable.

For accurate results, you must calculate SALR, as it varies strongly with altitude. Formula is in Wikipedia article.
See Wikipedia: Lapse rate and  Skybrary: Lapse Rate for more in-depth explanation.
Caveat, the aforementioned sites explain absolute unstability differently, I have no recolletion which it actually is, and my study books are buried in the garage...
Comment: This answer is off to a good start.  These days we do not need to "dig up books" to finish it.  The dry rate is different from the saturated rate.  This fact drives a lot of local weather.
Comment: Yea I remember the difference between dry and saturated LR, and how and why they "work" with ELR, but the absolute instability stuff escapes me  ...and the garage is a mess
Comment: Well, +1 for the references.  The cumulus photo in the Wiki $makes$ $it$.  I think the "absolute instability" is a *combination* of temperature *and* humidity difference (because H2O is a lighter molecule as compared with O2 or N2, 14 vs 32 or 28).  This is why a "dry line" along side humid air acts the same as a "cold front".  Rising humid air is "stable" until the cloud base, i guess.
Comment: Moist, or saturated even more so,  air loses heat slower than dry air,  hence it is able to maintain buyoancy when rising.
Answer: From @Jpe61 references one can approximate a dry adibatic lapse rate of 3C per 1000 feet and a saturated adiabatic lapse rate of 1.5C per 1000 feet.  The question has a 3000 foot differential and "assumes a constant lapse rate ... and ignoring the effects of pressure change".
There are 3 choices:  stable, conditionally stable, and unstable
There seemed to be some confusion in the definition of ELR being lesser or greater than DALR or SALR because these lapse rates can be expressed as negative or positive numbers.
Expressing them as -9.0C/3000 feet for DALR and -4.5C/3000 feet for SALR gives:
An ELR < -9.0C is stable and > -4.5C is unstable. An ELR> -9.0C and < -4.5C is "conditionally stable".
The reason RH data is included is really a second step to determine if the temperature drop is sufficient to reach the "dew point", where clouds form. This is the "condition" of stability.
Beyond answering the test question, it is important to realize air will rise for 2 reasons: higher temperature or higher humidity than surrounding air (or a combination of the 2).  Humidity makes air light because H20 (18) is lighter than O2 (32) or N2 (28). (Helium is 4 by comparison).
Convection (updraft) can be very strong in thunderstorms because the lapse rate is much less than in dry air while the moisture is condensing.  Strong airflow (jet stream) over the top of one of these cells can also have a Coanda-like effect.  Combined with water vapor condensation in the cloud, updraft can get strong enough to form a tornado.
Aircraft are generally instructed to stay away from this type of weather by a wide margin.
However, the fair weather cumulus clouds are a delight to glider pilots.  They are sign posts to much more gentle updraft "thermals", which can be used to gain altitude.


Should a program be allowed to run out of memory?

Question: Should programs that may run out of memory be allowed? For example, when validating data to see if it's a valid PNG file or not, as per this challenge.
Comment: I think you need to distinguish several cases here: a) will run out of memory for any valid input before producing the result, b) will run out of memory randomly, c) will run out of memory for sufficiently large inputs, d) will run out of memory eventually on infinite-output challenges, but will produce results until then. There may be more cases. There's also the question of "may run out of memory *on which machine*"?
Comment: @MartinEnder It may run out of memory if you give it a valid invalid input (an input which should validate to invalid/false).
Comment: @SoniEx2 **May** run out of memory, or **Will** run out of memory for specific inputs? is it a compiler limitation or a hardware limitation?
Comment: @tuskiomi May run out of memory if you don't give it enough RAM Because Java..
Answer: My thoughts:
If there are valid inputs for which the program will always run out of memory, then the program doesn't work for those inputs and isn't a valid solution. If you can solve the problem by throwing more memory into your system, then it's a hardware problem and theoretically, years down the line, the solution will function normally on most common systems, and this should be allowed.
Whether or not the program is allowed to run out of memory after a result has been given should be dependent on if the challenge allows the program to have errors, which is true in most cases.
On challenges that require the program to output infinitely, the program should always be able to generate more output given additional memory.


Should I max Lancer before starting Dragoon?

Question: I have recently come back to the game through the 4-day re-introduction event, and picked up my character.
I've got my Lancer up to level 30 now, and have Marauder at level 8. So I just have 7 levels of Marauder to go before I can take the Eye of the Dragon quest.
Is it worthwhile me getting my Lancer up to 50 before taking Dragoon? Are there advantages to having a Lv50 Lancer when working on Dragoon? Such as cross-over abilities.
Or do I level up Dragoon and Lancer as separate jobs, just like all the other jobs.
Answer: In Final Fantasy 14 there are base classes and advancement jobs, your base classes include classes such as arcanist, archer, marauder, and lancer just to name a few. Each of these base classes have a job associated with them, with exception to arcanist which has two, summoner and scholar, that require you to level a second base class to 15 to unlock. When you unlock your job you are leveling up your base class since the only thing that says you are your job is the equipable soul you obtain during the job quest. So this means for the oddity that is arcanist leveling up either scholar or summoner also levels up the other job.
Unlocking your job also unlocks more skills specific to your job that your base class will not unlock. By not taking your job when you first can unlock it you're essentially gimping your character since you will not be able to perform your role as well compared to a character with their job, which might be a great hindrance to your party in dungeons and trials and there are many players who get extremely angry over seeing people with no job in dungeons that are level 30+.
Another advantage of having your job is that at level 45 and 50 you get a free set of level 50 class armor specific to your class, so if you are struggling with gear this is a great freebie.
However there is one tiny advantage to going jobless and that is the cross class skills (which may not be a thing anymore come Stormblood). When you are playing as a base class you are able to use any cross class skill on any base class so if you wanted to throw healing skills on a lancer you could if you wanted.
Comment: I've accepted this answer, but please could you clarify more the difference between Class and Job, as that was my biggest stumbling block in understanding the system. I didn't realise that you are both, a Lancer class, but Dragoon job.
Comment: Your class is your base class, so Arcanist, Rouge, Archer, Lancer, those are what your base classes are. Your jobs are your advancements, like Summoner, Scholar, Ninja, Bard, and Dragoon. Your job level is tied to your base class level since for your job you are just equipping a soul to give you the job abilities.
Comment: @DavidYell It's worth noting that the class system might be going away in the future (not in Stormblood but maybe an expansion after). The game producer isn't happy with it and the confusion it causes and it's more of a legacy holdover.  In Heavensward and Stormblood, all the new classes are really just jobs with no base class.  And past level 50, you can only get new abilities through your jobs.
Comment: As per Stormblood cross-class skills are no longer a thing.
Answer: For simplicity I'll ignore the extra jobs introduced after Rouge/Ninja in this explaination of classes and jobs.
The class is what you choose by equipping a weapon. Swords for Gladiators, axes for marauders, Books for Arcanists, etc. These are your basic toolkits up to Lv30.
Jobs are unlocked at you get a class to lv30 (henceforth called the "base class"). This allows a specialisation within that class, along with a reasonable stat boost. You use a job ON TOP of the corresponding base class by equipping the corresponding soul crystal.
It's worth noting that as you level a job, the Exp earned goes to the base class, and the job's level IS the base class'. (you should see text like "Earned X Lancer exp points" while playing as a Dragoon)
The main example for this is the Arcanist, as that class has two jobs: Summoner  and Scholar. As the player levels a Summoner, what they are in fact doing is leveling the base Arcanist. The upshot of this is if that same player has gotten to Summoner lv50 (thus the Arcanist beneath it is lv50), then goes and unlocks Scholar, the Scholar will start at lv50 as that's what the Arcanist is.
In short, you don't level the Job, you level the class. And as such gain any abilities from both as you level up as a job. So there's no gain from leveling the class separately, and it will in fact make your job harder without the stat boost the soul crystal provides, as well as the extra job skills/traits and unlocked specialised gear.
Comment: If anyone is curious what the stat boost is, it's +5 to all stats and +10 to your primary.
Comment: I was under the impresson it was more than that, but thanks for the clarification


What are the differences between Azure DevOps (Pipelines) and GitHub Actions?

Question: My team is thinking of switching from Azure DevOps to GitHub Actions, currently we are using Azure DevOps Pipelines to handle code deployments. Our release pipelines are configured in a way where they are multi-staged whereas each stage is an environment (dev,qa,prod) and we also have a "review stage/approval" in the pipeline where someone has to review the code in the github repo before approving it. Also we will soon have some pipelines that will source from multiple repos. Will GitHub actions even support something like this? What are the main differences between Azure DevOps/Piplines and GitHub Actions? I heard github actions can only be pointed (or sourced) from a single repo.
Answer: Different between Azure DevOps versus GitHub Actions:

Azure Pipelines supports a legacy classic editor, which lets you define your CI configuration in a GUI editor instead of creating the pipeline definition in a YAML file. GitHub Actions uses YAML files to define workflows and does not support a graphical editor.

Azure Pipelines allows you to omit some structure in job definitions. For example, if you only have a single job, you don't need to define the job and only need to define its steps. GitHub Actions requires explicit configuration, and YAML structure cannot be omitted.

Azure Pipelines supports stages defined in the YAML file, which can be used to create deployment workflows. GitHub Actions requires you to separate stages into separate YAML workflow files.

On-premises Azure Pipelines build agents can be selected with capabilities. GitHub Actions self-hosted runners can be selected with labels.

Source https://docs.github.com/en/actions/migrating-to-github-actions/manually-migrating-to-github-actions/migrating-from-azure-pipelines-to-github-actions#key-differences


How to remove these weird ruler lines around artboard?

Question: My illustrator opens this way by default. I have no idea why or how. I have tried tweaking settings in document setup, preferences, etc. but it always opens a new Ai document like this. My older Ai files are fine tho. Can someone please tell me how to remove these rulers around grid and how to get the normal background instead of a transparent one?
Comment: Why would you choose video options if you donr want the rulers?
Answer: What you are looking at isn't weird but the artboard setup for video. They indicate the safe area for a screen, where the center of the screen would be and ruler around the outside.
The easiest way to resolve this is to simply not select a template from the Video and Film collection when you are setting up a new artboard.
However, you can easily change these in the document

To change the grid transparency (the checkered background) head to
VIEW / HIDE TRANSPARENCY GRID

To hide (or show) the rulers on the edge head to VIEW / RULERS /
SHOW/HIDE VIDEO RULES

To hide (or show) the safe zones and cross hairs head to ARTBOARD
OPTIONS and uncheck SHOW CROSS HAIRS, SHOW CENTER MARK and
SHOW VIDEO SAFE AREA
Comment: Cool, it worked!
However, when I do a document from the Video and Film collection, I followed all your pointers, and the last one does not seem to work. They're all unchecked but it the video safe area still shows. Thanks anyway!
Comment: Upload an image if you want and see if we can't narrow that down.

If you have multiple artboards then you may need to select all and do them. Sometime if you have settings that different between different artboards, you may find it easier to select all, uncheck and check all then hit ok and then go back an uncheck all them.


Follow me for WordPress blogs (multi-authors)

Question: If we have a blog with multiple authors is there a way for each to have a "follow me" twitter button separated. Meaning when we see the post of an author we see only the twitter button with the author account. Or because is a one blog the only option is a Follow us button meaning one account for all the authors?
Comment: it would be nice if you can put "follow author name" - cuz ppl could mis-understand between following the whole blog or each specific author (the last option being less widespread" )
Comment: Yeah. I want to do something similar.
Answer: If you are using a follow button plugin like the one in my Simple Twitter Connect plugin, then you should be able to specify the user you want the button to be for.
So for example, with STC, I'd activate STC-Login and the STC-Follow Button Widget plugins. Then I'd have my users "connect" their twitter accounts and their WP accounts (STC-Login lets them do this on the Users->Your Profile page). That way it knows what their twitter accounts are.
Then this code in a theme should do the trick:
<code>$twuid = get_the_author_meta('twuid');
if ( !empty($twuid) && function_exists('stc_follow_button') ) {
  stc_follow_button($twuid);
}
</code>
You'll have to put that code into the Loop or somewhere after it, so that the get_the_author_meta() function knows what user to look for.
Comment: how can extend this idea in a more generic form like for the "follow us" module that I am using on my website thelazy.info .


Adding a bathroom exhaust fan with wiring challenges

Question: I'm in a 1950 home with all kinds of weird wiring. I went to replace a bathroom light with an exhaust fan w/light. The power line in the attic came into the ceiling light junction box and then continued into another hall light (no switch) and from there into a bedroom and living room wall sockets. There's a switch for the old bathroom ceiling light that tied into the junction box above the old bathroom light. Old stuff. Pulled it open and have the power line (black and white wires) the black and white wires that continue to the hallway and beyond and the black and white wires for the switch.  I'm at a loss on how to connect the fan into the unpowered wall switch, the incoming power line, and the continuing power line without problems.  Fan & light has blk/wt/green for the fan and brown & blue for the light. Limited access to everything, especially that hallway light that is tied into the continuing power line without losing something down the line. I'm sure there's some basic wiring involved but this doesn't seem to be. Any suggestions?
Answer: Without putting new wires/cables in your switch will only work the fan and light together, both on or both off.
The black from power is connected to the white from the switch, marked on both ends with black or red(tape/paint/ink), and connected to the other blacks. Wire nuts come in different sizes for the amount of wires.  1950s would the wires are probably 14 gauge, but would need a wire gauge or label on the wire/cable to be sure.
The black from the switch is connected to the black of the fan, and probably brown of the light.
The white and blue of the fan/light are connected to the other whites.
All grounds are connected together plus with the box.
If you have a multi-meter, can check which of the brown, blue wires is attached to the centre post of the light to make sure, which one should be connected to power.
Answer: Agree with Crip659.  This is what's known as a switch loop, and was common during the 40's thru the 60's. The light/fan will get it's neutral from the white wire of the power line coming in, as well as the additional load lines feeding the other rooms. The switch doesn't need a neutral so you just send the power down the white wire,and bring it back up to the junction box via the black wire.


Keeping EntityManager of Doctrine in a session variable

Question: I'm developing a web-application and I'm going to use docrine framework to manage,
concurrent requests and transactional queries (like inserting or updating head and rows records).
For web necessities I thought to split operations in different steps:
First step: I have a page that allows the user for inserting a HeadTable record and after that I send the information to the server, create a Entity and store it in a EntityManager with a persist function.
Second step: The user will edit and insert all the RowsTable records. When it's all done, like before, I send all the data to the server, create Entities and Associate them to the HeadTable record.
The final step: When the user confirm all he has done, I trigger the flush operation of the EntityManager and commit all to DataBase in a single atomic transaction.
To keep all this steps toghether I put the EntityManager in a session variable and I remove it after the flush operation.
All seems to be fine but i would like to know if it's the correct way to resolve the problem or if there's a better way.
Answer: Sounds like a reasonable thing to try.
I'd probably avoid storing the entitymanager across requests, however.  It's got a database connection to worry about, and will therefore probably break.
What you can do, however, is just store your entities in session.  detach() them from their entitymanager, and then merge() them back on the next request.


Website using http and https

Question: Is there any method to know whether a website is https only or uses http webpages as well?Can it be done without using browsers cache?
Comment: Try both URLs? Can you explain why you want to know? Maybe that will help.
Comment: I'm confused as to what you mean by "Can it be done without using browsers cache?". You could test the server for port 80 to see if it has HTTP, but I expect you aren't looking to know if the port is open.
Comment: @farazkhan BTW, Welcome to Information Security. If you have a particular use case in mind with respect to SSL Strip then you should edit your question and include that. It will help other members of the community understand what you are trying to determine. If you have a forensics question (did this happen), vs a reconnaissance question (does this website support HTTPS) you'll want to make that clear too.
Comment: @amccormack if my earlier requests are cached I can find out whether the website uses http or https(except when the cached page redirects to an http page from https or vice versa)
Comment: @schroeder yes that is a possible solution.But I am wondering in case of ssl strip attack the user always gets back http response even if the website is https.
Answer: I'm going to assume that you are talking about HSTS.
HSTS is TOFU (Trust on first use). So from the second use onwards, you are protected.
But what about that first use?
I don't think there's a unified strategy. But here's some ideas:
What works today

HSTS Preloading: Use a browser that makes use of the HSTS preload lists. (Chrome, Firefox) And hope that the developers of the website you want to visit have had their website listed for HSTS preloading..
HTTPS Everywhere: There the EFF's HTTPS Everywhere project that uses a browser side plugin (Chrome, Firefox) and a large list of redirect rules, to redirect plain HTTP requests to encrypted HTTPS sites. This plugin only works if a rule has in fact been created for the website you want to visit. But -- other than HSTS pre-loading -- this does not depend on the webmaster's cooperation. Rules can be submitted by anyone.

What might work in the future

DANE/DNSSEC: DNS is a general purpose vehicle for storing info about domain names. Wikipedia's article about HSTS hints that this might be used in the future to indicate HTTPS support. -- "DANE" is a mechanism that uses DNSSEC (the signed form of DNS) to communicate crypto info about a domain name. For example to say "only this CA may sign my HTTPS certificates". This is achieved by placing something like this record in your DNS server:
_443._tcp.www.example.com. IN TLSA (
0 0 1 d2abde240d7cd3ee6b4b28c54df034b9
7983a1d16e8a410e4561cb106618e971 )

Now this tells anyone (who cares to ask) that a specific crypto key is associated in some way with a service that's running on port 443 on www.example.com.
Now a human can easily guess: "Okay, 443 will probably be HTTPS", and then connect with HTTPS instead of plain HTTP. But what you can't deduce from an existing DANE record is that HTTPS is fully supported for every bit of the web site. (For example HTTPS might only be used for login to that site and not work for the rest of the site.)
But AFAIK there is no mechanism yet to communicate "Use HTTPS!" to a browser.

Website using http and https


Is boxing haram?

Question: The other day, I had a discussion with a guy who seems to know a little about Islam and its related laws. I recommended that he box three days a week. He said that boxing was not allowed in Islam because it was dangerous and violent, where the players could get hurt badly. So is boxing really haram?
Comment: possible duplicate of [Is playing sports like boxing and martial arts allowed in Islam?](http://islam.stackexchange.com/questions/1276/is-playing-sports-like-boxing-and-martial-arts-allowed-in-islam)
Answer: There are a couple of points to look at when we talk about boxing.  One, is that it inflicts harm and allows people to hurt themselves just for fun/sport, and they can injure each other which could lead to brain damage and other things, while at the same time those that watch have fun watching them, sometimes they place bets and so on.  The Prophet (peace and blessings be upon him) said:

لَا ضَرَرَ وَلَا ضِرَارَ
There should be neither harming nor reciprocating harm

Al Arba'een Annawaweeyah
( See more information about this in this answer )
The other point to look at is, the Prophet (peace and blessings be upon him) said:

إِذَا ضَرَبَ أَحَدُكُمْ فَلْيَتَّقِ الْوَجْهَ
When one of you inflicts a beating, he should avoid striking the face

Sunnan Abi Dawood
To hit the face of a person (or animal) is haram, as is clear in the above Hadith and many others like it, so when we look at boxing the face does get hit/punches do reach the face, and that is haram.
So in short conclusion, yes boxing is haram.
Comment: Boxing is not haraam. Hitting on the face yes. You still can do boxing by punching on the bag or pads.
Comment: yes, but I am not referring to that at all in my answer, for a bag is not a person, and the boxing practiced todays world is considered haram.  As for punching a bag or something then there is no problem, as far as I know.
Comment: @مجاهد I get ure points about punching the face and stuff...but just becuz boxing is a sport that inflicts harm doesn't make it haram. Cuz our prophet and the Sahabas used to wrestle and wresting is a martial art and combat sport...which also includes inflicting haram. I think you should review the true meaning and context of the hadith where our prophet says there should be neither harming nor reciprocating harm...maybe it has to do with doing physical and mental harm to the individual for the sake of doing harm rather than for the sake of sport.
Answer: I've been training for well over 25 years in mostly martial arts but have trained in boxing, thai-boxing and full contact karate. Hitting the face whether for sport, fun or in aggression is haram. Islam teaches us to look after our body through good health and exercise, not to compete against our fellow brothers for status and arrogance which sadly is the state of boxing.
Answer: According to what I have  read and researched, Boxing overall is not Haram but sparring and actual competitive fights are haram as it involves striking to the face which is made clear in the Quran to be haram.
Comment: Salam and welcome on islam SE. Please consider adding references to support your claims. I strongly recommend you to take the [tour], check our [help] and read [answer],
Comment: It is not haram neither to do wrestling?
Answer: The boxing as we have it today has some aspects which go against the religion, such as hits to the face, and the risk of injury to self and to an opponent. It is not permissible to go into situations where harm is expected just for entertainment. Dr Zakir Naik explained this very well.Here
Answer: I believe actions associated with the sport are haram. Actions like people gambling and the consumption of alcohol. The boxer may not partake in such things. The sport itself can not be declared haram according to the Hadeeths quoted. Here is why.
The first hadith simply states that our beloved Prophet said: "There should be neither harming (darar) nor reciprocating harm (dirar). "
however whoever quoted this left out something that our Ummah fails at again and again...context. There should be neither harming nor reciprocating harm in what? I'm sure he is not talking about boxing...since the sport did not exist at that time.
The second hadith gives a context clue that it is about beating as a punishment. So that does not relate to boxing as a sport because trust me people who are in there fighting are not punishing each other by any definition of the word.
Honestly I think the fatwa on boxing and many of the people who say it is haram is because people do not want another influential person like Muhammad Ali to emerge again. Because of Allah's gift to him in that sport he was the biggest voice for Islam in America. Sometimes something that seems bad can do a lot of good.
Answer: Look i have researched alot and still dont know if it is halal or not but i found this. Boxing is a sport which has both hand wraps to protect the hands and gloves to protect your opponent face, and both fighters are doing it participantly. There are ring side doctors and alot of safety procedures and check ups. If you are a person to say boxing is haram cause people died in it then this is not logical, people dont die from boxing but they die in boxing due to weight cuts and constant sparring, if a fighter controls their weight and minimises sparring their is so much less chance for them to be hurt in any way. In addition being a great boxer could help islam in many ways and share good things and belief converting millions and also making million and giving to charity (this was done by fighters like muhammed ali, prince nassem, khabib and others). Lets say if all these were haram including acting and everything how are muslims going to put their word, if no muslim celebrities. People look up to celebrities and time has changed back then celebrities wont like now where you must be in an art or sport industry to become big and get people to follow you. However that said boxing can be haram as their are hadiths from prophet SAW prevent hitting the face so i honestly dont the answer but these are things to consider.
Answer: Folks you need to be a little realistic here. Boxing is NOT haraam. It is an art. A form of fitness. A form of self defence. A form of discipline.  If you want to guy by the letter of the law, YOU are not hitting someone in the face. No. There is a set of wraps and thick gloves in between your fist and the opponents face.
Also bear in mind, this is a sport in which you have two equally willing participants.
If we start calling this like this haraam, we would all need to emigrate to strictly religious countries as you could call living in western countries haraam too.
Guys, boxing is an excellent, tremendously rewarding sport which teaches respect and honour whilst getting you into fantastic shape. You meet many people from many cultures and thoroughly enjoy training together. Notwithstanding the fact that we are keeping youngsters off the streets and assisting them towards being more productive in their lives.
Let's be careful about what we label as haraam.
I run a boxing class at the mosque and not one person had felt the need to tell me it may be haraam!
Comment: Muhammad Ali has parkinsons. How many non boxer's have parkinsins. It not a boxing disease.
Comment: Brother, Boxing in of it's self is not haram, but as it is practiced today it is haram.  It doesn't matter whether you are wearing thick gloves and not directly hitting on the fce, it is the fact that the punches do reach the face, and in boxing as it is practiced today, damage is done, and the research in the damage of "sports" like boxing and football are available on the net.  Furthermore the benefits of boxing is less then the far more damage and harm it can cause, if you want to benefit from boxing then just do all the exercises, punch a bag, but don't go into the ring.
Comment: Lastly, we cannot say something is haram without proof, and with boxing (as is practiced today), the proof of it's damage (look at Muhammad Ali if you wish) is known.

Is boxing haram?


Why do Jews look before crossing streets?

Question: If Jews claim everything is predestined, and that we can do nothing to change it, why do we look before we cross the road? I'm a Jewish man myself and personally never look before crossing and have yet to be hit. It's not like we are going to die before our time.
Comment: Where do Jews claim that eveything is predestined?
Comment: I, and others, really suggest you start looking before you cross a street. Whether or not you get hurt is not the only concern; you may cause a driver or another pedestrian serious injury or death by your carelessness.
Comment: "Mi BeKitzo **UMi Lo BeKitzo**."
Comment: Foreseen and predestined are miles apart. Foreseen means God knows about it in advance, but it's still your choice. How he can know something if it is your choice is the famous paradox, but that is a problem with God's knowledge, not with freewill. Predestination is something completely different, it means that a certain thing is destined to occur; that freewill is not a factor. הכל צפויה means everything is foreseen; it by no means implies that everything is predestined.
Comment: SSpoke, +1, and thanks for the interesting question, which, as @DoubleAA notes, could use some citations [edited in](http://judaism.stackexchange.com/posts/19037/edit) for its claims. I hope you stick around and enjoy the site. (Oh, and, incidentally, I suggest you start looking before you cross.)
Comment: @SSpoke I must say that I admire your emunah in Hashem (that is, if you are being serious), however that emunah should really be channelled elsewhere..
Comment: "Everything is foreseen; yet free will is given" (Rabbi Akiva, Pirkei Avoth 3:15). Based on this understanding, the problem is formally described as a paradox, perhaps beyond our understanding.
Comment: possible duplicate of [do we really have free choice?](http://judaism.stackexchange.com/questions/856/do-we-really-have-free-choice)
Answer: First, G-d's omnipotence does not preclude free will, as the statement you bring clearly states. Omniscience does not mean that everything is decided already, only that G-d knows what you will choose to do, even if you don't know yet.
But it's true that certain things are decided in advance , so the question still stands, albeit on slightly altered legs.
But the statement that "we can do nothing to change it" is categorically untrue. Judaism believes in the efficacy of prayer, and that G-d empowers us to change even that which has been decreed above through prayer, repentance, and good deeds. Some of the most important prayers we say on Rosh Hashana and Yom Kippur spell this out quite clearly.

Your more direct question is "if the method and time of a person's death is already decreed, why not do dangerous things?" Well, the Talmud tells us that "HaSatan mekatreig b'shaas sakana". ("The Adversary prosecutes in a time of danger.")
That means, when a person is in a dangerous situation, the accusing angel (or 'the Satan') goes before G-d and basically says, "Look this guy deserves to die for his sins, and now is the perfect opportunity for me to do it. May I?)
Therefore, we avoid dangerous situations to avoid giving the Accuser an extra opportunity to prosecute us.
Comment: With the permission of @HodofHod, you can see H'aguiga (end of 4b and top of 5a) where a story is reported about Malakh Hamaveth who took a life by mistake even if it is not the time. When Rav Bibi Bar Abaye asked him how it did, Malakh Hamavet answered her that the person was in danger.
Answer: Mesilas Yesarim, Chapter 10 writes:

The Sages in all places have ordered that a man be especially attentive to his well-being and not put himself in danger even if he
is righteous and a doer of good deeds, that they have said
(Kethuvoth 30a), "All is in the hands of Heaven except chills and
fever," and that the Torah states (Deuteronomy 4:15), "Be very
watchful of your selves" - all of which indicates that a person is not
to extend trust in G-d to this area, even (as our Sages state further)
when a mitzvah is to be performed.
Know that there is fear and there is fear. There is appropriate fear
and there is foolish fear. There is confidence and there is
recklessness. The Lord blessed be He, has invested man with sound
intelligence and judgment so that he may follow the right path and
protect himself from the instruments of injury that have been created
to punish evildoers. One who allows himself not to be guided by wisdom
and exposes himself to dangers is displaying not trust, but
recklessness; and he is a sinner in that he flouts the will of the
Creator, blessed be His Name, who desires that a man protect himself.
Aside from the fact that because of his carelessness he lays himself
open to the danger inherent in the threatening object, he openly
calls punishment down upon himself because of the sin that he commits
thereby, so that his hurt results from the sin itself.
The type of fear and self-protection which is appropriate is that which grows out of the workings of wisdom and intelligence. It is
the type about which it is said (Proverbs 22:3), "The wise man sees
evil and hides, but the fools pass on and are punished."
"Foolish fear" is a person's desiring to multiply protection upon
protection and fear upon fear, so that he makes a protection for his
protection and neglects Torah and Divine service. The criterion by
which to distinguish between the two fears is that implied in the
statement of our Sages of blessed memory (Pesachim 8b), "Where there
is a likelihood of danger, it is different." That is, where there
is a recognized possibility of injury, one must be heedful, but where
there is no apparent danger, one should not be afraid.

Translation credits: http://www.rabbisilber.com/wp-content/uploads/2014/10/MESILAT_YESHARIM.pdf
Answer: I learned from one of my teachers that sometimes the Heavenly decree as to what will happen to a person is dependent on whether he has merits or not. For example, there may be a Heavenly decree saying "If this person has enough merit he will succeed in his business, if not he will not.
Additionally, when one is in a situation of imminent danger more merit is needed to save him from a disastrous result.
Therefore, one should look before crossing the street so in case he is in a situation where without the danger he might merit continued life and health, but he does not have enough merit to be worthy of being saved from the imminent danger, he should not get himself into a dangerous situation.
Answer: Although you are correct in stating that everything is predestined and that looking both ways before crossing the street really does not protect one from death, one must nonetheless adopt the practice as a chesed (kindness) to those who are fated to die as they cross the road. Although it is a fiction, we should pretend that looking both ways does protect one from death. When someone looks both ways, even if he knows on an intellectual level that it is of no consequence, he does get the illusion of protection, which is comforting.
Comment: @Clint, Do you have any source for this? It really doesn't fit with any normative Jewish theology that I've heard of. Also, what do _you_ mean by "everything is predestined?" Surely there is free choice, and effective prayer, etc.?
Comment: @Clint You wrote _"Although you are correct..."_ which implies that you believe his opinion to be that be valid to Judaism. So I asked what _you_ (with emphasis) meant by that. That being said, I'm sure you agree that it's a good thing to challenge flawed premises?
Comment: The initial question assumed that Judaism believes everything is predestined. Whether normative Judaism holds that is the subject of another question. Rather than contradicting the premise of the question, I answered as if it were true, addressing it to a person like the OP (i.e. a troll).