This is an array i have
<?php
$page['Home']='index.html';
$page['Service']='services.html';
?>
How do i get to echo something like this for individual one like
Home is at index.html
and again how can i do this through a loop and echo all?
...
I'm trying to come up with an efficient way to overwrite 2 strings that look like this:
str1 = "width=800,height=600,resizable=no,titlebar=no";
str2 = "width=100,height=100";
In the above example, str2 should overwrite str1 to produce str3:
str3 = "width=100,height=100,resizable=no,titlebar=no";
In my tests, I turned str2 into an a...
I need to iterate over an array of arbitrary rank. This is for both reading and writing, so GetEnumerator will not work.
Array.SetValue(object, int) doesn't work on multidimensional arrays.
Array.SetValue(object, params int[]) would require excessive arithmetic for iterating through the multidimensional space. It would also require dyna...
How can I sort an array first by length, then alphabetically?
I have a list of things with numbers on them, and I am currently getting:
Something1
Something10
Something2
Something3
Whereas I want to get:
Something1 Something2 Something3 Something10
...
Hi all,
I am building an android app that needs to download and synchronise with an online database, I am sending my query from the app to a php page which returns the relevant rows from a database in JSON format.
can someone please tell me the best way to iterate through a JSON array?
I receive an array of objects:
[{json object},...
I'm trying to read a config file, and then place the "section" of configs into an array in a bash script, and then run a command off that, and then reitterate through the configs again, and continue to do this until the end of the config file.
Here's a sample config file:
PORT="5000"
USER="nobody"
PATH="1"
OPTIONS=""
PORT="5001"
US...
Hi all,
I have a list in scala called l : List[AType] that I want to change to list[String].
This may sound like a very dirty, inefficient approach, but I'm not quite sure of the best way to do this. My code was:
var result = new Array[String]("a","b")
l foreach { case a => result = result :+ (a.toString().toUpperCase()); }
result toL...
I got the following dictionary:
mydict = {
'foo': [1,19,2,3,24,52,2,6], # sum: 109
'bar': [50,5,9,7,66,3,2,44], # sum: 186
'another': [1,2,3,4,5,6,7,8], # sum: 36
'entry': [0,0,0,2,99,4,33,55], # sum: 193
'onemore': [21,22,23,24,25,26,27,28] # sum: 196
}
I need to efficiently filter out and...
Is this correct?
int (*(*ptr)())[];
I know this is trivial, but I was looking at an old test about these kind of constructs, and this particular combination wasn't on the test and it's really driving me crazy; I just have to make sure. Is there a clear and solid understandable rule to these kind of declarations?
(ie: pointer to... arr...
I have read some posts here about arrays in JNI but since I'm not familiar with JNI at all I still don't know how to create a int array and add some values.
I have two int values and I want to put them into a int array to return that array (at the end of the call).
I think it's something very simple and unfortunately I couldn't do it ye...
Array has total 101 values. This array contains numbers from 1 to 100 and one number is repeating (two times). Write psuedo code to find repeating number.
...
Hi guys,
I've got a bidimensional array of objects (a 2D vector containing GridCell instances) as in here:
typedef vector<GridCell> CellArray;
typedef vector<CellArray> TwoDCellArray;
TwoDCellArray CellArr2D;
I am currently drawing all the cells like this:
for (int i = 0; i < rows; i++){
for (int j = 0; j < cols; j++){
C...
Hi. I have a little problem that I don't understand. I have a db that has an owner and type (and more off course). I want to get a list of all the type values that has owner equal to the current user, but I get only two result
$sql = "SELECT type FROM cars WHERE owner='".mysql_real_escape_string($_SESSION['username'])."' AND selling='0...
Hi,
I need to create a stored procedure which receives a parameter (named @codes).
This is a string which contains a list of codes separated by a semicolumn.
I'd need to look inside a table and return all rows that have a code (which is in the column EANcodes) which was passed in the @codes parameter.
Can anyone help me get started. M...
So I have a CSV file that looks like this:
12345, Here is some text
20394, Here is some more text
How can I insert this into an array that looks like so
$text = "12345" => "Here is some text",
"20394" => "Here is some more text";
This is what I currently had to get a single numerical based value on a one tier CSV
if ...
Ok, so I have this application that takes a adress strings (from values/xml) and parses it your current position) retuning a name, address and distance away. This is then picked up by an arrayadapter and put up on a listview. I cannot for the life of me get the list view to accept an onitemclick to start another activity, where I can ...
I have an array with just a list of ids, like so:
$my_array = array(
12, 17, 99, 23
);
Now I know I could probably do something like:
function in_array($haystack = array(), $needle = NULL)
{
foreach($haystack as $id)
{
if ($id == $needle)
{return TRUE;}
else
{return FALSE;}
}
}
but it seems like there's probably already...
I looked a bit at dynamic arrays in D2, and I found them very difficult to understand. It also seems I'm interpreting the spec wrongly..
Working on a reference or slice of a dynamic array seems very error prone when changing the arrays... Or am I just not understanding the fundamentals?
Referring to the same array only shares the actual...
I have a table with 20 rows and one row have for example:
2,3,5,6,8,22
2,3,5,6,8,22,44,55
etc.
How can I select from mysql table rows only unique numbers, not duplicated so results are:
2,3,5,6,8,22,44,55
The table definition:
CREATE TABLE IF NOT EXISTS `test` (
`id` int(11) NOT NULL auto_increment,
`active` tinyint(1) NOT N...
int[,] arr = new int[2,5];
var rows = arr.?
var cols = arr.?
Assert.Equals(3, rows);
Assert.Equals(6, cols);
...