How to know if a Date is within the same day of other date
Comparing two java.util.Dates to see if they are in the same day
Recently I needed to do weighted random selection of elements from a list, both with and without replacement. While there are well known and good algorithms for unweighted selection, and some for weighted selection without replacement (such as modifications of the resevoir algorithm), I couldn't find any good algorithms for weighted selection with replacement. I also wanted to avoid the resevoir method, as I was selecting a significant fraction of the list, which is small enough to hold in memory.  Does anyone have any suggestions on the best approach in this situation? I have my own solutions, but I'm hoping to find something more efficient, simpler, or both. Does electron orbital theory contradict the Heisenberg uncertainty principle? Force.Com Sidebar - Reference Data From Current Screen On URLs? I am being lead to believe this is possible:  A URL on the Force.Com Sidebar Menu which references data from the currently open page.  i.e., /{!recordId}?nooverride=1    However, this does not work.  The brackets simply turn into percent encoded references on the resultant page.  Is it possible to pass information onto a URL on the Force.Com sidebar? Do we really need polynomials (In contrast to polynomial functions)? I know from reading  that the "primary" use of the IDisposable interface is to clean up unmanaged resources.  To me, "unmanaged" means things like database connections, sockets, window handles, etc.  But, I've seen code where the Dispose() method is implemented to free managed resources, which seems redundant to me, since the garbage collector should take care of that for you.  For example:  public class MyCollection : IDisposable {     private List&lt;String&gt; _theList = new List&lt;String&gt;();     private Dictionary&lt;String, Point&gt; _theDict = new Dictionary&lt;String, Point&gt;();      // Die, clear it up! (free unmanaged resources)     public void Dispose()     {         _theList.clear();         _theDict.clear();         _theList = null;         _theDict = null;     }   My question is, does this make the garbage collector free memory used by MyCollection any faster than it normally would?  edit:  So far people have posted some good examples of using IDisposable to clean up unmanaged resources such as database connections and bitmaps.  But suppose that _theList in the above code contained a million strings, and you wanted to free that memory now, rather than waiting for the garbage collector.  Would the above code accomplish that? Prove a function is constant under certain conditions Let $f: \mathbb{R} \rightarrow \mathbb{R}$ be smooth and such that for every $x$    $$\int_{-\infty}^{\infty}\frac{|f(x)-f(y)|}{|x-y|^2}dy &lt; \infty$$   Prove that $f$ is constant. Likelihood Ratio Test for Exponential Distribution with a Limited Parameter Space Boot Error - ACPI PCC Probe Failed ACPI PCC Probe Failed is the error that pops up instead of the default GRUB loader after I updated my kernel to 3.19.  I searched around and couldn't find much information except that it is a known error and it is registered in kernel.org's launchpad . My question is, is anyone else facing it?, what are the impacts of this? And if only an update in the future can fix it, any suggestions or safety tips till then? Wayne Dalton Garage So I recent had a Garage door "professional" come out to my house and look at my garage. I originally thought I was having a motor problem because it would only lift door sporadically. After performing a 25 point inspection he believed he located the problem, which was the spring system from my Wayne Dalton Garage (torquemaster). He told me how horrible of a system they are and they don't fix them because of that they only replace the entire system and would cost me $700 or more. So now I'm left trying to figure out what I need, torquemaster springs, bracket assembly, both or if I need something completely else. I need some experience Wayne Dalton experience. Selecting features by attributes using ogr2ogr? Lebesgue integral uniform convergence Let $f_n, f \colon [a,b] \to \mathbb{R}.$ Show that, if $f_n \to f$ uniformly, then the Lebesgue integrals are equal, i.e. $\int f = \lim \int f_n$.  This is clearly true for continuous functions, but how do I handle the case of non-continuous functions? How to prevent mail from our website going into spam mail of users? I work for an educational services company based in India. We've around one million students enrolled as users. We're frequently facing the problem of our bulk mailers regarding upcoming exams, new product launches and promotions going into spam mail folders of the students. Is the problem in the headlines? Or where else? what can we do to reduce this number?   This is killing us, we cannot have an impossibly large precentage of mails not being opened..Please help. What is the perception of students who take a gap year between their graduation and starting graduate school? I am an undergraduate mathematics major, entering my fourth year. I plan on applying to graduate school, but I have not yet taken the GRE exams, and there a few key courses (Topology and Algebra in particular) that I have not taken yet, so I am hesitant to take the Advanced Math GRE too soon. (If you're wondering why I haven't taken Topology and Algebra yet, it's because I was trying to secure a CS degree, which sidetracked my mathematical studies last year. It was a healthy branching out experience, and one that helped me realize my true academic passion.)  My main question: what is the perception of students who take a gap year between their graduation and starting graduate school?  I think I will take the GRE tests this fall, a) for practice and b) if I score high, then I might as well apply sooner rather than later. However, I ask this question to gauge how much energy I should put into preparing for the tests this fall. If I hear, "You should really do your best to avoid any gap in your education," then I will work my butt off in preparation for the tests. But if I hear, "It's totally okay take a gap year before going into graduate school," then I would give myself more freedom in terms of my non-standardized-exam studies, extracurriculars, and in general social activities. I figure the answer to this question won't be as cut-and-dry as I hope, but any advice would be appreciated!  Just to clarify, my gap year would not consist of me sitting at my desk taking practice GRE exams all day... That would be a pitiful use of my time. I definitely plan working either as an intern or a research assistant at a successful organization. It seems like the general consensus is that taking time off is okay, and potentially beneficial, assuming you actually do something in that gap. creating a tar archive without including parent directory I am trying to create a graphical program for my script.  Inside the script I use tar to create a tar archive.  From the graphical program I get the full name of file that I want to create a tar archive.  tar -cvf temp.tar /home/username/dir1/dir2/selecteddir    My tar archive includes home, username, dir1, dir2 and selecteddir while i want tar to create archive only including selecteddir. This is actually a two part question:   Which methods are there to calculate average slope by unit (say km²) for a given area? Are there any special requirements on the data - like additional information besides height measurements? Which open source GIS implement methods usable to calculate average slope on a grid (e.g. TIF file)? How do I pack textures for sending off to a render farm Whenever i try to send a project off to a render farm such as sheepit, it says it needs the textures packing with the file in order to render correctly.  How would I do this? Travelling in Schengen area while waiting for permit of stay renewal in Italy Schadenfreude is the joy or pleasure derived from the misfortunes of others. What is the word for joy or pleasure derived from the happiness of others? How do comments work? Across the Stack Exchange network you may leave comments on a question or answer.  How do comments work? What are comments for, and when shouldn't I comment? Who can post comments? Who can edit comments? How can I format and link in comments? My comment doesn't contain some of the text I typed in it; why? My comment appears to be long enough, but I can't post it because it's too short; why? Who can delete comments? When should comments be deleted? Why can't I comment on specific posts even if I have enough reputation to comment? When can comments be undeleted? What are automatic comments? How can I link to comments? Anything else I should know about comments?  Also see the FAQ articles on  and . Is there a way to fix a small chip in a wall's paint? I'm not sure exactly with what I've bumped my wall and caused this this:    Is there anything that can be done to fix this without repainting the entire room?  I've been reading around a bit, and not sure exactly what to call this, hence the weird question title.  The paint is a beige-ish colour, not exactly white. The hole is about 2 x 1.5 cm in size.   I've read a bit about spackling paste, though I understand that's for small cracks and holes.  Here are some picture with a better resolution:  and   Unfortunately, I don't have much experience with this sort of thing. Help please.  Also, this is in the UK, so you can tell what stores I might have access to for materials.