Where we need to override finalize() method in java when we don't have idea when finalize() method for any given object might be run?What type of resources we can close in finalize()?What is the best chances when GC will called finalize() method?
I've been reading through a lot of the rookie Java questions on finalize() and find it kind of bewildering that no one has really made it plain that finalize() is an unreliable way to clean up resources.  I saw someone comment that they use it to clean up Connections, which is really scary since the only way to come as close to a guarantee that a Connection is closed is to implement try (catch) finally.    I was not schooled in CS, but I have been programming in Java professionally for close to a decade now and I have never seen anyone implement finalize() in a production system ever.  This still doesn't mean that it doesn't have its uses, or that people I've worked with have been doing it right.  So my question is, what use cases are there for implementing finalize() that cannot be handled more reliably via another process or syntax within the language?    Please provide specific scenarios or your experience, simply repeating a Java text book, or finalize's intended use is not enough, as is not the intent of this question.
Is it always better to use the whole dataset to train the final model? A common technique after training, validating and testing the Machine Learning model of preference is to use the complete dataset, including the testing subset, to train a final model to deploy it on, e.g. a product.      My question is: Is it always for the best to do so? What if the   performance actually deteriorates?   For example, let us assume a case where the model scores around 65% in classifying the testing subset. This could mean that either the model is trained insufficiently OR that the testing subset consists of outliers. In the latter case, training the final model with them would decrease its performance and you find out only after deploying it.   Re-phrasing my initial question:     If you had a one-time demonstration of a model, such as deploying it   on embedded electronics on-board an expensive rocket experiment, would you trust a   model that has been re-trained with the test subset in the final step without being   re-tested on its new performance? Quick easy way to migrate SQLite3 to MySQL? Anyone know a quick easy way to migrate a SQLite3 database to MySQL? Beamer: change header background color I have decided to switch from Powerpoint to Beamer, and for my first presentation I'd like to use the , and the same colors as in this goggle slide template:  .  I tried to do some research about it, the closest answers I found are the question  and the . I tried this code:  \documentclass{beamer} \usepackage[frenchb]{babel} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc}  \usetheme{metropolis}  \definecolor{bluegreen}{rgb}{3, 166, 155} \definecolor{pitchblack}{rgb}{0, 0, 0} \definecolor{lightbeige}{rgb}{255, 251, 241} \definecolor{mediumgray}{rgb}{183, 183, 183}  \setbeamercolor{background canvas}{bg=pitchblack} \setbeamercolor{normal text}{fg=lightbeige} \setbeamercolor{headline}{bg=bluegreen, fg=mediumgray}  \begin{document} \begin{frame}     \frametitle{The title}     Lorem ipsum... \end{frame} \end{document}   I does everything I want, except that the title bar's background color is lightbeige:    What did I do wrong? Or what argument should I pass to \setbeamercolor to get it right? Thanks in advance :-). In the PGF/TikZ manual, sometimes I see the option right of=somenode instead of right=of somenode. They look very similar, but the effects are different.  The distance between nodes positioned with the latter option is boundary-to-boundary, as stated in the manual. However, with the first option, it seems that the distance is shorter. I couldn't find any explanation of the first option in the manual.  My question is: what is the difference between the two options? Is there any explanation in the manual that I missed? removeClass and fade animation What library do I have to use such that the document can render \lt and \gt as less than and greater than signs, respectively? \documentclass{article} %\usepackage{amsmath} It does Not work ! \begin{document} \[ x\lt y \gt z \] \end{document}  What library do I have to use such that the document can render \lt and \gt as less than and greater than signs, respectively? Edit I am using MathJax library in my site under Asp.net Mvc 3. Web application is vulnerable to XSS and XSRF attacks so &lt; and &gt; should be avoided as the input from the users. My database will save LaTeX commands that can be rendered by both LaTeX compiler and MathJax. Therefore, I need \gt and \lt that already work in MathJax. Source:  Rendered: I can't seem to find a few of the Stones, so, is there a list available with the location of all the stones? How can I do case insensitive string comparison in Python?  I would like to encapsulate comparison of a regular strings to a repository string using in a very simple and Pythonic way. I also would like to have ability to look up values in a dict hashed by strings using regular python strings. In  (the original movie), Marty comes back from 1955 10 mins early to prevent Doc from being shot (which he fails at). He then rolls up to the Lone Pine Mall and sees himself hit 88 mph and shoot back to 1955 (again). Marty then carries on with this life as usual. What happens to the Marty that goes back to 1955 at the end of the film?  This obviously is a recursive problem where it would create another timeline and Marty would keep coming back 10 mins early to view another Marty zip back to 1955? Why can't we see images reflected on a piece of paper? C++ virtual function from constructor Why the following example prints "0" and what must change for it to print "1" as I expected ?  #include &lt;iostream&gt; struct base {    virtual const int value() const {       return 0;    }    base() {       std::cout &lt;&lt; value() &lt;&lt; std::endl;    }    virtual ~base() {} };  struct derived : public base {    virtual const int value() const {       return 1;    } };  int main(void) {    derived example; } When I add a mirror modifier it sometimes doesn't mirror correctly, giving me an overlapping mesh. How can I fix this? Root Android virtual device with Android 7.1.1 I'm trying to boot Canonical's Azure 16.04 .vhd file in a VirtualBox VM and it hangs at "non blocking pool is initialized".  It works in Hyper-V, so it may only be a bug in virtual box (5.0.20). Use worksheet name as a variable in a lookup I have 2 workbooks with 60 plus worksheets. I need to copy data from one workbook to the other but would like to capture and use the worksheet name within the cell. This is because when I create the workbook I make a master worksheet and then copy it 60 plus times. The above would make the cell ref for each worksheet the corresponding worksheet cell in the other file. How do "Dummy Variables" work? I do not understand how dummy variables work in math.   Suppose we have:  $$I_1 = \int_{0}^{\infty} e^{-x^2} dx$$  How is this equivalent to:  $$I_2 = \int_{0}^{\infty} e^{-y^2} dy$$  How does this dummy variable system work?   Since $y$ is the dependent variable for $I_1$ How can $y$ itself be and independent variable for $I_2$  ??  Thanks! When testing the difference between 2 proportions why do we use a z-test rather than a t-test?    Further, is there a simple way to conduct an omnibus test for significant differences between more than 2 proportions (in the form of percentages). Is there an equivalent to a one-way ANOVA for this?  I imagine that you could use logistic regression (assuming you have the original data for the proportions in the form of 0s and 1s) Are there other options? How does the "this" keyword work? Why isn't Jon executed on sight? So, to get spoilers out of the way -       Jon Snow is too honorable to break his oath and leave the Night's Watch.  However, he is stabbed a bunch, dies, and due to a line in the Night's Watch oath - "It shall not end until my death" - is able to leave without his usual reservation.   Now, this is fine from Jon's perspective.  However, there is a fairly rigid law about the Wall's deserters being punished by death. Which makes me wonder: why isn't Jon having more trouble with this?   He knows what happened, but others don't.  And the explanation that he actually did die doesn't seem like one the lands' lords and authorities would take on faith.  I know I wouldn't.  His story isn't quite like Sam's, who was sent by the Night's Watch to become a maester.  Jon is famous enough that many would know who he is, and that he has taken the black.  But a story like him dying and coming back to life is probably one that takes quite a but of time to stick - if it ever does.  A possible explanation might be that people know Jon is honorable and trust him. Or that they don't care about the law, and think that they can somehow benefit from not executing him - although the law seems to be a strict one, and not everyone seems to be psyched to help Jon out.  Or maybe by that time people coming back to life is a common enough thing that people believe it that easily.  Speculation aside, however, I am curious whether this was directly addressed from the higher-ups - the makers of the show, or the big boss himself.  Why isn't Jon executed on sight? Find the area of the shaded region in the figure below: Find the area of the shaded region in the figure below:    I am completely stuck on how to start off this question. Please help on some guidance on how to start it off.