arrays

How do I return one element from string_to_array() in PostgreSQL 8.4?

I want to parse a field with the following type of value: "DAVE EBERT CONSTRUCTION~139 LENNOX STREET~SANTA CRUZ, CA 95060~~Business Phone Number:(831) 818-3170" I would like to do a query like: Update mytable set street = string_to_array(myfield,'~')[2] But string_to_array does not "return" an array so it can't be chained in this wa...

ASP.NET StreamWriter - new line after x commas

Hey guys, I've got a JS array which is writing to a text file on the server using StreamWriter. This is the line that does it: sw.WriteLine(Request.Form["seatsArray"]); At the moment one line is being written out with the entire contents of the array on it. I want a new line to be written after every 5 commas. Example array: BN,ST,A...

How to get key values with foreach?

The Problem: Hi! I'm making a file upload form where I can upload photos, I added multiple="" to the input and for the name="upload_photo[]" so I'm able to upload multiple files. When I print $_FILES['upload_photo'] I get this and I want to get the values of each key with foreach. So for example I want to get just [name] what will be...

XML attributes to Array

Hello Everyone, I need to create a javascript array or object from an XML file that is structured as follows: <ITEMS> <TXT id="8" typ="1" pid="7" x="708" y="216" fcol="6777213" txt="sometext" hcmd="0" click="1"/> <TXT id="9" typ="1" pid="2" x="708" y="144" fcol="1231341" txt="some other text" hcmd="0" click="0"/> <GRAF id=...

Need to remove duplicates values from array during foreach

Hey All, Just wondering if you can help me out. I have a column with rows of tags. In each row i have each tag separated with a comma and space. for example: BMW M5, Leather Seats, 24 Inch Wheels, etc. What i need to do is loop through the array, explode it, and then print the values to the page. So far I have been able to do it; how...

I don't know why I'm getting an out of bounds exception!?

Hi I don't know why this is generating an ArrayOutOfBoundsException! It's likely I've overlooked something because I'm so tired but if someone could tell me what is wrong I'd appreciate it. Thanks. // array declaration public int CircleLeft[] = new int[mIPAWidth]; // this is my loop that generates the error: for(px = 0; px <= mIPAWidt...

How do I create a C# array using Reflection and only type info?

I can't figure out how to make this work: object x = new Int32[7]; Type t = x.GetType(); // now forget about x, and just use t from here. // attempt1 object y1 = Activator.CreateInstance(t); // fails with exception // attempt2 object y2 = Array.CreateInstance(t, 7); // creates an array of type Int32[][] ! wrong What's the secret ...

C++ Performance of structs used as a safe packaging of arrays

In C or C++, there is no checking of arrays for out of bounds. One way to work around this is to package it with a struct: struct array_of_foo{ int length; foo *arr; //array with variable length. }; Then, it can be initialized: array_of_foo *ar(int length){ array_of_foo *out = (array_of_foo*) malloc(sizeof(array_of_foo)); out...

javascript - map one array to a second array with a negative index offset

Alright, I'm taking an array, and making another array from it with the only difference being the indexes are displaced by an arbitrary number determined using two reference points (one in each array). Doing this creates negative indexes, which if it didn't stop the script from working, would be useful. Is there any way to have the sec...

JAVASCRIPT: Make array from regex

I have this string: {example1}{example2}{example3} This is the regular expression to find these { anything in it }: /\{.*?\}/g Now I want to know how put them in an array so I can do a FOR IN statement. EDIT I want an array something like array("{example1}","{example2}","{example3}"); ? ...

How to correctly write declarations of extern arrays (and double arrays) in C's header files?

Suppose I want to share a global array of data across my program, for example: int lookup_indexes[] = { -1, 1, 1, -1, 2, 1, 1, -2, 2, 2, -1, 1, 1, 2 }; What is the correct extern declaration for this array in the C header file? Also what about an array like this: int double_indexes[][5] = { { -1, 1, 1, -1, 1 }, { 2, -2, 2, 1, -1 } }...

how to declare an array of user defined type in vb6

Type ABFator a As Single b As Sinlge End Type Dim ABFactorArr(8) As ABFactor 'Basically i want to declare an array of 8 ABFactos which i can then access I do this and the complier gives error user defined type not defined Thanks ...

Unpacking array into separate variables in JavaScript

This is a simple problem, and I've done it before. I just can't remember how, or what exactly it was called. In python I can do this: arr = ['one', 'two'] one, two = arr how do I do that in JavaScript? ...

JSON Array in Flex

Hello! I have code: api_result = '{"response":[{"uid":1969258,"first_name":"Walle","last_name":"Woo"}]}'; var myobj:Object = JSON.decode(api_result); So, how I can get uid, first_name and last_name from "response" array? ...

PHP saving variables

There is a $variable, its value is a big Array(). It is created inside the function one() { ... } on the first.php page. first.php has form with method="post", after submition page reloads on second.php Is there any way to get value of $variable inside function two() { ... } on the second.php? Seems I can post value of $variable wit...

ExecuteReader with Oracle array binding

I'm trying to improve performance of my Oracle SQL queries by using array binding to an OracleParameter. This is basically what I'm trying to do: List<string> IDValList = new List<string>(); IDValList.Add( "IDOne" ); IDValList.Add( "IDTwo" ); List<int> sizes = new List<i...

How to sort this array ??

Hello, For the last 3 days, I have been trying to sort an array, but without success. I tried in the php file first and in the tpl file, but it was impossible for me to sort my array. Can you help me please ?? This is the structure of my array (thanks to the smaty debug tool !) : Array (5) attributes => Array (4) 23 => "1L" 24 =...

PHP calling tree objects

$var is an array: Array ( [0] => stdClass Object ( [ID] => 113 [title] => text ) [1] => stdClass Object ( [ID] => 114 [title] => text text text ) [2] => stdClass Object ( [ID] => 115 [title] => text text ) [3] => stdClass Object ( [ID] => 116 [title] => text ) ) How can we call [title] from some [ID]? (without touching...

can we pass arrays as arguments to functions by this syntax, under upcoming c++0x standards ?

suppose we have following function: void someFunction(int * araye){ for (int i=0;i<5;i++) cout <<araye[i]<<' '; cout <<'\n'; } can we pass an array to this function by following syntax, under upcoming c++0x standards? : someFunction({1,2,3,4,5}); if that's true, will we even be able to use this syntax in any case in which, arra...

PHP new array()

$var is an array: Array ( [0] => stdClass Object ( [ID] => 113 [title] => text ) [1] => stdClass Object ( [ID] => 114 [title] => text text text ) [2] => stdClass Object ( [ID] => 115 [title] => text text ) [3] => stdClass Object ( [ID] => 116 [title] => text ) ) Want to update it in two steps: Get [ID] of each object and throw i...