Can a c# DateTime value be set to a specific invalid value (like double.NaN)? I would like to initialize a DateTime value object with a value that does not represent a valid date because I need to distinguish an invalid or unset date from any valid value. For floating point numbers I would use not-a-number values like in this example:  Double value = Double.NaN;   Is there a similar value for DateTime objects in c#? For example something like that:  DateTime datval = DateTime.Invalid;
DateTime "null" value I've been searching a lot but couldn't find a solution. How do you deal with a DateTime that should be able to contain an uninitialized value (equivalent to null)? I have a class which might have a DateTime property value set or not. I was thinking of initializing the property holder to DateTime.MinValue, which then could easily be checked. I guess this is a quite common question, how do you do that?
I have an existing trigger which converts leads into peron accounts if the company name is blank.  Trigger AutoConvert on Lead (after insert) {      LeadStatus convertStatus = [           select MasterLabel           from LeadStatus           where IsConverted = true           limit 1      ];      List&lt;Database.LeadConvert&gt; leadConverts = new List&lt;Database.LeadConvert&gt;();       for (Lead lead: Trigger.new) {           if (!lead.isConverted &amp;&amp; lead.Company == null) {                Database.LeadConvert lc = new Database.LeadConvert();                String oppName = lead.Name;                 lc.setLeadId(lead.Id);                lc.setDoNotCreateOpportunity(true);                lc.setConvertedStatus(convertStatus.MasterLabel);                 leadConverts.add(lc);           }      }       if (!leadConverts.isEmpty()) {           List&lt;Database.LeadConvertResult&gt; lcr = Database.convertLead(leadConverts);      } }   I need to also write a trigger that stops records from coming into Salesforce if that email already exisits in a contact or an account (we use person accounts).  The issue is how do I get it working with the existing trigger (I need it to run before the trigger that converts it into a person account is run).   Is there a way to combine the two or add the functionality to create the record only if the email address doesn't already exist as a contact in the org? Find the population size that maximizes the probability that two random samples of size $20$ will have exactly $2$ members in common Ten fish are caught in a lake, marked, and then returned to the lake. Two days later 20 fish are again caught, 2 of which have been marked.  (a) Find the probability of 2 of the 20 fish being marked if the lake has $k$ fish (assuming the fish are caught at random). (b) What value of k maximizes the probability?    Progress:     I got the (a), $$\binom{10}{2}\binom{k-10}{18}\bigg/ \binom{k}{20}$$ But how do I get part (b) where $k$ is to maximize the probability? Do I need a UK or Ireland transit visa when flying from the US to a Schengen country? I am travelling to Budapest and therefore have a Schengen Visa. I hold an Indian passport and a valid US visa. I'm travelling from Chicago-Heathrow-Budapest and returning by Budapest-Dublin-Chicago.  Would I need a transit visa for UK/Ireland?  UPDATE  Hoping this will help someone someday.   I was not allowed to board my return flight (BUD-DUB-ORD) because I do not hold an overnight Irish Transit Visa. They said I could have transited happily if the connecting flight was in the same day, but because I would have to originally land at 10 PM and catch the connecting flight next morning at 10 AM, I needed a transit visa. Well, I thought it was BS, but couldn't help comply with the rules. I booked another last minute ticket and flew via Warsaw via LOT. In the experiments for photoelectric emission, the light is incident on one face of the emitting plate, for example the anode, when determining the stopping potential. The electrons are emitted by this face of the plate. Why are the electrons emitted in the direction of the incident light, and not opposite to it?  I have read a little about photons (the key words being, a little), and from what i gather, they have an intrinsic momentum $p=h/\lambda$, which is transferred entirely to the particle that absorbs it (along with the energy $h\nu$). This should imply that the electrons try to move further into the cathode, and not escape it! What is the fault in the reasoning?  Thanks! Is radioactive decay spontaneous or random? When it comes to radioactive decay, what is the difference between random and spontaneous?  For example, when the count rate of a radioactive isotope is measured, the readings fluctuate. Is this a demonstration of the randomness of the process, or of its spontaneous nature? When writing questions and answers here about the Harry Potter series, I often need a word for "someone who's not a Muggle". People often refer to "the wizarding world" as opposed to the Muggle word, so "wizard" would be one choice - but it seems slightly sexist to exclude witches in that way. On the other hand, "witch or wizard" is a bit cumbersome, much longer than the simple word "Muggle".  Is there a sensible word to use which is neither sexist nor cumbersome, that makes a good equivalent to "Muggle"? What would JK Rowling say to fill in a sentence such as this:     Muggles use technology, while [...] use magic. C++11: defining function on std::array If we pick randomly two points inside a circle centred at $O$ with radius $R$, and draw two circles centred at the two points with radius equal to the distance between them, what is the expected area of the intersection of the two cirlces that contain the origin $O$. What language is the Ubuntu Software Center written in? Just been wondering, since elementary AppCenter is written with Vala and Gtk+3.  Also, what GUI wrapper does it use? Which is correct: "This is her" or "This is she"? Upon answering the telephone, the person calling asks if Joan is available. If Joan is the person who answered the phone, should she say "This is her" or "This is she"? Electrons have spin 1/2, and as they are charged, they also have an associated magnetic moment, which can be measured by an electron beam splitting up in an inhomogeneous magnetic field or through the interaction of the electrons's magnetic moment with an external magnetic field in spectroscopic measurements.   On the other hand, a photon is neutral - how can one measure its spin if there's no magnetic moment? How do we know it has spin 1? How do I deal with NAs in residuals in a regression in R? If the velocity is a relative quantity, will it make inconsistent equations when applying it to the conservation of energy equations?  For example:  In the train moving at $V$ relative to ground, there is an object moving at $v$ relative to the frame in the same direction the frame moves. Observer on the ground calculates the object kinetic energy as $\frac{1}{2}m(v+V)^2$. However, another observer on the frame calculates the energy as $\frac{1}{2}mv^2$. When each of these equations is plugged into the conservation of energy, they will result in 2 distinct results (I think). How to start Ubuntu in Console mode I want to know if there is a way to switch to console mode from the boot menu.  I have an NVIDIA 1070 and every time there is an update, the GUI stops working. All I need to do is re-install the drivers; however, to do that I need to be in console mode. EDIT: I should have added more information to this question but I'll comment on all answers. In short: I've tried text instead of quiet splash I do see booting activity in text mode; however, I don't get a login screen and ctrl + Alt + F1 doesn't help because GDM keeps trying to restart. Previously I managed to kill GDM through multiple tries but is not working since the latest update. EDIT: After searching for runlevel, I've found  but I think it required me to have a running system to make changes -- please correct me if I'm wrong. Very basic question here, I am afraid.  I have hundreds of shattered pieces of a mesh and I am trying to animate their visibility over the scene.  How can I animate the visibility and render visibility parameter for one piece, then copy/transfer to all the others? Ever since Everything That Happened with Stack Exchange, it's understandable that many users are hesitant to get re-involved on SE.  It's understandable that  are deleting their own accounts, out of protest, or out of frustration, or for many other reasons.  But I have noticed that, at the very least on , where I spend most of my time, questions are getting fewer views and fewer answers, fewer votes are being cast, and fewer questions themselves are being asked.  I've also noticed that flags are taking a long time to be processed, probably because of the fact that Writing.SE .    Are other sites also experiencing inactivity?  Is this in direct correlation with Everything That Happened?  Is it just this site, or are other sites experiencing the same patterns as well? How is the classical twin paradox resolved? I read a lot about the classical twin paradox recently. What confuses me is that some authors claim that it can be resolved within , others say that you need . Now, what is true (and why)? The following code should find the appropriate project tag and remove it from the XmlDocument, however when I test it, it says:  The node to be removed is not a child of this node.  Does anyone know the proper way to do this?  public void DeleteProject (string projectName) {     string ccConfigPath = ConfigurationManager.AppSettings["ConfigPath"];      XmlDocument configDoc = new XmlDocument();      configDoc.Load(ccConfigPath);      XmlNodeList projectNodes = configDoc.GetElementsByTagName("project");      for (int i = 0; i &lt; projectNodes.Count; i++)     {         if (projectNodes[i].Attributes["name"] != null)         {             if (projectName == projectNodes[i].Attributes["name"].InnerText)             {                                                                 configDoc.RemoveChild(projectNodes[i]);                 configDoc.Save(ccConfigPath);             }         }     } }   UPDATE  Fixed. I did two things:  XmlNode project = configDoc.SelectSingleNode("//project[@name='" + projectName + "']");   Replaced the For loop with an XPath query, which wasn't for fixing it, just because it was a better approach.  The actual fix was:  project.ParentNode.RemoveChild(project);   Thanks Pat and Chuck for this suggestion. NSInvocation for Dummies? How exactly does NSInvocation work? Is there a good introduction?  I’m specifically having issues understanding how the following code (from Cocoa Programming for Mac OS X, 3rd Edition) works, but then also be able to apply the concepts independently of the tutorial sample. The code:  - (void)insertObject:(Person *)p inEmployeesAtIndex:(int)index {     NSLog(@"adding %@ to %@", p, employees);     // Add inverse of this operation to undo stack     NSUndoManager *undo = [self undoManager];     [[undo prepareWithInvocationTarget:self] removeObjectFromEmployeesAtIndex:index];     if (![undo isUndoing])         [undo setActionName:@"Insert Person"];      // Finally, add person to the array     [employees insertObject:p atIndex:index]; }  - (void)removeObjectFromEmployeesAtIndex:(int)index {     Person *p = [employees objectAtIndex:index];     NSLog(@"removing %@ from %@", p, employees);     // Add inverse of this operation to undo stack     NSUndoManager *undo = [self undoManager];     [[undo prepareWithInvocationTarget:self] insertObject:p                                        inEmployeesAtIndex:index];     if (![undo isUndoing])         [undo setActionName:@"Delete Person"];      // Finally, remove person from array     [employees removeObjectAtIndex:index]; }   I get what it’s trying to do. (BTW, employees is an NSArray of a custom Person class.)  Being a .NET guy, I try to associate unfamiliar Obj-C and Cocoa concepts to roughly analogous .NET concepts. Is this similar to .NET’s delegate concept, but untyped?   This isn’t 100% clear from the book, so I’m looking for something supplemental from real Cocoa/Obj-C experts, again with the goal that I understand the fundamental concept beneath the simple(-ish) example. I'm really looking to be able to independently apply the knowledge -- up until chapter 9, I was having no difficulty doing that. But now ...    Thanks in advance! How do I tell if matrices are similar?