Sunday, November 9, 2008

Search on single field using SearchView

If you want to search a view for specific field value then you can use SearchView as shown below.

Ex. If you want documents having "Yes" as value for "IsActive" Field then you can use SearchView as given below.

http://server/dbname.nsf/viewname?SearchView&QUERY=FIELD%20IsActive=Yes

Wednesday, October 22, 2008

"splice" - JS method to add/remove array elements

Definition and Usage

The splice() method is used to remove and add new elements to an array.

Syntax

arrayObject.splice(index,howmany,element1,.....,elementX)

 

Parameter

Description

index

Required. Specify where to add/remove elements. Must be a number

howmany

Required Specify how many elements should be removed. Must be a number, but can be "0"

element1

Optional. Specify a new element to add to the array

elementX

Optional. Several elements can be added

 


Example

In this example we will create an array and add an element to it:

<script type="text/javascript">
var arr = new Array(5);
arr[0] = "Jani";
arr[1] = "Hege";
arr[2] = "Stale";
arr[3] = "Kai Jim";
arr[4] = "Borge";
document.write(arr + "<br />");
arr.splice(2,0,"Lene");
document.write(arr + "<br />");
</script>

The output of the code above will be:

Jani,Hege,Stale,Kai Jim,Borge
Jani,Hege,Lene,Stale,Kai Jim,Borge

 


Example

In this example we will remove the element at index 2 ("Stale"), and add a new element ("Tove") there instead:

<script type="text/javascript">
var arr = new Array(5);
arr[0] = "Jani";
arr[1] = "Hege";
arr[2] = "Stale";
arr[3] = "Kai Jim";
arr[4] = "Borge";
document.write(arr + "<br />");
arr.splice(2,1,"Tove");
document.write(arr);
</script>

The output of the code above will be:

Jani,Hege,Stale,Kai Jim,Borge
Jani,Hege,Tove,Kai Jim,Borge

 


Example

In this example we will remove three elements starting at index 2 ("Stale"), and add a new element ("Tove") there instead:

<script type="text/javascript">
var arr = new Array(5);
arr[0] = "Jani";
arr[1] = "Hege";
arr[2] = "Stale";
arr[3] = "Kai Jim";
arr[4] = "Borge";
document.write(arr + "<br />");
arr.splice(2,3,"Tove");
document.write(arr);
</script>

The output of the code above will be:

Jani,Hege,Stale,Kai Jim,Borge
Jani,Hege,Tove


Ref Link : http://www.w3schools.com/jsref/jsref_splice.asp

Monday, October 13, 2008

JavaScript function equivalent to Arraygetindex

 
This js function will find the index of an array element with the given value in an array.
for Example you are having an array like
var mnuArray = new Array("Groups","Services","Applications");
And want to know the index/position of and element in an array, then
Ex. you can call mnuArray.findIndex("Services");
This will return "1″.
 
This will be helpful if you are having a large size array/the elements are unknown which you have populated from an dB
 
Array.prototype.findIndex = function(value){
var ctr = "";
for (var i=0; i < this.length; i++) {
// use === to check for Matches. ie., identical (===), ;
if (this[i] == value) {
return i;
}
}
return ctr;
};
And advanced version of this function is,
If you want to do the same in the case of multidimensional arrays
then use the following
 
Array.prototype.findIndexByCol = function(value,cIdx){
var ctr = "";
for (var i=0; i < this.length; i++) {
// use === to check for Matches. ie., identical (===), ;
if (this[i][cIdx] == value) {
//alert(this[i][cIdx]+"===="+value);
return i;
}
}
return ctr;
};
 
 

Wednesday, July 9, 2008

Lotus Domino Best Practices Wiki

A Lotus Domino Best Practices Wiki has been launched on developerWorks. Its purpose is to create a collaborative environment where customers, business partners, architects, support, and development can share best practices for Domino server administration and deployment. So go ahead and share your best practices!

Monday, March 31, 2008

Notes and Domino Buzz Kit



In case if you have not seen this, have a look at the below link for the large collection of links to videos, demos and community websites around the Notes/Domino marketplace.
Have a look at all the TABS {Welcome, Market Buzz, Resources...}
its really a good resource for education on Notes and Domino.

My IBM Lotus Notes and Domino Buzz Kit <http://www.netvibes.com/tcoustenoble> {http://www2.netvibes.com/tcoustenoble#Developing_extensions <http://www2.netvibes.com/tcoustenoble>}


Also have a look at the

1.) LotusPlanet <http://planetlotus.org/> {<http://planetlotus.org/>}

2.) developerWorks e-kits <http://www-128.ibm.com/developerworks/offers/ekits/?S_TACT=105AGY01&S_CMP=BLOG> : its give you a collection of tutorials, articles, webcasts, podcasts, and demos about a particular product, task, or role.
{
http://www-128.ibm.com/developerworks/offers/ekits/?S_TACT=105AGY01&S_CMP=BLOG#lotus <http://www-128.ibm.com/developerworks/offers/ekits/?S_TACT=105AGY01&S_CMP=BLOG> }

Thanks,
Abhijit.


Friday, March 28, 2008

In Place Merge Sort

According to Wikipedia InPlaceMergeSort is a pretty fast sorting algorithm (O(n log n) on average, O(n log n) worst case and O(1) memory usage.) Sub InPlaceMergeSort(vArray As Variant, nLow0 As Integer, nHigh0 As Integer)
Dim nLow As Integer
Dim nHigh As Integer
Dim nMid As Integer
Dim nEndLow As Integer
Dim nStartHigh As Integer
Dim vTemp As Variant
Dim nCount As Integer nLow = nLow0
nHigh = nHigh0
If nLow >= nHigh Then
Exit Sub
End If nMid = (nLow + nHigh) \ 2 Call InPlaceMergeSort(vArray, nLow, nMid)
Call InPlaceMergeSort(vArray, nMid + 1, nHigh) nEndLow = nMid
nStartHigh = nMid + 1 While nLow <= nEndLow And nStartHigh <= nHigh
If vArray(nLow) < vArray(nStartHigh) Then
nLow = nLow + 1
Else
vTemp = vArray(nStartHigh)
For nCount = nStartHigh -1 To nLow Step -1
vArray(nCount + 1) = vArray(nCount)
Next
vArray(nLow) = vTemp
nLow = nLow + 1
nEndLow = nEndLow + 1
nStartHigh = nStartHigh + 1
End If
Wend
End Sub Sub sort(vArray As Variant)
Call InPlaceMergeSort(vArray, Lbound(vArray), Ubound(vArray))
End Sub

Thursday, March 27, 2008

Profiling agents and Web services

Today I came to know about new very interesting and helpful Designer-7 feature. i.e. "Profiling agents and Web services".

By using profile document developers can know total execution time taken by the agent in milliseconds. Here is how to profile an agent -
1. To enable profiling in an agent or Web service, select the Security tab of the properties box and check "Profile this agent" or "Profile this web service."
2. Run your agent

To view profile document results of latest run-
1. Select the agent and choose Agent - View Profile Results, or select the Web service and choose Design - View Profile Results.

Screen shot for profile document results is shown below:



For more information on the same please have a look at Designer Help Document.