I am well aware of the fact that the template function basically gets compiled at the point when there is a specific invocation. But in this question I am looking for something different.  I have the following source files :  a.cpp :  template &lt;class T&gt; void g(T x) {     cout&lt;&lt;x&lt;&lt;"  g#1\n" ; } void f() ; main() {     g(10) ;     g('c') ;     f() ; }   b.cpp :  template &lt;class T&gt; void g(T x) {     cout&lt;&lt;x&lt;&lt;"  g#2\n" ; } void f() {     g(11) ; }   Now when I compile the code as :  g++ a.cpp b.cpp   all the three calls to g (2 in main and one in function 'f') are resolved via the template function defined in a.cpp.  But when I compile the code as :  g++ b.cpp a.cpp   the call g(10) in main and g(11) in function 'f' are resolved via the template function defined in b.cpp while the call g('c') in main is resolved via the template function defined in a.cpp  Of course if the template function defined in either of the two files is removed there is a compiler error reported by that particular file.  Can someone please provide an explanation for all these observations  In particular I want to know what kind of function call resolution is taking place during object file generation a.o and b.o. My query is as to how is the call resolved at compile time, i.e when I say :  g++ -c a.cpp   and  g++ -c b.cpp   and then what happens when I say :  g++ a.o b.o
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.)
With Glade Designer that lets you set up Gtk-Ui's you can check the option that windows are not shown in the launcher. If I take a look at the ui-file generated by Glade, it says &lt;property name="skip_taskbar_hint"&gt;True&lt;/property&gt;. In gtk code this hint is  window.set_property('skip-taskbar-hint', True). However I believe that this option is not exclusively Gtk-specific, and want to apply this one on my PyQt4-app. The Ubuntu window manager must be able to receive that hint, otherwise I would see the window of a gtk-application i use (stickynotes-indicator). So there MUST be a way of doing this in Qt or any other language, right?  Does anybody know such an option? Python or Qt syntax, doesn't matter! Open a direct file on the hard drive from Firefox (file:///) I have a small PHP system I created for myself. This system contains a few .doc and .docx file documents. I want to be able to open them directly from the browser without downloading them.  I created a link: &lt;a href="file:///c:/mysite/myfile.docx"&gt;myfile&lt;/a&gt;. But Firefox does not open the link. href="http://localhost/myfile.docx" works fine - it offers me to download the file.  Any ideas on how I can do it? Do I need to change something in the Firefox options or security settings? My interest in combinatorics was recently sparked when I read about the many things that the Catalan numbers count, as found by Richard Stanley. I picked up a copy of Brualdi's Combinatorics, and while browsing the section on counting sequences I found a nice little puzzle that has definitely puzzled me.     Let $m$ and $n$ be nonnegative integers with $n\geq m$. There are $m+n$ people in line to get into a theater for which admission if $50$ cents. Of the $m+n$ people, $n$ have a $50$-cent piece and $m$ have a $\$ 1$ dollar bill. The box offices opens with an empty cash register. Show that the number of ways the people can line up so that change is available when needed is   $$ \frac{n-m+1}{n+1}\binom{m+n}{m}. $$     I first noted that the first person to enter must be one of the $n$ with a half-dollar. Now the register has a half-dollar change. The second person can be either a person with a half-dollar or a dollar. In the first case, the register will now have two half-dollars, in the second case, the register will now have one dollar bill. So it seems to me that when one of the $n$ people with a half-dollar enters, the number of half-dollars in the register increases by $1$, and when one of the $m$ people with a bill enters, the number of half-dollars decreases by $1$ but the number of bills increases by $1$.   I tried to model this by looking at paths in $\mathbb{Z}^2$. The $x$-axis is like the number of half-dollars, and the $y$-axis is the number of bills. You start at $(0,0)$, and you can take steps forward $(1,0)$ or backwards diagonally $(-1,1)$ corresponding to who enters, but you must always stay in the first quadrant of the plane without crossing over the axes. The goal is to make $m+n$ moves, and I figured maybe the number of such paths is counted by $\frac{n-m+1}{n+1}\binom{m+n}{m}$, but I'm not sure how to show this. I don't know if this observation simplifies the problem at all, as I don't know how to finish up. I'd be happy to see how this problem is done, thank you. I want to write a function that takes an array of letters as an argument and a number of those letters to select.   Say you provide an array of 8 letters and want to select 3 letters from that. Then you should get:  8! / ((8 - 3)! * 3!) = 56   Arrays (or words) in return consisting of 3 letters each. I know how to define a package or a class, but how do I make it available (to myself) at all times?  Say I have the package file commonstuff.sty (or myprettyclass.cls), that I want to be able to include in any .tex file I create on my computer. Where do I put it? Do I need to run some installer on it, or is it enough to keep it in a certain folder?  Note: I know I can just place it in the same folder as the .tex file, but that's not what I'm after here. I'm looking for a way to "install" the package centrally on my computer. Orthogonal Projection onto the $ {L}_{\infty} $ Unit Ball What is the Orthogonal Projection onto the $ {\ell}_{\infty} $ Unit Ball?  Namely, given $ x \in {\mathbb{R}}^{n} $ what would be:  $$ {\mathcal{P}}_{ { \left\| \cdot \right\| }_{\infty} \leq 1 } \left( x \right) = \arg \min_{{ \left\| y \right\| }_{\infty} \leq 1} \left\{ {\left\| y - x \right\|}_{2}^{2} \right\} $$  I managed to get an answer using the . Yet I would be happy to see if someone can derive the answer directly.  Thank You. All rounds of AES (and Rijndael) have a MixColumns step, save the last round which omits it.  DES has a similar feature where the last round differs slightly.  The rationale, if I recall correctly, was to "make the cipher appear similar in reverse as it does in the forward direction."  Why does this make AES$^{-1}$ look similar to AES?  And how does this help in implementing the block cipher? Did Dolores Umbridge Have Any Association with Voldemort (or Death Eaters) before His Return? I noticed that Dolores Umbridge was born during the first Wizarding War, so it's very likely she wasn't a Death Eater then (but she is pretty evil -- who knows?).  After that Voldemort was not around in a way that could affect many people, and most wouldn't know he was planning to rise again.  During that time, and up through Voldemort's return (in Goblet of Fire), did Umbridge have any connection with the Death Eaters or with Voldemort?  Was she doing what she did on her own, or was it because of an association with Voldemort or his allies? Probability that median falls within a range? If I draw 5 samples from a distribution that is cont., what is the probability that the median of the population is between the xmin and xmax of the draw samples?  What is the formula to apply here? Why are my Cycles settings missing? so I'm working on a little bathroom scene and wanted to make a clay render. I started looking for the material override which I kinda knew where it was and on the way I switched my render engine accidently to workbench instead of cycles. Switched to cycles all my seetings on the render tab are missing except color management and free style. Hows that? I restarted blender multiple times and tried some other stuff but nothing changed a thing, and I'd rather avoid a new installation How to show $\sum_{k=0}^{n}\binom{n+k}{k}\frac{1}{2^k}=2^{n}$ Proving $(A\le B)\vee (B\le A)$ for sets $A$ and $B$ How to run a program without typing the full path? System utilities such as ls don't need to have the full path typed before executing them. However, to execute Netbeans, I have to type /home/chris/netbeans-7.0.1/bin/netbeans. How can I make it so that I only have to type netbeans? Proof of Frullani's theorem A continuous bijection from a compact space to a $T_2$ space is always a homeomorphism This problem is bugging me for some time.     $f:(X,\mathcal{T}) \to (Y,\mathcal{T}')$ is a continuous bijection where $(X,\mathcal{T})$ is compact and $(Y,\mathcal{T}')$ is $T_2$ (i.e. Hausdorff and $T_1$). Then show that $f$ must be a homeomorphism.   So far I have failed to understand any relation between the compactness of domain and $T_2$-ness of the range. I tried in vain to prove that $f(U)$ is open in $(Y,\mathcal{T}')$ whenever $U$ is so in $(X,\mathcal{T})$. I know $f$ makes $X$ and $Y$ respectively $T_2$ and compact and hence makes both of them $T_4$ spaces. But that is not coming to any use. I would be glad if someone helps me with a solution. Thank you. Can black holes be created on a miniature scale? How do you guys go about controlling column padding in tables?   Update  To clarify, I'm looking for a way to control both vertical and horizontal padding. So, if I had a simple table like in the following code snippet, I could pad the columns and make them look a bit less... ugly. :P   \begin{tabular}{|l|l|}     \hline     column 1 &amp; column 2 \\      \hline     I really would like this less &amp; crammed\\     \hline \end{tabular}   I tried this by using the command \vspace but it leaves gaps in the vertical lines. Resetting Ubuntu to factory settings I've had a lot of problems lately and now I'm having problems logging in at the login screen. I'm giving up and just want to reset and start over. How can I "factory reset" Ubuntu, in this situation, or, for future reference, in general? I have a question about the following text:     Last week Alex Knapp at Forbes published an article criticizing my Nikola Tesla comic. I don't normally respond to these kinds of thing, but since it's' Forbes I figured a proper response was in order.    I would rather say "this kind of things" rather than the version in the text above. Is it true that $A^A\simeq P(A)$? Let $A$ be an infinite set and $$A^A=\{f | f:A\to A\,\,\, \text{is a function}\}.$$ Is there any natural bijection between $A^A$ and $P(A)$?