Why dividing int.MinValue by -1 threw OverflowException in unchecked context?

This is not an exception that the C# compiler or the jitter have any control over. It is specific to Intel/AMD processors, the CPU generates a #DE trap (Divide Error) when the IDIV instruction fails. The operating system handles the processor trap and reflects it back into the process with a STATUS_INTEGER_OVERFLOW exception. The CLR … Read more

Jquery set radio button checked, using id and class selectors

“…by a class and a div.” I assume when you say “div” you mean “id”? Try this: $(‘#test2.test1’).prop(‘checked’, true); No need to muck about with your [attributename=value] style selectors because id has its own format as does class, and they’re easily combined although given that id is supposed to be unique it should be enough … Read more

What is the difference between the states selected, checked and activated in Android?

The difference between Checked and Activated is actually quite interesting. Even the Google documentation is apologetic (emphasis below added): … For example, in a list view with single or multiple selection enabled, the views in the current selection set are activated. (Um, yeah, we are deeply sorry about the terminology here.) The activated state is … Read more

if checkbox is checked, do this

I would use .change() and this.checked: $(‘#checkbox’).change(function(){ var c = this.checked ? ‘#f00’ : ‘#09f’; $(‘p’).css(‘color’, c); }); — On using this.checked Andy E has done a great write-up on how we tend to overuse jQuery: Utilizing the awesome power of jQuery to access properties of an element. The article specifically treats the use of … Read more

Setting “checked” for a checkbox with jQuery

Modern jQuery Use .prop(): $(‘.myCheckbox’).prop(‘checked’, true); $(‘.myCheckbox’).prop(‘checked’, false); DOM API If you’re working with just one element, you can always just access the underlying HTMLInputElement and modify its .checked property: $(‘.myCheckbox’)[0].checked = true; $(‘.myCheckbox’)[0].checked = false; The benefit to using the .prop() and .attr() methods instead of this is that they will operate on all … Read more