I am trying to set an NSDate from a string. The format of the string looks like this (RFC 2822):  Tue, 09 Jun 2015 06:09:38 +0000   The code I am using is:  NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier: @"en_US_POSIX"]; dateFormatter.dateFormat = @"EEE, dd MMM yyyy hh:mm:ss Z"; NSDate *dateString = [dateFormatter dateFromString:self.time];   But dateString always returns a nil. self.time definitely contains the string for the time.
How do I convert, NSDate to NSString so that only the year in @"yyyy" format is output to the string?
Let $m$ and $n$ be two integers. Prove that if $m^2 + n^2$ is divisible by $4$, then both $m$ and $n$ are even numbers.   I think I have to use the contrapositive to solve this. So I assume $\neg P\implies Q$ and I have to derive $\neg Q$? I know its easier to show odd numbers rather than even... but im still unsure how to do this practice problem. Limit the post for differents custom post type in the same wp_query I have three custom post type:    books magazine videos   Now i want to limit the number of post for custom post type, for example:   books => 3 post magazine => 2 post videos => 1 post   I used a query post like this:  query_posts( array(     'post_type' =&gt; array(     'books',     'magazine',     'videos' ), 'paged' =&gt; $paged, 'posts_per_page' =&gt; 6,  )); $counter = 1; if (have_posts()) :     while (have_posts()) : the_post();   if (($counter == 2) || ($counter == 3) || ($counter == 4)) {         $div = 'alpha';     } elseif(($counter == 6)) {         $div = 'omega';     } else {         $div = '';     }   The problems is i cant limit the numbers by custom post type.  Any idea?  Thank you :) Bell's inequality theorem, along with experimental evidence, shows that we cannot have both realism and locality.  While I don't fully understand it, Leggett's inequality takes this a step further and shows that we can't even have non-local realism theories.  Apparently there are some hidden variable theories that get around this by having measurements be contextual.  I've heard there are even inequalities telling us how much quantum mechanics does or doesn't require contextuality, but I had trouble finding information on this.  This is all confusing to me, and it would be helpful if someone could explain precisely (mathematically?) what is meant by: realism, locality (I assume I understand this one), and contextuality.  What combinations of realism, locality, and contextuality can we rule out using inequality theorems (assuming we have experimental data)? I am doing some arcpy -functions and afterwards I'm trying to add the calculated results from one table to another table. I'm using the arcpy.AddJoin_management() function.   As input table I'm using a table which is stored in a personal geodatabase. The personal geodatabase is not the workspace environment! As "JoinTable" a Table of a file geodatabase is used. This file geodatabase is the workspace geodatabase environment.  The initialized function looks like this:  (%self.getWorkspaceEnvironment => "W:/a18fb/data/mypersonalgeodatabase.mdb" and tFactsheetHochwasser => table in the personal geodatabase)  arcpy.AddJoin_management("%s/tFactsheetHochwasser"%self.getWorkspaceEnvironment(),"KPG", "GebaeudeKtn_BWVred1Stat","KPG","KEEP_ALL")  If the code is executed the following error-message appears:  Failed to execute.Parameters are not valid. The value cannot be a table     ERROR 000840: The value is not a Raster Layer.      ERROR 000840: The value is not a Raster Catalog Layer.      ERROR 000840: The value is not a Mosaic Layer.      Failed to execute (AddJoin)`. I am using extensively trigonometric functions when an angle is given in degrees. Some of these functions like sine or cosine have rational values, for example, the well   known example is that $\cos(\theta) =0.6 $ and $\sin(\theta) =0.8 $.       However besides the case of multiplicity of $90^\circ$ it seems there are no rational numbers $\theta$  with simultaneously rational  values of  sine and cosine.      Is it possible somehow to prove that for rational values of an angle given in degrees there are  no values simultaneously rational of sine and cosine functions, beside obvious case of multiplicities of $90^\circ$? Tricks for getting lots of arrows? Any tips or tricks for getting arrows (besides cheating)? Or tricks for finding a skeleton spawn?  I've tried farming chickens and gravel for feathers and flint, but it takes a ridiculously long time. How do people get enough arrows to make using a bow actually feasible? Does DTIME(O(n)) = REGULAR? (I don't think that this is a good fit on cstheory, since I figure that this question already has a known answer.  However, if you think that this would be a better fit there, please feel free to migrate it)  It can easily be shown that REGULAR (the class of regular languages) is contained in DTIME(O(n)), because for any regular language L we can decide membership in that language in O(n) time by converting a DFA that decides L into a TM that decides L in a single pass over the input.  However, is it also true that DTIME(O(n)) is contained in REGULAR; that is, that any language that can be decided in O(n) time by a single-tape TM is necessarily regular?  I have no idea how to approach this problem, and every language I can think of in DTIME(O(n)) seems to be regular.  Intuitively, this would make sense, since if you're only allowed to make finitely many passes over the input, you could only remember finitely many things about it, which it seems like you could simulate with a sufficiently large DFA.  However, the fact that you can write to the input tape seems like it might complicate things.  And no, this isn't a homework problem.  I'm actually teaching a course that covers computability and complexity theory and thought it would be interesting to present the answer to this question in lecture. :-)  Thanks! Do I need a RHEL subscription to install packages? How to resolve a hostname to an IP address in Metro/WinRT? Render looks darker than Look Dev mode Lots of questions in the reopen queue My storage was not updated Where can I find historical data on arrival and departure times of a particular flight? Where can I find historical data on flights, specifically Delta international flights?  I need to find out about cancellations, diversions and any other flight data pertaining on particular route at a given time.  This source has to be official and stand up to legal scrutiny. How can an uneducated but rational person differentiate between science and religion? I recently found myself unable to respond to the statement "But the big bang theory is just another creation myth!" during a science vs. religion argument. I found it very difficult to explain the difference between the big bang theory and creation myths without going through a crash course in Newtonian and then Relativistic mechanics.   This had me thinking of the following scenario: Consider a person who for various reasons never got a formal education beyond basic reading and writing. He/She doesn't know any science or math, and was never exposed to any scientific reasoning and experiments. She/He is however an open minded, level headed, and rational person (I've met more than one such person myself).   How would such a person differentiate science from religion? As far as he/she is concerned science has the exact same structure as religion:    A hard to understand scripture: Science treatises and journal papers.  An ordained clergy with a high entry barrier: Doctors, professors, scientists, etc... Seemingly arbitrary injunctions against certain behaviors: "Don't smoke", "Don't pollute",.... Various metaphysical (from his/her perspective) claims about the world around us: The big bang, other galaxies, blackholes, quarks,... Organizations which control and oversee doctrine: The FDA, The NIH, The NFS,...   From his/her perspective, all of these characteristics are no different than the way organized religion presents itself as being the source of truths about the world.   In particular if such a person were to heed the advice of the :         Do not go upon what has been acquired by repeated hearing (anussava),   nor upon tradition (paramparā),   nor upon rumor (itikirā),   nor upon what is in a scripture (piṭaka-sampadāna)   nor upon surmise (takka-hetu),   nor upon an axiom (naya-hetu),   nor upon specious reasoning (ākāra-parivitakka),   nor upon a bias towards a notion that has been pondered over (diṭṭhi-nijjhān-akkh-antiyā),   nor upon another's seeming ability (bhabba-rūpatāya),   nor upon the consideration, The monk is our teacher (samaṇo no garū) Kalamas, when you yourselves know: "These things are good; these   things are not blamable; these things are praised by the wise;   undertaken and observed, these things lead to benefit and happiness,"   enter on and abide in them.'      Following the Buddha's advice (ironically himself a religious figure), such a rational but uneducated person would have just as much reason to doubt the various results of scientists as to doubt the dogmas of organized religion.    How would it be possible for such a person to distinguish scientific facts from religious dogma?  How can we convince such a person of the validity of ideas like those of modern cosmology or evolutionary biology, without first having to teach them enough biology and physics to understand those concepts? I don't understand how to use Fermat's little theorem to find remainders e.g if we are asked to find remainder of $50^{50}$ on division by $13$, what is a and what is $p$ in the formula?  Also I wanted to check can we use both congruence classes as well as Fermat's little theorem to find such remainders? How would be write $50^{50}$ on division by $13$ in terms of congruence classes to find the remainder?  I don't exactly understand what a congruence class is, what does it tell us and how is it related to this? What, exactly, is transferred along supply lines? How can I serialize an object to JSON without properties that are null? To communicate with a REST interface on a private system, I need to send a JSON message from a trigger. I have a message object that has some fields, lists and a child object:  public class MerchantConfig {  public class MIDConfig {     public String mid;     public String currencyCode;     public String cardTemplateName;     public String paymentPanelRestriction;     public List&lt;String&gt; restrictedCountries;      public String paymentPanelRestrictionForCountries; }  public String merchantName; public String sopgTemplateName; public Integer dispositionTimeWindowInMinutes; public List&lt;String&gt; features; public Boolean activateImmediately; public List&lt;MIDConfig&gt; midConfiguration; }   I can serialize it to JSON using the built-in serializer:  String body = JSON.serializePretty([MerchantConfig instance]);   The result:  {   "sopgTemplateName" : null,   "midConfiguration" : [ {     "restrictionCountries" : [ "DE", "AT" ],     "paymentPanelRestrictionForCountries" : "MANDATORY",     "paymentPanelRestriction" : "OPTIONAL",     "mid" : "1000000001",     "currencyCode" : "EUR",     "cardTemplateName" : null   }, {     "restrictionCountries" : [ ],     "paymentPanelRestrictionForCountries" : "",     "paymentPanelRestriction" : "OPTIONAL",     "mid" : "1000000002",     "currencyCode" : "USD",     "cardTemplateName" : null   }, {     "restrictionCountries" : [ ],     "paymentPanelRestrictionForCountries" : "",     "paymentPanelRestriction" : "PROHIBITED",     "mid" : "1000000003",     "currencyCode" : "AUD",     "cardTemplateName" : null   } ],   "merchantName" : "Test Merchant",   "features" : [ XYZ ],   "dispositionTimeWindowInMinutes" : 10,   "activateImmediately" : true }   How can I serialize this object so that all properties that are null don't show up in the JSON string?   In this example, "sopgTemplateName" and all "cardTemplateName" properties are null and should not appear in the JSON string. The empty list "restrictionCountries" should still appear as an empty list, though. If $R$ is an infinite ring, then $R$ has either infinitely many zero divisors, or no zero divisors Please help me to prove that if $R$ is an infinite ring, then $R$ has either an infinite number of zero divisors, or it has no zero divisors. Convert and redirect URL in uppercase to lowercase using .htaccess I would like to redirect a URL with uppercase characters http://localhost/A/B to a lowercase version http://localhost/a/b using the .htaccess file. Using regex I can capture A and B but is it possible to convert them to lowercase? mongodb group values by multiple fields