Here is a simplified version of the code I am trying to write:  template&lt;typename Derived&gt; class StateMachine { public:   void SetState(Derived::State s) {     static_cast&lt;Derived*&gt;(this)-&gt;TransitionTo(s);   } };  class MyFSM : public StateMachine&lt;MyFSM&gt; { public:   enum class State {     State1,     State2,     State3   };   void TransitionTo(State s) {     _state = s;   } private:   State _state = State::State1;   };   I'm using c++11 with clang. The error I get here is 10:17: error: missing 'typename' prior to dependent type name 'Derived::State' for the declaration of SetState. I've also tried adding typename Derived::State DerivedState; and then using DerivedState instead of Derived::State, but then I get error: unknown type name 'DerivedState'.  More confusing still, I tried typedef typename Derived::State DerivedState; and then I get the error: error: no type named 'State' in 'MyFSM'. my last try was typedef enum class Derived::State DerivedState; and then I get the most confusing error of all: error: no enum named 'State' in 'MyFSM'.  I'm out of my depth with templates here and would welcome any help understanding this! Also, there may be a better pattern to use here. The main thing I'm going for is that the StateMachine class has some common functionality and then there are a bunch of different state machines, each with their own state and transition function. I have another way of doing it that requires passing in this to SetState (when called from within MyFSM, which is a simplified version of what I'm doing), but that's ugly for it's own reason. I'd love to avoid this tempalted class thing, but my main goal is making the derived classes as easy to write and understand as possible.
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?
Both sides differentiation expression with integral I have a problem with derivation of some function. This is related to computing the Poincare Map of Logistic Population model with Periodic harvesting. This function is:  $\phi(t,x_0) = x_0 + \int_{0}^{t} f(s,\phi(s,x_0)) ds $,  where $\phi(t,x_0)$ is a function: $\mathbb{R}  \times \mathbb{R} \rightarrow \mathbb{R}$.  I'm trying to differentiate  equation of this function both sides  with respect to $x_{0}$. In book from this equation comes from the result of this differentiation is:  $\frac{\partial \phi}{\partial x_0} (t,x_0) = 1 + \int_0^{t} \frac{\partial f}{\partial x_0} (s, \phi(s,x_0)) \cdot \frac{\partial \phi}{\partial x_0} (s, x_0)ds$.  I can't understand expression under the integral. In this book it is explained that it is clear from chain rule.Could someone explain to me this transformation in easy way? I will be grateful for your help Best regards What is currently the best way to get a favicon to display in all browsers that support Favicons? Test if there are files matching a pattern in order to execute a script Exploring $ \sum_{n=0}^\infty \frac{n^p}{n!} = B_pe$, particularly $p = 2$. I was exploring the fact that $$ \sum_{n=0}^\infty \frac{n^p}{n!} = B_pe,$$ where $B_n$ is the $n$th Bell number.   I found this result by exploring the series on wolframalpha and looking up the sequence of numbers generated. I have no experience with Bell numbers other than knowing that they represent the number of ways of partitioning a set.   What I tried  Looking at the base case we can verify $$\sum_{n=0}^\infty \frac{n}{n!} = \sum_{n=1}^\infty \frac{1}{(n-1)!} = e. $$  But then I realize that $n^2$ is going to be difficult.  Specifically what I want  I am doing this for fun, so I just want to glean some sort of lesson out of this. Resources that let me learn for myself are just as good!   An accepted answer will have any one of the following:   A proof that $\sum_{n = 0}^{\infty} \frac{n^2}{n!} = 2e$ (this interests me a lot) A description of why this series is related to Bell numbers and the number of partitions of a set A link to some resource that introduces Bell numbers and/or their connection to this series. Iterate a list as pair (current, next) in Python Prove $(a+b)^\frac{1}{n} \le a^\frac{1}{n} + b^\frac{1}{n}$ Prove: $$ (a+b)^\frac{1}{n} \le a^\frac{1}{n} + b^\frac{1}{n}, \qquad \forall n \in \mathbb{N} $$ I have have tried using the triangle inequlity $ |a + b| \le |a| + |b| $,  without any success. Scale settings for exporting to STL (for 3d printing) I've set my Units (in scene properties) to Metric, and the Scene Scale to 0.01 hoping to get the Blender dimensions it mm's. While the (normal) scale is 1 for x,y,z, the standard cube has the dimensions 2x2x2 cm. When I export this to an STL and open it in a slicing program (Netfabb, Slic3r or Cura) they all give the dimensions: 2x2x2 mm. While exporting, the scale is 1.  What am I doing wrong? I hope you can help me.  Thanks! I am using Windows 10. I am trying to install 1 open source software.  In the readme.txt of that software, it says it requires Visual C++ 2008 Redistributable. I found that my Windows already has Visual Studio 2012 Redistributable installed.  After I install the open source software, it seems that it is working, even though I haven't installed Visual C++ 2008 Redistributable.  Do I need to install Visual C++ 2008 Redistributable if my Windows already has Visual Studio 2012 Redistributable? $$I(\alpha)=\int_0^1 \frac{x^\alpha-1}{\ln x}dx.$$  As the title says, if someone could solve this without using the differentiation under the integral sign technique, I would be very grateful. I'd like to call a function in python using a dictionary.  Here is some code:  d = dict(param='test')  def f(param):     print(param)  f(d)   This prints {'param': 'test'} but I'd like it to just print test.  I'd like it to work similarly for more parameters:  d = dict(p1=1, p2=2) def f2(p1, p2):     print(p1, p2) f2(d)   Is this possible? Using Leibniz Integral Rule on infinite region I am trying to take the derivative with respect to $a$ of some function $I(a)=\int_{0}^{\infty}f(a,x)dx$.  I would like to make sure that I am using the  correctly.  Various web sources indicate a set of conditions that must hold for $f(x,a)$ and $\frac{\partial f(x,a)}{\partial a}$ when integration is done over infinite region.  From reading  (see Theorem 10.3 on page 13) the conditions that $f(x,a)$ and $\frac{\partial f(x,a)}{\partial a}$ must obey are:   $f(x,a)$ and $\frac{\partial f(x,a)}{\partial a}$ are continuous over $x\in[0,\infty)$ and around $a$ that we are interested in. There exists an integrable function (over $x$) $g(x)$ such that $|\frac{\partial f(x,a)}{\partial a}|\leq g(x)$. There exists an integrable function (over $x$) $h(x)$ such that $|f(x,a)|\leq h(x)$.   Integrable here means $\int_{-\infty}^{\infty}g(x)dx&lt;\infty$.  However,  seems to omit condition 3 above.  I am wondering which source is correct.  If there are "both correct", when is condition 3 necessary? Why do we use microwaves in microwave oven? We know that any object above absolute zero emits electromagnetic radiation. So hotter the object shorter the wavelengths. In the electromagnetic radiation spectrum radio waves has the longest then microwave, then infrared, then visible light, then ultraviolet, then x-ray, then gamma rays. Why do we use microwaves in microwave oven when infrared and visible light are much hotter and how do microwaves cook food when they are cooler than visible light and others. Interface vs Base class Why don't files from Xbox 360 show up when USB drive is plugged into computer? I'm using a Lexar JumpDrive S73 32GB USB flash drive. I've configured it on my Xbox 360 and got a message saying it's compatible and meets the standards, but when I plug in it in my computer no files show up, even in Horizon.   After the driver was installed, both the USB mass storage and Lexar JumpDrive USB device were ready to use (installed properly), but it said no driver found for Xbox 360.    I tried looking for some sort of driver (which sounds silly) but I couldn't find anything.  I'm attempting to mod Minecraft on my Xbox and I don't want to buy another USB. If I insert a flash drive and try to drag any files onto desktop - nothing happens.  Or from any other folder.  Drag 'n copy only works if you open desktop in nautilus ("show desktop in files").  I already ran the command:  gsettings set org.gnome.nautilus.preferences use-experimental-views false   It didn't help. How to fix this? How to calculate $\lim_{n\to\infty}(1+1/n^2)(1+2/n^2)\cdots(1+n/n^2)$? How can we compute the following limit:     $$\lim_{n\to\infty}(1+1/n^2)(1+2/n^2)\cdots(1+n/n^2)$$   Mathematica gives the answer $\sqrt{e}$. However, I do not know to do it. What is the most efficient way to deep clone an object in JavaScript? Label PGFPlot table points with coordinates I would like to label each plotted point with its x and y coordinate. I am able to label with a single one using the MWE below. I must avoid manually labeling each point since my actual table size is larger and will be changed out regularly. \documentclass{standalone}   \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.16}  \begin{document}  \pgfplotstableread[col sep=&amp;,row sep=\\]{  x     &amp;  y     \\  0.940 &amp;  0.992 \\  0.992 &amp; -0.940 \\ -0.992 &amp;  0.940 \\ -0.940 &amp; -0.992 \\ }\mytable  \begin{tikzpicture}  \begin{axis}     \addplot+[only marks, nodes near coords]table[x=x,y=y,meta=x]{\mytable}; \end{axis}  \end{tikzpicture} \end{document}  which creates the following figure  The desired output is for each point to be labelled with both coordinates. For specific example the top left point would be labelled with &quot;(0.94, 0.992)&quot;. How do I change NEI to cheat mode? Shell script throws a not found error when run from a sh file. But if entered manually the commands work I'm trying to use the following script to generate a sitemap for my website. When I run it as sh thsitemap.sh I get an error like this and creates an empty sitemap.xml file:  thsitemap.sh: 22: thsitemap.sh: [[: not found thsitemap.sh: 42: thsitemap.sh: [[: not found thsitemap.sh: 50: thsitemap.sh: Syntax error: "(" unexpected   But as the same user root when I manually copy and paste these lines on the terminal, it works without any error and the sitemap.xml file have all the urls. What's the problem? How can I fix this?  #!/bin/bash ############################################## # modified version of original http://media-glass.es/ghost-sitemaps/ # for ghost.centminmod.com # http://ghost.centminmod.com/ghost-sitemap-generator/ ############################################## url="techhamlet.com" webroot='/home/leafh8kfns/techhamlet.com' path="${webroot}/sitemap.xml" user='leafh8kfns'       # web server user group='leafh8kfns'      # web server group  debug='n' # disable debug mode with debug='n' ############################################## date=`date +'%FT%k:%M:%S+00:00'` freq="daily" prio="0.5" reject='.rss, .gif, .png, .jpg, .css, .js, .txt, .ico, .eot, .woff, .ttf, .svg, .txt' ############################################## # create sitemap.xml file if it doesn't exist and give it same permissions # as nginx server user/group if [[ ! -f "$path" ]]; then     touch $path     chown ${user}:${group} $path fi  # check for robots.txt defined Sitemap directive # if doesn't exist add one # https://support.google.com/webmasters/answer/183669 if [ -f "${webroot}/robots.txt" ]; then SITEMAPCHECK=$(grep 'Sitemap:' ${webroot}/robots.txt)     if [ -z "$SITEMAPCHECK" ]; then     echo "Sitemap: http://${url}/sitemap.xml" &gt;&gt; ${webroot}/robots.txt     fi fi ############################################## echo "" &gt; $path  # grab list of site urls list=`wget -r --delete-after $url --reject=${reject} 2&gt;&amp;1 |grep "\-\-"  |grep http | grep -v 'normalize\.css' | awk '{ print $3 }'`  if [[ "$debug" = [yY] ]]; then     echo "------------------------------------------------------"     echo "Following list of urls will be submitted to Google"     echo $list     echo "------------------------------------------------------" fi  # put list into an array array=($list)  echo "------------------------------------------------------" echo ${#array[@]} "pages detected for $url"  echo "------------------------------------------------------"  # formatted properly according to # https://support.google.com/webmasters/answer/35738 echo "&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt; &lt;urlset xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9  http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"&gt;" &gt; $path  echo '     ' &gt;&gt; $path;    for ((i=0;i&lt;${#array[*]};i++)); do echo "&lt;url&gt;     &lt;loc&gt;${array[$i]:0}&lt;/loc&gt;     &lt;lastmod&gt;$date&lt;/lastmod&gt;     &lt;changefreq&gt;$freq&lt;/changefreq&gt;     &lt;priority&gt;$prio&lt;/priority&gt; &lt;/url&gt;" &gt;&gt; $path    done echo "" &gt;&gt; $path echo "&lt;/urlset&gt;" &gt;&gt; $path  # notify Google # URL encode urls as per https://support.google.com/webmasters/answer/183669 if [[ "$debug" = [nN] ]]; then     wget  -q --delete-after http://www.google.com/webmasters/tools/ping?sitemap=http%3A%2F%2F${url}%2Fsitemap.xml      rm -rf ${url} else     echo "wget  -q --delete-after http://www.google.com/webmasters/tools/ping?sitemap=http%3A%2F%2F${url}%2Fsitemap.xml"      echo "rm -rf ${url}" fi echo "------------------------------------------------------"  exit 0