What is the practical logic way to choose time intervals without leaving loose ends? I have been trying to figure out a practical way to select events of specific period of a machine. I have a historical data of product arrival/process_start/process_finish times (DateTime) to a machine and events (breakdown,repair,maintenance etc.) of the machine with event_start/event_type/event_finish times (DateTime).  I want to identify those events happened at the machine for a product from time it arrives to it finishes the process.       foreach(var product in productList)      var resultEvents = from events in eventList                          where (data.Machine == product.Machine) &amp;&amp; (events.Start&lt;product.Arrival &amp;&amp; event.Finish &lt; product.Finish)   This is not giving me proper states, and it gets confusing and ambigious as I outline options when a machine may go down... Is it that I should also use process start or am I looking at more &amp;&amp; statements?  A quick feedback is greatly appreciated :) Thanks!
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.
I bought a new SSD with 750 GB and made two partitions: 600 GB and 150 GB. The smaller one was thought to be a Bootcamp partition one day, but to date it was just another unused partition. When I needed more space, I decided to merge these two partitions. The partition was created with Mavericks, the merge was done with Yosemite.  I opened Disk Utility and the "minus" button. Disk Utility told me both partitions would be merged then. However it miserably failed. My main hard disc suddenly had errors which couldn't be repaired and even two of my other external hard discs could not be mounted any longer.  I eventually restored the hard disc from Time Machine, which worked well.  My second partition is now listed as free:    Unfortunately I can't resize the 600 GB partition nor can I create a new partition using the free space.  Diskutil reveils the following:  ~  diskutil list /dev/disk0    #:                       TYPE NAME                    SIZE       IDENTIFIER    0:      GUID_partition_scheme                        *750.2 GB   disk0    1:                        EFI EFI                     209.7 MB   disk0s1    2:          Apple_CoreStorage                         599.6 GB   disk0s2    3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3 /dev/disk1    #:                       TYPE NAME                    SIZE       IDENTIFIER    0:                  Apple_HFS Macintosh HD           *599.3 GB   disk1                                  Logical Volume on disk0s2                                  XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX                                  Unencrypted   Also diskutil brought up this:  ~  diskutil cs list CoreStorage logical volume groups (1 found) | +-- Logical Volume Group 9D2BA4BA-xxxx-xxxx-xxxx-xxxxxxxxxxxx     =========================================================     Name:         Macintosh HD     Status:       Online     Size:         599640592384 B (599.6 GB)     Free Space:   6111232 B (6.1 MB)     |     +-&lt; Physical Volume 29A9A02B-xxxx-xxxx-xxxx-xxxxxxxxxxxx     |   ----------------------------------------------------     |   Index:    0     |   Disk:     disk0s2     |   Status:   Online     |   Size:     599640592384 B (599.6 GB)     |     +-&gt; Logical Volume Family 2FA7892F-xxxx-xxxx-xxxx-xxxxxxxxxxxx         ----------------------------------------------------------         Encryption Status:       Unlocked         Encryption Type:         None         Conversion Status:       NoConversion         Conversion Direction:    -none-         Has Encrypted Extents:   No         Fully Secure:            No         Passphrase Required:     No         |         +-&gt; Logical Volume 7BF42B7B-xxxx-xxxx-xxxx-xxxxxxxxxxxx             ---------------------------------------------------             Disk:                  disk1             Status:                Online             Size (Total):          599282155520 B (599.3 GB)             Conversion Progress:   -none-             Revertible:            No             LV Name:               Macintosh HD             Volume Name:           Macintosh HD             Content Hint:          Apple_HFS   I have tried this:    fsck -fy (The volume Macintosh HD appears to be OK.)   but it wouldn't help. It said I couldn't recover because it wasn't created in a way it would support (sorry for missing the exact message).  I then have learned that Apple_CoreStorage might indicate my disk is encrypted, which might explain why I can't resize it. It doesn't explain why I can't create a new partition to me.  What are my options to make my hard disk available in a single partition with size 750 GB? In-Page Editor Line Distortion The SFDC In-page editor has always had distortion for me, and I'm just wondering if it's just a lousy browser plugin they're using or if someone has found a good browser / operating system combination that stops the obnoxious distortion.   Obviously Salesforce doesn't have much interest in fixing it: as it's been this way on multiple operating systems and browsers I've used since I've used Salesforce.  However, my frustration with their other developer tools has lead me to use it occasionally and it's always the same: Headers and font in KOMA-script I am setting up the layout for my bachelor thesis using scrbook as basis for a self-made documentclass with twosided print. I want a header containing the current part number and name on the outer side (left on even pages, right on odd pages), the current chapter number and name on the center of the head and the same for section on the inner side. I found this example in the KOMA-Script documentation:  \usepackage{scrlayer-scrpage} \pagestyle{scrheadings} \automark[chapter]{chapter} \automark*[section]{}   It puts the chapter on the outer side on even pages and the section on the outer side on odd pages. Sadly, I was not able to modify this to fit my needs because I do not really understand the way KOMA-Script works here. If a part starts but there is still no chapter in it, the place for the chapter shall remain empty (same for chapter and section). Can anyone help?  Furthermore, I would like to change all fonts that KOMA-Script changes (e.g. toc, section, chapter...) back to the default computer modern as I do not like the font KOMA-Script uses here. Is there a better way than changing all the fonts manually like this:  \addtokomafont{section}{\fontfamily{cmr}\selectfont} Creating a DateTime in a specific Time Zone in c# I'm trying to create a unit test to test the case for when the timezone changes on a machine because it has been incorrectly set and then corrected.  In the test I need to be able to create DateTime objects in a none local time zone to ensure that people running the test can do so successfully irrespective of where they are located.  From what I can see from the DateTime constructor I can set the TimeZone to be either the local timezone, the UTC timezone or not specified.  How do I create a DateTime with a specific timezone like PST? Distributing elements across a list of lists Adding an [AuthorYear] block at the beginning of bibliography entries I want to add a block at the beginning of my bib entries of the form      [Lastnameauthor(s) Year]   When the shortauthor field is defined it should use this field +Year instead. The following example is fairly minimal:  \begin{filecontents*}{test.bbx} \ProvidesFile{test.bbx}  [\abx@bbxid $Id: test.bbx,v 0.9d 2010/09/03 20:11:58 lehman beta $]  \RequireBibliographyStyle{authoryear}  \DeclareBibliographyDriver{article}{%   \usebibmacro{bibindex}%   \usebibmacro{begentry}%   %---add something here---   \usebibmacro{author/translator+others}%   \setunit{\labelnamepunct}\newblock   \usebibmacro{title}%   \newunit   \printlist{language}%   \newunit\newblock   \usebibmacro{byauthor}%   \newunit\newblock   \usebibmacro{bytranslator+others}%   \newunit\newblock   \printfield{version}%   \newunit\newblock   \usebibmacro{in:}%   \usebibmacro{journal+issuetitle}%   \newunit   \usebibmacro{byeditor+others}%   \newunit   \usebibmacro{note+pages}%   \newunit\newblock   \iftoggle{bbx:isbn}     {\printfield{issn}}     {}%   \newunit\newblock   \usebibmacro{doi+eprint+url}%   \newunit\newblock   \usebibmacro{addendum+pubstate}%   \setunit{\bibpagerefpunct}\newblock   \usebibmacro{pageref}%   \usebibmacro{finentry}}  \endinput  \end{filecontents*} \begin{filecontents*}{MeineBib.bib}   @article{example,  author={Firstname Lastname and First Last},   title={Title},  journal={Journal},  year={Year},   pages={Pages}, }    \end{filecontents*}  \documentclass[12pt,ngerman,    ]{scrartcl} \usepackage[ngerman]{babel} \usepackage{filecontents} \usepackage[babel,german=quotes]{csquotes} \usepackage [bibstyle=test]{biblatex} \bibliography{MeineBib}  \begin{document} \tableofcontents \cite{example} \printbibliography\end{document}   I'm guessing the solution lies here  DeclareBibliographyDriver{article}{%       \usebibmacro{bibindex}%       \usebibmacro{begentry}%       %---add something here---       \usebibmacro{author/translator+others}%   but I can't find out how. It should look like this  which is an existing style (natdin) in BibTeX, but not in biblatex. How can I set up dual monitors with nVidia? Using Laptop Screen as a monitor Some conditions require that a person lie in bed all the time until recovered. Is there a name for such conditions or people experiencing them at the moment?   For example,      I am currently &lt;bed sick&gt; and can't help you with your homework.   I tried looking for bed sick but hit a dead end. Given a large (~ 1 million) sample of unevenly distributed points - is it possible to generate irregular grid (in size, but could also be irregular in shape if that is possible?) that will contain specified minimum amount of n points?   It is of less importance for me if genereted 'cells' of such grid contain exactly n number of points or at least n points.  I'm aware of solutions like  in ArcGIS or  in QGIS/mmgis however they will all create regular grids which will result in an output with empty cells (smaller problem - I could simply discard them) or cells with count of points less than n (bigger problem since I'd need a solution to aggregate those cells, probably using some tools from ?).  I've been googling around to no avail and am open to both commercial (ArcGIS &amp; extensions) or free (Python, PostGIS, R) solutions. I have seen only the first three movies, so I don't know whether the other movies/TV series deal with this question or not. My main point is that in the movies, the terminator that travels back furthest in time is of the worst quality, and the quality increases with the time travel (meaning they travelled from a later time). What is a good explanation for this?  Note: I am not interested in the obvious not-in-universe explanation that they wanted something better and bigger for each new movie. As stated above, I can't connect to my home wi-fi with natty but can with Windows 7. The strange thing is I that I have gotten it to connect to other password protected networks with natty, it's just mine that it dosn't like.   I am using a WPA2 pass-code with AES Encryption and all other devises work fine on my network. Laptop used is a Dell Latitude D430. How to start X windows inside "Bash on Ubuntu on Windows" After installing the new feature (still "Beta") called  that is a feature subset of Windows 10 Anniversary edition, I get the following message when trying to start X-Windows using startx :    What do I need to tweak / configure in order for X-Windows to launch?  I noticed that xauth was already installed, however I had to install the rest of the framework as follows :  apt-get install xorg openbox Order of items in a context menu How to reshape data from long to wide format I'm mainly a C# developer, but I'm currently working on a project in Python.  How can I represent the equivalent of an Enum in Python? "Out of pocket"? I'm increasingly hearing the phrase "out of pocket" used in America as a colloquialism to mean "away from the office", "unavailable", or "incommunicado".     I apologize for not replying sooner; I have been out of pocket.    What is the etymology of this usage? It always sounds odd to me, since I had previously always associated the phrase with expenses, e.g., "I had to pay for the service out of pocket," meaning, "I had to pay for the service using my own money." Should either of these usages be avoided? What is the extent of their acceptance? I know this is a total noob question but then again, when it comes to PostgreSQL I am a total noob...    I have installed the OpenGeo suite on my computer, running Windows 7, 64-bit.  I have downloaded the tutorial data and have been working through it.  I would like to access the database that I have made with ArcGIS so I can start learning about how that works.  However, when I try to connect to the database using the "Add Database Connection..." I can't seem to figure out what to put in for 'Instance' - everything I've tried (localhost, localhost,54321, my IP address with and without the port, my computer name) doesn't seem to work.  I installed and created the nyc test database according to all the instructions in the OpenGeo tutorial pages but am at a total loss here.  I know this must be an easy thing to deal with, I just can't get my head around it.  Can someone with more experience throw me a bone on this one?    Frustratingly enough, QGIS connects to the database with almost no effort and everything works fine - but my organization is heavily ESRI focused and switching to QGIS is a long shot...  EDIT Thanks everyone for pitching in on this.  I really appreciate the advice, it's what makes this site great.  I have installed    OpenGeo Suite 3.0.1 with no extensions ArcGIS Desktop 10.1, no license for server   I just went to the Opengeo website and downloaded the Windows installer and installed the default configuration. I have tried every permutation for the instance name that I can think of - using colons and commas, my machine name, localhost, postgresql, server, my IP address, random curse words, anything I can think of.  I have been using port 54321 instead of 5432 because that is what the OpenGeo workshop told me to set up my 'nyc' practice database to use.    It seems that localhost should work, here is a shot of the server properties from pgAdmin: I'm looking for one word which describes what a student who missed classes needs to do How do you compute negative numbers to fractional powers?