Hey guys. I dont know how i suppose to do about setting values to derived classes ctor. And here is my code. I remember something like that build in my class. But i know that we can write something like that build ( xxx():yyy(){,,,};). Check the main's second object.      #include &lt;iostream&gt;  using namespace std;  class vehicle { protected:     string brand;     int wheelNumber;     double maxSpeed=0; public:     vehicle(){cout&lt;&lt;"default ctor for vehicle"&lt;&lt;endl;}     vehicle(string br1, int wn1, double ms1)     {brand=br1; wheelNumber=wn1; maxSpeed=ms1;}      void setbrand(string br){brand=br;}     string getbrand(string br){return brand;}     void setWN(int wn){wheelNumber=wn;}     int getWN(int wn){return wheelNumber;}     void setMaxS(double ms){maxSpeed=ms;}     double getMaxS(double ms){return maxSpeed;}     ~vehicle(){cout&lt;&lt;"dtor for vehicle."&lt;&lt;endl;} }; class car: public vehicle { private:     int numberOfDoors;     string fuelType; public:     car(){cout&lt;&lt;"default ctor for car"&lt;&lt;endl;}     car(int nOD,string fT){numberOfDoors=nOD; fuelType=fT;}      void setnOD(int nOD){numberOfDoors=nOD;}     int getnOD(int nOD){return numberOfDoors;}     void setfT(string fT){fuelType=fT;}     string getfT(string fT){return fuelType;}      void printFeatures()     {         cout&lt;&lt;endl;         cout&lt;&lt;"brand:"&lt;&lt;brand&lt;&lt;endl;         cout&lt;&lt;"wheelNumber:"&lt;&lt;wheelNumber&lt;&lt;endl;         cout&lt;&lt;"MaxSpeed:"&lt;&lt;maxSpeed&lt;&lt;endl;         cout&lt;&lt;"NumberOfDoors:"&lt;&lt;numberOfDoors&lt;&lt;endl;         cout&lt;&lt;"FuelType:"&lt;&lt;fuelType&lt;&lt;endl&lt;&lt;endl;     }     ~car(){cout&lt;&lt;"dtor for car."&lt;&lt;endl;} };  int main() {     car *cc;     cc= new car;     cc-&gt;setbrand("bmw");     cc-&gt;setfT("diesel");     cc-&gt;setMaxS(333.25);     cc-&gt;setWN(4);     cc-&gt;setnOD(6);     cc-&gt;printFeatures();     delete cc;      car *xx;     xx= new car;     car(5,"gasoline"):vehicle("mercedes",4,489.12);//Part that i cant figure it out.     xx-&gt;printFeatures();     delete xx; }
What are the C++ rules for calling the base class constructor from a derived class? For example, I know in Java, you must do it as the first line of the subclass constructor (and if you don't, an implicit call to a no-arg super constructor is assumed - giving you a compile error if that's missing).
CSS 100% height with padding/margin With HTML/CSS, how can I make an element that has a width and/or height that is 100% of it's parent element and still has proper padding or margins?  By "proper" I mean that if my parent element is 200px tall and I specify height = 100% with padding = 5px I would expect that I should get a 190px high element with border = 5px on all sides, nicely centered in the parent element.  Now, I know that that's not how the standard box model specifies it should work (although I'd like to know why, exactly...), so the obvious answer doesn't work:  #myDiv {     width: 100%     height: 100%;     padding: 5px; }   But it would seem to me that there must be SOME way of reliably producing this effect for a parent of arbitrary size. Does anyone know of a way of accomplishing this (seemingly simple) task?  Oh, and for the record I'm not terribly interested in IE compatibility so that should (hopefully) make things a bit easier.   EDIT: Since an example was asked for, here's the simplest one I can think of:  &lt;html style="height: 100%"&gt;     &lt;body style="height: 100%"&gt;         &lt;div style="background-color: black; height: 100%; padding: 25px"&gt;&lt;/div&gt;     &lt;/body&gt; &lt;/html&gt;   The challenge is then to get the black box to show up with a 25 pixel padding on all edges without the page growing big enough to require scrollbars. Rewriting Triple Integral in different order How can I rewrite, say: $$\int^1_0\int^{z^2}_0\int^y_0{f}dxdydz$$ In the orders $dzdxdy$ and $dydzdx$?  Would I have to solve this triple integral all the way or is there a simple way to do this? Limit of ${a_n}^{1/n}$ is equal to $\lim_{n\to\infty} a_{n+1}/a_n$ Today my lecturer put up on the board that:  If $\lim\limits_{n\to\infty}\frac{a_{n+1}}{a_n}$ exists and $a_n&gt;0$ then   $\displaystyle \limsup\limits_{n\to\infty}\left(a_n^{\frac{1}{n}}\right)=\lim_{n\to\infty}\frac{a_{n+1}}{a_n}$  however I am not sure why this is true, can somebody give me a hint or something as to how to go about proving this.  thanks for any help Set up a scheduled job? I've been working on a web app using Django, and I'm curious if there is a way to schedule a job to run periodically.   Basically I just want to run through the database and make some calculations/updates on an automatic, regular basis, but I can't seem to find any documentation on doing this.  Does anyone know how to set this up?  To clarify:  I know I can set up a cron job to do this, but I'm curious if there is some feature in Django that provides this functionality.   I'd like people to be able to deploy this app themselves without having to do much config (preferably zero).  I've considered triggering these actions "retroactively" by simply checking if a job should have been run since the last time a request was sent to the site, but I'm hoping for something a bit cleaner. Entering U.S. exactly on the day of visa "expiration date" I'm a bit surprised from my US Visa. I plan to go to a conference on 3rd of April. Amazingly though, the visa expiration date is written as April 3rd.  So what does that mean. Can I enter the US on April 3rd? or should I enter one day earlier? Using Either a Comma or a Semicolon My teacher was explaining how sometimes a comma isn't enough to make a sentence correct, and that sometimes you have to use a semicolon. I am having trouble figuring out when you should use which.   Can someone please explain? I can't seem to find an answer to this simple question, which I need for some compliance documentation.    On a default install of CentOS 6.5 (OpenSSH 5.3p1-94.el6), after how long of being idle will a user's SSH session be terminated?  I believe the following can be set to increase the idle timeout, but they are commented out by default.  $ grep -i alive /etc/ssh/sshd_config #TCPKeepAlive yes #ClientAliveInterval 0 #ClientAliveCountMax 3   Also, is there a command to dump a list of the current sshd settings?  I don't see anything in man sshd. Can I disable auto logon on windows 10 home I recently setup a new computer for my parents with windows 10 home. I made two local accounts for them - no microsoft accounts. I also would like to keep them without a password. Problem is now that windows automatically signs in with the last used account. No lock/login screen.  I tried a number of answers from similar questions here but none worked. Since it's a home version there are no group policies and the method using task scheduler does not work because accounts with no password are not allowed to create such tasks.  Are there other options to force windows to show a user list on startup without setting passwords for the accounts? Presheaf which is not a sheaf -- holomorphic functions which admit a holomorphic square root I'm thinking about a problem in Ravi Vakil's algebraic geometry notes  (Exercise 3.2B) and I'm having trouble with the second part of the exercise as my understanding of complex analysis is quite rudimentary.   If to every open set $U\subset \mathbb{C}$ we associate the ring of holomorphic functions which admit a holomorphic square root, this defines a presheaf on $\mathbb{C}$ (I can see this).   Apparently however this is not a sheaf -- supposedly it fails to satisfy the gluing property.   To prove this, we need to take an open cover $\{U_i\}$ of some open $U\subseteq \mathbb{C}$, a holomorphic function $f_i:U_i\to \mathbb{C}$ for each $i$ which has a holomorphic square root (i.e. there exists a holomorphic function $g_i$ for each $i$ such that $f_i(z)=g_i(z)^2$ for all $z\in U_i$), which all agree nicely on the intersections of the various open sets, but such that it is impossible to find a holomorphic function $f:U\to \mathbb{C}$ with a holomorphic function which restricts to $f_i$ on each $U_i$.   Any help would be great -- my problem is in showing that such a function cannot exist. Given the following HTML:   &lt;div id="container"&gt;   &lt;!-- Other elements here --&gt;   &lt;div id="copyright"&gt;     Copyright Foo web designs   &lt;/div&gt; &lt;/div&gt;    I would like #copyright to stick to the bottom of #container. Can I achieve this without using absolute positioning? I have to try to add a field called 'Name' to a bunch of different feature classes using python, and then access the name of the feature class to fill in the field. I have no idea how to even start this! I know I need a loop but that's all I know. How to make Gnome's "Activities" bar always visible? Let's say I have some data, and then I fit the data with a model (a non-linear regression). Then I calculate the R-squared ($R^2$).  When R-squared is negative, what does that mean? Does that mean my model is bad? I know the range of $R^2$ can be [-1,1]. When $R^2$ is 0, what does that mean as well? Files greater than 1 GB and older than 6 months I want to find files which are greater than 1 GB and older than 6 months in entire server. How to write a command for this? Combinatorial argument for $\sum\limits_{k=i}^{n}\binom{n}{k}\binom{k}{i} = \binom{n}{i}2^{n-i}$ I need to show that $$\sum\limits_{k=i}^{n}\binom{n}{k}\binom{k}{i} = \binom{n}{i}2^{n-i}$$  I know that $\displaystyle \binom{n}{k}\binom{k}{i}$ is counting the number of ways to pick $k$ elements from $n$ and then $i$ elements from those $k$, so $\displaystyle \sum\limits_{k=i}^{n}\binom{n}{k}\binom{k}{i}$ is counting the number of ways to do that $\forall k$.  I know that $\displaystyle \binom{n}{i} = \binom{n}{n-i}$ and that $2^{n-i}$ is the number of elements in the power set for $[n]\setminus[i]$.  How do I show that both sides are equivalent? I'm stumped on this one. Could anyone give me a pointer in the right direction? The classic example... $X \sim Po\left (\lambda\right ), Y \sim Po\left (\mu\right)$, X and Y are independent.  Show that the conditional distribution of X is binomially distributed. Or in other words, $P(X=k\mid X+Y = n) = P (\tilde{X} = k), \tilde{X} \sim B\left (n ,\frac{\lambda}{\lambda + \mu}\right )$.   I've so far managed to reach to this step, and have been stuck since. Just somehow gotta get a $\frac{1}{n!}$ in the denominator, that would then complete the proof..or at least I think..  $$P(X=k\mid X+Y=n) = \frac{\frac{\lambda^{k}\mu^{n-k}}{k!(n-k)!}}{P(X+Y = n)}=  \frac{\frac{\lambda^{k}\mu^{n-k}}{k!(n-k)!}}{\sum_{i=1}^{n} \frac{\lambda^{i}\mu^{n-i}}{i!(n-i)!}}$$  Thanks for the help! How to set an alias on a per-directory basis? Suppose you have an alias go, but want it to do different things in different directories?  In one directory it should run cmd1, but in another directory it should run cmd2  By the way, I have an aliases for switching to the above directories already, so is it possible to append the go alias assignment to the foo alias?  alias "foo=cd /path/to/foo"   Working in bash(?) on OSX. If I calculate the median of a sufficiently large number of observations drawn from the same distribution, does the central limit theorem state that the distribution of medians will approximate a normal distribution? My understanding is that this is true with the means of a large number of samples, but is it also true with medians?  If not, what is the underlying distribution of sample medians? Convert file contents to lower case I have temp file with some lower-case and upper-case contents.  Input  Contents of my temp file:  hi Jigar GANDHI jiga   I want to convert all upper to lower.  Command  I tried the following command:  sed -e "s/[A-Z]/[a-z]/g" temp   but got wrong output.  Output  I want it as:  hi jigar gandhi jiga   What needs to be in the substitute part of argument for sed? is a simple way to script small GUIs.  Can anyone give a nice example with a button and a text widget. When the button is pressed should a shell command be executed and the output piped to the text widget.  If you have other nice and clean examples for useful tasks, please add them too.