arrays

XL VBA - Passing an array in a user defined function?

How to pass an array as a parameter for a user defined function in MS Excel VBA? Eventually I want to test that if a given date (dateDay) is in several ranges of dates (arrayVacation): Function CB_IsInRangeArr(dateDay As Date, ParamArray arrayVacation() As Variant) As Boolean ' Test that the array is in the form of 2 columns and n...

How to reinitialize the int array in java

class PassingRefByVal { static void Change(int[] pArray) { pArray[0] = 888; // This change affects the original element. pArray = new int[5] {-3, -1, -2, -3, -4}; // This change is local. System.Console.WriteLine("Inside the method, the first element is: {0}", pArray[0]); } static void Main() ...

VBScript function to create a two-dimensional array, like GetRows does

This is asp classic using VBScript, and no, it ain't moving to .net anything, so don't even ask. OK, so the classic way to get data out of a database is to use GetRows: Dim MyRecords Dim rs, conn [...database opening stuff...] If Not rs.EOF Then MyRecords = rs.GetRows End If [...close database & set to Nothing...] Note how MyReco...

Problem with returning rows using PHP

<?php if (isset($_GET['flyerID'])) $FlyerID = $_GET['flyerID']; $DBConnect = @mysqli_connect("host", "UN", "pword") Or die("<p>Unable to connect to the datbase server.</p>" . "<p>Error Code ".mysqli_connect_errno().": ".mysqli_connect_error()) . "</p>"; $DBName = "agentsleuthdb"; @mysqli_select_db($DBConnect, $DBName) O...

Is there a Perl shortcut to count the number of matches in a string?

Suppose I have: my $string = "one.two.three.four"; How should I play with context to get the number of times the pattern found a match (3)? Can this be done using a one-liner? I tried this: my ($number) = scalar($string=~/\./gi); I thought that by putting parentheses around $number, I'd force array context, and by the use of scal...

Objective-C Array Iteration Speed

I'm working on an application, I have a NSMutableArray that stores 20 or so sprites. I need to iterate through it fairly quickly and efficiently. The speed for my purposes is not optimal... I'm getting two values from each sprite as it iterates through, would it be more efficient (faster) to iterate through an array of say CGPoints then ...

Checking an array of data for similar elements in C

Hi, I created an "address" structure. Each address (xx.yy.zz.mm) consists of an xx, yy, zz and mm element, all of which are ints. Each address also has a "name" element associated with it. I have an array of up to 100 addresses called "network". Here is an example of some elements in network: 186.88.1.21 Tyler 186.88.9.11 Bob 101.21.0...

Allocation order on the stack

I'm running this C code #define STACKSIZE 65536 char d[STACKSIZE]; if (((int) &d[STACKSIZE-1]) - ((int) &d[0]) + 1 != STACKSIZE) { Printf ("Stack space reservation failed\n"); Exit (); } printf("Allocated from %d to %d so for %d bytes\n", &d, ...

Load a DateTime array into ListBox?

How can I save a Properties.Settings.Default.Array using DateTime format (with just the time)? ...

for vs foreach vs while which is faster for iterating through arrays in php

which one is the fastest for iterating through arrays in php? or does another exist which is also faster for iterating through arrays? ...

Cleaning up a PHP array to make it 0 based again

I sometimes end up having data in an array that starts far into the array, at position 25 instead of 0 for example. Example: Array ( [16] => Array ( [0] => http://rapidshare.com/files/268123830/hmh.fo3-oks.part01.rar [1] => Marked as illegal ) [17] => Array ( [0] => h...

C# volatile array items?

Hi I need an array with volatile items, and can't find a way to do that. private volatile T[] _arr; This means that the _arr reference is volatile, however it does not guarantee anything about the items inside the _arr object itself. Is there any way to mark the _arr's Items as volatile? Thanks. EDIT: The following code built acc...

Query to find most common names in content, from a defined list

Hi, I have been struggling to find a way to rank blog post articles by popularity of names that appear in them. Here's what I'm trying to achieve: I have a blog where celebrity names commonly appear. I would like to count how many times these celebrity names appear in the blog titles, and rank the output by most popular celebrity (name ...

How to take out the first part of array?

The following function out-puts an array and html. I don't want to have <li><a href="http://127.0.0.1/ci_okadadesign/index.php/admin/menus/r"&gt;r&lt;/a&gt;&lt;/li&gt; Could anyone tell me how to achive it please? Function function getTopMenus(){ $data[0] = 'root'; $this->db->where('parentid',0); $Q = $this->db->ge...

Php form validation with an array - print the name of a variable

Hi, I am trying to do form validation by putting the post values into variables and those variables into an array and then cycling through them and outputting error messages for fields that are not filled in. I am having two issues. Firstly, the if statement is running for all the values even if the field is empty or is == to 'undefined...

How do I create a regularly-spaced array of values in MATLAB?

How do I make an array that's defined with a start point, an end point, and a total array size? Something like an array that goes from 1 to 10 that's 20 elements long. For example, the array could look something like: 1 1.5 2 2.5 3 3.5 ... ...

Adding DateTime to ListView?

How can I add a DateTime value along with 2 string values into a ListView? I've tried... String[] row = { Time.Value.ToString(), "Example Text", "Example Text"}; listView1.Items.AddRange(row); but I get conversion errors. ...

Loading data from file in C

i am really struggling to load some numeric floating point data from a file into a C program...the file has floating point numbers with precision of 3 decimal points, each of which is in a single line...i wanted to load these values into an float array and then perform some calculations in it...however i tried loading it into an array of...

Question about an array in gallery2

I'm working on a modification from a theme in the open source project "gallery2". Here is the code that I am looking at: For anyone familiar with it, its in the SearchShowAll.tpl file in the search module in the modules section of the download. <ul class="giInfo"> {foreach from=$result.fields item=field } <li> ...

jQuery storing and referring to an array of items

I'm not exactly what I'm looking for in jQuery/Javascript terms. The behavior I'm looking for is akin to your typical lightbox slide show with the following elements: a list of items clicking on an item will bring up a new element that references the item in the list while the new element includes next/prev navigation that refers back ...