Tagged Questions
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
7 views
Caesar Cipher shift on a string using shifting number
I have this question.
Using the Ruby language, have the function CaesarCipher(str,num) take the str parameter and perform a Caesar Cipher shift on it using the num parameter as the shifting number. A ...
0
votes
0answers
4 views
Output array in Twig
I trying to output array from database to screen.
In my entity:
/**
* @ORM\Column(type="array", nullable=true)
*/
private $category;
In my twig template:
{% for category in ...
0
votes
1answer
23 views
Writing a 2-dimensional array in C++ gives 'invalid types for array subscript' error
I'm a beginner in C++ (physics undergraduate) and am currently taking a course on computational physics. I have an exercise to numerically solve - using Euler's method - a 'flow problem' for a ...
0
votes
3answers
39 views
Checking if the user inputs the same string twice using array
i want to check if the user inputs a same string twice using array. don't have any idea on what codes to use can you suggest anything?
if the user inputs "1A" twice i want to print "Already Taken", ...
0
votes
0answers
9 views
Obtain all possible cobinations from multiple NSMutableArray
I am trying to write a method which allows me to compute all the possible word combinations from all the arrays which are stored in my NSMutableDictionary. So, basically my NSMutableDictionary object ...
-1
votes
0answers
13 views
Dynamic array allocation during constructing object, invalid use of non-static variable
class Array {
public:
Array(unsigned h, unsigned l, std::initializer_list<double>);
....
private:
unsigned length;
double * array;
...
-2
votes
1answer
18 views
character array triangle having characters seperated with spaces in C language
im trying to create this kind of a triangle in C language which is a right angled triangle and
the text is separated or delimited with spaces.
it should print
first line: this, second line: this is, ...
-2
votes
1answer
39 views
how do I mount this type of array in php?
how do I mount an array in this format with php?
array(6) {
[0]=> array(2) {
[0]=> int(10)
[1]=> string(10) "2014-09-02"
}
[1]=> array(2) {
[0]=> ...
0
votes
0answers
13 views
Stuck at an assignment - Confused as to what to do
(Language is processing)
Hey, I have an assignment that I don't really understand. This is part 2 of another assignment, where I had to make a function called drawButton, that uses an array as ...
0
votes
3answers
33 views
Addition Of Array
When the code is executed the sum of 'a' is coming 4 more than the actual sum while 'b' is correct. If i write a[i] in the last ouput instead of sum_a. The result is correct. What can be the reason ...
0
votes
0answers
41 views
Multidimensional flexible array initializer in C
Is there any way to replace the [5] in the array declaration by [] ? Everything is declared statically, so why does it need to know the size ?
#include <stdio.h>
int main (int argc, char ...
3
votes
6answers
99 views
Sort an ArrayList of Strings that are numbers
What is the fastest way to sort an ArrayList<String> (in descending/ascending manner) that contains numbers, eg: { "12", "3.5", "188", "33.03" } ? Does Collections have a built-in method for ...
0
votes
3answers
33 views
Best way in Javascript to check if string is inside an huge txt/csv?
My real world problem is: users of my mobile app type their city and I have to make sure it really exists, and that it is correctly written (caseinsensitive, so these are correct: New York, NEW york, ...
2
votes
4answers
28 views
Change array values in bash
I need to strip the first 0 from all values in an array, e.g. change:
array=( 01 02 03 [...] 10 [...] 20 [...] )
to
array=(1 2 3 [...] 10 [...] 20 [...] )
I think I can do this with ...
0
votes
2answers
19 views
Creating Different Permutations from different Arrays Values
I am trying to write a method which allows me to create a different String permutations, based on the values I have stored within 3 different arrays. Currently I have a NSMutableDictionary that ...
0
votes
0answers
49 views
Limit for number of elements in array [duplicate]
I'm new to java,and I have a question:is there a limit for the number of indexes in the array,for example I have an input of 450 ints ,and I'd like to store all of them in one array is it possible?
...
0
votes
2answers
28 views
Handle Arrays of self in Class initialize method
Let's say I define class:
Class Product < Struct.new(:field1,:field2)
and the corresponding new method, which parses an input string into the attributes of this class:
def initialize(string)
...
-2
votes
0answers
40 views
shuffle array until it`s ordered c++ [on hold]
I have an assignment with arrays in c++
My first task was to write a function that returns an array in a range of min and max values.
For example: min = 5; max = 10; it will fill an array with ...
1
vote
1answer
18 views
python: multiply two colums of nd-arrays to get the vector of same dimensions?
I have the following code:
x = np.random.randint(0,10,size=(10,2))
y = np.random.randint(0,10,size=(10,2))
x and y are 10 x 2 matrix. Now I want to multiply second column of x and y. I did
z = ...
0
votes
3answers
43 views
Array out of bounds error with quick sorting
I'm not sure why, but this keeps giving me an array out of bounds error when I compile it. Assuming the array is initialized correctly to have 10 index positions and I pass to the method 0 and ...
0
votes
0answers
8 views
Articulate storyline Ordering Results
For an Articulate Storyline project i would like to order my results from High to Low and display only the top 5.
Does someone know how you can do this in Articulate storyline or Javascript ?
Kind ...
0
votes
2answers
39 views
Merge two php arrays (or more) to one table
I have 2 arrays:
array 1 contains 2 products.
[records] => Array
(
[0] => Array
(
[productID] => 3347
...
0
votes
2answers
36 views
Serializing object to byte-array in C++
I am working on an embedded device (microcontroller), and I want to save objects to permanent storage (an EEPROM). Most of the serialization solutions I can find, use the file-system in some way, but ...
0
votes
1answer
23 views
Getting wrong result from database - Wrong counting for a specific field in records using PHP
I am trying to count number of a word "Saturday" that's been stored in database records using PHP.
It's not counting correctly.I have in that column only three records : Saturday Saturday Sunday
When ...
1
vote
3answers
40 views
Javascript Return Array of Average Test Results Based on Date
Say that I've got this array:
testResults = [
{
dateCreated: "2014-07-12",
score: 27.1
},
{
dateCreated: "2014-05-11",
score: 99.3,
},
{
...
1
vote
6answers
74 views
finding the second minimum
I want to find the second minimum in a array list.Here's my code.Is there a better way to do it?
int main(){
int a[5]={7,5,45,89,12};
int smallest=a[0];
int index;
for(int ...
0
votes
3answers
25 views
mongodb insert a new field into an array
I am trying to insert a new field to an array of objects
{
"_id": "543356fe0c9af6066e68970c",
"createdDate": "2014-10-06 07:59 pm",
"cancle": false,
"eventDate": "2014/12/12",
...
0
votes
0answers
59 views
Complete a task in a to do list
I've created a to-do list in javascript. But what I can't get right, is a function that completes a task. When a task is completed, I want to add a linethrough on the text. An extra thing that would ...
0
votes
2answers
26 views
Arranging multi-dimensional array populated from different sources
I'm populating a multi-dimensional array from different sources.
This is my array structure:
$feeds[$source][$indexLoop]["Link"] = $link;
$feeds[$source][$indexLoop]["User"] = $username;
...
0
votes
2answers
54 views
Why I can't dereference a two dimentional array?
I have the following code:
void main()
{
int a[3][4] = {{1,2,3,4},{11,12,13,14},{21,22,23,24}};
printf("%d\n",*a);
system("pause");
}
The output is the address of the first element of ...
0
votes
1answer
36 views
spacing between square brackets of an array
I have an array where I would like to put spaces between the [] like :
$array[South Africa]=array();
But I can't... why this is not possible?
0
votes
1answer
10 views
Send empty array from ajax to jersey web server
I try to send array of integers from ajax to jersey web service.
javascript
var myFoods = [];
// adding items via push
$.ajax({
url: "ws/food/" + idParam + "/recomendation",
...
0
votes
1answer
84 views
Array of struct implementation in C
I need some ideas on my array of struct implementation. This is what I have in my structs. I plan on making SHAPES an array because I will have multiple SHAPES. Each shape will have multiple x and y ...
0
votes
1answer
19 views
MongoDB documents of nexted arrays vs dictionaries
I've started logging all the DNS queries from my network, and am wondering which would be the best storage mechanism.
Currently I'm using MySQL, but querying it is a bit cumbersome (a bit slow due to ...
0
votes
0answers
11 views
How to parse a soap xm response into an array
Hi Im not able to parse an XML response into an array
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" ...
-1
votes
1answer
20 views
Graph/2-d array traversal and paths
I'm studying some computer science questions and many questions are about graph traversal and shortest paths. For example, you may be asked to find the shortest path from a point in the graph to ...
0
votes
1answer
18 views
Find Unique line output of a 2 dimensional string array
I have the following string;
string[,] test=
{
{"0","0"},
{"0","0"},
{"0","0"},
{"0","1"},
{"5","0"},
};
I'd like to find a way to search the array for all lines that are unique.
So my ...
-4
votes
3answers
51 views
creating string arrays through for loop, in java
I have a long Array, and for every long value i m using this query to fetch a string Array from sqlite database.
long[] mylong= {1,3,5,6,7};
Dbadapter finaldb = new Dbadapter(this);
for(int i=0; ...
-2
votes
3answers
50 views
Recursively obtaining kth smallest element in an array
I'm trying to "translate" this algorithm from the pseudocode provided in my textbook. My program keeps crashing though, and I'm not really sure where I went wrong with my implementation. Here's the ...
-2
votes
1answer
40 views
Lookup of a number in an array
I wanted to ask what am I doing wrong that is causing the if statement to be false every time I run the program. I've also tried to use .equals(num) instead of the Array.asList(num) to check if the ...
0
votes
1answer
27 views
php invalid argument supplied
thanks for looking at this, I am getting this error.
Warning: Invalid argument supplied for foreach() in /home/chris/public_html/marketplace/add_part.processor.php on line 45
Fatal error: Call to ...
0
votes
3answers
31 views
How to retrieve list of strings in jquery at client side
I have a list at my Home controller that is :
public List<string> BoomList()
{
List<string> BoomList = new List<string>()
{
"Rohit", ...
-2
votes
6answers
52 views
displaying a reversed array? java [on hold]
It prints
Flip Method (only prints 9 to 5 ) but I want it to print from 9 to 0
http://imgur.com/gggiJwn
public static void flip(int[] flp){
System.out.println("This is the flip ...
0
votes
0answers
21 views
checking if char out of not fully filled array is empty
char usr_answer[1000];
int sizeCounter = 0;
std::cin >> usr_answer;
for(char c : usr_answer){
if(strcmp(&c, "\0") == true){
std::cout << "Found";
sizeCounter++;
}
...
0
votes
1answer
27 views
Duplicate entries after using Swap function to sort an array of class objects - C++
First off, I'll admit openly that this is a homework assignment. That being said, my code is VERY close, and hoping for a nudge in the right direction.
The prompt:
Write a complete program to ...
-1
votes
1answer
21 views
php cookie values to javascript array
I need to convert php code to javascript and display it on the html page.
I'm setting my cookie (example with some special errors):
<?php
...
1
vote
5answers
45 views
php array vote by values in array
i have an array with many values and i want to get one value is many show of all values. Like this.
my array
$allValues = array(0,1,1); // i want to get 1, because two 1 vs one 0
// other ...
0
votes
2answers
39 views
“For”-loop ceases to work properly (or I'm doing something wrong)
So the issue here is fairly simple; I have a "for"- loop that doesn't work properly. The "for"-loop is situated at the end of the second class, in the "generateBlock()" method. This "for"-loop is ...
3
votes
3answers
48 views
Trouble with algorithm for multiplying matrix (c++)
Hi I'm helping a friend of mine write a program that multiplies two upper triangular matrices without expanding the matrices. When I say without expanding the matrix, I mean without filling the lower ...
0
votes
2answers
29 views
Assigning Arrays through while-loop [on hold]
I have just started learning about Arrays and I am currently trying to assign values into the arrays using while-loop.
This is my code:
while ( n < 10)
{
if (n ==0)
{
xArray[n] = ...