I wrote a simple program in Cpp but I have no idea what is the best approach to test this? Is there a certain format for unit testing like in Java?   #include &lt;iostream&gt; #include &lt;sstream&gt; #include &lt;string&gt; #include &lt;algorithm&gt; #include &lt;vector&gt;  using namespace std; static vector&lt;int&gt; getAllFlipLocations(         vector&lt;int&gt; &amp; pancakesRepresentedByDiameter);  /**  * Problem statement can be viewed at:  * http://www.programming-challenges.com/pg.php?page=downloadproblem&amp;probid=110402&amp;format=html  *  * The following is a solution for the above problem.  *  * @author Quinn Liu (quinnliu@vt.edu)  */ int main(void) {     string stackOfPancakes;      while (getline(cin, stackOfPancakes)) {         istringstream is(stackOfPancakes);          vector&lt;int&gt; pancakesRepresentedByDiameter;          int diameterOfPancake;         while (is &gt;&gt; diameterOfPancake) {             pancakesRepresentedByDiameter.push_back(diameterOfPancake);         }         reverse(pancakesRepresentedByDiameter.begin(),                 pancakesRepresentedByDiameter.end());          vector&lt;int&gt; orderOfFlipLocations = getAllFlipLocations(                 pancakesRepresentedByDiameter);          // first print original stack of pancakes         cout &lt;&lt; stackOfPancakes &lt;&lt; endl;          // now print location within stack to flip pancakes to get a stack         // of pancakes where the pancake diameters decrease as they move         // from the bottom to the top         for (int i = 0; i &lt; orderOfFlipLocations.size(); i++) {             if (i != 0) {                 cout &lt;&lt; ' ';             }             cout &lt;&lt; orderOfFlipLocations[i];         }         cout &lt;&lt; endl;     } }  /**  * Return the order of the locations to flip pancakes in the pancake stack.  */ vector&lt;int&gt; getAllFlipLocations(vector&lt;int&gt; &amp;pancakesRepresentedByDiameter) {     vector&lt;int&gt; orderOfFlipLocations;      vector&lt;int&gt;::iterator beginIndex = pancakesRepresentedByDiameter.begin();     vector&lt;int&gt;::iterator endIndex = pancakesRepresentedByDiameter.end();      for (int i = 0; i &lt; pancakesRepresentedByDiameter.size(); i++) {         vector&lt;int&gt;::iterator currentIndex = beginIndex + i;         vector&lt;int&gt;::iterator maximumIndex = max_element(currentIndex,                 endIndex);          // iterate through the stack of pancakes         if (currentIndex != maximumIndex) {              if (maximumIndex + 1 != endIndex) {                 // adds value of (maximumIndex - beginIndex + 1) to the end of the vector                 orderOfFlipLocations.push_back(maximumIndex - beginIndex + 1);                 reverse(maximumIndex, endIndex);             }             orderOfFlipLocations.push_back(i + 1);             reverse(currentIndex, endIndex);         }     }     orderOfFlipLocations.push_back(0);     return orderOfFlipLocations; }
I'm working on a large c++ system that is has been in development for a few years now. As part of an effort to improve the quality of the existing code we engaged on a large long-term refactoring project.  Do you know a good tool that can help me write unit tests in C++? Maybe something similar to Junit or Nunit?  Can anyone give some good advice on the methodology of writing unit tests for modules that were written without unit testing in mind?
What is the benefit of launching a satellite "a few days before the monthly report" I've seen this hint in the game as well as on this site and I've been wondering if there is any specific advantage to launching satellites closer to the monthly report rather than any time during that month.  The way I see it, monthly maintenance costs are taken out during the reports (correct me if i'm wrong), so regardless of when you launch it during the month it would cost the same.   Is the benefit of holding on to them longer simply a safety net in case some countries go into the red during that time? Another form of the question is: will joining two diodes with wires (pn-np) make a transistor-equivalent?  I read that they are not equivalent, but why? The process substitution output is out of the order My impression for how Poincare and Lorentz representations are linked in $3+1$ dimensions is:   Assuming positive mass for simplicity, irreducible representations of the Poincare group are indexed by their mass $M$ and spin $s$. Irreducible representations of the Lorentz group are indexed by two numbers $(s_1, s_2)$ and when restricted to the rotation subgroup contains spins from $|s_1 - s_2|$ up to $s_1 + s_2$ in integer steps. Particles transform in representations of the Poincare group, while fields transform in representations of the Lorentz group. They are related by defining $$|\mathbf{p}, \lambda \rangle = a^\dagger(\mathbf{p}, \lambda) |0 \rangle$$ where $\lambda$ is the helicity, and the field is defined in terms of the creation and annihilation operators in the usual way. The only requirement is that the Lorentz representation used for the field contains the spin $s$ used in the Poincare irrep. A relativistic wave equation is imposed to eliminate the unwanted degrees of freedom.   For example, a massive spin $1$ particle may be embedded in a vector field, which is in the $(1/2, 1/2)$ irrep of the Lorentz group. This vector field has one extra degree of freedom that is eliminated by the equation $\partial_\mu A^\mu = 0$.  Assuming this is right, I'm wondering why I've never heard of "alternative" embeddings. For instance, why can't one embed a spin $1$ particle inside the $(1, 0)$ irrep, which doesn't have any extra degrees of freedom at all, or inside the $(1, 1)$ irrep? For massive particles, I've only ever seen spin $0$ in $(0, 0)$, spin $1/2$ in $(1/2, 0) + (0, 1/2)$, and spin $1$ in $(1/2, 1/2)$. Are other embeddings very clunky, or not allowed, or are they actually used somewhere? Where is the New Oxford American Dictionary stored? Whoever or whomever: 'happy for ___ has the pleasure of working with you next.' So sad to lose you, yet happy for whomever has the pleasure of working with you next. I have never used Ubuntu or any other Linux OS before last Friday. For all I know, I might have installed Ubuntu wrong and be missing a component. I would prefer if you use simplest terminology possible, but I'm OK with doing a bit of googling if need be. I just installed Steam for Ubuntu 16.04 but it won't open when I click on it in the launcher. The icon flashes for a few seconds, stops and then nothing happens. I looked in the system monitor and steam shows up there but ending the process and trying again does nothing. I heard trying to open apps that aren't working through the terminal tells you what the error is so I tried that and I got this:  Running Steam on ubuntu 16.04 64-bit STEAM_RUNTIME is enabled automatically Installing breakpad exception handler for appid(steam)/version(0) libGL error: unable to load driver: radeonsi_dri.so libGL error: driver pointer missing libGL error: failed to load driver: radeonsi libGL error: unable to load driver: swrast_dri.so libGL error: failed to load driver: swrast   Please help I just want to play CS:GO again. Can we have the table name as "option" in MySQL? I am very, very new to MYSQL.I tried to create a table named "option". My SQL Query is :  create table option(   id int not null primary key auto_increment,  choice varchar(30)  )  While executing this query it shows the following error  Error Code : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'option( id int not null primary key auto_increment, choice varchar(30) )' at line 1 (0 ms taken)  If I try with the table name as "choice" it is working.  can we have the table name as "option" in mysql?   thanks How to unit test an object with database queries I've heard that unit testing is "totally awesome", "really cool" and "all manner of good things" but 70% or more of my files involve database access (some read and some write) and I'm not sure how to write a unit test for these files.  I'm using PHP and Python but I think it's a question that applies to most/all languages that use database access. How to compare two time series? I have collected temperature readings for 4 locations on a beach in Cornwall UK using data loggers. The loggers recorded temperature every 15 mins accurate to .1 of a degree (Celsius). The loggers collected data for 10 days with a one day break to calibrate the sensors. In total I used 30 sensors with 6-7 sensors in each position.  I have now downloaded the data and have produced time-series for temperature over the 10 day period. Visual inspection of the time-series shows how the temperature changes with tides and night and day. I want to investigate whether the time-series differ significantly from one another. Please could someone point me in the direction of a technique to do this in SPSS? What is the best way to implement constants in Java? I've seen examples like this:   public class MaxSeconds {    public static final int MAX_SECONDS = 25; }   and supposed that I could have a Constants class to wrap constants in, declaring them static final. I know practically no Java at all and am wondering if this is the best way to create constants. One thing I've noticed about the relatively new sitewide layout is that I can't find a quick way to get back to www.stackexchange.com without finding StackExchange in the sites list. As a result, I am typing stackexchange in my toolbar a whole lot more often now. In particular, I tend to enjoy browsing the hot questions list and my own personal feed quite often so visit these pages on a daily basis. Is there an easy link to them that I'm missing?  (On the android app, there is a feed in the menu that I really appreciate, something like that on the desktop would be ideal!) Where in the DNS process are NS records used? I register a new domain, mynewdomain.com, at a hosting company.   In the advanced DNS settings there is an A record which maps mynewdomain.com to a ip address.  In my webhost control panel, it shows me the nameservers for the domain: ns1.mywebhost.net &amp; ns2.mywebhost.net  When I type in mynewdomain.com into a browser and hit enter I believe the following happens.   ISP resolver searches "." nameserver ISP resolver then told to search ".com" nameserver instead. ISP resolver finds mynewdomain.com, and searches the zone file to get the A record.     So my question is, where does my webhost's nameservers come into play? I believe the flaw in my logic comes from the fact that my zone file (in which the A record is kept) is stored on ns1.mywebhost.net). But if that is the case, how does my ISP resolver know to look here? (because I didn't type this into my address bar) Cloning a Non-Standard Svn Repository with Git-Svn $\mathbb{R}P^4$ and $\mathbb{R}P^6$ do not admit fields of tangent $2$-planes See the related question . This is the second part of question 4-C in Milnor and Stasheff's book on characteristic classes. In the solution to the first part, we rely on the fact that having a field of tangent $1$-planes allows us to split the tangent bundle into a direct sum. It doesn't seem like this should be true for a field of tangent $2$-planes (otherwise the question wouldn't just be asking about $P^4$ and $P^6$), so I'm not sure exactly where to start.  edit: actually, since $P^n$ can be given a Riemannian metric, any subbundle should be a Whitney summand; this doesn't answer the question as to why they only ask for $P^4$ and $P^6$ though, so I'm still confused. The Pauli group for $n$-qubits is defined as $G_n=\{I,X,Y,Z \}^{\otimes n}$, that is as the group containing all the possible tensor products between $n$ Pauli matrices. It is clear that the Pauli matrices form a basis for the $2\times 2$ complex matrix vector spaces, that is $\mathbb{C}^{2\times 2}$. Apart from it, from the definition of the tensor product, it is known that the $n$-qubit Pauli group will form a basis for the tensor product space $(\mathbb{C}^{2\times 2})^{\otimes n}$.  I am wondering if the Pauli group in $n$-qubits forms a basis for the complex vector space where the elements of this tensor product space act, that is $\mathbb{C}^{2^n\times 2^n}$. Summarizing, the question would be, is $(\mathbb{C}^{2\times 2})^{\otimes n}=\mathbb{C}^{2^n\times 2^n}$ true?  I have been trying to prove it using arguments about the dimensions of both spaces, but I have not been able to get anything yet. If a company is bought by another company, does my stock rollover to the new company when it is combined with the new parent company? Choosing Geographical Coordinate System and Projected Coordinate System for India? I want to create spatial data for entire India.  Usually I use WGS84 as GCS and UTM zones for PCS in the places in India, but when I have to create the spatial data for entire India, I get confused which geographical coordinate systems and projected coordinate system will be suitable.  What are suitable ones? Given a Lie group, how are you meant to find its Lie algebra?  The Lie algebra of a Lie group is the set of all the left invariant vector fields, but how would you determine them?  My group is the set of all affine maps $x \rightarrow A.x+v$ from $R^n$ to $R^n$ under function composition. Using jQuery, how do I change the elements html value? (div) Using a ajax request I want to change content of my div.  &lt;div id="d1"&gt;202&lt;/div&gt;   So I want to change the content to a different number.  $('d1').InnerText???   Also, say I wanted to increment the number, how could I do that? Do I have to convert to int?