Category "arrays"

Why does the indexing start with zero in 'C'?

Why does the indexing in an array start with zero in C and not with 1?

How can I use `defineProperty` to create a readonly array property?

I have the following as a part of a module (names simplified for purpose of question): In "module.js": var _arr; _arr = []; function ClassName () { var

Retrieving values from multidimensional arrays

I have an array something like this: int[,] multiDimensionalArray2 = { { 1, 2 }, { 4, 5 } }; if I want to retrieve 1 and 2 and feed them into this: int a; i

storing coordinates in array in javascript

I want to store coordinates into an array in javascript, I am new to javascript and do not have an idea how to do it. Any help would be appreciated.

ES6 - Finding data in nested arrays

In ES6 using find or filter I'm quite comfortable iterating through to find an element in an array using a value. However, I'm trying to get a value from a par

how to combine many google sheets in one sheet by using query

I created two online sheets and tried to collect them in another one sheet by query but there a missing data although it's exists in the original sheets (data s

How to construct a ndarray from a numpy array? python

I can't seem to convert it into an ndarray in numpy, i've read http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html but it didn't show me how

How to resize multidimensional (2D) array in C#?

I tried the following but it just returns a screwed up array. T[,] ResizeArray<T>(T[,] original, int rows, int cols) { var newArray = new

Extract subarray between certain value in Python

I have a list of values that are the result of merging many files. I need to pad some of the values. I know that each sub-section begins with the value -1. I am

Converting array to string and then back in PHP

I created a array using PHP $userarray = array('UserName'=>$username,'UserId'=>$userId,'UserPicURL'=>$userPicURL); How can I convert this array into

Is it possible to map only a portion of an array? (Array.map())

I am building a project using React.js as a front-end framework. On one particular page I am displaying a full data set to the user. I have an Array which conta

PHP drop down list using array's and foreach (else and for) code

I'm taking a course called "Dynamic Web Development with PHP" and after getting an F for an exercise, I wish if you could help me with the following. I have a p

Javascript - Remove duplicate ID from array of objects

Take the following two arrays: const array1 = [ { props: { type : 'text', id : 'item1', name : 'item1', value : '@item1@', },

How to replace item in array?

Each item of this array is some number: var items = Array(523,3452,334,31, ...5346); How to replace some item with a new one? For example, we want to replace 3

Converting an int[] to byte[] in C#

I know how to do this the long way: by creating a byte array of the necessary size and using a for-loop to cast every element from the int array. I was wonde

Create a new line whenever an array value reaches more than 10 characters

Here is my code, but it isn't dynamic. What I need is it will automatically create new line if array value is greater than 10. <?php $limit = 10; $newline =

array_map triple dimensional array [duplicate]

How do I run a array_map on a triple dimensional array? Where I want to "clear" the innermost array? It looks like this: Array ( [1] =&g

How to filter related models (hasMany relation) using where in LoopBack 3

Customer hasMany relationship with jobs Filtering by the top-level property works as shown below Customer.find({ include: ["jobs"],where :{username:"mel"} },

PHP array_filter with arguments

I have the following code: function lower_than_10($i) { return ($i < 10); } that I can use to filter an array like this: $arr = array(7, 8, 9, 10, 11

Check if string contains a value in array [duplicate]

I am trying to detect whether a string contains at least one URL that is stored in an array. Here is my array: $owned_urls = array('website1