I have an array of arrays with objects and now want to get all objects for a certain date (which is an object property).
what's the best way to query it?
Hi,
I'm a beginner in java. I want the logic of the small program.
I have two arrays
array = {a1,a2,a3,a4,a5,,,,,,,,,an}
and
array2 = {b1,b2,b3,b4,,,,,,,,,,,bn}
I want string as:
a1b1,a2a3b2b3,a4a5a6b4b5b6,..........an
Please tell me what will be the logic.
Can somebody demonstrate how to send an array of bytes over a TCP connection from a sender program to a receiver program in Java. (I'm new to Java programming, and can't seem to find an example of how to do this that shows both ends of the connection (sender and receiver.) If you know of an existing example, maybe you could post the link. (No need to reinvent the wheel.) P.S. This is NOT homework! :-)
I have a books app with a UISearchBar, where the user types any book name and gets search results (from ext API call) below as he types.
I am using a singleton variable in my app called retrievedArray which stores all the books.
@interface Shared : NSObject {
NSMutableArray *books;
}
@property (nonatomic, retain) NSMutableArray *books;
+ (id)sharedManager;
@end
This is accessed in multiple .m files using NSMutableArray *retrievedArray; ...in the header file
retrievedArray = [[Shared sharedManager] books];
My question is how do I ensure that the values inside retrievedArray remain synchronized across all the classes.
Actually the values inside retrievedArray gets added through an NSXMLParser (i.e. through external web service API). There is a separate XMLParser.m file, where I do all the parsing and fill the array. The parsing is done on a separate thread.
- (void) run: (id) param {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL: [self URL]];
[parser setDelegate: self];
[parser parse];
[parser release];
NSString *tmpURLStr = [[self URL]absoluteString];
NSRange range_srch_book = [tmpURLStr rangeOfString:@"v1/books"];
if (range_srch_book.location != NSNotFound)
[delegate performSelectorOnMainThread:@selector(parseDidComplete_srch_book) withObject:nil waitUntilDone:YES];
[pool release];
}
- (void) parseXMLFile: (NSURL *) url
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[self setURL: url];
NSThread* myThread = [[NSThread alloc] initWithTarget:self
selector:@selector(run:)
object: nil];
[retrievedArray removeAllObjects];
[myThread start];
[pool release];
}
There seems to be some synchronization issues if the user types very quickly (It seems to be working fine if the user types slowly)....So there are 2 views in which the content of an object in this shared array item is displayed; List and Detail.
If user types fast and clicks on A in List view, he is shown B in detail view...That is the main issue.
I have tried literally all the solutions I could think of, but am still unable to fix the issue.
Please suggest some suitable fixes.
I used JQuery.serializeArray() on a form to create an array of objects on a GreaseMonkey application:
[
{
name: a
value: 1
},
{
name: b
value: 2
},
{
name: c
value: 3
},
{
name: d
value: 4
},
{
name: e
value: 5
}
]
I need to use GM_xmlhttpRequest to serve these fields back to a server side application. What is the best way to return these fields?
Thanks in advance,
D
I'm getting the following error in my ASP.net web page:
Invalid length for a Base-64 char array.
This happens when a user activates an ajax request before the previous request completes. How can I prevent this error fro occurring?
I have a PHP array of strings: ie: "Big green car parked outside"..etc
I would like to perform boolean search operations on these strings, similar to MySQL fulltext searching , or Sphinx Searching.
For example, I would like to find all strings containing word "green" but not "car"
Does anyone know of any existing PHP classes or libraries which would help me accomplish this ? Or can anyone suggest any google terms I could search for ?
Thank you in advance!
hi there, are there any way to create an object form any class inside a numpy array?¿. Something like:
a = zeros(4)
for i in range(4):
a[i]=Register()
Thanks
Intention is to take a current line which contains commas, store trimmed values of all space and store the line into the array.
Why does this not work?
String[] currentLineArray = currentInputLine.replace("\\s", "").split(",");
I've looked around for a good example of this, but I haven't run into one yet. I want to pass a custom string array from java to oracle and back, using the IBATIS framework. Does anyone have a good link to an example? I'm calling stored procs from IBATIS.
Thanks
print_r($pages);
print max($pages);
print min($pages);
shows me
Array ( [0] => 1 [1] => 2 [2] => 3 ) 1 2
While I was expecting the last two numbers to be 3 and 1. How come?
Is following array initialization correct? I guess it is, but i'm not really sure if i can use const char* or if i better should use std::string. Beside the first question, do the char pointers point to memory segments of same sizes?
struct qinfo
{
const char* name;
int nr;
};
qinfo queues[] = {
{"QALARM", 1},
{"QTESTLONGNAME", 2},
{"QTEST2", 3},
{"QIEC", 4}
};
Hi all,
looks like a memory leak when i try to initializing an array of pointers, this my code:
void initLabelTable(){
register int i;
hashNode** hp;
labelHashTable = (hashNode**) malloc(HASHSIZE*sizeof(hashNode*));
hp = labelHashTable;
for(i=0; i<HASHSIZE; i++) {
*(hp+i) = NULL;
}
}
any idea?
Hi friends,
Yet I use Soft Keyboard sample from http://developer.android.com/resources/samples/SoftKeyboard/index.html
Here we uses ASCII value from XML ,now at the place of XML I want to generate these value using array.
How can I do this
Thanks in Advance
What's the simplest way of printing an array of primitives or of objects in Java? Here are some example inputs and outputs:
int[] intArray = new int[] {1, 2, 3, 4, 5};
//output: [1, 2, 3, 4, 5]
String[] strArray = new String[] {"John", "Mary", "Bob"};
//output: [John, Mary, Bob]
Given an array of size n, which contains numbers in the range 1 to n, and in which each number is present at least once, but some numbers may be missing, how can I find the missing numbers?
I have the following array:
procs=(
'one a b c'
'two d e f'
'three g h i'
)
I try run these processes from a loop (using echo instead of eval so I can debug):
for proc in ${procs[@]}
do
echo $proc
done
I get:
one
a
b
c
two
d
e
f
three
g
h
i
I wanted:
one a b c
two d e f
three g h i
What went wrong?
Hi,
I'm wondering if someone knows how to store an array into a user session?
This is the method to store a single attribute:
$this->getUser()->setAttribute('something', $something);
And the documentation says:
"User attributes can store any type of data (strings, arrays, and associative arrays)"
... but doesn't say anything more. The API documentation doesn't have a "SetAttributes" or something similarly obvious.
Thank you.
We have to write the nodes of a binary tree to a file. What is the most space efficient way of writing a binary tree . We can store it in array format with parent in position 'i' and its childs in 2i,2i+1. But this will waste lot of space in case of sparse binary trees.
HI,
I have a string:
NEW ALPINESTAR?S SMX PLUS WHITE
MOTORCYCLE BOOTS! 44/9.5$349.95 Time
Left 1h 2m NEW AGV BLADE FLAT MATTE
WHITE LARGE/LG HELMET$75.53Time Left
1h 2m
I want result in array like this:
Productname
Price time NEW ALPINESTAR?S SMX
PLUS WHITE MOTORCYCLE BOOTS! 44/9.5
$349.95 Time Left 1h 2m
I know I can do
for (id obj in array)
{
if ([obj isKindOfClass:[Elephant class]])
[elephants addObject:obj];
}
but I feel there must be a more elegant way of doing this. I've looked at filtering arrays but can't come up with a good predicate. Thoughts?
Hi -
I'm getting JSON-encoded output from another organization's API.
In many cases, the output can be either an array of objects (if there are many) or an object (if there's just one). Right now I'm writing tortured code like this:
if ( is_array($json['candidateList']['candidate'][0]) ) {
foreach ($json['candidateList']['candidate'] as $candidate) {
// do something to each object
}
}
else {
// do something to the single object
}
How can I handle it so the "do something" part of my code only appears once and uses a standard syntax?
Hi,
Just wondering if it's possible to pass a global javascript array value into a html tag, specifically inside a img (title) tag?
Basically want to know if I can do this:
<img src="_info.gif" height="26" width="37" title=myArray[5]/>
If so, how and if not, can people possibly provide other suggestions.
Thanks