I am planning to implement a bounded queue without using the Queue<T> class. After reading pros and cons of Arrays and LinkedList<T>, I am leaning more towards using Array to implement queue functionality. The collection will be fixed size. I just want to add and remove items from the queue.
something like
public class BoundedQueue<T>...
I need to describe an associative array in which to search, you can use the key and value. With functions add, delete, getBy1st (search by key), getBy2nd (search by value).
For example in C++:
symmap<std::string, int> m;
m.insert(make_pair<std::string,int> ("hello", 1));
m.insert(make_pair<std::string,int> ("wow", 2));
...
m.getBy1st(...
I'm getting an array of values back from a database where I get an array with values like this:
Array ( [6712] => 64.79.197.36:43444 [6712] => 64.79.197.36:43444 [6711] => 64.79.194.56:41113 [6710] => 64.21.47.20:8080 [6709])
Where the numbers in brackets, like [6712] are the "id" field in the database.. the issue is that in my scrip...
Hi,
There is an array of numbers, the number on each cell display how many setps does you need to go (left or right), for exmpple
int[2]=4 that means that you have to go 4 steps or to int [-2] or to int[6] you have to return true if you went trough all the cell and did not went "out" of the array and false if not.
Thanks a lot
...
Please help. I need randomly generate an 2 dimensional nXn array .
lets take for now n=10;
array should have such structure. one example
$igra[]=array(0,1,2,3,4,5,6,7,8,9);
$igra[]=array(6,9,1,5,0,2,7,3,4,8);
$igra[]=array(2,5....................
$igra[]=array(1,7.....................
$igra[]=array(5,4...................
$igra[]=arr...
Hi,
I am sending data via get and I need to put it into a int array to be used in a find.
here is my code :
@found = Array.new
params['candidate'].each do |c|
@found << c.to_i
end
My url looks like this
http://localhost:3000/export/candidate?candidate[]=3&candidate[]=4&commit=Export
If it makes any difference I am u...
I have txt file with email addresses under under the other like :
[email protected]
[email protected]
So far I managed to open it with $result = file_get_contents("tmp/emails.txt"); but I don't know to to get the email addresses in an array. Basically I could use explode but how do I delimit the new line ?
thanks in advance for any answer ...
It's as easy as the title sounds; I need to get the index/key of the last inserted item. Why is this difficult? See the following two code samples:
$a=array();
echo 'res='.($a[]='aaa').' - '.(count($a)-1).'<br>';
echo 'res='.($a[]='bbb').' - '.(count($a)-1).'<br>';
echo 'res='.($a[]='aaa').' - '.(count($a)-1).'<br>';
die('<pre>'.print_r...
I've got a char* buffer to hold a file that i read in binary mode. I know the length of the file is 70 bytes and this is the value being used to produce a buffer of the correct size. The problem is, there is 17 or 18 extra spaces in the array so some random characters are being added to the end. Could the be a unicode issue?
ulFLen stor...
We gave a given array which can be in 4 states.
array has values that are:
only arrays
only non-arrays
both array and non array
array has no values
...
example:
<?php
$string = "This is some text written on 2010-07-18.";
preg_match('|(?<date>\d\d\d\d-\d\d-\d\d)|i',$string,$arr_result);
print_r($arr_result);
?>
returns:
Array
(
[0] => 2010-07-18
[date] => 2010-07-18
[1] => 2010-07-18
)
but I want it to be:
Array
(
[date] => 2010-07-18
)
in php's pdo object there ...
Hey guys,
Consider a list of numbers L=. We can only have the series between +=2^j, while 0<=j<=32.We have to implement an algorithm which implements the largest product.
...
I'm currently going through K.N. King's C Programming: A Modern Approach. I've made it past the text for the 8th chapter (Arrays), and I'm eager to move on to chapter 9, but I've yet to solve the so-called "programming projects" at the end of each chapter. Unfortunately, the 14th... bugs me.
Write a program that reverses the words in...
Hi All,
So I'm trying to create a function that generates a SQL query string based on a multi dimensional array.
Example:
function createQueryString($arrayToSelect, $table, $conditionalArray) {
$queryStr = "SELECT ".implode(", ", $arrayToSelect)." FROM ".$table." WHERE ";
$queryStr = $queryStr.implode(" AND ",$conditionalArray); /*NE...
my code is :
class demo(BaseRequestHandler):
def get(self):
a=[[1,2,3],[3,6,9]]
self.render_template('map/a.html',{'geo':a})
and the html is :
{% for i in geo %}
<p><a href="{{ i[0] }}">{{ i[0]}}</a></p>
{% endfor%}
and the error is :
raise TemplateSyntaxError, "Could not parse the remainder: %s" % to...
i have this array:
[2] => Array
(
[type] => jpg
[name] => 25.jpg
)
[3] => Array
(
[type] => jpg
[name] => 26.jpg
)
[8] => Array
(
[type] => jpg
[name] => 27.jpg
)
[13] => Array
(
[type] => jpg
[name] => 10.jpg
)
[14] => Array
(
...
How do I read every line of a file in Python and store each line as an element in an array?
I want to read the file line by line and each line is appended to the end of the array. I could not find how to do this anywhere and I couldn't find how to create an array of strings in Python.
...
How do i sort this array by ssup asc?
[xml] => Array
(
[sale] => Array
(
[0] => Array
(
[ref] => 316205
[line] => 3
[partno] => MC41SS
[cust] =...
Why does it complain about it not being able to convert a string array to a string when the values are strings within a string array
Code:
int i;
string[] Filenames;
OpenFileDialog UnConvertedFilesList = new OpenFileDialog();
if (UnConvertedFilesList.ShowDialog() == DialogResult.OK)
{
...
Hello
what is the easiest way to change this array to 1D array, i can do that using for loop or foreach, but i'm curious to check if there is an easier way. THANKS
Array
(
[0] => Array
(
[id] => 1
)
[1] => Array
(
[id] => 2
)
[2] => Array
(
[id] =...