What does %w(array) mean?

%w(foo bar) is a shortcut for [“foo”, “bar”]. Meaning it’s a notation to write an array of strings separated by spaces instead of commas and without quotes around them. You can find a list of ways of writing literals in zenspider’s quickref.

Passing a 2D array to a C++ function

There are three ways to pass a 2D array to a function: The parameter is a 2D arrayint array[10][10]; void passFunc(int a[][10]) { // … } passFunc(array); The parameter is an array containing pointersint *array[10]; for(int i = 0; i < 10; i++) array[i] = new int[10]; void passFunc(int *a[10]) //Array containing pointers { // … Read more

Where is Java’s Array indexOf?

There are a couple of ways to accomplish this using the Arrays utility class. If the array is not sorted and is not an array of primitives: If the array is primitives and not sorted, one should use a solution offered by one of the other answers such as Kerem Baydoğan’s, Andrew McKinlay’s or Mishax’s. The above code will compile even if theArray is primitive (possibly emitting … Read more

How to compare arrays in JavaScript?

To compare arrays, loop through them and compare every value: Comparing arrays: Usage: You may say “But it is much faster to compare strings – no loops…” well, then you should note there ARE loops. First recursive loop that converts Array to string and second, that compares two strings. So this method is faster than use … Read more

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