In a medium size code I have a base class like this  class Base { public:  virtual ~Base() = 0; //This is the important point };   In a derivate class I have something like this  class Derivate : public Base { public:  ~Derivate(); };   An implementation of the virtual constructor is provided (it basically does some deallocation on the base class) the derivate class extends such behaviour to the derivate class. Since the base class is abstract I cannot instantiate anything.  I have a wrapper class like this  class Wrapper {  public:    ~Wrapper();  private:    Base *stuff; }   Now I could have several derivates classes of the base one, so basically the purpose would be to let the user have the freedom of chose what to put in stuff The destructor of Wrapper is implemented as  Wrapper::~Wrapper() {   stuff-&gt;~Base(); }   (My actual code follows such pattern). However when the destructor of wrapper is called an error is returned when I debug using gdb, where basically is stated that ~Base() Is a pure virtual method, which is true, however I thought that because is virtual anyway the actual constructor of the derivate class would have been called instead.  Is my understanding wrong? What Am I missing? Shall I decler the destructor of Base just as virtual and not pure virtual?  Note : Please keep in mind that the code I posted is a just some scratch.  Thank you.
Is it wrong to write:  class A { public:     virtual ~A() = 0; };   for an abstract base class?  At least that compiles in MSVC... Will it crash at run time?
BasicTeX - how to identify packages that need to be added after an upgrade Is there an idiom available, that is exactly opposite to "Cake walk" or "Child's play"? A conceptual doubt regarding Forced Oscillations and Resonance While studying about the Resonance and Forced Oscillations, I came across a graph in my textbook that is given below:-  Now, the author writes      As the amount of damping increases, the peak shifts to lower frequencies.   Why does this happen? And does this imply that at higher damping levels one cannot achieve a higher amplitude by setting the period of the forced oscillation to be equal to the natural frequency? This seems strange because, the highest amplitude is achieved when the natural frequency is equal to the driving frequency. But, I guess that the rules are somehow different for the damping case. How do I calculate $\lim_{x\rightarrow 0} x\ln x$ I was thinking about the reasons behind $0^0=1$ and I remember one of my friends studying math arguing about the continuity of the function $x^x$ in $0$. But when I write as $$x^x=e^{x\ln x}$$ I am now looking at $$\lim_{x\rightarrow 0} x\ln x$$ Graphically I can see in Mathematica that it goes to $0.$ But I can't calculate by using a Taylor expansion, because I can't expand log around $0$. How do you prove that? How to plot a function in integral form with TikZ? how to plot the function $f:x\mapsto \int_x^{2x}\frac{4}{\sqrt{1+t^4}}\, \textrm{d}t$ with TikZ? I have a stubborn folder that someone must have created accidentally and that has persisted all this time. I can see it with:  # find /var/www/html -maxdepth 1 -type d   which gives me:  /var/www/html /var/www/html/files /var/www/html/.?   unfortunately the question mark there is not the actual character ?, it merely seems to denote that there is no proper glyph and/or translation for that character. So something like rmdir is out of the question. My system has UTF-8 as the default locale as so many modern Ubuntu systems, but admittedly the folder in question may have originated on a RHEL or CentOS box (tared up and unpacked).  # env|grep LANG LANG=en_US.UTF-8   When trying to cd .\? (as mentioned before it is not actually ?) I get auto-corrected to . by bash and actually end up in /var/www/html/. for some reason. Now if I can't "name" this folder usefully, I cannot access it in any way. How can I get rid of it without putting the whole system in jeopardy?  Now I installed detox already but that only seems to act on files, not folders, according to its documentation and besides it still requires that I be able to name the object somehow to do something with it. When is it appropriate to end a question without a question mark? Use of a semicolon before and comma after "however" Several years ago, a previous boss told me to use a semicolon and comma with the word "however".  I've always questioned this and would like to know if the following random sentences are using the correct method.        Our plane was delayed overnight; however, the airlines reimbursed us for lodging.   It looks as though he's upset; however, she told me he always has that look on his face.   I want to find him a nice gift; however, I am a broke until payday.      Normally I would use a less "wordy" sentence in casual writing, but hopefully the example will suffice.  For example, on number 3 I would usually type:      I want to get him a nice gift, but I'm broke until payday. I am trying to use squared loss to do binary classification on a toy data set. I am using mtcars data set, use mile per gallon and weight to predict transmission type. The plot below shows the two types of transmission type data in different colors, and decision boundary generated by different loss function. The squared loss is $\sum_i (y_i-p_i)^2$ where $y_i$ is the ground truth label (0 or 1) and $p_i$ is the predicted probability $p_i=\text{Logit}^{-1}(\beta^Tx_i)$. In other words, I am replace logistic loss with squared loss in classification setting, other parts are the same. For a toy example with mtcars data, in many cases, I got a model &quot;similar&quot; to logistic regression (see following figure, with random seed 0).  But in somethings (if we do set.seed(1)), squared loss seems not working well.  What is happening here? The optimization does not converge? Logistic loss is easier to optimize comparing to squared loss? Any help would be appreciated.  Code d=mtcars[,c(&quot;am&quot;,&quot;mpg&quot;,&quot;wt&quot;)] plot(d$mpg,d$wt,col=factor(d$am)) lg_fit=glm(am~.,d, family = binomial()) abline(-lg_fit$coefficients[1]/lg_fit$coefficients[3],        -lg_fit$coefficients[2]/lg_fit$coefficients[3]) grid()  # sq loss lossSqOnBinary&lt;-function(x,y,w){   p=plogis(x %*% w)   return(sum((y-p)^2)) }  # this random seed is important for reproducing the problem set.seed(0)  x0=runif(3) x=as.matrix(cbind(1,d[,2:3])) y=d$am opt=optim(x0, lossSqOnBinary, method=&quot;BFGS&quot;, x=x,y=y)  abline(-opt$par[1]/opt$par[3],        -opt$par[2]/opt$par[3], lty=2) legend(25,5,c(&quot;logisitc loss&quot;,&quot;squared loss&quot;), lty=c(1,2)) $\Delta U$, $C_p$, $C_v$ for an ideal gas process What is the size of an enum in C? I'm creating a set of enum values, but I need each enum value to be 64 bits wide. If I recall correctly, an enum is generally the same size as an int; but I thought I read somewhere that (at least in GCC) the compiler can make the enum any width they need to be to hold their values. So, is it possible to have an enum that is 64 bits wide? Recently I began studying machine learning, however I failed to grasp the intuition behind .   The following are the facts about logistic regression that I understand.   As the basis for hypothesis we use . I do understand why it's a correct choice, however why it's the only choice I don't understand. Hypothesis represents the probability that the appropriate output is $1$, therefore the domain of our function should be $[0,1]$, this is the only property of sigmoid function I found useful and appropriate here, however many functions satisfy this property. In addition, sigmoid function has a derivative in this form $f(x)(1-f(x))$, but I don't see the utility of this special form in logistic regression.   Question: what so special about sigmoid function, and why we cannot use any other function with domain $[0,1]$? The cost function consists of two parameters ${\rm Cost}(h_{\theta}(x),y)=-\log(h_{\theta}(x))$ if $y=1, {\rm Cost}(h_{\theta}(x),y)=-\log(1-h_{\theta}(x))$ if $y=0$. In the same was as above, I do understand why it's correct, however why is it the only form? For example, why couldn't $|h_{\theta(x)}-y|$ be a good choice for the cost function?  Question: what is so special about the above form of cost function; why cannot we use another form?   I would appreciate if you could share your understanding of logistic regression. Survival probability up to time $n$ in a branching process. Let $\{Z_n : n=0,1,2,\ldots\}$ be a Galton-Watson branching process with time-homogeneous offspring distribution $$\mathbb P(Z_{n,j} = 0) = 1-p = 1 - \mathbb P(Z_{n,j}=2), $$ where $0&lt;p&lt;1$. That is, $Z_0 = 1$ and $$Z_n = \sum_{j=1}^{Z_{n-1}}Z_{n,j}$$ for $n\geqslant 1$. Let  $$T=\inf\{n : Z_n=0\} $$ be the extinction time of the process. I want to find $$t_n := \mathbb P(T&gt;n), $$ i.e. the probability that the process survives up to time $n$. I found the following recurrence:  $$t_{n+1} = p(2t_n - t_n^2)$$ (with $t_0=1$) from this mathoverflow question:   I checked the recurrence for small values of $n$, and confirmed that $t:=\lim_{n\to\infty} t_n$ satisfies $$ t = p(2t - t^2),$$ both in the case where $t=0$ $\left(p\leqslant\frac12\right)$ and where $t=2-\frac1p$ $\left(p&gt;\frac12\right)$. So I'm fairly confident this recurrence is valid. However, I have no idea how to solve it.  For context, this problem comes from Adventures in Stochastic Processes by Sidney Resnick:   From @Did's comment, it appears to be intractable to find a closed form for $\mathbb P(T&gt;n)$. I find it curious that the question would be asked were it not, though. In C#, what is the best way to access a property of the derived class when the generic list contains just the base class.  public class ClassA : BaseClass {    public object PropertyA { get; set; } }  public class ClassB: BaseClass {     public object PropertyB { get; set; } }  public class BaseClass { }  public void Main {     List&lt;BaseClass&gt; MyList = new List&lt;BaseClass&gt;();     ClassA a = new ClassA();     ClassB b = new ClassB();      MyList.Add(a);     MyList.Add(b);      for(int i = 0; i &lt; MyList.Count; i++)     {         //I would like to access PropertyA abd PropertyB from the derived classes             } } Product of manifolds & orientability A two way String hash function Problem with >> inside of \tt I have an inline code example with a nested Java generic declaration, using the typewriter typeface. However, the closing &gt;&gt; is rendering as a black box. A cursory Google search suggested $&gt;&gt;$, but this removes the typewriter font. Using \textgreater in place of the actual &gt; also encounters the same problem. Here is the offending snippet:  ...declaration {\tt List&lt;Map&lt;Integer, String&gt;&gt;} is...   Any ideas? Hogsmeade has a lot of individuals who live there, and it has the distinction of being the only non-muggle community in the UK. Are there any students at Hogwarts who live there during the summer?  I ask because  explicitly says that students must ride the train or not go to the school at all, which seems silly for someone who already lives at the destination.     Many pure-blood families were outraged at the idea of their children using Muggle transport, which they claimed was unsafe, insanitary and demeaning; however, as the Ministry decreed that students either rode the train or did not attend school, the objections were swiftly silenced. Securing SSH server against bruteforcing I have a little SVN server, old dell optiplex running debian. I don't have that high demands on my server, because its just a little SVN server... but do want it to be secure.  I just renewed my server to a newer and better optiplex, and started looking a bit into the old server. I took it down after experiencing problems. When I check the logs, its full of brute-force attempts and somehow someone has succeeded to enter my machine. This person created some extra volume called "knarkgosse" with two dirs "root" and "swap1" or something.  Don't really know why and what they do, but sure do want to prevent this from happening again. I find this a bit strange though because I change my password ever few months or so, and the passwords are always random letters and numbers put together... not easy to brute-force.  I know I can prevent root from logging in, and use sudoers... and change the SSH port, but what more can I do?  So I have a few questions:   How can I prevent logging in for 5 minutes after X amount of incorrect tries. Or slow tries down after each incorrect try? Is there some kind of central blacklist which a server can connect to? A blacklist that keeps track of IP addresses that are "unsafe" and should never be granted access? What more can I do to apply safety to my server?   Like I said earlier, I am running Debian 5 with Apache (www-data user problem?), svn, mysql, php, phpmyadmin, hudson. It is on a home network with port forwarding on 80, 443, 8080, 8180, 23 and 22. Blank white desktop icons on new Windows 7 install I just did a fresh install of Windows 7 professional on my father's Toshiba Satellite laptop and everything went smoothly except for the fact that certain desktop shortcuts appear as a blank white page.    I've tried:    going in and changing the icon to many different things reloading the icon cache by deleting the IconCache.db file uninstalling his Free AVG as he heard the virus scanner might be preventing it (it wasn't and he put it back.)   The one thing these icons have in common is that they are shortcuts to some very old DOS executables.  One of them is Word Star 2000 to give you an idea.  Does anybody have any other suggestions besides what we've tried?