templates  C++
What does template  mean?
I have the following code that will remove lines with the pattern banana and 2 lines after it:  sed '/banana/I,+2 d' file   So far, so good! But I need it to remove 2 lines before banana, but I can't get it with a “minus sign” or whatever (similar to what grep -v -B2 banana file should do but doesn't):  teresaejunior@localhost ~ &gt; LC_ALL=C sed '-2,/banana/I d' file sed: invalid option -- '2' teresaejunior@localhost ~ &gt; LC_ALL=C sed '/banana/I,-2 d' file sed: -e expression #1, char 16: unexpected `,' teresaejunior@localhost ~ &gt; LC_ALL=C sed '/banana/I,2- d' file sed: -e expression #1, char 17: unknown command: `-' I'm a C++ newbie, but I wasn't able to find the answer to this (most likely trivial) question online.  I am having some trouble compiling some code where two classes include each other.  To begin, should my #include statements go inside or outside of my macros?  In practice, this hasn't seemed to matter.  However, in this particular case, I am having trouble.  Putting the #include statements outside of the macros causes the compiler to recurse and gives me "#include nested too deeply" errors.  This seems to makes sense to me since neither class has been fully defined before #include has been invoked.  However, strangely, when I try to put them inside, I am unable to declare a type of one of the classes, for it is not recognized.  Here is, in essence, what I'm trying to compile:  A.h  #ifndef A_H_ #define A_H_  #include "B.h"  class A {     private:         B b;      public:         A() : b(*this) {} };  #endif /*A_H_*/   B.h  #ifndef B_H_ #define B_H_  #include "A.h"  class B {     private:             A&amp; a;      public:         B(A&amp; a) : a(a) {}  };  #endif /*B_H_*/   main.cpp  #include "A.h"  int main() {     A a; }   If it makes a difference, I am using g++ 4.3.2.  And just to be clear, in general, where should #include statements go?  I have always seen them go outside of the macros, but the scenario I described clearly seems to break this principle.  Thanks to any helpers in advance!  Please allow me to clarify my intent if I have made any silly mistakes! Allowed Wave Functions of System Given a single-particle system with Hamiltonian $H$, what constraints can be put on the wave function at a particular point in time $\psi(x)$? Of course $\psi(x)$ must obey boundary conditions given by $H$. However, in situations where $H$ does not yield strict boundary conditions (e.g. the harmonic oscillator) can $\psi(x)$ be any normalised function? My intuition says no for the following reason: QM textbooks say that any valid wave function can be represented as a linear combination of the eigenstates of $H$. In the case of the harmonic oscillator, the eigenstates of $H$ are a countably infinite set. However the set of all normalised functions is uncountably infinite. It seems to me that one cannot change between one complete set of basis functions to another and reduce the "dimensionality" somehow. This makes me think that the eigenstates of $H$ are not complete, that they imply some constraints on $\psi(x)$. This is not an area of mathematics that I understand well. Can somebody help me out? $$\lim_{n \to\infty} \frac{n!}{n^n}$$  I have a question: is it valid to use Stirling's Formula to prove convergence of the sequence? Display header and footer in all PDF pages using VF My vf page     &lt;apex:page renderAs="pdf" Controller="testpdf1"&gt;     &lt;head&gt;         &lt;style type="text/css" media="print"&gt;             @page              {                 size: 8.5in 11in;/* width height */             }              @page              {                 @top-center                  {                     content: element(header);                 }                  @bottom-left                  {                     content: element(footer);                 }             }              div.header              {                 padding: 10px;                 position: running(header);             }              div.footer              {                 display: block;                 padding: 5px;                 position: running(footer);             }              .pagenumber:before              {                 content: counter(page);             }              .pagecount:before              {                 content: counter(pages);             }         &lt;/style&gt;     &lt;/head&gt;      &lt;div class="header"&gt;             &lt;div align="right"&gt;Header&lt;/div&gt;     &lt;/div&gt;      &lt;div class="footer"&gt;         &lt;div&gt;Page &lt;span class="pagenumber"/&gt; of &lt;span class="pagecount"/&gt;&lt;/div&gt;     &lt;/div&gt;      &lt;div class="content"&gt;         &lt;p&gt;             &lt;apex:repeat value="{!opp}" var="item"&gt;                 &lt;tr&gt;                     &lt;td class="tableContent"&gt;{!item.Name}&lt;/td&gt;                 &lt;/tr&gt;             &lt;/apex:repeat&gt;         &lt;/p&gt;     &lt;/div&gt; &lt;/apex:page&gt;   Controller  public class testpdf1 {     public list&lt;Account&gt; opp{get;set;}      public testpdf1()     {         opp=[SELECT Name  from Account limit 50];     } }   I am getting all records in pdf format but able to get header in first page only and i am not getting header from second pages how can i display header to all pages. How to delete specific lines from a txt file I have a Bash script that writes data into a log file, then from that I take out stuff I want using the sed command. That gives me a file data.txt. What I want to know is how I go about deleting specific line inside that data.txt file.  For example:  123 456 789   I want to remove the 2nd line, containing 456 so that I only have  123  789   I tried with sed '2d' data.txt but it doesn't work.  I use this command to create data.txt from log.log:  sed -nE '1s/.{1}(.{2}).*/\1/p;' log.log &gt;&gt; data.txt Any good tutorials for learning how to post-process images? I don't really know where to start with post-processing my images. I normally just straighten, crop and sharpen. Do people know of any good resources on the internet for getting a grip with Photoshop and similar tools? I'm trying to create a multi-page table with all cells having the same height (as well as certain fixed widths) so that certain manual cut-and-paste operations are a lot easier.  One issue is that one column in particular is text-heavy and should line-break within the cell.  As I don't want it justified, I looked into alternatives such as .  This is doing exactly what I want for horizontal alignment.  For vertical alignment, I've looked at  and the \vphantom method detailed in the above link doesn't seem to be working.  Here's what I'm currently working with:  \documentclass[11pt]{article} \usepackage{array}  \newcolumntype{P}[1]{&gt;{\raggedright\hspace{0pt}\arraybackslash}p{#1}} \def\Z{\vphantom{\parbox[c]{1.7in}{\Huge Something Long}}}  \begin{document} \begin{tabular}{| c || P{0.5in} || P{0.5in} || P{5in} |}\hline  1.  \Z &amp;&amp;&amp; Long long long long long long long long long             long long long long long long long text  \\\hline 2.  \Z &amp;&amp;&amp; More long long long long long long long long             long long long long long long long text  \\\hline \end{tabular}   When I compile, the cells do not have a uniform height, and none of them are as large as 1.7 inches vertically.  So this suggests that somehow the \vphantom method is failing.  Does anybody know of a relatively straightforward solution to this problem? Is it okay to ask a professor from another university for class lecture notes of a course that he offered on that university? I find two very interesting courses that were offered in the Spring 2019 semester at ETH Zürich. Unfortunately, their class lecture notes are not shared publically. I wonder if it is appropriate to email the professors and ask them for class notes. TikZ \foreach loop with macro-defined list "Above"/"below" before/after a noun I have seen sentences similar to the following:  (1) See the reference above. (2) See the reference below.  And,  (3) See the above reference.  But not,  (4) See the below reference.  Are all these forms acceptable? Which is/are preferred in formal writing? A positive polynomial is the sum of two squares in $\mathbb{R}[X]$ Let $P\in\mathbb{R}[X]$ be a positive polynomial.  I want to show that there exists $A,B\in\mathbb{R}[X]$ so that $P=A^2+B^2$    $\displaystyle P=a\prod_{k=0}^q(x-a_k)\prod_{k=0}^{2p}(x-b_k)=a\prod_{k=0}^q(x-a_k)\prod_{k=0}^p(x^2-2\Re(b_k)+|b_k|^2)$ where $a$ is the leading coefficient, $a_k$ are the real rooks, $b_k$ are the complex roots.  What can i do now ? I know that the identity $(a^2+b^2)(c^2+d^2)=(ac-bd)^2+(ad+bc)^2$ should come in handy, but I can't figure out :  1) How to show that the product real roots is a square  2) How to use the above identity for the complex roots.  If I can solve those two points, then I can solve the problem. Do we have different badges in different SE sites Clever bounty reputation hack I say "hack" in the most favorable light. It's a clever idea and theoretically beneficial.  I noticed that an old question of mine suddenly started getting a lot of renewed attention. The question had been answered, with an answer accepted. But another user added a well reasoned and insightful answer to the list. He also opened a +100 bounty on that question.  The resulting increased attention quickly got his answer quite a lot of up-votes. Well more than the 100 points he had spent on the bounty. Therefore, he gets a net rep profit out of the transaction.  So here's the hack:   Find an interesting question Research and provide a very good answer Open up a bounty on that question to attract attention and votes to your new answer Profit!!!   2 and 3 may be out of order--I didn't see the timing of it. But either way, assuming he gets more than 10 votes, he still gets increased rep out of the deal.  I don't think this is necessarily bad for SO - it does generate some useful discussion and insightful answers. Plus you can increase your own rep very rapidly by making your answers highly visible, and therefore frequently voted upon.   However, it does slightly change the meaning and purpose of bounties away from starting a discussion and toward self-promotion. Still, interesting. Dot Product Intuition I'm searching to develop the intuition (rather than memorization) in relating the two forms of a dot product (by an angle theta between the vectors and by the components of the vector ).      For example, suppose I have vector $\mathbf{a} = (a_1,a_2)$ and vector $\mathbf{b}=(b_1,b_2)$.  What's the physical or geometrical meaning that   $$a_1b_1 + a_2b_2 = |\mathbf{a}||\mathbf{b}|\cos(\theta)\;?$$  Why is multiplying $|\mathbf{b}|$ times $|\mathbf{a}|$ in direction of $\mathbf{b}$ the same as multiplying the first and second components of $\mathbf{a}$ and $\mathbf{b}$ and summing ?       I know this relationship comes out when we use the law of cosines to prove, but even then i cant get a intuition in this relationship.  This image clarifies my doubt:    Thanks How can I get dramatic shallow DOF with a kit lens? I'm currently using an entry-level DSLR with 18-55mm lens and having great trouble trying to creating a blurred background effect in my photos. Now matter what aperture or shutter speed I choose, I'm not able to get it.  There's a general question about , but what specific things can I do to get this effect with an entry-level lens? I'm trying to use the ant migration tool to retrieve all the Custom Metadata records for a single Custom Metadata Type.  However, I can't figure out the syntax.  I would think that something like this would work:    &lt;Package xmlns="http://soap.sforce.com/2006/04/metadata"&gt;     &lt;types&gt;         &lt;members&gt;State_Sales_Tax.*&lt;/members&gt;         &lt;name&gt;CustomMetadata&lt;/name&gt;     &lt;/types&gt;     &lt;types&gt;         &lt;members&gt;State_Sales_Tax__mdt&lt;/members&gt;         &lt;name&gt;CustomObject&lt;/name&gt;     &lt;/types&gt;     &lt;version&gt;36.0&lt;/version&gt; &lt;/Package&gt;   but no dice. I posted a question which was closed as off-topic and it seems like it could fit on another site in the network. How can I go about moving it there?   What is migration? When can a question be migrated, and who can migrate it? When should I consider migration, and when is it inappropriate? What causes a migration to be blocked and what happens after? What causes a migration to be rejected and what happens after? Anything else I should know about migration? Can a black hole absorb photons whose wavelengths are greater than the BH horizon size? The recent  about a new supermassive virus being discovered got me thinking about how we define viruses as non-living organisms whilst they are bigger than bacteria, and much more complex than we first gave them credit for.   What biological differences between viruses and cellular organisms have made viruses be deemed non-living?