An array is an ordered data structure consisting of a collection of elements (values or variables), each identified by one (single dimensional array, or vector) or multiple indexes.
0
votes
0answers
6 views
Getting files from a directory and adding them to a zip file
I've created a zip file named 'files.zip'. I have images inside my property_image folder. I've scanned that directory and have the type of files I need. '$prop_image' is another array which have the ...
0
votes
1answer
8 views
Getting Unique Values in Multidimensional Array PHP
I have an array similar to this:
array(5) { [0]=> string(2) "32" [1]=> string(2) "67" [2]=> string(19) "2013-07-15 15:56:28" [3]=> string(1) "1" [4]=> string(4) "Fail"}
array(5) { ...
0
votes
0answers
2 views
How to return the hstore value for each key in an array of keys?
I have a model called Favorite that has an hstore column named :data. It could includes keys like "Yellow", "Green", "Red". But, since in production the actual keys will be unknown...I need to call ...
-2
votes
6answers
100 views
sizeof() function in C
main()
{
char a[] = "Visual C++";
char *b = "Visual C++";
printf("\n %d %d",sizeof(a),sizeof(b));
printf("\n %d %d",sizeof(*a),sizeof(*b));
}
sizeof(a) gives me output: 11 ( that is length of the ...
0
votes
0answers
11 views
Empty value powershell array
i have a strange issue, this is my csv
Serveur;Carte;Cordon;IP;Mac;Vmnic ;Vmnic mac;Connect;Port
Dexter;eth1;405;172.16.5.117;00:24:e8:36:36:df;Vmnic0;00:50:56:56:36:df;sw-front-1;A1
...
0
votes
2answers
30 views
Get an image from an array
I'm trying to place an image from an array into a div.
arralegro =[ "01.png", "02.png", "03.png", "04.png"];
n=2;
var goImg = 'alegro/' + arralegro[n];
alert (goImg); //correct - `alegro/02.png`
...
0
votes
1answer
21 views
Loop through array that might be multi dimensional
I might have the following array()
Array([
0
]=>Array([
part_id
]=>6[
part_user_id
]=>2[
part_department
]=>3[
part_category
]=>1[
part_subcategory
]=>1[
...
0
votes
4answers
33 views
Can i use two quotations with Array()?
I translate my website to French, i would like to know if this is correct
$lang = array(
"tittle" => "C'est bien",
"desc" => "Bienvenue sur mon site",
);
If i use:
'tittle' => 'c'est ...
0
votes
3answers
22 views
multiple array to json object convert?
I have multiple array like as follow:
var a=[1,2,3,4,5,6,7,8,9];
var b=["a","b","c","d","e","f","g","h","i","j"];
but i need to convert arrays to array object like as below:
ab=[
...
-3
votes
3answers
57 views
Checking if a string contains any of the strings in an array
Without for () loops such as
for(int j =0; j < array.length; j++)
{
}
I want to be able to check if a string contains any of the strings in an array globally. So for() loops ...
1
vote
0answers
11 views
Dynamic content in custom mobiscroll
I am using mobiscroll for my select forms and am having no problem when using static content, but...
Now I am trying to create an mobiscroll with dynamic content from ajax/json.
Here is what I am ...
5
votes
2answers
81 views
reading a text file into an array
I'm really new to programming, and after thinking hard about this for a week for a summer project, I'd really appreciate some help!
I'm trying to read in a long text file, which is just a long string ...
0
votes
1answer
64 views
array containing two arrays with no key
I was bug squashing my script when I discovered that an array ($array) contained two arrays with no key like so:
array(19) {
["id"]=>
string(3) "243"
["var"]=>
string(4) "test"
}
...
-1
votes
2answers
27 views
Using checkboxes to specify items in array
I want to use checkboxes to specify the items to be added to an array, my code is as follows:
$columns = array(
if (isset($_POST['CustomerID'])) {
'Customer ID' => 'CustomerID',
}
if ...
-1
votes
1answer
22 views
Pivot json data from array of models
I host a web api service, which returns a snapshot of my model "myModel" for the last 12 months. The json array that I receive on my client is a simple array of 12 "myMydel" objects.
If myModel has ...
0
votes
4answers
32 views
get the name of the current $_GET variable [duplicate]
I want to know what URL user has accessed. For example, if user accessed:
index.php?register
it will echo '1'.
if (isset($_GET))
{
switch ($_GET)
{
case "register":
...
1
vote
1answer
46 views
Extracting an array of a member variable from a vector
Let's say I have a struct:
struct Foo {
float A;
float B;
float C;
};
And I have a vector of the struct:
std::vector<Foo> vFoo;
And a function that takes arrays of floats (or ...
0
votes
1answer
18 views
Hierarchal Menu in PHP from Array
Alright, it's hump day, and my brain's already shot.
Can someone tell me what I'm doing wrong here, I'm trying to build a Navigation list properly (hierarchal)
Here's the array:
Array
(
[0] => ...
0
votes
3answers
53 views
Random Value in php
I using the rand from php. That below script is working perfect, But My question is to give the priority for the one value in array(Show multi times). For example 100 times it randomly show the value, ...
2
votes
3answers
89 views
How to initialize an array with unknown length?
I'm a beginner of c and I'm not sure if I do it correctly.
char new_str[2000];
void ini(char a[]){
for (int i=0;i<2000;i++) {
a[i] = new_str[i];
}
}
int main(void)
{
char ...
1
vote
1answer
81 views
Optimize counting in an array
I think my code could be done better ...
What I want:
array a = ([1,2,3],[4,5,6],[7,8,9])
array b = ([2,3,4],[2,2,2])
Euclidean distance from a[0] to b[0] and b[1] and then the minimum of that ...
3
votes
3answers
59 views
Wrong result from the conversion in an array
Let's say that I have
char number[2] = "2";
In my code I get number 2 as a string that's why i have char. Now with the usage of atoi I convert this char to int
int conv_number;
conv_number = ...
0
votes
0answers
29 views
How to make it So it writes Update (Filelocation) (filelocation) and also add the number that is in the textbox into a textfile
To make it plain and simple i want it to write this to file SISINstall (filelocation) and then another Filelocation and the CFID number that the textbox has. SO it would look like this SISinstall ...
0
votes
5answers
41 views
How to create an array that extends itself dynamically?
How to create an array that extends itself. I don't want to use the classes like ArrayList and Vector etc to do this. Instead i need to generate an array that extends it's size upon adding elements to ...
0
votes
4answers
38 views
Creating a repeating integer array - PHP
I just want to make an array with the dates of a month. So the dates will start from 1 until 31 at most.
The obvious way, I know is a manual way:
$date_array = array( '1', '2', '3', '4', '5', '6', ...
0
votes
2answers
36 views
Best data type for my array/collection
I would like to store a enum value and a number in a collection or array, with the ability to update a specific value. Any recommendations on best method, taken into account performance impact?
E.g.
...
0
votes
1answer
40 views
create 10000 2dim arrays with a for loop with c#
Does some body how to create n(for example n=10000) arrays with a for loop which each array has its own index?
Array[,] number 1
Array[,] number 2
Array[,] number 3
.
.
.
I tried this code:
for ...
0
votes
3answers
38 views
PHP error while inserting in MYSQL with arrays
I have a script which inserts all data in array to MYSQL. But when there is just a single word in the array, the script gives no error, while when there are multiple words, it gives a
Column count ...
5
votes
1answer
90 views
Find the number of couples with the same difference in a sorted array
This is a interview Question.
"Given a sorted array. Find the number of couples with the same difference."
for example: if array is {1, 2, 3, 5, 7, 7 , 8, 9};
then we have
5 pairs with difference ...
2
votes
1answer
189 views
Cast object to array - strange behaviour
I am casting an object to array and after that I am unable to access the resulting array by a key.
This is the code
print_r($new);
$new = (array)$new;
echo $new['EPPContactemail'];
foreach($new as ...
0
votes
0answers
13 views
Merge two JSON encoded arrays to get a third array
I have two arrays encoded in JSON format, one for VISITS and one for DOWNLOADS:
VISITS JSON:
...
0
votes
1answer
21 views
Chunk array by value
how do you chunk array like this below?
array(
[0] => array(
['id'] => '1',
['parent_id'] => ''
)
[1] => array(
['id'] => '2',
['parent_id'] => ''
)
[2] => array(
...
0
votes
0answers
17 views
Kineticjs array objects
I have a problem with kinetics object:
I have some kinetics objects...
var trianguloG1=new Kinetic.Polygon({
points: [x, y, catetosTiangulosGrandes+x, y, x, catetosTiangulosGrandes+y, x, y],
fill: ...
0
votes
1answer
32 views
Why do I get “Illegal invocation” of this object?
Why do I get "Uncaught TypeError: Illegal invocation" when I post this functions returned object into an ajax post:
base.serialize = function()
{
var data
, depth = 0;
step = function(level, ...
1
vote
2answers
69 views
Storing elements of array in linked list
This is my code to append an integer in linked list.
#include "iostream"
using namespace std;
class LinkList
{
private:
struct Node
{
int data;
Node* link;
}*p;
...
-1
votes
3answers
65 views
Split string to array using javascript
I need to split a string dynamically that may have different format(a:b,a.b,a/b) to an array of two elements.For example :
string :- abs:sba;//array[0]='abs';array[1]='sba';
string :- ...
-1
votes
4answers
57 views
convert json response to javascript arrays [duplicate]
I'm getting json response from my webserver by $.getJSON . This is the response :
...
0
votes
2answers
57 views
putting double value 2d array read text
I want to put my text's double values on 2d array. My text is double and string together
deneme deneme 4.5 5.5 6.6 7.5 9.9 9.9
dsdsa sddsf 9.9 8.7 7.5 8.8 4.4 6.5
ı extraxt double from string. my ...
0
votes
6answers
65 views
Inserting values of array into MYSQL
I have a text file, who's value i have put into arrays,
this is the php code:
<?php
$homepage = file_get_contents('hourlydump.txt');
$x = explode('|', $homepage);
$desc = array();
...
1
vote
1answer
42 views
Parse string into multidimensional array with single regex?
I was wondering if anyone here could help me. I have the following string:
$str = 'unit1(field1,field2,field3),unit2(field4,field5,field6)';
I am trying to parse this string to create the ...
0
votes
0answers
6 views
Unable to put NSSound instance in NSMutableArray ion cocoa
Im having trouble adding NSsound instances into an NSMutableArray - But im not sure why.
The error I get is that I can not do soundFiles addObject, because soundObj is nil. But if I do [soundObj ...
0
votes
3answers
42 views
Write a Java program using single dimensional array. Have a list of 10 numbers and fetch a value based on the index
So I have this assignment for my Programming class, and I'm lost on what to do for the second part. This is the code I have so far:
class SingleArray
{
public static void ...
0
votes
0answers
32 views
LCM of all the numbers in an array in Java
I have an array of ints, and I'm trying to find the LCM (least common multiple) of all the values in the array. I've written an lcm method separately; it takes two values as input, and returns the ...
1
vote
2answers
51 views
PHP: key->value from two array elements
Basically, I have an array where each element is a key/value pair of elements, like this:
[myArray] => Array
[0] => Array
[id] => 121
[name] => ...
-4
votes
3answers
35 views
Create an array of another array subelements in one line [on hold]
Like this
oldArray = [[a, b, c, d],[e, f, g, h]]
I need one line of code that will return a new array of, say, element 2 in each element of oldArray
newArray = coolLine(oldArray, 2)
newArray ...
2
votes
2answers
55 views
Increment Array
I'm trying to increment an array (alphabet[0]) index whenever the letter 'a' appears in the user input, however when I print out alphabet[0] I received the wrong output.
Example problem:
"Enter a ...
-1
votes
3answers
22 views
Deleting an array from a multidimensional array in ruby
How would this get done? Assume I have the following
arr = [[test, 0, 0, 0], [apples, 0, 9, 8]]
I know I would do something like:
def delete_me(item)
arr.each do |a|
if a[0] == item
...
0
votes
3answers
62 views
cannot find symbol - out of bounds error
I'm working on a class assignment. Basically, we must use one-dimensional arrays to display a student's name, his current grade, and the subject. Code follows:
import java.util.*;
import ...
0
votes
1answer
16 views
VBscript gives out of range error with arrays within loop but not with arrays outside
I am getting a "Subscript out of range error" on line 23 of my code. I am opening and reading a .csv file and trying to return the data of the last line. The input information looks like this:
...
2
votes
5answers
73 views
Why array type object is not modifiable?
It is stated here that
The term modifiable lvalue is used to emphasize that the lvalue allows the designated object to be changed as well as examined. The following object types are lvalues, ...