Get Tweets from EpiTwitterJson

Question: I've been banging my head against the wall for a few days now trying to do something that should be so simple. I am trying to use Jaison Mathai's EpiTwitter library to retrieve tweets from my account. Here is my code to get my tweets:
<?php $twitterObj = new EpiTwitter($__TWITTER['ConsumerKey'], $__TWITTER['ConsumerSecret'],$__TWITTER['MyAccessToken'],$__TWITTER['MyAccessTokenSecret']);
$twitterInfo= $twitterObj->get_accountVerify_credentials();
$twitterInfo->response;
// ^ This part works fine, I can get my user info and profile pic and whatnot
$username = $twitterInfo->screen_name;
$tjson = $twitterObj->get('statuses/user_timeline.json', array("screen_name"=>$username));

As far as I can tell, ^ this also works as it should. If I var_dump($tjson), I can see the tweets that I want to access, among a HUGE mess of other data.
My question boils down to this: from this point, how can i simply print out each tweet returned? Here's what I've tried so far:
foreach($tjson as $tweet) print($tweet)
//^ Throws IllegalArgumentException, "Not an array or object"
foreach($tjson->responseText as $tweet) print($tweet)
//^ Warning: illegal argument. Doesn't print anything

print_r($tjson->response) //Prints NULL

I thought $tjson->response would be what I want, because in the __get method in EpiTwitterJson, there is a line:
$this->response = json_decode($this->responseText, 1);. Right after this line if I var_dump($this->response), I get my tweets along with a little less data than var_dump($tjson) before. If on that same line I print($this->response['status']['text']), I get a nice string of my tweet, which is exactly what I want.
What I don't quite understand is why $this->response is set inside of the EpiTwitterJson class, but $tjson->response is NULL in my code. I've looked and looked and looked but I can't seem to find any code snippets to get tweets with this library specifically. I think it's just one of those things that must be so obvious and simple that my brain refuses to accept it.
Obviously I could just crawl through $tjson->responseText, but I thought the whole point of the EpiTwitterJson class was so I would not have to do that? The ideal answer to my question will be code to boil down my $tjson object so i can say
foreach(something as $tweet) //do stuff with the tweet

Second best answer would be code to do this with another library. I only chose the EpiTwitter lib because it 'supports async' which sounds kinda cool if I ever decide to use it, and because it seemed like the simplest (ie least lines of code on my part). Quite frankly I really care more about making this work than understanding it; I can figure out what it all means later on.
Answer: foreach($tjson->response as $post){
    echo '
';
    var_dump($post);
    echo '
';
}

this works for me.
for eg. u can get id of post like that $post['id'], or user name $post['user']['name']

Get Tweets from EpiTwitterJson


Hide Status Option From WordPress Publish Metabox and Rename Published on:

Question: I want to hide Status option on publishbox and rename Published on to Date Created for Custom post post_type like you see in red on the below picture.
Answer: Both those strings seem to be located in wp-admin/includes/meta-boxes.php. They don't have any filters attached to them, so they're not meant to be (easily) altered by your code.
However, both those strings are internationalized (ie, run through a translation function) to allow WordPress's interface to be translated into languages other than English. The i18n functions—__() and _e()—both use translate(), which provides a filter, gettext, that you can use to control what is displayed.
Caveats:

This may adversely affect the translatability of your plugin.
If WordPress ever changes the strings used in these locations, your filter will no longer work.

With that in mind, this code should be a good starting point.
add_filter( 'gettext', 'wpse406946_change_meta_strings', 10, 3 );

/**
 * Change the "Published On:" string and remove the "status: " line from
 * my CPT's meta box.
 *
 * @param  string $translation The translated string.
 * @param  string $text        The original string.
 * @param  string $domain      The current text domain.
 * @return string              The filtered translated text.
 */
function wpse406946_change_meta_strings( $translation, $text, $domain ) {
    // Checks for the custom post type.
    if ( 'my_post_type' === get_post_type() && 'default' === $domain ) {
        // Unhooks the filter to prevent infinite loops.
        remove_filter( 'gettext', 'wpse406946_change_meta_strings', 10, 3 );
        if ( 'Published on: %s' === $text ) {
            $translation = __( 'Created on: $%s', $domain );
        }
        // The "Status: Published" message is actually 2 parts.
        // This should catch both.
        if ( 'Status:' === $text || 'Published' === $text ) {
            $translation = '';
        }

        // Rehooks the filter.
        add_filter( 'gettext', 'wpse406946_change_meta_strings', 10, 3 );
    }

    return $translation;
}

References

__()
_e()
gettext filter


On shortest vector problem

Question: Assume we have an oracle which gives the length of the shortest vector in a lattice. Given this oracle can we find the shortest vector in polynomial time?
Answer: Yes you can. I'll write $\lambda_1(L) = \min_{l\in L\setminus \{0\}} \lVert l\rVert_2$.
I will also identify a lattice with any of its basis, e.g. I will write $\lambda_1(B)$ where $B$ is a lattice basis.
There are two relevant forms of SVP

Search: Given a lattice basis $B$, recover $\vec x$ such that $\lVert B\vec x\rVert_2 = \lambda_1(B)$ is the shortest vector in the lattice.
Decision: Given a lattice basis $B$ and length bound $t$, return "yes" if $\lambda_1(B) \leq t$, and "no" otherwise.

What you're asking for is implied by a reduction from the search SVP problem to the decision SVP problem, as your oracle can easily be used to solve decision SVP.
Such reductions are known to exist, see for example this.

On shortest vector problem


Why is the denominator $N-p-1$ in estimation of variance?

Question: I was recently going through the book Elements of Statistical Learning by Tibshirani et.al. In this book, while explaining the ordinary least squares model, the authors state that assume that $y_i \epsilon \mathbb{R}$ represents the observed variables, $\hat{y_i}$ represents the model output and $\mathbf{x_i} \epsilon \mathbf{R}^{p+1}$ represent the inputs. If the $y_i$s are assumed to be uncorrelated and have constant with variance $\sigma$, then the unbiased estimate of variance is $\hat{\sigma} = \frac{1}{\left (N-p-1 \right)}\sum\left( y_i - \hat{y_i} \right)^2$, summation being done from $i=1$ to $i=N$. Note that $p$ has been used here to denote the dimensionality of $\mathbf{x_i}$s. My question is why is the factor in the denominator $N-p-1$ while estimating the variance of $y_i$s i.e. $\hat{\sigma}$ ? From my understanding if the $y_s$s are real numbers that have constant variance, the factor should be equal to $N-1$.
Answer: The current accepted answer is flawed, as it implicitly assumes that the error of the model $\varepsilon$ is Gaussian (otherwise you need not have $\sum(y_i-\hat{y}_i)^2\sim\sigma^2\chi^2_{N-p-1}$).
Here's a proof with the general assumption that $\varepsilon$ has mean $0$ and variance $\sigma^2 I_N$.
First note that $\sum(y_i-\hat{y}_i)^2=\|y-X\hat\beta\|^2$.
We have $$\begin{align}
y-X\hat\beta &= X\beta +\varepsilon -X(X^TX)^{-1}X^T(X\beta +\varepsilon)\\
&=X\beta +\varepsilon - X\beta -X(X^TX)^{-1}X^T\varepsilon\\
&= (I_N-H)\varepsilon\end{align}$$
where $H=X(X^TX)^{-1}X^T$ is the hat matrix. It's easy to check that
$H^T=H$ and $H^2=H$ (indeed the hat matrix is merely the orthogonal projection on $\operatorname{Im}X$).
Hence $\begin{aligned}[t]E( \|y-X\hat\beta\|^2) &= E(\varepsilon^T(I_N-H)^T (I_N-H)\varepsilon)=E(\varepsilon^T(I_N-H)\varepsilon)
\end{aligned}$
Note that $\varepsilon^T(I_N-H)\varepsilon=\sum_{i,j} \varepsilon_i\varepsilon_j (\delta_{ij}-H_{ij})$, thus $$E(\varepsilon^T(I_N-H)\varepsilon)=\sum_{i,j} \sigma^2\delta_{ij} (\delta_{ij}-H_{ij})=\sigma^2(N-\operatorname{tr}H)$$
Note that $\operatorname{tr}H =\operatorname{tr}(X(X^TX)^{-1}X^T)=\operatorname{tr}(X^TX(X^TX)^{-1})=\operatorname{tr}(I_{p+1})=p+1 $
Putting everything together, $E( \|y-X\hat\beta\|^2)=\sigma^2(N-p-1)$
Comment: Just before the variance equation in ESL it's written ".. we now assume that the observations $y_i$ are uncorrelated and have constant variance $σ^2$ , and that the $x_i$ are fixed (non random)".. I don't see where they make the claim that $Y = f(X) + \epsilon$. This was done only in chapter two. I was under the impression that the assumptions in this chapter are more relaxed. Unfortunately, without this assumption I could only get as far as this: $E[\|y-X\hat\beta\|^2] = (I-H)^T E[y y^T] (I-H)$. We could use $\sigma^2 I = E[y y^T] - E[y] E[y]^T$ but we don't know the mean.
Comment: I think this is the best answer.
Answer: You can show that $\sum(y_i-\hat{y}_i)^2\sim\sigma^2\chi^2_{N-p-1}$. As expectation of a $\chi^2_{N-p-1}$ is $(N-p-1)$. Hence $\mathbb{E}(\frac{1}{N-p-1}\sum(y_i-\hat{y}_i)^2)=\sigma^2$.
$N-p-1$ is in the denominator to make the estimator unbiased.
Comment: $\sum(y_i-\hat{y}_i)^2\sim\sigma^2\chi^2_{N-p-1}$ requires that the error term be Gaussian, which may not be true.
Comment: you can convert $\sum(y_i-\hat{y}_i)^2/\sigma^2$ into sum of squares of $N-p-1$ independent standard normal variables by Gram-Schmidt orthogonalization.
Answer: To answer the question without using the Gaussian assumption, nor the additive model assumption as it has been done in previous answer, here is my take:
The assumption made are that the observations $y_i$ are uncorrelated and have mean zero, constant variance $\sigma^2$, and that the $x_i$ are fixed (non random).
From the previous section we have that $\hat{y} = X(X^TX)^{-1}X^Ty = Hy$
where the hat matrix can be shown easily to satisfy $H^T=H^2=H$.
Also we can rewrite $\sum_{i=1}^N(y_i - \hat{y_i})^2$ as $(y-\hat{y} )^T(y-\hat{y} )$ and thus it comes that
\begin{align*}
 \mathbb{E}[\sum_{i=1}^N(y_i - \hat{y_i})^2]
 &= \mathbb{E}[(y-Hy)^T(y-Hy)]
 = \mathbb{E}[((I-H)y)^T((I-H)y)] \\
 &= \mathbb{E}[y^T(I-H)(I-H)y]
 = \mathbb{E}[y^T(I-H)y] \\
 &= \mathbb{E}[\sum_{i,j}y_iy_j(\delta_{ij}-H_{i,j})] \\
 &= \sum_{i,j}\mathbb{E}[y_iy_j\delta_{ij}]- \sum_{i,j}\mathbb{E}[y_iy_jH_{i,j}] \\
 &= \sum_{i}\mathbb{E}[y_i^2]- \sum_{i,j}\mathbb{E}[y_iy_j]H_{i,j}
 \end{align*}
The hat matrix has been removed from the expectation since it is fixed as the $x_i$ are.
In addition the $y_i$ are uncorrelated of mean zero and variance $\sigma^2$ thus using the cyclic property of the trace:
\begin{align*}
\mathbb{E}[\sum_{i=1}^N(y_i - \hat{y_i})^2]
&= \sum_{i}\sigma^2 - \sum_{i}\sigma^2H_{i,i}
= \sigma^2[N - trace(H)] \\
&= \sigma^2[N - trace(X(X^TX)^{-1}X^T)] \\
&= \sigma^2[N - trace(X^TX(X^TX)^{-1})] \\
&= \sigma^2[N - p - 1]
\end{align*}
So finally we have that an unbiased estimator $\hat{\sigma}^2$ of $\sigma^2$ is
\begin{align}
\mathbb{E}[\hat{\sigma}^2]
&= \mathbb{E}[\frac{1}{N - p - 1} \cdot \sum_{i=1}^N(y_i - \hat{y_i})^2]
= \sigma^2
\end{align}


What makes one pole of a planet north vs south?

Question: Given a planet without any relationship to Earth, what does it mean for the poles to be "north" or "south"?  Is it something arbitrary that can be changed?
Comment: The polarity of the fields changes periodically. N becomes S, S becomes N.
Comment: @smithkm's answer is correct. You should mark it as accepted, to help distinguish it from other posts, even though it's a self-answer.  The site lets you do that after a few days.
Comment: How about monopoles!
Comment: On the topic, what decides what the northern hemisphere of a planet is and what the southern hemisphere is? Isn't this a purely human concept? In addition, wasn't the Prime Meridian created by humans? There's no actual relationship to nature/earth there; the only reason we chose it to run through England was because they were the most powerful country when it was established.
Comment: @fi12 That's really just another way of phrasing the same question.  The plane of the equator dividing them is not arbitrary.  It's just a matter of what we call them, which is the same issue as what we call the two poles.  The prime meridian is a separate question. Roughly, it is arbitrary, but it's a decision that needs to be made and there are practical considerations which Greenwich does fit fairly well.
Answer: tl;dr - North will be whichever pole is oriented most closely to Earth's north pole.
If the planet is "without any relationship to Earth" as in not in this universe, then it's completely arbitrary.

For planets in the solar system-

Geographic poles are decided thusly:

The International Astronomical Union (IAU) defines the geographic north pole of a planet or any of its satellites in the solar system as the planetary pole that is in the same celestial hemisphere relative to the invariable plane of the solar system as Earth's North pole.

Magnetic poles, for planets/moons that have them, match those of Earth. See image above.

For planets in our galaxy-

Geographic north pole will likely be selected as which ever axis points mostly in the direction of galactic north.
Magnetic poles, for planets/moons that have them, will match those of Earth. See image above.

For the rest-

Geographic poles will follow the same rules as our galactic poles, the galactic north with either be that which is closest to ours or will be arbitrary.
Magnetic poles, for planets/moons that have them, will match those of Earth. See image above.
Comment: @Random832 No, there is no basis that the direction of rotation defines the north pole of a planet. This is clear because the IAU defines the north pole of Venus as the "same celestial hemisphere relative to the invariable plane of the solar system as Earth's North pole", yet Venus rotates in the opposite direction.
Comment: So there's no basis for taking into account the direction of rotation (i.e. whichever pole rotates counterclockwise is north)?
Comment: Is there any chance, though, that human colonists to another solar system would define that solar system's plane relative to the prevailing rotation and revolution within the system, rather than with reference to Earth or indirectly via Galactic North? I am asking this because "east" is strongly culturally associated with the sunrise in most human cultures. For your claim about galactic north, you only say "likely" rather than citing any formal rule - is there a formal rule?
Comment: @Random832 Sure, there is a chance, there is also a chance they could decide to call that pole west. If they're a space faring civilization there may not be a cultural association with sunrise in the East anymore. As I say, if it's not referenced to Earth it's entirely arbitrary, because without Earth there isn't the cultural association either. I know of no formal rule for exoplanet geographic pole naming, but with Venus as an excellent example, it won't be depend on rotation direction.
Comment: Interesting: I've always heard the counterclockwise definition, and that's consistent with saying that its inclination is 177 degrees.  I see the infobox in Wikipedia says *3* degrees and a negative rotation period, consistent with the ruke as you cited it.  I leaned Astronomy in the pre-computer era.
Comment: P.s. the use of "tl; dr" slang is really getting annoying. I upvoted anyway because you *cited* and quoted.
Comment: After reading @jim2b 's answer and looking again at yours, I find the summary of Magnetic North lacking. "Just like Earth" means what? Remember even on Earth the poles flip from time to time, so it doesn't make sense to just label them opposite the rotation poles. If it's *same as used for physics and electronics (and in the bar magnet used to make the compas)" you could have just said that, and pointed out how it's opposite the geographic label for Earth, now.
Comment: @JDługosz The description references the included diagram. The magnetic north pole is the pole which the north pole of a magnet (a compass) is attracted to. Observing the overall magnetic field of the planet, the magnetic north pole is the south pole of the magnet (opposites attract). The convention for magnets is the field direction is taken to be outward from the north pole and into the south pole of the magnet, thus the planet's magnetic north pole is pointed to by the magnetic field lines.
Comment: @JDługosz When the magnetic poles flip again it's hard to say if we'll decide the names are now flipped. We will probably just paint the other side of the compass needle red, since we're mainly using it to approximate the geographic north, not trying to find the magnetic north. The "it's opposite" definition is not one that has, or always will, remain true. So it's not much use to us.
Comment: @Samuel There is one reason to use direction of rotation for reference, and that's that it is a mathematical convenience. Using the direction of the rotational momentum as "north" might make it more intuitive to e.g. plot some orbital maneuvers.
Comment: @MikeL. Sure, though it's arbitrary as to using the left-hand rule or the right-hand rule to achieve that. Because of that it's not a great way to define north vs. south, only to have all the planets the same.
Comment: @Samuel Well, if you use right-hand rule for all the rest of your maths, there's something to be said for consistency.
Comment: @MikeL. The right-hand rule is common, but the left-hand rule is also frequently used. I suppose the thing to be said for consistency is "whatever".
Answer: First off, any of the cardinal directions can reasonably be taken to be the base one from which we start measuring the others.  The modern world has largely settled on north.  Medieval Europe used east, and China used South at one point. In Tolkien's middle earth west was the primary direction.  The term "orient" to mean pointing something in the right direction derives from when European maps had east at the top.
I will mostly be addressing north, and to a lesser degree, east, but you could flip things and start with west or south just as easily for an alien culture.
There are different kinds of north (and the other cardinal directions as a result).
Geodetic and celestial directions are based on how the planet spins.  The difference between them is tiny and relates to differences in what the 'centre of the planet' means.  The geodetic poles are where the axis of rotation of the earth meats the surface while the celestial poles are where it meets the notional 'celestial sphere'.  The celestial poles trace out large circles over tens of thousands of years as its axis 'wobbles'.  The land or sea at the poles varies with tectonic drift over millions of years.
The grid poles are where the meridians of longitude meet.  Because of the slight lumpiness of the Earth we have many different coordinate systems.  fictional worlds really don't need that level of detail so you can merge the grid poles with the geodetic and celestial poles.
That leaves the magnetic and geomagnetic poles.The difference here has to do with the shape of the surface of the earth, and the unevenness of its magnetic field.  For conworld purposes it's possibly worth thinking about having magnetic poles distinct from the geodetic ones, but the distinction between magnetic and geomagnetic probably isn't worth the trouble.
So, if we now have a pair of geodetic poles, and maybe a pair of magnetic poles, that leaves the question of which is the north pole vs the south pole.
If you look at Earth from above its north pole, the planet rotates counterclockwise.  Since this is tied to the rotation which defines the axis which defines the poles, this is a good candidate for "northness" such that we can apply the word beyond Earth.  Venus is rotating the opposite direction so Venusian north is pointing in roughly the opposite direction to Terrestrial north.  Uranus has its axis roughly in the plane of the ecliptic, but we can still easily identify one pole as north using this in a way that is meaningful for the planet.  Magnetic fields change (Earth itself), may not align with the rotation (Uranus), and may be patchy or negligible (Mars, most moons).
Equivalently, you can look at the stars.  The north pole is the point where the stars rotate clockwise directly overhead, and east is the direction where stars move straight up.
Treating the direction from which a rotation appears to be counterclockwise as positive(Or conversely, treating counterclockwise rotation as positive) is called the "right hand rule" and is a common convention in mathematics, many sciences, and engineering.  Left handed coordinates are also possible (And are used in computer graphics), but it's important to keep things consistent.
This is how the IAU defines north for dwarf planets, asteroids, and other sub-planetary bodies.  The IAU has a different, older definition of north for anything that's planet sized or bigger.  The solar system  rotates, and so it has  poles, and the pole closer to earth's north is system north, and for all the planets in the system, north is whichever pole is closer to that.  To go outside of the solar system, you do the same trick with the rotation of the galaxy, and then pick the pole closer to the pole of the galaxy that's closer to Earth's North.  Since the axes of rotation wobble, this can cause IAU north and south to flip as an axis crosses an imaginary plane dividing the universe in half.  Smaller things tend to wobble more, which is why the IAU switched to the right hand rule north for dwarf planets.

"planets" (the 8 specific named large bodies) in the solar system and their sattelites use the pole in the celestrial hemesphere
dwarf planets, minor planets, their satellites, and comets use "right hand rule", and to avoid further confusion calls it positive rather than north.

By the IAU definition, north is undefined and meaningless without Earth, the solar system, and the milky way.  So, you could say a fictional world in an Earthless universe has no north; the poles need some other words to identify them that can not be translated to "north" and "south".  You could also assign the real world words to poles arbitrarily.  Finally, you could use the
On Earth everything rises in the east and sets in the west.  Assuming you use right handed north, the same tends to be true of other worlds, but not necessarily.
Except in the situation like Mercury that a planet is both rotating even more slowly than if it were tide-locked to its sun and rotating the same direction as its orbit the sun will rise with the background stars in the east and set in the west. whereas on mercury the sun rises in the west.  If it's tide locked, the sun will not rise and set on opposite sides of the sky like on earth but will instead follow a figure 8 path through the sky over the course of a year.  So for a sunrise in the west, you need to have a day that's longer than a year like Mercury.
Moons above synchronous orbit will go east to west (like ours), below synchronous will go west to east (like Mars's moons) and at a synchronous orbit they will trace a figure 8 over the course of a month.
"North" and "south" are also used to describe magnetic polarities.  The north pole of a magnet is attracted to the magnetic pole near the geographic north pole.  This means that the north magnetic pole, is a south pole in terms of magnetic polarity because magnetic fields attract the opposite polarity.  When the next pole reversal occurs, the north pole will be a north pole, and will attract south poles, making all magnetic compasses backwards.
There are other ways to create cardinal directions although it's a bad idea to call them "north", "south", "east", or "west": you can treat some other point as a pole such as a holy city and have toward, away from, to the left of, and to the right of that pole as directions. Another option is seaward, landward, along the cast with the sea on your left, along the coast with the sea on your right which are defined in terms of an area.
A culture might consider toward/away from the equator more significant than north and south although that seems unlikely. Some real cultures consider 'centre' or 'not going anywhere' a 5th direction equivalent to the other 4.  You can also treat four cardinal directions as 2 just directions with positive and negative polarities.  Up and down (elevation) can also be added for the three spatial dimensions. Time is another physical dimension with past and future as cardinal directions.  A culture might consider other opposed concepts as being akin to a dimension that can be moved along such as good and evil.
Comment: A tidally locked body with different conditions on the side facing the orbit has 6 poles: north, south, facing, opposing, leading, trailing.  I'd like to point out that Mercury has a sidereal day that's shorter than it's year, meaning the sun rises in the West while using the stars motion to conventionally define North. (Did you mistype your paragraph where you said the sul will (still) rise with the stars in the east if it rotates slower than if it were locked?)
Comment: @JDługosz Yes, I should have mentioned mercury.  The paragraph is correct, but maybe could be a bit clearer, note at the beginning I'm saying 'Except when'  It also looks like the definition I've been using is different from what the IAU uses for planets, although it is what the IAU uses for dwarf planets.  So I need to update my answer there as well.
Comment: Venus is also rotating slower than its year. But the N is pointing the other way, which means the direction of the solar orbit is reversed.  That is, the movement of the sun across the sky due to its orbital motion is in the opposite direction as that due to its rotation, and innthis case the orbital speed is greater.
Comment: Definition: for this purpose, it applies to any body with a stable axis of rotation. Comets and asteroids may be irregular enough to "tumble", but just because it's not nicely round doesn't mean it *must* tumble.
Answer: Edited 7/25/2015: based upon discussion in the comments section, I've updated this answer to reflect the IAU standards
Ultimately the selection of label for geographic North and South pole is arbitrary.  However, as in many things related to science and engineering that are arbitrary, the field has adopted a convention which should be used to ensure that there's less confusion when referring to the poles.
International Astronomical Union (IAU) has adopted two separate conventions to determine which rotational pole will be called the North Pole for Solar System bodies.
Planets and their moons
The IAU has adopted a standard in which planets and their moons North Pole is defined as:

as the planetary pole that is in the same celestial hemisphere
  relative to the invariable plane of the Solar System as Earth's North
  pole. This definition means that an object's direction of rotation
  may be negative (retrograde rotation)

Other Solar System Bodies
The IAU uses a different standard for the "minor" bodies of the Solar System.  This standard or convention is called the Right Hand Rule to determine which pole is the North vs. South pole.
With the Right Hand Rule, you make a fist.  Observe the direction your fingers curl.  Align your hand so the fingers point in the direction of rotation and then your thumb points in the direction of the North Pole.
Right Hand Rule shows direction of North Pole

Rotation of Earth using the right hand rule
Comment: So the *rotation vector* is not a synonym for North. I suspect they ratified convention used by plantary geologists and mappings?  @jamesqf: there is no sensible definition that lers Pluto be a "planet" without re-admitting Ceres. Whatever you call it, a belt of small bodies is a different class of thing than a single (large) body that expells anything else except at trojan points.
Comment: @jim2b: the first is dominant as the angular momentum is all shared frommthe same pool; the latter is a coincidence since stars point every which way and any bias to match the galactic orbit has been too small to detect.
Comment: Hmm, Jim2b 's comment "does ... since 2009" would retract the Answer, so why not edit it? But from my reading it seems clearly stated that the North pole is the one in the notrh celestial plane, and the *Positive* pole is the physics' s rotation vector (right-hand rule).
Comment: @jim2b  the IAU uses the celestrial pole correspondence for the 8 "true" planets, and the right-hand rule for dwarf planets and asteroids. So, the illustration for Venus and Uranus is **wrong**.  https://en.m.wikipedia.org/wiki/Poles_of_astronomical_bodies#Geographic_poles
Comment: It's not the [convention of the IAU](http://en.wikipedia.org/wiki/Poles_of_astronomical_bodies#Geographic_poles), so where does it come from and what authority does it have?
Comment: It's a common *convention* in physics, math, and engineering per my original link as well as my own multiple engineering degrees.  Remember the selection is arbitrary and it is simply an agreed upon labeling convention so we understand one another.
Comment: and according to your link, the IAU **does** use the right hand rule to define a body's North pole and has since 2009.
Comment: Yes, *clearly* the right-hand rule is a convention in physics; you don't need multiple engineering degrees for that, but it's good that your undergrad was useful. The right-hand rule is **not** used for determining a planet's poles (this question is about planets), it's used for "dwarf planets, minor planets, their satellites, and comets".
Comment: That's just silly.  Astronomers bucking the rest of the sciences - just to be different no doubt.  I'm betting if this ever becomes an issue for the common person, the astronomers are going to lose out to the other professions.
Comment: Interestingly, the Earth's, Sun's, Solar System's, and Galaxy's rotational North Pole (based upon the Right Hand Rule) all point to the same hemisphere.
Comment: @Samuel: Isn't the IAU the same bunch that came up with the nonsense "clearing its orbit" rule 'cause they didn't want Pluto to be a planet?  So we should bother to listen to them?
Comment: Astronomers made a total mess of it. 97 degrees is still not sufficient to switch the poles, but 177 degrees already is. Uranus north pole faces away from the northern hemisphere.
Comment: I edited my answer so it is exactly and  precisely correct, provides illustrations, and explanations and yet it is still getting down votes.  Someone doesn't like me.
Comment: It's not exactly right… the right-hand-rule defines a *positive* pole, not "north". It appears that different presenters use conflicting definitions for their casual (non-normative) use of "north" in labeling their maps.


New and improved with clarification: XML feed design best practice for structured data when there is no pre-existing DTD/Schema

Question: When designing an XML feed for structured data, what  is good practice, and what anti-patterns are there?
I'd like answers that cover XML structure and content, and/or transport mechanisms.
Transport Mechanisms
With current technologies is FTP/SFTP a good technology? Are there cases where it is the best fit as a solution?
Generally I prefer HTTP pull feeds, but what weaknesses does using HTTP have?
What other feed mechanisms should be considered with their pros and cons?
XML Structure Content
When there is no suitable existing DTD/schema that exists, what practices can be followed to come up with a good XML design?
Two anti-patterns for this I have already given in my answer below.
But what should I be doing when designing a feed? I'd like to hear about tags vs attributes, how relational data (esp. many-to-many relationships) should be conveyed in XML, etc.
Note: I have completely rewritten the question, as even with the bounty offered it wasn't getting a lot of love. (The old version is in the edit history if you want to see it. This version should be pertinent to the answers already given)
Answer: A good feed has
1) A schema, because that way you can check it programatically and you know when it's been changed - saves lots of arguements
2) Tells you when it's down
3) Works consistently
4) Will handle stops, starts, pause, rewind gracefully
5) Has a test service that fully exercises all the existing feed features
6) Has a new features service for sand box development
Realistically I've only worked with feeds that deliver 1 and sometimes 2, but we can dream.
Answer: Without a DTD / Schema you have no way to knowing if a feed is valid until your code encounters a problem. So for me schemas are very important, both as an XML consumer and a producer.
Even a simple schema is useful, defining the elements, how many times they occur etc. A detailed schema, with restrictions or enumerations as needed is even nicer. When I have those I can minimise the amount of errors in the XML I produce, or I can validate the whole file if it's sent to me and reject it as non-compliant as necessary. It's just a neat, standard way of performing input validation.
Answer: It's a good question, but I don't know how much further it goes than schema good, !schema bad.
I've had to consume feeds which failed to provide or provided broken schemas and realistically all you can do is transform those into namespace-less clones, which is workable but risky as hell.
I18N and especially number formats and datestamps are a massive problem. Best practice is of course declaring your format in the doc, and preferably defaulting to UTC time.
I guess the only other good practice I can suggest is where consuming multiple feeds which need to interact don't try and deal with them on their terms, instead the first thing you need to do is deserialise them to a standard object or transform them to a standard internal schema.
Answer: Without knowing your real requirements, it is difficult to make recommendations for transport mechanisms or styles. For instance, if you're doing pull based syndication, HTTP can offer features that assist with caching. If you're doing push based or publish/subscribe protocols like XMPP could be used.
For your feed itself, I'd recommend sticking to a public specification such as Atom (or maybe an RSS variant if you want). Atom incorporates some of the items you mentioned such as encoding content and date formats (using UTC is easiest in most cases, then convert to a user's local time for display). By sticking to standard formats, you also allow use of feed parsers that support that spec.
Atom and RSS are flexible enough to allow you to define your own XML namespaces to add whatever elements and attributes you need. If your data produced doesn't map onto the feed/entry data model, then maybe they aren't the best fit for you.
If you are using XML, parent/child relationships (where the child only has 1 parent) these can be easily modeled as parent/child elements. If the child has multiple parents, you can use reference and attributes to link elements.
Comment: Generally though we have to supply structured data, where there is no obvious agreed standard. So unless I am missing something, I don't think ATOM/RSS would suffice. e.g. Tennis scores. There is a SportML DTD for such things, but it seems massively verbose.
Comment: Who is consuming your data? Are they other computerized services or humans via something like Google Reader? If you are the supplier, can't you define the standard used to supply the data? It seems like you need to choose to lead (define your own) or follow (use an SportsML).
Answer: One personal bugbear of mine at the moment are timestamps without timezone information. If you are dealing with feeds from all over the world, a time without a timezone is meaningless.
Edit: And feeds which don't include an encoding attribute, or include one, but then don't respect it!
Comment: Common recommendation for timestamps: always use UTC.
Answer: Well, quite honestly, "best practices" are not universal, so any answer will only be applicable for the particular problem that is being solved.
However, in my experience, here is a list of general XML and protocol design elements.

Avoid FTP/SFTP whenever possible because of reliability and, especially with SFTP, they are not universal implementations.  Also, most firewalls will allow port 80, but you can run into blocked ports for FTP/SFTP.
Implement a schema with a namespace that has a version or date in it.  For example, http://yourcompany.com/xml/myfeed/2009/03.   That conveys information about when the schema was revised and also indicates a version number, which is useful for clients.
If your feed is publicly exposed, consider implementing various RDF tags for your data.  Your data will then become part of the Semantic Web.
If your content supports it, use RSS or Atom, because there are tons of clients out there that understand those formats already, so it dramatically increases your usability.
Answer: I think MediaRSS is a pretty good feed schema.  I like it because:

It is flexible enough to contain almost any type of content.
It lets you define groups of media with in the feed (useful, e.g., when you have multiple resolutions of an image, or multiple formats).
It defines pretty much all the basic metadata common to all types of media, but doesn't require all of them.  I haven't run into any media I wanted to put into a feed it couldn't represent.

One thing I would like it to have that it doesn't is a tag for arbitrary parameters that should be passed to the player of a given piece of media, but I don't think that really makes sense since the feed shouldn't have to know anything about the player.  But sometimes I just have to pass params to the Flash player.


How to integrate images into text lines in Unity?

Question: Here are two screenshots from Stellaris, where images are seamlessly integrated into the text. How can I achieve this in Unity?
Comment: [I implemented something a bit like this some years ago](https://twitter.com/D_M_Gregory/status/680477412287578112), but never got it cleaned up enough to be a production-quality asset. [I gave an overview of the strategy I used here](https://twitter.com/D_M_Gregory/status/695596960250793984), which might give you some leads for how you can attack this.
Comment: Let me suggest... maybe.. maybe the best way is to do it in old and tested way. To convert text to images. This works all the time for many years already. You can create sprite-sheet with images of all the letters and write function that places image of character instead of actual character.
Comment: Are you using the classic Text component or the newer TextMeshPro texts?
Comment: @ShoulO that's effectively what the text components in Unity already do for you, so I don't think there's much to be gained by reinventing that wheel.
Answer: The regular Text component unfortunately can't do that, at least not on a UI canvas and without some nasty hacks. But TextMeshPro can. I really recommend using TextMeshPro over the classic Text component anyway, because it is superior in basically every way. The only thing which still justifies the existence of the classic Text component is backwards compatibility.

Create an image asset with all the icons you need (aka "sprite atlas")
Import the image as a "Texture Type: Sprite" with "Sprite Type: Multiple".
Slice the image into sprites using the sprite editor (requires importing the 2D Sprite package from the package manager). Set the "Pivot" of every sprite to "Bottom Left" (otherwise the sprites will not align properly with the text).
Right-click on the image asset in your project window and select Create > TextMeshPro > Sprite Asset
Create a "Text - TextMeshPro" gameObject on your canvas. When you already have one, make sure that you still have "Rich Text" enabled (it's hidden under "Extra Settings").
Assign that sprite asset to your TextMeshPro component. The setting is hidden under "Extra Settings". Or alternatively, if you want to use the same set of icons for all texts in the game, Go to Edit > Project Settings > Text Mesh Pro > Settings and set the default sprite asset to the asset you just created.
You can now refer to sprites in your sprite asset by writing <sprite=number> into the text of your text object, where "number" is the sprite number from your sprite atlas. You can also explicitly name sprites in your TextMeshPro Sprite Asset and then refer to them as <sprite name="spritename">.

For example, if the second tooltip from the screenshot in the question were a TextMeshPro text, then its text would read something like this in the editor:
Pop Amenities Usage (<sprite name="populaton"> <color="yellow">52</color>): <color="red">52</color>

Comment: He's right about the old Text component; there's no reason to use it anymore.


QGIS3 How to export shapefile symbology to scale?

Question: I'm looking how to export in QGIS3 a vector layer with a determined scale.
It was straightforward in QGIS2 when I was exporting to a shapefile I had the option symbology scale but it disapear in QGIS3 or maybe I'm missing something.
The intent is to use the shapefile in another program.
Answer: Shapefiles do not store scale or any style in their files. Yes, there is a Symbology export which I tried to make it work, and I have tried with Feature symbology enabled and Symbol layer symbology enabled. But in fact there was no effect at all and the shapefile was exported without any scale or symbology information stored in it.

Maybe this option was added to support other formats that can store scale and symbology but not shapefile.
Also I checked if using Symbology export option will add a new .qml file as symbology file alongside with the shapefile as kind of shortcut, but nothing happened and no extra  .qml file was added/exported.
In QGIS 3.4, it looks like the option of exporting shapefile and other vector formats was separated from exporting Symbology layer. Exporting shapefile/other vector formats is available by right-click the layer in the table of contents -> Export -> Save Features as, and you also export symbology including scale separately from right-click the layer in the table of contents -> Export -> Save as QGIS Layer Style File

Load the style as usual from Layer Properties -> Style -> Load Style

This will load the style with predefined scale and symbology onto the layer:
Scale value >= 100000 (1:250000), nothing appeared:

Scale value < 100000 (1:50000), style appeared:


How To Download Kali linux Old ISO From Official Sources Like kali.org

Question: Hey Stack Overflow Community I Have been Huge Fan Of Kali Linux as all the development pakage is preinstalled plus using windows you have distraction like playing games so i generally use kali for penetration testing learning and for the development as all python 3 c shell are preinstalled but i did n't like the fancy new kali arrival after 2020.1 so is there a way to get old kali iso like 2017,18,19 from the official source because of disk file from untrusted could reverse engineer to make it maleware i do know oldkali.org like ftp but i do not know it as official if it do reply
Answer: All the old Kali Linux ISOs (from kali-1.0.0 to kali-2021.1) can be found here: http://old.kali.org/kali-images/. Every iso come with the signed checksum files it will be used to check  the downloaded images.
Answer: Some advice, try searching the web to see if your concern is already addressed before posting here. This site also gives a lot of helpful guidance on when and how to ask questions--as well as how and when not to. Please read it.
Here is a link to my Google search that turned up multiple answers and even the official Kali (old) archives: Google Search: kali linux download official old
Specifically, old.kali.org is documented by Kali (see their README.md file) as the official root mirror to download older images, and I can see images on their site as old as 1.0 (from 2014).


why are we multiplying v by v/r to get the acceleration

Question: In this answer to the question "Intuitive explanation for why centripetal acceleration is $(v_T)2/r$": https://physics.stackexchange.com/a/190532/262601 (excerpt from the answer is attached below), I don't understand why "we multiply the length of the velocity vector by v/r, just as before, to get the acceleration". I understand why we multiply the position vector, r, by v/r to obtain the velocity vector, v: r(v/r) = v. However, I don't understand why we are multiplying v by v/r to get the acceleration.

A point is moving around a circle. It has a blue position vector and a red velocity vector, like this:

The position vector stays the same length and rotates around and around in a circle. Because the position vector is changing, it has a derivative. That derivative is the velocity.
Because we're always going the same speed, the velocity vector also stays the same length. Because the velocity is always 90 degrees rotated from the position, the velocity is also going around in a circle. In other words, the velocity vector is doing exactly the same thing as the position vector is doing; rotating and staying constant length. The only difference between the position and velocity is that we rotated by 90 degrees and multiplied the length by v/r.
(Note: it does not matter where we draw a vector; no matter where we draw it, the vector is the same. We draw the velocity vector at the end of the position vector, so it looks like the velocity vector is moving around in space. That's not the point. We can re-draw the velocity vector so it also starts at the origin and then it will not move around at all. What matters is just the magnitude and the direction. The velocity vector, even if we make it always start at the origin, spins around in a circle at the same speed the position vector does because they are always 90 degrees apart. So the velocity vector really looks just like a new position vector, just with a different magnitude and a direction 90 degrees ahead.)
Acceleration is the derivative of velocity, and we know how to take the derivative. Since the velocity is doing exactly the same thing the position is, we can take the derivative of the velocity in exactly the same way we did with the position.
We rotate the velocity by 90 degrees and get a vector pointed back in towards the center of the circle. That's the direction of the acceleration. Next we multiply the length of the velocity vector by v/r, just as before, to get the acceleration, which is v∗v/r=v^{2}/r.
Answer: Since $\vec v$ is always orthogonal to $\vec r$ and has a constant magnitude, it means vector $\vec v$ rotates with the same angular velocity. The end of vector $\vec v$ will cover "distance" $\Delta = 2\pi v$ during the period of $T=2\pi r/v$. Thus, it moves with the "speed" $\Delta/T = v/(r/v) = v^2/r$.
Another way to look at it, is to see that $v_1$, $v_2$ and $a\,dt$ form an isosceles triangle which is similar to $r_1$, $r_2$, $v\,dt$. Thus, $a\,dt/v = v\,dt/r$.


Discrepancy in Google Analytics reports for Audience vs. Page vs. Content Drilldown - Why?

Question: I've been using Analytics for over a year now so I'm familiar with it though I'm haven't mastered it yet. Having said that, I need your help and guidance in regards with a discrepancy I keep running into when comparing results of a specific subfolder in a domain through the audience section vs. all pages (once it's filtered so that specific folder) and content drilldown.
I have domain www.domain.edu/ and I'm trying to get a report for January for www.domain.edu/em/ which needs to include visits, visitors, page views, unique page views, et al.
Normally I would go to Behavior > Site Content > All Pages and use the search box (under the line chart section) to filter only /em/ and so my results would like this

So according to this report for /em/ there were 391 page views. But if I go to Behavior > Site Content > Content Drilldown the results are different

Here now reports 387 page views, 4 less than from filtered All Pages. Okay so it's not that of a big deal and I agree... BUT if I go to Audience > Overview; results are drastic this time.
First I made sure to create a new segment and I actually used the same one which was generated when filtering for /em/ in All Pages ("Matching RegExp = /em/")

Here now reports over a thousand page views just for January, out of the 391 page views from Page, in contrast with the 387 page views from Content Drilldown.

I can finally see a much better complete report of what I was looking for in the first place; visits, unique visitors, etc. But the page views are way off above of what I initially was getting from the previous two reports. No wonder why my numbers were not matching when adding them up in a year (Page (from All Pages) vs. Overview)
So my obvious question is why this is happening. Am I doing something wrong in here? As far as I know, the Behavior section only contains reports designed to help you improve the content on your site to meet the needs and expectations of visitors (source) but doesn't mention anything of excluding anything.
Another question is, am I using the correct filter for the Overview section? Remember, I'm only interested on the analytics reports for /em/
Please advise. Thank you very much.
Answer: Segment page views in the GA overview are NOT limited to the page in your segment. Rather, the overview shows the total number of pages seen by visits matching your segment. So the bigger PV numbers show how many pages were viewed across your website by people who, in any visit, went to a page with the /em/.
Larger problem is that your overview example shows so many visits and unique visitors for your segment (many more than PVs). May have to do with your GA configuration, but effectively defeats the purpose of trying to find overview metrics using the segment as currently defined.
Answer: It might be because visitors may be coming to your section's landing page in the middle of surfing your site.
Explanation is found here on Google Analytics' site: Why a custom report shows more Unique Visitors than Visits


Windows Server 2012 R2 VPN - connects to network but cannot access server

Question: I've configured Windows Server 2012 R2 SSTP VPN and for the most part it appears to be functioning normally. The remote machine connects, is allocated an IP address in the LAN, and has access to network computers and resources.
The only problem is that the remote machine cannot access the actual VPN server machine itself. Pings to it's IP address time out and RDP attempts fail.
The VPN server responds normally to pings from LAN machines. I can even RDP into a machine on the network, and from that machine, successfully RDP into the VPN server. Why can't I contact the VPN machine directly from the remote client?
The VPN machine is virtual, has nothing else installed apart from the Remote Access role (and dependencies). It's firewall is turned off, and the connecting user is an administrator of the VPN machine. The VPN machine is not part of a domain.
Could anyone recommend a way to troubleshoot this?
Thanks :)
Answer: I found the answer.  Looking at the Network and Sharing Center, the RAS (Dial in) Interface was set to Public network. I had turned the firewall off but only for private networks. Turning it off completely solved the problem.
Answer: You might also consider configuring the firewall rather than just disabling it.  Its good to know the rules were the issue, but security concerns should be considered.
Answer: I found this while facing a similar problem.  The Network Category turned out to be the issue for me, also.  If anyone else stumbles across this, they may want to try Get-NetConnectionProfile from a PowerShell prompt.


Weyl law for arithmetic Fuchsian groups known?

Question: For congruence subgroups of $PSL(2,\mathbb{Z})$, the Weyl law for the eigenvalues of Maass cusp forms had been proven by Selberg. How is the status of such a Weyl law for eigenvalues of Maass cusp forms for arbitrary arithmetic nonuniform cofinite Fuchsian groups? Has it already been proven? Does one know at least that there are infinitely many linearly independent Maass cusp forms for these lattices?
Comment: I decided to ask the following follow-up question: http://mathoverflow.net/questions/130062/concrete-examples-of-noncongruence-arithmetic-subgroups-of-sl2-r ... Perhaps you have an example at hand?
Answer: The Weyl law has been proven in great generality, e.g. for congruence subgroups of $PGL(n,\mathbb{R})$, and beyond. See the introduction in Lindenstrauss-Venkatesh: Existence and Weyl's law for spherical cusp forms, GAFA 17 (2007), 220-251 (manuscript available here). See also Marc Palm's recent thesis.
Comment: The only arithmetic, nonuniform cofinite Fuchsian groups are (after a conjugation in $SL_2({\mathbb R})$) commensurable with $SL_2({\mathbb Z})$. So the issue is congruence subgroups vs. non-congruence subgroups of $SL_2({\mathbb Z})$.
Answer: Consider the normalizer $\Gamma$ of $\Gamma_0(N)$ in $SL_2(\mathbb{Q})$ for $N$ squarefree, which is not a subgroup of $SL_2(\mathbb{Z})$, then you obtain the same Weyl law as classical. For my taste, these groups should also be called congruence subgroups, although they are not contained in $SL_2(\mathbb{Z})$. They are important if you want classically distinguish between nonisomorphic supercuspidal reps contained as factors of automorphic reps associated, which are associated to ramified quadratic extensions of $\mathbb{Q}_p$ at $p |N$.
I don't know a single example what happens if $\Gamma$ does not contain a congruence subgroup, but is arithmetic.
Btw, your question makes perfect sense, because the modified Rolecke-Selberg conjecture states (see the  introduction http://link.springer.com/content/pdf/10.1007%2FBF02572621.pdf) that apart from arithmetic lattices, there are at most finitely many discrete eigenvalues.
There is some computational evidence by Hejhal for this conjecture:
Hejhal, Dennis A.(1-MN-SM)
On eigenvalues of the Laplacian for Hecke triangle groups.

Copy&Paste from MathSciNet: This paper is part of a series of articles in which computer experiments are performed to numerically compute the eigenvalues of the Laplacian. In this paper the Hecke triangle groups generated by z→−1/z, z→z+2cos(π/N) are considered.
     The basic results are a computation of eigenvalues for the groups with N=3,4,6 (the congruence groups) with eigenvalue 14+R2 with R<25, and the conclusion that no even cusp forms exist when N=5, R<60 and N=7, R<40. The last result, which is similar to results of Winkler, gives evidence in support of the Phillips-Sarnak conjecture that one should have few if any cusp forms for nonarithmetic groups (except for the obvious ones caused by symmetries).
     The procedure used is essentially the collocation method. One must also be careful in evaluating the K-Bessel functions that appear in the Fourier expansion of the forms.

What is sure is that if $\Gamma$ does not contain a congruence subgroup, then the Maass cusps forms on $\Gamma \backslash \mathbb{H}$ can not be lifted to a vector of an automorphic adelic space $SL_2(\mathbb{A})$ in any obviuous way, and one cannot expect them to have a nice $L$-functions. Also the contribution of the continuous spectrum is most likely not expressable in terms of classical Dirichlet L-functions. Recall that this is the main point to be understood for Weyl laws of non-uniform lattices.
I know that the Belyi's theorem generates an isomorphisms between nonsingular algebraic curves over $\mathbb{C}$ and $\Gamma \backslash \mathbb{H}$ compactified at the cusps, where $\Gamma$ is an arithmetic subgroup of $SL_2(\mathbb{Z})$, but noncongruence in general. This might be a source of such lattices and at least modular functions on them should exists (by Riemann Roch?).


Google Sheets - value in cell different from text

Question: Within one cell, I would like the value of the cell to be treated differently from the text inside that cell. For example, I would like the cell to display "$148 (123 euros)", but the value to be treated as 148 when I am summing that cell and another.
Answer: Given your example — "$148 (123 euros)" — you won't simply be able to refer to the cell when trying to do math with it.
Let's say that your above string is in A2 and you want to divide the USD amount by 2 in cell B2. In cell B2, you'd use something like this:
=REGEXEXTRACT(A2,"\d+")/2
The REGEXEXTRACT will extract the first group of digits it finds, on which math can now operate.
Keep in mind that if you only want to extract the number without any further math, you'll need to wrap the REGEXEXTRACT in VALUE:
=VALUE(REGEXEXTRACT(A2,"\d+"))
This is because REGEXEXTRACT extracts strings. When you apply further math operations, Sheets automatically knows you want to treat the extracted portion as a number. But if no math is applied, the extraction remains a string. So VALUE converts it to a number. In lieu of this, you could also just apply the math of *1:
=REGEXEXTRACT(A2,"\d+")*1
Comment: Thank you Erik. I had a feeling this was not possible. Your workaround makes sense.
Comment: You're welcome. I don't know the purpose of your having the string information together in one cell. You may have one. But also consider that you could use two different cells, side by side. The first could just have the real number 148 formatted as currency with a dollar sign. And the second could have the number 123 formatted as currency with a euro sign. In fact, if the string is coming into your sheet as-is, you could set up two columns next to it that would pull either or both of those two numbers into separate cells, which you could then do direct math on.


Center of mass of constrained rigid body

Question: Say we have a rod with center of mass at its geometric center. Rigid bodies rotate around center of mass. If you apply force $\mathbf{F}$ at distance $\mathbf{r}$ from center of mass you generate torque $\boldsymbol{\tau} = \mathbf{r} × \mathbf{F}$, resulting in angular acceleration. If you apply force at center of mass, this results only in linear acceleration. However what happens if we constrain (hang) the rigid body from one of its ends? Why does applying force at the geometric center now generates torque? Does center of mass shift?
Comment: Hey! You've asked some questions in comments to the answers below. It'd be better if you put those queries in the body of the question above.
Comment: '...If you apply force at center of mass, this results only in linear acceleration...'. What happens when the body is already rotating when you apply force at the centre of mass?
Answer:
Does center of mass shift?

Absolutely not! Centre of mass can shift only if there is a change in distribution of mass of the body.
That means we are still applying force on the centre of mass of the body, and the value of $\vec{r}$ in $\vec{\tau}=\vec{r}×\vec{F}$ is still zero. So we can be sure that the force being applied by us is not producing any torque.
Then what could be the explanation of the torque we witness? Think about it again, what is required for producing a torque about a point? A force whose line of action does not pass through that point!
This implies that there must be at least one such force in the above condition that we have been ignoring till now. Where that force could be? To find it, try comparing the motion of the body in the two different scenarios that you have presented and think about what is causing the motion to differ in the second case. When we say that the rigid body is constrained, what exactly is causing this constraint?

As we can see in the above illustration, in the first case, the topmost point moves with the same acceleration as the rest of the body. But when we hinge this point (constrain the body), its motion stops. From here, we can imply that the hinge applies a force on the point opposing its original motion.

(Please note that I have only shown a component of the hinge force. It can have another componet along the rod too.)
Since the line of action of this force is not passing through the centre of mass of the rod, it is perfectly capable to produce a torque and cause rotation of the rod (which it indeed does).

Why does applying force at the geometric center now generates torque?

The torque is generated because your force at the geometric centre is causing a hinge reaction force (which is not at the geometric centre), and this reaction force is generating the torque.
Comment: Thanks for the detailed answer! Can I ask what happens to the linear acceleration? Applying force to the center of mass should  generate linear acceleration, but we get none.
Comment: Also in an example with a cart, if we apply a force to it (cart) the rigid body gets angular acceleration because of torque, but we can say the body also gets linear acceleration right?
Comment: Linear acceleration is the acceleration of the cenre of mass of the body, and since the centre of mass is in an accelerated motion, there IS a linear acceleration present.
Comment: And yes, the body gets linear acceleration too as, again, the centre of mass is accelerated.
Comment: In fact, you can see the motion you are talking about as a composition of a rotation around the center of mass, generated by the hinge reaction, and a linear motion, generated by the force acting on the center of mass. By the way, congratulations to Aumkaar for the nice answer.
Answer: If you hang the rigid body from one of the ends, then when you apply your force, there is a normal force applied at the end that ensures the constrained end does not move.  This normal force can generate torque.  The center of mass doesn't shift.
Comment: I understand, thanks! But say we constrain the body to a cart and then apply force to the cart which causes it to translate with the rigid body. If we ignore the forces generated by air drag and friction. Would this force cause any torque on the body? The body would get some torque in real life but is it solely caused by air drag?
Comment: Depends upon how is the body consrained to the cart and in what manner the cart is being moved. The bottom line is that if there is any force on the body not passing through its centre of mass then it is capable of producing a torque.
Comment: If you are saying something like [this](https://imgur.com/a/1kHYXNX), then yes there will be a torque on the body as the hinge is applying force in forward direction and this force does not pass through the centre of mass of the body.
Comment: @AumkaarPranav Thanks for the reply! I was thinking something like the body at its end being glued onto the cart, not constrained with a hinge.
Comment: It's much more convenient to offer such explanations in the answer itself, so please add these follow-up queries of yours in the body of your question.
Answer: If you carefully look at your question you have the answer
$\boldsymbol{\tau} = \mathbf{r} × \mathbf{F}$,  as you said this, now thing is if the force passes through the axis of rotation the cross product becomes zero, so when you pivot the rod using its one of end, weight of mg is always passes through the centre of mass, and hence torque produced by it becomes zero.
Answer: Consider a thin uniform rod of length, L, and mass, m, hanging vertically at rest from a hinge or axle at the top. We will strike the rod at its center with an impulse, Ft, which is perpendicular to the rod (and the axle). Assume, t, is a very short period of time.  Relative to the axle, the impulse is an angular impulse which produces an angular momentum:  Ft(L/2) = Iw = (mLL/3)w  Then:  w = (3Ft)/(2mL)  This also the angular velocity about the center of mass.  We can say that the associated angular momentum was caused by an angular impulse produced by the horizontal component of the force from the axle:  ft(L/2) = (mLL/12)w  giving: f = [mL/(6t)][3Ft/(2mL)] = F/4.  From the angular velocity, the linear (tangential) velocity of the center of mass, v, is (L/2)w = (3/4)Ft/m.   We can check this against the net liner impulse:  (Ft – ft)  = mv, again giving: v = (3/4)Ft/m   If the original impulse is applied at some other point along the rod, the analysis is more complicated (two torques acting about the center of mass), but the results are similar.
Answer: You have made principal error here =>

Rigid bodies rotate around center of mass

Nope. They rotate around a reference point, which usually is a fulcrum where rigid body is attached to. If fulcrum will be attached to center of mass - body will rotate around center of mass. Otherwise it will rotate about different point.
For example - take a look at wheel. Usually it is rotated around axis which goes through a geometric center of wheel. But nobody said that it must always be so.
You can cut a hole in ANY wheel/disk place required, put some rod in there, push the wheel and voila  - its starts to rotate around that reference point. Of course such design isn't optimal, because in such way rotating wheel will induce high stress to rotational axis, due to centrifugal force of rotating wheel. In any-case you need to stop thinking that a rigid body rotation has something to do with COM. It can of course, but this is not required.


Is n-tier software design a subset of SOA?

Question: Is n-tier software design a subset of SOA?
Answer: no . It is not .
SOA is a design strategy for an enterprise. There is lots written about what it is elsewhere, however it decides how systems interact using services.
N-tier software architecture is  application specific.  It assists maintainability and scalability by separating layers of code.
They are aimed at different components of Information Technology and have different goals and benefits.
Answer: No.
For a start N-Tier is older than SOA, and they are quite different concepts.
N-tier architecture splits an application into seperate tiers with a disctinct concern. The tiers should allow minimum application rewrite if, for example, the front-end changes from a Windows application to web application.
SOA is a broader concept, that tries to encapsulate individual business services and expose them to each other using an agreed contract. These individual services may be built using an N-tier architecture.


Keeping inventory conditionally

Question: I want to make a PvP data pack for a Minecraft server, and I want it to function as follows: if a player is killed within half a minute of him hitting another player, they should drop all their items, but if they're killed without hitting another player they should keep their inventory. Is this possible? Also, if possible, I would want to do this without using command blocks.
Answer: The gamerule keepInventory can only be applied to the whole Minecraft world. But luckily there's also the /clear command. You can set /gamerule keepInventory true and then handle the inventory clearing with commands:
You can detect players who hit someone/got hit like this: Detect when player attacks another player
Then you can use a scoreboard of the deathCount type to find players who have died (and respawned) and use /clear to clear their inventory.
If you also want to clear their XP, you can use /xp set <player> 0.
Comment: Thanks, but I'm trying to do this without the use of command blocks, and even then I want them to drop their items, not delete them.
Comment: Without using commands or without using command blocks? You can of course just make a function with the same commands. Without commands, it's impossible, just like keeping the inventory in general.
Comment: I was thinking about doing that with a data pack and I'm pretty sure it is possible, but I don't know how.
Comment: Yes, functions, as I said. They are part of data packs. But what's your reason for not wanting to use command blocks? Performance?
Answer: I currently am working on a server-side Fabric mod which would entirely focus on such a matter. And even though it still only is in beta, you can still set a config to make it work properly, since making it work properly at first was the alpha version challenge.
You can actually find that mod right here. I'd also soon be publishing updates, as soon as I'll reach some real step in the development.
Here is a helpful description from the mod:

When any player dies, if the keepInventory vanilla gamerule is set to true, and the death matches any condition set in the blacklist, the player's inventory drops anyway. If set to false, the mod searches for matching death into the whitelist, and if it finds any, the player gets to keep its inventory. But here comes the second gamerule, conditionalDoVanishing, which makes it so that, when the player gets to keep its inventory despite the vanilla keepInventoory, and this gamerule is set to true, all the items with the Curse of Vanishing in their inventory still get to disappear in thin air.  Finally, when the server stops, the mod saves the config to the config file to make sure it matches the gamerules.
Comment: We are sorry that your post was deleted and restored. We would like to inform you that you need to be more careful about promoting your content on our sites: we don't tolerate users that are here just to drive traffic to their content. Please read our [helpful guide](https://gaming.stackexchange.com/help/promotion) on how to promote your content without being considered a spammer.

Keeping inventory conditionally


How to get a large collection of quantum circuits that are valuable to practitioners?

Question: I want to get a large collection of quantum circuits that matter to practitioners in quantum computing. I want a get many complete quantum circuits. For example, 1 million QASM files.
However, I could not readily find a large dataset.
Are there any places I could find it?
Comment: Could you please clarify what is your ultimate goal what to do with "1 milion QASM files"? It would help to answer your question.
Comment: Hi and welcome to QCSE!  What do you mean by "a large collection of quantum circuits?"  Are you wondering how quantum gates are actually implemented?  Are you looking for a set of "standard cells" for quantum circuits that implement specific functions?  Are you familiar with [quantum gates](https://en.wikipedia.org/wiki/Quantum_logic_gate)?  Your goal is not clear right now with the way the question is framed.  I recommend you revise your question for clarity, and what you mean by "collection of quantum circuits."
Comment: @MarkS I am familiar with quantum gates. I am not specifically looking for standard cells, however if there was a method to generate many useful quantum circuits that happened to use standard cells that method would be very useful.
Comment: I want to study how to reduce noise in quantum circuits that are valuable to practitioners.
Answer: I would recommend this paper: https://arxiv.org/abs/1804.03719. You can find there information on algorithms and how to deal with noise and errors in quantum circuits. Moreover, it can help you to "generate bunch of QASM files" implementing algorithms presented there.


240v AC Voltage measurement using Voltage divider

Question: I'm doing my project on energy based auditing, it's an industrial project... I need to measure the high voltage of around 240v, can I step down to 5v using voltage divider?
Comment: not safely, no. you need a transformer for isolation. also remember that naive resistor dividers have polarity, unless you merely half the voltage.
Comment: Yeah I know, but I was thinking of measurement without transformer,.... Is there any other methods for transformer less measurement of AC voltage?
Comment: Yes: optical. So with an optocoupler. Note that this might not work over a very large AC voltage range and some circuitry is needed to get a proper indication of the AC voltage.
Comment: Are you wanting "instantaneous" measurement? Or are you willing to accept the peaks or some kind of mean value? Also, what is your allowable power budget for the device?
Comment: I need to measure the voltage using Microcontroller, so as you said need to measure at each samples and get the mean, if I use the divider what resistor values should i use for high voltage measurement?
Answer: You can't accurately measure energy flow without measuring the instantaneous voltage and instantaneous current with many samples per cycle.
I suggest you take a look at reference designs for energy meters. If it's an industrial situation you may have to do it for 3-phase power. The safest and most expensive method is via a potential transformer.
Comment: I did the circuit using voltage divider and stepped down 230v to 5v ac, then i connected to my arduino to test to measure actual ac voltage by taking about 100 samples per second and got those values ;)
Answer: Yes you can. But things become complicated quickly since there are a few other things to consider.
When you design such circuit you'd want to have as much resistance as possible to limit wasted power in the divider. You'd also want your divider to survive electrical fast transients (EFT) and other surges, thus your divider should be able to withstand those voltages.
But high total resistance makes common mode and noise pickup a problem. Yet low total resistance make dissipated heat a problem.
You could take 20 resistors to combat this, but then you'd also have the side effects of 20 resistors. (eg: space, inaccuracy and drift)
There several application notes around tackling this issue.
TI: slaa494a
Atmel: AVR465
Then you also have the problem of data acquisition, since you'd need to be doing RMS with enough bit depth and sample-rate. Which is quite cpu intensive.
And then the harmonics show up and your measurement is incorrect...
Notice that whenever you attach anything to live or neutral without high resistance or isolation you can't directly attach anything else anymore. No programmer without isolation, no USB, no oscilloscope.
Magic smoke will be released if you do.
Comment: Can i use anti alias filter to reduce noise?
Comment: @Dexter Alias filter is mandatory anytime you have Analog to Digital conversion. It won't help with all the other problems though.
Comment: Very good advice about scopes, USB etc. I remember doing this kind of thing on a three phase motor design. I was so careful to disconnect everything after programming and before powering back up with rectified mains present while waiting for my isolation transformer to arrive. Then one time, inevitably, I forgot. My poor motherboard, may it rest in peace. Not to mention the JTAG interface that is now in the great electronics scrap heap in the sky.
Answer: Just a thought but since your goal seems to be measuring energy rather than voltage, why don't you concentrate on measuring current and just assume the voltage is its nominal value. You didn't specify accuracy but mains voltage rather varies more than about 5% either above or below nominal. This would eliminate a difficult, and potentially dangerous, measurement process.  Measuring current is not necessarily easy but it seems you must do it since energy is much more dependent on current rather than voltage.
Answer: Your cheapest solution would be a two stage step down transformer with a buffer in between; most commercial transformers are highly efficient and would save you the further trouble of worrying about noise.
Comment: Welcome to EE.SE. (1) Why would you recommend a two-stage step down? (2) How would two stages be cheaper than one? (3) What is a buffer between two transformers? (4) Why would efficiency matter on a voltage measurement application where the current is likely to be < 1 mA or so? (5) Why would noise be an issue with any other solution and not with a two stage step down? There is a schematic button on the editor toolbar if you wish to add a schematic of your answer.
Comment: (1) I recommended two stages to ensure that the analog voltage would almost always be at bare minimum irrespective of spikes, and having a large step down transformer wouldn't be aesthetically pleasing for a small project, so two small step down transformers should do....(2) it wouldn't be cheaper..(3) i was thinking an op-amp buffer to ensure something of a pure voltage source with very small impedance..(4) I assumed that the OP gave preference to correctness, considering that his ADC resolution might be fantastic..(5) Commercial transformers have better Noise control for it's price
Comment: I appreciate your thought, but for my project i needed to reduce the bulky of my device, so I thought of transformer less high voltage measurement using microcontroller. Using Voltage divider we can achieve step down to around 5v range, but it's kinda dangerous anyway, if I do using divider, i think we can reduce noise by ANTI ALIASING FILTER which attenuate High frequency component, using this crosstalk and noise could be reduce i think.


What is the percentage modulation of phase modulation PM?

Question: What is the percentage modulation of a phase modulation (PM)?
Can you further explain and give detail? I am currently stuck in finding the information about this
Comment: @Andyaka "As long as it is."
Comment: How long is a piece of string?
Comment: Percentage is just another way of expressing a ratio, ie a pure number. The top of the ratio is obviously the modulation, in radians. There are only a couple of options for the bottom of the ratio. a) One radian, so it means the same as modulation Index or b) the maximum rated or permitted modulation for that particular scheme, so 100% means rated modulation index. All that's needed now is a little more context in the question.
Comment: Start with the definition of phase modulation. Look what happens when you raise the modulation; at one point *something interesting* happens, and that would be the 100% point
Answer: Phase Modulation is a broad category and generally refers to carrier modulation. However on baseband modulation this also spans a broad spectrum of modulation types like PWM, Bi-phase, Manchester, MFM, RLL etc.
There are tradeoffs for carrier spectral BW for small and large signal modulation for the % deviation ratio of maximum.
QPSK has 4 phases such that 2 (Sin+cos) patterns may each be binary modulated to produce 4 phase or Baud symbol patterns mapping 2 bits in about the same bandwidth, BW. This can be extended to 128 phases. But better modulation methods combining Amplitude Modulation with PM may compress even more logic states into one time symbol or Baud.
But as Shannon-Hartley's theorem  dictates this requires more signal to noise ratio SNR to achieve the same bit error rate (BER) to achieve this BW compression of bits/Baud  but it does increases the channel capacity.
This is necessary in wide BW channels such as Modems so that the entire BW is sub-divided into smaller AM+PM or whatever sub-channels handled in parallel by a Digital Signal Processor (DSP).
Answer: Well, at any one moment in time you could advance the phase angle of the carrier by 180° and, at another moment in time you could retard the carrier phase angle by 180°. That covers the full spread of all possible angles. The question then remains how you want to approach this in terms of attributing a percentage value. You could say that the limits were +100% for an advance of 180° and -100% for a phase retard of 180°.
Or you could call it +/- 50% but, whatever you call it, you should define what is meant by the percentage value in case there was someone who didn't understand your definition.


Grade 10 academic math

Question: The perimeter of a basketball court is 72m. The difference between its length and its width is 12m. Solve the system to determine the dimensions of the court.
I keep getting different answerers and can't seem to find the right on. Please help.
Comment: It would be easier to help if you showed your attempts -- then people could try to figure out which _wrong_ things you need to unlearn instead of just showing you the _right_ solution (which you have probably already seen in class for other similar problems, and it hasn't helped you stop doing wrong things in your own attempts).
Answer: Let the length be $l$ metres and breadth be $b$ metres.
$2(l+b) = 72$ and $l = b + 12$
These two are the main linear equations.
So, $$2(b+12+b) = 72 \implies 4b + 24 = 72$$
$$4b = 48 \implies b = 12 \implies l = 20$$
So, length and breadth are 20m and 12m respectively.
Answer: Your question give us the information we need to make two equations.
First: $2l + 2w = 72$.  This shows that the perimeter is 72 m.
Second: $l - w = 12$.  This shows that the difference between its length and width is 12m.
Now we have to solve these equations.  We can rearrange (2) to get $l = 12 + w$.  We then substitute that into (1) and get $2(12 + w) + 2w = 72$.  We can simplify that to get $24 + 4w = 72$.  If we solve for $w$ we get $w = 12$.  Now we need to find $l$.  Just put $w$ into $l = 12 + w$ and we get $l = 24$.
I hope this helps.  You should try asking your teacher with this kind of question.  It's their job to help you.
Answer: Hint:
$2l + 2w=72\\l-w=12$
Now, just solve the second equation for either $l$ or $w$ and plug that into the first equation, then after some more algebraic manipulation you should be able to solve the system

Grade 10 academic math


Endogeneity versus unobserved heterogeneity

Question: What is the difference between endogeneity and unobserved heterogeneity? I know that endogeneity comes for example from omitted variables? But as far as I understand, unobserved heterogeneity causes the same problem. But where exactly lays the difference between these two notions?
Comment: try me, I know Russian, and formulas are the same for all languages.
Comment: unobserved heterogeneity can have different interpretations (google does not give a unique definition for example), can you please cite some reference, or give the precise definition you want to be explained.
Comment: @mpiktas: I'm analyzing the problem of omitted variables in a regression. The omitting of variables is causes problems with consistency of the estimator. There are a bunch of other problems that causes inconsisteny (simultaneaus causality and measurement errors for example). All these problems are known as Endogenity. But in this context you often hear the word unobserved heterogenity. And I'm not sure if this is a synonym for Endogenity? Sorry I can't give you more information, because I don't have any (References are in Polish, you  wouldn't understand :))
Answer: I agree with @Michael's description of endogeneity---this is about a problem with the variables that you include and their relationship to the variables that you do not (i.e., the stuff in the error term).
Unobserved heterogeneity is typically about unobservable componenents of the effects that you are estimating. Continuing with @Michael's education example, unobserved heterogeneity might be that some people have higher returns (e.g., increases in wages) from going to school than others. Let the returns for person $i$ be $\beta + b_i$ with $\mathbb{E}(b_i) = 0$. We have
$$\begin{equation*} y_i = x_i (\beta + b_i) + w^\prime_i \gamma + \epsilon_i, \end{equation*}$$
where $y_i$ is (typically, log) income, $x_i$ is years of education, and $w_i$ is a set of other controls. An example of endogeneity is when $x_i$ is correlated with $\epsilon_i$ (e.g., education is correlated with IQ, which is not among our other predictors).
If we estimate a single coefficient, we have
$$\begin{equation*} y_i = x_i \beta + w^\prime_i \gamma + (\epsilon_i + b x_i) = x_i \beta + w^\prime_i \gamma + \tilde{\epsilon}_i \end{equation*}$$
See that the included variable $x_i$ is correlated with the error term $\tilde{\epsilon}_i$, inducing the same problems as the case of endogeneity.
Answer: The terms endogeneity and unobserved heterogeneity often refer to the same thing but usage varies somewhat, even within economics, the discipline I most associate with the terms.
In a regression equation, an explanatory variable is endogenous if it is correlated with the error term.
Endogeneity is often described as having three sources: omitted variables, measurement error, and simultaneity.  Though it is often helpful to mention these "sources" separately, confusion sometimes arises because they are not truly distinct.  Imagine a regression predicting the effect of education on wages.  Perhaps our measure of education is simply the number of years someone spent in formal education, regardless of the type of education.  If I have a clear idea of what type of education affects wages, I might describe this situation as measurement error in the education variable.  Alternatively, I could describe the situation as an omitted variables problem (the variables indicating type of education).
Perhaps wages also affect education decisions.  If wages and education are measured at the same time this is an example of simultaneity, but it too, might be reframed in terms of omitted variables.
Unobserved heterogeneity is simply variation/differences among cases which are not measured.  If you understand endogeneity, I think you understand the implications of unobserved heterogeneity in a regression context.
Comment: I would also include autoregression with autocorrelated errors and sample selection as additional ways endogeneity can arise.
Comment: @DimitriyV.Masterov, Thanks for mentioning those concepts, I think they extend the point I was making.  Couldn't, for example, a given case of autoregression with autocorrelated errors or sample selection be reframed as a problem of omitted variables?  I know I'm not teaching you anything.  I just want learners to think about how these terms are related and realize that the same statistical issue can be conceptualized in many ways.
Answer: I understand heterogeneity to be any difference between individuals. Observed heterogeneity usually consists of the covariates and unobserved heterogeneity consists of any unobserved difference like ability or effort.
Endogeneity refers to the relationship between the observed and unobserved variables, namely that they are dependent on one another.
Answer: To wrap it up:

Unobserved heterogeneity is one possible cause of endogeneity.
Endogeneity is therefore the broader term.
Unobserved heterogeneity implies endogeneity but not the other way around.
Answer: the difference between the unobserved heterogeniety and endogeniety in the case of omitted variables lies in the orthogonality assumptions made. Whereas in the former, the assumption is that the unobserved omitted variable is independent of the observed (included) explanatory variable x,...in the latter this assumption is relaxed such that the unobserved (omitted) variable is correlated with some of the observed (included) explanatory variable.
Answer: Easy answer, without explanation because it is not wanted: if the omitted variables that cause endogeneity are not observable we call it unobserved heterogeneity. Easy :)