arrays

problems with operator new when allocating arrays

Hello! I'm having prblems with my C++/openGL program. at some point of code, like these(it's a constructor): MyObject(MyMesh * m, MyTexture* t, float *c=NULL, float *sr=NULL, int sh=100){ texture=t; mesh=m; subObjects=NULL; texCoords=NULL; if (texture!=NULL){ texCoords=new float[mesh->numSurfacePoints*2]; the new throws an std::bad...

LINQ: Entity string field contains any of an array of strings

I want to get a collection of Product entities where the product.Description property contains any of the words in a string array. It would look something like this (result would be any product which had the word "mustard OR "pickles" OR "relish" in the Description text): Dim products As List(Of ProductEntity) = New ProductRepository(...

MATLAB: Determine total length/size of a structure array with fields as structure arrays

I have a structure array containing fields as structure arrays of varying length. For example: 's' is a structure 'data' is a field in 's', and also a structure array itself and length(s(n).data) ~= length(s(m).data) I want to preallocate an array that takes a time stamp from every field s.data.timestamp. Is there a way to do this wi...

C++ boost shared array swapping pointers (simple question)

Hi all, I'm new to boost shared arrays. There is existing code that declares two arrays: boost::shared_array<unsigned char> src; boost::shared_array<unsigned char> dest; All I want to do is swap what each array is pointing to (src becomes dest, and dest becomes src). As I understand it, the shared_array.get() method returns a poin...

php array parent array position

Hello, Is there a way to get the the current position of an array from within a nested array ? I have a php script that has a for loop which cycles through an array, with in this is an nested loop which cycle through a sub array. I can use pos() to get the position of the child array, is there anyway of getting the current position of...

Using jQuery inArray with array of JavaScript Objects

Hello all, I'm working with an array of JavaScript Objects as such: var IssuesArray = [{"ID" : "1", "Name" : "Issue1"}, {"ID" : "2", "Name" : "Issue2"}, {"ID" : "3", "Name" : "Issue3"}]; My end effort is trying to remove an object from the array when I know the ID of the object. I'm trying to u...

Linq with array

Dim Cozinhas as string = "1, 2, 3" Dim FiltroCozinha() As String = Cozinhas.Split(",") Dim Empresas = (From E In lstEmpresas _ Group Join CE In lstCozinhasEmpresas On CE.EmpresaID Equals E.EmpresaID Into CEJ = Group From CE In CEJ.DefaultIfEmpty() _ Group Join FC In lstFiltroCozinha On FC Equals CE.Cozinh...

jquery json multidimensional array lengths

I'm using a jQuery ajax json call to retrieve a 3 dimensional PHP array into Javascript. the PHP array looks like this: $rate[0][1]['name'] = 'guff'; $rate[0][1]['value'] = 'puff'; $rate[0][2]['name'] = 'guff'; $rate[0][2]['value'] = 'puff'; $rate[0][3]['name'] = 'guff'; $rate[0][3]['value'] = 'puff'; $rate[...

Graph Adjacency List How to implement O(1) lookup for nodes/vertexes. Array?

I read in the specifications for graphs implemented with Adjacency List that adding edges is done in constant time. BUT that would require a node lookup with O(1). I would like best possible performance. The question here is which datatype would would give me that. Hashmap has been considered, worst case with hashmap is still O(n). Cou...

How to merge duplicates in 2D python arrays

Hi, I have a set of data similar to this: No Start Time End Time CallType Info 1 13:14:37.236 13:14:53.700 Ping1 RTT(Avr):160ms 2 13:14:58.955 13:15:29.984 Ping2 RTT(Avr):40ms 3 13:19:12.754 13:19:14.757 Ping3_1 RTT(Avr):620ms 3 13:19:12.754 Ping3_2 RTT(Avr):210ms 4 13:14:58.955 13:15:29.984 Ping4 RTT(Avr):360ms 5 13:19:1...

Testing if the element is an array, in Javascript

To check if an element is an array in JavaScript, I have always used Crockford's function (pg 61 of The Good Parts): var is_array = function (value) { return value && typeof value === 'object' && typeof value.length === 'number' && typeof value.splice === 'function' && !(value.propertyIsEnumerable('le...

Parse CSV string into Array of Integers

I have a text box field inputs 123,145,125 I to separate this field into an array of integers. And validate this field true or false if everything is parsed right. CODE: private bool chkID(out int[] val) { char[] delimiters = new char[] { ',' }; string[] strSplit = iconeID.Text.Split(delimiters); int[] intArr = null;...

passing array of structs from c# to regular dll

Hi there I have a regular dll with the followign fucntion exported. extern "C" __declspec(dllexport) int FindNearestStuff(double _latitude, double _longitude , LocationStruct * locations[]) LocationStruct is very simple struct LocationStruct { long positionIndex; long item; }; I'm tryign to call it from c# using [DllIm...

post array jquery serialize

I am trying to post a javascript array to a php page. The array has to be associative. My structure looks like this: <input id="test" value="1" class="settings" /> <input id="test1" value="2" class="settings" /> When I create the array it is: var myArray = new Array(); $(".setttings").each(function(){ myArray[$(this).attr("id")...

C++, Can't use an array or vectors, how do I use a pointer to get through this mess?

I need help with pointers and memory management. I need to store different objects, all derived from the same base class, and have been using an array to do this but it is causing a segmentation fault when the array is populated with different objects. My program works fine when the array is full of objects of the same derived type. ...

Update Array field in progress DB using ODBC

Dear All: I access the progress DB using ODBC in my C# program, and I need to update some fields,which are array data type. so how can I write my sql statement to do such things? I read some progress documentations,in which some methods were mentioned as bellow: update pub.sometable set arrayfield='X;X;X;X;X;X' where condition.... but ...

PHP - Getting limited chunks of a large array from MySQL table

Let's say you've got a table like this: ID Cat1 Cat2 1 a red 2 b red 3 c blue 4 d blue 5 e blue 6 f green etc etc etc The goal is to display the ID and Cat1 (unique pairs), split into groups according to Cat2. The easy way out is to run a separate MySQL query for each Cat2, but with a lot...

javascript object arrays

Can we create a class with getters and setters and an array of objects of this class using javascript? ...

How to get the length of longest string in an array

Say I have this array: $array[] = 'foo'; $array[] = 'apple'; $array[] = '1234567890; I want to get the length of the longest string in this array. In this case the longest string is 1234567890 and its length is 10. Is this possible without looping through the array and checking each element? ...

bad_alloc exception when trying to print the values

I've debugged my other problem back, to the MyMesh constructor. In this code: if (hollow) { numTriangles = n*8; triangles=new MyTriangle[numTriangles]; if (smooth) numSurfacePoints=n*8; else numSurfacePoints=n*12; surfacePoints=new SurfacePoint[numSurfacePoints]; }else { numTriangles = n*4; triangles=new MyTr...