Why is the maximum value of an unsigned n-bit integer 2ⁿ-1 and not 2ⁿ?

The -1 is because integers start at 0, but our counting starts at 1. So, 2^32-1 is the maximum value for a 32-bit unsigned integer (32 binary digits). 2^32 is the number of possible values. To simplify why, look at decimal. 10^2-1 is the maximum value of a 2-digit decimal number (99). Because our intuitive … Read more

Why Treat 0 as True in Ruby?

I’m guessing that Matz wanted conceptual simplicity of “truthiness” as such – the only “false” values are false and nil. Period. Using just false would be the cleanest but there is understandable need for including nil. To include the integer zero as a special case might open the mental floodgates of questioning truthiness of other … Read more

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