What is the difference between several alloc methods of memory in c++?
What is the difference between new/delete and malloc/free?
I need help to find the Galois Group of $x^5 +1$. I know that it has a 5-cycle and a 4 cycle and is not a subgroup of $A_5$. Thanks! get dynamic properties in javascript General solution of expected value of E(f(X))? This is maybe a trivial question I came up while solving a few examples and understanding Markov/Chebyshev inequalities and subsequently in evaluating Chernoff bounds. Suppose $X$ is a random variable with some distribution $p$ and we need to evaluate $\mathbb{E}[f(X)]$. Here, $f(X)$ may or may not have the same distribution as $X$. In my case, if $f(X) = e^{sX}$, where $s&gt;0$. I would work out this problem by letting $Z = e^{sX}$ and   $\mathbb{E}[f(X)] = \mathbb{E}[Z] = \int_{\infty}^{\infty}z \hspace{0.2em}p(z)dz$.   Now I find the distribution of $Z$ as: $P\{ Z \leq z \} \implies P\{ e^{sX} \leq z \} \implies P\{ X \leq \frac{\log(z)}{s}\} = \int_{-\infty}^{\frac{\log(z)}{s}}x.p(x)dx $  thereby substituting this into the expectation one gets $\mathbb{E}[Z] = \int_{\infty}^{\infty}z\hspace{0.2em} \left(\int_{-\infty}^{\frac{\log(z)}{s}}x\hspace{0.2em}p(x)dx\right)^{\prime} dz$  According to the Law of Unconscious Statistician , this approximates distribution of $Z$ as $p$. I understand the backward proof through calculus, I don't follow the measure theory approach. For example I don't follow how this works if say $X \sim Gamma$. Is there a source I can read through for someone with no measure theory background? Why more (and varying number of) logical reads with read ahead (prefetch)? After creating tpch database in my SQL Server, I tried below query:      set statistics io on     DBCC DROPCLEANBUFFERS;             select top 100 * from dbo.lineitem order by l_partkey;   The table lineitem has a non-clustered index on l_partkey. I issued the above queries for several times and found out that the logical reads vary each time:      Table 'lineitem'. Scan count 1, logical reads 1019, physical reads 4, read-ahead reads 1760, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.     Table 'lineitem'. Scan count 1, logical reads 1007, physical reads 4, read-ahead reads 1720, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.     Table 'lineitem'. Scan count 1, logical reads 1030, physical reads 4, read-ahead reads 1792, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.   From the post here: , I know it could be caused by read ahead behavior.  BUT exactly why read ahead could cause more logical reads? How does it change the SQL Server behavior? Like SQL Server may read more index page since it's in cache anyway?  Anyway, I disabled read ahead and issue the above query again. Now it reports the same amount of logical reads each time. BUT the logical reads is much smaller!!      Table 'lineitem'. Scan count 1, logical reads 404, physical reads 160, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.   So my question is, why the read ahead feature could cause many more and various logical reads count?  Out of curiosity, I tried another query without the "order by":      select top 100 * from dbo.lineitem   Here's the result without read ahead:      Table 'lineitem'. Scan count 1, logical reads 5, physical reads 3, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.   Here's the result with read ahead:      Table 'lineitem'. Scan count 1, logical reads 15, physical reads 2, read-ahead reads 3416, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.   The one with read ahead still has more logical reads. So, why? How to get a mission to continue the story? I got Destiny and I did the first mission where the guy wakes up and has to get to his ship. Now I'm stuck in the tower. There are no mission notifications or anything. How can I get the next mission and start it? Book/series with winged elven hybrids and a group bringing a child to the north to defeat a great evil Simple Linq query has duplicated join against same table? Show that $(L^{p},\|\|_{p})$ is a Banach space. Show that $(L^{p},\|\|_{p})$ is a Banach space.  My approach: I prove the statement for $(L^{1},\|\|_{1})$, of the following way, first all, is easy show that $\|\|_{1}$ is a norm. So,  $(L^{1},\|\|_{1})$ is vector space. To show that is a Banach space, note that  Prop. 1: Let $(f_{n})_{n\in\mathbb{N}}\subset\mathcal{L}^{1}$ (where $\mathcal{L}^{1}=\mathcal{L}^{1}(X,\tau,\mu)$ is the space of all integrals function), such that $\sum_{i}{\|f_{n}\|}_{1}&lt;\infty$, then the sequences $\left(\sum_{n=1}^{N}{f_{n}}\right)_{n\in\mathbb{N}}$ converges almost everywhere to the integral function, that we called $\sum_{n\in\mathbb{N}}{f_{n}}$. Furthermore $$\sum_{n\in\mathbb{N}}{\int{f_{n}d\mu}}=\int{\sum_{n\in\mathbb{N}}{f_{n}d\mu}}\quad\lim_{N\to\infty}{\|\sum_{n=1}^{N}{f_{n}}-\sum_{n\in\mathbb{N}}{f_{n}}\|_{1}}=0$$ Prop. 2: Let $(E,\|\|)$ a normed vector space. Then $E$  is a Banach space if and only if for all $(e_{k})_{k\in\mathbb{N}}\subset E$ such that $\sum_{k\in\mathbb{N}}{\|e_{k}\|}&lt;\infty$, $\left(\sum_{k=1}^{n}{e_{k}}\right)_{n\in\mathbb{N}}$ converges in $E$  We take the proposition 2. Let $(f_{n})_{n\in\mathbb{N}}\subset L^{1}$ such that $\sum_{n}{\|\hat{f}_{n}\|_{1}}&lt;\infty$. Let $f_{n}\in\hat{f}_{n}$, then $\|f_{n}\|_{1}=\|\hat{f}_{n}\|_{1}$ and then $\sum_{n}{\|f_{n}\|_{1}}&lt;\infty$, by prop. 1, there exist $F\in\mathcal{L}^{1}$ such that $\|\sum_{n=1}^{N}{f_{n}-F\|_{1}}\to 0$, and then $\|\sum_{n=1}^{N}{\hat{f}_{n}-F\|_{1}}\to 0$. Finally note that $\hat{F}\in L^{1}$ is a Banach space. This was my answer for  $L^{1}$ space, but how I prove the general statement for $L^{p}$ (I want to do a similar response). Edit: I'm stuck in the problem, any idea or hint is appreciated.Thanks!! Set Snap Mode with PyQGIS I am trying to set snap mode within QGIS plugin.  So far, I have tried:  QgsSnappingUtils().setSnapToMapMode(QgsSnappingUtils.SnapAdvanced)   and  QgsSnappingUtils().setSnapToMapMode(2)   without success.  QGIS Snapping options (Settings>>Snapping Options...) continue with:  Snapping mode = Current layer  Any hint? (Using v 2.14.0) When a lattice is a lattice of open sets of some topological space? When a lattice $(L,\leqslant)$ is a lattice of open (or closed) sets of some topological space $(X,\tau)$? Which conditions have to be satisfied? We may assume that $X$ is $T_1$. This is a  about Apache's mod_rewrite.   Changing a request URL or redirecting users to a different URL than the one they originally requested is done using mod_rewrite. This includes such things as:   Changing HTTP to HTTPS (or the other way around) Changing a request to a page which no longer exist to a new replacement. Modifying a URL format (such as ?id=3433 to /id/3433 ) Presenting a different page based on the browser, based on the referrer, based on anything possible under the moon and sun. Anything you want to mess around with URL   Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask!  How can I become an expert at writing mod_rewrite rules?   What is the fundamental format and structure of mod_rewrite rules? What form/flavor of regular expressions do I need to have a solid grasp of? What are the most common mistakes/pitfalls when writing rewrite rules? What is a good method for testing and verifying mod_rewrite rules? Are there SEO or performance implications of mod_rewrite rules I should be aware of? Are there common situations where mod_rewrite might seem like the right tool for the job but isn't? What are some common examples?   A place to test your rules  The  web site is a great place to play around with your rules and test them. It even shows the debug output so you can see what matched and what did not. Kepler problem in time: how do two gravitationally attracted particles move? Two particles with initial positions and velocities $r_1,v_1$ and $r_2,v_2$ are interacting by the inverse square law (with G=1), so that  $$ {d^2r_1\over dt^2} = - { m_2(r_1-r_2)\over |r_1-r_2|^3} $$ $$ {d^2r_2\over dt^2} = - { m_1(r_2-r_1)\over |r_1-r_2|^3} $$  (the inverse square law along the line of separation). What is the complete solution of these differential equations? What is the position of the two objects as a function of time?  After reading a lot on Wikipedia, I've come to the definition of center of mass and relative coordinates:   $$R(t) ~=~ \frac{m_1 r_1 + m_2 r_2}{m_1+m_2}$$  $$\ddot{r}(t) r(t)^2 ~=~ (m_1+m_2)G$$  Where $R$ is the center of mass, and $r$ is the displacement between the particles... Is this correct? How do I proceed to solve the differential equation? Which creatures in Tolkien's literature can be female? I know a lot of female programmers, and I know there are a good number of them out there.  But I don't recall ever having one of my questions answered by, nor have I ever answered a question by a female programmer here at Stack&nbsp;Overflow.  Now I mostly deal in the Delphi tag, and that may make a difference. But I've got the feeling there is something about the programming social network that Stack&nbsp;Overflow is, along with its form of mini-competition (via reputation) that turns most ladies off.  When I go down the first few pages of top users by rep, there is nary a lady to be found.  Go over to Quantcast and . Go down to the Demographics, and you'll see that a full 20% of the visits are by females. So they are here, lurking and using the wonderful info that Stack&nbsp;Overflow provides.  Then why aren't there more of them participating, both with questions and answers?  What can Stack&nbsp;Overflow do to persuade female programmers to participate more?    So after a dozen downvotes offset by a dozen upvotes, and accusations by many that I am a bigot, the bottom line seems to be that Stack&nbsp;Overflow appeals to males more than females.  This is my observation and I believe a proper analysis would support the hypotheses that a much higher percentage of male programmers use Stack&nbsp;Overflow than the percentage of female programmers.    Assuming that is the case, then Stack&nbsp;Overflow is geared more towards the male psyche than the female. If so, I again ask, what can they do about that?      This question was asked in StackOverflow Meta on November 20, 2009. It was made Community Wiki. It was asked in a constructive manner and should be considered an appropriate question for Meta.   Yet it was closed over two years after it was asked as "not constructive" after more than 40 upvotes and 10 favorites and 16 answers.   Now it resides here on Meta StackExchange, still closed. I just shake my head. Which command should I use for textual subscripts in math mode? Textual subscripts like in W_{total} should be typeset in an upright text font (so that code isn't good practice), as has been  in   . Now there are several ways to achieve this, and I'm somewhat confused which I should use:   W_{\rm total} is nice and short, and appears to work in all circumstances, but I expect LaTeX people will frown upon it :-) Is there any good reason against this? W_{\mathrm{total}} &ndash; is this the LaTeX equivalent of the \rm approach? W_{\textnormal{total}}  as total is text and not math&nbsp;... In , Ulrike Fischer suggests a more complicated approach. Even W_{\operatorname{total}} appears to work, but it seems inappropriate.   Note: I always assume here that amsmath is loaded.  I've already asked some questions above, but my main question is: which of these options is the best practice for textual subscripts?    Let me point out why I haven't mentioned \text, \textrm or \textup above. Those commands (mostly) keep the font of the context they're used in, e.g., in an italic context, \text and \textrm would give italic subscripts, and all three yield bold subscripts in a bold context.  Final note: This question is similar to, but not the same as all those  about the  between , , , ,  that have been asked before. Maybe it's still a duplicate&nbsp;... Do class spells take up spell slots? So I'm fairly new and ended up being the Cleric in my also fairly new group. I haven't played a caster before and the book says that at level 1 I have Bless and Cure Wounds. Do I need to assign these to a spell slot or do I have them inherently (not to be confused with a cantrip; I know I'd have to use a slot to cast them)? BibTeX handling of the Dutch "van" name prefix with natbib I want to produce the following with LaTeX/BibTeX:  In the running text:     ... we refer the reader to the work of Van Noort (2010).   In the bibliography:     Thomas van Noort. An important paper. 2010.   I have tried many tricks, but I don't seem to able to fulfill all the requirements:   "Thomas van Noort" has to appear sorted in the bibliography by the name "Noort". In the running text, the "Van" needs to have an uppercase 'V' In the bibliography, the "van" needs to have a lowercase 'v' I am using hyperref, and I want the whole "Van Noort (2010)" text to link to the reference.   Using plain \citet will generate:     ... we refer the reader to the work of van Noort (2010).   Note the lowercase 'v'; this is not acceptable, as per standard treatment of Dutch names. Setting the BibTeX name to Van Noort, Thomas makes the running text citation look ok, but then in the bibliography I get     Thomas Van Noort. An important paper. 2010.   Note the uppercase 'V'; this is also not acceptable, as it should only be uppercase if it is not preceded by the first name.  (1) is easy: I set the BibTeX author field to {\noopsort{Noort}}{van Noort}, Thomas. (2) and (3) I can fake by saying something like we refer the reader to the work of Van Noort \citeyear{...}, but this is not nice, and does not fulfill (4).  Anyone has any suggestions? I was under the impression that LaTeX and BibTeX were designed with these kind of things in mind, so maybe I'm missing something... Site.createPortalUser() returning null in test context I am in Portugal (Lisbon) at the moment, and when leaving my room late at night (12 pm ~ 04 am) I usually face about 4 of these arthropods in the corridors:    (For reference, the "line" in the image is a standard separation on the floor. This particular example of the animal is a little smaller than a nail.) They seem to have quite variable sizes and walk primarily on ground. Also, as implicit above, they seem to be active primarily during the late night. (I don't see them much often, if at all, during the morning/afternoon.) They can be quite fast, but if left unharmed do not move much. They also appear to take shelter inside the walls.  From what I searched, it seems possible that they are centipedes. I've seen sites saying that they are useful to keep other less pleasant animals at bay. My questions are: What are those animals, and should I leave them be or not? Regex exec only returning first match