I was under the impression that std::tr1::array was the same as the boost::array in that it would throw an exception when accessing an index out of bounds. In fact, I took a peek in the header and it appears that way as well. Could someone explain why the following code results in a bus error (gcc version 4.0.1 (Apple Inc. build 5465)) ...
Hello.
I have a multidimensional array with strings as keys. I want to perform a function (to manipulate the strings) on those keys and then write to a new array (i.e. leave the original array unchanged).
Example:
$oldArr = array(
"foo_old" => array("moo_old" => 1234, "woo_old" => 5678);
"bar_old" => array("car_old" => 4321...
Let's say I have a function like:
void myFunc(List<AClass> theList)
{
string[] stuff = new string[theList.Count];
}
and I pass in an empty list.
Will stuff be a null pointer? Or will it be a pointer to some random place in memory that is uninitialized?
...
I've created a short demonstration of the problem I'm having. This isn't exactly how I'm implementing it but seems to lead to the same result.
<?php
class mainclass {
var $vardata = array();
function &__get ($var) {
if ($this->vardata[$var]) return $this->vardata[$var];
if ($var == 'foo') return $this->_loadFo...
I am new to MATLAB, and I can't fathom this from the documentation.
function GotData(sender, args)
interval = args.DataBlock.TimeIntervalInMicroseconds;
doubles = args.DataBlock.AsDoubleArray();
x = 0;
complexCount = length(double(doubles))/2;
DATA = zeros(complexCount);
for index = 1:(complexCount-1)
rea...
Hi All,
Apologies if this is a simple question but googling hasn't been able to help me.
I am planning to display 3 arrays of data in a Table View that has each array in a different section in the Table View.
Can any one provide me with a link to a good tutorial or sample code that could help me with this?
Once again I apologize if th...
Consider the following code.
public interface IFoo { }
public class Bar
{
public Bar(IFoo[] foos) { }
}
public class MyModule : NinjectModule
{
public override void Load()
{
Bind<IFoo[]>().ToConstant(new IFoo[0]);
// ToConstant() is just an example
}
}
public class Program
{
private static void ...
ArrayIterator is handy (although I don't need the reset functionality), but like the rest of the Commons Collections stuff, it doesn't use generics. I checked Google Collections, but I didn't see a close equivalent. Did I miss it? Is there another library of similar reputation and quality as the first two that provides such a thing? Than...
I need to return a unsigned int* from a function. The code below will compile but will crash at run time on a Windows 64 bit machine. I know I am making a silly mistake somewhere and can someone point it out for me. :p. I also have declared the function in my header, so I know its not that error.
Please note I have censored the variable...
First, apologies,this should be simple but I've had too much coffee and cannot wrap my tired brain around this (at least not without making it way more complicated than I know it should be).
Lets say I have a simple Javascript array with a number of items in it:
var items = ["Hello", "This", "is", "an", "array", "with",
"...
Hi!
I have two dropdownlist in one view but i don't know if i can load the view passing the two arrays like this:
$this->load->view('primerPaso',$data,$data2);
To be more specific i'm doing everything like this:
Model
/*
* Método encargado de consultar las ciudades
* donde existen agencias.
*/
function ConsultarCiudadesAgencias()...
Suppose we have the Java code:
Object arr = Array.newInstance(Array.class, 5);
Would that run? As a further note, what if we were to try something like this:
Object arr1 = Array.newInstance(Array.class, 2);
Object arr2 = Array.newInstance(String.class, 4);
Object arr3 = Array.newInstance(String.class, 4);
Array.set(arr1, 0, arr2);
Ar...
I am not sure if this is Java behaviour or rogue GWT behaviour. But here goes.
I have a class for 2D vectors, called Vector2. In my program I do some simulation of 2D particles represented by instances of this class. I have two arrays of Vector2, m_x and m_oldx that are members of another class, with a function that does some processing...
Consider the following array:
$main_array = array();
$main_array[0] = array('location'=> array('France', 'Germany'), 'random_number'=> array('6520'));
$main_array[1] = array('location'=> array('Italy', 'Switzerland'), 'random_number'=> array('3245'));
$main_array[2] = array('location'=> array('Portugal', 'Spain'), 'random_number'=> arra...
I've got a design decision to make and am looking for some best practice advice. I have a java program which needs to store a large number (few hundred a day) of floating point arrays in a MySQL database. The data is a fixed length Double array of length 300. I can see three reasonable options:
Store the data as a BLOB.
Serialize th...
I am trying to allocate a block of memory, and store a list of structures without using multiple mallocs for each... this is just a generic example, I don't have the original code I was working with earlier, but this is the general idea, but my problem was that I was getting heap corruption when other parts of my code executed after the ...
what I am trying to do is represented in my other question with code.
Basically I need to keep in memory a table of elements (structs), there's no fixed number of elements that can exist, but it is small, but I still can't use an array.
And I don't want to use a linked list of elements because I don't want to keep adding and deletin...
Hi guys, I need to get all of the users in my user table and then get the results as an array and traverse through it and create a XML file for each user.
How would I go about doing that?
I am guessing the query would be something like SELECT * FROM users but I am unsure as to how I can get all the results as an array and then how to t...
I want to know whether the array $arr has duplicate elements.
...
I have an array in javascript that contains the following:
["Value 1", "Value 5". "Value 10", "Value 11"];
How would I go about sort this array so that it does not appear as follows:
["Value 1", "Value 10". "Value 11", "Value 5"];
But as:
["Value 1", "Value 5". "Value 10", "Value 11"];
Any help would be great.
...