Monday, June 22, 2009

Stimulating keyboard in Java

Below is a sample java code which does the same purpose of sendKeys in vb code.

import java.awt.*;
import java.awt.event.*;

public class RobotTest{
//Create an array of keycode data
static int keyInput[] = {

public static void main(String[] args)throws AWTException,IOException{


Robot robot = new Robot();

for (int i = 0;i <>

Wednesday, June 17, 2009

DQL Tips

To display all available cabinets/folders/documents for a particular login user

select FOR READ * from dm_document where i_cabinet_id in (select r_object_id from dm_cabinet)

Always remember this and create your queries on the basis of this only

1, for None
2, for Browse
3, for Read
4, for Relate
5, for Version
6, for Write
7, for Delete

So your query can be:-

SELECT * FROM dm_document WHERE acl_name IN (SELECT object_name FROM dm_acl WHERE ANY r_accessor_permit > 3) AND ANY i_folder_id in (SELECT DISTINCT r_object_id FROM dm_folder WHERE acl_name IN (SELECT object_name FROM dm_acl WHERE ANY r_accessor_permit > 1))

I got this query as a response to the question in posted in DocumentumGyan

For more DQL Tips:

Format Recognizing in documentum for DFS

Recently I got stumbled over the way in which I can get the documentum format for my files and the vice verse. For DFC, there is a function called getFormatRecognizer(), since I am using DFS for the operation I was searching the corresponding for DFS.

The below link was a great help in getting some idea :

For getting a documentum format for dos extension like (doc, ppt, docx, ppptx..) using this query :
Select name from dm_format where dos_extension = 'dosExtension';
This will give only the format name like crtext, msw8...

For getting the description of a documentum format, you can do a query like this

SELECT r_object_id as rid, object_name, a_content_type from dm_sysobject WHERE CABINET('/Templates') and r_object_type ='objectType' and r_object_type <> 'dm_folder' and ( a_content_type = 'documentumFormatName')

For doing a reverse mapping of documentum format to dos extension
Select dos_extension from dm_format where name = 'documentumFormatName';

DFS can do a search query using this query to get the values.

Photo Reading

Recently I had a chance to read the book PhotoReading by Paul R Scheele , also we had a nice discussion on our weekly team meeting in company. This books talks about some speed method for reading a book as quickly as possible. According to me this method is very good for executives who want to have a quick overview about a subject/topic. It is not advisable for students or others who want to have a thorough knowledge on the subject.

It introduces the following concept on reading a book.
  1. Prepare : - keep in mind what would be the desired output of reading
  2. Preview :- Get a sense of Structure
  3. PhotoRead: - Using our eyes, have a peripheral vision over the book.
  4. Activate: - Exploring parts most attaracted.
  5. Rapid Read:- moving quickly through the text page by page starting from beginning to end
Surely I know this will help people who no reading habit or got stumbled on the middle way; to have an effective way for reading a book.
It is a book worth while to read.

Following are some of the links which will help for a quick start :

Ephphatha, that is, Be opened.


Mark 7:31,32
"And again, departing from the coasts of Tyre and Sidon, he came unto the sea of Galilee, through the midst of the coasts of Decapolis.And they bring unto him one that was deaf, and had an impediment in his speech; and they beseech him to put his hand upon him."

Here we will meditate the spiritual aspects of a miracle done by Jesus.
The main in the context was deaf, and had an impediment in his speech.
It shows our state of mind of not able to speak to God and not able to hear what the God says.
This will hinder our spiritual and earthly blessings.To receive blessings we have to open our ears

Jesus took him away from the multitude, this shows a separated life we have to follow in our personal life.
Jesus told Ephphatha, that is, Be opened.

We will mediatate about the life of four persons, who got blessed by opening their ears to the word of GOd.

Listen to Word of God and got saved : Luke 19:5 (King James Version)
"And when Jesus came to the place, he looked up, and saw him, and said unto him, Zacchaeus, make haste, and come down; for to day I must abide at thy house."
Here Jesus asked Zacchaeus to come down. Since he opened his ears to listen to the word of Jesus, he and the entire family were saved.

Listen to Word of God and Loved by God : Luke 10:38
"Now it came to pass, as they went, that he entered into a certain village: and a certain woman named Martha received him into her house.And she had a sister called Mary, which also sat at Jesus' feet, and heard his word."
Here there is the family of Martha, Mary and Lazarus. Since they listened to the word of God, In John 11:5, "Now Jesus loved Martha, and her sister, and Lazarus". They were loved by Jesus.

Listen to Word of God and Got healed : Luke 17:11-14 (King James Version)
"And when he saw them, he said unto them, Go shew yourselves unto the priests. And it came to pass, that, as they went, they were cleansed.". When they listened to waht Jeusu told, they were
In Exodus 15:26 (King James Version)
"And said, If thou wilt diligently hearken to the voice of the LORD thy God, and wilt do that which is right in his sight, and wilt give ear to his commandments, and keep all his statutes, I will put none of these diseases upon thee, which I have brought upon the Egyptians: for I am the LORD that healeth thee."
For getting healed we have to do four things:
1) diligently hearken to the voice of the LORD thy God
2) wilt do that which is right in his sight,
3) wilt give ear to his commandments,
4) keep all his statutes,

Listen to the word of God and received great blessings : Mathew 4:18
Disciples listened to the word of God and they were turned from mere fishermen to those who catch men. They were know all over the world and were able to shake the world by their words and deeds in the name of Jesus.
They did miracles which Jesus did not done in his missionary days.

What Jesus did for the deaf man to hear? Mark 7:33 (King James Version)
"And he took him aside from the multitude, and put his fingers into his ears, and he spit, and touched his tongue;"
  1. Jesus took him away from the multitude, this shows a separated life we have to follow in our personal life.
  2. Jesus told Ephphatha, that is, Be opened.

Are we not able to speak to God? Are we not able to listen to word of God?

Please examine our life and open our ears and mind to be get blessed by the Lord.

Friday, June 12, 2009

I am with thee, and will keep thee


Genesis 28:15 (King James Version)
"And, behold, I am with thee, and will keep thee in all places whither thou goest, and will bring thee again into this land; for I will not leave thee, until I have done that which I have spoken to thee of."

This is what God told to James on the way to the home of Laban, when he ran waya from his brother.This is a promise verse which all christian should know.
This verse contains 4 promises.

For the Lord to give us this promises, what we have to do?

Complete Obedience:
Genesis 27:43 (King James Version)
"Now therefore, my son, obey my voice; arise, flee thou to Laban my brother to Haran;"
James obeyed the word and fled to Haran. It shows complete obedience to what servants of Lord told you to do.

Life of separation:
The Lord appeared to him when he was alone at the forest. This shows a life of separation.When we lead a life of separation, the Lord will start to speak to us.
God was with Joseph.
Gen 39:2, 37:2 Genesis 39:2 (King James Version)
"And the LORD was with Joseph, and he was a prosperous man; and he was in the house of his master the Egyptian"

Parying and Mediatating before God:Joshua 1:5 (King James Version)
"There shall not any man be able to stand before thee all the days of thy life: as I was with Moses, so I will be with thee: I will not fail thee, nor forsake thee."

Meek and Faithful:Number 12:3,7
"Now the man Moses was very meek, above all the men which were upon the face of the earth."
"My servant Moses is not so, who is faithful in all mine house."

Spirit of Ministry, Meditating the law of God
Joshua 1:1
"Now after the death of Moses the servant of the LORD it came to pass, that the LORD spake unto Joshua the son of Nun, Moses' minister, saying,"

For those people who do the above four things , the promises will belong to them.
2 Chronicles 15:2 (King James Version)
"And he went out to meet Asa, and said unto him, Hear ye me, Asa, and all Judah and Benjamin; The LORD is with you, while ye be with him; and if ye seek him, he will be found of you; but if ye forsake him, he will forsake you."

May God bless you with these words



Exodus 17:8-9 (King James Version)

"Then came Amalek, and fought with Israel in Rephidim.And Moses said unto Joshua, Choose us out men, and go out, fight with Amalek: tomorrow I will stand on the top of the hill with the rod of God in mine hand."
Here the verse speak about the fight between Amalek and how Israel overcome them.

The word Rephidim means 'Rest'. But the spirit of Amalake will try to take away the rest from you.In our todays life Amaleks' are some kind of spirit which will hinder us in the progress of our spiritual life.They will not allow us to reach canan and they will also kill those people who were left behind because of tiredness.Until we have oversome this spirit, we cannot reach our spiritual canan.

Today we will meditate 5 things about Amalek.

The spirit of sin: 1 Samuel 15:18 (King James Version)
"And the LORD sent thee on a journey, and said, Go and utterly destroy the sinners the Amalekites, and fight against them until they be consumed."
In the life of a saved child of God there will be struggle against sins in life and against faith in life. This is the work of Amalek spirit and as said in Hebrews 12:4 "Ye have not yet resisted unto blood, striving against sin."
We have to fought against it.

The spirit of blocking the way: 1 Samuel 15:2 (King James Version)
"Thus saith the LORD of hosts, I remember that which Amalek did to Israel, how he laid wait for him in the way, when he came up from Egypt.
This shows these spirit will be blocking on the way of child of God to heaven.

The spirit with No Fear of God:Deuteronomy 25:18 (King James Version)
"How he met thee by the way, and smote the hindmost of thee, even all that were feeble behind thee, when thou wast faint and weary; and he feared not God." In Psalm 36:1"The transgression of the wicked saith within my heart, that there is no fear of God before his eyes."

The spirit of Killing the weary people :Deuteronomy 25:18 (King James Version)
"How he met thee by the way, and smote the hindmost of thee, even all that were feeble behind thee, when thou wast faint and weary; and he feared not God."
It shows the power of backsliding

The spirit of taking the Crown:2 Samuel 1:10 (King James Version)
"So I stood upon him, and slew him, because I was sure that he could not live after that he was fallen: and I took the crown that was upon his head, and the bracelet that was on his arm, and have brought them hither unto my lord."
The crown reveals overcoming life. The spirit of Amalake are looking to take away your crown.

How can we overcome Amalake?
4 people have to be there to overcome the spirit of Amalake
Joshua, Moses, Aron and Hur
They are the 4 symblolic of prayer life.
1 Timothy 2:1 "I exhort therefore, that, first of all, supplications, prayers, intercessions, and giving of thanks, be made for all men;"

Moses shows prayer
Aron, the High priest shows intercessions
Hur belongs to the tribe of Juda and shows praising, thanks giving to God
Joshua who is in the battle field shows supplications

May Lord God help you to have Rephidim, Rest in your life

Friday, June 5, 2009

Listing available printers using lotus script

Listing available printers using lotus script

Dim WshNetwork As Variant
Dim WshPrinters As Variant
Dim pArray() As String
Dim iRetValue As Long
Dim DefaultPrinter As String
Dim pCount As Integer
Dim printerAvailable As Boolean
Dim n As Integer

Set WshNetwork = CreateObject("WScript.Network")
Set WshPrinters = WshNetwork.EnumPrinterConnections()

'count the connected printers
pCount% = 0
For n = 1 To WshPrinters.Count() Step 2
If wshPrinters(n) <> "" Then pCount%=pCount%+1

'collect the names of the connected printers
Redim pArray(pCount%-1) As String
pCount% = 0
For n = 1 To WshPrinters.Count() Step 2
If wshPrinters(n) <> "" Then
pArray(pCount%) = wshPrinters(n)
End If

Listing available printers in system using java

The below code will list the default printer device and also list the available printers in the system

import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;

import javax.print.*;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;
import javax.print.event.PrintJobEvent;

public class ListPrinters {
public static void main(String[] args) throws PrinterException{

PrintService defServ = PrintServiceLookup.lookupDefaultPrintService();
System.out.println("Default PrintService: "+defServ);

PrintService[] serv = PrintServiceLookup.lookupPrintServices(null, null);
if (serv.length==0) {
System.out.println("no PrintService found");
} else {
System.out.println("number of Services "+serv.length);

for (int i = 0; i
PrintServiceAttributeSet psa = serv[i].getAttributes();
System.out.println("printer name "+(i+1)+" "+psa.get(PrinterName.class));
System.out.println("accepting "+psa.get(PrinterIsAcceptingJobs.class));


Printing .txt file directly to printer using java

The below code will sent a .txt file directly to printer.


import javax.print.Doc;
import javax.print.DocFlavor;
import javax.print.DocPrintJob;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.SimpleDoc;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.event.PrintJobAdapter;
import javax.print.event.PrintJobEvent;

public class Class3 {

public static void main(String[] args) {

DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;

PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();

/* locate a print service that can handle it */

PrintService[] pservices = PrintServiceLookup.lookupPrintServices(flavor, aset);

/* create a print job for the chosen service */

int printnbr = 0;
DocPrintJob pj = pservices[printnbr].createPrintJob();

try {
FileInputStream fis = new FileInputStream("C:\\tmp\\test.txt");
Doc doc = new SimpleDoc(fis, flavor, null);
PrintJobWatcher pjDone = new PrintJobWatcher(pj);

/* print the doc as specified */
pj.print(doc, aset);

catch (Exception ex){


Some useful links which will discuss deeply about the problem with printing in java and printing jasper reports

Printing an Open office document

Printing a Jasper Report

Windows script dealing with printer devices

Read/Write windows registry entries using Java

In one of my application , where I had to read/write entries on windows registry using Java. These are the two jar files which I found extermely useful.

Windows Registry Wrapper

This help us to read/write REG_DWORD and REG_BINARY also.

Below is a sample code I used with the jar file

import at.*;
import at.jta.*;

public static void main(String[] args) throws RegistryErrorException

Regor obj = new Regor();
Key key = obj.openKey(Regor.HKEY_CURRENT_USER, "Software\\Custom Writer");
int count = 0;
count = Integer.parseInt(obj.readDword(key, "StartAt"));


Java Registry Wrapper

The source code and .jar files are available in the google code store. (

This will help us to read/write the REG_SZ (registry string characters)

Some other helpful links:

Running multiple instance of notes client on desktop

Running multiple instance of notes client on desktop

Please read this blog entry

Detecting a Laptop in Lotusscript

While searching, I came across two interesting article from panagenda's Blog

Detecting a Laptop in LotusScript (on Windows)

Creating your own desktop / virtual workspace skin for Lotus Notes

Its a very good blog providing out of box thinking

Windows Short Cut Keys

I was doing a search for the windows shortcut keys for minimizing an open screen. I searched a lot in several forums but i do get list of windows short cut keys , but was unable to find one for minimizing an active window.

Accidentally from one blog post I got the answer.

ALT+Space Bar + N

Some helping links the windows short cut keys

Computer Short Cut Keys