I am very new to unit testing and I am a little confused.  I am trying to do unit testing (using the Boost unit testing framework) on a C++ class called VariableImpl. Here are the details.  class Variable { public:   void UpdateStatistics (void) {     // compute mean based on m_val and update m_mean;     OtherClass::SendData (m_mean);     m_val.clear ();   }   virtual void RecordData (double) = 0;  protected:   std::vector&lt;double&gt; m_val;  private:   double m_mean; };  class VariableImpl : public Variable { public:   virtual void RecordData (double d) {     // put data in m_val   } };   My question is how can I check that the mean is computed correctly? Note that 1) m_mean is protected and 2) UpdateStatistics calls a method of another class and then clears the vector.  The only way I can see would be to add a getter (for instance, GetMean), but I don't like this solution at all, nor I think it is the most elegant.  How should I do?  And what should I do if I were to test a private method instead of a private variable?  TIA,  Jir
How do I unit test (using xUnit) a class that has internal private methods, fields or nested classes? Or a function that is made private by having  (static in C/C++) or is in a private () namespace?  It seems bad to change the access modifier for a method or function just to be able to run a test.
The  asks about functions $f \colon \mathbb R \to \mathbb R$ such that $$f(x+y)=f(x)+f(y).$$ It is a very well-known functional equation, which appears in various areas of mathematics ranging from exercises in freshman classes to constructing useful counterexamples for some advanced questions. Solutions of this equation are often called . Also a few other equations related to this equation are often studied. (Equations which can be easily transformed to Cauchy functional equation or can be solved by using similar methods.) Is there some overview of basic facts about Cauchy equation and related functional equations - preferably available online? Let's start with a definition:     Definition: Let $F$ be a field, $I$ a nonzero ideal in $F[x]$, and $g(x)$ an element of $F[x]$. Then, $I= \langle g(x)\rangle$ if and only if $g(x)$ is a nonzero polynomial of minimum degree in $I$.   Now it gets completely foggy what is meant with "minimum degree".I constantly come across the "minimal polynomial". This seems to be linked, but it seems strange that there is a division here.   Could someone give a pointer to what the second line actually means. Maybe some example or diagram (if possible) would help a lot here. Aligning three figures next to each other based on text width Problem:  I am trying to align three figures next to each other with text centered to each figure. This is going well until the box for the third box does not adjust after the text width.  Minimal Working Example (MWE):  \documentclass{article} \usepackage{graphicx} \usepackage{caption}  \begin{document}  \begin{figure}[!tbp]   \centering   \begin{minipage}[b]{0.2\textwidth}     \includegraphics[width=\textwidth]{icon-password.eps}     \caption*{Login system}   \end{minipage}   \hfill   \begin{minipage}[b]{0.2\textwidth}     \includegraphics[width=\textwidth]{icon-shopping.eps}     \caption*{Shopping cart}   \end{minipage}   \hfill   \begin{minipage}[b]{0.2\textwidth}     \includegraphics[width=\textwidth]{icon-clock.eps}     \caption*{Temporary information}   \end{minipage} \end{figure}  \end{document}   Outputs:   Desired outcome:  To get the width to adjust after the text so that "Temporary information" can be written out in one line instead of two. Resize images in PHP without using third-party libraries? Find the number of ways in distributing $8$ distinct balls into $6$ distinct boxes such that there is at least $1$ ball in each box.  We are well acquainted with the traditional Inclusion-Exclusion principle in solving this and it will come up as $191520$ ways.  I tried in this way:  When we distribute $8$ balls into $6$ boxes we have two possible cases  Case $1.$ There are exactly $2$ boxes with $2$ balls each  Case $2.$ There is exactly $1$ Box with $3$ balls in it.  For Case $1$, the distribution is done by choosing $2$ boxes from $6$ boxes and $2$ balls from $8$ balls and those two balls can be arranged in $2!$ ways. But I require another two balls from remaining $6$ balls to be placed in each of these two boxes which can be done in $\binom{6}{2} \times 2!$ ways. Finally remaining $4$ balls can be distributed in remaining $4$ boxes in $4!$ ways. So total number of ways for Case $1.$ is  $$\binom{6}{2} \times \binom{8}{2} \times 2! \times \binom{6}{2} \times 2! \times 4!=604800$$  For Case $2$, the number of ways is  $$\binom{6}{1} \times \binom{8}{3} \times 5!=40320$$  I am pretty sure the value obtained for Case $2.$ is correct. but I could not find where I went wrong in Case $1.$ I was checking on something in the Harry Potter wiki and saw Harry listed as "Half-Blood."  Both his parents were magical, but, as we know, his grandparents on his Mother's side were muggles.  This reminds me of the racially loaded terms like octoroon.  (In the south, you still hear those terms every once in a while.)  When there was still segregation, having only 1 great-grandparent of an ethnic group was enough to classify a person of that group.  So how far down the line did it go in the Harry Potter universe?  Just how many generations removed from a muggle-born would a person have to be before they're no longer classified as half-blood or something similar? Where to download Flash Player for offline installation? I can't find Flash Player download link which will give me the full EXE/MSI file, not the tiny downloader which downloads data from the internet.  What's the proper download site for this? How do I select all but two types of entities in Minecraft with the type selector? I've asked this question towards a developer for Minecraft and I thought I'd ask here too since they might not see the question.  How do I select all but two types of entities in Minecraft?  For example, something like: /say @e[type=![Player,Item],r=50] (to clarify I also tried type=Item,Player, type=Item,type=Player etc)  Should select any entity that does not match players or items, so things like Creepers, Ghasts, XPOrbs, PrimedTNT and so on within a radius of 50 blocks and print them to the chat.  Instead it ignores one of the flags, and works with the other instead. Question: If $(1+x)^n=\binom{n}{0}+\binom{n}{1}x+\binom{n}{2}x^2+\dotsm+\binom{n}{n}x^n$, prove that $\binom{n}{1}-2\binom{n}{2}+3\binom{n}{3}-\dotsm+(-1)^{n-1}n\binom{n}{n}=0$  My attempt:  I wrote the expression for $\binom{n}{k}$ for each term in the L.H.S and then tried to simplify but could not reach the R.H.S.  Please help. I have no idea on how to begin. I am not allowed to use calculus. How do I send SMS from PC through Android Phone or to Android Phone? I'm looking for an app that will let me type text messages on my PC and send the SMSs directly from the PC through my phone, or save the messages to the phone for later use.  I'm basically looking at something like Nokia PC Suite's equivalent.  EDIT:  Google Voice is only for US, doesn't work in India at least, and also defeats the purpose (it will go through the internet, why, when it's possible through the usb cable/modem/wifi). DesktopSMS is a good program, but kept crashing, for some reason. PDANet worked for me. But I liked the tiny . It's weird, and I had to change the bluecove library jar file for Windows 7 x64, but it's compact (a concern for me). What's your recommendation on drive partitioning schemes for a desktop and home server? What partitioning scheme do you recommend for a desktop? I've always created three or four primary partitions -- root, swap, home, and sometimes a separate boot partition. Ubuntu's default install offers LVMs. I've never had to add additional drives or space, so it never seemed like a big deal. Whenever I do a fresh install, though, I always think there might be a better way. I installed kali linux OS on my laptop.  The installation went well but when I booted in kali linux the screen was backwards. I signed in as root and the screen flipped back but the mouse is reverse (x &amp; y axis).  When I move my mouse left it moves right when I move it down it moves up. If I want to press a button at the upper right I need to press it at the down left.  The screen is acting backwordes (x &amp; y axis)but I see the graphics straight and the mouse is acting backwordes.  I installed kali linux again with a fresh installation. I have the same problem as before.  I installed kali linux again with a fresh installation. I have the same problem as before.   I searched the web And I don't find information on a problem like this Do the SSH or FTP protocols tell the server to which domain I am trying to connect? When using the ssh or ftp commands from the Bash shell, does the server that I am connecting to learn of the domain name used? I understand that the domain name is locally translated into an IP address via DNS. In HTTP, after that happens, the server is told the original domain name as well in order to serve the correct page, or to present the correct TLS cert (SNI).  host serverfault.com GET /   Does a similar phenomenon happen when connecting to ssh or ftp?  I ask because I am  trying to ssh into a server (GoDaddy webhosting) which expects a domain name, but is not letting me in when I try to connect via user@IPaddress as the DNS is not yet moved to the GoDaddy IP address. One of the big new features for Windows is the fact that multiple "virtual" desktops are now natively supported, allowing you to organise collections of windows together and separate groups of tasks.  This is good.  You can move windows between desktops by clicking the "tasks" button and then right clicking an application window and selecting "Move to..."  This is a bit clunky and not quite so good.  I have two monitors and often like to have a film playing on my second monitor, either in a web browser or media player, while I have a browser and some other applications on the main screen. Doing this isn't a problem in my current setup, it just works.   With the advent of virtual desktops I was wanting to put the browser on one virtual desktop and another app on another virtual desktop and still be able to watch the video when I switch desktops, effectively having it visible on both virtual desktops. Using the default Film &amp; TV app to play a video and then moving to another desktop simply results in your video stopping without any warning.   This is not good.  What I was hoping was that either the two monitors would have their own virtual desktop or their would be some "pin to all desktops" option similar to the "sticky window" feature that I have seen in many Linux based window managers.  Is there some way to achieve this? Prove: If a sequence converges, then every subsequence converges to the same limit. I need some help understanding this proof:  Prove: If a sequence converges, then every subsequence converges to the same limit.  Proof:  Let $s_{n_k}$ denote a subsequence of $s_n$. Note that $n_k \geq k$ for all $k$. This easy to prove by induction: in fact, $n_1 \geq 1$ and $n_k \geq k$ implies $n_{k+1} &gt; n_k \geq k$ and hence $n_{k+1} \geq k+1$.  Let $\lim s_n = s$ and let $\epsilon &gt; 0$. There exists $N$ so that $n&gt;N$ implies $|s_n - s| &lt; \epsilon$. Now $k &gt; N \implies n_k &gt; N \implies |s_{n_k} - s| &lt; \epsilon$.   Therefore: $\lim_{k \to \infty} s_{n_k} = s$.   What is the intuition that each subsequence will converge to the same limit I do not understand the induction that claims $n_k \geq k$ Is there an unsubdivide function in Blender? PHP syntax for dereferencing function result creating a diagonal matrix with a variable amount of parameters I am making a fudge recipe that calls for 1cup whole milk and 5 cups sugar. It also uses 2 sticks of butter and 25 marshmallows. I'm wondering if I can omit the milk and cut back on the sugar by using sweetened condensed milk. I'm considering replacing an outdoor lighting fixture with an LED motion-sensitive fixture, but I'm not sure how to safely do the wiring.  The location is protected (under a porch) but still needs to be weatherproof. Here's the existing fixture and mount:    The obvious replacement would be another lamp that included its own box cover, so that its wiring would be covered and protected. But, the fixture I like doesn't include such a cover:    You can see it's meant to be screwed into the wall, but doesn't cover anything. The power cable ends with bare wires which are meant to be wire-nutted to the supply wiring, probably inside a junction box. But, how do I get the wire safely into the junction box while keeping things weatherproof?  One option would be to replace the lamp's power cable with one ending in a grounded plug, and install a weatherproof outlet box. But that's ugly and complex.  Are there weatherproof junction box covers that include provisions for sealed entry of cables?