I'm trying to insert a certain number of indentations before a string based on an items depth and I'm wondering if there is a way to return a string repeated X times.  Example:  string indent = "---"; Console.WriteLine(indent.Repeat(0)); //would print nothing. Console.WriteLine(indent.Repeat(1)); //would print "---". Console.WriteLine(indent.Repeat(2)); //would print "------". Console.WriteLine(indent.Repeat(3)); //would print "---------".
What it's the best way to generate a string of \t's in C#  I am learning C# and experimenting with different ways of saying the same thing.    Tabs(uint t) is a function that returns a string with t amount of \t's  For example Tabs(3) returns "\t\t\t"  Which of these three ways of implementing Tabs(uint numTabs) is best?  Of course that depends on what "best" means.     The LINQ version is only two lines, which is nice.  But are the calls to Repeat and Aggregate unnecessarily time/resource consuming? The StringBuilder version is very clear but is the StringBuilder class somehow slower? The string version is basic, which means it is easy to understand.   Does it not matter at all?  Are they all equal?   These are all questions to help me get a better feel for C#.     private string Tabs(uint numTabs) {     IEnumerable&lt;string&gt; tabs = Enumerable.Repeat("\t", (int) numTabs);     return (numTabs &gt; 0) ? tabs.Aggregate((sum, next) =&gt; sum + next) : "";  }    private string Tabs(uint numTabs) {     StringBuilder sb = new StringBuilder();     for (uint i = 0; i &lt; numTabs; i++)         sb.Append("\t");      return sb.ToString(); }    private string Tabs(uint numTabs) {     string output = "";     for (uint i = 0; i &lt; numTabs; i++)     {         output += '\t';     }     return output;  }
Is $\frac{1}{\sqrt{2}}$ a fraction or not? Installing from source. How to resolve dependencies without destroying the package manager Cannot Buy Land in Falkreath I have a Dell Inspiron 1525 laptop and I am planning on purchasing a mac mini, new version , I am tight on money for a while and want to use my current laptop screen as monitor for mac mini, I just want to know if it is at all possible to do, I have windows 7 and ubuntu 11.04 installed in my laptop, and I don't really care if need to wipe them out, or purchasing a monitos is the only option left, also I am planning to use it for coding and stuff, so VNC is probably not a good choice. Extract information from a text file What focal length or range of focal lengths are usually used for portraits?   What is used by professionals? Why would one select a certain focal length? What are the advantages and disadvantages of different choices, and are there certain situations where an unusual choice might be better? Series Summation,Convergence I am stuck on the 4 th one.I have done the rest.I have found out the value of a_n.But not getting how to proceed for the 4 th one. Solve $z^2+|z|=0$ Solve for $z$: $$z^2+|z|=0$$ I found this question on my textbook but I unable to derive an answer to it as a modulus of $z$ is present. I am unable to take an approach please guide me ..thanks Analysing Bounce Rate and Time on Page Dirac's remark that inspired Feynman when formulating path integral When Feynman was trying to formulate  of quantum mechanics, he was inspired by Dirac's remark which roughly states that $e^{i\frac{S}{\hbar}}$corresponds to the transition amplitude, where $S$ is the action.   I'm wondering what was Dirac's original argument behind this statement. Does GCM (or GHASH) only provide 64-bit security against forgeries? In a  a doubt was voiced about my answer, which claims GCM to requires $2^{128}$ for a successful forgery. The doubt was that the square root needs to be taken meaning the security would be $2^{64}$.  So of course I immediately checked the relevant security theorem ():  $$\mathbf{Adv}^{\text{auth}}_{\operatorname{GCM}[\operatorname{Perm}(n),\tau]}(\mathcal A)\leq \frac{0.5(\sigma+q+q'+1)^2}{2^n}+\frac{q'(\ell_A+1)}{2^\tau}$$  with $\sigma$ being the total plaintext size in blocks, $q$ being the total number of encryption queries, $q'$ being the total number of decryption queries, $n$ being the size in bits of the underlying permutation, $\ell_A$ being maximum authenticated input length in blocks and $\tau$ being the tag size in bits.  Now clearly from this we can see that performing $2^{n/2}=2^{64}$ queries yields a strong enough advantage for a break.  Now my question is: When talking about "n-bits of security" or "needs $2^n$ operations to break", do we usually talk about "online" security, ie queries to an oracle can be done and cost $1$ or "offline" security where no oracles are available or do we need to make this decision depending on the situation?  TL;DR: Does GCM offer 64 or 128 bit security? Can misused Schema.org hurt SEO? I've inherited a site where I noticed that    there is an excessive use of Schema.org in all navigation elements pages describing products are marked as itemtype="http://schema.org/CreativeWork"   So I'm wondering if these tags are sending the wrong message and not truly optimized. I realize that the nav (1) is done in some themes, but I'm more worried about (2). Can it be a hit SEO-wise to mislabel pages instead of products? Space which is connected but not path-connected Let $G$ pe a $p$ group. I have to show that         the number of nonnormal subgroups is divisible by $p$       the number of subgroups differs from the number of normal subgroups by a power of $p$.   Are there any theorem that can help me to prove this ? We have discussed the Sylow theorems but I don't know how to apply them - if those are the theorems I need. (Does this theorem also hold for infinite groups $G$ ?) Is color undefined I want to check whether a color has been previously defined, consider the below code which doesn't execute.  \documentclass{article}  \usepackage{xcolor} \newcommand{\colorprovide}[2]{\ifx\undefined{#1}\colorlet{#1}{#2}\fi}  \begin{document}     %Initial Definition     \colorprovide{mycolor}{red}     \textcolor{mycolor}{Test 1}      %Will overwrite     \colorlet{mycolor}{green}     \textcolor{mycolor}{Test 2}      %Should NOT overwrite as it exists     \colorprovide{mycolor}{red}     \textcolor{mycolor}{Test 3} \end{document}   In other words and analogous to \providecommand{...} not renewing an existing command if it exists, I need a macro which will will NOT redefine a color if the color has already been defined.  The above code throws an error as the logical checking part \ifx\undefined... is incorrect. Does Gollum know that others call him Gollum? Is $\langle1-i\rangle$ a maximal ideal in $\mathbb{Z}[i]$? I'm trying to show that $\langle1-i\rangle$ is a maximal ideal of $\mathbb{Z}[i]$.  I started by assuming there is some ideal $A$ that properly contains $\langle1-i\rangle$, and then I want to show that $1 \in A$, and then I will have that $A= \mathbb{Z}[i] $, so $\langle1-i\rangle$ is maximal.  Is this the right approach?  Thanks  Second Attempt: Because $\forall a+bi \in \mathbb{Z}[i]$, we have $a+bi = (a+b) -b(1-i)$, then we have $a+bi - (a+b) = -b(1-i) \in \langle1-i\rangle$, which implies $a+bi +\langle1-i\rangle = a+b +\langle1-i\rangle$.  So every coset is of the form $c +\langle1-i\rangle$, where $c\in \mathbb{R}$.  Furthermore, $-i(1-i)^2=2 \in \langle1-i\rangle$. Write $c = 2q + r$, where $q,r\in \mathbb{R}$ and $r=0,1$.  Then because $2 \in \langle1-i\rangle$, we have $2q\in \langle1-i\rangle$ and therefore $2q= 2q+r-r = c-r\in \langle1-i\rangle$, so $c+\langle1-i\rangle = r+\langle1-i\rangle$, and every coset is of the form $0 + \langle1-i\rangle$ or $1 +\langle1-i\rangle$. Thus, $1 +\langle1-i\rangle$ is the only nonzero element, and is invertible with itself as its inverse.  Thus, $\mathbb{Z}[i]/\langle1-i\rangle$ is a field with two elements, and by a theorem, $\langle1-i\rangle$ must be maximal.  Is this correct? Let $X$ be topological space and $A\subseteq X$.   If $E\subseteq X$ is connected, $E\cap A\neq\emptyset$ and $E\cap(X\setminus A)\neq\emptyset$ then $E\cap\partial A\neq\emptyset$.  Assume that $E\cap\partial A=\emptyset$.  If $E\cap\partial A=\varnothing$ then $E=(E\cap\text{int}(A))\cup(E\cap\text{ext}(A))$, i.e. a union of disjoint sets open in $E$.   Also the sets are nonempty because: $E\cap\text{int}(A)=E\cap A\neq\varnothing$ and $E\cap\text{ext}(A)=E\cap A^c\neq\varnothing$.  This contradicts that $E$ is connected.  Fixed. To prove $\left|\frac{p_n(z)}{q_m(z)}\right|\leq \frac{M}{|z|^{m-n}}$ for some $M>0$ I would like to typeset the top part of Pascal's triangle. To get the triangle with the names of the binomial coefficients, i.e., {n \choose k}, I used the following code  \begin{tikzpicture} \foreach \n in {0,...,4} {   \foreach \k in {0,...,\n} {     \node at (\k-\n/2,-\n) {${\n \choose \k}$};   } } \end{tikzpicture}   The result is this   Now I want to be equally lazy and do something like this for the values of the binomial coefficients, i.e., replace {\n \choose \k} in the node label with \CalculateBinomialCoefficient{\n}{\k} where \CalculateBinomialCoefficient is a hypothetical macro that calculates the binomial coefficient. Has anyone done something like that?  The result should look like this: