I'm cycling through a list using {% for item in list %}  and I want to output something like this:  &lt;li&gt;One&lt;/li&gt; &lt;li class='alternate'&gt;Two&lt;/li&gt; &lt;li&gt;Three&lt;/li&gt; &lt;li class='alternate'&gt;Four&lt;/li&gt; ...   with the intention of styling the alternate lines a different colour.  Django (1.3) has no mod or div template tag operators. I know I can add them by manipulating the django source, but I'd rather not do that as I want to be able to package this app up.  How can I achieve this?
Django templates offer the builtin tag cycle for alternating between several values at different points in a template (or for loop in a template) but this tag does not reset when it is accessed in a scope outside of the cycles definition.  I.e., if you have two or more lists in your template, the rows of all of which you'd like to use some css definitions odd and even, the first row of a list will pick up where the last left off, not with a fresh iteration from the choices (odd and even)  E.g., in the following code, if the first blog has an odd number of entries, then the first entry in a second blog will start as even, when I want it to start at odd.  {% for blog in blogs %}   {% for entry in blog.entries %}     &lt;div class="{% cycle 'odd' 'even' %}" id="{{entry.id}}"&gt;       {{entry.text}}     &lt;/div&gt;   {% endfor %} {% endfor %}   I've tried obviating this by patching with the resetcycle tag offered here:    to no avail.  (The code didn't work for me.)  I've also tried moving my inner loop into a custom tag, but this also did not work, perhaps because the compile/render cycle moves the loop back into the outer loop?  (Regardless of why, it didn't work for me.)  How can I accomplish this simple task!?  I'd prefer not to create a data structure in my view with this information pre-compiled; that seems unnecessary.  Thanks in advance.
Let $f:[0,\infty)\rightarrow [0,\infty) $ be a continuous strictly increasing function and $g=f^{-1}$. Let $a,b&gt;0$ and $a\neq b$. Then how $\displaystyle\int_{0}^af(x)dx+\int_0^bg(y)dy\geq ab.$ Any hint will be appreciated. I need to calculate the Cramer Rao lower bound of variance for the parameter $\theta$ of the distribution $$f(x)=\frac{1}{\pi(1+(x-\theta)^2)}$$   How do I proceed I have calculated $$4 E\frac{(X-\theta)^2}{1+X^2+\theta^2-2X\theta}$$  Can somebody help Showing just color ramp in legend without values Crash adding comment How to prove $\text{Rank}(AB)\leq \min(\text{Rank}(A), \text{Rank}(B))$? How to prove $\text{Rank}(AB)\leq \min(\text{Rank}(A), \text{Rank}(B))$? Does there exist a surjective homomorphism from $(\mathbb R,+)$ to $(\mathbb Q,+)$ ? Does there exist a surjective homomorphism from $(\mathbb R,+)$ to $(\mathbb Q,+)$ ?  ( I know that there 'is' a   'surjection' , but I don't know whether any surjective homomrophism from $\mathbb R$ to $\mathbb Q$ exist or not . Please help . Thanks in advance ) Cyclic vectors in a real vector space Let $V$ be an n-dimensional vector space over $\mathbb{R}$ and $T:V \rightarrow V$ be linear. Call a vector $v \in V$ cyclic if $V$ is spanned by $\{v, \ Tv, \ T^2v,..\}$.  Question:  Show that $v$ is cyclic for $T$ then there is some $k \geq 1$ such that   $$B=\{v, \ Tv,..T^{k-1}v \}$$ is linearly independent in $V$ and that $T^kv$ lies in  the span of $B$.  Thoughts:  If we suppose that no such $k$ exists, then every subset of the form $\{v, \ Tv,..T^{l-1}v \}$ is linearly dependent, or it is linearly dependent with $T^lv$ not lying in it span.  There are in effect then two cases to consider.  Suppose every subset of the form $\{v, \ Tv,..T^{l-1}v \}$ is linearly dependent. Then $T^{l-1}$ can be expressed as a linear combination of $v,...,T^{l-2}v$. Now, $\{v, \ Tv,..T^{l-2}v \}$ is also linearly dependent by assumption and so we can express $T^{l-2}$ as a linear combination of  $v,...,T^{l-3}v$ etc... Continuing in this way, we show that $T^{l-1}v= \lambda v$ for some $\lambda \in \mathbb{R}$. Thus $$B=\{ \mu v \ | \ \mu \ \text{is an eigenvalue of} \ T^mv \ \text{for some} \ m \}$$ This is 'at best' countably infinite, and therefore could not span $V$ even if it were 1-dimensional, wince our base field is $\mathbb{R}$, which is uncountable.  Suppose then that $B$ is linearly independent for some $k$ but that $T^kv$ does not lie in its span. I can't see how to progress this argument.  Note: This question is for second year Undergraduates, and I think there must be some more simple approach; even the first part surprises me if we need to argue using the uncountability of $\mathbb{R}$, so any alternative approaches are also appreciated. How can I embed a view inside a content of a node in Drupal 8?   I found something similar, for example in the question about "" or the  module, but it is all for Drupal 7.  I tried with an Entity reference field pointing to a View but it display only a label and from the Manage Display tab I can choose only from Label and Entity ID. I need something like the "Rendered entity" option that is present on Entity reference fields pointing to other nodes. Redirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted to Know About mod_rewrite Rules but Were Afraid to Ask This is a  about Apache's mod_rewrite.   Changing a request URL or redirecting users to a different URL than the one they originally requested is done using mod_rewrite. This includes such things as:   Changing HTTP to HTTPS (or the other way around) Changing a request to a page which no longer exist to a new replacement. Modifying a URL format (such as ?id=3433 to /id/3433 ) Presenting a different page based on the browser, based on the referrer, based on anything possible under the moon and sun. Anything you want to mess around with URL   Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask!  How can I become an expert at writing mod_rewrite rules?   What is the fundamental format and structure of mod_rewrite rules? What form/flavor of regular expressions do I need to have a solid grasp of? What are the most common mistakes/pitfalls when writing rewrite rules? What is a good method for testing and verifying mod_rewrite rules? Are there SEO or performance implications of mod_rewrite rules I should be aware of? Are there common situations where mod_rewrite might seem like the right tool for the job but isn't? What are some common examples?   A place to test your rules  The  web site is a great place to play around with your rules and test them. It even shows the debug output so you can see what matched and what did not. Find the determinant of the following matrix biblatex, authoryear style: In-text citations display first name initials for certain bibliography entries $\sum_{i=1}^n(a_i)\sum_{i=1}^n(\frac{1}{a_i})\ge n^2$ is what I want to prove, where $a_i&gt;0$ and I need to showwhen equality holds.  I have tried using Cauchy-Schwarz, where inside the sums I multiply each value by 1 to do it but it doesn't work out.  I have also done  $\sum_{i=1}^n(a_i)\sum_{i=1}^n(\frac{1}{a_i})=\sum_{i=1}^n \sum_{i=1}^n(\frac{a_i}{a_i})=\sum_{i=1}^n\sum_{i=1}^n(1)=\sum_{i=1}^n(n)=n^2$, but this proves an equality.  Am I not allowed to do the first step I did in my work? What is the difference between $* and $@? Consider the following code:  foo () {     echo $* }  bar () {     echo $@ }  foo 1 2 3 4 bar 1 2 3 4   It outputs:     1 2 3 4       1 2 3 4   I am using Ksh88, but I am interested in other common shells as well. If you happen to know any particularity for specific shells, please do mention them.  I found the follwing in the Ksh man page on Solaris:     The meaning of $* and  $@  is   identical  when  not  quoted  or  when  used  as a parameter   assignment value or as a file name. However, when used as  a   command argument, $* is equivalent to ``$1d$2d...'', where d   is the first character of the IFS variable,  whereas  $@  is   equivalent  to  $1 $2 ....   I tried modifying the IFS variable, but it doesn't modify the output. Maybe I'm doing something wrong? How to list all installed packages I'd like to output a list of all installed packages into a text file so that I can review it and bulk-install on another system.  How would I do this? I don't have administrator account on my mac On my mac I have 2 accounts and the both are normal account. So in this moment I don't have a Administrator account, only one that was in the past a administrator, but now is not.  How I can have again a Administrator account? Pre & post increment operator behavior in C, C++, Java, & C# How to find users by name I have a whole bunch of people I would love to follow or at least check out on Stack Overflow. I know them from places like Github as well as personal friends. However I am having a really hard time finding them even though I know e.g. their Gmail address and that they use OpenID via Gmail to login and their full name.   How come this is so painful? Note that I don't want to have to fuzz around with the data explorer just to find a friend of mine on Stack Overflow. What am I missing? Is it just not there or just not working properly? Local explanation of the Aharonov-Bohm effect in terms of force fields Here is an interesting paper for the Physics SE community:      On the role of potentials in the Aharonov-Bohm effect. Lev Vaidman. .  [quant-ph].   You should check it out because it's an amusing read, but I will summarise the argument to whet your appetite, assuming you have basic familiarity with the . In the traditional AB setup, one considers an electron in a superposition of paths, taking it in two opposite directions around a solenoid treated as a classical source of the electromagnetic field. The observable relative phase acquired between the electron's paths is attributed to the influence of the magnetic vector potential on the electron, which cannot be globally gauged away - despite the absence of a physical field anywhere along the electron's path(s) - due to a topological obstruction.  Instead, Vaidman considers the effect of the electron on the sources of the field, treating the latter as quantum particles. He shows that the relative phase between the two branches of the wavefunction can be considered as arising from the action of the physical field of the electron, which is not zero at the position of the sources. However, Vaidman uses highly contrived gedankenexperiments and completely semi-classical arguments, which begs a pair of concrete and related questions.  1) Can Vaidman's first, electric AB effect gedankenexperiment be described in a fully quantum manner, by solving (at least approximately) the three-particle Schroedinger equation? If not, why not?  2) Is it possible to explain within this formalism the experiments of Tonomura et al. (), who used a superconductor to completely shield the magnetic field of the source? Open Mapping Theorem: counterexample The Open Mapping Theorem says that a linear continuous surjection between Banach spaces is an open mapping. I am writing some lecture notes on the Open Mapping Theorem. I guess it would be nice to have some counterexamples. After all, how can you appreciate it's meaning without a nice counterexample showing how the conclusion could fail and why the conclusion is not obvious at all.  Let $\ell^1 \subset \mathbb{R}^\infty$ be the set of sequences $(a_1, a_2, \dotsc)$, such that $\sum |a_j| &lt; \infty$. If we consider the $\ell^1$ norm $\|\cdot\|_1$ and the supremum norm $\|\cdot\|_s$, then, $(\ell^1, \|\cdot\|_1)$ is complete, while $(\ell^1, \|\cdot\|_s)$ is not complete.  In this case, the identity $$   \begin{array}{rrcl}     \mathrm{id}:&amp; (\ell^1, \|\cdot\|_1)&amp; \to &amp;(\ell^1, \|\cdot\|_s)     \\                 &amp; x &amp; \mapsto &amp; x   \end{array} $$ is a continuous bijection but it is not open.  I want a counterexample in the opposite direction. That is, I want a linear continuous bijection $T: E \to F$ between normed spaces $E$ and $F$ such that $F$ is Banach but $T$ is not open. This is equivalent to finding a vector space $E$ with non-equivalent norms $\|\cdot\|_c$ and $\|\cdot\|_n$, such that $E$ is complete when considered the norm $\|\cdot\|_c$, and such that $$   \|\cdot\|_c   \leq   \|\cdot\|_n. $$ The Open Mapping Theorem implies that $\|\cdot\|_n$ is not complete.  So, is anyone aware of such a counterexample? I have several hundred Illustrator files that are formatted similarly, and for legal reasons I need to replace a font in all of them. Even with the 'Find font' tool, that's a hell of a lot of fonts to replace by hand.  Is there some way of automating it? For example, using Bridge? Illustrator (CS5) doesn't offer many options in Bridge, compared to the automation options offered by Photoshop. I also don't see any option for running actions on multiple Illustrator files.  Also, creating a repeatable action for replacing the font doesn't seem to work: instead of repeating my action, it brings up the dialog box an waits for me to tell it to replace them.  As a programmer I'm prepared to edit the files directly if it can be done without breaking them.    Update: The 'Batch...' menu item from Illustrator's actions panel menu allows the same action to be performed on a folder of files. It doesn't fix the Find Fonts action waiting for input though. Toggling the dialog off makes the action do nothing at all.