Differences between declare, typeset and local variable in Bash

Difference between typeset and declare: The former is more portable(e.g. ksh), while the latter is more preferable when portability is not a concern. Difference between declare(or typeset) and local when used inside a function: The former implies the latter, but more powerful. For example, declare -i x makes x have the integer attribute, declare -r … Read more

C function pointer syntax

I explain this in my answer to Why was the C syntax for arrays, pointers, and functions designed this way?, and it basically comes down to: the language authors preferred to make the syntax variable-centric rather than type-centric. That is, they wanted a programmer to look at the declaration and think “if I write the … Read more

How to declare an ArrayList with values? [duplicate]

In Java 9+ you can do: var x = List.of(“xyz”, “abc”); // ‘var’ works only for local variables Java 8 using Stream: Stream.of(“xyz”, “abc”).collect(Collectors.toList()); And of course, you can create a new object using the constructor that accepts a Collection: List<String> x = new ArrayList<>(Arrays.asList(“xyz”, “abc”)); Tip: The docs contains very useful information that usually … Read more

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