arrays

Variable Sized Arrays in C

On the discussion of dynamic memory here: "Intro to C Pointers and Dynamic Memory" The author states: A memory block like this can effectively be used as a more flexible array. This approach is actually much more common in real-world C programs. It's also more predictable and flexible than a "variable size array" The type of memor...

How to expand a PowerShell array when passing it to a function

I have two PowerShell functions, the first of which invokes the second. They both take N arguments, and one of them is defined to simply add a flag and invoke the other. Here are example definitions: function inner { foreach( $arg in $args ) { # do some stuff } } function outer { inner --flag $args } Usage would loo...

Is it possible to increase the max columns of an Oracle database to store huge arrays?

For reasons that are beyond my control I need to store huge arrays (10000+ entries) in database rows, and it has to be easy to access each index of the array individually, which means I'd rather avoid serialization/blobs, if at all possible. So my first idea, and the actual question here, is can I increase max columns for Oracle in anyw...

double dimensional array value from php

Dear All I have a PHP file going to write a two-dimensional array in javascript: <?php print "<script language='javascript'>"; print " extra[0][0]=new Array(1,'Bob',12);"; print " extra[0][1]=new Array(2,'Alice',18);"; .. // need to assign the extra[1][0],extra[1][1] so on. print "</script>"; ...

Size of static array

I declare a static char array, then I pass it to a function. How to get the no. of bytes in the array inside the function? ...

Difference in initalizing and zeroing an array in c/c++ ?

In c (or maybe c++) , what's the difference between char myarr[16]={0x00}; and char myarr[16]; memset(myarr, '\0', sizeof(myarr)); ?? edit: I ask this because in vc++ 2005 the result is the same.. edit more : and char myarr[16]={0x00,}; ? maybe can get more comprehensive answer and not ambigous as some answers below re...

javascript arrays and type conversion inconsistencies

I have been playing with javascript arrays and I have run into, what I feel, are some inconsistencies, I hope someone can explain them for me. Lets start with this: var myArray = [1, 2, 3, 4, 5]; document.write("Length: " + myArray.length + "<br />"); for( var i in myArray){ document.write( "myArray[" + i + "] = " + myArray[i] + "<...

Performance of Arrays vs. Lists

Say you need to have a list/array of integers which you need iterate frequently, and I mean extremely often. The reasons may vary, but say it's in the heart of the inner most loop of a high volume processing. In general, one would opt for using Lists (List) due to their flexibility in size. On top of that, msdn documentation claims List...

Difference between "int[] myArray" and "int myArray[]" in Java

Possible Duplicate: Difference between int[] array and int array[] I've wondered for a long time whether or not there is a difference between the following: int[] myArray; and, int myArray[]; ...

Pop off array in C#

I've got a string array in C# and I want to pop the top element off the array (ie. remove the first element, and move all the others up one). Is there a simple way to do this in C#? I can't find an Array.Pop method. Would I need to use something like an ArrayList? The order of the items in my array is important. ...

Opposite of String.Split with separators (.net)

Is there a way to do the opposite of String.Split in .Net? That is, to combine all the elements of an array with a given separator. Taking ["a", "b", "c"] and giving "a b c" (with a separator of " "). UPDATE: I found the answer myself. It is the String.Join method. ...

Are there O(1) random access data structures that don't rely on contiguous storage?

The classic O(1) random access data structure is the array. But an array relies on the programming language being used supporting guaranteed continuous memory allocation (since the array relies on being able to take a simple offset of the base to find any element). This means that the language must have semantics regarding whether or n...

dynamic allocating array of arrays in C

I don't truly understand some basic things in C like dynamically allocating array of arrays. I know you can do: int **m; in order to declare a 2 dimensional array (which subsequently would be allocated using some *alloc function). Also it can be "easily" accessed by doing *(*(m + line) + column). But how should I assign a value to an ...

Emulating HTTP POST using command line curl and exporting output to text file

How do I emulate an HTTP POST request using curl and capturing the result on a text file? I already have a script called dump.php: <?php $var = print_r($GLOBALS, true); $fp = fopen('raw-post.txt','w'); fputs($fp,$var); fclose($fp); ?> I did a simple test by doing: curl -d 'echo=hello' http://localhost/dump.php but I didn't ...

How can I print out string records stored in a two-dimensional array?

I am working on a project using C. I store several records in a two-dimensional array of strings, where one string is the record name and the other string is the actual value. For example: myArray[0][0] = "filename1"; myArray[0][1] = "somefile.txt"; myArray[1][0] = "filename2"; myArray[1][1] = "anotherfile.txt"; // and so on ... I kno...

The Most Efficient Algorithm to Find First Prefix-Match From a Sorted String Array?

Input: 1) A huge sorted array of string SA; 2) A prefix string P; Output: The index of the first string matching the input prefix if any. If there is no such match, then output will be -1. Example: SA = {"ab", "abd", "abdf", "abz"} P = "abd" The output should be 1 (index starting from 0). What's the most algorithm way to do this ki...

C# Remove element of a regular array

I have an array of Foo objects and i need to remove the second element of the array i need something similar to RemoveAt but for a regular array. ...

VB.NET Problem with "Control Arrays"

I have a VB.NET application and use some third party (closed source) ActiveX controls. One of the controls represents a "camera" (connected over several interfaces) and I try to write an example how to work with several cameras in one application. To do this I allocate multiple "camera" objects dynamically as an array which works as expe...

searching for and matching elements across arrays

I have two tables. In one table there are two columns, one has the ID and the other the abstracts of a document about 300-500 words long. There are about 500 rows. The other table has only one column and >18000 rows. Each cell of that column contains a distinct acronym such as NGF, EPO, TPO etc. I am interested in a script that will ...

Convert a multidimensional javascript array to JSON?

What is the best way of converting a multi-dimensional javascript array to JSON? ...