arrays

How can I store the status in an array after concatenating

Example: (if the status can be: 'done', on_going', 'to_verify') for loop starts here -------- I used $status .= $status; and if I perform echo $status; it will give me 'doneon_goingdoneto_verify' for loop endshere -------- I would want to perform something based on the status like if there's 'on_going' status then set $on_go...

Objective-C Problem with Dictionaries & Arrays

Hello! I am attempting to follow the tutorial shown here - http://www.iphonesdkarticles.com/2009/01/uitableview-sectioned-table-view.html - and implement it in my own code. Here's the problem I'm getting - data, wishlists, and wishlistids are all NSMutableArrays. I know this problem is occuring on the line where I try to add the dict...

Array.count works fine locally but breaks on heroku

Right now, if I go to the index action of a model that I have, I don't show the basic table of data that rails generates for me if there are no existing records in the database. I do something like: <% if @my_records.count > 0 %> <table> <tr> <th>...</th> <th>...</th> <th>...</th> <th>etc</th> </tr> <% @my_records....

idiomatic way to construct the complement of an array in C

I'm writing a function that gets passed a pointer to an array of length 4. This array will contain integers 0 <= x <= 52 and I would like to construct an array of length 48 with every integer from da kine that's not in the passed in array. In python this would be # just included for specificity cards = [card for card in deck if card not...

Javascript - declare array of objects containing objects ...

I have an array of objects that contain other objects. At the moment the way I declare them is pretty long winded. Is there are more condense way to do the following: function city(name,population) { this.name = name; this.population = population; } function state(name) { this.name= name; this.cities = new Array(); } function coun...

Best way to create singleton array

What is the "easiest" way for you to create a singleton (with exactly one element) Objects array in Java ? ...

Assembly - Array (Linux)

In assembly how do i Print the values of an Array? Now in this program I also have to print its values < Index entered in by the user. .intel_syntax noprefix .include "console.i" .data index: .long 0 array: .long 1,2,3,4,5,6,7,8,9,10,11,12 # Array initialized value: .long 0 .text ask1: .asciz "Enter an...

Python: Error --> setting an array element with a sequence

The data-element is a float-number and no sequence (I think). But I get the error "setting an array element with a sequence". folder = r"C:\Dokumente und Einstellungen\ssc" contents=os.listdir(folder) ar = zeros((81,81,256),int) filenumber = 0 for d in contents: if str(".bin") in d: filename = os.path.join("C:\\Dokumente u...

C# Convert string array to dataset

I have an array of strings and need to convert them to a dataset. Is there some shortcut way to do this? For example: string[] results = GetResults(); DataSet myDataSet = new DataSet(); results = myDataSet.ToDataSet(); // Convert array to data set I’m not too bothered about formatting or structure. ...

Insert and select from a table/array in oracle

Hi everyone, I have a pretty big sql statement which returns a list of id's. I need this id-list as base for other statements. Like this: open crs_result1 for ' select * from ... where id in ( select <ids> from <base_statement> ) '; open crs_result2 for ' select * from ... where id in ( select <ids> from <base_statement> ) '; open crs_...

Filter out duplicate values in array using php

Please help me to filter out only duplicate values in array using php.Consider, $arr1 = array('php','jsp','asp','php','asp') Here I would prefer to print only array('php'=>2, 'asp'=>2) tried it by print_r(array_count_values($arr1)); but, its getting count of each element. ...

Passing numerically indexed PHP array to javascript

I've got a PHP array in this format: $js_data_array[] = array('href' =>$matches[1][0], //this is an image url 'title' =>'Lorem ipsum dolor sit amet, consectetur adipiscing elit', ); And I need to get it into this format in javascript [{ 'href' : 'http://farm5.s...

Vbscript + Create and compare an array of usernames

Hi, I'm trying to write a script which basically takes an array of lots of users and checks if the logged on user match. If it does, a different routine is run. This is what I have so far: Dim objNetwork Dim Username Set objNetwork = CreateObject("WScript.Network") Username = objNetwork.UserName What I have to do next is to assign ...

PHP loop checking existence of a string in an array then outputting a boolean

Fairly rubbish with PHP, this is a continuation on from my last question. I have a list of user agents inside an array, and I want an output to be true if the user agent matches one listed inside the array. This is what I have for a single user agent: <?php function mediaType(){ $browser = strpos($_SERVER['HTTP_...

Python: get the position of the biggest item in an numpy array

How can I get get the position of the biggest item in an numpy array? ...

Can't write new elements to IteratorAggregate?

Am I correct in thinking that IteratorAggregate only provides array-like read access to an object? If I need to write to the object-as-array, then I need to use Iterator? Demonstration of an IteratorAggregate object causing a fatal error when trying to add a new element follows: <? class foo implements IteratorAggregate { public ...

variable variables within $_POST and associative arrays

I'm probably being a little thick, but I can't seem to find an answer to this one. I'm moving from a server with register globals ON to one with it being off. It's a good thing, but unfortunately I have been used to years and years working with register globals being ON which has resulted in me writing sloppy code. I am now trying to fix...

How to sort a query result array

Hi, I have a array with results from a query from regular tables, for example: id | Name | Department | Location | Email | Phone | Type | ..........and so on I have the results in a query array, I can get the default query sorted, but I would like to ability to be able to resort that array as needed without having to keep re-reading d...

PHP: how to 'cut' my array ?

I have an array Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 ) How can I remove the latest 2 cells and make it shorter ? Array ( [0] => 0 [1] => 1 [2] => 2 ) Thanks ...

How to empty an javascript array?

var arr = [-3, -34, 1, 32, -100]; How can I remove all items and just leave an empty array? And is it a good idea to use this? arr = []; Thank you very much! ...