arrays

Passing a pointer to an array in a different function in C

Ok, so I am trying to pass a pointer rgb that is initialized with memset to 0 and then looped through to place a 32 bit integer only in the bounds that I create with height and width input (h and w) as well as offset from the top left corner of the 2d array (x and y). after compiling, I seem to have the value with printf of the pointer ...

Deep recursive array of directory structure in PHP

I'm trying to put some folders on my hard-drive into an array. For instance, vacation pictures. Let's say we have this structure: Set 1 Item 1 of Set 1 Item 2 of Set 1 Item ... of Set 1 Set 2 Subset 1 of Set 2 Item 1 of Subset 1 of Set 2 Item ... of Subset 1 of Set 2 Subset 2 of Set 2 Random file, not a dir. Set 3 ... I want t...

Read-only array in .NET

Arrays are a fast way to iterate through an unordered set of items, and it's often nice for them to be read-only. While exposing arrays with the `readonly' keyword is useless because the contents of the array can still be altered, a ReadOnlyCollection<T> wrapper solves this. The problem is it's 4 times slower than a plain array in test...

Replace string in javascript array

Hello. I have an array in javascript. This array has strings that contains commas (","). I want all commas to be removed from this array. Can this be done ? Thanks. ...

What's wrong with Collections.sort?

I have these strings in an ArrayList of String in no particular order but when I invoke Collections.sort(listReference), the sorted result is incorrect, why do 10 and 11 (the last 2 characters) come before 07, 08, 09? 12880 20090506054200001 12880 20090506054200002 12880 20090513070200003 12880 20090513070200004 12880 2009052020260...

C#: Nonzero-based arrays are not CLS-compliant

I am currently reading Albahari's C# 3.0 in a Nutshell and on pg. 241, whilst talking about Array indexing, he says this: Nonzero-based arrays are not CLS (Common Language Specification)-compliant What does it mean exactly, for nonzero arrays to not be CLS compliant ? And what implications does it have on your code? [Update] ...

How can I determine if one PGArray is included in another using SQLAlchemy sessions?

I have an SqlAlchemy table like so: table = sql.Table('treeItems', META, sql.Column('id', sql.Integer(), primary_key=True), sql.Column('type', sql.String, nullable=False), sql.Column('parentId', sql.Integer, sql.ForeignKey('treeItems.id')), sql.Column('lineage', PGArray(sql.Integer)), sql.Column('depth', sql.Integer)...

Are the dynamic arrays in DOORS data base worth using?

I am a new developer for a DOORS database and when writing scripts in dxl. If you know there are only 1 dimensional arrays in dxl. I wanted to use more than one dimension so I decided to use a dynamic array, but this slowed my script down a lot, and when we have around 14000 objects per module it would take a day or so for the script to...

How to convert List<Integer> to int[] in Java?

This is similar to this question: http://stackoverflow.com/questions/880581/java-convert-int-to-integer I'm new to Java. How can i convert a List to int[] in Java? I'm confused because List.toArray() actually returns an Object[], which can be cast to nether Integer[] or int[]. Right now I'm using a loop to do so: int[] toIntArray(List...

Converting the "arguments" object to an array in javascript

As a trivia question, I'm trying to write a javascript function that returns its variable number of arguments in sorted (normal lexicographic) order. Having never dealt with javascript before, I came across the "arguments" object, which seems to work somewhat like an array but without having the standard array functions -- therefore I s...

De / Interleave array fast in C#

Hi guys, I am looking for the fastest way to de/interleave a buffer. To be more specific, I am dealing with audio data, so I am trying to optimize the time I spend on splitting/combining channels and FFT buffers. Currently I am using a for loop with 2 index variables for each array, so only plus operations, but all the managed array ch...

How to stringify JSON to JavaScript array

My form in the html DOM is a checkbox to click (there can be more than one). The problem occurs in the description string when ever I use an apostrophe, since my list object is single-quote deliniated. This is one of the checkboxes in the form: <input type="checkbox" id="cbx" name="cbx" value="{'getPic': 'url', 'picsrc': 'http://lh3.g...

What mysqli function should I use?

Hello, I'm currently trying to extract data from a table, and am using this: $online = mysqli_fetch_field(mysqli_query($db, "SELECT `online` FROM `tbl_system` WHERE `property` = 'extranet'")); However, it's not working as echoing $online give "Array". Here's a var_dump from $online object(stdClass)#3 (11) { [...

one line hash creation in ruby

How can I, very simply construct a hash in ruby using something simple like "times" I have a @date (ie = Date.today) and then a number of days... say 5 5.times { |i| @date_range[:day] = (@date+i).strftime("%Y-%m-%d") } I know there's got to be something super simple that's missing. Thanks... ...

Multidimensional Associative Array in VB.NET

Hi can someone show me an example of a multidimensional associative array in vb.net. Need array to hold peoples name, there age and a few other settings. Want to be able to use a Dictionary to use People.Add. Thanks --Mark ...

PHP - Hashed array, insert at Index?

Hi, i wrote an array wrapper class PersonArray which can contain objects of a certain type (Person). Every person has a unique getHash() function which returns the ID + Name as a unique identifier. This allows for speedy retrieval of the Person from the PersonArray. The PersonArray actually holds two internal Arrays. One for the storage...

Extract elements from array so it only consists values of a specified index

I have an array array( array('total'=>10,'v'=>3229), array('total'=>20,'v'=>3129), array('total'=>30,'v'=>3391), ); is there a one line way to convert the above to the following in PHP? array(10,20,30); ...

Cheapest Way To Export/Import Array Contents To File - AS3/AIR

I'm working on a basic editor application. It uses an array of varying size that I want to store to disk. This will eventually be in an AIR application, but for now it's just an AS3 project in Flex. I want to store the array in a file. The application edits the data, so it doesn't need to be human readable. I want it to be in whatever ...

Choose random array element satisfying certain property

Suppose I have a list, called elements, each of which does or does not satisfy some boolean property p. I want to choose one of the elements that satisfies p by random with uniform distribution. I do not know ahead of time how many items satisfy this property p. Will the following code do this?: pickRandElement(elements, p) rand...

How to create a two dimensional array in javascript?

I have been reading online and some places say it isnt possible, some say it is and then give an example and others refute the example, etc. How do I declare a 2 dimensional array in js? (assuming its possible) How would I access its members? (myArray[0][1] or myArray[0,1] ? ) Thanks ...