I'm working with a Ruby project for school, and have sadly not been able to find an answer to this question in my literature.
I have an array of camping lots, each containing a guest. I initialize the lots like this:
lots = Array.new
for i in (1..36)
lots[i] = Lot.new(i)
end
Further down I create a Guest object, initialize it, an...
I have this
var checkBox = e.target;
var tableRow = checkBox.parentNode.parentNode;
var key = tableRow.attributes["key"];
var aKey = key.nodeValue;
at this point aKey = "[123]"
what the best way to return 123 as an int in javascript? note that aKey could just as likely be "[5555555555555555555]" so I can't just grab c...
I came across this syntax while reading a script. I am not sure what is the use of square brackets.
push @data, [ split //, $line ]; #printing this array gives crap values
Or to put into other words what is the difference between the above and the following?
push @data, (split//, $line); #printing this gives actual values
Any sugg...
Hi,
I have a bidimensional Object array in Java.
Some indices aren´t nor used, because thei were skipped during array fill.
Array looks like:
Array[0][0]
Array[0][1]
Array[0][2]
Array[1][0]
Array[1][1]
Array[1][2]
Array[3][0]
Array[3][1]
Array[3][2]
The 2 is missing, how can i rebuild the indices to make the array "correct"?
...
The output of eg >>w = whos; returns an array of structs. I would like to construct an array whose elements are the scalars from a particular field name in each struct.
The most obvious way of doing this doesn't return an array as I want, but each answer separately.
>> w(1:2).bytes
ans =
64
ans =
128
I could do it with a loop...
I need to split my string input into an array at the commas.
How can I go about accomplishing this?
Input:
9,[email protected],8
...
I have an array in Javascript:
var array = new array();
array[0] = "apples";
array[1] = "oranges";
array[2] = "pears";
In PHP, with a given array, I can use the following to loop through an array, and break up the keys and values:
foreach ($array as $key => $value) {
echo("Key is $key and Value is $value");
}
How can I do this ...
how can i get [user_id] from this array?
Array
(
[2] => cbpaidSubscription Object
(
[replaces_plan] =>
[replaces_subscription] =>
[subscription_date] => 2009-07-14 12:45:52
[last_renewed_date] => 2009-07-14 12:45:52
[expiry_date] => 2010-07-14 12:45:52
...
In C++, I need to read in a string from user input and place it into a char array [done]
Then, I need to pass that array to a function [done]
That function is supposed to reverse the order of characters [problem!]
Then after, back in the main(), it displays that original array with the newly reversed characters.
I'm having trouble cr...
I can't get the code below to compile (see errors). Advice on correction would be appreciated.
#include <stdio.h>
typedef struct {
char *fldName;
unsigned fldLen;
} Field;
typedef struct {
char *fldPrompt;
unsigned startRow;
unsigned startCol;
} Prompt;
typedef struct {
Field *fields[];
Prompt *prompts[];
uns...
What are the pros and contras of using a Vector.<> instead of array?
...
In .net, does a bool[] use one bit or one byte per array item? ie, does it automatically pack the bool values? I know a single bool uses 1 byte, but maybe the CLR has a special case for bool[]...
...
Let's say I have a List<NameValuePair>, where NameValuePair is a simple object that has a Name property and a Value property, both strings.
The list is populated with values like this:
name = "name1", value = "value1"
name = "name1", value = "value2"
name = "name2", value = "value3"
name = "name3", value = "value4"
Note that there ar...
I need to send to c# a array of objects from Flex. Anybody know how do I do this?
Sorry for my English, I am Brazilian.
Thank´s
Sidnei Cachate.
...
I want to upcast object array to different array of different object type like below
object[] objects; // assuming that it is non-empty
CLassA[] newObjects = objects as ClassA[]; // assuming that object to ClassA is valid upcasting
is there any way other than upcasting each element individually?
...
Are there any concurrency problems with one thread reading from one index of an array, while another thread writes to another index of the array, as long as the indices are different?
e.g. (this example not necessarily recommended for real use, only to illustrate my point)
class Test1
{
static final private int N = 4096;
fi...
I'm programming an application in VB.NET in which I need to take the Items from a ListBox, which are an ListBox.ObjectCollection and convert into a String array to be passed as a parameter to a Sub procedure.
How should I do it?
...
I have a output file which is a two dimensional array (this file was output generated after running script written to produce 2D array) and I have to read information under a particular column, say column 1. In other words, how do I read and print out information listed, corresponding to all the rows, under column 1.
Any suggestions?
_...
If I have int x[10] and int *y, how can I tell the difference between the two?
I have two ideas:
sizeof() is different.
&x has different type --- int (*p)[10] = &x works but not int **q
= &x.
Any others?
In some template library code, I need to determine whether a pointer is a "real" pointer or degenerated from an array...
Hi,
I'm trying to create a recursive function (or method) that stores a sub-tiered navigation in an array variable or object. Here is what I have:
class Navigation extends Database
{
function build($parent_id = 0)
{
$query = 'SELECT id, name, href, parent_id
FROM navigation
WHERE parent_id = '.$parent_id.'
...