Is it recommended to memorize the Quran without understanding the words?

Question: Is there any hadith or Quranic ayat which encourages just memorizing Quran without understanding it? In our country Pakistan, it is a well established common thing to memorize Quran but those people don't understand even a single ayat and still think that they will be able to provide intercession for their family on the day of qiyamah. Please give references for both sides of this argument.
Answer: Asalmu Walaykum
It is recommended that you memorize, and understand the quran. According to this verse of the holy quran:
"(This is) a Book (the Qur'aan) which We have sent down to you, full of blessings, that they may ponder over its Verses, and that men of understanding may remember"
[Saad 38:29].
However, it is okay to memorize without understanding it. One who memorized the quran will have a crown over his head, and will have the reward, and one who understands and has Memorized the holy quran will get more reward. There is nothing wrong with memorizing without understanding it.


How did this question get 1500 views in one hour?

Question: I'm not sure I can phrase this other than as "why is my most popular question so popular?" but I am genuinely curious as to how I can get first the Popular Question badge and then, within an hour, the Notable Question badge for my question LaTeX3 versus pure Lua.  I remember checking after getting the first one; it had about 1045 views.  Now it has more than 2600 (which is in turn about 50 more than it has a few minutes ago when I got the badge).  Did it get linked somewhere?  Granted that it's a popular question; it's been relatively stable for most of the last week.
Answer: The question was posted to Hackernews, which can easily drive that kind of traffic if you make it to the frontpage.
Answer: At least two contributions:

Stefan Kottwitz received the gold Publicist badge ("Shared a link to a question that was visited by 1000 unique IP addresses") as a result of posting it (somewhere).
It was also tweeted to the Stack Exchange Twitter account.
Comment: Looks like Stefan is the "culprit"; the tweet is a week old.


Dynamic Regression on Time series with multiple and long seasonalities

Question: I'm currently working on a time series prediction model about calls incoming over one year with half hourly data. This time series has multiple and long seasonalities that I have identified. A daily one of 22, a weekly one of 152 (22 x 7) and a monthly one of 668.8 (22 x 30.4). I want also to include external regressors into the model as we have noticed that holidays and campaigns could have an effect on the total of calls.
Reading the literature, Dynamic Regression (A regression with ARMA errors) seems to be the perfect approach as it takes into account the complex seasonality (introduced by Fourier terms) and integrates the external regressors. But here, I'm a bit stuck on how to start..
My question is about stationarity. The literature emphasizes this as an important consideration that all the time series: Y and the different covariates are stationary.
I looked a my Y series and the ACF plot clearly shows that it is non stationary :

ACF PLOT of the time series Y
I ran the KPSS test that suggests differencing with a lag of 12 but the ACF plot after differencing still shows a non-stationary time series. I tried a seasonal difference of 152 (22*7) but still the same conclusion.
Do you have any idea on how I can make this time series stationary?
For the covariates, most of them are dummies (the event has occurred or not). Should we apply the same methodology applied for the time series Y? Even if it is already stationary?
On which Y series, Fourier terms should be calculated : on the stationary one or the original time series?
Thank you for your help,
kr,
Jérôme
Answer: As you mention, the time series you are analyzing is not stationary. Applying seasonal differences makes sense when considering stochastic seasonality (ARIMA approach). This is how it may take more than one difference to obtain a
stationary time series (daily/weekly/monthly/yearly differences). The other alternative, as you comment, is to use Dynamic Regression using Fourier coefficients to encode seasonality in a deterministic manner. Dummy variables would be considered one more exogenous variable in that setup. Finally, the Fourier terms are not calculated "on a series", but rather, with respect to the period you want to encode with them (one day, one week, one year, etc.)


Is it possible to store stone in a more efficient manner?

Question: As you can see it is getting a bit out of hand and taking up a lot of space using raw Stockpiles.
Comment: Someone should add a minecart un-dump to this as an answer
Answer: Designate a garbage dump zone using the i command and using d to designate the zone as a garbage dump. Your haulers will now dump any stone designated as garbage there. If you want to stone back in rotation, just unforbid the stone. For ease of unforbidding it is best to just use one square as a garbage dump zone.
Any item that is marked as garbage/to be dumped is hauled by a hauler to a garbage zone, and then marked as forbidden.
You can designate a mass area as stuff to be dumped, use d, go to item properties b and select d any squares you now designate containing items, will mark those items to be dumped. (Use the same commands but D to mass undump items, or c to claim/unforbid).
This trick is called a quantum stockpile. Some consider it to be an exploit.
From the wiki there are also these two tricks:

A similar effect may be achieved by building a wall two tiles in front of a catapult and digging a channel between the wall and catapult. By firing the catapult at the wall, the stone falls into the trench. The stone will pile up in the channel, putting it out of sight and out of mind. Not only does this train siege operators, but it clears the stone that your legendary miners leave.
Another way to quantum stockpile is to not have appropriate stockpiles to move items back you moved to the trading depot. The depot can hold an infinite number of items, and those items will not be removed if there is nowhere else to place them. This is also useful for anything you want to trade anyway.
Comment: The guide on the wiki strongly recommends only using 1 square for the garbage dump, since it makes unforbidding things much easier.
Comment: I think you missed a step: A garbage zone designated around a pit will make the person dumping the item throw it down the pit.  So a 3X3 garbage zone with a hole in the middle will throw it all down the pit.
Comment: Dwarves will happily use a single tile garbage zone without needing a pit. It's filling ponds that they're not interested in doing at foot level.
Comment: The pit is not needed. It is possible, but just designating a garbage zone is enough. (I actually had problems with multi level garbage pits. Dwarfs dumping stuff in while another was picking stuff up).

I'll edit my answer.
Comment: I'm pretty sure the pit is needed to make the dwarves stack things onto the same tile; without it, the zone gets filled up, and they'll stop hauling stuff to it.  With the pit, dwarf hauls object, drops it down pit.  Zone does not fill up.
Comment: Well, I played a while back, so I just checked my save game. I had a garbage pile of six squares with only two used filled with a lot of rocks and other large stuff.
Answer: Another way, if you're mostly planning to use this stone for constructions, is to order it carved into blocks at a mason's workshop. Each boulder creates four blocks, each of which can be used in place of a raw stone when building things (so you get 4x as many things out of it as well). This is also a good way to train up beginning masons, since their skill affects only the speed of the job (and it's a pretty fast job anyway). I usually build a special mason's shop for this near the quarry, with its work queue filled by "make blocks" orders on repeat so that my manager doesn't give it orders for anything important, and I set it to "beginners only" so that my master masons don't waste their time.
Blocks can be stacked to 10 in bins in a stockpile, cutting down the space you need by 60% (assuming you have plenty of bins). In addition, buildings and constructions made from blocks are somewhat more valuable than those made from raw stone, and are built faster.
The disadvantage is that blocks cannot be used for anything other than constructions and buildings: furniture and crafts require raw stones. So be careful not to block up all your stones if your economy relies on stonecrafting. Smelting pig iron and steel also requires raw flux stones, but in this case they should be safe from being grabbed up by an overzealous mason because economic stones are normally ineligible (I recommend manually setting kaolinite to economic as well if you want a porcelain industry).
Comment: Thanks that is also a great way of getting rid of the stone that I didn't think about. A bit different method than the stockpile method, but at least it reduces storage space. (At the cost of hauler jobs, but that is why I dedicate haulers). Just making mugs out of them should also work.
Comment: @Ids Sure, if you're just trying to get rid of the stones. The advantage of blocking is that it makes the stones even more useful for 80% of the stuff you need stone for (because you get 4 instead of 1). Mugs, as we all know, are useless crap, only good for selling to the caravan and making Goblin Christmas come more often.
Answer: You can quantum stockpile without the need to manually designate dumping and reclaiming, and you can do it in such a way that allows you to have multiple quantum stockpiles with specific contents. Having multiple garbage dumps will result in dwarves using the closest for everything. Cart-powered quantum stockpiling lets you retain all the benefits of the custom stockpile settings.
To do this, you need a minecart track with a maximum-friction track stop built on it. A feeder stockpile is built nearby which accepts the materials you wish to stockpile, and a single-tiled stockpile which accepts the same things is built next to the track.
One benefit for this method is that dwarves can use wheelbarrows to haul stone or other heavy objects to the feeder stockpile. They only have to carry the objects between the feeder and the track stop.
By setting up a hauling route with this stop, dwarves can be told to fill the cart from the feeder stockpile and then give the cart a push, which dumps the contents onto the quantum stockpile. You can have a stop for each different kind of quantum stockpile you like! It works great for stones, furniture, etc - pretty much anything that isn't stored in a container.
For more detailed instructions, see dbay's post on bay12.
Comment: No minecart track is needed. Just have the Track Stop dump everything to the tile of quantum stockpile that is right next to it. This way, items that are put into the minecart will immediately get quantum dumped. The minecart doesn't even need to be pushed.
One thing your answer does not mention, is that you'll have to define a hauling route, with a hauling stop that superimposes onto the track stop. Assign a vehicle to it. Set the appropriate items that the minecart will accept. Select the feeder stockpile from which this hauling stop will take items.


video embed field module folder path

Question: I have placed the video embed field module in the location sites/all/modules/contrib/video embed field. Now I have problem with generating youtube thumbnail.Is that path I uploadwed the module is correct or need to change the module to some where
Answer: Yes, you've uploaded the module to the correct location (otherwise you wouldn't have been able to install it).
Failure to generate thumbnails could theoretically be caused by a number of different configuration problems, but the most common would probably be either:

incorrect permissions on sites/default/files (or a subfolder)
something blocking the outgoing request to download the thumbnail from YouTube's servers.

Check your server logs and Drupal's watchdog for errors, if there are none you'll probably need to step through the code to find out exactly where and why it's failing.
Comment: how to set permission to the folder
Comment: Depends on what you need. Use https://drupal.stackexchange.com/questions/373/what-are-the-recommended-directory-permissions as a guide, but unless you're sure you know what you're doing get a sysadmin to help you

video embed field module folder path


Examples of "transfer via bijection"

Question: On some occasions I have seen the following situation: We want find out whether a set of a given cardinality $\varkappa$ has some property P. If this property is invariant under bijective maps, then it doesn't matter which set of cardinality $\varkappa$ we choose. But sometimes choosing a set which has some additional structure might make proving/disproving whether the set has this property.
I am posting some examples of this method as answers below - I hope they help to clarify what I have in mind.
Do you know of some other interesting examples?
Answer: Suppose that $|A|=\aleph_0$. We are asking whether there exists a chain in $(\mathcal P(A),\subseteq)$ that has cardinality $\mathfrak c$.
Clearly this property is invariant under bijections.
If we take $A=\mathbb Q$ and
$$A_r=(r,\infty)\cap\mathbb Q$$
for any real number $r\in\mathbb R$, then $\{A_r; r\in\mathbb R\}$ is a chain of cardinality $|\mathbb R|=\mathfrak c$.
This proof have appeared in an answer here.
Answer: This is another classical example: A nonempty family $\mathcal I$ of subsets of $\omega$ is independent iff for any pairwise distinct $A_1,\dots,A_k,B_1,\dots,B_l$ in $\mathcal I$, we have that
 $$ \bigcap_{i=1}^k A_i\cap\bigcap_{j=1}^l(\omega\setminus B_j) $$
is infinite. The question of whether there is an independent family of size continuum is clearly invariant under replacement of $\omega$ with any other infinite countable set $X$.
For example, we can take $X=\{(a,A)\mid a\subseteq{\mathbb N}$ is finite, and $A\subseteq{\mathcal P}(a)\}$.
Given $S\subseteq{\mathbb N}$, let $t_S=\{(a,A)\in X\mid a\cap S\in A\}$. The claim is that ${\mathcal I}=\{t_S\mid S\subseteq{\mathbb N}\}$ is as wanted.
For this, first note that $S\mapsto t_S$ is injective.
Now, suppose $X_1,\dots,X_n,Y_1,\dots,Y_m$ are infinite, pairwise distinct, subsets of ${\mathbb N}$. Write $A=t_{X_1}\cap\dots\cap t_{X_n}\cap(X\setminus t_{Y_1})\cap\dots\cap(X\setminus t_{Y_m})$. For each $i,j$ with $1\le i\le n$ and $1\le j\le m$, let $\alpha_{ij}\in X_i\triangle Y_j$. One easily shows that for any finite $F\supseteq\{\alpha_{ij}\mid 1\le i\le n,1\le j\le m\}$ there is an ${
\mathcal F}$ such that $(F,{\mathcal F})\in A.$ This proves the result.
Comment: Several proofs of existence of such independent families are collected in Stefan Geschke: [Almost disjoint and independent families](http://www.hcm.uni-bonn.de/fileadmin/geschke/papers/IndependentFamilies_03.pdf). He says there that this proof is due to Felix Hausdoff.
Comment: Thanks for the reference, Martin!
Answer: Suppose that $|A|=\aleph_0$. We are asking whether there exists an almost disjoint system of infinite subsets of the set $A$, which has cardinality $\mathfrak c$. Recall that a system $\mathcal S$ is called almost disjoint if $A\cap B$ is finite for any two sets $A,B\in\mathcal S$ such that $A\ne B$.
Clearly this property is invariant under bijections.
If we take $A=\mathbb Q$ and we take for every real number $r$ a sequence $(q_n)_{n\in\mathbb N}$ of rationals, which converges to $r$, then the system of sets of the form
$$A_r=\{q_n; n\in\mathbb N\}$$
for every $r\in\mathbb R$ give as an almost disjoint family of cardinality $|\mathbb R|=\mathfrak c$.
Such almost disjoint systems appeared in several other questions at MSE, for example here and here.
Answer: The partition calculus is a generalization of Ramsey theory to the transfinite. In its basic setting, we ask, given ordinals $\alpha,\beta,\gamma$, whether
 $$ \gamma\to(\alpha,\beta)^2, $$
meaning that if the edges of the complete graph on $\gamma$ vertices, $K_\gamma$, are colored red and blue, then either there is a red copy of $K_\alpha$ (that is, a subset of $\gamma$ of order type $\alpha$, any edge between two of its vertices being red), or a blue copy of $K_\beta$.
To investigate partition relations satisfied by ordinals of the form $\omega^\alpha$ for $\alpha$ countable (where the exponentiation is in the ordinal sense), in many cases it is convenient to work not with $\omega^\alpha$ directly, but rather with some other set that can be ("naturally") ordered in type $\omega^\alpha$. For example, for $n<\omega$, we typically work with
 $$ W(n)=\{(m_0,m_1,\dots,m_{n-1})\in\mathbb N^n\mid m_0<m_1<\dots<m_{n-1}\}, $$
ordered lexicographically. Of course, we could replace $W(n)$ with the set of subsets of $\mathbb N$ of size $n$. Notationally, $W(n)$ is more convenient on occasion.
To see how this is used, I indicate here rather briefly how Haddad and Sabbagh proved that $\omega^2\to(\omega^2,n)^2$ for all $n<\omega$, a result first due to Specker.
We consider a partition of $[W(2)]^2$ into two pieces, $A_0$ and $A_1$ ($A_0$ corresponds to red, and $A_1$ to blue). Use this to partition $[\omega]^4$ into 16 pieces $B_{ijkl}$ where $i,j,k,l\in\{0,1\}$: Given $\{a,b,c,d\}\in[\omega]^4$, with $a<b<c<d$, we put $\{a,b,c,d\}\in B_{ijkl}$ iff

$\{(a,b),(c,d)\}\in A_i$,
$\{(a,c),(b,d)\}\in A_j$,
$\{(a,d),(b,c)\}\in A_k$, and
$\{(a,b),(a,c)\}\in A_l$.

We now invoke Ramsey's theorem to conclude that there is an infinite $H\subset\omega$ such that all tuples in $[H]^4$ are in the same $B_{ijkl}$. Quickly checking the possibilities for $i,j,k,l$ gives us a monochromatic $I\subset W(2)$ as required: If one of $i,j,k,l$ is $1$, one easily gets $I$ of any finite size we want with $[I]^2$ all blue. If $i,j,k,l$ are all $0$, then we can write $H$ as $\bigcup_n H_n$ where the $H_n$ are infinite and pairwise disjoint, and let $I=\{(x,y)\mid x\in H_0$ and $y\in H_{x+1}$ and $x<y\}$. Then $I$ has type $\omega^2$ as $[I]^2$ is all red.
More sophisticated applications of this idea of conveniently representing $\omega^n$ or $\omega^\omega$ or other indecomposable ordinals can be seen in the work of Jean Larson. See for example Part I of these slides.
Comment: Section 7.2 of "Combinatorial set theory", by Williams, contains additional details of this argument.
Comment: In the late 60s, Haddad and Sabbagh announced a series of results on the computation of Ramsey numbers $R(\alpha,n)$ for finite $n$ and $\alpha$ countable. None of the details of their arguments were ever published (and most remain unpublished today), with the exception of their short new proof of Specker's theorem.
Answer: A particularly nice use of this "transfer" idea can be seen in the following proof of the $\Delta$-system lemma. I first saw this in Shelah's book on Proper forcing. Assaf Rinot recently posted the argument on his (highly recommended) blog.
A version of the lemma states that if $\kappa$ is a regular uncountable cardinal, and $\mathcal A$ is a family of finite sets, with $|\mathcal A|=\kappa$, then we can find a subfamily $\mathcal B\subseteq\mathcal A$, again with $|\mathcal B|=\kappa$, that forms a $\Delta$-system, that is there is a fixed finite set $r$ such that whenever $a\ne b$ are in $\mathcal B$, then $a\cap b=r$.
To prove this, we note that we may as well assume that $\mathcal A\subseteq[\kappa]^{<\omega}$ (this is the "transfer" part). Since $\kappa$ has uncountable cofinality, we may in fact assume that $\mathcal A\subseteq[\kappa]^n$ for some fixed $n$. We then proceed by induction on $n$. The result is clear if $n=1$. Assuming the result for $n$, and that $\mathcal A\subseteq[\kappa]^{n+1}$, we ask whether for some $\gamma$ there are $\kappa$ elements $a\in\mathcal A$ such that $\gamma=\min(a)$.
If yes, we can replace $\mathcal A$ with $$ \mathcal A'=\{a\setminus\{\gamma\}\mid a\in\mathcal A\mbox{ and }\min(a)=\gamma\}, $$ and use the inductive assumption to conclude.
If not, then we proceed recursively (using that $\kappa$ is regular): We enumerate $\mathcal A=\{a_\alpha\mid \alpha<\kappa\}$. Given any $\gamma$, there are fewer than $\kappa$ values of $\alpha$ such that $\gamma\in a_\alpha$: Else, there are $\kappa$ members of $\mathcal A$ whose minimum is at most $\gamma$, and by regularity we can fix $\kappa$ with the same minimum. But then we can start with $\alpha_0=0$, find $\alpha_1$ such that $a_0\cap a_\beta=\emptyset$ for $\beta\ge\alpha_1$, then find $\alpha_2>\alpha_1$ such that $a_{\alpha_1}\cap a_\beta=\emptyset$ for $\beta\ge\alpha_2$, etc. The sets $\{a_{\alpha_i}\mid i<\kappa\}$ are pairwise disjoint.
Comment: The $\Delta$-system lemma is also called the *sunflower lemma*, especially when considering its finite versions. I'll use this answer as an excuse to draw attention to this MO question: http://mathoverflow.net/questions/115069/the-state-of-art-of-the-sunflower-lemma
Answer: Here is another example I like. It requires a mild understanding of forcing: One can prove abstractly that if a partial order is countable, and any condition can be extended in two incompatible ways, then the partial order is forcing isomorphic to Cohen's forcing. (This means that there is an isomorphism between the Boolean completions of the two posets.)
Conditions in this poset are finite functions $f$ whose domain is a (finite) subset of $\omega$ and whose range is $\{0,1\}$. A condition $p$ extends a condition $q$ iff, as functions, $p$ extends $q$, that is, $p\supseteq q$.
This forcing adds a subset of $\omega$ (a Cohen real). One of its many nice properties is that forcing with this poset makes the ground model reals have measure $0$.
One nice way of proving this consists of considering, for each $\epsilon$, the poset $C_\epsilon$ whose conditions are finite unions of rational intervals, whose total length is less than $\epsilon$. A condition $p$ extends a condition $q$ iff it extends it as a set of reals. Note that $C_\epsilon$ is countable, and any condition can be extended in two incompatible ways: Given $p$, we can find extensions $p_1$ and $p_2$ such that the total length of the intervals making up $p_1\cup p_2$ is $\epsilon$ or larger. This means, because of the abstract result mentioned above, that $C_\epsilon$ is Cohen forcing in disguise. (This is the "transfer".)
Now, forcing with $C_\epsilon$ gives us an open set $I_\epsilon$ whose measure is at most $\epsilon$, and such that any ground model real is in $I_\epsilon$. This shows that forcing with Cohen forcing makes the ground model reals have outer measure at most $\epsilon$. Since $\epsilon$ was arbitrary, we are done.
Comment: I mentioned this example here: http://mathoverflow.net/questions/46757/a-problem-about-posets-similar-to-suslins-problem
Comment: For a stronger result: http://mathoverflow.net/questions/63497/cohen-reals-and-strong-measure-zero-sets
Answer: This is perhaps not as nice as other answers given here, but it still might be a nice exercise for students in the first course where they learn about cardinalities. I have seen this exercise in some introductory textbook on set theory. (It was the book T. Šalát a J. Smítal. Teória množín, which is written in Slovak language. But it is very probable that the same exercise appears in many different books, too.)
EDIT: Now I found the same exercise as Problem 6.34 in Schaum's Outline of Set Theory and Related Topics by Seymour Lipschutz (Google Books link).

Question: Show that the set $\mathbb Q\times\mathbb Q$ can be written as $V\cup H$, where the set $V$ has the property that all vertical section $V\cap\{x\}\times\mathbb Q$  are finite, and the set $H$ has the property that all horizontal sections $H\cap \mathbb Q\times\{y\}$ are finite.
Solution. For any bijection $f \colon \mathbb Q\to\mathbb N$ we have bijection $f\times f \colon \mathbb Q\times\mathbb Q \to \mathbb N\times\mathbb N$ given by $f(q_1,q_2)=(f(q_1),f(q_2))$. This bijection preserves vertical and horizontal lines. So in fact this bijection transforms the problem to the set $\mathbb N\times\mathbb N$.
Solving the same problem for $\mathbb N\times\mathbb N$ is easy; just take $V=\{(x,y)\in\mathbb N\times\mathbb N; y\le x\}$ and $H=\{(x,y)\in\mathbb N\times\mathbb N, y>x\}$. $\mathbb \qquad\square$
(If we look back to the original problem, which asks about $\mathbb Q\times\mathbb Q$, the fact that this set can be decomposed in such way might seem a little surprising at first.)
Answer: This is a very trivial example which also has easy solutions not invoking the idea of transfer via bijection, but I will include it anyway.
We want to show that the set $\mathbb N$ can be decomposed into infinitely many infinite sets. We take any bijection $f\colon \mathbb N \times \mathbb N \to \mathbb N$ and then the sets $f[\mathbb N\times\{i\}]$ for $i\in\mathbb N$ yield the required decomposition.
There have been several questions at MSE about this problem:

Partition of N into infinite number of infinite disjoint sets?
Partitioning an infinite set
How to Decompose $\mathbb{N}$ like this?

Examples of "transfer via bijection"


How many hours / school years does it take for the average child to memorize the $10\times 10$ addition and multiplication tables?

Question:
How many hours does it take for the average child to memorize the $10\times 10$ addition table?
How many school years does it take for the average child to memorize the $10 \times 10$ addition table?
How many hours does it take for the average child to memorize the $10\times 10$ multiplication table?
How many school years does it take for the average child to memorize the $10 \times 10$ multiplication table?
Comment: I don't recall ever having to memorize the *addition* table. Perhaps we were supposed to memorize it, I don't know (and I don't know how it could have been tested), but I'm pretty sure I only knew a handful of them and did others using "ticks" I discovered on my own, such as adding 9 is adding 10 and subtracting 1, adding 8 is adding 10 and subtracting 2, adding 4 and 7 is "3 and 7 and one more", etc. And this was before calculators appeared  schools, so it's not as if I didn't do a lot of non-calculator calculations (indeed, I did a huge amount on my own, playing around with numbers).
Comment: Welcome to ME.SE. Are you interested in children or adults, and a setting where they only try to memorize the table, or a usual school setting where there is usually more they are trying to learn?
Comment: I'm interested in the *memorize* component of this question. [Wolfram|Alpha suggests](https://www.wolframalpha.com/input/?i=6%2B7), for instance, that the average "computing time" for $6+7$ is age-dependent, ranging from $6.3$ seconds at age $6$ to $1$ second at age $18$. What true memorization is in this context may vary by individual or age group, and certainly would by how it is measured.
Comment: @Tommi Brander: I am interested in children only because people memorize the tables when they are children. The "how many school years" questions imply "a usual school setting where there is usually more they are trying to learn". The "how many hours" questions imply only taking into account the moments "where they only try to memorize the table" not taking into account the moments where they do other stuff like learn division or learn history and geography.
Comment: I'll put this "answer" as a comment. It's not based on any real data, but is what I imagine to likely be true (and it might be entirely wrong). But no one else has answered any of the questions, so... To answer the question: for $10\times 10 $ multiplication table... anywhere between $20$ hours and $200$ hours, spread out over the course of $1$ to $5$ years of regular "drilling", which should really be a combination of instant recall, finding shortcuts, and speed training. Probably, "hours spent" is inversely correlated with "general aptitude/ability at maths".
Answer: When/where I grew up in California, ordinary second-graders (7 - 8 year-olds) were expected to learn the times tables well enough to answer randomly chosen problems without writing anything down or looking anything up; but 100 percent accuracy was more of a hope than an expectation.  Flashcards, mental shortcuts, and other memorization aids were used.
By the end of fourth grade (10 year-olds), above-average students were expected to be able to see, recognize, and write down the correct answer to randomly chosen times table problems in 2 - 3 seconds with 97 - 100 percent accuracy.  The problems were randomly chosen between 0 x 0 and 12 x 12.
Answer: Assuming that the German "Kerncurriculum" (actually, there are 16 of them, one for each federal state. I'm referring to the one from Lower Saxony) for primary school is at least somewhat tailored for the "average person": at most two years, because at the end of second grade, pupils are supposed to

state the addition table (up to 10) and confidently derive the inverse operations

and

state the multiplication table (up to 10), confidently derive the inverse operations  and the results of further problems.

While I have no idea what the last part ("further problems") is supposed to mean, the additions "derive inverse operations" is a hint that the tables should be thoroughly memorized by the end of second grade. Because I think that the memorization does not start straightaway from day one, less than two years is a reasonable estimate.
Sources for the translated expectations:

Die Schülerinnen und Schüler geben die Zahlensätze des kleinen 1 + 1 automatisiert wieder und leiten deren Umkehrungen sicher ab.
Die Schülerinnen und Schüler geben die Kernaufgaben des kleinen 1 x 1 automatisiert wieder und leiten deren Umkehrungen und die Ergebnisse weiterer Aufgaben ab.

Kerncurriculum für die Grundschule, Mathematik, Niedersachsen, 2006.


Changing order of sum

Question: We know that
$$\sum_{n=1}^{\infty}a_n = \mbox{convergent}$$
Does that imply that
$$a_3 + a_1 + a_2 + a_6 + a_4 + a_5 + \cdots = \mbox{convergent?}$$
We don't know whether our series is absolutely convergent.
Comment: Little "local" changes of order make no difference. From the fact that partial sums of the $a_i$ converge, one can show that the modified partial sums converge to the same value.
Comment: To be clear: the pattern is $3,1,2,\;6,4,5,\;9,7,8,\dots$ and so on, right?
Comment: Yes, the permutation has bounded displacements, see this previous question http://math.stackexchange.com/questions/1150964/prove-that-the-series-still-converges-under-a-permutation
Comment: Hey I have a question, why is that series convergent? Doesn't it add up to infinity?
Answer: Given that
$$\sum_{k=1}^{\infty} a_k=\mbox{convergent}$$
We have
$$a_3 + a_1 + a_2 + a_6 + a_4 + a_5 + \cdots$$
$$=\sum_{k=1}^{\infty} \left(a_{3k} +a_{3k-2}+a_{3k-1}\right)$$
$$=\sum_{k=1}^{\infty} \left(a_{3k-2}+a_{3k-1}+a_{3k}\right)$$
$$=a_1 + a_2 + a_3 + a_4 + a_5 + a_6+\cdots$$
$$=\sum_{k=1}^{\infty} a_k =\mbox{convergent}$$
Answer: Let $S_n$ be the nth partial sum of the original series, and let $T_n$ be the nth partial sum of the new series.
Since the original series converges, $S_n\to S$ for some number $S$.
Since $T_{3n}=S_{3n}, \;T_{3n+1}=S_{3n}+a_{3n+3},\; T_{3n+2}=S_{3n}+a_{3n+3}+a_{3n+1}$, and $a_n\to 0$,
$T_n\to S$ so the new series converges to the same sum.
Answer: Yes, your sum necessarily converges.
Let $b_n$ denote the $n$th element of your sequence (so for example $b_1 = a_3$).
Let $S_N = \sum_{n=1}^N a_n$ and $T_N = \sum_{n=1}^N b_n$.
We note that $T_{3N} = S_{3N}$.  So, if $T_N$ converges, it converges to the same limit as $S_N$.
Moreover, $T_{3N+2} = T_{3N} + b_{3N+1} + b_{3N+2}$.  However, we note that $b_n \to 0$ by the convergence of the original sum.  So, for any $\epsilon > 0$, we can select $N_0$ so that $b_N < \epsilon$ when $N > N_0$.  So, we have
$$
|T_{3N + 2} - T_{3N}| = |b_{3N+1} + b_{3N+2}| < 2 \epsilon
$$
this is enough to conclude that $T_N$ is Cauchy, and thus convergent.
Answer: Little "local" changes of order make no difference.
From the fact that partial sums of the $a_i$ converge, say to $s$, one can show that the modified partial sums converge to $s$. Let $(b_n)$ be our modified sequence. Then $\sum_1^{3k} a_i =\sum_1^{3k}b_i$, and both have limit $s$.
Since the $a_i$ have limit $0$, we have that $\lim \sum_1^{3k+1} b_i$ and
$\lim \sum_1^{3k+2} b_i$ are also equal to $s$.

Changing order of sum


Implementing powerups for my Breakout clone

Question: I'm making a simple Breakout clone in Python that will have very many powerups/powerdowns (so far I came up with 26). Some will affect the paddle (paddle missile, two paddles, short paddle, etc.), some will affect the ball (slow ball, destructo-ball, invisible ball, etc.), some will affect the bricks (brick scramble, move up, bricks indestructible, etc.), and some will affect other game aspects (extra life, more points, less points, etc.). I'm pretty sure I have the code to draw the falling powerups and test for collisions with the paddle down, but I'm confused about how to code the effects of the powerups. Since there are very many powerups, it seemed inefficient to add specific methods to each component as done in this tutorial. However, I can't think of an other ways to implement the powerups. I found a page that hints at some way to design powerup behavior using classes, but I'm at a loss for how to do that. (A short example would help.) Please give me a short code example of another way to implement the effects of the powerups.
Comment: possible duplicate of [Implementing Power-Ups in a game](http://gamedev.stackexchange.com/questions/24149/implementing-power-ups-in-a-game)
Comment: The answer for that one seems to be to put modifiers in every class that is affected by the powerup. (The link to the other answer is broken :( ) That is the same solution as the tutorial I linked to. Is that the only way to do it?
Comment: Eva, I've posted an answer that *might* help. It's my interpretation of the accepted answer on the question I linked. Additionally, I didn't have any problems with the link in the other answer. Perhaps try again?
Answer: I think this question should still be closed and I'm just using this space to better explain the answer found here. Sorry, I haven't used Python in years, and only used it a little bit so this answer is not Python oriented at all.
With your paddle class, you would have something like this (which you probably already have):
Paddle {
    private int paddleWidth;

    public void setPaddleWidth(int aWidth) {
        paddleWidth = aWidth;
    }
    public int getPaddleWidth() { return paddleWidth;}

}

Then as an example powerup, you'd have something like:
PaddlePowerup implements Powerup {
    PowerupType type
    EffectType effect;

    public static void pickedUp(Paddle targetPaddle) {
        switch(effect) {
            case PowerupType.GROW:
                 targetPaddle.setPaddleWidth(targetPaddle.paddleWidth() * 2);
                 break;
            case PowerupType.SHRINK:
                 targetPaddle.setPaddleWidth(targetPaddle.paddleWidth() * 0.5f);
                 break;
            case PowerupType.INVISIBLE:
                 targetPaddle.setVisible(false);
                 break;
            ...
        }
    }
    public static void pickedUp(Ball targetBall) {
        switch(effect) {
            case PowerupType.INVISIBLE:
                 targetBall.setVisible(false);
                 break;
            case PowerupType.SLOW:
                 targetBall.setSpeed(targetBall.getSpeed() * 0.5f);
                 break;
            ...
        }
    }
}

The other answer doesn't go into how to do different power ups for different objects, like the ball, bricks or global parameters.
So when your paddle picks up a power up you could call something like this in your main game code (somewhere that has access to all your objects):
public void triggerPickup(Powerup powerup) {
    switch(powerup.type) {
        case PowerUpType.PaddlePowerup:
             pickedUp(playerPaddle);
        case PowerUpType.BallPowerup:
             pickedUp(playerBall);
        ...
    }
}

Comment: That makes more sense. Thanks for the explanation.
Comment: Why not pass the paddle as a parameter to the powerup, and use the fact that they all implement an interface to make them each handle their own effects? That way you could throw out the ugly case statement, and it would be very easy to add in more powerups and effects.
Comment: @SomeGuy I think that would work just fine. However, the paddle is not the only thing that can be affected. Additionally, I wasn't sure how or if interfaces worked in Python, so I didn't want to rely on an interface.
Comment: @Byte56 Now that you mentioned it, I don't think interfaces are standard in Python. Guess I just got used to PEAK...


Best way to organize book-page structure

Question: I'm wondering what is the best way to organize book-page content without involving taxonomies. So for example, I have a math book with a bunch of problems that I wish to list. I have a custom post type qa which can include a taxonomy <book-name>, and I want the URL to be: <domain>/qa/<book-name>/<page-number>/<problem-number>. So creating such a structure isn't a big deal except the <page-number> - there will be lots of pages, and I think that it is not practical to create so many taxonomies. So what will be the optimal implementation? I'd appreciate any suggestions.
Answer: I don't know if this is the optimal, it's one suggestion.
For me I'd created the qa post type as hierachical.
Then for every page in the book I'd created a child qa post using menu_order field to handle the page number.
This child has a 3rd level child for problems.
Hooking intro pre_get_posts for qa archive, you can set the post_parent to 0, so in the archive view you get only books, and not the big list of pages and problems.
Last thing to is create a rewrite rule that convert the url into some query vars.
E.g.
<domain>/qa/<book-name>/<page-number>/<problem-number> should be rewritten in
 <domain>/index.php?name=<book-name>&post_type=qa&number=<page-number>&problem=<problem-number>

That url will end in a very simple query where post id = <problem-number>.
Example code:
function my_book_rules() {
  add_rewrite_rule( 'qa/([^/]+)/([0-9]+)/([0-9]+)$', 'index.php?&post_type=qa&name=$matches[1]&number=$matches[2]&problem=$matches[3]', 'top' );
  add_rewrite_rule( 'qa/([^/]+)/([0-9]+)$', 'index.php?&post_type=qa&name=$matches[1]&number=$matches[2]', 'top');
}
add_action('init', 'my_book_rules');

function my_book_query_vars($vars) {
  $vars[] = 'problem';
  $vars[] = 'number';
  return $vars;
}

add_filter('query_vars', 'my_book_query_vars');

function my_book_query( $query ) {
  if ( is_admin() || ! is_main_query() ) return;
  if ( is_archive() && $query->get('post_type') == 'qa') {
     $query->set('post_parent', 0);
  } elseif ( is_single() && get_post_type() == 'qa') {
    $post = get_queried_object();
    if ( $post->post_parent == 0 && $query->get('number') && ! $query->get('problem') ) {
      // a page number is requested
      $query->set('name', '');
      global $wpdb;
      $n = intval($query->get('number'));
      $p = (int) $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'qa' AND post_parent = $post->ID AND menu_order = $n");
      $query->set('p', $n);
    } elseif( $query->get('problem') ) {
      // a problem is required
      $query->set('name', '');
      $n = intval($query->get('problem'));
      $query->set('p', $n);
    }
  }
}
add_action('pre_get_posts', 'my_book_query');

In the single view template single-qa.php you can load sub tempalte for books, pages or problems, something like:
if ( $post->post_parent == 0 ) {
   get_template_part('book', 'content');
} else {
  $parent = get_post( $post->post_parent );
  if ( $parent->post_parent == 0 ) {
    get_template_part('page-number', 'content');
  } else {
    get_template_part('problem', 'content');
  }
}

Another snippet is for display the book title and the page number inside the problem template (problem-content.php according to previous snippet),
$thepage = get_post( $post->post_parent);
$pagenumber = $thepage->menu_order
$the_book = get_post( $thepage->post_parent )->post_title

echo "The problem " . get_the_title() .
  " is in the book " . $the_book->post_title .
  " at the page number " . $pagenumber;

Note that the code is a proof of concept and untested.
Comment: Thank you sir. I've got the idea. I'm new to WP and I want to ask you what does the `$query->set('p', $foo);` mean?  I've chosen to modify the architecture a bit, introducing new table which will hold data about books. Can I create my own query in `my_book_query` such that the fetched items will be available at `single-qa.php`? Because WP supplies methods such as `the_title()` and `the_content()` in `single.php`, but can I affect the way these methods work without hardcoding the core files? Can it be done in the `my_book_query` method?
Comment: I'm asking this because I have to execute a certain queries for my new tables in the db (so I don't have to create this nested structure you've suggested). I just want to execute different query for each option: if it is `qa/` then I'll fetch on my own the pages and I would like to pass the result to `single-qa.php`. If it is `qa//` I would like to execute a different query, fetching all the problems and sending it, again, to `single-qa.php`. So can I update somehow the object that operates the whole `single-qa.php` thing? Thanks.
Comment: I guess I could fetch the book name or book page in `single-qa.php` using `$_SERVER['REQUEST_URI'];` and then execute queries for different conditions, but I know that WP has already executed its own queries and there's some data in methods like `the_title()` and `the_content()`, so I want to avoid making unnecessary queries. That is why I want to affect the way WP fetches the object that operates `single-qa.php`. I hope that I explained myself better. Thank you in advance!
Comment: `the_title()` and other template tags use `global $post` variable to work. If you use your custom table to store data, you need extra code to make it works. It's hard to explain here in a comment, expecially without knowing how you have structured your table. The built-in query runned by wordpress known as 'main query', can be edited before it run using 'pre_get_posts' hook. My function does that, and `query->set` is the way to change the WP main query. If you work with your custom table you have to create your custom query and `query->set` will be un-useful for you, I think. @somebody


Can Legilimency detect invisibility?

Question: Just like the question indicates — can Legilimency detect invisibility or camouflage? We know that Legilimency detects someone's thoughts. So, if a Legilimens were to look into the eyes of an invisible or camouflaged person and perform Legilimency, would the Legilimens be able to know where the invisible or camouflaged person is?
Answer: Legilimency seems unable to find the invisible.
Though it is never explicitly stated that Legilimency cannot detect the location of someone invisible, from what is shown in the books, it can be reasoned that it likely is not possible. Snape, a known Legilimens, searches for Harry in his Invisibility Cloak solely by feeling around for him. If he could have used Legilimency to find Harry, he presumably would have known this, done it, and succeeded. He knew he was looking for Harry, so he knew whose mind he was seeking, and Harry was indeed present. However, Snape instead attempts to physically find Harry by feeling around where Harry might be.

"Potter!' Snape snarled, and he actually turned his head and stared right at the place where Harry was, as though he could suddenly see him. 'That egg is Potter's egg. That piece of parchment belongs to Potter. I have seen it before, I recognise it! Potter is here! Potter, in his Invisibility Cloak!'
Snape stretched out his hands like a blind man, and began to move up the stairs; Harry could have sworn his overlarge nostrils were dilating, trying to sniff Harry out – trapped, Harry leant backwards, trying to avoid Snape's fingertips, but any moment now –
'There's nothing there, Snape!' barked Moody. 'But I'll be happy to tell the Headmaster how quickly your mind jumped to Harry Potter!" - Harry Potter and the Goblet of Fire, Chapter 25 (The Egg and the Eye)

Presumably if Legilimency would have worked, Snape would have attempted to use it to find Harry then - that he did not implies that this is likely not possible. Additionally, although Dumbledore could see Harry under the Invisibility Cloak at times, he did this using Homenum Revelio, not Legilimency, despite being a Legilimens.

Angela Morrissey: Why is it that albus dumbledore can see harry under his invisibility cloak at certain moments? (during the series is the cloak only infallible to those who do not own a deathly hallow).
J.K. Rowling: Dumbledore, who could perform magic without needing to say the incantation aloud, was using ˜homenum revelio' –
J.K. Rowling: the human-presence-revealing spell Hermione makes use of in Deathly Hallows. - J.K. Rowling Web Chat Transcript (July 30, 2007)

As he tells Harry, Dumbledore is indeed skilled at Legilimency. Yet, the times when he sees Harry under the Invisibility Cloak, it is through using Homenum Revelio.

"Yes, but it took a great deal of skilled Legilimency to coax it out of him,' said Dumbledore, 'and why should anybody delve further into Morfin's mind when he had already confessed to the crime? However, I was able to secure a visit to Morfin in the last weeks of his life, by which time I was attempting to discover as much as I could about Voldemort's past. I extracted this memory with difficulty." - Harry Potter and the Half-Blood Prince, Chapter 17 (A Sluggish Memory)

Since both Snape and Dumbledore are intelligent wizards skilled at Legilimency, both know that Harry has an Invisibility Cloak, and both have had reason to want to find Harry when he was invisible, it seems likely that at least one of them would have found Harry this way at some point. It seems highly unlikely that it would be successful but it simply never occurred to either of them to try - both Dumbledore and Snape are intelligent and logical thinkers.
Comment: I'd argue that Dumbledore would rather use a simple spell (like Homenum Revelio) than using an highly advanced spell (like Legilimens). And Snape might be capable of detecting (or at the very least sensing something amiss) Harry using Legilimency. After all, he started going upstairs right at where Harry was, until Moody stopped him.
Comment: But Harry's invisibilty cloak isnt the run of the mill one any muggle can buy from Poundland. May be Snape couldn't legilimense through it
Answer: It might be possible, you'd be able to detect someone who is invisible or camouflaged, if you're skilled enough in Legilimency and you happen to casually be casting Legilimens into nothing or someone else in the room.
While Severus Snape states in The Order of the Phoenix that "eye contact is often essential to Legilimency", that doesn't make it mandatory.

'Time and space matter in magic, Potter. Eye contact is often
  essential to Legilimency.'
Rowling, J.K.. Harry Potter and the Order of the Phoenix (pp.
  490-491). Pottermore Publishing. Edición de Kindle.

For instance, in Fantasic Beasts and Where to Find Them, Queenie Goldstein is capable of the mind of people without needing to watch them in the eye, and although she's naturally skilled in Legilimency, there's nothing hinting that a talented mage couldn't reach her skill by training.
Voldemort also seems to be capable of using Legilimency without making eye contact. For example:

'Do not lie to me!' hissed the second voice. 'I
  can always tell, Wormtail! You are regretting that you ever returned
  to me. I revolt you. I see you flinch when you look at me, feel you
  shudder when you touch me …'
Rowling, J.K.. Harry Potter and the Goblet of Fire (p. 8). Pottermore
  Publishing. Edición de Kindle.

It seems unlikely that Pettigrew is looking Voldemort in the eye in that scene, since he's a coward and Voldemort scolds him because he "flinchs when he looks at him". And yet, Voldemort could read Pettigrew's mind.
Comment: But surely Albus Dumbledore, the most powerful wizard of the twentieth century and very possibly in history, would have been up to Queenie's standards in Legilimency? Also, for Voldemort saying that he knows that Pettigrew is regretting that he has returned to him, I think he was judging on Pettigrew flinching every time he looked at Voldemort, or the fact that he was shuddering when he touched Voldemort. And even if it is true that Voldemort did read Pettigrew's mind, Voldemort says so himself that Pettigrew flinches when he looks at him, suggesting that Pettigrew did, at some point, look...
Comment: ...at Voldemort straight in the eyes.
Answer: To perform Legilimency you need eye contact.
How do you know where the eyes of an invisible person are  ?
It would be impossible to do Legilimency on an invisible person.
Because there isn't an eye to look at!  ( the eye is there but you can't see it ) . It is said that Eye Contact is essential for Legilimency.
I think it might be possible  ( though extremely difficult ) to perform Legilimency on a Camouflaged person ( eg Disillusionment Charm ) , if you locate the eyes of the person in the question.
Conclusion
Legilimency can't detect invisibility  ( Hello - Mad Eye Moody ! ).
Because Legilimency is designed to only detect thought and memories and not matter.
Comment: But just because the eyes are invisible/camouflaged, doesn't mean the eyes don't exist anymore. You can still make eye contact, even if the eyes aren't visible, I'd think. Even if you can't see where the eyes are, it's entirely possible to still make eye contact if the Legilimens happens to catch the invisible/camouflaged person's eyes, right?
Comment: @Krumione and Dembridge I agree. Can you see the air  ? Just because you can't see the air doesn't mean that the air isn't there  ! I clearly mention this in my answer
Comment: PS - What does Dembridge mean anyway  ?
Comment: Eye contact is "often needed", not "always needed" - See the quite in the other answer.

Can Legilimency detect invisibility?


Why do we multiply $\cos θ$ in the formula for work?

Question: I know that the formula for work, $W = FS\cos\theta$, where $F$ is the applied force, $S$ is the displacement of the object and $\theta$ is the angle between the applied force and the displacement of the object. When the object moves along the direction of the force, then we use $W = FS$. But why do we multiply it with $\cos\theta$ when the object doesn't move along the direction of the force?
Comment: $\begin{aligned}W=\int \overrightarrow{F}\cdot \overrightarrow{ds}=\int \left( \overrightarrow{F}_{11}+\overrightarrow{F}_{\bot }\right) \cdot d\overrightarrow{s}=
\int \overrightarrow{F}_{11}\cdot \overrightarrow{ds}=\int F\cos \left( \varphi \right) ds\end{aligned}$
Answer: In general, work is a dot product between two vectors. You must integate over the path, $W=\int \vec F\cdot \mathrm d\vec s$, but if the force is constant, this simplifies to:
$$W=\vec F\cdot \vec s.$$
A dot product is mathematically the parallel components multiplied together. We could write it as
$$W=\vec F\cdot \vec s \quad\Leftrightarrow\quad W=F_\parallel \;s\quad\Leftrightarrow\quad W=F\;s_\parallel$$
if we wanted to. These three versions are all equivalent. The trick we need is how to get the parallel component only. If the forces are already parallel, then no biggie. Just multiply them without change:
$$W=F\;s\qquad \leftarrow \text{if parallel.}$$
If not, then it turns out that the cosine function can help. Remember from the unit-circle definition how cosine is defined: It is the horizontal distance while sine is the vertical distance. The cosine and sine values constistute the two legs (cathetusses) of a right-angled triangle in which the hypotenuse is 1. Scale it up to a ypotenuse with the length of your vector $F$ and the legs are now $F$ times longer than before, so $\cos(\theta)F$ and $\sin(\theta)F$.
These legs are the horizontal and vertical components, respectively, of the vector $F$, meaning:
$$F_\parallel=\cos(\theta)F\qquad\text{ and }\qquad F_\perp=\sin(\theta)F.$$
We could do the same for the vector $s$. In both cases, when we replace either $F_\parallel$ or $s_\parallel$ in work formula, we introduce this cosine term:
$$W=\vec F\cdot \vec s \quad\Leftrightarrow\quad W=F_\parallel \;s\quad\Leftrightarrow\quad W=F\;s_\parallel \quad\Leftrightarrow\quad W=Fs\cos(\theta).$$

The dot product uses cosine in this way. The cross product uses sine (used in the torque formula e.g.). To remember this technique for other uses, try to
memorize that the cosine is equal to the adjacent leg of the right-angled triangle over the hypotenuse. And sine is equal to the opposite leg over the hypotenuse:
$$\cos(\theta)=\frac{\text{adjacent leg}}{\text{hypotenuse}}\qquad \text{ and }\qquad \sin(\theta)=\frac{\text{opposite leg}}{\text{hypotenuse}}.$$
(I don't know if there is some smart mnemonic in English - in Danish I typically say "cos er hos", because "hos" means "at / belongs to".) Since the hypotenuse always is the full vector length, then just flip it over to the over side of the equal sign, and then you have the expression you need for the parallel component (adjacent leg) or perpendicular component (opposite leg).
Answer: Because the force applied on the object produces two effects - changing kinetic energy of the object by changing its speed and curving its path.
The work is supposed to tell us, how much kinetic energy was transferred to the object (or from it). The kinetic energy is however increased only by the component of the force in the direction of the motion, which is why the cosine appears. The perpendicular component serves only to curve the trajectory and there is no energy associated with the curvature of the motion so we are not interested in this component.
Comment: THIS is the key, nice answer. I suggest you to include a circular motion example. In circular motion, parallel force increases kinetic energy while the normal component only maintains the rotation. That is to say, components parallel to motion increase velocity, while normal components only change trajectoy but not the modulus of the velocity
Answer: To give and intuitive idea:
Imagine a person carrying a heavy suitcase fitted with wheels.
As long as the person pulls his luggage on a flat terrain, he does (ideally) no work: The (gravitational) force is perpendicular to the motion.
If the person arrives at a place when he/she has to pull his luggage say along an uphill ramp, then the more inclined the ramp, the more works said person will have to provide to go forward, because the larger the angle, the more the motion of the suitcase is aligned withe the force of gravity.
In this example the $cos(\alpha)$ measure how much the motion of the the suitcase is aligned withe gravity (i.e) with the vertical axis.
Answer: Work is basically dot product of force and displacement. If force and displacement have different directions and are inclined at an angle then the component of force in direction of the displacement is responsible for the work done. So for obtaining that component of force we draw a perpendicular line from head of the force vector to the displacement and so by simple trigonometry $F \cos \left( \theta \right)$ is that component of force in direction of displacement. So we have work done $= F_{s} \cos \left( \theta \right)$. You can also take component of displacement in direction of force which also gives same result.


Is there a way to setup palettes/themes that apply across all folders in photoshop?

Question: I am trying to create a solution where I can create a series of 'designs' or 'patterns' which may use 3 colours from a palette. What I want to achieve is to be able to change those colours (my palette) and have them apply across all of the different designs in my document.
Below is a very crude and gross diagram of what I'm trying to achieve. Can this be done in Photoshop or Illustrator?
Comment: [What should I do when someone answers my question?](https://graphicdesign.stackexchange.com/help/someone-answers)  :)
Answer: You can do this in Illustrator, but not in Photoshop; see https://graphicdesign.stackexchange.com/a/13792/57377.
To do it in Illustrator, in the "swatches" panel, click on a swatch and then click "swatch options" in the hamburger menu of the swatches panel.  Turn on the "global" checkbox.
Now, anything that uses the "global" swatch will update when you edit that swatch.
Note that your existing objects that are colored the same CMYK value as your global swatch will NOT update.  You have to actually color them with the global swatch first.
Global swatches are indicated by a small white triangle on the lower right corner of the swatch square in the swatches panel.
Here is the official help for illustrator swatches.


All up front rental payments impacting taxes?

Question: Prospective tenant in Philadelphia, PA wants to pay for year long lease all up front. How does this impact net income and therefore taxes? Typically when paid on a monthly basis I am able to deduct depreciation of property to offset taxable income from the rent collection; some in 2023, some in 2024 as lease is [October '23, October '24].
With an all up front payment, all of the income would be in 2023, while the scheduled depreciation would not be able to offset the income, leading to substantially higher taxes.
Unless I am misunderstanding, this seems detrimental. Normally the net tax comes out close to 0 since yearly depreciation covers the income. But if all of a sudden the income is all in 2023, depreciation wouldn't be enough to net it out, thereby incurring non-zero taxes and causing me to pay more than I otherwise would have.
The only way it nets to 0 delta over the 2 years is if home depreciation can be used to offset other income (ie salary) in 2024. Not sure if this is possible?
Is this a correct understanding?
Comment: You might consider asking them if they'd be willing to pay through Dec upfront, then pay the rest in Jan.
Answer: This is not entirely how it works, but it can cause some temporary cash-flow problems due to taxes shifting.
When you're paid for a whole year at once, you as a cash basis taxpayer recognize the income at once. Depreciation is always taken over time. So you can potentially get into a situation where you have higher tax liability in 2023 due to the lump sum payment, and then tax loss in 2024 due to the depreciation taken with no income to offset it.
It eventually balances out over time, but in 2023 you may have to pay a bit more in taxes and wait for a year to recoup it in depreciation. You can deduct rental losses from other income, but to a limit. It's called "passive activity loss" and there are non-trivial rules on how to handle it. See the IRS Publication 925. In 2024 you may end up with passive activity loss rules limiting how much of the loss you can actually use against other income, but it will also end up balancing out with future rental income or when you sell the property since you carry forward the passive activity losses that you cannot use until you can.
It is an inconvenience to you for sure, and unconventional. I'm not sure why the tenant wants it, since they also lose the value of the money for the whole year.
Comment: The main reason I can think of for wanting to pay a whole year up front is if the tenant cannot provide the proof of recurring income (at a certain multiple above the rent amount) that most landlords require for a regular lease billed monthly.
Comment: @Douglas I'd be wary of such a tenant. What happens at the end of the lease? Any explanation I can come up with makes me worry as a landlord, this just doesn't make much sense.
Comment: @littleadv: I was on the tenant side of this as a student. My parents were paying (my share of) the rent. The landlord wanted it up-front in order to avoid having to worry about the nonexistent credit of the average college student. As for what happens at the end of the lease - it's the end of the school year. We're moving out, and everybody understands this at the start.


Show both ctime and atime in ls output

Question: Can I get both ctime and atime in ls output? Seems I can only pass one --time=ctime or --time=atime argument (the second is ignored). Is there any other way?
Answer: If you are only parsing values out of ls, you can use stat instead:
# stat -c %x,%z,%n *
2011-01-11 06:09:04.000000000 -0500,2011-01-11 02:43:52.000000000 -0500,sqlupdate.sh
2011-01-11 06:09:04.000000000 -0500,2011-01-12 02:43:55.000000000 -0500,file.tar.gz
2011-01-11 06:09:04.000000000 -0500,2011-01-11 02:43:52.000000000 -0500,mysql_password.txt
2011-01-17 02:43:49.000000000 -0500,2011-01-12 13:40:48.000000000 -0500,public_html
Where:
 %x     Time of last access
 %z     Time of last change
 %n     Name of file
Comment: Just to be sure I understand the answers here. It is possible with ls to display any of access, modified and change time, but not more than one at a time. Because that is both really surprising, and very annoying.
Answer: You could run stat -c '%x %z' filename.txt
Comment: Just note that `stat -c '%w %x %y %z' filename.txt` gives you creation, access, data modification, status change. In human-readable format.
Comment: On a Mac this would look more like `stat -f "%c %a %N" filename.txt` (change it to `%Sc %Sa` for human readable).
Answer: with findyou get very close to what ls -lprovides:
# find . -maxdepth 1 \
     -printf "%M %u %g %s\t%Ab %Ad %AH:%AM\t%Cb %Cd %CH:%CM\t%P\n"

you have access to ctime (%C), atime(%A) and modification time (%T). read man find to find more info.

Show both ctime and atime in ls output


when an object is lifted (at a constant velocity) shouldn't the work done on the object be zero?

Question: When I lift an object from the ground (at a constant velocity) I'm applying force on the object equal to its weight and the earth is also pulling it downwards with equal amounts of force. So if the net force on the object is zero shouldn't the WORK also be zero?...(Although the potential energy increases which indicate work done.....I'm a bit confused.)
Comment: possible duplicate of [Work done against gravity](http://physics.stackexchange.com/q/135175/)
Comment: https://physics.stackexchange.com/questions/321288/question-about-potential-energy?rq=1.   Farcher and Bill N's answers are relevant
Answer:
When i lift an object from the ground (at a constant velocity) I'm
  applying force on the object equal to it's weight and the earth is
  also pulling it downwards with equal amounts of force. So if the net
  force on the object is zero shouldn't the WORK also be zero?

You should consider the definition of work

In physics, a force is said to do work if, when acting on a body,
  there is a displacement of the point of application in the direction
  of the force. For example, when a ball is held above the ground and
  then dropped, the work done on the ball as it falls is equal to the
  weight of the ball (a force) multiplied by the distance to the ground
  (a displacement)

If you apply a force to an object and it is lifted from the ground, that simply means that you have done positive work on that object, because you have displaced it and the amount of work  is its weight times the displacement.
If work done were zero the object would remain on the ground
Answer: This appears to be a very normal intuition challenge: someone has claimed the math says the world works one way, and intuition declares it works the other.  Let's see if we can get intuition to agree with the so called "math."
Gravity is a sneaky thing.  Even at the Quantum Mechanical level, it keeps causing problems.  It will be easier to understand if we look at an analogous situation using a spring instead of gravity.
Dust off your frictionless surface and lay it on the ground.  You ordered one of these from Amazon, right?  Physics is so much easier once you have the proper laboratory equipment like frictionless surfaces and spherical cows.  In fact, just because this is my analogy, go grab your spherical cow... we'll use it as the object we're trying to move around and do work on.*
Now lets grab a spring.  We're going to hook one end of the spring to a Fixed Point™ in the middle of our frictionless surface.  Hook the other end to the spherical cow.  Now this situation is akin to the scenario you described with gravity working on an object, but it has been replaced with a spring so that we can more intuitively see where the work is going as we stretch things.
Now we're going to push the cow away from the center at a fixed velocity (your frictionless surface should have come with special "Sticky Shoes" so that you can do this.  Never attempt to push a spherical cow on a frictionless surface without Sticky Shoes).  Obviously the spring will begin to stretch.  We can intuitively recognize that the spring is building up potential energy, because it would snap back if we stopped pushing.  Thus we should recognize intuitively that we are doing work, but how should we think about this to make it more applicable to your original example?
One of the definitions of work is a force applied in a direction for a distance ($W=F\cdot s$, where s is the direction of movement).  If the force is applied in the direction of movement, it's positive work (work done to the object by the actor).  If the force is applied opposed to the movement, it's negative work (work done to the actor by the object).  Now let's break apart all of the forces and see how they work:

You are applying force $F_{you\to cow}$ on the cow in the direction of movement, so your work, $W_{you\to cow}$, is positive (you are applying work to the cow. Mooo!).
The spring is applying a force on the cow, $F_{spring\to cow}$, and the cow is naturally applying a resulting force back, $F_{cow\to spring}$.  Now the direction of these forces is important.  Because the cow is effectively stretching the spring, it is doing work in the positive direction, so it is doing work ($W_{cow\to spring} >0$), and the spring is having work done to it ($W_{spring\to cow} < 0$).  Initially, we're going to focus on $W_{cow\to spring}$ because it follows intuition better: you're applying work to the cow, and it's applying it to the spring.  It's a lot easier to think of all of the positive works when you can -- most brains aren't wired to think of "negative work."

Now, the spherical cow is not accelerating, as per your question.  This means the sum of the forces must be equal to zero, so $F_{you\to cow} = -F_{spring\to cow}$.  Since I mentioned earlier it's easier to think of a long chain of works from you to the cow to the spring, lets flip the direction on the second term by dropping the negative sign and switching the order of the actor and object: $F_{you\to cow} = F_{cow\to spring}$.  From this wording, we see that all of the force you apply to the cow is applied by the cow to the spring (which makes sense, since the cow isn't accelerating).  This means  $W_{you\to cow} = W_{cow\to spring}$.  All of the work done to the cow must be done to the spring.
That work has to go somewhere, so it goes into deforming the physical structure of the spring, straining atomic bonds and what not to store the energy to be released later.
Now we can bring this back to your original question by replacing the frictionless surface and spring with an object being lifted into the air at a constant rate.  You are still pushing an object away from a fixed point (the ground beneath your feet), against a conservative force (gravity, which happily snaps back when you stop pushing on it, just like the spring did).  The last piece of the puzzle is "what is the equivalent of the 'physical structure of the spring deforming."  The answer is that it's the "deformation" of objects being drug through a gravitational field.  In this specific case, it is not too bad to think of the effects of gravity being like a big rubber sheet that tries to pull back on objects, storing up "potential energy."  However you want to think about it, the work you expend lifting the object gets "stored" in gravitational potential energy, just as the work expended pushing the cow got "stored" in the spring's potential energy.
* If you've not seen this before, there is an ongoing joke in Physics education about how we love to use impossible objects because they make the math easier, but we want to use tangible examples.  One of the most famous questions involved finding the trajectory of a cow through the air.  At the end of the problem was a caveat, "Assume the cow is a perfect sphere."

Now, you'll note I dropped a ton of resultant forces in my example.  They don't matter when you're just approaching this problem on the surface.  However, they get extremely interesting when you try to expand this problem to include more complicated problems, like putting an object into orbit.
In the original example, we used some pretty fancy laboratory equipment.  Fixed Points™ that can be attached to frictionless surfaces are very expensive, and Sticky Shoes do eventually wear out.  What if we tried to do this experiment without them?  (I'll keep the frictionless surface because it lets me model things being lifted into the air without having to pay attention to gravity itself.  It keeps the model sane.)
Instead of attaching the spring to a Fixed Point™, lets just stick it on an ordinary object, like a block.  Instead of using Sticky Shoes to push directly on the frictionless surface, lets push against the block yourself.  Depending on if you're visualizing moving it a little bit or a lot, you can either visualize this as you're going to push off the block by extending your legs, or you may have to attach a walk-way of sorts to the block so that you can push it.  It doesn't matter for the physics, just your intuitive model of what it looks like to push spherical cows around a frictionless surface.
What does matter is that all of the force your legs used to apply to the ground must now be applied to the block.  Now, if you take the time to account for all of those pesky resultant forces like $F_{cow\to you}$.  When you do so, you find that the sum of forces on you, the spring, and the cow are all 0 because the resultant forces cancel everything out nicely (if they didn't we'd be accelerating).  The last two resultant forces that will not have been canceled out are $F_{you\to block}$ and $F_{spring\to block}$.  Since the block isn't accelerating either, these two forces are equal and opposite as well.
Now this is neat because, unlike the first example, the frictionless surface is no longer having any particularly special effect.  All it's doing is holding in a 2d plane to make it easier to describe what is going on in words.  We've removed virtually all of the fancy laboratory equipment, and all that is left are normal objects from the real world!
So in this case, when you push the cow outwards, it stretches the spring.  The block gets pushed slightly backwards, and you and the cow push slightly forward.  The entire system "gains energy," just like when you stretch a huge gym rubbber band over your head and realize just how much potential energy you stored in it (and just how inadequate your muscles are for keeping it there without it snapping back on your head).
Likewise, in your real question, when you finally get around to modeling all of the resultant forces, you'll find that lifting the cow actually pushes backwards on the earth, stretching the virtual-rubber-band of gravity.  This "stretching" is the potential energy of gravity.
And this is what happens when you let go, and all of the gravitational potential energy snap back.
Answer: No that's not right. a work can be calculated for each force individually.
you are mixing it with the equation between work and energy that says:
$$W = \Delta K  \quad \text{K is kinetic energy}$$
but this work is actually the work of the overall force on the object. the work done by earth gravity force and your force is zero. But each is doing some work individually. you are doing some positive amount of work and the earth is doing it in the same amount but in negative sign.
Answer: It is zero; think of the conservation of energy.  Actually, because of this law, all force's work on an object will be equal to only its change of kinetic energy (at least in the Newtonian physic), and in this case this is zero. We use the potential energies to ease up the calculations (so you don't have to calculate all times i.e. the Coulomb-force's work): they are some kind of a "reverse work" - the amount of the energy can be gained in the future. By definition: the gravitational potential energy is the work of the gravitational force while it takes the object from height $h$ compared to the zero point to the zero point. This is the opposite of the gravitational work in our case. But this can not be used when you count with the force's work since in this way you would count it twice: you can either use $$W_F +W_{\text{grav}} = 0  \quad \text{or} \quad W_F = E_\text{grav.pot}$$ but never $$W_F + W_\text{grav} =E_\text{grav.pot}$$.
Answer: Yes, the net force is zero. But that doesn't mean you are doing no work "against gravity".
That the system is in stable equilibrium, does indicate that the kinetic energy is constant. You are changing the configuration of the system- its state of position - against a field where the force is given by the gradient of potential energy ie. $$ \mathbf{F} = -\nabla U$$. So, you have to do work against the field concerned so as to change the state. If the system had changed its velocity, that only meant you were doing extra work for executing the change in kinetic energy.


A children's sci-fi book about children on the moon

Question: I remember a book as a kid about moon inhabitants.  The book was about a couple of the children who would have adventures, and I think maybe even traveled in space ships... I remember absolutely loving the books, but I was like 9, so I can't really remember any other details besides that.  This would have been in the early 80's, but the books could have been much older.
Answer: One of the classic stories with two children having an adventure on the moon is the Robert Heinlein novel Have Space Suit - Will Travel. This is one of several novels that are characterized as the "Heinlein Juveniles".
In the novel, the main character Clifford "Kip" Russel wins a space suit in a contest. He ends up being kidnapped along with a young girl "Peewee", and an alien "Mother Thing" and taken to the moon. They manage a short lived escape and hike across the surface of the moon before being recaptured and transported to Pluto.
Other Heinlein novels involve scenes on the moon. The novel The Rolling Stones starts on the moon with a family that lives there, until they buy a ship and head out on an adventure. The short story The Menace From Earth is set entirely on the moon.
Comment: I love that book. It's one of my favorite Heinleins, and much better I'm sure than whatever book the OP is remembering. Probably not Kip and Peewee, because they were not series characters, they were just in that one book.
Comment: Those were my first thoughts as well, the Heinlein YA ones. Quite a few of them featured similar themes, the other main "moon" one that I remember was [Rocket Ship Galileo](https://en.wikipedia.org/wiki/Rocket_Ship_Galileo).
Answer: This sounds like the first SF book I remember reading: The Wonderful Flight to the Mushroom Planet by Eleanor Cameron - first in a series. Two kids build a spaceship in their back yard and travel to a moon/planetoid somewhere not that far from Earth. I don't remember the whole story but it involved leaving a chicken behind when they went home!


Nintex workflow 'Copy to SharePoint' for video files

Question: I'm using 'Copy to SharePoint' workflow action to copy a video file between two site collections using Nintex workflow.
For some reason that does not work perfectly well in all cases.
Looking at the video file structure in SharePoint, once video is uploaded a new document set is created for it containing the video file itself plus a thumbnail.
Once 'Copy to SharePoint' is completed the actual video file is copied across, however that is not the case for the original thumbnail image. There is no new thumbnail generated either.
Answer: Issue was solved with upgrading Nintex 2013 Workflow 22.214.171.124 to 220.127.116.11
Not mentioned in the release notes though.


Any difference from Apple instructions when installing Bootcamp to dual-drive iMacs?

Question: Apple's Bootcamp instructions make no mention of how to proceed with a dual-drive iMac. Are there any differences in formatting/installation procedures involving either or both of the drives? I am new to Macs and don't want to muck up what is working well.
Comment: BootCamp only supports installing a partition on the same drive as the OS. Macs allow you to install an OS on pretty much any drive, so if you have two OS, one on each drive you could also have two BootCamp. Can you narrow down a bit what research or what thing about BootCamp you're not getting? Are you simply looking for the BootCamp FAQ or is there something deeper to be answered?
Answer: If you have an internal SSD and HDD I think it comes down to which one is the boot drive. You can choose the startup disk in the Preferences pane.
You can change the startup disk by formatting the new drive with GUID in Disk Utility.
I think the Bootcamp partition must be on the same drive as the startup disk, so that it shows up when you press Alt during boot.
If you use an external SSD drive, Bootcamp can not start the installation on an external drive (eg. external Thunderbolt enclosure with SSD), however you can install on the internal drive and clone the partition.
BootCamp installation on a secondary internal drives may require cloning a partition, see this post.


How to draw a tree in java language

Question: I am trying to parse an XML file in java, after I have to represent it as a tree using Jframe like this
Comment: Your question I am afraid is very ambiguous at the moment.  Please add additional information so that the community may better assist you with an answer.
Comment: Assuming you want to replicate the figure, why Java? Any specific reason? Else use [Dia](http://projects.gnome.org/dia/)!
Comment: I am trying to parse an XML file in java, after I have to represent it as a tree using Jframe
Answer: Trees are generally one of the easier linked constructs to lay out like this, because paths generally don't "merge" or "cross".
You can approach it in a roughly tabular way by traversing the tree "left to right": start at the root, and draw its representation at the top left of the area. Then, traverse its "left" branch one level at a time, drawing those nodes' representations on successively lower "rows", in the same "column" as the root. Then, as you move to the "right"-side nodes, draw that node in the next "column" available to the right on the same level. This will produce a ramp-shaped graph of the tree's structure.
You can add some pre-analysis of the number of levels and nodes at each level, which will allow you to "center" the tree into a rough pyramid shape by knowing the maximum number of levels the graph will require and the number of nodes at each level of that graph. But, that requires traversing the entire graph before you start drawing anything.
As for "arranging" a tree's nodes so they fit in the smallest area without arrows crossing or overlapping, that's a problem with a scope far exceeding the average SO answer.
Answer: There are lots of good libraries for visualizing graphs.
Here's a pretty extensive list of options: http://s6ai.livejournal.com/33969.html
Answer: Prefuse could probably create something aesthetically similar. Of course, you could go the primitive route and do the graphics manually. For an XML to graph transform, the TreeMLReader API may be of some use, however you might have to convert the XML to the TreeML format with XSLT first.
Answer: Us the standard forms to print the image
http://www.java-forums.org/awt-swing/6763-how-display-image.html

How to draw a tree in java language


Is skin friction drag affected by material?

Question: Normally, friction between surfaces is affected by the materials. Can skin friction be reduced by a low friction material like Teflon?
Comment: Can you elaborate on your question? What is the aviation link?
Comment: I'm not too sure of your question.  But the answer is yes.  Friction and drag are almost completely dependent on material.  For example, a rocket with "perfectly" smooth paint will use less fuel than a rocket with a normal matte finish.
Answer: Indirectly, yes. Friction goes up when dirt and smashed bugs accumulate on the wing. A low surface energy coating might well reduce their stickiness, so the wing collects less dirt and has less roughness. This is especially helpful when it helps to delay the transition from laminar to turbulent flow.
Another way to delay that transition would be a soft surface which could help to dampen the characteristic Tollmien-Schlichting oscillations from which the transition of boundary layer flow from laminar to turbulent springs. Accelerated flow is naturally damped (the amplitude decreases relatively to flow speed), so it stays laminar on a smooth wing. Once the damping turns negative (i.e. the oscillation is increasing), the turbulent transition is imminent. When the wing is not only smooth, but also soft and helps to dampen those Tollmien–Schlichting oscillations, even unaccelerated flow might stay laminar for longer, which again reduces friction drag. So far, I am unaware that this effect has been exploited successfully on an aircraft, though.
The friction between gaseous substances and solids is not affected by the surface energy of the solid, so a direct reduction in viscous drag due to a polytetrafluoroethylene coating will not happen.
I trust you know how drag depends on surface roughness. If not, please feel free to post another question.
Answer: According to this paper some kind of roughness can lower skin friction.
The idea is to create small "barrels" of gas that rolls between surface and the gas flow. The surface has ridges perpendicular to the flow direction. They guide air in small rotating air tubes.
Shark skin also has a reduced skin friction. Here is how it looks :

I think it provide both advantages of ridges (gap between scales) and the soft surface properties Peter is talking about.


Using the PSS, how do you ask anyone to battle?

Question: I'm playing Pokemon Y and recently, while using the PSS, I saw someone with a white sign on their avatar. When I selected him, it automatically prompted me for battle. I wanna know how to do that. Does anyone?
Answer: This should do the trick.
In the first PSS menu you have this page:

If you tap Battle you open a new menu where you can choose what kind of battle you want: Infrared, Local and Internet. If you choose "Internet" and select which battle options you like, you have to choose who you want to challenge. At the bottom of the screen, there's a button that lets you invite Friends and Acquaintance. Then, the game will automatically search for a challenger.
Probably for a friend or an acquaintance this "search" will have the look of a special icon on your avatar. I can't figure out any other process.
Comment: thanks alot ,and by the way the icon was something like a shout out,it was moving,it had a battle sign on it and was white.


Tor - refresh your path every x seconds

Question: Is there a way to refresh your path in Tor every x seconds or minutes without manually doing like pressing new identity? I need it to do it automatically (e.g. putting a line in the torrc file)? I looked online but couldn't find any information about this.
Answer: Maybe you can try this: /etc/init.d/tor restart
Comment: How would that work as a repeated process? If you're suggesting a cronjob then please elaborate.
Answer: Write a script (or maybe you can find a pre-made one) to loop a "NEWNYM"(New Identity) to the controller (port 9060). There's a built-in 10 second limit to how fast you can send a signal. But even that could be harsh on the network. So don't cycle so often/frequently.
I'd recommended using Stem (TOR's Python Library) to write your script.
https://stem.torproject.org/
Answer: You may be looking for the torrc option MaxCircuitDirtiness, which defaults to 10 minutes.
This is assuming that you're doing something low-level, i.e. not using a browser, because the option only applies to new TCP connections. Existing connections don't get closed automatically!

Tor - refresh your path every x seconds


Simultaneous Tridiagonalization of a given set of hermitian matrices?

Question: I have a set of $N\times N$ hermitian matrices $A_i,~i=1,\dots,M$. Are there any results  on the possibility of simultaneously tridiagonalizing them?
Comment: for $M=2$, see http://www.sciencedirect.com/science/article/pii/S0021869308000045
Comment: thanks for the reply. But I was interested in the general case.
Answer: Not an answer, but rather a pointer to some potentially interesting references. Two relevant geometric ideas are flag varieties (or manifolds) and Hessenberg varieties.
Flags connect abstract linear operators with matrices, with possible various structures. A matrix differs from an abstract linear operator by being expressed in a particular basis, say $e_i$. Often, it is not the basis itself that is important, but the subspaces $V_i = \operatorname{span}(e_j)_{j=1}^i$. In general, a sequence of subspaces $0 \subset V_1 \subset V_2 \subset \cdots \subset V_{n-1} \subset \mathbb{R}^n$, with the dimension of each $V_i$ increasing by one is called a complete flag. Picking a vector $e_i \in V_i \setminus V_{i-1}$ generates, in the reverse direction, a basis from a flag. It so happens that the space of all complete flags $\mathrm{Flag}_n$ is a smooth compact manifold (even an algebraic variety) of dimension $n(n-1)/2$.
Given a linear operator $A\colon \mathbb{R}^n \to \mathbb{R}^n$, we can consider special flags that satisfy $A V_i \subseteq V_{i+1}$. These are called Hessenberg flags, because the matrix corresponding to $A$ in a basis adapted to the flag is in upper Hessenberg form: all entries below the sub-main diagonal are zero ($a_{ij} = 0$ if $i > j+1$). If $A$ happens to be symmetric ($a_{ij} = a_{ji}$), then being in upper Hessenberg form is the same as being in tridiagonal form. The set of all Hessenberg flags of $A$ is then a subset $\mathrm{Hess}(A) \subset \mathrm{Flag}_n$, referred to as the Hessenberg variety of $A$. It seems that the study of the geometry and topology of Hessenberg varieties was initiated in

On the topology of the Hessenberg varieties of a matrix
  Filippo de Mari Casareto dal Verme,
  PhD Dissertation Washington University 75 (1987)
Generalized Eulerian numbers and the topology of the Hessenberg variety of a matrix,
  Filippo de Mari, Mark A. Shayman,
  Acta Applicandae Mathematica (1988) 12 213-235

According to these references, $\dim \mathrm{Hess}(A) = n-1$ for a generic operator $A$. Since $2(n-1) < n(n-1)/2$ for $n > 4$, we cannot expect $\mathrm{Hess}(A)$ and $\mathrm{Hess}(B)$, for generic $A$ and $B$, to have non-empty intersection in $\mathrm{Flag}_n$ for $n > 4$. So in higher dimensions. One cannot exect any two random operators to be simultaneously reducible to upper Hessenberg form. Of course, there may exist some simple condition on $A$ and $B$ such that guarantees simultaneous reducibility to upper Hessenberg form, but I haven't thought of it.
As already noted, for symmetric operators, upper Hessenberg and tridiagonal forms are related. So, if one were to think of a set of conditions for simultaneous upper Hessenberg form, they might lead to similar conditions for simultaneous tridiagonalizability. But, in the absence of such conditions I'm afraid I'm no closer to answering your question.
Comment: are you suggesting that for $n\leq 5$, simultaneous tridiagonalization is possible?
Comment: It seems so, just by dimension counting. To submanifolds whose dimensions sum to more than the dimension of the ambient space generically intersect each other.
Comment: Does this hold for any $M$?
Comment: Sorry, had an off-by-one error. It should be $n\le 4$ not $5$ Again, counting the dimensions, you have $M_2 = \infty$, $M_3 = 3$ and $M_4 = 2$, where $M_n$ is the maximum number of $n\times n$ matrices you can expect to simultaneously put in upper Hessenberg form (hence tridiagonal for, if they are symmetric).


Memory usage and space disk on Solaris 11

Question: How can I monitor

Memory Usage: 33/512MB (6%)
Disk usage: 4.2/20GB (23%)
CPU Load: 0.01

on a Solaris 11 System? I want to make a script to monitor my desktop resources.
Comment: Do any of the answers solve your problem? If so, please [consider accepting](http://unix.stackexchange.com/help/someone-answers) one.
Answer: If you have one system then SAR is the a good alternative out of the box.
If you have multiple system you might want to evaluate other choices as well besides SAR.
Xymon and dimSTAT are two of them that I use and recommend.
dimSTAT is specially good for Solaris as it was developed with Solaris in mind by a Sun Engineer.
Xymon is multipurpose and highly customizable.
Now if you want to use your own scripting then there are several possibilites and you should use the one that suits you best. examples inline: echo "::memstat"|mdb -k
root@solsrv01:~# echo "::memstat" |mdb -k
Page Summary                 Pages             Bytes  %Tot
----------------- ----------------  ----------------  ----
Kernel                      114567            447.5M   11%
ZFS Metadata                  7312             28.5M    1%
ZFS File Data                72180            281.9M    7%
Anon                         36257            141.6M    3%
Exec and libs                 1559              6.0M    0%
Page cache                    6286             24.5M    1%
Free (cachelist)              8973             35.0M    1%
Free (freelist)             784053              2.9G   75%
Total                      1048463              3.9G

you will need to look at the right line and get the desired values.
for cpu load you can use uptime, prstat or even kstat.
root@solsrv01:~# uptime
 11:35pm  up 12 min(s),  1 user,  load average: 0.02, 0.29, 0.30

root@solsrv01:~# prstat -c 1 1
Please wait...
   PID USERNAME  SIZE   RSS STATE   PRI NICE      TIME  CPU PROCESS/NLWP
     5 root        0K    0K sleep    99  -20   0:00:01 0.1% zpool-rpool/147
   996 root       11M 3064K cpu0     49    0   0:00:00 0.1% prstat/1
   957 root       21M 7064K sleep    59    0   0:00:01 0.1% sshd/1
   958 root       11M 3188K sleep    49    0   0:00:00 0.0% bash/1
   489 root     3964K 2116K sleep    59    0   0:00:00 0.0% hald-addon-acpi/1
   480 root     8204K 6312K sleep    59    0   0:00:00 0.0% hald/4
    68 netadm   5320K 3360K sleep    59    0   0:00:00 0.0% ipmgmtd/6
    86 root     4044K 2284K sleep    59    0   0:00:00 0.0% svc.periodicd/4
   547 root       15M 3040K sleep    59    0   0:01:03 0.0% ldap_cachemgr/8
   360 root       10M 2464K sleep    59    0   0:00:00 0.0% picld/4
    45 netadm     11M 2288K sleep    59    0   0:00:00 0.0% ibmgmtd/4
    42 netcfg   3748K 2588K sleep    59    0   0:00:00 0.0% netcfgd/4
    15 root       20M   19M sleep    59    0   0:00:46 0.0% svc.configd/31
    13 root       53M   33M sleep    59    0   0:00:13 0.0% svc.startd/15
   185 root       18M 3740K sleep    59    0   0:00:00 0.0% rad/4
Total: 62 processes, 397 lwps, load averages: 0.02, 0.25, 0.29

root@solsrv01:~# kstat -p 'unix:0:system_misc:avenrun*'|awk '{print $1"\t"$2/256}'
unix:0:system_misc:avenrun_15min        0.269531
unix:0:system_misc:avenrun_1min 0.0195312
unix:0:system_misc:avenrun_5min 0.203125

For disk usage:
root@solsrv01:~# df -h
Filesystem             Size   Used  Available Capacity  Mounted on
rpool/ROOT/solaris      19G   2.8G        13G    18%    /
/devices                 0K     0K         0K     0%    /devices
/dev                     0K     0K         0K     0%    /dev
ctfs                     0K     0K         0K     0%    /system/contract
proc                     0K     0K         0K     0%    /proc
mnttab                   0K     0K         0K     0%    /etc/mnttab
swap                   3.9G   1.6M       3.9G     1%    /system/volatile
objfs                    0K     0K         0K     0%    /system/object
sharefs                  0K     0K         0K     0%    /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                        16G   2.8G        13G    18%    /lib/libc.so.1
fd                       0K     0K         0K     0%    /dev/fd
rpool/ROOT/solaris/var
                        19G   221M        13G     2%    /var
swap                   3.9G     4K       3.9G     1%    /tmp
rpool/VARSHARE          19G   2.4M        13G     1%    /var/share
rpool/export            19G    32K        13G     1%    /export
rpool/export/home       19G    38K        13G     1%    /export/home
rpool                   19G   4.5M        13G     1%    /rpool
rpool/VARSHARE/zones    19G    31K        13G     1%    /system/zones
rpool/VARSHARE/pkg      19G    32K        13G     1%    /var/share/pkg
rpool/VARSHARE/pkg/repositories
                        19G    31K        13G     1%    /var/share/pkg/repositories
root@solsrv01:~# zpool list
NAME    SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
rpool  19.6G  6.08G  13.5G  30%  1.00x  ONLINE  -

Comment: Many Thansk dude!.
Answer: Use sar.

sar

system activity reporter

Also, read this link

Monitoring System Activities (sar)
Use the sar command to perform the following tasks:

Organize and view data about system activity.
Access system activity data on a special request basis.
Generate automatic reports to measure and monitor system performance, as well as special request reports to pinpoint specific
  performance problems. For information about how to set up the sar
  command to run on your system, as well as a description of these
  tools, see Collecting System Activity Data Automatically (sar).

For a detailed description of this command, see the sar(1) man page.

and this link.

Collecting System Activity Data Automatically (sar)
Three commands are involved in the automatic collection of system
  activity data: sadc, sa1, and sa2.
...


cassette pick, and lockring + working with my derailleur

Question: Need a cassette here for an alexrim. How do I choose one? Need lockring too, will also need to know which one and do I need to consider what my derailleur is with the new cogs (for compatibility)[?
Comment: How many cogs were there on your old cassette?   What is the exact model number of your derailleur?   Or last resort, how many clicks are there on your right-hand shifter?
Comment: Worth noting that at least for newer Shimano cassettes, all specs are written on it. You typically have the model number on the lock ring (assuming it is the original one), for example CS-5800 and besides the obvious number of cogs, you also have printed the amount of tooth on every single cog, the one on the largest cog is usually good enough to indicate the correct cassette variant (28, 30, 32, ....)
Comment: @DoNuT good point.   I suspect OP doesn't have any cassette.  Its also possilble the rest of the bike is incomplete too - we don't know what else is there.
Comment: @Criggie Yeah, I was too optimistic in the OP asking for a replacement since components are already present, but that might not be the case. I'd say without any information about the rest of the groupset (or whatever is present), it'll be hard to give any advise. My educated guess is that a Shimano 12-speed-cassette is needed and I'd probably pick a 11-34 but that won't help to solve the case^^
Answer: The depth of the cassette is related to the number of gears, but 8/9/10 all use the same width of cassette, simply making the chain thinner and space between cogs smaller.
A new cassette will come with a lockring, so that's covered.
You need to match the number of cogs with your shifter, and have a chain the "correct" thickness.  There may only be half a millimetre difference but that's enough to make a transmission work or not.
Comment: In the Shimano world, the 8 and 9 speed cassette are the same width, but a Shimano 10 speed (road) cassette is actually 1.0 mm narrower (go figure?).  A Shimano 10 speed road cassette will also come with a 1.0 mm spacer which goes on to the freehub first then the cassette, followed by the lockring (spec is 40 N-m or 29 lb-ft of torque on the lockring).
Comment: @ojs but since you asked, here is one of my favorites on this subject.  You'll have to scroll a bit, because there is a lot of history in this one. https://www.slowtwitch.com/Tech/Cassette_How-To_-_Part_2_3257.html
Comment: @TedHohl thanks for the link. That was new information for me, and a bit surprising because it's well known that 8/9/10 freehub width is the same, and that 11-speed MTB cassette on 11-speed road hub requires a spacer.
Comment: @ojs You're welcome. It was a surprise to me the first time I realized it myself. I rode 9 speed well into the 10 speed era, and jumped directly to 11 speed, so was late to learn this nuance.  In fact, the Shimano road 10 speed cassette on an 11 speed freehub requires two spacers, both a 1.0 mm one and a 1.85 mm one (2.85 mm total).  The 1.85 is the width difference between the 11 speed and 8/9/10 speed freehub, and the 1.0 is the width difference between the narrower 10 speed cassette and the 8/9 speed cassette(s).
Comment: @TedHohl do you have a source for that?
Comment: @ojs it is common knowledge.  And a comment.  One could also say that the 8, 9, and 10 speed Shimano road cassettes are all the same width, if you include the 1.0 mm spacer with the the 10-speed.  The 8/9/10 speed freehub body is the same width.


Need to leave for double entry china visa?

Question: A quick question. I have a double entry 2x60 days visa in PRC. Do I need to leave to and reenter into China to use the second entry, or can I stay for the full 120 days without leaving any time before?
Comment: What passport are you on?
Answer: The key word is double "entry". Yes you have to leave. A 60 day visa allows you to stay in the country for a maximum of 60 days, then you have to leave.  This is pretty much the rule anywhere in the world.  On the brightside, a trip to Hong Kong or Macau counts as leaving.
Comment: Depending on where in China the OP's actual business is, at trip to Hong Kong or Macau may not be "quick".
Comment: The reference was intended to point out that Hong Kong and Macau counted as "leaving", even though they are still part of China.  I have edited out the word quick, are you happy?