Java: Check if current date is in range of specific days I am struggling with following problem:  In my app I want to check whether a current datetime from LocalDateTime.now() is in range of some specific days of week, let's say between Friday and Sunday.   Example:  Datetime window is from Friday 20:00 to Sunday 20:00. When I check current date on Thursday at 22:00*, answer should be false but when I check it on **Saturday at 8:00, answer should be true.  I can sort of achieve this with DayOfWeek class in java.time API using compareTo() method and comparing hours and minutes separately but I would like to know if there is any better way to do it  and especially when the range of days spans over two weeks (e.g. Friday to Monday of the next week)?  Thanks in advance for any advice or help.
Determine Whether Two Date Ranges Overlap Given two date ranges, what is the simplest or most efficient way to determine whether the two date ranges overlap?  As an example, suppose we have ranges denoted by DateTime variables StartDate1 to EndDate1 and StartDate2 to EndDate2.
Why are my wrists the first part of my body to start aching during a long ride? Most riders seem to say it's their groin, neck or lower back that starts hurting first after a decent distance has been ridden. For me it is my wrists.  I have no history of wrist pain (strains, breaks etc) so it can't be explained by that and I try to adjust my hand positions across my handlebars as often as I can.  My question has 2 parts:   1. Is there anything I can do to minimise pain in terms of riding position, gloves, exercises etc which will reduce soreness?  2. Why might this pain be occurring?  *I do all of my riding on paved roads on a road (Specialized Allez) bike. Is there a way of setting culture for a whole application? All current threads and new threads? Is there a way of setting culture for a whole application? All current threads and new threads?  We have the name of the culture stored in a database, and when our application starts, we do   CultureInfo ci = new CultureInfo(theCultureString); Thread.CurrentThread.CurrentCulture = ci; Thread.CurrentThread.CurrentUICulture = ci;   But, of course, this gets "lost" when we want to do something in a new thread. Is there a way of setting that CurrentCulture and CurrentUICulture for the whole application? So that new threads also gets that culture? Or is it some event fired whenever a new thread is created that I can hook up to? Dodecagon Area Question The distance between two opposite vertices of the dodecagon is 2. Find the area of the dodecagon.  Is there any way to do this without trigonometry?  And could you include a proof also? :O This one seems to be a common question in most forums and all over the web, it is asked here in many formats that typically sound like this:  In SQL Server -  What are some reasons the transaction log grows so large? Why is my log file so big? What are some ways to prevent this problem from occurring? What do I do when I get myself on track with the underlying cause and want to put my transaction log file to a healthy size? When do I pronounce a non-existent “r” between adjacent vowel sounds? If I say two words consecutively, with the first ending in a vowel sound and the second starting with one, when is it correct to include a non-existent r between those two words?  Examples from phrases I've heard:        I saw (r)a movie   They saw (r)us   Law (r)and order   That's the idea, (r)anyway.      I heard the last one in the movie Edge of Tomorrow yesterday.  Is this grammatically correct? If so, is the omission of the r grammatically incorrect? Are there any rules regarding this? How do I install the latest stable version of LibreOffice? LibreOffice is seeing some dramatic improvements each version and subversion that goes out.   I would like to have always the latest version of LibreOffice on my machine(s). I know of the PPA that exists but is it recommended to use it with 12.04 for daily use? What are the pro and cons of using the PPA? Will it break my system/Libreoffice installation?  Does libreoffice get eventually also upgraded in the Ubuntu repositories or does this upgrade happen only with new releases? Who manages the upgrades of libreoffice in Ubuntu and in the PPA? Grammatical function of "at best" idiom state that "at best" is an idiom. But, what is the grammatical function of "at best" (for example, in the below sentences?)        Their response to the proposal was, at best, cool.   The government's response seems to have been at best confused and at   worst dishonest.   If he drops the course now, at best he’ll get an incomplete, and he could fail.      Thanks Removing elements with Array.map in JavaScript I would like to filter an array of items by using the map() function. Here is a code snippet:  var filteredItems = items.map(function(item) {     if( ...some condition... )     {         return item;     } });   The problem is that filtered out items still uses space in the array and I would like to completely wipe them out.  Any idea?  EDIT: Thanks, I forgot about filter(), what I wanted is actually a filter() then a map().  EDIT2: Thanks for pointing that map() and filter() are not implemented in all browsers, although my specific code was not intended to run in a browser. How to encode the filename parameter of Content-Disposition header in HTTP? Web applications that want to force a resource to be downloaded rather than directly rendered in a Web browser issue a Content-Disposition header in the HTTP response of the form:  Content-Disposition: attachment; filename=FILENAME  The filename parameter can be used to suggest a name for the file into which the resource is downloaded by the browser.  (Content-Disposition), however, states in  (The Filename Parameter) that the file name can only use US-ASCII characters:     Current [RFC 2045] grammar restricts   parameter values (and hence   Content-Disposition filenames) to   US-ASCII.  We recognize the great   desirability of allowing arbitrary   character sets in filenames, but it is   beyond the scope of this document to   define the necessary mechanisms.   There is empirical evidence, nevertheless, that most popular Web browsers today seem to permit non-US-ASCII characters yet (for the lack of a standard) disagree on the encoding scheme and character set specification of the file name. Question is then, what are the various schemes and encodings employed by the popular browsers if the file name “naïvefile” (without quotes and where the third letter is U+00EF) needed to be encoded into the Content-Disposition header?  For the purpose of this question, popular browsers being:   Firefox  Internet Explorer  Safari Google Chrome  Opera Is it possible to have f.lux (software that adjusts display's color temperature) on Ubuntu 14.04? f.lux is software which adjusts temperature of your display according to time of the day. Is it possible to make f.lux work in Ubuntu 14.04? If so, maybe you can share your knowledge or point me to a guide. Zip folder without including path to folder and require only one argument I'm trying to make a zip function that'll do all the steps I typically do when zipping a file or folder. Say my current directory is ~, and I want to zip a folder named Folder1, whose file path is ~/Folder2/Folder1.  Issuing  cd ~/Folder2 &amp;&amp; zip -r Folder1 Folder1 &amp;&amp; cd -   does exactly what I want. Namely, it zips so that the output Folder1.zip does not contain folders that lead up to the folder I'm zipping (namely, /home/user/Folder2), it zips recursively, and it takes in the first argument of zip with the exact name as the file or folder I'm zipping (Folder1.zip).  So I want to make a function in my .zshrc something akin to  coolerzip() { cd /path/to/file &amp;&amp; zip -r file file &amp;&amp; cd - }   where it need only take in one argument, which in this case, it will be ~/Folder2/Folder1. Then Folder1 will be the name for both files in coolerzip, and I will cd right into ~/Folder2 so Folder1 lies in my current directory before zipping. Is there any way I can achieve this so that coolerzip only requires one argument rather than three? XGBoost Loss function Approximation With Taylor Expansion How to determine surprise when only part of a side is stealthy? What is the best way to randomize an array of strings with .NET? My array contains about 500 strings and I'd like to create a new Array with the same strings but in a random order.  Please include a C# example in your answer. Gaussian-like integral : $\int_0^{\infty} e^{-x^2} \cos( a x) \ \mathrm{d}x$ Python and regular expression with Unicode I need to delete some Unicode symbols from the string 'بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ'  I know they exist here for sure. I tried:  re.sub('([\u064B-\u0652\u06D4\u0670\u0674\u06D5-\u06ED]+)', '', 'بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ')   but it doesn't work. String stays the same. What am I doing wrong? How can I get the node id the comment is attached to in hook_comment_insert?  I tried the following code:  function mymodule_comment_insert(Drupal\Core\Entity\EntityInterface $entity) {   if ($entity-&gt;bundle() == 'comment_custom' &amp;&amp; $entity-&gt;get('entity_type')-&gt;value == 'node') {      // Below returns empty, because "$entity-&gt;get('entity_id')-&gt;value" is empty.     $node = Node::load($entity-&gt;get('entity_id')-&gt;value);      // No luck with this one too.     $node = \Drupal::routeMatch()-&gt;getParameter('node');    } } Helllo!  For a project that I am doing, I need to render the my model to a sprite sheet. This is all fine, except that the model has a cloak, which uses a cloth animation. I need to smoothly transition from the end of the cloth simulation to the start, so it doesn't just jerk back, but I can't find any way of doing this.  Thanks in advance. How distorted does the Andromeda Galaxy appear to us due to the speed of light? The Andromeda Galaxy appears to us at an angle to the galactic disk, i.e. we are not in the Andromeda Galaxy disc's plane, nor are we near the direction that the galaxy's pole points. Therefore, due to the geometry and distances involved, it would seem to me that we are seeing the 'far edge' a few thousand years later than we are seeing the 'near edge'. How far can a galaxy spin during that those few thousand years, and therefore how distorted are we seeing Andromeda? Can we infer how Andromeda or other large spiral galaxies seen at an angle would look if light were to travel instantly?  Might this phenomenon account for some of the unusual spin properties measured in galaxies, which is attributed to dark matter? Disabling middle mouse button