syntax - What's the difference between <?> and <? extends Object> in Java Generics?

<?> and <? extends Object> are synonymous, as you'd expect. There are a few cases with generics where extends Object is not actually redundant. For example, <T extends Object & Foo> will cause T to b... Read More

Dynamic variable names in Bash

I've been looking for better way of doing it recently. Associative array sounded like overkill for me. Look what I found: suffix=bzz declare prefix_$suffix=mystr ...and then... varname=prefix_$suffi... Read More

java - Difference between >>> and >>

>> is arithmetic shift right, >>> is logical shift right. In an arithmetic shift, the sign bit is extended to preserve the signedness of the number. For example: -2 represented in 8 bits would be 11... Read More

php - Are "elseif" and "else if" completely synonymous?

From the PHP manual: In PHP, you can also write 'else if' (in two words) and the behavior would be identical to the one of 'elseif' (in a single word). The syntactic meaning is slightly different (i... Read More

Multiline strings in JSON

JSON does not allow real line-breaks. You need to replace all the line breaks with \n. eg: "first line second line" can saved with: "first line\nsecond line" Note: for Python, this should be written... Read More

syntax - Ternary operator (?:) in Bash

ternary operator ? : is just short form of if/else case "$b" in 5) a=$c ;; *) a=$d ;; esac Or [[ $b = 5 ]] && a="$c" || a="$d"... Read More

How does this JavaScript/jQuery syntax work: (function( window, undefined ) { })(window)?

The undefined is a normal variable and can be changed simply with undefined = "new value";. So jQuery creates a local "undefined" variable that is REALLY undefined. The window variable is made local... Read More

What is the proper way to test a bash function return value?

If it was the exit code and not the result you could just use if func arg; then ... If you cannot make the function return a proper exit code (with return N), and you have to use string results, use... Read More

java - Null check in an enhanced for loop

You should better verify where you get that list from. An empty list is all you need, because an empty list won't fail. If you get this list from somewhere else and don't know if it is ok or not you... Read More

java - Why the strange indentation on switch statements?

The cases are logically labels. Many people put labels at the same indentation level as the block they are in. In my opinion, that way it's easier to read through the text. I compare it with a timeli... Read More