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'm trying to use an if statement to work out which of 2 strings comes first alphabetically. Like with numbers and greater and less than:
if (1 < 2) {
just with strings:
if(@"ahello" < @"bhello") {
Or would I have to have a string containing all the letters and then check the index of the first char in each string and see which index is greater, and the index that is less than the other comes first in the alphabet and then if they are equal move on to the next char and repeat?
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 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'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 am using protobuf-net to serialize and deserialize my messages. My message also contain come strings that can be null. However when I deserialize them on the other side, I get empty strings ("").
According to google docs, the default value for string type in empty string.
What could be the resolution for this issue?
hello.. is there any way to replace titles faster then str_replace function? I've got a file that 2000 lines of array changes. that hurts my webpage thanks.
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
Hi,
How can i copy a substring from a given string with start and end index or giving the start index and length of the string are given.
Thanks,
iSight
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 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 wonder how to specify to the command find for searching files with names matching some string or some other string.
For example, if I want to look for files that match either *dat or *txt under current directory, how to specify?
Thanks and regards!
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
Lets assume myProp is @property (retain) NSString * myProp and synthesized for us....
self.myProp = @"some value";//string literal?
self.myProp = [NSString stringWithString:@"some value"];
Is there a difference here?
Is the first one a string literal that doesnt get autoreleased or is it just in memory for it's current scope and I dont have to worry about it?
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?
I have a List defined like this :
public List<string> AttachmentURLS;
I am adding items to the list like this:
instruction.AttachmentURLS = curItem.Attributes["ows_Attachments"].Value.Split(';').ToList().Where(Attachment => !String.IsNullOrEmpty(Attachment));
But I am getting this error: Cannot implicitly convert IEnumerable to List
What am I doing wrong?
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?
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'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
OK so, is there an efficient way to detect on what array you're currently on by using the KeyListener?
My code: http://www.javadan.pastebin.com/X68VyuGL
What I am trying to do here is see if the current tile I am on is BLOCKED.
Thanks.
What is the smartest way of searching through an array of strings for a matching string in Perl?
One caveat, I would like the search to be case-insensitive
so "aAa" would be in ("aaa","bbb")
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
On login:
$result = mysql_query("SELECT `id`, `username`, `email` FROM `users`
WHERE `username` = '$username'
AND `password` = '$passwd'");
$userdata = array('id','username','email');
$_SESSION['user'] = mysql_result($result, 0, $userdata);
And when i want to print the users username
echo $_SESSION['user']['username']
it only prints the first letter :/
whats wrong`?