arrays

Is there something known as Array type mismatch exception in C#?

My teacher has asked me to write a program in C# to handle "Array type mismatch exception". But i couldn't find anything in the net related to that. I just want to confirm if there exists something like that. ...

Converting ruby array to array of consecutive pairs

What is the easiest way to convert a ruby array to an array of consecutive pairs of its elements? I mean: x = [a, b, c, d] → y = [[a, b], [c, d]] ...

How to manipulate data in byte[] fast?

I need to remove every fourth byte in the byte[] I have. Is there some built-in function that could help me to do that or do I have to loop over the array picking and moving each byte one by one? Similarly what what if I need to place 0 after every three bytes from byte[] is there a way to do this faster than manually? ...

c++ return private array

hi, i've a class and there is an array set as private, how do i make the get_array() function i mean how do i return that array knowing that i will have to return a pointer of arr[0] as we know , but isn't this breaking the private rule ? is there other way of returning array ? I actually thought of having array2 in the main , then edit...

array stored as string back into array?

hello - just trying to add some setting for the admin in a database entry. i've saved; array('aviva'=>'aviva','teacher'=>'teacher'); into the field 'fullPara' but can't seem to get it back into an array? Just spits it out as a string and i've tried eval but not sure where to go from here? echo $userTypes['fullPara']; // spits out a...

PHP can I do this loop?

I have a loop (based on an array - which could grow but NOT too much - max 6 keys) e.g.: array('12','34','56',48'). What I would like to do is loop through the array and THEN loop again to find the "previous" array val. For example, key[0] = 12, key[1] = 34 then key[0] = 12, key[2] = 56 then key[1] = 34 etc. The values of the array ar...

Why is Jquery sending "undefined=undefined" as my post parameters instead of sending the array data?

I am attempting to send a javascript array to my web server for an ajax request. Here is my code: function SearchTasksByTags() { // Get the list of tags currently chosen var tags = []; $('.tagit-choice input').each(function () { tags.push($(this).val()); }); // If we have no tags, don't bother searc...

Problem with NSMutableArray and custom NSObject

Hi, I'm really desperate on this one. I'm trying to make a Framework which you can search and play YouTube videos with. But while testing it, I'm running in to a big problem. In the search operation I'm adding YTVideos (a subclass of NSObject) to a NSMutableArray. When I loop thru it in the main(), I'm getting nil-objects: Method - (N...

print out array of arbitrary length

I am trying to print print out an array of integers whose length i dont know in C++. Here is my attempt. int i = 0; while ( X != NULL){ cout << *(X+i) << " "; i+=1; } X is the array. My problem is to stop upon printing last element. ...

Store SQL Server result set into an array with ASP 3.0

My ASP knowledge is shaky--I haven't used it regularly in years. I'm working with an ASP application. It performs a basic search, returning multiple columns and rows: rs = conn.execute("SELECT col1, col2, col3, col4, col5, col6, etc. FROM some tables") While Not rs.EOF Response.Write rs("col1") Response.Write rs("col2") etc. W...

Ideas for importing text data using PHP array functions

Hello, I am new to php and am asking for some coding help. I have little experience with php and have gone to the php.net site and read couple books to get some ideas on how to perform this task. There seems to be many functions and I am confused on what would be the best fit. (i.e. fgetcsv, explode(), regex??) for extracting data in t...

C# | Making a switch to work against items in an array

I'm using authorize.net AIM, the sample code they provide prints an ordered list of the response values. Rather than print out an ordered list to the screen where the customer would see all this information, how do I set up a switch to access certain indexs of the array and do something based on the text returned for the particular array...

Is there any way I can print String array without using for loop?

Is there any function in java like toString() to print a String array? This is a silly question but I want to know if there is any other way than writing a for loop. Thanks. ...

array_push key=>value , how can do it?

Hi , all I want to push key and value in array , but I can't $con = mysqli_connect('localhost','root','','wp') or die (mysqli_error('Error:')); $query = mysqli_query($con,'set names utf8')or die (mysql_error()); $qy = mysqli_query($con,"SELECT ID,post_title FROM wp_posts WHERE post_type='page' AND post_status='publish'")or die (mysql...

PHP: How to get sum of elements of 2 dimension array ?

I want to get total of elements of each row at the end of that row and total of elements of each column at the end of each column. For Example: I have an array with digits values like this: $twoDimArr = array( array("1" , "2" , "3" , "4"), array("1" , "2" , "3" , "4"), array("1" , "2" , "3" ,...

Ruby - pick randomly from an array

I want to know if there is a much cleaner way of doing this. Basically, I want to pick a random element from an array of variable length. Normally, I would do it like this: myArray = ["stuff", "widget", "ruby", "goodies", "java", "emerald", "etc" ] item = myArray[rand(myarray.length)] Is there something that is more readable / simple...

Deleting char array returned by getenv()

Should I free the memory allocated for the char array, pointer to which is returned by the char * getenv( char * ) function? And which way - C free() or C+ delete []? If no - why? I mean: char * ptr = getenv( "LS_COLORS" ); cout << ptr << endl; delete [] ptr; //Is this or free() call needed? Thank you. ...

How to handle ((List<string>)Session.Add("")

((List<string>)Session["answera"]).Add(xle.InnerText); I need to perform this operation, but I get "Object reference not set to an instance of...." I don't want to use List<string> ast = new List<string>(); ast.Add("asdas!"); Session["stringList"] = ast; List<string> bst = (List<string>)Session["stringList"]; as I mer...

PHP class public parameter as two dimensional array, how?

Ok, so I have a class and I would like to be able to get any trackName (two dimensional array) after initializing an object in another php script. This is a part of the class that is relevant: class fetchData{ public $artistName; public $trackName; public function getArtistTracks(){ $i = 0; if( $tracks = getTracks() ){ ...

return multiple arrays from a query

i have 2 tables 1st table called services has id_service, name, date. description 2nd table called services_images has id_img, img_name,id_service Let's say now that I have to, with one query (if possible), return 2 arrays 1st array with fields from one specific id from table "services" 2nd array with fields from all the images relat...