Hi all,
I'm trying to implement a ring buffer with the following struct
/*head, tail are indexes of the head and tail of ring buffer
*count is the number of elements; size is the max size of buffer
*rbArray is an array to pointer of char used to store strings
*/
struct rb{
int head;
int tail;
int count;
int size;
char...
It's been a long time since I worked with C++, but I have a class that uses 3-dimensional data and I can't figure out how I can make this work. I need the sizes of the dimensions to be defined in the constructor. I tried this in the header:
class CImage
{
public:
float values[][][];
...
}
and this in the constructor:
CImage::CIma...
Question: How to shorten this array creation ?
I need to create an array of type ReportingService2005_WebService.Property with one property.
Something like:
Dim PropertyArray() as new ReportingService2005_WebService.Property(1)
I have to do this:
Dim PropertyArray As ReportingService2005_WebService.Property() = New Reportin...
Often, I will have an array holding a set of values each of which I need to process. Sometimes, the array will only hold a single set, in which case each value needs to be put through the process. Other times, the array will hold many sets, in which case each value will be an array and each value of those arrays will need to be processed...
I want to initialize a two-dimensional array of variable size to zero.
I know it can be done for a fixed-sized array:
int myarray[10][10] = {0};
but it is not working if I do this:
int i = 10;
int j = 10;
int myarray[i][j] = {0};
Is there a one-line way of doing this or do I have to loop over each member of the array?
Thanks
...
Hi all,
I am really struggling on this. I have an XML feed:
<?xml version="1.0" encoding="ISO-8859-1"?>
<data>
<date>
<name>27/9/10</name>
<event>
<title>Event 1</title>
<more>Copy in here</more>
</event>
</date>
<date>
<name>04/10/10</name>
<event>
...
Let's say I have an array as follows:
$food['fruit'] = array('apples','oranges','bananas');
$food['veg'] = array('potatoes','onions','peppers');
$food['meat'] = array('bacon','beef','chicken');
How would I go about ordering it such that any given type of food would be brought to the top of the array and the rest of the order remains i...
Why does the following line
Object[] objects = new Object[10000000];
result in a lot of memory (~40M) being used by the JVM? Is there any way to know the internal working of the VM about arrays?
Manu
...
How to count array elements after the first occurrence of a given element?
For example
$a = array('a', 'c','xxd','ok','next1','next2');
echo occurences_after($a, 'ok');
should print "2"
...
I want to compare two arrays if an email address in array 1 exists in array 2 (here: [email protected]). In that case it should display that the email already exists.
$Array1 = Array
(
[0] => Array
(
[username] => uname1
[name] => fullname1
[email] => [email protected]
)
[1] => ...
What is the best way to accomplish this?
...
The weirdest thing is happening to me...
I have a form I'm sending via an ajax post (using jquery's serialize function) to a php script running this function (stripped down for clarity):
$arr = $_POST;
unset($arr['command']);
unset($arr['index']);
$vals = $arr;
$keys = $arr;
...
Ok, first of all, I originally programmed this csv parser in PHP. It is for a specialized kind of CSV file that we use internally. Anyway, I wanted to move it to C# to get some experience with the language. The only thing I can see that is different between the two (scripts?) is that I changed sqlarray from a 3-dimensional jagged arra...
Homework:
Consider the two-dimensional array A:
int A[][] = new int[200][200];
where A[0][0] is at location 500 in a paged memory system with pages of size 500 (a little unrealistic -- not 512). A small process that manipulates the matrix resides in page 0 (locations 0 to 499). Thus, every instruction fetch will be from an ins...
I asked a question not too long ago about multi-dimensional and jagged arrays in C#. Well, I was trying the List class instead and was running into a bit of a jam. What happens is only a few of the values in wtflist actually make it to the end of Main(). How can I make sure all of the data gets in (and stays in) wtflist?
Edit: Here ...
I'm working on an existing c project (spglib on sourceforge), and I'm running into the following problem after cleaning up some array initializations:
* glibc detected tests/spglibtest: free(): invalid next size (fast): 0x08ab46e0 **
The backtrace is:
#0 0xb7fe1424 in __kernel_vsyscall ()
#1 0xb5cfdd61 in raise () from /lib/libc.so...
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main (){
int a,b;
b = 0;
cout<<" this is a family profiling program to test my knowledge of structural arrays. ";
cin>> a;
struct p {
char name[20];
int age;
char hobby[40];
char favcolor[15];
};
p family[2];
**cin.getline(family.name[0]);**
cout<<"en...
I have a static large array-of-arrays, witch represents tree structure with about ~100k nodes, this array is only read-only reference for value lockups.
Now, witch of this methods will perform better?
First, simply array definition in pure PHP file, for including in requests
Second, serialize this array, gzip serialized output, and lo...
I have an array like this
$data = array(
"some => "163",
"rand" => "630",
"om" => "43",
"words" => "924",
"as" => "4",
"keys" => "54"
);
How can I get each set's key associated with their values like this:
foreach ($data as $stuff){
$this->$stuff["key"] = $stuff["value"];
}
...
How do I change the values of arrays from different classes?
i've array in one class called creation
all the array are global variable
import addClass;
public var first1:Array = new Array();
public var op:Array = new Array();
public var second:Array = new Array();
public var res:Array = ...