I'm working on a form that lets folks choose their preferred methods of contact. Among other things, the form consists of 9 checkboxes (3 sets of three) that I'm trying to store in my database as JSON.
Here's the pertinent parts of the form...
<h1 style="padding-top:25px;">Communication Preferences</h1><hr />
<div class="onethird cont...
I have an array of 'questions' ordered according to their number of votes, and want to show the question immediately before and immediately following the currently-selected question.
Let's say the currently-selected question is stored in the variable @question, and I'm showing a list of other questions associated with the same user. Thi...
I'm using the code below to return and echo an array. If I define ' mysqli_fetch_array($results, MYSQLI_BOTH) ' then my array is truncated by one result. The 1st result in the array drops off the list. If I remove the MYSQLI_BOTH then I get the results that I expect, but my hosting company (Dreamhost) throws this error:
Warning: mysqli_...
I want to use the value of a variable as an "index" of an object, an of a value inside of it.
Unfortunately this code won't run.
animatedObjects = {
userPosition.uid: {
"uid": userPosition.uid,
"x": 30,
"y": 31
}
}
Wher...
Hello SO community!
I'm trying to take 9x9, 12x12, 15x15, etc. arrays and have the program interpret them as multiple 3x3 squares.
For example:
0 0 1 0 0 0 0 0 0
0 0 0 0 0 2 0 0 0
0 0 0 0 0 0 0 3 0
0 0 0 0 0 0 6 0 0
0 0 4 0 0 0 0 0 0
0 0 0 0 0 5 0 0 0
0 0 0 0 0 0 0 0 0
0 7 0 0 0 0 0 0 0
0 0 0 0 8 0 0 0 9
Will be understood as:
0 0 ...
I'm taking a stab at writing a Bash completion for the first time, and I'm a bit confused about about the two ways of dereferencing Bash arrays (${array[@]} and ${array[*]}).
Here's the relevant chunk of code (it works, by the way, but I would like to understand it better):
_switch()
{
local cur perls
local ROOT=${PERLBREW_ROO...
hi!
i have a problem with saving something and am officially out of ideas.
what i want to do is save an integer array into the userDefaults, then when restarting the app loading this array and restart the game from this last point.
what i do is that after each turn my AI logic saves the actual game state into an array -> so far so goo...
I just learned about jquery's .makeArray and I am trying to use JSON.stringify to store the array in localStorage but I am having unexpected results.
This works:
var links = {'one': 1, 'two': 2 };
var setstr = JSON.stringify(links);
localStorage.setItem('strlinks', setstr);
var getstr = localStorage.getItem('strlinks');
console.log(ge...
I have an array of people's names:
Array
(
[1] => A. Aitken
[2] => A. C. Skinner
[3] => A. Chen
[4] => R. Baxter
)
What's the quickest way to sort the array in (alphabetical) order of the surname in php? i.e. to give
Array
(
[1] => A. Aitken
[4] => R. Baxter
[3] => A. Chen
[2] => A. C. Skinner
)
...
I am trying to send a jquery sortable list of items to my MVC method for data processing. Currently I am trying to send it via the following code:
var data = {};
data.projectId = projectId;
data.publishedSectionIds = $('#section_list').sortable('toArray');
// Perform the ajax
$.ajax({ url: '/Project/Publish',
type: 'POST',
dat...
i have an ole Object created with (simple verion)
obj := CreateOleObject('foo.bar');
obj.OnResult := DoOnResult;
procedure TMyDM.DoOnResult(Res: olevariant);
which all works, the res variable has a function String[] GetAns()
which im calling like this
var
ans: array of string;
begin
ans := Res.GetAns;
end;
which again works.. ex...
String input = txtInput.getText();
char[] charArray = input.toCharArray();
char[] flipArray = null;
System.out.println(charArray.length);
for (int i = 0; i < charArray.length ; i++) {
System.out.println(charArray[i]);
sorry if the code doesn't make much sense.
charArray is taken from a JTextField .
So the code should do somethi...
What is the proper way to initialize an empty array in Tcl?
I have the following code (simplified):
proc parseFile {filename results_array} {
upvar $results_array results
set results(key) $value
}
set r1 {}
parseFile "filename" r1
and I get the error:
Error: can't set "results(key)": variable isn't array
...
I want to get an array of bytes (Array[Byte]) from somewhere (read from file, from socket, etc) and then provide a efficient way to pull bits out of it (e.g. provide a function to extract a 32-bit integer from offset N in array). I would then like to wrap the byte array (hiding it) providing functions to pull bits out from the array (pro...
I don't know if the title explains it very well, so here's what I'm trying to achieve.
With this script people can change the value of configuration variables on the fly like so:
Config::write('General.load', array('plugin1','plugin2'), true);
In that example, it changes the General.load config variable to an array, and sets the 3rd p...
I have an unsorted array, what is the best method to remove all the duplicates of an element if present?
e.g:
a[1,5,2,6,8,9,1,1,10,3,2,4,1,3,11,3]
so after that operation the array should look like
a[1,5,2,6,8,9,10,3,4,11]
...
Hi,
I have defined a constant array in one of my classes as:
static const float values[] = {-0.5f, -0.33f, 0.5f, -0.33f, -0.5f, 0.33f,};
In the dealloc method of my class, do I need to free the memory occupied by this field? How do I do it? Should I use NSArrays instead?
...
Given the following dates:
6/30/2010 - 7/6/2010
and a static variable:
$h = 7.5
I need to create an array like:
Array ( [2010-06-30] => 7.5 [2010-07-01] => 7.5 => [2010-07-02] => 7.5 => [2010-07-05] => 7.5 => [2010-07-06] => 7.5)
Weekend days excluded.
No, it's not homework...for some reason I just can't think straight today.
...
I have an array of regular expressions and am trying to loop through a text document to find the first pattern, assign that as the key to an array then continue through find the second pattern and assign that as the value. Whenever I come across pattern 1 I want that to always be assigned as a key and all pattern 2 matches that follow un...
Hello,
Let's imagine that we have two arrays
$array_1 = array(
'0' => 'zero',
'1' => 'one',
'2' => 'two',
'3' => 'three',
);
$array_2 = array(
'zero' => '0',
'one' => '1',
'two' => '2',
'three' => '3',
);
Now, I'd like to insert array('sample_key' => 'sample_value') after third element of each array. How can I d...