arrays

MATLAB class array

What would be the best way to manage large number of instances of the same class in MATLAB? Using the naive way produces absymal results: classdef Request properties num=7; end methods function f=foo(this) f = this.num + 4; end end end >> a=[]; >> tic,for i=1:1000 a=[a Request];en...

Reverse Method for an Array of int

I have this as Main int[] M ={ 10, 2, 30, 4, 50, 6, 7, 80 }; MyMath.Reverse(M); for (int i = 0; i < M.Length; i++) Console.WriteLine(M[i].ToString() + ", "); After I created the class MyMath I made the Reverse method public int Reverse(Array M) { int len = M.Length; for (int i = 0; i < len / 2; i++) { ...

Is it better to use tables instead of arrays field type in PostgreSql when arrays do not exceed 50 elements?

Or better said: When to use array as a field data type in a table? Which solution provides better search results? ...

Remove empty elements from an array in Javascript

How do I remove empty elements from an array in Javascript? Is there a straightforward way, or do I need to loop through it and remove them manually? Thanks ...

How to scan in two arrays from user??

I'm relatively new to programming and I have to write a function that reads in input from the user and to fill two arrays then compare them. I guess what I'm confused on is how to read in both arrays. This is what I'm supposed to do, Write a table_diff fuction that compares two arrays of integers and returns the subscript of the first ...

Using loops to create arrays

I am extremely new at php and I was wondering if someone could help me use either a for or while loop to create an array 10 elements in length ...

What is best way to implement variable length arrays?

I want to store a large result set from database in memory. Every record has variable length and access time must be as fast as arrays. What is the best way to implement this? I was thinking of keeping offsets in a separate table and storing all of the records consecutively? Is it odd? (Programming Language: Delphi) ...

C++ Arrays: conversion of contained type

What is the best way to convert a fixed length string array to a fixed lengh integer array in C++ ? ...

duplicate tags in nusoap

I'm using nusoap to connect to a soap webservice. The xml that the class sends to the service is constructed from an array, ie: $params = array("param1" => "value1", "param2" => "value1"); $client->call('HelloWorld', $params, 'namespace', 'SOAPAction'); This works fine. A multidimensional array also constructs a nice nested xml messag...

How do you declare arrays in a c++ header?

This is related to some other questions, such as: this, and some of my other questions. In this question, and others, we see we can declare and initialise string arrays in one nice step, for example: const char* const list[] = {"zip", "zam", "bam"}; //from other question This can be done in the implementation of a function with no bo...

How do I find the length of an associative array in ActionScript 3.0?

Is there a simple way to retrieve the length of an associative array (implemented as an Object) in ActionScript 3.0? I understand that there are two primary ways of creating associative arrays in AS3: Use a Dictionary object; especially handy when the key does not need to be a string Use an Object, and simply create properties for eac...

JAVA: Reading a file into an array

I have a file (called "number.txt") which I want to read to an array in Java. How exactly do I go ahead and do this? It is a straight-forward "1-dimensional" file, containing 100 numbers. The problem is that I get an exception every time. Apparently it can't find it (I am sure its spelled correctly). When looking through code examples, ...

How can I see if an element in an int array is empty?

example: I want to see if array[5] holds a value or is empty. ...

Way to define List<> of two elements string array?

I want to build two-dimentional array of strings where length of one dimention is 2. Similar to this string[,] array = new string[,] { {"a", "b"}, {"c", "d"}, {"e", "f"}, {"g", "h"} } Doing List<string[]> list = new List<string[]>(); list.Add(new string[2] {"a", "b"}); list.Add(new string[2] {"c", "d"}); list.Add(new...

How to declare an array inline in VB.NET

I am looking for the VB.NET equivalent of var strings = new string[] {"abc", "def", "ghi"}; ...

Stringing an Array in Php

Does anyone know how to string a group of arrays into a single variable? I am trying to covert the a date format into another format, but i need to string to the arrays. $datetochange="2008-11-5"; $date_parts=explode("-", $datetochange); //Displays 2008 print $date_parts[0]; //Displays 11 print $date_parts[1]; //Displays 5 print $da...

Array of zero length

I am working on refactoring some old code and have found few structs containing zero length arrays (below). Warnings depressed by pragma, of course, but I've failed to create by "new" structures containing such structures (error 2233). Array 'byData' used as pointer, but why not to use pointer instead? or array of length 1? And of course...

Regex match question

In javascript, I've got a block of HTML like this: <h2>{title}</h2> <p><a href="{url}">{content}</a></p> And I'm trying use regex "match" to spit out an array of all the {item}'s. So my output should look like: ['title', 'url', 'content'] I've gotten as far as: var pattern = new RegExp("\{[a-zA-Z]+\}+"); var match = pattern.exec("...

How do you output contents of an array as a comma separated string?

I would like to convert an array if IDs, into a string of comma separated values, to use in a MySQL UPDATE query. How would I do this? ...

In what situations is the ATL CSimpleArray a better choice than CAtlArray

The documentation says that CSimpleArray is for dealing with small numbers of objects. What is small in this context? Is CSimpleArray ever a good choice or should I always use a different collection class such as CAtlArray? ...