arrays

Bash combine two arrays

I have the following situation, two arrays, let's call them A( 0 1 ) and B ( 1 2 ), i need to combine them in a new array C ( 0:1 0:2 1:1 1:2 ), the latest bit i've come up with is this loop: for ((z = 0; z <= ${#A[@]}; z++)) do for ((y = 0; y <= ${#B[@]}; y++)) do C[$y + $z]="$...

Jquery json parsing for select

Hallo, I have this json: { "ROWCOUNT":5, "COLUMNS":["ID","REGIONE"], "DATA":{ "ID":[1,2,4,3,5], "REGIONE":["Abruzzo","Campania","Emilia","Molise","Toscana"] } I want retrieve value from ID and REGIONE with jquery, to fill a select. I have tried this one: for(var COLUMNS in data) { jQuery.each(data[COLUMNS], ...

How does C# 3.0 jagged array performance optimization vs. rectangular arrays work ?

Hi, In the Apress book "Illustrated C# 2008", pg. 343 notes: "One-dimensional arrays have specific instructions in the CIL that allow them to be optimized for performance. Rectangular arrays do not have these instructions...Because of this, it can sometimes be more efficient to use jagged arrays..." Does anyone know how these pe...

An array of array of bytes (vb.net)

I need an array and each item in the array is an array of bytes like this , but I'm not sure how to do the : Dim xx as array xx(0) *as byte* = {&H12, &HFF} xx(1) *as byte* = {&H45, &HFE} ...

Python: print the full array

When I print an array i get the following stuff, but I want the full array. Is there any way to do this? Thanks in advance, and everybody a happy, lucky, successfull new year! [[0 0 0 ..., 0 0 0] [0 0 0 ..., 0 0 0] [0 0 0 ..., 0 0 0] ..., [0 0 0 ..., 0 0 0] [0 0 0 ..., 0 0 0] [0 0 0 ..., 0 0 0]] ...

PHP: Use associative arrays with preg_replace()

In the documentation for preg_replace is says you can use indexed arrays to replace multiple strings. I would like to do this with associative arrays, but it seems to not work. Does anyone know if this indeed does not work? ...

Array .push() if does not exist?

How can i push up into an array if neither values exist? Here is my json array/object: [ { name: "tom", text: "tasty" }, { name: "tom", text: "tasty" }, { name: "tom", text: "tasty" }, { name: "tom", text: "tasty" }, { name: "tom", text: "tasty" } ] If i tried to push again into the array with either name: "tom" or...

Best way convert text with '&' into the variables

I've got a this text "?foo=bar&foobar=barfoo" what is the best way to convert this text to variable? Like this: <?php echo $q['foo']; //bar echo $q['foobar']; //barfoo ?> Thanks. Sorry for my English. ...

Java: How to create an array of objects which include arrays?

Hi, I would like to create a list objects called Product (Listproducts) where Product includes the following members: public class Product { private Double price; private String title; private String description; private List<Point>points; ... } Point is another object which includes latitude and longitude: public class Point{ Doub...

Get Items Feeds4J Java Array

Im from php, so i want to lear java. In php in a for loop if i want to create an array i just do $items = $this->getItems(); for($i=0;$i<count($items);$i++) { $myarrayitems[$i] = $items[$i]; } return $myarrayitems; But in java i got arrayoutofexponsion or like that. here is the code im trying public String[] getItems(String url)...

My own OCR-program in Python

Hello everybody! I am still a beginner but I want to write a character-recognition-program. This program isn't ready yet. And I edited a lot, therefor the comments may not match exactly. I will use the 8-connectivity for the connected component labeling. from PIL import Image import numpy as np im = Image.open("D:\\Python26\\PYTHON-PRO...

getting items from a SimpleXMLElement object

From what I can tell, a SimpleXMLElement is just an array of other SimpleXMLElements, plus some regular array values if there wasn't a tag nested in another tag. I have a SimpleXMLElement in a variable $data, and var_dump($data) gives me this: object(SimpleXMLElement)#1 (33) { ["buyer-accepts-marketing"]=> string(4) "true" ... ... ...

getting certain bytes from byte array in vb.net

I have a byte array containing bytes from a file(see my last question) now I want to get the second lot of 4 bytes from the array and convert them to an integer something like bytearray.get(4[start],4[length]) ...

getting 4 bytes from a byte array vb.net

I have a byte array and I need to get 4 bytes from it at a certain location(16) but I don't want to convert it to a integer or anything just keep it as 4 bytes to store in a variable. (I am sorry if this is too similar to my last question) ...

Bash insert a comma (,) after every third field of a variable or array?

I have a variable with the following contents: "a b c d e f g h i j k l", how would you go about adding a comma sign (,) after each third member so it looks like this: "a b c, d e f, g h i, j k l". Initially all my variable data is stored in an array so if anyone knows how to directly manipulate the array, it would be great. Thanks in ...

searching classes in an array

I have an array (Items) which holds lots of instances of a class (Item). Item has 2 properties, a Group and an ID. there may be more than Item in the array(Items) that have the same Group and ID properties. How do I "search"/get the first Item which matches a specified Group and/or ID Something like: Item.getbygroup([group]) which re...

not able to add to array (need to use new keyword) in vb.net

I have a property which is an array of items but when I come to add an item to the array it says I must use the new keyword, but I can't use a new keyboard with a property. (item is a custom class) Private itemsvalue As item() Public Property Items() As item() Get Return itemsvalue End Get Set(ByVal value As DBPFind...

How do I reference a Perl hash in an array in a hash?

This is the code snippet I am working with: my %photo_details = ( 'black_cat' => ( ('size' => '1600x1200', 'position' => -25), ('size' => '1280x1024', 'position' => 25), ('size' => '800x600', 'position' => 0), ), 'race_car' => ( ('size' => '1600x1200', 'position' => 10), ('size' => '800x600', 'position' => 5), ),...

How to search an array key by matching a string in it's value

Hi, I'm trying to find the key number in a array matching a string. I tried array_search in this way $key = array_search("foo", $array); echo $array[$key]; but that prints $array[0] Is there another way to do this? Thanks :) ...

SQL:1999 Array Type Constructor Usage?

Can anyone confirm whether or not the SQL:1999 Array type Constructor provides any operations for searching the Array in a WHERE clause?. As an Example If a table EMPLOYEES had a column QUALIFICATION VARCHAR(20) ARRAY[10] containing values such as ARRAY['BSC','MBA'] Does the standard support some way of querying EMPLOYEES to find al...