I found this Python script that prints all permutations of given variables. I am a complete Python newby, but after a few modifications it does almost exactly what I need.   Here is what I got so far:  blocks =  [ "0", "1a", "2a", "2b" ] # variables num_blocks = len( blocks ) num_places = 4  # number of places  for i in range( pow( len( blocks ), num_places ) ):      value = i     indexes = []      while value:             indexes.append( value % num_blocks )         value = value // num_blocks      # print( i + 1 ) # alternatively print number of each permutation      for j in range( len( indexes ), num_places ):         print blocks[ num_blocks - 1 ]      for j in range( len( indexes ) - 1, -1, -1 ):         print( blocks[ num_blocks - 1 - indexes[ j ] ] )      print " "  # add a line break after each entry   The output is  2b 2b 2b 2b  2b 2b 2b 2a   etc.  How can I A) change the output to   2b2b2b2b 2b2b2b2a   etc.  and B) only print occurences that include the last variable, in this case "2b".  For the purpose of this example, I only included four variables: 0, 1a, 2a, 2b. The script prints all possible combinations of these four variables, from 0000 to 2b2b2b2b and anything in between. Is it possible to print only combinations that include the last variable 2b? So for example 2b2a1a0 or 1a1a02b, but not 2a2a1a0 or 2a01a1a? Later on, many more variables will be included (3a, 3b, etc.), but the script shall only list permutations including the last variable.  Thanks in advance!  George  EDITED to clarify second question.
I'd like to do it in Python. What I'd like to do in this example in C: #include &lt;stdio.h&gt;  int main() {     int i;     for (i=0; i&lt;10; i++) printf(&quot;.&quot;);     return 0; }  Output: ..........  In Python: &gt;&gt;&gt; for i in range(10): print('.') . . . . . . . . . . &gt;&gt;&gt; print('.', '.', '.', '.', '.', '.', '.', '.', '.', '.') . . . . . . . . . .  In Python print will add a \n or space, how can I avoid that? Now, it's just an example, don't tell me I can first build a string then print it. I'd like to know how to &quot;append&quot; strings to stdout.
Putting char into a java string for each N characters I several days ago somewhere read that category and tag pages should be noindexed. But later on somewhere else, I read that, they only increase rank for search term, but overall traffic decreases- said one from his experience.  So, if I just concern about traffic, not about individual search term that much, should I make those category and tag pages as indexed to google? I am confused which is the best to do.  Thanks in advance.  Regards Rana Introduction to proofs with a fair amount of hand-holding? For creating the graphics for my thesis (function graphs, flow charts, line art sketches) I've chosen to use the sans serif font by  \renewcommand\familydefault{\sfdefault}    However when I use mathematical symbols like $p_{s}$, they are still typeset in roman font and that looks weird:    So I wonder:   how could I force mathematical expressions also be typeset in \sfdefault if I do, are there any negative sideeffects to expect (with greek signs or other special symbols?) OR should I typeset all "mathematical" graphs (axis labels etc.) in roman font, and only make the other graphics like flow charts and sketches with sans serif font? Remove element of a regular array I have an array of Foo objects. How do I remove the second element of the array?  I need something similar to RemoveAt() but for a regular array. Testing whether two regression coefficients are significantly different (in R ideally) If this is a duplicate question, please point to the right way, but the similar questions I've found here haven't been sufficiently similar. Suppose I estimate the model $$Y=\alpha + \beta X + u$$  and find that $\beta&gt;0$. However, it turns out that $X=X_1+X_2$, and I suspect $\partial Y/\partial X_1 \ne \partial Y / \partial X_2$, and in particular, that $\partial Y/\partial X_1 &gt; \partial Y / \partial X_2$. So I estimate the model $$Y=\alpha + \beta_1 X_1 + \beta_2 X_2 +u$$and find significant evidence for $\beta_1,\beta_2&gt;0$. How can I then test whether $\beta_1&gt; \beta_2$? I considered running another regression $$Y=\alpha +\gamma(X_1 - X_2) + u$$ And testing whether $\gamma&gt;0$. Is this the best way?  Also, I need to generalize the answer to many variables, i.e. suppose we have $$Y=\alpha + \beta^1 X^1 + \beta ^2 X^2 + \dots + \beta^nX^n + u$$ where for each $j=1,\dots,n$, $X^j=X_1^j+X_2^j$, and I would like to test for each $j$ whether $\partial Y/\partial X_1^j \ne \partial Y / \partial X_2^j$.  By the way, I am primarily working in R. How to check if a column exists in a SQL Server table? Distribution of number of Bernoulli trials to a given number of successes Delete commits from a branch in Git Wikipedia entry on likelihood seems ambiguous I have a simple cylinder which is mirrored on both the X and Y axis.  When I scale it along the X axis, the two halves of the cylinder overlap, rather than scale as it would before the mirror modifier was applied:    I haven't used Blender in a while and I know this is a simple fix. Windows service stops automatically Foreign key constraint on array member? How to derive the least square estimator for multiple linear regression? Returning from a finally block in Java I was surprised recently to find that it's possible to have a return statement in a finally block in Java.  It seems like lots of people think it's a bad thing to do as described in ''. Scratching a little deeper, I also found '' which shows some pretty horrible examples of other types of flow control in finally blocks.  So, my question is, can anyone give me an example where a return statement (or other flow control) in a finally block produces better / more readable code? Understanding how references and labels work I'm trying to understand why I cannot effectively reference figures or equations that I have defined with labels.  For example:  \begin{figure}   \label{fig:area_Treasuries}   \caption{Treasuries as a portion of total financial flows.}   \centering   \includegraphics[width=0.75\textwidth]{graphs/Area_Treasuries.png} \end{figure}  \paragraph{} Figure~\ref{fig:area_Treasuries} presents Treasuries (both flowing into and out of the United States) as a share of total financial flows.  From 1985 to 2010, Treasuries account for, on average, 53.2\% of total financial flows.   With the above code, I get this warning:      LaTeX Warning: Reference `fig:area_Treasuries' on page 37 undefined on   input line 477.   The result is "Figure ?? presents Treasuries..."  Why is this happening?  Related, I don't understand why I can't reference, say, an equation before (I mean physically above in the text) the actual equation.  Isn't this what compiling multiple times and cross references is supposed to take care of? It seems that $\{e\}, \{e,s\}, \{e,rs\}, \{e,r^2s\},...,\{e,r^{n-1}s\}, \{e,r,r^2,...,r^{n-1}\}, D_n$ are always subgroups of $D_n$. Especially when $n$ is odd, these seem to be the only subgroups. But when n is even, say $n=4$, then there are also $\{e,s,r^2,r^2s\}$ and $\{e,rs,r^2,r^3s\}$. It makes me wonder, is there a general formula/algorithm for finding all subgroups of $D_n$ when $n$ is even? Run bash script at login stored in the home folder? When I try to load a LaunchAgent plist from launchctl I can't find out how to run a script in the home directory.  My code is:  &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt; &lt;dict&gt;     &lt;key&gt;ProgramArguments&lt;/key&gt;     &lt;array&gt;         &lt;string&gt;bash&lt;/string&gt;         &lt;string&gt;~/script.sh&lt;/string&gt;     &lt;/array&gt;     &lt;key&gt;RunAtLoad&lt;/key&gt;     &lt;true/&gt;     &lt;key&gt;Label&lt;/key&gt;     &lt;string&gt;com.tyilo.test&lt;/string&gt; &lt;/dict&gt; &lt;/plist&gt;   I have tried both with and without bash and also replacing ~ with $HOME. I have also tried using bash -c without it working.  The error code is:   `com.tyilo.test: bash: ~/script.sh: No such file or directory` Proving $\frac{a}{a^2-a+1}+\frac{b}{b^2-b+1}+\frac{c}{c^2-c+1}+\frac{d}{d^2-d+1}\le \frac{8}{3}$ given $a+b+c+d=2$ Let $a,b,c,d\in \mathbb{R}$ and $a+b+c+d=2$. Prove that $$\frac{a}{a^2-a+1}+\frac{b}{b^2-b+1}+\frac{c}{c^2-c+1}+\frac{d}{d^2-d+1}\le \frac{8}{3}.$$   We have $$\frac{a}{a^2-a+1}\le \frac{4}{3}a\Longleftrightarrow \frac{-a\left(2a-1\right)^2}{3\left(a^2-a+1\right)}\le 0,$$ (Right)  So $$LHS\le \frac{4}{3}\left(a+b+c+d\right)=\frac{8}{3}=RHS$$  When $a=b=c=d=\frac{1}{2}$  But also $a=b=c=1;d=-1$ i don't know how to solve it. "died from" versus "died of" Why can't I say “She died from drinking 18 cans of Coca-Cola”? Instead, the correct sentence would be “She died of drinking 18 cans of Coca-Cola”. Why does that happen?