arrays

Javascript object / array question?

I am new to the javascript object model (prototype based) and am trying to do the following: I have a constructor that simply initializes an array: this.myArray = []. I have a method: MyConstructor.prototype.addToArray = function(myObject, type) { // }; Basically I need myArray to be attached to a specific type. I.e. when addToAr...

Pass Array From C# COM object to JavaScript?

Similar to this http://stackoverflow.com/questions/45169/how-do-i-return-an-array-of-strings-from-an-activex-object-to-jscript but in C#. I have an COM control that passes back an array of strings to javascript. It seems like javascript cant understand what it is I am passing back and the array in javascript is always undefined. Java...

Help with array in android

i get NullPointerException at the start of the for where am i going wrong? public void checkzone(Location loc) { X = new List<float[]>() { }; Y = new List<float[]>() { }; X.clear(); Y.clear(); float x = (float) loc.getLatitude(); float y = (float) loc.getLongitude(); float A1...

Difference between the results of Doctrine_Query and Doctrine_RawSql

Hey I have problem with the following Doctrine_RawSql: public function getWithThreads($forum_id) { $conn = Doctrine_Manager::connection(); $q = new Doctrine_RawSql($conn); $q->select('{f.*},{t.*}, {p.id}, {p.last_post_date} ') ->from(sprintf("forum f LEFT JOIN thread t ON t.forum_id = f.id JOIN (SELECT MAX(p.crea...

Joining a NSArray of objects into a string, but need to be abke to specify property

I have a NSArray of Foo objects. @interface Foo : NSObject { } - (NSString *) name; @end I want to be able to join all these [Foo name] results into one NSString. In C# I would get a array of these by using LINQ, creating a Array of it, and feeding it to String.Join(): List<Foo> foo = [..]; String.Join(",", foo.select(F => ...

session objects that has Arrays within Array

I need to create a shopping cart there are many variables like Shirts,CompanyText,Desiner_Names,Company,Cons_Name,DSNR_Cert_Number,DSNR_Cert_Issued_Date etc. Here "Shirts,CompanyText,Desiner_Names" are all Array type variables where "Shirts" is the main Array. So i need to basically work on Array that has inside it 2 different Arrays al...

PHP Show Differences

I have two strings: $stringA = "1,2,3,4"; $stringB = "1,2,4,5"; I want to pick out the values from $stringB that are not in $stringA. How can I do that? ...

How to create a 2D array of objects in Ruby?

I am creating a map for my roguelike game and already I stumbled on a problem. I want to create a two dimensional array of objects. In my previous C++ game I did this: class tile; //found in another file. tile theMap[MAP_WIDTH][MAP_HEIGHT]; I can't figure out how I should do this with Ruby. ...

how to store an Array in localStorage?

If i didn't need localStorage, my code would look like this: var names=new Array(); names[0]=prompt("New member name?"); This works, however I need to store this variable in localStorage and its proving quite stubborn. I've tried: var localStorage[names]=new Array(); localStorage.names[0]=prompt("New member name?"); Where am I goi...

Rails conditions equal to one of an array- Syntax Errors

Hi I am trying to understand why I get a syntax error for this: :conditions => ["rank = ? and primaries.relationship = ?", ['CPT','SFC'], "Spouse"] I need to check "rank" against an Array of options. Seems like this should be pretty simple, any suggestions? ...

Order of a newly defined C# array

In C# 3.0, when I pass an array of strings to a method in the manner below, will the order I define them in be retained or are there conditions under which the order can change? Is this documented somewhere that I haven't seen? CalculateOmniturePageName(new[] { Model.GetOmnitureDomain(), Model.SectionTitle, Model.Title }) ...

How to build a Ruby hash out of two equally-sized arrays?

I have two arrays a = [:foo, :bar, :baz, :bof] and b = ["hello", "world", 1, 2] I want {:foo => "hello", :bar => "world", :baz => 1, :bof => 2} Any way to do this? ...

Bash, compare files. Removing values from file A that exist in File B

Greetings, I have one file - more or less a greylisting file. I need to compare the 40 to 50 values in it against a whitelisting file - and remove any values from the greylist that exists in the whitelist file. Right now I'm taking each greylist value and comparing it against each value in the whitelisting file (which has 1 - 2 thousa...

What's the fastest way to merge Array's in JavaScript where comparisons are expensive?

I want to merge two Array's in JavaScript. Unfortunately, comparisons of the particular data I am using is expensive. What is the best algorithm to merge my to lists with the least amount of comparisons? EDIT: I should note that the two Array's are sorted and I would like the merged content to be sorted and have only unique values. EDI...

Convert char Array/string to bool Array

Hi, We have this field in our database indicating a true/false flag for each day of the week that looks like this : '1111110' I need to convert this value to an array of booleans. For that I have written the following code : char[] freqs = weekdayFrequency.ToCharArray(); bool[] weekdaysEnabled = new bool[]{ Convert.ToBoolean(int....

What is the syntax getSomeValues()[0] called?

Possible Duplicate: Access array element from function call in php Sorry if this has been asked before, but due to the symbols I can't search Google or Stack Overflow for it. If it's been asked before, feel free to close it as a dupe. In some languages, if a function returns an array, then as opposed to storing the array in a...

Button to populate image from array

Hey guys i have an image view, with a popover controller. There is an array called detailitem which loads images into the image view. All i want is a button to load next image in array into the image view how would i write this? Here is my attempt it doesn't work? -(IBAction) nextitem { NSString * imageName = [NSString stringWithF...

PHP - reformat multidimensional array to insert into MYSQL?

Hello, how can I parse php array like this: $cars= array( "Ford"=>array("C-Max"=>array("length"=>"4333","width"=>"1825","height"=>"1560"),"Escape"=>array("length"=>"4480","width"=>"1845","height"=>"1730") ,"Explorer"=>array("length"=>"4912","width"=>"1872","height"=>"1849"),"Fiesta"=>array("length"=>"3950","width"=>"1973","heigh...

Remove item from string array

I have a database field with data such as this: 76,60,12 If I want to remove, for example, 60, what do I have to do? The number to be removed could be any place. I also need to remove the comma, if needed. I'm using .NET 2.0. ...

How can I split a string into two separate arrays using the .NET framework?

I've got a string containing both ints and a string. How do I split it into two arrays, one for ints and one for the string? I also need to maintain the order because I'm writing a file parsing system that depends on reading in and correctly splitting these strings. EDIT: Here's a sample input, and what I would like as output: ~Wolf 10...