Questions tagged "arrays" (page No.1)

php checking array values

Hey all i am trying to figure out a way to see what all values are within the array: $sql = "select * from product where type = ? limit 1"; $query = self::$__CONN__->prepare($sql); $query->execute(array($type)) or die(print_r($query->errorinfo())); I am new at PHP and im not sure what all that is doing to ...

How to pass multi-dimensional array with Jquery AJAX post?

I've been using Serialize() to pass checkbox form data with Post() for a basket that can hold multiple items of the same category. When I post them using the submit button it works fine with multiple values being passed and displayed under one category. However when I used Jquery serialize() it will ...

String arrays output

How can I get the output of this program to work correctly? I'm not sure why the string array won't store my values and then output them at the end of my program. Thanks. #include <iostream> #include <string> using namespace std; int main () { int score[100], score1 = -1; ...

Detect values on same place

How can I detect with javascript if at least one value in array is same as value in other array on the same place? If you can't understand, this example will help you. This should return true: var array = [ [ [3, ...

display an array of 25 integers positive and negative c#

How could I create a program that has an array of 25 integers with a mixture of values positive and negative and display the average of all the numbers, the positive numbers and the negative numbers? Please help ...

HTML checkbox array value duplication

This is ODD. For some reason if you have a checkbox array NOT in a form, it sets the value of every element in the array to be the first value. I use the same section of code in my forms and it works fine, but when displaying it without ...

PHP array overwrites itself

Everytime I pass post array data it overwrites itself every time a new selection is passed. I want it to add to the previous selection and keep growing. Im banging my head trying to work this out, is it due to the array thats passed not having enough dimensions or the ...

Javascript Scoping Issue or Instantiation Issue?

I have a webpage that does some calculations on the fly based on user 'keyup' events in a text input field. It's a rather large page that is built dynamically, so I have to keep a Hash/Array of values that I can reference from other locations within the page. So at ...

Array of objects. JSON deserialization. Please suggest

I am consuming a web service which returns a JSON string. String str =[{"users":{"company":"abc","contact_Number":"999999999"}}, {"users":{"company":"xyz","contact_Number":"888888888"}}, {"users":{"company":"xxx","contact_Number":"555555555"}}, ] Unable to De-serialize. class jsonmenuwrapper { ...

Perl - Search array of words to check for a partial match in any part of an email address

Again, a whole day and I am stuck again. I need to use an array of words or var that contains forbidden words that cannot appear in an email address. Either: $baddies = 'smtp mailer sysop'; or @baddies = qw(smtp mailer sysop); or @baddies = qw/smtp mailer sysop/; There are more bad words in the array ...

Remove characters from array output

I have an array of images being displayed from a specific directory using the following code: <?php $dir = "img"; $files = scandir($dir); echo '<pre>', htmlspecialchars(print_r($files, true)), "</pre>\n"; ?> The output of this code is as follows: Array ( ...

Comparing two arrays to prevent massive looping

I have two things I'm cross-indexing; an external .txt file and a directory. I've stored both to a array (or tried to, the txt file is returning a blank array with print_f) What I'm trying to do now is loop through the directory array looking for a fuzzy logic match on the ...

Is there any way to make my function return a dynamic array?

So at the moment I have a function I made returning a static array, is there any way to make it return a dynamic array for the sake of efficiency? #include <stdio.h> #include <stdlib.h> #include "header.h" int *charpos(char *str, char ch) { int *bff, bc, ec, i, strln; static ...

Plotting two arrays of different lengths

So I have some data import pyfits import matplotlib.pyplot a = pyfits.getdata('data.fits') x = a['time'] y = a['flux'] I had a issue with some data where my arrays contained NaN values. To get rid of them, I did the following: x = x[numpy.logical_not(numpy.isnan(x))] y = y[numpy.logical_not(numpy.isnan(y))] Which removes all NaN values from the arrays x and y. The problem ...

Array declaration and size initialization (C++)

I'm not exactly sure how to pose this question so I'll start with some example code: //header file class A { public: A(); private: int x; std::string arr[x]; } //cpp file class A { public: A() { /*code to get the ...

Arrays with PHP wont evaluate

I have a config.php file which has some constants and methods. I have a test.php file which calls one of the methods in config.php. The relevant code is: $Questions = array( 1 => "Is he/she nice?1", 2 => "Is he/she sweet?2", 3 => "Is ...

Create Array and Search Through in Ruby

Using devise, rails 3.2. I'm trying to figure out how to create an array of ids and then check if the current_user's id is included in this array. My users have many locations through location_users. (Locations have many users through the same relationship.) I can get a list of user_ids associated with ...

cocos2d sigleton array is not adding objects

Sorry for my bad english i search over the internet and i saw how to but for some reason is not adding objects; what i want to do is load on a layer my power up sprites and add them on an array and based on the array i will choose which ...

« Previous12345678910 ... 16421643Next »Show All