arrays

I need some advice on storing data in mysql, where one needs to store more than one, let say userids for a single post?

In cases when some one needs to store more than one value in a in a cell, what approach is more desirable and advisable, storing it with delimiters or glue and exploding it into an array later for processing in the server side language of choice, for example. $returnedFromDB = "159|160|161|162|163|164|165"; $myIdArray = explode("|",$ret...

Struggling with flashlite 1.0 Strings

I'm using eval to simulate arrays. Setting values works fine for integers, but seems to completely fail for strings. eval("array" add i-1) = arrayVal; // fails for string values Getting values seems to work perfectly fine either way. arrayVal = eval("array" add i-1); // works fine for strings and ints Is there any way around this?...

PHP: Convert variable to array.

I'm trying to convert a variable to an array and split each character using PHP. So say I have a variable $name = 'John Smith'; How do I convert it to: array('J','o','h','n',' ','S','m','i','t','h'); Notice the space between John and Smith as well. Thank you. ...

Rearranging Array in PHP

Hello, I have an array similar to {A,B,C,D,E,F,G,H}. I would like to be able to pick an index or entry and have the array be reordered. So say if i had a function reorder('C'); It would return the array starting at C, with anything before this index added on to the end, so this example would give {C,D,E,F,G,H,A,B} Is there a functi...

Return perl array to MATLAB

Is there a way to return a perl array to MATLAB? Or do I just have to return a string and parse it? I'm using a call from MATLAB to a perl script to interface with a MySQL database. After I get the results of a query, I want to pass it back to MATLAB. EDIT: I'm using a modified version of perl.m to call the perl script. It calls the ver...

Numpy matrix to array

I am using numpy. I have a matrix with 1 column and N rows and I want to get an array from with N elements. For example, if i have M = matrix([[1], [2], [3], [4]]), I want to get A = array([1,2,3,4]). To achieve it, I use A = np.array(M.T)[0]. Does anyone know a more elegant way to get the same result? Thanks! ...

Why is my multi-dimensional dynamic allocation in C not working?

Hi all, I have been trying to figure out the problem with my allocation and use of a multidimensional dynamically allocated array in C. I'd really appreciate any help. I've tried two approaches. The first: cdr = (double ***) malloc(NUM_REGIONS * sizeof(double **)); for(i=0; i<NUM_REGIONS; i++){ cdr[i] = (double **) malloc(numRating...

SQLite on Android: Union with limits alternative

I want to create a Cursor, which later I will pass via CursorAdapter to AutoCompleteTextView for autocompletion suggestions. The problem is that my SQL statement needs to select 2 different result sets from the same table, just sorted by different criteria. At the same time these result sets must not overlap - otherwise I would have mult...

Looping an array through a second array

Looking to loop through an array of URLs and inject each keyword from a second array into each URL but can't get to grips with the understanding of arrays. Eg: $key = array("Keyword+1", "Keyword+2", "Keyword+3"), $url =array("google.co.uk/#hl=en&q=", "bing.com/search?q=","uk.search.yahoo.com/search?vc=&p="), I'd like the above to outp...

Computing number of arrays containing an element in perl

I think I've just been looking at this too long. I have some data that looks like this: @a = ( { name => 'ethan', depth => 0 }, { name => 'victoria', depth => 1 }, { name => 'stephen', depth => 2 }, { name => 'christopher', depth => 3 }, { name => 'isabella', depth => 2 }, { name => 'ethan', depth => 3 }, { ...

Multiple foreach without nesting

This first block of code works as expected. It's a foreach to print values from an $fnames key-value array. foreach($fnames as $fname){ echo $fname; } The $fnames array has an $lnames array that correspond to it, and I'd like to print the lname with the fname at the same time, something like this: but it doesn't compile foreach($f...

Confusion on whether to use fixed with unsafe code and stackalloc

I have a block of code below with a single line commented out. What happens in the CreateArray method is the same thing that the commented out line does. My question is why does it work when the line b->ArrayItems = d is uncommented, but return garbage when commented out. I dont think I have to "fixed" anything, because all of the infor...

How to convert a ResultEvent from amfphp into array collection flex?

Hello friends, how can I convert a source.result from AMFPHP into ArrayCollection? the function I'm trying without success is the following: public function listrecordsmail(source:ResultEvent,arrayDefinitionsargs:Array):void { //listamailsend.dataProvider = source.result; var array:Array = ArrayUtil.toArray(source.result); Se...

PHP Assign array to variables

I'm not sure if my memory is wrong, but when I last used PHP (years ago), I vaguely remember doing something like this: $firstVariable, $secondVariable = explode(' ', 'Foo Bar'); Note that the above is incorrect syntax, however in this example it would assign 'Foo' to $firstVariable, and 'Bar' to $secondVariable. What is the correct ...

need an ideea to optimize an algorithm for matching multipart rar files from input in php

Hello, i'm looking for a better optimized way to find and group multipart archives from an array of filenames I have as an input for example: array( books.part1.rar, books.part3.rar, 00000114.rar, svoy_20ostrov.rar, svoy_20ostrov.rar, koncert_20v_20dk_20mir.rar, koncert_20v_20centralnom_20teatre_20kukol.rar, LP_LIVE_PR_Tampa.part2.rar...

php arrays (and remvoing certain element)

I'm not 100% but this ($settings) would be called an array in php: $setting; $setting['host'] = "localhost"; $setting['name'] = "hello"; but what's the name for this that's different to the above: $settings = array("localhost", "hello"); Also from the first example how can i remove the element called name? (please also correct my...

Compare multiple values in a Ruby array

[ { "name": "John Doe", "location": { "name": "New York, New York", "id": 12746342329 }, "hometown": { "name": "Brooklyn, New York", "id": 43453644 } }, { "name": "Jane Doe", "location": { "name": "Miami, Florid...

Array of Types in Ruby

I am trying to create instances of objects of various types by iterating and checking for validity. I need an array of types so I can do something like this: def tryClasses(in) types = [Foo::A, Foo::B, Foo::C] types.each do |type| a = type.new(in) return a != null end end How do I create and array of clas...

Allocate array from command line parameters

I am working on a small C application and I am capturing a value from the command line. I would like to capture the value and use it to initialize an array. Here is what I'm trying to do. int main(int argc, char* argv[]) { int option = atoi(argv[2]); int values[option]; ...... } I am getting a compilation because my opt...

How do you convert a file in memory to a byte array?

I am using IonicZip to compress video files and store in a blob field. I have the zip file created just need to convert it to a byte array. How is this done without writing to the harddrive? Thanks, Dave ...