I have this on a javascript var: (it's a http returned data, and I don't know if it's an array or string - (how can we see that?) - Update: using typeof returned "string", so it's a string.
[{"nomeDominio":"gggg.fa"},{"nomeDominio":"rarar.fa"}]
How can we pass/transform that, into something like this:
["gggg.fa","rarar.fa"]
?
Than...
It is clear that the T[] array type is not covariant as the elements of a T[] can be set by index.
And yet, a U[] can be cast to a T[] without any complaints from the compiler as long as U derives from T.
Man[] men = new[] { new Man("Aaron"), new Man("Billy"), new Man("Charlie") };
Person[] people = (Person[])men;
In the above code i...
I have three arrays. The arrays all have the same size and contain the same elements. However, the three arrays must not be in the same order. How do I verify that the elements are not in the same order?
Here's how I've implemented it:
all_elements_equal = true
array1.zip(array2, array3) do |first, second, third|
if ...
Below php code I have selected "Neo" so Neo should not pick in the random selected. And another 2 value should print.
<?php
$input = array("Neo", "Morpheus", "Trinity", "Cypher", "Tank");
$rand_keys = array_rand($input, 2);
echo $input[$rand_keys[0]] . "\n";
echo $input[$rand_keys[1]] . "\n";
?>
And my array is M...
I have the main .cpp file with this:
#include "stdafx.h"
#include "Form1.h"
#include <iostream>
...
#include <stdio.h>
const int MAX_LEN = 1000;
struct DataLine {
char StartCode;
int ByteCount;
int Address;
int RecType;
int DBytes[16];
int Checksum;
};
DataLine AllData[MAX_LEN];
Then I have a form.h with ...
Sorry for the noob question I'm just a little confused.
If I have an array of structures in main that I want to pass to a function:
struct MyStruct{
int a;
int b;
char c;
mayarray[5];
};
MyStruct StructArray[10];
myFunction(StructArray[])
Pass to this to a function:
void myFunction(struct MyStruct PassedStruct...
Hi, I need to add some new values to array by doing something similar.
$array = array();
$array[7] = 'test1';
$array[7] = 'test2';
The problem is that [7] only takes the last value that was added and not test1. Thanks for any help.
...
I found this method:
Array.prototype.compare = function(arr) {
if (this.length != arr.length) return false;
for (var i = 0; i < arr.length; i++) {
if (this[i].compare) {
if (!this[i].compare(arr[i])) return false;
}
if (this[i] !== arr[i]) return false;
}
return true;
}
var a = ['aa'...
I have a long list of words in an array. Some short, some long. I'd like to filter out those words which starts with a word from the array (length of this "prefix" word can be set to, say, 3 characters) and which at the same time ends with a word from it.
Let's say the first word is 'carport'. Now, if 'car' and 'port' exist in the array...
Hi there,
This is my first pathetic attempt at C++. I did an array based stack in C++ and the destructor is throwing out some memory dump. I can't figure out what went wrong.
#include <stdio.h>
#include <iostream>
#include <exception>
using namespace std;
class FullStackException : public exception {
virtual const char* what() ...
In C#, I have an Array of MenuItem. I'm trying to swap the two Objects in index 2 and index 3 of the array without success using the code below:
MenuItem Temp = Items[2];
Items[2] = Items[3];
Items[3] = Temp;
There must be a reason why the second and third lines aren't working in C# which I may not understand yet. Is anyone able...
How to do a Perl program that contains an array and that array points a hash?
It is like this pictorially,
(M1) (M2) ...it goes on
|--k1=>v1 |--K1=>v1
|--k2=>v2 |--k2=>v2
I should access that array M1, then the hash it contains inside. (and so on)...
...
How would I dynamically add a value (push) to an array? I could do this in AS3, but I can't find a function for it in C++.
...
Hi,
I'm dealing with large XML files (several megabytes) for which I have to make various kind of checks. However I have problem with memory and time usage which grows very quickly. I've tested it like this:
$xml = new SimpleXMLElement($string);
$sum_of_elements = (double)0.0;
foreach ( $xml->xpath('//Amt') as $amt ) {
$sum_of_eleme...
Hi
I'm trying to figure out serialization of .net arrays to XML. Here's a piece of code that I've come up with:
public class Program
{
public class Person
{
public string Firstname { get; set; }
public string Lastname { get; set; }
public uint Age { get; set; }
}
...
I have a <textfield> ($_POST['list']).
How can I get value of each line to an array key?
Example:
<textfield name="list">Burnett River: named by James Burnett, explorer
Campaspe River: named for Campaspe, a mistress of Alexander the Great
Cooper Creek: named for Charles Cooper, Chief Justice of South Australia 1856-1861
Daintree River...
Hello all!
I have two Delphi7 programs: a COM automation server (EXE) and the other program which is using the automation server.
I need to pass an array of bytes from one program to the other.
After some searching I've found that using variant arrays is the way to go (correct me please if you know any better methods).
My question is...
So I have this "list" of ints. It could be a Vector, int[], List<Integer>, whatever.
My goal though is to sort the ints and end up with a String[]. How the int array starts out as is up in the air.
ex:
Start with:{5,1,2,11,3}
End with: String[] = {"1","2","3","5","11"}
Is there anyway to do this without a for loop? I have a for ...
I'll start with explaining what my end goal is as there may be better solutions to it.
I have a function called updateUser which accepts the following parameters:
function updateUser($password = NULL, $name = NULL, $lastname = NULL, $age = NULL, $email = NULL, $relation = NULL)
As you can see I've set them to NULL, so if they aren't ...
Its my array:
$hello = Array(
[text] => Array([name] => blabla [num] => 10)
[sometext] => Array([name] => blabla [num] => 2)
[anytext] => Array([name] => blabla [num] => 1)
)
How to sort this array by [num]?
Should look like (on echo):
<ul>
<li>anytext</li>
<li>sometext</li>
<li>text</li>
</ul>
Thanks.
...