Differences in string compare methods in C#

Here are the rules for how these functions work: stringValue.CompareTo(otherStringValue) null comes before a string it uses CultureInfo.CurrentCulture.CompareInfo.Compare, which means it will use a culture-dependent comparison. This might mean that ß will compare equal to SS in Germany, or similar stringValue.Equals(otherStringValue) null is not considered equal to anything unless you specify a StringComparison option, it … Read more

Can’t compare naive and aware datetime.now()

By default, the datetime object is naive in Python, so you need to make both of them either naive or aware datetime objects. This can be done using: import datetime import pytz utc=pytz.UTC challenge.datetime_start = utc.localize(challenge.datetime_start) challenge.datetime_end = utc.localize(challenge.datetime_end) # now both the datetime objects are aware, and you can compare them Note: This would … Read more

Compare two List objects for equality, ignoring order [duplicate]

If you want them to be really equal (i.e. the same items and the same number of each item), I think that the simplest solution is to sort before comparing: Enumerable.SequenceEqual(list1.OrderBy(t => t), list2.OrderBy(t => t)) Edit: Here is a solution that performs a bit better (about ten times faster), and only requires IEquatable, not … Read more

What is the rationale for all comparisons returning false for IEEE754 NaN values?

I was a member of the IEEE-754 committee, I’ll try to help clarify things a bit. First off, floating-point numbers are not real numbers, and floating-point arithmetic does not satisfy the axioms of real arithmetic. Trichotomy is not the only property of real arithmetic that does not hold for floats, nor even the most important. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)