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
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.
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 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 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'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'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?
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)
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?
I am doing an SVN merge for a branch, and in one of the files I see this:
GetQueryReferenceData(int sessionId, Int32 sessionId)
Which means that the merge tool just added another parameter without asking any questions. Imagine if it was a call to Substring(0) and in another branch it would be Substring(0,2). That is completely different behavior, how does it even get to decide which one to choose? Good thing it came up during compile time.
The problem is that it will not be marked as a conflict and will be merged automatically. That is very dangerous behavior and if you don't have the luxury of having a unit test for every line of code - you are screwed.
What am I doing wrong and how to do big merges without the merging tool putting in dangerous changes silently? Is there a merge tool that is not language agnostic?
I am using Tortoise SVN.
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
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
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
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 wrote a program in c# using directshow , that captures all devices' audios , and video from single device (webcam or external camera) , now that my requirement is to merge selected audio files with one video file and i can not get it done in c#.
so i need a program or libraries that merges one(or several) audio file(s) and one video file and save it as an avi VIDEO file ,, both audio file and video files are in avi format.
I'm new to T-SQL command MERGE so I found a place in my SQL logic where I can use it and want to test it but can't figure out how exatcly should I use it:
IF (EXISTS (SELECT 1 FROM commissions_history WHERE request = @requestID))
UPDATE commissions_history
SET amount = @amount
WHERE request = @requestID
ELSE
INSERT INTO commissions_history (amount) VALUES @amount)
Plase suggest the proper usage. Thanks!
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 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'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?
hi.
Suppose I have some pointer, which I want to reinterpret as static dimension array reference:
double *p;
double (&r)[4] = ?(p); // some construct?
Is it possible to do so?
how do I do it?
i have an ajax script that check if the user name is available or not, but it keeps taking the newest user name and the rest are out
$result = mysql_query("Select username from customer");
while ($row = mysql_fetch_array($result)){
$existing_users=array(''.$row['username'].',');
}
i know i am doing something worng