arrays

php recive array from get form

how can i recive an array from an html get form? i would receive the value of same checkbox, they have all the same name "es. object" ...

PHP array Reference Bug ?

With PHP is it even Possible to Pass arrays by Reference ? or its a Bug Only for Me. class MyStack{ private $_storage = array(); public function push(&$elem){//See I am Storing References. Not Copy $this->_storage[] = $elem; } public function pop(){ return array_pop($this->_storage); } publi...

How to read this PHP Array

Hello, I juste want to know how to read the value "status" in this PHP array: Array ( [0] => stdClass Object ( [smsId] => 10124 [numberFrom] => +000 [numberTo] => +000 [status] => waiting [date] => 20100825184048 [message] => ACK/ [text] => ...

How to interleave arrays of different length in Ruby

If I want to interleave a set of arrays in Ruby, and each array was the same length, we could do so as: a.zip(b).zip(c).flatten However, how do we solve this problem if the arrays can be different sizes? We could do something like: def interleave(*args) raise 'No arrays to interleave' if args.empty? max_length = args.inject(0) {...

Array of proxies on a linux machine

Hi, I would like to setup a system which I could change the ip any time I want. The Idea I have is to have a list of proxies, which by pressing a button or something similar will switch to a different proxy server. any suggestions of how to do it( I believe there is already a software for that somewhere) I use ubuntu 10.04 (linux). ...

How to get the correct number of columns from mysql_fetch_array()?

Hi Here is a line of my code while($row = mysql_fetch_array($result)) I want to get how many columns are in the row. I tried count($row) but this returned what I think is the number of cells for the whole $results. i.e there are actually 7 columns, and 2 rows and count($row) returned 14. I want a function that will return 7. Can yo...

Objective-C Search NSArray for String?

Hello! I have an array of strings. How might I be able to figure out what index a string is in a array? Thanks, Christian Stewart ...

how to address portion of an (1-D) array?

Hi, I'm a new user to C programming. I've tried researching this online, but couldn't find an answer... how to I access a portion of an array in C? For example, int Data[4] int Input[32] What's the syntax for doing: Data = Input[12:15] such that Data[0] = Input[12] Data[1] = Input[13] Data[2] = Input[14] Data[3] = Input[15] In rea...

Very simple ListPreference to play sound is not working. Any ideas? (tons of details)

Could someone maybe tell me what i'm doing wrong? I'm betting im missing one small thing. I've looked on the developer site and i've read some tutorials and i'm just not seeing what i did wrong. I'm trying to use a ListPreference to decide which sound to play on a button click. I have this at the top: public String greensound; Here'...

Removing all instances of items from array

I have an array which may have duplicate values $array1 = [value19, value16, value17, value16, value16] I'm looking for an efficient little PHP function that could accept either an array or a string (whichever makes it easier) $array2 = ["value1", "value16", "value17"]; or $string2 = "value1 value16 value17"; and removes each item...

How to add linebreak to decoded json array in php

Hi, I need to add some sort of line break after each segment (date, name, address, phone) to separate them, I have tried using the break and paragraph etc but just keep on getting syntax errors with the usual unexpected "<" and have also tried using tables but that failed too. Is there an easy way to format the output of this to display...

How to get the last n items in a PHP array as another array?

How to I get an array of the last n items of another array in PHP? ...

Can I store JavaScript Functions in arrays?

How can I store functions in an Array with named properties, so I can call like FunctionArray["DoThis"] or even FunctionArray[integer] Note: I do not wish to use eval. ...

C struct arrays

I have a C (not C++) struct that goes like this typedef struct mystruct{ float a,b; int x, y; } mystruct; Then in a function I collect data like this: mystruct List[MAX]; ListNumber = 0; for(i = 0; i < MAX; i++) { if(conditions_meet) { List[ListNumber].a = masterlist[i].a; ...etc ListNumber++; } } then I send the array to ...

Multidimensional array retriving (OOP)

Hello, i have two classes (Database for queries over database) and News for manipulating articles. On index.php (could be any other page) i call News class, which calls Database class. Everything goes ok, until i have to display result on index.php. Let's say, i save result in $news in News class. How should i retrieve that array in in...

Using a for statement to create variables from array

I have a set of numbers that I need to pass from a function to a few other functions before it is actually used. I figured an array is a good way to do this, however I can't remember how to do what I want to do. The code looks like this int set1; // variables that hold settings int set2; int set3; cout << "Setting 1"; cin >> set1; cou...

creating a changing amount of pointers in c++

I have a project im working on where I need to make an array that stores pointers but the number and size of the array will change at run time each time it runs. is there any way to declare variables in a for loop or something like that where i can declare a variable in the format of pointername with a number at the end. ...

Merge two ActiveRecord arrays and order by created_at

books = Book.find(:all) articles = Articles.find(:all) By reading from http://guides.rubyonrails.org/layouts_and_rendering.html I knew that I could do something like: <%= render :partial => [customer1, employee1, customer2, employee2] %> and it would use _customer and _employee partials as appropriate. So I want to do something lik...

Comparing one array against another in rails

Hi, I am using the 'contacts' gem in rails to retrieve a users contacts from their mail application. It returns the contacts like so: ["person name", "[email protected]"], ["person name", "[email protected]"], ["person name", "[email protected]"] etc... I want to compare this list to the Users already signed up for...

Can you index elements of an array in Postgres?

I'm wondering if I can do something like CREATE INDEX firstelement ON mytable (myarray[1]); this particular syntax creates a syntax error. ...