Assume that int array arrayName is a member of class className, How can I access its element in my main program?? className.arrayName[0] doesn't seem to work
I have the following code:
function HideTemplates($File, $Templates)
{
foreach ($Template in $Templates)
{
Write-Host $Template[0] $Template[1] $Template[2]
}
}
HideTemplates "test.xml" @(("one", "two", "three"))
HideTemplates "test.xml" @(("four", "five", "six"), ("seven", "eight", "nine"))
It prints:
o n e
t w o
t h r
four five six
seven eight nine
I want it to print:
one two three
four five six
seven eight nine
Am I doing something wrong in my code? Is there a way to force PowerShell to tread a multi-dimensional array with a single item differently?
Is it possible to set 'MaxDegreeOfParallelism' (that is maximum number of threads to use) for Array.Parallel module since under the hood it uses Parallel.For?
if an array of size n has only 3 values 0 ,1 and 2 (repeated any number of times) what is the best way to sort them. best indicates complexity. consider space and time complexity both
i'd like to record sounds played by tapping with a two dimensional array using the time and the sound id.
is there any code example anywhere?
thanx blacksheep
When I obtain a field 'text' of an array I have to do something like this:
$text = isset($tab['text'][0])?$tab['text'][0]:"";
is there any function that returns value when element $tab['text'] exists and "" when not and of course doesn't produce notice in latter case.
$GET = array();
$key = 'one=1';
$rule = explode('=',$key);
/* array_push($GET,$rule[0]=>$rule[1]); */
I'm looking for something like this so that:
print_r($GET);
/*output:*/ $GET[one=>1,two=>2,...]
is there a function to do this (because array_push won't work this way).
thanks!
I have such an array:
arr['key1'] = true;
arr['key2'] = true;
arr['key3'] = true;
...
arr['keyN'] = true;
How to determine, have anyone key a "false" value?
I open excel file by JExcel, modify some cells and save it.
As result Array formulas({ ... } CTRL+SHIFT+ENTER) was broken.
Does anybody know what to do? (FormulaException is rasing during copy)
I'm looking for the easiest way to sort an array that consists of numbers and text, and a combination of these.
E.g.
'123asd'
'19asd'
'12345asd'
'asd123'
'asd12'
turns into
'19asd'
'123asd'
'12345asd'
'asd12'
'asd123'
This is going to be used in combination with the solution to another question I've asked here.
The sorting function in itself works, what I need is a function that can say that that '19asd' is smaller than '123asd'.
I'm writing this in JavaScript.
I have this array, for example (the size is variable):
x = ["1.111", "1.122", "1.250", "1.111"]
and I need to find the most commom value ("1.111" in this case).
Is there an easy way to do that?
Tks in advance!
I need to represent some spatial points: x,y,z
when I try to initialize the array like this:
int[][][] points
{
{
{100, 120, 10},
{100, 120, 18},
...
}
}
I got an error: Uncompilable source code - not a statement
where is the error?
I'm trying to initialize an int array with everything set at -1.
I tried the following, but it doesn't work. It only sets the first value at -1.
int directory[100] = {-1};
Why doesn't it work right?
Let's say I have this to create a multidimensional array dynamically:
int* *grid = new int*[gridSizeX];
for (int i=0; i<gridSizeX; i++) {
grid[i] = new int[gridSizeY];
}
Shouldn't be possible now to access elements like grid[x][y] = 20?
Hi,
i basically want to know the differences or advantages in using a generic list instead of an array in the below mentioned scenario
Class Employee
{
private _empName;
Public EmpName
{
get{return _empName;}
set{_empName = value;}
}
}
1. Employee[] emp
2. List<Employee> emp
can anyone please tell me the advantages or disadvaatges and which one to prefer
Hi all,
i'd like to call a function using an array as a parameters:
var x = [ 'p0', 'p1', 'p2' ];
call_me ( x[0], x[1], x[2] ); // i don't like it
function call_me (param0, param1, param2 ) {
// ...
}
Is there a better way of passing the contents of x into call_me()?
Ps. I can't change the signature of call_me(), nor the way x is defined.
Thanks in advance
example some array {2,8,9,10,21,32,1,6,3...}
first child take (data size / 2) and sort
second chile take (data size / 2) and sort after combine 2 child data and give us a sorted full data, is it possible with some algorithms?
i'd like to record sounds played by tapping with a two dimensional array using the time and the sound id.
is there any code example anywhere?
thanx blacksheep
I have a multi-dimensional array:
a=[[2,3,4],[1,3,4],[1,2],[1,2,3,4]]
i've to compare all the 4 sub-arrays and get common elements.Next,take 3 subarrays at a time and get common elements.then take 2 sub arrays at a time and get common elements, in RUBY.
i code some configuration setting. And need those values to be load, everytime my webapp start. yes, it's somekind autoload setting.
But, right now, i have to choose between save it as object or array. is there any different between them when we save them in database ? which one is faster or maintainable or other pro and cons
thanks
i'd like to record sounds played by tapping with a two dimensional array using the time and the sound id.
is there any code example anywhere?
thanx blacksheep
In what cases I should use Array(Buffer) and List(Buffer). Only one difference that I know is that arrays are nonvariant and lists are covariant. But what about performance and some other characteristics?