I am in the process of writing some unit tests. In particular I want to test some private methods.  So far the I have come up with using.  #define private public   But I am not happy with this as it will destroy all encapsulation from the point of view of the unit test.  What methods do you use to unit-test private methods.
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.
Usually, when we see two letters put together it is to define the pronunciation or to differentiate synonyms or just its foreign origins. But some words don't seem to have any reason to double up.     Why does vacuum have two of the letter U?  Why does aardvark have two of the letter A?  Why does llama have two of the letter L? I have to teach the Bayes formula to some undergraduates, in the form:  $$ P(A|B) = \frac{P(A \cap B)}{P(B)} = \frac{P(B|A)P(A)}{P(B)} $$  I was wondering if anyone had any really thoughtful or alternative ways of teaching it instead of the standard approach. Cleaning up factor levels (collapsing multiple levels/labels) Forward/Inverse Search Does Not work on certain tex files What should happen if a logo I made is similar to another? What's the difference between !, %, and @ in replacement tokens? Function in Table I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off.  This happens on page ready and works just fine.  The problem I have is that any select boxes I add via Ajax or DOM after the initial loop won't have the event bound.  I have found this plugin (), but before I add another 5k to my pages with a plugin, I want to see if anyone knows a way to do this, either with jQuery directly or by another option. How to compute PCA scores from eigendecomposition of the covariance matrix? Given a data matrix $\mathbf X$ of $12 \times 7$ size with samples in rows and variables in columns, I have calculated centered data $\mathbf X_c$ by subtracting column means, and then computed covariance matrix as $\frac{1}{N-1} \mathbf X_c^\top \mathbf X_c$.  The dimensions of this covariance matrix are $7 \times 7$. After that I have calculated the eigenvalue decomposition, obtaining eigenvector matrix $\mathbf V$ with eigenvectors in columns.  Now I want to know about projections (i.e. principal component scores in PCA): is it $\mathbf{V}^\top \mathbf{X}_c$ or $\mathbf{X}_c \mathbf{V}$?  mean_matrix = X - repmat(mean(X),size(X,1),1); covariance = (transpose(mean_matrix) * mean_matrix)/(12-1);  [V,D] = eig(covariance); [e,i] = sort(diag(D), 'descend'); V_sorted = V(:,i); Apt sources.list problem , packages not found? I am trying to install WICD but getting following errors on my ubuntu 10.04 box  sudo apt-get install wicd   Err http://archive.ubuntu.schoolnet.lk/ubuntu/ lucid/universe python-wicd 1.7.0+ds1-2   Could not connect to archive.ubuntu.schoolnet.lk:80 (103.29.60.18). - connect (111: Connection refused) Err http://archive.ubuntu.schoolnet.lk/ubuntu/ lucid/main python-iniparse 0.3.1-1   Unable to connect to archive.ubuntu.schoolnet.lk:http: Err http://archive.ubuntu.schoolnet.lk/ubuntu/ lucid/universe wicd-daemon 1.7.0+ds1-2   Unable to connect to archive.ubuntu.schoolnet.lk:http: Err http://archive.ubuntu.schoolnet.lk/ubuntu/ lucid/universe wicd-gtk 1.7.0+ds1-2   Unable to connect to archive.ubuntu.schoolnet.lk:http: Err http://archive.ubuntu.schoolnet.lk/ubuntu/ lucid/universe wicd 1.7.0+ds1-2   Unable to connect to archive.ubuntu.schoolnet.lk:http: Failed to fetch http://archive.ubuntu.schoolnet.lk/ubuntu/pool/universe/w/wicd/python-wicd_1.7.0+ds1-2_all.deb  Could not connect to archive.ubuntu.schoolnet.lk:80 (103.29.60.18). - connect (111: Connection refused) Failed to fetch http://archive.ubuntu.schoolnet.lk/ubuntu/pool/main/p/python-iniparse/python-iniparse_0.3.1-1_all.deb  Unable to connect to archive.ubuntu.schoolnet.lk:http: Failed to fetch http://archive.ubuntu.schoolnet.lk/ubuntu/pool/universe/w/wicd/wicd-daemon_1.7.0+ds1-2_all.deb  Unable to connect to archive.ubuntu.schoolnet.lk:http: Failed to fetch http://archive.ubuntu.schoolnet.lk/ubuntu/pool/universe/w/wicd/wicd-gtk_1.7.0+ds1-2_all.deb  Unable to connect to archive.ubuntu.schoolnet.lk:http: Failed to fetch http://archive.ubuntu.schoolnet.lk/ubuntu/pool/universe/w/wicd/wicd_1.7.0+ds1-2_all.deb  Unable to connect to archive.ubuntu.schoolnet.lk:http: E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? How can a Photon have a "frequency"? I picture light ray as a composition of photons with an energy equal to the frequency of the light ray according to $E=hf$. Is this the good way to picture this? Although I can solve elementary problems with the formulas, I've never really been comfortable with the idea of an object having or being related to a "frequency". Do I need to learn quantum field theory to really understand this? Where can I check which difficulty bracket I'm in? Supposedly DOTA 2 matchmaking is divided into brackets.  I want to know which difficulty bracket I'm in. How can I find this information? Is it possible for an x86 processor to match an ARM processor in terms of performance per watt? From my personal experience with my tablet, and from the benchmarks and articles I've read, it always seems ARM processors, as seen in virtually all mobile devices, deliver incredible performance for the amount of power they consume.  It really seems like ARM is inherently more power-efficient than x86.  To me, it looks like that this is because x86 is a  while ARM is a . However, Intel Atom processors deliver very good performance relative to their power consumption as well.  In addition, having studied computer architecture, it is my understanding that in modern processors, the complex x86  is internally translated into simpler  that use an internal instruction set that is closer to the simpler ARM or MIPS ISAs than x86 proper.  As such, the ISA as presented to the programmer is little more than an interface to issue commands to the processor, rather than a representation of the actual low-level operations the chip performs.  Then again, implementing this translation layer requires additional silicon space on the chip...  That said, assuming that they are implemented using the same semiconductor process, is ARM inherently more efficient than x86? With a properly designed , is it possible for an x86 processor to deliver the same performance per watt as an ARM processor?  Remember, I'm looking for a well-written technical answer in the spirit of Stack Exchange and not mere speculation. Phantom device showing on Google Play Show that $\langle x,y\rangle_A = \langle Ax,Ay\rangle$ is an inner product on $\mathbb R^n$ Let $A$ be an $n \times n$ matrix with real enteries. Define $\langle x,y\rangle_A = \langle Ax,Ay\rangle, \quad x,y \in \mathbb R^n$ , where $\langle,\rangle$ is a standard inner product on $\mathbb R^n$. Then  $\langle x,y\rangle_A$ is an inner product iff  1)  $\ker A = \{0\}$.  2) $\operatorname{rank} A= n$.  3) all eigenvalues of $A$ are positive.  4) all eigen value of $A$ are non negative.  Clearly if $\ker A \neq \{0\}$, then there exist $x \neq 0$ such that $Ax =0$, then $\langle Ax, Ax\rangle_A = 0$, then $\langle ,\rangle_A$ is not inner product, so $\ker A = \{0\}$, thus rank of $A$ is $n$.  I am unable to check the 3) and 4) option. Please help to check the other option. Thank you MATLAB superclass can not be found on the MATLAB's search path Picturing the how the covariant derivative acts on vector fields I'm just going to throw this out there, but Google indexes Stack Overflow really quickly Convert a Bitmap to GrayScale in Android What's the starting wealth for higher levels? The PHB only gives starting wealth for Level 1 PCs. Based on my experience in other games, specifically Pathfinder, I would expect to get more at higher levels. Where can I find an appropriate table or calculation?