Python: max/min builtin functions depend on parameter order

In [19]: 1>float(‘nan’) Out[19]: False In [20]: float(‘nan’)>1 Out[20]: False The float nan is neither bigger nor smaller than the integer 1. max starts by choosing the first element, and only replaces it when it finds an element which is strictly larger. In [31]: max(1,float(‘nan’)) Out[31]: 1 Since nan is not larger than 1, 1 … Read more

What is the difference between google’s ImmutableList and Collections.unmodifiableList ()?

No, the immutability is only applied to the amount and references of the objects in the Collection, and does not address the mutability of objects you put in the Collection. What Immutable list gains over the standard JDK Collections.unmodifiableList is that by using ImmutableList you are guaranteed that the objects referenced, their order and the … Read more

What is the correct way to compare char ignoring case?

It depends on what you mean by “work for all cultures”. Would you want “i” and “I” to be equal even in Turkey? You could use: bool equal = char.ToUpperInvariant(x) == char.ToUpperInvariant(y); … but I’m not sure whether that “works” according to all cultures by your understanding of “works”. Of course you could convert both … Read more

.net ORM Comparison [closed]

Since J. Tihon did a great job on explaining EF features, I’ll just list the areas where NHibernate runs circles around EF: Caching EF has nothing out of the box; there’s just an unsupported sample NH has complete caching support, including DB-based invalidation. It’s also extensible and provider-based, meaning it works with different types of … Read more

(…()) vs. (…)() in javascript closures [duplicate]

There’s no difference. Both are valid ways to get the JavaScript parser to treat your function as an expression instead of a declaration. Note that + and ! will also work, and are sometimes used by minifiers to save a character of size: +function() { var foo = ‘bar’; }(); !function() { var foo = … Read more

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