Why is this field declared as private and also readonly?

If it’s private and readonly, the benefit is that you can’t inadvertently change it from another part of that class after it is initialized. The readonly modifier ensures the field can only be given a value during its initialization or in its class constructor. If something functionally should not change after initialization, it’s always good … Read more

readonly div in CSS or JavaScript

You could use pointer-events: none; to disable mouse DOM interaction (like click, hover, etc) on certain element. Example: div { pointer-events: none; } <div> <input type=”text” value=”value” /> <br /> <textarea>value</textarea> </div> However, even though pointer-events: none; is there, it’s still possible to make the cursor to be focus on the element (or it’s children). … Read more

How can you make a variable/Object read only in Javascript? [duplicate]

In the current widely available implementation, ECMAScript 3 there is no support for real immutability. UPDATE: Nowadays, the ECMAScript 5 standard is widely supported. It adds the Object.seal and Object.freeze methods. The Object.seal method will prevent property additions, still allowing the user to write to or edit the existing properties. The Object.freeze method will completely … Read more

Changed behavior of string.Empty (or System.String::Empty) in .NET 4.5

The difference lies in the JIT for the new release of .NET, which apparently optimizes references to String.Empty by inlining a reference to a particular String instance rather than load the value stored in the Empty field. This is justified under the definition of the init-only constraint in ECMA-335 Partition I ยง8.6.1.2, which can be … Read more

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