I firstly think c++ compiler like g++ generates different functions or classes for different templates in compiling stage, But when we use a lib, lib binary has been made, it has been a fixed binary, just for link, why template still works?
Quote from :     The only portable way of using templates at the moment is to implement them in header files by using inline functions.   Why is this?  (Clarification: header files are not the only portable solution. But they are the most convenient portable solution.)
Solving infinite sums with primes. Let $p_n$ denote the $n$'th prime number.  How would one go about proving that infinite products like: $$\prod_{k=1}^\infty1 - \frac{1}{(p_k)^2} = \frac{6}{\pi^2}$$  or  $$\prod_{k=1}^\infty\frac{{p_k}^2}{{p_k}^2 - 1} = \frac{\pi^2}{6}$$ are correct?  Is there any way to prove it except by exhaustion? E.g.: If your Gmail ID is abc.xyz@gmail.com, it considers this the same as abcxyz@gmail.com.  Why is this so? Where do I put item tags on items inside a chest or your inventory? I am making a Minecraft Mini Game adventure map, and one of the levels has a /setblock command, I am using the command in a way to spawn an item in a chest (Wooden Button) I need the wooden button to have CanPlaceOn tag so it can be placed on a log. I have tried this command: setblock 294 5 -1251 minecraft:chest 0 replace {Items:[{Count:1,Slot:0,id:minecraft:wooden_button,CanPlaceOn:[log]}]}` When to use "have" and "have got" I've been digging through some parts of the Linux kernel, and found calls like this:  if (unlikely(fd &lt; 0)) {     /* Do something */ }   or  if (likely(!err)) {     /* Do something */ }   I've found the definition of them:  #define likely(x)       __builtin_expect((x),1) #define unlikely(x)     __builtin_expect((x),0)   I know that they are for optimization, but how do they work? And how much performance/size decrease can be expected from using them? And is it worth the hassle (and losing the portability probably) at least in bottleneck code (in userspace, of course). PostgreSQL execute a default query when no row are returned I need to calculate the average score of a list of userId.  I have a table user_place_score:  (user_id, place_id, score)   Sometimes I do not have the score (no row for (user_id,place_id) in the table) so I need to fetch a "default" score from the table default_place_score:  (place_id, score)   Is is possible in PostgreSQL to do this in one query? For a given list of users and one place_id, select all their scores in the user_place_score and if no row is found then take the score found if the default_place_score table?  Basically I want to avoid doing this kind of stuff:  for (Integer userId : userIds) {   score = (query to fetch the score for this userId)   if (score == null)     defaultScore = (query to fetch the default score for this PlaceId)    total = total + defaultScore }  //return the average return total/numberOfUser is there any way to decode string? How can I stop being prompted to unlock the 'default' keyring on boot? For a prime $p \equiv 1$ or $3$ (mod $8$), show that the equation $x^{2} + 2y^{2} = p$ has a solution. For a prime $p \equiv 1$ or $3$  (mod $8$), show that the equation $x^{2} + 2y^{2} = p$ has a solution.   I'd like to see an elementary proof. I am embedding a PDF file inside my LaTeX-generated PDF file using embedfile:  \usepackage{embedfile} \embedfile{myfile.pdf}   I would like to also insert a link that the user can click on to open the attachment.  Is there any way to do that? With biblatex, is it possible to replace one author of an author list by a bibnamedash or idem string? With biblatex, the author can be replaced by a dash (or “idem”) in the bibliography. Is it possible to have this replacement also if there are multiple authors, and the first of these multiple authors is the same as the author of the book listed before? (It is somewhat difficult to describe, see the attached example instead, where “Buchautor, Hans-Wilhelm” should be replaced in book3 as well.)   I assume that it should be possible by customising \DeclareNameFormat, but I don’t know how.  Minimal example:  \documentclass{scrartcl} \usepackage[T1]{fontenc} \usepackage[latin1]{inputenc} \usepackage[english]{babel} \usepackage{csquotes} \usepackage{filecontents} \begin{filecontents}{\jobname.bib} @BOOK{book1,   author = {Buchautor, Hans-Wilhelm},   title = {Irgendein Buch},   location = {Buch am Wald},   date = {2000} } @BOOK{book2,   author = {Buchautor, Hans-Wilhelm},   title = {Ein anderes Buch},   location = {Berlin},   date = {2001} } @BOOK{book3,   author = {Buchautor, Hans-Wilhelm and Zweitautor, Zoran},   title = {Noch ein Buch},   location = {London and New York},   date = {2010} } \end{filecontents}  \usepackage[ style=authortitle, backend=bibtex8 ]{biblatex} \bibliography{\jobname}  \renewcommand*{\bibnamedash}{%   \bibstring[\mkbibbold]{idem\thefield{gender}}}  \begin{document} \nocite{*}  \printbibliography \end{document}   Edit 15/02/2011 17:14   I should have added that there was a feature request for biber which pointed back to biblatex. See .  Edit 21/06/2011 9:26  Is this somehow possible now with biblatex 1.4/1.5? I played a bit with uniquename/uniquelist, but I could not get it to work. How do I calculate the power consumed by a lightbulb? I'm studying a lightbulb and its variable resistance, given by the expression:  $R(T) = Ro[1 + α(T-T_0)]$, where $R_0$ is the resistance of the lamp at $T_0$.  In this case, $R$ is not given by Ohm's law ($V=Ri$). So, which expression can I use to calculate the power consumed by a lightbulb?   $P = R\cdot i^2$ $P = \frac{V^2}{R}$ $P = V\cdot i$ (I don't think I can use this one)   I have measured the current and the e.p.d. at the bulb using instruments. Integration of elementary rational fractions $$\int{\frac{Mx+N}{x^2+px+q}}dx$$  When all the coefficients are given, it can be easily solved using substitution but I have no idea how to find a solution in a standard form.  What are the first steps? Why do files sometimes change but not the inode or vice versa? When a file is updated then the corresponding inode gets updated. But sometimes the following condition occurs    file is same and inode is new  file gets changed but corresponding inode is older   Why ? Quick way to remove solidify thickness I have made the mesh and added solidify modifier and applied. But later i thought to increase the thickness. So now i want to remove thickness so that i can added the solidify modifier again. I want to know is there any quick remove thicknes. When i select the edge then ctrl+ the selection goes downward not to single face. So i want to know a quick way to decrease thickness. Any suggestion or help. How to prove $\lim_{n \to \infty} \sqrt{n}(\sqrt[n]{n} - 1) = 0$? To an an external observer it appears that time has stopped for photon. But this relation is reflexive, so for an observer travelling with the photon it appears the universe has stopped everywhere.  Is this right?  Space also gets distorted parallel to the direction of motion, but not perpendicular to it.   Does this mean that for an observer travelling with a photon sees spacetime as a flat plane?  Note 1: I'm using language vividly not literally when I say a photon experiences space and time. Not that I'm against idealist or panpyschist interpretations of matter or energy come to that.  Note 2: Since it's been pointed out that an inertial frame can't be boosted into the frame of a photon and moreover there is no limiting behaviour here - no matter what frame you are boosted into, light will always appear to travel at c. Nevertheless, when an external observer watches a train chasing a photon by gradually increasing its speed, he will note that the train speed is approaching the speed of the photon (but will never match it) and when he looks at the clock inside the train he will not too that it is gradually slowing down (but never actually stops). Using this picture, we can attempt the thought experiment - if not one that can be carried out - of what a world looks like to a photon. I know they have their adherents, but do more or less esoteric branches of mathematics such as Category Theory and/or Quantum Logic provide powerful tools for new theory development or are they just occasionally-useful presentational frameworks?  More particularly, is it worth investing the time to study these formalisms? Newton's Law of Universal Gravitation tells us that the potential energy of object in a gravitational field is $$U ~=~ -\frac{GMm}{r}.\tag{1}$$  The experimentally verified near-Earth gravitational potential is  $$U ~=~ mgh.\tag{2}$$  The near-Earth potential should be an approximation for the general potential energy when $r\approx r_{\text{Earth}}$, but the problem I'm having is that they scale differently with distance.  $(1)$ scales as $\frac 1r$.  So the greater the distance from the Earth, the less potential energy an object should have.  But $(2)$ scales proportionally to distance.  So the greater the distance from the Earth, the more potential energy an object should have.  How is this reconcilable? In Chiswell's Mathematical Logic, there is the following problem is posed using the language of propositions (LP):     In some systems of logic (mostly constructive systems where 'true' is taken to mean 'provable') there is a rule      if $(\Gamma\vdash(\phi\,\lor\psi))$ is a correct sequent then at least   one of $(\Gamma\vdash\phi)$ and $(\Gamma\vdash\psi)$ is also correct.      By giving a counterexample to a particular instance, show that this is   unacceptable as a rule for LP. [Start by giving counterexamples for   both the sequents $(\vdash p_0)$ and $(\vdash(\neg p_0))$.]   In my , it was answered that one can let $\Gamma = \{p_0\,\lor\,(\neg p_0)\}$.  From there, one can deduce neither $(\Gamma\vdash p_0)$ nor $(\Gamma\vdash (\neg p_0))$.  But this does not proceed by the counterexample route that the author suggests.  Namely, he seems to imply that we should (1) take an interpretation of propositional variables $p_0,\,p_1,\,\ldots$ (setting each one equal to T or F), and (2) write $\phi$ and $\psi$ as functions of these propositional variables, and (3) pick sentences for $\Gamma$ which are all T, all with the conditions that (A) $(\phi\,\lor\psi)$ is evaluated as T, yet (B) both $\phi$ and $\psi$ are evaluated as F.  This, of course, seems impossible.  What, then, am I missing?  It seems that taking a concrete interpretation of the propositional symbols makes the constructivist's rule irrefutable.  (Note: this is supposed to be a very simple problem set, and I am an elementary logician).