I have a SQL Server 2008 instance and one table is quite large (log data) so I delete old logs. Now I start to read articles on this problem, .  As I see it there is no solution! If I shrink the database and then rebuild the index, the database will be about the same size as before. If I don't rebuild the index, the database will shrink, but performance will be low, which is not an option.  So shrinking for production databases seems not to be an option. Is there any solution? Does deleting from the database make any sense? How do big companies delete log data from their databases?
This question is asked in various forms here but the question boils down to:  I know shrinking a database is risky. In this case, I've removed so much data and I'll never use it again.   How can I shrink my database? What files do I shrink?  What should my considerations be while doing this?  Should I do anything after? What if it is a large database? Can I shrink it in smaller increments?
Random forest regression not predicting higher than training data I've noticed that when building random forest regression models, at least in R, the predicted value never exceeds the maximum value of the target variable seen in the training data. As an example, see the code below. I'm building a regression model to predict mpg based on the mtcars data. I build OLS and random forest models, and use them to predict mpg for a hypothetical car that should have very good fuel economy. The OLS predicts a high mpg, as expected, but random forest does not. I've noticed this in more complex models too. Why is this?   &gt; library(datasets) &gt; library(randomForest) &gt;  &gt; data(mtcars) &gt; max(mtcars$mpg) [1] 33.9 &gt;  &gt; set.seed(2) &gt; fit1 &lt;- lm(mpg~., data=mtcars) #OLS fit &gt; fit2 &lt;- randomForest(mpg~., data=mtcars) #random forest fit &gt;  &gt; #Hypothetical car that should have very high mpg &gt; hypCar &lt;- data.frame(cyl=4, disp=50, hp=40, drat=5.5, wt=1, qsec=24, vs=1, am=1, gear=4, carb=1) &gt;  &gt; predict(fit1, hypCar) #OLS predicts higher mpg than max(mtcars$mpg)       1  37.2441  &gt; predict(fit2, hypCar) #RF does not predict higher mpg than max(mtcars$mpg)        1  30.78899 Inexact measurement and wavefunction collapse As is usually said, measurement of an observable $q$ leads to collapse of wavefunction to an eigenstate of the corresponding operator $\hat q$. That is, now the wavefunction in $q$ representation is $\psi(q)=\delta(q-q_0)$ where $q_0$ is result of measurement.  Now, in reality measurements are never exact, so the wavefunction should not have that sharp peak. Instead it should be broadened depending on precision of measurement. In this case, can we still introduce an operator, an eigenstate of which would the new wavefunction appear? Is it useful in any way? Or does the new wavefunction depend too much on the way it was measured so that each instrument would have its own operator? How would such opeartor look e.g. for a single-slit experiment? How do we solve (i.e. get the closed form of) $\int \sqrt{1 + t^2} dt$ ?   shows the closed form of it but not the steps in solving it.  I think I need some algebraic trick..   I thought of some hyperbolic functions and their derivatives and equalities:  If I make $ t = \sinh x$, then I can reduce the integral to  $$ \int \cosh ^2 x dx $$ though I'm not sure if this is valid. But from here, I cannot go on evaluating the integral... Java Command line arguments I am trying to detect whether the 'a' was entered as the first string argument. Why do Tcler suggest to brace your `expr`essions? How to handle UNABLE_LOCK_ROW errors when this is caused by a batch APEX job we are facing a serious issue. We have a batch APEX job running daily which makes updates on records fulfilling certain conditions. There is another job running parallel to this, in some cases updating or accessing to the same records than the batch job and hence, causing the error:     Update failed. First exception on row 400 with id XXX; first error:    UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record or 200    records:   So, I had then read that in order to fix this kind of error you should use FOR_UPDATE in your select statement (records that have to be updated). The problem is, that you can not use FOR UPDATE for batch jobs. We tested this and effectively, we get the error:     System.QueryException: Locking is implied for each batch execution and   therefore FOR UPDATE should not be specified      It will however lock the records within each execution of execute. See   QueryLocator.getQuery()usage:      You cannot use the FOR UPDATE keywords with a getQueryLocator query to   lock  a set of records. The start method automatically locks the set   of records in  the batch.   Could you find a solution to this?. We would like to handle this in the code itself, because we don't have the permission to schedule the batch job for another time as the another job. the_excerpt not displaying Calculate limiting distribution of $\frac{\sum_{i=1}^n X_i}{\sum_{i=1}^n Y_i}$ How can time dilation be symmetric? There is a problem 3.3 in :     Ambiguities in the energy-momentum tensor:      (a) If you add a total derivative to Lagrangian ${\cal{L}} \rightarrow {\cal{L}} + \partial_\mu X^\mu$, how does the energy-momentum tensor change?      (b) Show that the total energy $Q = \int d^3x \; {\cal{T^{00}}}$ is invariant under such changes   Given the definition of energy-momentum tensor:  $$ {\cal{T}}^\mu{}_\nu = \sum_n \frac{\partial{\cal{L}}}{\partial \left( \partial_\mu \phi_n \right)} \partial_\nu \phi_n - g_{\mu\nu} {\cal{L}} $$  It changes as:  $$ \delta {\cal{T}}^\mu{}_\nu =  \sum_n \left( \partial_\rho \frac{\partial{X^\rho}}{\partial \left( \partial_\mu \phi_n \right)} \right) \partial_\nu \phi_n - g_{\mu\nu} {\partial_\rho X^\rho} $$  $T^{00}$ changes as:  $$ \delta {\cal{T}}^{00}= \sum_n \left( \partial_\rho \frac{\partial{X^\rho}}{\partial \dot{\phi_n}} \right) \dot{\phi_n} - \partial_\rho X^\rho $$   From this point I’m stuck. The first term doesn’t seem to disappear at all after integration over space, and the second disappears only partially:  $$ \int d^3x \; \dot{X^0} $$  So even if I’d have assumed that $X$ depends on position, and not on the fields - the total energy doesn’t seem to be invariant under it.  What is the best way to proceed forward with this? Finding joint density of dependent variables I've got two random variables, $x$ and $y$, where $x=u(y)$ and $y=v(x)$. How do I find the joint density of the two variables?   The eventual purpose is to find the integral  $\int^a\int^b f(x,y) dydx$,  where $f(.)$ is said joint density function.  This question is related () but I'm still a bit confused by the answer. I am indeed effectively looking for $Prob(x \leq a, y \leq b)$ but don't understand how I can get there without knowing the PDF first.  Any advice is much appreciated. Thanks a lot in advance! Does there exists an Isomorphism between $\mathbb{C}^* $ under multiplication with $\mathbb{C}$ under addition.  Attempt In my opinion It does not exists.  If there exists such an isomorphism say $\phi :\mathbb{C}^* \to \mathbb{C}$ then, from the fact that Isomorphism takes identity to identity we have $$\phi \left( 1 \right)=0$$  From the fact      Given $\phi:G \to H$ be an isomorphism, then For a fixed integer $k$ and a fixed group element $b$ in $G$, the   equation $x^k=b$ has the same number of solutions in $G$ as does   the equation $x^k=\phi\left(b\right)$ in $H$.   We have $x^4=1$ and $x^4=0$ must have same number of solutions, but the solutions to these equations are 4 and 1 only. Which one is the best option to get the identity value I just generated via an insert? What is the impact of these statements in terms of performance?   SCOPE_IDENTITY()  Aggregate function MAX() SELECT TOP 1 IdentityColumn FROM TableName ORDER BY IdentityColumn DESC Schengen Visa four years- 90 days stay I have been granted multiple entry Schengen Visa valid for 4 years with the duration of stay of 90 days. Does it mean only 90 days of stay in total during a 4 years period?  I'll be travelling to Schengen Area in September for 25 days, then after 2 month or so I will travel again for 30 days. Similarly, I'll be traveling to the Schengen Area in the future depending on the business meetings.  How will I know, that how many days are left? On what basis the calculations are done?  Also, please explain the "90/180" rule. Can inner classes access private variables? class Outer {      class Inner {     public:         Inner() {}         void func() ;     };  private:     static const char* const MYCONST;     int var; };  void Outer::Inner::func() {     var = 1; }  const char* const Outer::MYCONST = "myconst";   This errors out when I compile with class Outer::Inner' has no member named `var' Tikz: setting options for pin I just found the pin option to drawing, and it looks useful in some of the things I want to draw. How do I format it though? I've tried pin=[red]60:{Hey!} and I get the error Cannot parse this coordinate.  \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{shapes,arrows,positioning} \begin{document} \begin{tikzpicture}[node distance=2cm,&gt;=latex, every node/.style={     font=\sffamily\scriptsize     },       circtext/.style={draw,circle,minimum size=8pt,inner sep=2pt},     dot/.style={draw,circle,fill=black,minimum size=0.6mm,inner sep=0pt} ] { \node[rectangle, fill=green!10!white!90!black, minimum width=6cm, minimum height=3cm] at (2,0){}; \node[circtext, fill=yellow](A) at (0,0) {A}; \node[circtext, fill=yellow, right=of A](B){B}; \draw[-&gt;] (A) -- node[dot, pos=0.5, pin=[red]60:{Hey!}](C){}(B); } \end{tikzpicture} \end{document}     The default style looks like it's a gray thin arrow, and I want to change it to a black thin dotted line with no arrow.    update: I figured out how to add style to the pin node:  pin={[red]60:Hey!}]  But I can't figure out how to change the linestyle though. How did Lucius Malfoy know Sirius's Animagus form? In Order of the Phoenix, Snape eggs on Sirius at Grimmauld Place:  ‘Tell me, how is Lucius Malfoy these days? I expect he’s delighted his lapdog’s working at Hogwarts, isn’t he?’ [Sirius] ‘Speaking of dogs,’ said Snape softly, ‘did you know that Lucius Malfoy recognised you last time you risked a little jaunt outside? Clever idea, Black, getting yourself seen on a safe station platform ... gave you a cast-iron excuse not to leave your hidey-hole in future, didn’t it?’ Order of the Phoenix - Chapter twenty-four, Occlumency - Page 460 - Bloomsbury  How did Lucius Malfoy know that Sirius was a dog Animagus? How did he know it was Sirius in the train station? Some facts to consider: According to the 's timeline, the characters who are considered to be of the Marauders era (born 1959) were only five years younger than Lucius Malfoy (born 1954), so Sirius and Snape, and the other Marauders-era students, and Lucius Malfoy, would have been at Hogwarts together for two years. Prisoner of Azkaban demonstrates it took Sirius, James, and Peter four to five years to master the Animagus transformation, which would have been at least two years after Lucius Malfoy would have left Hogwarts (Although we don't know when Lucius became a school governor.). A canon-based answer would be great; barring one, a speculative answer in the spirit of canon is welcome. If $x$ is a positive rational but not an integer, is $x^x$ irrational? Let $x$ be positive, rational, but not an integer. That means $x$ can be written as $\frac{p}{q}$ with $p,q$ coprime, $p,q \neq 0$ and $q \neq 1$. Is $x^x$ always irrational?   I think that this has to be the case, but I can't prove it.  $x^x = (\frac{p}{q})^\frac{p}{q} = \frac{p^\frac{p}{q}}{q^\frac{p}{q}}$  I know that $p^\frac{p}{q}$ and $q^\frac{p}{q}$ can't both be rational, but there are cases where the division of two irrational numbers gives us an rational number. For example $\frac{\sqrt{2}}{\sqrt{2}} = 1$ How do I create a file and mount it as a filesystem? How do I create a file of size 10M, format it with ext3 filesystem and then mount it in /media/fuse?  I tried with  mkfs -t ext3 file   then to mount it  mount -t ext3 file /media/fuse   It didn't work because it said that file wasn't a block device. Can anybody help me? How can I vertically align elements in a div?