arrays

PHP: Split a string in to an array foreach char.

Hi I am making a method so your password needs at least one captial and one symbol or number. I was thinking of splitting the string in to lose chars and then use preggmatch to count if it contains one capital and symbol/number. however i did something like this in action script but can't figure out how this is called in php. i cant f...

Using Array "Keys" In a MySQL WHERE Clause

I have a data set that is generated by a Zip Code range search: $zips: key -> value 11967 -> 0.5 11951 -> 1.3 The key is the Zip Code (Which I need to query the Database for), and the value is the miles from the user entered zip code. I need to take the key (Zip Code) and search the database, preferably using a MySQL query similar to...

Most efficient way to create a zero filled JavaScript array?

What is the most efficient way to create an arbitrary length zero filled array in JavaScript? ...

Array of Pointers

How can I get an array of pointers pointing to objects (classes) ? I need to dynamically allocate space for them and the length of array isn't determined until run-time. Can any one explain and tell me how to define it? and possibly explain them how it works, would be really nice :) ...

[Objective C] Leaks hunting

I'm still working on my leaks problem and I don't know how to solve this one I have leaks on each arrayTmp addObject lines NSMutableArray *arrayTmp= [[NSMutableArray alloc] init]; [arrayTmp addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"1", @"value", @"Value 1", @"name", nil]]; [arrayTmp addObject:[NSDictionary dictionaryWithO...

javascript compare array

Hello, Somebody made a compare script for me, but it is working like it should be, because I a was little unclear, the code doesn't totally do how I like to have it. Please take a look at this website, this will explain more then thousand words The function of this website is checking the lotto/bingo numbers, Each draw day (1 and 2) s...

How do I shuffle two arrays in exactly the same way in Perl?

Does anyone know how to shuffle two arrays randomly in exactly the same way in Perl? For example, say I have these two arrays: Before shuffling: array 1: 1, 2, 3, 4, 5 array 2: a, b, c, d, e After shuffling: array 1: 2, 4, 5, 3, 1 array 2: b, d, e, c, a So every element in each array is bound to its equivalent element. ...

Memory usage large arrays puzzle in java

Hello to all and good day, I want to test how much memory takes a class(foo) in java.In the constructor of foo I have the followings new: int 1 = new int[size] int 2 = new int[size] .... int 6 = new int[size] The size begins from 100 and increases until 4000. So my code is: Runtime r = Runtime.getRuntime(); for(int i=0;i<10;i++) r.g...

count from several multidimensional arrays

hi all, i have foreach, which generate following arrays: ==== array 1 ==== array 0 => array 'tag' => string 'daf' (length=3) 1 => array 'tag' => string 'daa' (length=3) 2 => array 'tag' => string 'daf' (length=3) 3 => array 'tag' => string 'daaa' (length=4) 4 => array 'ta...

accessing hash inside of an array with ruby on rails

I am getting the average of all of the calls that belong to a user. A user can have many phones. So I search all the phones that belong to that user and average that phones calls and add it to an array. Now I need to average all of the calls together. This is what comes back: [{["2009-08-14", #<BigDecimal:87e1488,'0.81E2',4(8)>]=>nil, [...

What is the purpose of Array.GetLowerBound(int) ?

I don't understand the purpose of Array.GetLowerBound(). Does it ever return non-zero? When? How? Thanks. ...

Copying a dictionary with multiple sub dictionaries and only returning certain keys from the sub dictionaries.

In my current iPhone project, I have a created a dictionary that groups the sub dictionaries by the first letter of the "Name" key. NSLog returns the following. I would like to create an identical dictionary that only shows the "Name" key under each initial letter key. What is the best way for making a copy of some of the items in the su...

Filtering a dictionary by the value for a key in the sub dictionaries with a UISearchBar

(Note: This is an extension of a previous question.) I am having some difficulty implementing a SearchBar for fairly complex tableview. The tableView has multiple sections, two lines of text and an image. All the data is loaded from a plist and then put into sections by the initial letter of the value for the "Name" key. NSLog returns t...

How to sort an array containing class objects by a property value of a class instance?

Possible Duplicate: How to sort an array of object by a specific field in C#? Given the following code: MyClass myClass; MyClassArray[] myClassArray = new MyClassArray[10]; for(int i; i < 10; i++;) { myClassArray[i] = new myClass(); myClassArray[i].Name = GenerateRandomName(); } The end result could for example look ...

Can Variable number of variables with incremental variableNames be created through reflection in Java?

Hi I have the following requirement. I want to create variable number of String arrays in a method, based on the number of levels present. For e.g I have the variable numOfLevels (int) received from a jsp page. Based on this I want to create: String[] level1; String[] level2; String[] level3; String[] level4; etc ... I know my re...

How is *array* memory allocated and freed in C and C++?

My question specifically is in regards to arrays, not objects. There a few questions on SO about malloc()/free() versus new/delete, but all of them focus on the differences in how they are used. I understand how they are used, but I don't understand what underlying differences cause the differences in usage. I often hear C programmers...

2-dimensional arrays in C# and how to return the array

Hi, I'm having trouble with declaring 2-dimensional arrays in C#, populating them and then returning the array. At the moment, I'm declaring the array like so: private static string[,] _programData = new String[50,50]; public string[,] ProgramData { get { return _programData; } } ...

Convert a string array to a concantenated string in C#

Is there an easy way to convert a string array into a concantenated string? For example, I have a string array: new string[]{"Apples", "Bananas", "Cherries"}; And I want to get a single string: "Apples,Bananas,Cherries" Or "Apples&Bananas&Cherries" or "Apples\Bananas\Cherries" ...

Using the iPhone SDK, can I programmatically get a list of the applications/games on a users iPhone/iPod touch?

I would like to be able to pull the list of apps and games the user has and present it to them, or launch one of them. I'm guessing that Apple doesn't provide this capability in the iphone sdk. Still, I'd like to know how to do it and still be eligible for the app store. ...

JSON vs. Serialized Array in database

What are the adventages and disadventages of storing JSON data in MySQL database vs. serialized array? ...