FAQ Database Discussion Community


Sorting and displaying values systematically from a multi-dimensional PHP array

php,arrays,wordpress,sorting,sub-array
Below I've appended the $var_dump of an array that I've created through user-actions involving an HTML form. I'm certainly willing to consider other strategies for achieving the final effect (and I'm not, to be honest, positive that it would not be better achieved via WordPress functions, since that's the environment...

How to get a subarray in numpy

numpy,sub-array
I have an 3d array and I want to get a sub-array of size (2n+1) centered around an index indx. Using slices I can use y[slice(indx[0]-n,indx[0]+n+1),slice(indx[1]-n,indx[1]+n+1),slice(indx[2]-n,indx[2]+n+1)] which will only get uglier if I want a different size for each dimension. Is there a nicer way to do this....

Sort array of objects by subarray property value in javascript

javascript,arrays,sorting,sub-array
I have an array of JavaScript objects: var people = [ { "name": "Edward", "age": 100, "wallet": { "location": "home", "cash": 500 }, "bank": { "location": "bank street", "cash": 22100 } }, { "name": "Lisa", "age": 30, "wallet": { "location": "home", "cash": 20 }, "bank": { "location": "bank street", "cash":...

C# subarray of strings with LINQ

c#,string,linq,startswith,sub-array
I have an array of strings and I have to take only those entries, which are starting with "81" or "82". I've tried it like this: var lines = File.ReadAllLines(fileName); // This returns an array of strings lines = lines.TakeWhile(item => item.StartsWith("81") ||item.StartsWith("82")).ToArray(); but this just doesn't work. It retuns...