Friday, April 30, 2010

Issues with using pipe ( | ) symbol in Evaluate method in lotusscript

When attempting to use @DBLookup in Evaluate using lotusscript the following attempt succeeded


Evaluate({ @DbLookup("";"";"vwDB";"userName"; 2 ) })

But, replacing the curly braces with the pipe symbol failed,
I mean the following,
Evaluate(| @DbLookup("";"";"vwDB";"userName"; 2 ) |)

I even tried introducing the document parameter,in the following fashion,
Evaluate(| @DbLookup("";"";"vwDB";"userName"; 2 ) |,contextDoc)

I tried this in 8.5.1 and I believe it must be the same with all the other versions as well.

Thursday, April 29, 2010

Simple Javascript Tester

When ever I work with javascript, I often have to test small functions. When working on cumbersome tasks, testing for smaller functions becomes a pain.

So in order to test them I developed this small useful tool.

Just copy and paste the following code into your html page, and there you go you get the tool that will work,

<textarea style="height: 300px; width: 600px;" id="scriptContainer"></textarea>

<button type="button" onclick="eval(document.getElementById('scriptContainer').value)">Evaluate</button>


In Xpages Context, Create a Custom Control, go to the source code panel, delete all the code that you see there, and copy paste the following code into it.This will give you a simple client side javascript tester tool.

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">

    <xp:inputTextarea id="scriptContainer" style="height:300.0px;width:600px"></xp:inputTextarea>
    <xp:br></xp:br>
    <xp:button value="Evaluate" id="button1">
        <xp:eventHandler event="onclick" submit="false">
            <xp:this.script><![CDATA[eval(document.getElementById('#{id:scriptContainer}').value)]]></xp:this.script>
        </xp:eventHandler></xp:button>
</xp:view>


You can also test your javascript code here,


Hope this helps :)

Wednesday, April 28, 2010

Invoking Escape key using Lotusscript

There was one scenario that pushed me to explore for options through which I can control the keyboard using lotusscript. My thought was to invoke the Escape key using lotusscript.
Though this did not resolve my issue, still it was a new discovery on my path.

Put the following code on a button in a form, compose the same and click it.

Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.SendKeys ("{ESC}")


You will see the current form getting closed. Yes this code actually simulates the Escape key press on the keyboard.Again I believe that this will only work in windows

Hope this helps :)

Getting Current Row Index in a Repeat Control

Create a Repeat control with a label inside it. For assistance regarding creating a repeat control take a look into the following post, http://ozinisle.blogspot.com/2010/04/creating-repeat-controls-in-xpages.html

Select the Repeat Control, go to the properties pane and type in the value named "rowIndex" in the field that says "Index name:". The following figure is an illustration of the same


Now Select the Label inside the Repeat control, and compute its value as illustrated in the following figure,


Now save and preview the XPage. You shall see a screen that is similar to the following,

I have actually used the word "rowIndex" which I have keyed in as a value in the Index Field field (fig 1) as a variable and have assigned the same as the label value. Hence It gets updated for each and every row and this you see the result that has been produced , i.e the numbers 0 to 4

Creating Repeat Controls in XPages

Following is a simple illustration of how a repeat control works in XPages
1. Create a new XPage.

2. Open the Control Palette

3. Drag and Drop the control named Repeat Control on to the XPage

4. Now Drag and Drop a Label Control into the Repeat Control present in the XPage

At this point of time you will be seeing something similar to the following on your screen


5. Now select the repeat control, go to the properties panel and check the property named "Create Controls at Page Creation"

6. In the Iteration section select Javascript and put the value 5 as highlighted in the figure above.

7. Now save and preview the XPage.You will be able to see five labels being displayed on the Screen

Forall equivalent in Formula Language - @Transform

I felt amazed when I found the Forall (lotusscript) equivalent in Formula Language.

The command is @Transform. It has a typical syntax that it is difficult for beginners to understand.

The syntax for the command is as follows,

@Transform( list ; variableName ; formula )

The parameter named variableName is the culprit that works in a tricky way. In addition the name of the command itself is no where similar to Forall and hence is used less due to lack of a meaningful name, I suppose.

The following is a little illustration of how to use the function.Assume that the following code is in a button (ofcourse you can copy this into a button),

****************

myList=@Explode("FirstValue,NextValue,LastValue";",");
@Transform ( 
   myList;
   "myListValue";
   @Prompt(1;"";myListValue)
)

****************

This will bring up three prompt with the texts - FirstValue, NextValue and LastValue in each of them respectively.

Here the key is understand how I used the iterator parameter myListValue. First I pass it as a string and there after I use it as if it is a normal variable.

The above mentioned code fragment is equivalent to the following in lotusscript.

****************

dim myList as variant
myList=Split("FirstValue,NextValue,LastValue",",")
Forall  myListValue in myList
   msgbox myListValue
End Forall

****************

Hope this helps :)

Tuesday, April 20, 2010

A toggle display - Changing styles of a button control dynamically in XPages

In a normal HTML page changing the look and feel of a button dynamically is very easy. All have to do is write a few lines of Javascript. But the same will often let you down in XPages.

Yes I have tried this on a Button Control in an XPage. My requirement was to give it a look and feel which simulates a toggle like display for the button on the screen. The color of the button needs to toggle between green and blue gradients each time I click it. Normal client side javascript which i use to do in normal HTML Pages failed.

Even when stuffs worked fine, when a server level refresh happens, the change gets nullified. So I had to do the following to keep up with the task.

1. Create a Button control on the XPage
2. Code such a way that you associate a field control to its onclick event. That is when ever you click on the button, mark the field control with a flag.Let me Name the field as FlagField
3. Go to the Style tab of the button control in the properties pane.
4. click the little diamond against the style class name as illustrated in the following figure

5.This will open up the script editor. Put up the code as illustrated in the following figure.

6. Now write a style sheet with the following code,

.topNavBtnGreen{
    border-color:#c0c7cd;
    background-image:url(TopLightGrey.JPG);
    background-repeat: no-repeat;
    background-size: 100%;
    }

.topNavBtnBrown{
    border-color:#9f060d;
    color:#ffffff;
    background-image:url(TopDarkGrey.JPG);
    background-repeat: no-repeat;
    background-size: 100%;
    }


and associate the same with the XPage.

7. This is it. Now you can preview your button and view the difference.
A sample illustration of the look feel is shown in the following figure
Hope this helps :)

Friday, April 16, 2010

Excel Manipulations with Java (POI 3.6)

This post consists of a code fragment that can be used to perform various operations like, creating excel files, updating them, copying images in the excel files and pushing them into an applet using Java.

My experiments in this post can be summarized into the following
  • createWorkBook()
  • readFromWorkBookDemo()
  • writeToWorkBookDemo()
  • getPictureData()

In order to work with these functions you may have to download the following jars, get them into the resources of your project and proceed with my code.
I have used the POI 3.6 API to accomplish the same .

Click here to download the necessary files

Source Code
**************************************************
import java.awt.Color;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.Transferable;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.List;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.TransferHandler;

import org.apache.poi.hslf.model.Sheet;
import org.apache.poi.hssf.model.Workbook;
import org.apache.poi.hssf.record.chart.ChartRecord;
import org.apache.poi.hssf.record.formula.functions.Row;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFChart;
import org.apache.poi.hssf.usermodel.HSSFPictureData;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.CellReference;

public class NewWorkbook {

public void createWorkBook() throws IOException {
HSSFWorkbook wb = new HSSFWorkbook();
FileOutputStream fileOut = new FileOutputStream("c:\\workbook.xls");
wb.write(fileOut);
fileOut.close();
}

public void readFromWorkBookDemo() throws IOException {
InputStream is=new FileInputStream("c:\\workbook.xls");
HSSFWorkbook wb = new HSSFWorkbook(is);
HSSFSheet sheet1 = wb.getSheetAt(0);
HSSFRow row = sheet1.getRow((short) 0);
HSSFCell cell=row.getCell(0);
System.out.print(cell.getStringCellValue());

}

public void writeToWorkBookDemo() throws IOException {
InputStream is=new FileInputStream("c:\\speedometer.xls");
HSSFWorkbook wb = new HSSFWorkbook(is);
HSSFSheet sheet1 = wb.getSheetAt(0);
HSSFRow row = sheet1.getRow((short) 2);
HSSFCell cell=row.getCell(5);
double d=80;
cell.setCellValue(d);
is.close();
FileOutputStream fileOut = new FileOutputStream("c:\\speedometer.xls");
wb.write(fileOut);
fileOut.close();
}

public void getPictureData() throws IOException {
InputStream is=new FileInputStream("c:\\workbook.xls");
HSSFWorkbook wb = new HSSFWorkbook(is);
List pics=(List) wb.getAllPictures();
System.out.println(pics.size());
System.out.println(pics.get(0).suggestFileExtension());
HSSFChart.getSheetCharts(wb.getSheetAt(0));
ImageIcon imageIcon = new ImageIcon(pics.get(0).getData());
Image image = imageIcon.getImage();
JLabel label=new JLabel(imageIcon);
final Clipboard clipboard =Toolkit.getDefaultToolkit().getSystemClipboard();
TransferHandler handler = label.getTransferHandler();
System.out.println(label.toString());
System.out.println(clipboard.toString());
JFrame myFrame=new JFrame();
myFrame.setSize(500,500);
JPanel panel = new JPanel();
panel.setBackground(Color.CYAN);
panel.add(label);
myFrame.getContentPane().add(panel);
myFrame.setVisible(true);
}

public static void main (String args[]) {
NewWorkbook nwb=new NewWorkbook();
try {
//nwb.createWorkBook();
//nwb.readFromWorkBookDemo();
//nwb.getPictureData();
nwb.writeToWorkBookDemo();
} catch (Exception e) {
e.printStackTrace();
}
}
}

Thursday, April 15, 2010

Booking resources/rooms for a meeting

In order to book a resource or a room for a meeting, the place you may have to do the same is in the Resourcereservations.nsf database that shall exist in the domino directory of your organization's server.

Also making reservations here will ensure that it gets updated with all future meetings that u schedule, that is will say where the resource is booked or not automatically when some one else tries to book a meeting which includes the same

Creating links to databases which exists elsewhere, under domino directory

1. Open the domino admin client.
2. Right click on the folder under which you want to create the link. Click New and Click Link


3. This will bring up a pop as mentioned in the following screen shot  

4. I name my link as MyFirstDominoLevelLink and I am mapping the same to a folder path “F:\DB_OutOf_Data_Dir”. Also In the above screen shot note that there are no entries found in the highlighted section by the link name that I am about to create.

5. Clicking ok creates the link and is displayed as follows


   6. My external folder named “F:\DB_OutOf_Data_Dir” contains 3 databases as shown in the following screen shots

 
7. Now clicking on my link should show all these databases in my admin client and that was what I got



One of the typical usages of creating these links are, they come in handy when it comes to memory management and in cases mentioned in previous post

    Scheduling agents in local databases


    In order to run scheduled agents locally i.e. in local databases , you got to ensure that the highlighted property is enabled. Other wise it wont run, really.

    Also the database must be with in the data directory.

    If in case the database is not with in the data directory then, you got to create a link to the database under the data directory. To know more about creating the link go through the next post.
     

    Tuesday, April 13, 2010

    @Businessdays equivalent in Lotusscript

    Function businessDays( NewDate As Variant, OldDate As Variant) As Double
            Dim DateCnt As Long
            Dim NoDays As Long
            Dim BeginDate As Long
            Dim EndDate As Long
            Dim DayOfWeek As Integer
          
    ' This function calculates the difference between two dates in whole days and
    '    does not include the start date , weekends are also excluded
          
            On Error Goto errDateDiff
            BeginDate =OldDate
            EndDate = NewDate
            DateCnt = BeginDate
            NoDays = 0
          
            Do While (DateCnt <= EndDate)
                    DayOfWeek = Weekday(DateCnt)
                    If Not (DayOfWeek = 1 Or DayOfWeek = 7) Then
                            NoDays = NoDays + 1
                    End If
                    DateCnt = DateCnt + 1
            Loop
          
            businessDays= NoDays
          
            Exit Function

    errBusinessDays:
            businessDays= -1
            Exit Function
    End Function

    Friday, April 9, 2010

    Question Bank for Begineers in Lotus Notes

    1. How to Create a Form and a View?

    2. How to Map a form to a View?

    3. How do you save a document?

    4. How do you close a document?

    5. How do you write a window title?

    6. How do you create a new document using a action button?

    7. How to open an existing document by clicking Button?

    8. How to navigate between different pages with in a frame on a button click?

    9. How to open the page or form by clicking button?

    10. How to load a image in form or page?

    11. How to create a frameset?

    12. How to display the content of the document in a frame when opened directly from a view ?

    13. How to select Multiple Values in Dialog list Box?

    14. How to get a list of names in names field by placing a cursor ?

    15. How to Give link in Navigator?

    16. In Action Bar Whats the Difference Between Button and Check box?

    17. All fields have the following properties - Computed, Computed for Disply, Computed When Composed.. Whats the use of that?

    18. Where can we use a folder?

    19. How to use Folder?

    20. How to set a default value in combobox in Notesclient?

    21. How do you map fields of a from to a view?

    22. How do you give title to a frameset?

    23. How to give a message box with user name in lotusscript?

    24. How to calculate sum of values in one column in a view and display it in an other column of the same view?

    25. How to move the documents from one folder to another using an Simple Action Agent?

    26. Circle the TRUE statement(s)
    a. Forms can contain fields
    b. Pages can contain fields
    c. Forms can contain pages
    d. Subforms can contain fields
    e. Forms can contain subforms & pages

    27. Which of the following is NOT a design element?
    a. Form
    b. Page
    c. View
    d. Frame
    e. Folder

    28. Which of the following is FALSE?
    a. Shared Actions come under Shared Element
    b. Shared Actions come under Shared Code
    c. Columns is a Shared Element
    d. Fields is a Shared Element

    29. Which of the following is TRUE?
    a. All documents that a view contains cannot be placed inside a folder
    b. All documents in a folder cannot be deleted
    c. All documents in a view cannot be deleted
    d. You cannot drag and drop documents into a view

    30. A subform can
    a. Contain fields
    b. Contain forms
    c. Contain views embedded into it
    d. Contain pages
    e. Contain subforms

    31. Which of the following is TRUE about a Shared Column?
    a. Its properties can be changed directly from the view
    b. Its properties cannot be changed directly from the view
    c. It cannot have a title
    d. A shared column cannot be inserted in more than 32 views

    32. A page can be simply described as a
    a. Form without view
    b. Form without columns
    c. Form without documents
    d. Form without fields

    33. A Frame CANNOT contain
    a. Outline
    b. Subform
    c. Shared Column
    d. Shared Field

    34. When you preview a subform on the client
    a. It opens in a new window
    b. It opens in the same window
    c. It open in a new frame
    d. It opens in a new frameset
    e. It doesn’t open

    35. To preview a form directly from client, Goto
    a. View
    b. CreateForm
    c. Preview 
    d. Compose
    e. Create

    36. Outlines are used to
    a. Display text
    b. Decorate text
    c. Navigate
    d. Create Navigators

    37. Which of the following is FALSE about Navigators
    a. They can have irregular shaped links
    b. They can have unorganized links
    c. They are the latest trend in the Lotus Notes Development
    d. They can contain hotspots

    38. The section of the designer that is at the extreme right is called
    a. Action Pane
    b. Properties Pane
    c. Control Pane
    d. Control/Data section in XPages & CC/Action Pane in case of Forms, Views,etc
    39. Select the FALSE statement
    a. A frame can contain a frameset
    b. A frameset can contain a frame
    c. A frame can contain a frame
    d. A frameset can contain a frameset

    40. Which of the following are invalid field type(s)?
    a. Author
    b. Reader
    c. Rich Text Light
    d. Name

    41. Which of the following is an invalid field name?
    a. txtSample
    b. fldSample
    c. num Sample
    d. dtSample

    42. Which field will you use to verify the ATM pin of the user?
    a. Checkbox
    b. Radio Button
    c. Dialog List
    d. Password

    43. Using a Dialog list field, a user can
    a. Always select multiple values
    b. Always select only single value
    c. Select multiple values, if permitted by design
    d. Never select multiple values

    44. If you want to specify your project manager, you will use a
    a. Combo box Field
    b. List box Field
    c. Names Field
    d. Dialog List Field

    45. “Allow Multiple Values” property cannot be changed for
    a. Checkbox
    b. Listbox
    c. Combobox
    d. Radio Button
    46. Circle the TRUE statement(s)
    a. Forms can contain Form Info tab
    b. Forms can contain Defaults tab
    c. Forms can contain Info tab
    d. Forms can contain Form Background tab
    e. Forms can contain Background tab

    47. Form can be of Type?
    a. Documents
    b. Response
    c. Response to Response
    d. Response to Response to Response
    e. Form

    48. How to make a form as Database default form?
    a. Form - > Default database form property
    b. Form - > Database default form property
    c. Form - > Form default for database property
    d. Form - > Default form for database property

    49. By setting a form property that refreshes all keyword fields as the user edits a document.?
    a. Automatically refresh fields
    b. Refresh fields automatically
    c. Refresh Document on field refresh
    d. Refresh fields

    50. Forms Property box , Default tab contains
    a. On Create
    b. On Open
    c. On Close
    d. On Web Access
    e. On Submitt
    f. On Load

    51. How to create alias of a form ?


    52. What are the options available in Conflict Handling
    a. Create Conflicts
    b. Form Conflicts
    c. Merge Conflicts
    d. No Conflicts
    e. Merge/No Conflicts
    f. Do Not Create Conflicts

    53. Form Property Box , Launch Tab contains
    a. Auto Launch
    b. Auto Open
    c. Auto Web Open
    d. Auto Frame

    54. View Contains
    a. View Info tab
    b. Info tab
    c. Options tab
    d. Style tab
    e. View Background tab


    55. Style of a view can be
    a. Standard Outline
    b. Outline
    c. Standard View
    d. Notes view
    e. Calendar

    56. View Property box , Style tab contain
    a. Body
    b. Grid
    c. Margin
    d. Rows
    e. Others
    f. Header

    57. In Column Property box, Column Info tab , Multi-value separator does not contains
    a. None
    b. Space
    c. Blank
    d. Line
    e. Comma
    f. Semicolon
    g. New Line

    58. What is the default design element created when creating a new database
    a. Form
    b. View
    c. Page
    d. Xpage

    59. Select the FALSE statements
    a. A column can multiple views
    b. A column can be categorized
    c. A view can have multiple column
    d. A form can contain many columns

    60. The Style of the column can be a
    a. General
    b. Number
    c. Text
    d. Name
    e. Date/Time

    61. In column Property box, Sorting tab under Totals , which are the options are correct?
    a. Total
    b. None
    c. Average per document
    d. Percent of all documents

    62. Choose the wrong answers?
    a. Alias can be give for form
    b. Alias can be give for View
    c. Alias can be give for Column
    d. Alias can be give for Fields

    63. For a field type “Text” types can be
    a. Editable
    b. Computed
    c. Computed for Display
    d. Computed to display
    e. Computed when Composed

    64. If you choose a Dialog list field , then under controls tab in choices will display
    a. Enter choices (one per line)
    b. Use formula for choices
    c. Use Address dialog for choices
    d. Use View dialog for choices

    65. “Allow values not in list ” property can be set for
    a. Dialog list
    b. Listbox
    c. Combobox
    d. Radio Button

    66. How many design elements are there under the section "Code" in a Notes 8.5 database?

    67. What do you understand by the term "Agent"?

    68. How many ways you can trigger an agent?

    69. Explain the different ways to trigger an agent?

    70. How many ways an agent can act on a Target document?

    71. What is the difference between an agent acting on "All selected documents" and "All documents in a view"?

    72. In how many ways you can code for an agent?

    73. Specify a programming language which is not available for writing agents?

    74. What is the minimum time you can schedule an agent?

    75. How many ways you can schedule an agent?

    76. What all target documents can a schedule agent should work?

    77. What all steps need to be done to make an agent work in a "Local" environment?

    78. How will you specify an agent for this purpose?
    a. I want to move some selected documents to a folder.
    b. I want to move all documents from the database A to database B
    c. I want to modify field A of all document

    79. Write formula for an agent which should act only on documents whose age is greater than 26?

    80. Write formula to modify value of the field Status to "Pending" for all selected documents?

    81. Write a Lotus Script agent to modify a field value of a document?

    82. I want to modify a field in a document every 1 hr. How will you accomplish this task?

    83. How many types of script libraries can be created in Lotus Notes 8.5 database?

    84. How can be I include a script library in a form?

    85. Write a pseudo code for validating fields in a form?

    86. What is the difference between function and sub routine?

    87. Define:
    a. Option Public
    b. Option Declare

    88. What are the default options available when a Lotus Script script library is created?

    89. What is the difference between script library and agent?

    90. What is meant by signing of agent?

    91. What will happen 'Disable' an agent?

    92. I want an Action Button to be displayed on all views. How can I accomplish the task?

    93. I want to create a context menu which contains "Action-1", "Action-2".How can I accomplish the task?

    will keep updating...

    Thursday, April 8, 2010

    Canvas - List of commands that a beginner needs to know

    Referenece: https://developer.mozilla.org/en/Canvas_tutorial

    Applying Styles for canvas

     <style type="text/css">
           canvas { border: 1px solid black; }
     </style>

    Commands

    var ctx =canvas.getContext("2d");
     ctx.fillStyle = "rgb(200,0,0)";
     ctx.fillRect (10, 10, 55, 50);
     ctx.fillStyle = "rgba(0, 0, 200, 0.5)";

    Rectangles

    fillRect(x,y,width,height) : Draws a filled rectangle
    strokeRect(x,y,width,height) : Draws a rectangular outline
    clearRect(x,y,width,height) : Clears the specified area and makes it fully transparent

    rect(x, y, width, height)

    Besides the three methods we saw above which draw rectangular shapes directly to the canvas, we also have a method rect which adds a rectangular path to the path list.

    This method takes four arguments. The x and y  parameters define the coordinate of the top left corner of the new rectangular path. width and height define the width and the height of the rectangle.

    When this method is executed, the moveTo method is automatically called with the parameters (0,0) (i.e. it resets the starting point to its default location).

    Drawing paths

    beginPath()
    closePath()
    stroke()
    fill()

    One very useful function, which doesn't actually draw anything, but is part of the path list described above, is the moveTo function. You can probably best think of this as lifting a pen or pencil from one spot on a piece of paper and placing it on the next.

    moveTo(x, y)

    For drawing straight lines we use the lineTo method.

    lineTo(x, y)

    For drawing arcs or circles we use the arc method. The specification also describes the arcTo method, which is supported by Safari and Firefox, but wasn't implemented in the older Gecko browsers.
    arc(x, y, radius, startAngle, endAngle, anticlockwise)

    Bezier and quadratic curves

    The next type of paths available are Bézier curves, available in the cubic and quadratic varieties. These are generally used to draw complex organic shapes.

    quadraticCurveTo(cp1x, cp1y, x, y) // BROKEN in Firefox 1.5 (see work around below)
    bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y)

    A quadratic Bézier curve has a start and an end point (blue dots) and just one control point (red dot) while a cubic Bézier curve uses two control points.

    USING IMAGES

    drawImage(image, x, y)
    drawImage(image, x, y, width, height)
    drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight)

    controlling Image Scaling Behavior : mozImageSmoothingEnabled

    Colors

    fillStyle = color
    strokeStyle = color

    Transparency

    globalAlpha = transparency value

    Line styles

    lineWidth = value
    lineCap = type
    lineJoin = type
    miterLimit = value

    Gradients

    createLinearGradient(x1,y1,x2,y2)
    createRadialGradient(x1,y1,r1,x2,y2,r2)
    addColorStop(position, color)

    Patterns

    createPattern(image,type)

    Shadows

    shadowOffsetX = float
    shadowOffsetY = float
    shadowBlur = float
    shadowColor = color

    Saving and restoring state

    save()
    restore()

    Translating

    translate(x, y)

    Rotating

    rotate(angle)

    Scaling

    scale(x, y)

    Transforms

    transform(m11, m12, m21, m22, dx, dy)
    setTransform(m11, m12, m21, m22, dx, dy)

    Compositing

    globalCompositeOperation = type

    type is a string representing any one of twelve compositing operations. Each of the available types is described below.

    Note: In all of the examples below the blue square is drawn first and referred to as 'existing canvas content'. The red circle is drawn second and referred to as 'new shape'.

    source-over (default)
    This is the default setting and draws new shapes on top of the existing canvas content.
      

    Image:Canvas_composite_srcovr.png
      

    destination-over
    New shapes are drawn behind the existing canvas content.
      

    Image:Canvas_composite_destovr.png

    source-in
    The new shape is drawn only where both the new shape and the destination canvas overlap. Everything else is made transparent
      

    Image:Canvas_composite_srcin.png
      

    destination-in
    The existing canvas content is kept where both the new shape and existing canvas content overlap. Everything else is made transparent.
      

    Image:Canvas_composite_destin.png

    source-out
    The new shape is drawn where it doesn't overlap the existing canvas content.
      

    Image:Canvas_composite_srcout.png
      

    destination-out
    The existing content is kept where it doesn't overlap the new shape.
      

    Image:Canvas_composite_destout.png

    source-atop
    The new shape is only drawn where it overlaps the existing canvas content.
      

    Image:Canvas_composite_srcatop.png
      

    destination-atop
    The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content.
      

    Image:Canvas_composite_destatop.png

    lighter
    Where both shapes overlap the color is determined by adding color values.
      

    Image:Canvas_composite_lighten.png
      

    darker
    Where both shapes overlap the color is determined by subtracting color values.
      

    Image:Canvas_composite_darken.png

    xor
    Shapes are made transparent where both overlap and drawn normal everywhere else.
      

    Image:Canvas_composite_xor.png
      

    copy
    Only draws the new shape and removes everything else.
      

    Image:Canvas_composite_copy.png

    Note: Currently the copy and darker settings don't do anything in the Gecko 1.8 based browsers (Firefox 1.5 betas, etc).

    Clipping paths

    clip()

    Wednesday, April 7, 2010

    Ceil command simulation in Lotusscript

    Assume that you have a numeric expression "numExpr" on whichyou want to perform the Ceil operation.

    This can be achieved by using the following expression,

    Fix(numExpr)+1

    In java Math.Ceil(9/5) will return 2.
    Fix(9/5)+1 will also return 2... thus Ceil command simulation in Lotusscript is achieved

    Hope this help :)

    Floor command simulation in Lotus script

    The command named Fix returns the Integer part of a fractional number.

    This is similar to the command named Floor in Java or Javascript

    For example ,  Msgbox Cstr(Fix(9/5)) will alert '1'

    Also a particular numerical expression can be expressed as ,

    Fix(numExpr) + fraction(numExpr) = numExpr.

    And this is always true.
    For More Info refer to the designer help
    Hope this helps :) Cheers

    Thursday, April 1, 2010

    Passing Values Through Scoped Variables

    This post may seem complex. But it is really simple. Just follow the first three steps blindly. Then you will get to know my point of simplicity.

    1.Create an XPage and go to the Source panel.
    2. Select all the xml code that you see there and replace the same with the following code,

    <?xml version="1.0" encoding="UTF-8"?>
    <xp:view xmlns:xp="http://www.ibm.com/xsp/core">
    <xp:button value="Label" id="button1">
            <xp:eventHandler event="onclick" submit="true"
                refreshMode="complete">
                <xp:this.action><![CDATA[#{javascript:sessionScope.Label+="x"}]]></xp:this.action>
            </xp:eventHandler></xp:button>
       
        <xp:br></xp:br>
        <xp:br></xp:br>
        <xp:br></xp:br>
        <xp:label value="#{javascript:sessionScope.Label}" id="label1">
            </xp:label>
    </xp:view>

    3. Now go to the Design Panel of the XPage.

    4. There you go, you will see a Button and a Label as you see in the following screen shot,
    5. The button named label will have the following code in its onclick event,
    sessionScope.Label+="x", and the same is illustrated in the following figure

    6. The label needs to have a computed value with the following code in it.
    sessionScope.Label, and this is as illustrated in the following figure,
    7. Now preview the page on the browser or on a 8.5.1 client and click the button.

    8. You will see that the label get changed every time you click the button, and the same is illustrated in the following screen shot
    What really happens here is that the label has been mapped to a sessionScope variable.When ever you click the butto, it updates the same and hence the label also gets its value refreshed.

    Hope this helps :)