arrays

Function pointer arrays in Fortran

I can create function pointers in Fortran 90, with code like real, external :: f and then use f as an argument to another function/subroutine. But what if I want an array of function pointers? In C I would just do double (*f[])(int); to create an array of functions returning double and taking an integer argument. I tried the most o...

Array from Requests

Hi ive set up 2 scripts, both communicating back and forth. One thing id like is for 1 script to post an unknown amount of GETs to the other script. Id like the other script to some how be able to grab all the GETS and put the values in an array. ...

Generic Vector in Java

Hi, Why doesn't the add() method here compile? Vector<?> vectorList[] = new Vector<?>[10]; vectorList[0].add("elem1"); Thanks ...

XCode: How to adress dynamic Variables?

I want to do something like that: for (v=1;v=150;v++) { for (h=1; h=250;v++) { tile_0%i_0%i.image = [UIImage imageWithData:tmp_content_of_tile]; //1st %i = v; 2nd %i = h } } In the %i should be inserted the current value of "v" or "h"? Is it possible? How is it called? Greets! ...

make username and userid into array php

i want to my array , somthing like this manner array("userid"=>"username","1"=>"ganeshfriends","2"=>"tester") mysq query somthing like this $query = select username, userid from tbluser $result = mysql_query($query); while($row = mysql_fetch_array($result)){ $items = array($row['userid']=>$row['username']); } print_r($items)...

JExcel doesn't copy Array formula

I open excel file by JExcel, modify some cells and save it. As result Array formulas({ ... } CTRL+SHIFT+ENTER) was broken. Does anybody know what to do? (FormulaException is rasing during copy) ...

swfupload destroy session? php

hy, i need a little help here: i use SWFupload to upload images! in the upload function i make a folder call $_SESSION['folder'] and all the files i upload are in 1 array call $_SESSION['files'] after uploads finish i print_r($_SESSION) but the array is empty? why that? this is my upload.php: if($_FILES['image']['name']) { list(...

Functional way to get a matrix from text

I'm trying to solve some Google Code Jam problems, where an input matrix is typically given in this form: 2 3 #matrix dimensions 1 2 3 4 5 6 7 8 9 # all 3 elements in the first row 2 3 4 5 6 7 8 9 0 # each element is composed of three integers where each element of the matrix is composed of, say, three integers. So this example should...

How do I code a loop for my echo statement?

I get only one printed result in the foreach echo loop at the bottom of the page. <?php defined('_JEXEC') or die('Restricted access'); $db =& JFactory::getDBO(); $query0 = "SELECT * FROM `jos_ginfo` WHERE . . . LIMIT 30"; //echo $query0; $db->setQuery($query0); $ginfo = $db->loadObjectList(); //echo /...

javascript "associative" array access

Hello I have a simple simulated aarray with two elements: bowl["fruit"]="apple"; bowl["nuts"]="brazilian"; I can access the value with an event like this: onclick="testButton00_('fruit')">with `testButton00_` function testButton00_(key){ var t = bowl[key]; alert("testButton00_: value = "+t); } However whenever I try to acc...

Inserting only unique values into an array

I have a set of values that I'm pushing into an array in the order they occur $valsArray = array(); //I process each value from a file (code removed for simplicity) //and then add into the array $valsArray[] = $val; How do I turn this into an associative array instead where the value gets inserted (as $key of associative array)...

How to define and work with an array of bits in C?

I want to create a very large array on which I write '0's and '1's. I'm trying to simulate a physical process called random sequential adsorption, where units of length 2, dimers, are deposited onto an n-dimensional lattice at a random location, without overlapping each other. The process stops when there is no more room left on the latt...

How can I sort an array so that certain file extensions sort to the top?

I have an array containing a list of files. I want to sort it in a way that it will let me have .txt files in the beginning of the array and the rest of files after that. This is what I'm doing now, which works fine. @files = (grep(/\.txt$/,@files),grep(!/\.txt$/,@files)); Is there a better way to do it though? ...

PHP: Next Available Value in an Array, starting with a non-indexed value

I've been stumped on this PHP issue for about a day now. Basically, we have an array of hours formatted in 24-hour format, and an arbitrary value ($hour) (also a 24-hour). The problem is, we need to take $hour, and get the next available value in the array, starting with the value that immediately proceeds $hour. The array might look so...

adding to json property that may or may not exist yet

let say i want to do this var dasboard = {}; var page = "index"; $('.check').click(function(){ $(this).toggleClass("active").siblings().slideToggle('slow', function() { dashboard['pages'][page][$(this).closest('li').attr("id")]['show'] = $(this).is(":hidden") ? 'collapsed' : 'expanded'; }); } i get an error s...

Accumulate 2D Array by Index

I have an array that looks like this: Array ( [0] => Array ( [amount] => 60.00 [store_id] => 1 ) [1] => Array ( [amount] => 40.00 [store_id] => 1 ) [2] => Array ( [amount] => 10.00 [store_id] => 2 ) ) W...

Simple javascript string problem in ie6 and ie7

I have a very simple function that takes a list of comma separated (x,y) points and imports them into a graph. I have FF, Chrome and IE8 installed. I use IETester to test for IE6 and IE7. // Import Data this.Import = function(data) { alert("Data in: "+data); var d; // Make sure the first and the last are start/ending pare...

Initalizing an array before initalizing a pointer to that same array

I want to initialize an array and then initialize a pointer to that array. int *pointer; pointer = new int[4] = {3,4,2,6}; delete[] pointer; pointer = new int[4] = {2,7,3,8}; delete[] pointer; How can I do this? ...

Tutorials and Introductions to C++ Expression Templates

What are good introductions to the creation of C++ expression template systems? I would like to express arithmetic on user defined types while avoiding temporary values (which may be large), and to learn how to do this directly rather than applying an existing library. I have found Todd Veldhuizen's original paper and an example from th...

how to generate random number from array

How to generate random number from an array? and not from a range. int n [] = {1,7,3,5,8,10,33,12,18} ...