I am novice in the template programming.  What is the problem in this simple function?  template&lt;class T&gt; void myFunction() {     basic_string&lt;T&gt;::size_type i = 0;  }   I cannot compile it?!  Changing class to typename does not solve the problem?
In templates, where and why do I have to put typename and template on dependent names? What exactly are dependent names anyway?    I have the following code:  template &lt;typename T, typename Tail&gt; // Tail will be a UnionNode too. struct UnionNode : public Tail {     // ...     template&lt;typename U&gt; struct inUnion {         // Q: where to add typename/template here?         typedef Tail::inUnion&lt;U&gt; dummy;      };     template&lt; &gt; struct inUnion&lt;T&gt; {     }; }; template &lt;typename T&gt; // For the last node Tn. struct UnionNode&lt;T, void&gt; {     // ...     template&lt;typename U&gt; struct inUnion {         char fail[ -2 + (sizeof(U)%2) ]; // Cannot be instantiated for any U     };     template&lt; &gt; struct inUnion&lt;T&gt; {     }; };   The problem I have is in the typedef Tail::inUnion&lt;U&gt; dummy line. I'm fairly certain that inUnion is a dependent name, and VC++ is quite right in choking on it. I also know that I should be able to add template somewhere to tell the compiler that inUnion is a template-id. But where exactly? And should it then assume that inUnion is a class template, i.e. inUnion&lt;U&gt; names a type and not a function?
Example where union of increasing sigma algebras is not a sigma algebra How can I add a PPA from a previous release? Weird syslog order Have you ever seen wrong order in /var/log/syslog ? I think that it causes only crontab.  Jun 28 22:20:01 alex CRON[2327]: (root) CMD (something &gt; /dev/null) Jun 28 22:21:01 alex CRON[2700]: (root) CMD (something &gt; /dev/null) Jun 21 03:49:01 alex CRON[2753]: (root) CMD (something &gt; /dev/null) Jun 28 22:23:01 alex CRON[2754]: (root) CMD (something &gt; /dev/null) Jun 27 05:08:01 alex CRON[2813]: (root) CMD (something &gt; /dev/null) Jun 26 00:19:01 alex CRON[2816]: (root) CMD (something &gt; /dev/null) Jun 28 22:25:01 alex CRON[2816]: (munin) CMD (if [ -x /usr/bin/munin-cron ]; then /usr/bin/munin-cron; fi) Jun 28 22:25:01 alex CRON[2821]: (root) CMD (something &gt; /dev/null) Jun 28 22:27:01 alex CRON[3225]: (root) CMD (something &gt; /dev/null) Jun 28 22:28:01 alex CRON[3240]: (root) CMD (something &gt; /dev/null) Jun 28 22:30:01 alex CRON[3290]: (root) CMD (something &gt; /dev/null) Jun 26 12:03:01 alex CRON[3291]: message repeated 2 times: [ (root) CMD (something &gt; /dev/null)] Jun 28 22:30:01 alex CRON[3291]: (munin) CMD (if [ -x /usr/bin/munin-cron ]; then /usr/bin/munin-cron; fi) Jun 28 22:31:01 alex CRON[3659]: (root) CMD (something &gt; /dev/null) Jun 28 22:32:01 alex CRON[3754]: (root) CMD (something &gt; /dev/null) Jun 16 06:41:01 alex CRON[3846]: (root) CMD (something &gt; /dev/null) Jun 28 22:35:58 alex cron[909]: (CRON) INFO (pidfile fd = 3) Jun 28 22:35:58 alex cron[944]: (CRON) STARTUP (fork ok) Jun 28 22:35:58 alex cron[944]: (CRON) INFO (Running @reboot jobs) Jun 28 22:36:01 alex CRON[1428]: (root) CMD (something &gt; /dev/null) Jun 28 22:37:01 alex CRON[3050]: (root) CMD (something &gt; /dev/null) Jun 28 22:38:01 alex CRON[3082]: (root) CMD (something &gt; /dev/null) Jun 28 22:39:01 alex CRON[3114]: (root) CMD (something &gt; /dev/null)   As you can see, there is bad time order between lines. It is just crontab error, or there is some problem with system clock, or something?  I am running the latest Ubuntu 14.04 kernel:  Linux alex 3.13.0-30-generic #54-Ubuntu SMP Mon Jun 9 22:45:01 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Best word wrap algorithm? Word wrap is one of the must-have features in a modern text editor.  How word wrap be handled? What is the best algorithm for word-wrap?  If text is several million lines, how can I make word-wrap very fast?  Why do I need the solution? Because my projects must draw text with various zoom level and simultaneously beautiful appearance.  The running environment is Windows Mobile devices. The maximum 600&nbsp;MHz speed with very small memory size.  How should I handle line information? Let's assume original data has three lines.  THIS IS LINE 1. THIS IS LINE 2. THIS IS LINE 3.   Afterwards, the break text will be shown like this:  THIS IS LINE 1. THIS IS LINE 2. THIS IS LINE 3.   Should I allocate three lines more? Or any other suggestions? ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ Who owns R2-D2 & C-3PO in the Prequel trilogy? Is there any concrete evidence that Anakin officially owned R2-D2 or C-3PO?  I found this episode of Star Wars: Clone Wars that shows it, but it's fairly vague... Finding the convergence interval of $\sum_{n=0}^\infty\frac{n!x^n}{n^n}$. I want to find the convergence interval of the infinite series $\sum\limits_{n=0}^\infty \dfrac{n!x^n}{n^n}$. I will use the ratio test: if I call $u_n = \dfrac{n!x^n}{n^n}$, the ratio test says that, if the following is true for some values of $x$, the series will be convergent for these values of $x$: $$\lim_{n\to+\infty}\left|\frac{u_{n+1}}{u_n}\right|&lt;1$$ So, I will first calculate the value of $\left|\dfrac{u_{n+1}}{u_n}\right|$: $$\left|\dfrac{\dfrac{(n+1)!x^{n+1}}{(n+1)^{n+1}}}{\dfrac{n!x^n}{n^n}}\right|=\dfrac{(n+1)!|x|^{n+1}}{(n+1)^{n+1}}\times\dfrac{n^n}{n!|x|^n}=\frac{(n+1)n^n|x|}{(n+1)^{n+1}}=|x|\left(\frac{n}{n+1}\right)^n$$ So, $\lim\limits_{n\to+\infty}\left|\dfrac{u_{n+1}}{u_n}\right|$ becomes: $$\lim_{n\to+\infty}\left|\frac{u_{n+1}}{u_n}\right|=\lim_{n\to+\infty}|x|\left(\frac{n}{n+1}\right)^n=|x|\lim_{n\to+\infty}\left(\frac{n}{n+1}\right)^n$$ Now I must evaluate the value of $\lim\limits_{n\to+\infty}\left(\dfrac{n}{n+1}\right)^n$. For this, let $y = \left(\dfrac{n}{n+1}\right)^n$; so, instead of calculating $\lim\limits_{n\to+\infty}y$, I will first calculate $\lim\limits_{n\to+\infty}\ln y$: $$\lim_{n\to+\infty}\ln y=\lim_{n\to+\infty}\ln \left(\dfrac{n}{n+1}\right)^n=\lim_{n\to+\infty}n\ln\left(\frac{n}{n+1}\right) =\lim_{n\to+\infty}\frac{\ln\left(\frac{n}{n+1}\right)}{\frac{1}{n}}$$ Applying L'Hôpital's rule: $$\lim_{n\to+\infty}\frac{\ln\left(\frac{n}{n+1}\right)}{\frac{1}{n}} =\lim_{n\to+\infty}\frac{\frac{1}{n(n+1)}}{-\frac{1}{n^2}} =\lim_{n\to+\infty}\left(-\frac{n}{n+1}\right)=-1$$ Now, since we know that $\lim\limits_{n\to+\infty}\ln y = -1$, we have that: $$\lim_{n\to+\infty}y=\lim_{n\to+\infty}e^{\ln y} = e^{-1} = \frac{1}{e}$$. Substituting this back into the expression $\lim\limits_{n\to+\infty}\left|\frac{u_{n+1}}{u_n}\right| = |x|\lim\limits_{n\to+\infty}\left(\frac{n}{n+1}\right)^n$, we have that the limit of $\left|\dfrac{u_{n+1}}{u_n}\right|$ as $n\to+\infty$ is: $$\lim_{n\to+\infty}\left|\frac{u_{n+1}}{u_n}\right|=\frac{|x|}{e}$$ Therefore, the series will certainly be convergent for the values of $x$ for which $\dfrac{|x|}{e}&lt;1$, that is, $|x|&lt;e$. So, I know that the series is convergent for $-e &lt; x &lt; e$, but I have to test whether the series is convergent at $x = e$ or $x = -e$. That is, I have to test whether $\sum\limits_{n=0}^{\infty} \dfrac{n!e^n}{n^n}$ and $\sum\limits_{n=0}^{\infty} \dfrac{(-1)^nn!e^n}{n^n}$ are convergent. Since these limits don't approach zero, I know they are both divergent, but I'm not sure how to find the limits, because of the factorial function. Also, I can't use integral test here, because of the factorial. Probably I should use comparison test, but I haven't found any divergent series to which to compare it. Any hints? Thank you in advance.  Edit: Using the suggestion by Ragib Zaman in the answer below, since the Taylor polynomial $P_n(x)$ of $e^x$ at $a=0$ is $$e^x = 1 + x + \dfrac{x^2}{2!} + \cdots + \dfrac{x^n}{n!}+\cdots,$$ if we substitute $n$ for $x$ we see that $e^n&gt;\dfrac{n^n}{n!}$; therefore, $\dfrac{n!e^n}{n^n} &gt; 1$, and, thus, we show that $\sum\limits_{n=0}^{\infty} \dfrac{n!e^n}{n^n}$ is divergent, because its term doesn't approach zero. $\sum\limits_{n=0}^{\infty} \dfrac{(-1)^nn!e^n}{n^n}$ is also divergent, because, although the absolute value of the ratio between two successive terms, $|e|\left(\frac{n}{n+1}\right)^n$, approaches 1 as $n\to\infty$, it approaches 1 from values bigger than 1; therefore, the absolute value of a term is always greater than the absolute value of the previous term. How to replace a character by a newline in Vim I'm trying to replace each , in the current file by a new line:  :%s/,/\n/g    But it inserts what looks like a ^@ instead of an actual newline. The file is not in DOS mode or anything.  What should I do?  If you are curious, like me, check the question  as well. I have to import large Shapefiles (> 1 million records) into PostGIS, and I have been wondering about the best way to do it.    In my question I used the word "hack", instead of tool, on purpose because I think this is not so much a matter of which tool, but which set of steps, or configuration settings to use. So far, I have tried the  plugin (QGIS), the  Postgis tool and the GDAL  tool. You can view my full review on  post. So far, I find all of them really unresponsive, when dealing with a large dataset. I was wondering if someone experienced a similar issue, and if you could share something about the approach. Update (March, 2012): This has been rolled out to all sites in the network.    Behind the scenes we've been hard at work making some changes to how we track reputation.  Here are some of the issues we're aiming to address with these changes:   Reputation Skew (your actual reputation doesn't match what's shown) Up/Down votes oddities (mostly with the daily rep cap, the magical +2) Historical Deletes (not impacting rep immediately, contributing to skew) Unaccepts (display issues in the profile) User Deletion (magically missing rep, another skew contributor)   To be clear: reputation values are not changing, every action in the system is still worth the same amount.   Here’s what will be different:   Your reputation will be correct at all times Deletions will have a much more immediate effect on reputation, not waiting on a recalc  (but reputation sync takes up to 5 minutes on a delete/undelete action; as to not block the user's response thread, it's offloaded to a background queue) Recalcs will no longer be necessary Up/Down vote reversals will restore the correct reputation amount Up/Down vote reversals will correctly adjust to the reputation cap The reputation history in your profile will be more detailed and accurate (e.g. when a post is deleted, you'll see that in the reputation tab of your profile)   This means your reputation will go up and down more than it has previously, but it will be in sync.  To think of it more easily: imagine that a recalc will be done after every action in the system.  Probably the biggest impact many will be concerned with is that you may see your reputation drop in cases where it didn't seem like it did before  This was effectively happening before, but the results of that change were not applied immediately, but on the next rep recalc.  Post deletion is the biggest factor here, previously it didn't (immediately) account for the reputation impact...that will no longer be the case.  Reputation changes from the deletion will now be applied within the hour, and most other changes will be instant.  Now the part that will make everyone throw vegetables our way:  this will require a global recalc to get everything in sync.  We'll be rolling it out first here on meta, then the rest of the network...the enabling of the detailed rep view and global recalc on each individual site will coincide.  During the rollout you will see empty reputation tabs on profiles as we transition to the new storage behind the scenes, they'll be restored as the recalc rolls though each user.  We’ll put up a blog post on  before the network-wide rollout.  If you have any questions about this change or details I may have left out, please do so in answers below so that we can clear up as much as possible before this rolls out. I was thinking about writing a partial derivative macro that has a similar syntax to the . ()  The syntax could be like this:   \D{f}{x} expands to \frac{\partial f}{\partial x} \D{f}{x,y} expands to \frac{\partial^2 f}{\partial x\,\partial y} \D{f}{{x,2},y} expands to  \frac{\partial^3 f}{\partial x^2\,\partial y} et cetera for any number of derivatives.   Bonus points for an optional argument so that for instance   \D[subscript]{f}{{x,2},y} expands to f_{xxy}   I looked at the  package but the syntax is a little tedious.  For instance, to get \frac{\partial^3 f}{\partial x^2\,\partial y} with that package I would need to do \md{f}{3}{x}{2}{y}{}.  And it doesn't generalize to three variables.  Before I dive in I thought I'd ask the hive and see what's been done. Selecting the size of a System.Drawing.Icon? I'd like to use a different + symbol in addition to + in math mode, preferably one which is just bolder than the standard one.  I'm currently using \pmb{+} from the amsbsy package, but it's a bit too lean for my taste, and it looks a bit pointy to the ends.   I am aware of \ding{58} from the pifont package, as well as \Plus from bbding, both of which seem to be non-math mode symbols, and look really bad next to math symbols.  Am I missing some other option to produce a bold +, apart from drawing the symbol myself? Are there tips and tricks for people with fear of flying that can makes them have a more pleasant experience when flying? I know drugs can do magic, and . I'm ideally after official advice and recommendations, but other tips and tricks would be nice as well. How to convert Wubi install into regular install? I have installed Ubuntu on my D: partition using Wubi. Is there any way in which I can remove my Windows from C: drive and move my existing Ubuntu installation to C: drive and make it a regular install. How do I show the current node title in page.html.twig OR in node.html.twig? If I want to show the current node title in page.html.twig (by default it seems to only be available in node.html.twig) I have to create a preprocess function like so:  function theme_preprocess_page(&amp;$variables, $hook) {   // Set our page title so we can access it in page.html.twig   if ($node = \Drupal::routeMatch()-&gt;getParameter('node')) {     $variables['my_node_title'] = $node-&gt;title-&gt;value;   } }   And then I have to overwrite page-title.html.twig by copying it into my current theme folder and commenting out everything.  This doesn't seem "right".  Is there a better way? Archive by Year How to remove duplicate entries in dash? For positive invertible operators $C\leq T$ on a Hilbert space, does it follow that $T^{-1}\leq C^{-1}$? Cardinality of a set of closed intervals What is the cardinality of the set S of all closed intervals on the real number line with rational (positive) lengths?  I believe the number of intervals with a specific fixed length but varying start points is |R|, and the number of intervals with a fixed start point but varying lengths is |Q| = |N|. I think the answer to the question would then be |S| = |R x N| = |R|? I'm not quite sure how to prove the last equality though. Would I have to define a bijective function that maps elements of (R, N) to R? How would I approach doing so? I need to include a couple of Python code listings, where the indentation of the lines (using some number of spaces) is significant. I would like for the code listings to be copyable, so the spaces at the beginning of the line need to be be copied along with the text.  This question has been asked in various ways before (e.g. , or ). Those questions focus on making line numbers uncopyable, though.  Making the spaces at the beginning of a line copyable seems to be harder: "I am not sure it is possible to specify in the PDF (at least in a viewer-independent way) that the indentation should be copied too" (). At , Philippe Goutet suggests a solution (turning the spaces into visible spaces, and coloring them in the background color so that they appear invisible) that works using Acrobat Reader, but not all readers. He says "It works under Acrobat Reader and it's extremely pleasant to be able to quickly copy/paste code without problem (perhaps the problem can be circumvented by writing direct PDF code to tell that it's a space, I've never had the time to try)".  Is it possible to produce a PDF with a code listing with copyable real spaces at the beginning of a line?  Minimal example: The line return x should start with four spaces.  \documentclass{article}  \begin{document} \begin{verbatim} def myfunction(x):     return x \end{verbatim} \end{document}   I know that I could attach the code to the PDF as a file, but that's not what I want.