When I write a friend declaration like this  template&lt;typename T&gt; struct Foo {};  struct Bar {      friend class Foo&lt;Bar&gt;; };   everything is fine. However, when I use a typedef  template&lt;typename T&gt; struct Foo {};  struct Bar {     typedef Foo&lt;Bar&gt; FooBar;      friend class FooBar; };   gcc (4.4.7) complains with  error: using typedef-name ‘Bar::FooBar’ after ‘class’  error: ‘Bar::FooBar’ has a previous declaration here  error: friend declaration does not name a class or function   I always thought a typedef behaves exactly the same as if I typed the original type.... Is it not allowed to use a typedef here? or am I just using it wrong?  PS: the template turned out to be a red herring, the following will cause the same error  struct Foo{}; struct Bar{     typedef Foo FooBar;     friend class FooBar; };
Does anyone know why typedefs of class names don't work like class names for the friend declaration?  class A { public: };  class B : public A { public:    typedef A SUPERCLASS; };  typedef A X;  class C { public:    friend class A;             // OK    friend class X;             // fails    friend class B::SUPERCLASS; // fails };
Calculating $\int_{|z|=2}\frac{e^{1/z^2}}{1-z}dz$ Find the value of $\displaystyle\int_{|z|=2}\frac{e^{1/z^2}}{1-z}dz$   The first idea I had was to apply Cauchy's integral formula. But can this be done? $e^{1/z^2}$ is not holomorphic on the interior of $|z|=2$. Still, if we would apply this we would obtain:  $\displaystyle\int_{|z|=2}\frac{e^{1/z^2}}{1-z}dz=-2\pi ie$.  Another way I think, is to apply the residue theorem. For $1-z$ has a simple zero at $z=1$ and $e^{1/1^2}\neq 0$, then the residue of $e^{1/z^2}/(1-z)$ at $z=0$ is $-e$. Again we obtain $2\pi iRes(g;0)=-2\pi ie$, where $g=\frac{e^{1/z^2}}{1-z}$.  But again, it seems to me this is not right because $g$ has two singularities, at $z=1$ and $z=0$. What we might do about $z=0$? The answer is not $-2\pi i e$? Cropping Shapefiles in QGIS? HTTP GET request in JavaScript? I need to do an  request in JavaScript. What's the best way to do that?  I need to do this in a Mac OS X dashcode widget. Game Theory and Uniform Distribution question? In an Auction , two players are  bidding. Their bids will be a unknown fraction of their valuations. The valuations come from a uniform distribution $$[0,1] $$  If Player 2 bids $$ v/2 $$  and Player 1 bids $$b1&lt;1/2$$   What is the probability player 1 wins ? Clearly for player 1 to win,players 2 bid has to be less than player 1 bids. $$P(v/2 &lt; b1)$$  $$P(v &lt; 2b1)$$ I follow the question up to this stage. Now it says since its uniformly distributed the probability player 1 wins is $$2b1$$ Im confused how can you just get 2b1 from the inequality ?  Thanks in advance I want to calculate the posterior distribution given a gamma-prior and a poisson likelihood. The task is from a textbook and I just have the solutions (without a walkthrough). Please find all given information in the following:  Given information:  $m$ countries each with a population of $n_i$; $y_i$ is the number of people having a disease; $y_i$ is a poisson random variable with mean $\frac{n_i*\lambda}{100}$  The prior distribution for $\lambda$: $\lambda \sim Gamma(a_0,b_0)$  Task:  Show that the posterior distribution is also a gamma distribution with $a_m = a_0 + \sum_{i = 1}^{m}y_i$ and $b_m = b_0 + \sum_{i = 1}^{m} \frac{n_i}{100}$  My solution:  $Posterior \propto Likelihood \times Prior$  $p(\theta|y) \propto \prod_{i=1}^{m}(\theta^{y_i}e^{-\theta})\times \theta^{a_0-1}e^{-b_0\theta}$  $p(\theta|y) \propto \theta^{\sum_{i = 1}^{m}y_i}e^{-m\theta}\times \theta^{a_0-1}e^{-b_0\theta}$  $p(\theta|y) \propto \theta^{\sum_{i = 1}^{m}y_i+a_0-1}e^{-\theta(m+b_0)}$  $a_m = a_0 + \sum_{i = 1}^{m}y_i$  $b_m = b_0 + m \neq b_0 + \sum_{i = 1}^{m} \frac{n_i}{100}$  I think I am doing a mistake, because I don't know how to incorporate the information that the mean of $y_i$ is given as $\frac{n_i*\lambda}{100}$. Or do I just have to transform $b_m$ somehow? Can someone may give me a hint?   Thank you already in advance!  Edit 1: Considering first advices  $Likelihood: p(y | \theta) \propto \prod_{i=1}^{m}(\frac{n_i\lambda}{100})^{y_i}e^{-\frac{n_i\lambda}{100}}$  $\propto \prod_{i = 1}^{m} ((\frac{n_i}{100})^{y_i})\lambda^{\sum_{i=1}^{m}y_i}e^{-\lambda\sum_{i=1}^{m}\frac{n_i}{100}}$  $\propto \lambda^{\sum_{i=1}^{m}y_i}e^{-\lambda\sum_{i=1}^{m}\frac{n_i}{100}}$  Is the transformation of $\prod_{i=1}^{m}$ I did from the first to the second step correct? SELECT permission on view querying table from another database SQL Server 2008 R2 SP1  My company uses the Great Plains (GP) financial system with several customizations.  Our Value-Added-Reseller (VAR) for GP has setup most of these customizations in a separate database from the GP data called DYNCUSTOM.  In the DYNCUSTOM database is a View that is merely a SELECT * FROM a table in the GP company database (called PARTS).  I was approached by a user having problems trying to select on this view.  The error he was getting:  Msg 229, Level 14, State 5, Line 2 SELECT permission denied on object 'BM010415', database 'PARTS', schema 'dbo'   I looked at how his login was mapped and he had a database user in the DYNCUSTOM database belonging to a database role that was granted select on the view.  However, he did not have a database user in the PARTS database.    Usually the intent of a view is so that one can grant select permissions on the view without exposing access to the underlying table.  With SQL Server however, if the view crosses databases does it then change the security context being used?  Therefore, the user would also need a database user in the PARTS database as well as granted select access to the underlying table? What kind of questions can I expect to see on a qualifying exam? Host alias for ssh There are a few SSH destinations I will frequently be connecting to and I'm wondering if rather than remember the IP address I can create a host alias for them.  I'd like to be able to use...  ssh -p xx user@domain.ssh  I've tried establishing this host in /etc/hosts and unless there's a service I needed to restart it had no effect. Consider the vectorspace of all real $m \times n$ vectors and define an    inner product $\langle A,B\rangle = \operatorname{tr}(B^T   A)$.    "tr" stands for "trace"        which is the sum of the diagonal entries of a matrix.   How do you prove that $\operatorname{tr}(B^T   A)$ is indeed a inner product?  Kind regards How to typeset the symbol “^” (caret/circumflex/hat) I need to display the symbol '^'  d &lt;- dist(fascores, method = "euclidean")^2   How do I do that? I keep reading about  ('PPAs') and people answer questions with a link to a PPA. What's the best way to use these?     There are multiple valid answers for this question spanning over several versions of Ubuntu. For your convenience, an index of each is below. Evaluating the sum after reordering an infinite series $1-\frac {1} {2}+\frac {1} {3}-\frac {1} {4}+\ldots $ If in the series  $1-\dfrac {1} {2}+\dfrac {1} {3}-\dfrac {1} {4}+\ldots $ the order of the terms be altered, so that the ratio of the number of positive terms to the number of negative terms in the first $n$ terms is ultimately $a^{2}$, show that the sum of the series will become $\log \left( 2a\right) $.  Solution attempt. Let $p$ be the number of positive terms in the first $n$ terms of the reordered series so based on the question we are allowed $a^{2}=\dfrac {p} {n-p}$. Now solving for p we get $p=\dfrac {a^{2}n} {\left( 1+a^{2}\right) }$ and $n-p=\dfrac {n } {\left( 1+a^{2}\right) }$.  We also observe that in the original series only the odd terms are positive and only the even terms are negative.  Let's define $S_{odd}=1+\dfrac {1} {3}+\dfrac {1} {5}+.\ldots +\dfrac {1} {2n-1}$ and $S_{even}=\dfrac {-1} {2}\dfrac {-1} {4}\ldots -\dfrac {1} {2n}$  $S_{Reordered}=S_{odd_{p}}+S_{even_{n-p}}$  $S_{Reordered}=\sum _{t=1}^{t=P}\dfrac {1} {2t-1}+\sum _{t=1}^{t=(n-P)}\dfrac {-1} {2t}$ $S_{Reordered}=\sum _{t=1}^{t=\dfrac {a^{2}n} {\left( 1+a^{2}\right) }}\dfrac {1} {2t-1}+\sum _{t=1}^{t=\dfrac {n } {\left( 1+a^{2}\right) }}\dfrac {-1} {2t}$    In order to extend $S_{Reordered}$ from n terms to an infinite length. I guess i should take the limit of the $S_{Reordered}$ as $n\rightarrow \infty $ which would make the upper values of $t$ (Not sure of technical term here) to be $\infty$ giving me   $S_{Reordered}=\sum _{t=1}^{t=\infty}\dfrac {1} {2t-1}+\sum _{t=1}^{t=\infty}\dfrac {-1} {2t}$   and i have lost the $a$ from the expression. I guess i am stuck i need to perform some step to capture a before taking the limit. Any help would be much appreciated. Change default code page of Windows console to UTF-8 Currently I'm running Windows 7 x64 and usually I want all console tools to work with UTF-8 rather than with default code page 850.  Running chcp 65001 in the command prompt prior to use of any tools helps but is there any way to set is as default code page?  Update:  Changing HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\OEMCP value to 65001 appear to make the system unable to boot in my case.  Proposed change of HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\Autorun to @chcp 65001&gt;nul served just well for my purpose. (thanks to ) Stack Overflow is a site of passers-by They says that Stack Overflow is a community-driven web-site. But, as a matter of fact, it is not.  There is no community at all. It's more like an imageboard, as a number of participants makes them pretty much like anonymous to each other despite of registration.   Stack Overflow is a site of passers-by.  Passers-by who want to solve their silly typo problem and passers-by who eager to share their vast knowledge in spotting silly typos. And - oh - sometimes to perform a civic duty and vote to close a question they have no idea what to answer to and thus calling it "not a real question".  So, as a funny consequence, whatever question can get   answered upvoted downvoted closed deleted   depends not on its quality but only on the fluctuation happened to "community" at the given moment, at a pretty random rate.  It is not only quite discouraging. It makes the very idea of collecting and improving knowledge quite impossible. In theory, is it possible that the loss on the train set will increase together with the train set accuracy? (in the normal case the train set loss should go down) And vice versa, can the train loss decrease along with the accuracy?   Note: This is obviously different than the classic underfit / overfit cases which are easier to grasp. I have seen this many times, a question is being asked because a previous, duplicate question was asked and answered a few years ago and has no longer relevant answers.  The  is to edit the old question, or add new answers to it, but it is not always happening.  I was wondering, should I still mark it as duplicate and vote to close it? Or just leave it as is? Can I completely disable Cortana on Windows 10? How do you find the Lie algebra of a Lie group (in practice)? Given a Lie group, how are you meant to find its Lie algebra?  The Lie algebra of a Lie group is the set of all the left invariant vector fields, but how would you determine them?  My group is the set of all affine maps $x \rightarrow A.x+v$ from $R^n$ to $R^n$ under function composition. Modifying C string constants? Selecting all files in directory for merging in QGIS Processing? I'm writing a generic script which involves writing shapefiles to a directory which are then merged together. After writing the files out to the Output folder, I'm trying to get the saga:mergeshapeslayers algorithm to merge all the files in the Output folder. I have used the Model Builder and although it is helpful to an extent, I find that it is used for specific purposes whereas I am attempting to make a script for generic purposes.   Code:  ##Test=name ##Select_folder=folder ##Result=output vector  import os import glob  path_1 = Select_folder path = path_1 os.chdir(path)  def function():      output = glob.glob(path_1 + './*.shp')     x = 0      while output[x]:         for fname in glob.glob("*.shp"):             outputs_1 = processing.runandload("qgis:fieldcalculator", output[x], 'Number', 1, 10, 0, True, 1 , "C:\Users\Me\Desktop\Output\\"  + fname)             multiple_0 = glob.glob("*.shp")             x = x + 1          if x + 1 &gt; len(output):             processing.runalg("saga:mergeshapeslayers", output[0], ";".join(multiple_0) , Result)             break         else:             continue  if path_1:     function() else:    pass