Some useful Javascript Arrays functions
Created 09 May 2006 00:00

Removing elements

Use this function to remove elements from an array.

Array.prototype.remove = function(index) {
    // create a temporary array, and remove items from the main array 
    // until you get to the index you want - and don't add that element
    var arr = new Array();
    while (this.length > index) {
        var element = this.pop();
        if (this.length > index) arr[arr.length] = element;
    }
    // now go back and add all elements in the temp array back - using 
    // concat() would be cleaner but doesn't seem to work correctly in IE
    while (arr.length > 0) {
        var element = arr.pop();
        this[this.length] = element;
    }
}
For example, to remove element 1 from your array, all you need to do is call

    yourArray.remove(1);

Contains

This function can be used to see if an array contains a certain element.

// Adds a contains() function to the JavaScript array object
// @param	obj		The object to search for - returns true if the array already contains the object, else false
Array.prototype.contains = function(obj) {
  for (var i=0; i<this.length; i++) {
    if (this[i] == obj) return true;
  }
  return false;
}
To see if your element contains a particular object:

    if (yourArray.contains(yourObject)) alert('Yes!');
Manually refreshing Oracle materialized views
Created 18 May 2006 00:00
Manual Refreshes

You can manually refresh a materialized view with the following statement:

  EXECUTE DBMS_SNAPSHOT.REFRESH('mv_your_view', 'c');

where your options are:

  • F, f - fast refresh
  • C, c - complete refresh
  • A - Always perform complete refresh
  • ? - Use the default option