Friday, October 30, 2009

Chinese characters in resource bundles

I had a difficult time to implement Chinese characters for my SWT application. I was using resource bundle for internationalizing the application. While creating resource bundles for Chinese characters I noticed that resource bundles will accept only ASCII and Java is not able to read UTF-8 resource bundles.I was using eclipse as my development IDE.

The following work around helped me to overcome the situation.

Open an existing MessageBundle.properties file outside eclipse using notepad. Enter Chinese characters for the translation you want and save the file in UTF-8 format. You can use google translation for getting the chinese characters.

Use the tool 'native2ascii' to convert the chinese charcters to unicode characters.

The syntax is like this:

C:\temp>native2ascii -encoding utf-8 MessagesBundle.properties Chinese.properties

The Chinese.properties file will contain Unicode characters for your Chinese letters in MessageBundle.properties. Then copy the content in Chinese.properties file and copy it to any MessageBundle.properties file created in eclipse.

The program will work fine displaying Chinese characters without any modification to source code.

http://forums.sun.com/thread.jspa?threadID=306155
http://forums.sun.com/thread.jspa?threadID=212238&tstart=121351
http://java.sun.com/developer/technicalArticles/Intl/IntlIntro/
http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/native2ascii.html

Tuesday, October 27, 2009

ini file which helps you to preserve comments while updating

I have faced a difficult situation where one of the scenario require to write and preserve comments in configuration file. I tried using properties file and ini file concept using java. But when we write back to the file for storing configuration information, the entire comments in the proprieties or ini file get lost.

At last after a frantic search, I got the following free library which will help you to store configuration in an ini file where you can read and write and it will preserve any comments wrtitten at the top of the file.

http://ini4j.sourceforge.net/tutorial/IniTutorial.java.html

Format date in Lotus script

Below post helped me to format date in Lotus script

http://www.joelitton.net/A559B2/home.nsf/d6plinks/JLIN-5UU4B2

I made changes to the code and below code will format the date value in a field of document.

Dim session As New NotesSession
Dim dateTime As NotesDateTime
Set dateTime = session.CreateDateTime ( deliveredDate )
print " : " & Cstr(dateTime.LocalTime ) & " GMT Time :" & Cstr(dateTime.GMTTime)

Dim dtGMT As NotesDateTime
Dim strRSSDate As String

Set dtGMT = New NotesDateTime( Left$(dateTime.LocalTime , 22) )
strRSSDate = Format$(dtGMT.LSLocalTime, "dd-mmm-yyyy hh:mm:ss AM/PM")

ReplaceAll function in lotus script


Code snippet to stimulate replaceAll function in lotus script

Function StringReplaceAll(Byval strArg As String, Byval strSrc As String,Byval strDst As String) As String



Dim iPos As Integer
iPos = Instr(strArg, strSrc)

While iPos > 0
strArg = Left$(strArg, iPos - 1) + strDst + Mid$(strArg, iPos + Len(strSrc))
iPos = Instr(iPos + Len(strDst), strArg, strSrc)
Wend

StringReplaceAll= strArg

End Function


The function call
StringReplaceAll("hello","l", "g") will give the result as 'heggo'

Dynamically moving scroll bar when dragging an object over an SWT Tree.

Dynamically moving scroll bar when dragging an object over an SWT Tree.

In the dragOver() event write the following statements:

event.feedback |= DND.FEEDBACK_SCROLL;

For expanding a tree, when mouse hover over it during dragging an object:

event.feedback |= DND.FEEDBACK_EXPAND;

The more details can be found at the below link

http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html

Wednesday, September 9, 2009

Disabling close button in SWT shell window

Below snippet of code can be used in a SWT dialog box to disable the close button on window.

//disabling the close button
dialogShell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
e.doit = false;
}
});

Center a SWT Shell on the screen

Below snippet of code can be used to center a SWT shell on the screen

//center the dialog screen to the monitor
Monitor primary = display.getPrimaryMonitor ();
Rectangle bounds = primary.getBounds ();
Rectangle rect = shell.getBounds ();
int x = bounds.x + (bounds.width - rect.width) / 2;
int y = bounds.y + (bounds.height - rect.height) / 2;
shell.setLocation (x, y);

shell.open();
shell.layout();

Below link will provide a brief idea about creating a splash screen using SWT

http://www.eclipsezone.com/eclipse/forums/t53291.html

Wednesday, August 5, 2009

Batch files and Bat to Exe converter

Some of the useful links on MS-DOS basic commands and creating bat file.

http://www.computerhope.com/starthlp.htm#04

Information on Batch Files

Also the following link provides a free tool for converting a bat file to exe.

Bat to Exe Converter

It is a super tool. Congratulations to Fatih Kodak

scheduled agent in my local database is not running

Last time I had a problem that 'scheduled agent in my local database is not running eventhoug I am able to run manually'. Later I found that the database should be in data folder for running the scheduled agents in local.

Follow the following check list when having problem with running scheduled agents in local.

1. See you are able to successfully run the agent manually.
2. Go to Cleint. File->Preferences->User Preferences->Basics Tab; check 'Enable scheduled local agents'
3. Check whether the database is in data folder.

Starting Lotus Notes Client after a crash

For those who have problem with starting Lotus Notes after a client crash, do the following step.

  1. Goto the notes program directory.
  2. Create a shortcut icon for nsd.exe
  3. Add the following parameter "-kill" to the target field on shortcut properties window.

eg: "C:\Program Files\lotus\notes7\nsd.exe" "-kill"

The nsd will run and stop all lotus notes related process. After that you can open lotus notes client with out any problem.

Creating nice charts in Lotus Notes Client

Creating nice charts in Lotus Notes Client

This is the database used by Rob McDonagh and Julian Robichaux in their ILUG 2008 session on Reports, Charts, and Graphs in Lotus Notes. They used this as a demo database to show the various techniques discussed in that session. You can download the database from the following link:

http://captainoblivious.com/rob_mcdonagh/home.nsf/d6plinks/BLOT-7BR3XB

Also there is a nice artcile on how to create a chart using lotusscript on web.

http://www.notessidan.se/A55B53/blogg.nsf/pixel?Openagent

Version of Lotus script currently running

Last week, I faced a strange question of what version of Lotusscript you are using. I frantically searched help document, web ; but I was not able to get a proper answer on what version of Lotusscript is currently running on my Lotus Notes.

Later I got a hint on the following code.

retval = Getthreadinfo(LSI_THREAD_VERSION)
Msgbox "The Version of your Lotus script is : " + Cstr(retval)

will print the version of Lotus script currently running

Programatically setting default printer using lotusscript

I had a particular issue of printing problem on Lotus Notes client version below 7.0.2. I want to set a pdfCreator printer driver as default printer for print operation as the uidoc.print() will not accept a printer name as parameter.

I tried setting the pdfcreator as default printer using lotusscript code and tried printing. But what i noticed is whatever we do, Lotus Notes client will not recognize the default printer settings made programaticallyuntil you have restarted the Lotus Notes Client.

I searched several forums and also in IBM technical forum also they have made it very clear.

Changed default printer setting not used by Notes

But I found several good articles which will help to set a printer programatically using lotusscript.

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/b6a12c5af0975f65852571380061c261?OpenDocument

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/737998b4fb2386018525754a0052684f?OpenDocument

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/bc361293e222d12e852575d800646d90?OpenDocument

From my own experience what ever the case to get the progrmatically printer settings to get effect on Lotus Notes Client below 7.0.2 , you have to close and open notes client again.

Below is also a small snippet of code , whihc will programatically set a default printer.

Dim WshNetwork As Variant
Dim WshPrinters As Variant
Set WshNetwork = CreateObject("WScript.Network")
Set WshPrinters = WshNetwork.EnumPrinterConnections()
PrinterPath = "PDF Writer"
WshNetwork.SetDefaultPrinter Cstr(PrinterPath)

Mercy of Lord

Isaiah 30:18
'And therefore will the LORD wait, that he may be gracious unto you, and therefore will he be exalted, that he may have mercy upon you: for the LORD is a God of judgment: blessed are all they that wait for him.'
Mercy of Lord. There is no limit to the mercy of Lord. When the mercy of God meets man , there are many blessings.

Here we will meditate main 6 blessings received by the mercy of God.

1. Sins are forgiven: Luke 18:13
'And the publican, standing afar off, would not lift up so much as his eyes unto heaven, but smote upon his breast, saying, God be merciful to me a sinner.'

2. Obtain divine healing: Mark 10:47
'And when he heard that it was Jesus of Nazareth, he began to cry out, and say, Jesus, thou son of David, have mercy on me.'

3. Comforted: Luke 7:13
'And when the Lord saw her, he had compassion on her, and said unto her, Weep not.'

4. Protection: Psalm 57:1
'Be merciful unto me, O God, be merciful unto me: for my soul trusteth in thee: yea, in the shadow of thy wings will I make my refuge, until these calamities be overpast.'

5. Prayer will be answered: Psalm 4:1
'Hear me when I call, O God of my righteousness: thou hast enlarged me when I was in distress; have mercy upon me, and hear my prayer.'

6. Gather thee: Isaiah 54:7
'For a small moment have I forsaken thee; but with great mercies will I gather thee.'

For receiving the mercy of God, we have to do the following things:
1. Confess our sins: Prov 28:13
'He that covereth his sins shall not prosper: but whoso confesseth and forsaketh them shall have mercy.'
2. Fear the Lord: Luke 1:50
'And his mercy is on them that fear him from generation to generation.'

Experience of upper chamber of house

As told in TPM CHURCH, ROYAPETTA 19-JULY-2009 SUNDAY SERVICE

I Samuel 9:25
'After they came down from the high place to the town, Samuel talked with Saul on the roof of his house.'
Samuel took saul to the upper part of the house. Only afetr that saul got anointed.without the experience of upper house there is no anointing.Only those having the experience of upper house can be counted for blessings of God.

There are five that will happen at the upper chamber of house.

1. Experience of Pass over was conducted at the top of the house: Luke 22:12

'And he shall shew you a large upper room furnished: there make ready.'
It shows the experience of sanctification. Sanctification opens the window of heaven and bless. All blessings starts with santification. To what extend we are santified, that extend personal blessings will come. Without santification we should not expect blessings of God.

2.Experience of Praying: Daniel 6:10

'Now when Daniel learned that the decree had been published, he went home to his upstairs room where the windows opened toward Jerusalem.'
Only those who pray and praise can receive blessings. Prayer is the experience of speaking to God. Gods children shouls always have the experience of praying and parising to God.

3. Experience of Many Lights Acts 20:8

'There were many lamps in the upstairs room where we were meeting.'
Reveals the light of testimony. Otherwise you will be like Eutychus.If we preserve the life of testimony God will bless us. Elijah had a testimony from gentiles that he is the man of God.

4. Experience of raising dead to Life Acts 9:36,40

Jesus raised three types of people from dead:
Mark 5:43 (dead at home) Only we know what is dead in us. Nobody knows outside.
Dead in Gods love, brotherly love.
Luke 7:16 (dead at street) . The death is know to the village i.e., some people.
It shows some does not have testimony among others. Dead in grace
John 11:35 (dead at tomb). Dead in ceppal. It is stinging. His own sister is saying 'by this time there is a bad odor, for he has been there four days'. Dead state known to everybody. It shows backsliding,not able to pray, attend meeting, read bible. Jesus said Lazars come out.

5. Experience of being in fellowship Acts 1:13, 15

'When they arrived, they went upstairs to the room where they were staying'. Around 120 disciples gathered at the upper chamber of rrom for receiving holy spirit. It shows fellowship, we all are one.

Overcome Jericho

As told in TPM CHURCH, ROYAPETTA 12-JULY-2009 SUNDAY SERVICE

Joshua 6:2

'Then the LORD said to Joshua, "See, I have delivered Jericho into your hands, along with its king and its fighting men.'
A child of God have to overcome Jericho is two ways.
1. In personal life we have to overcome Jericho.
2. Collectively, as a church, we have to overcome Jericho.
Jericho is a place of cursed. We have to overcome this curse by the blood of Jesus and meditating the calvary.

Here we will discuss three matters about Jericho.

1. Jericho is a place where there are many robbers. Luke 10:30
'In reply Jesus said: "A man was going down from Jerusalem to Jericho, when he fell into the hands of robbers. They stripped him of his clothes, beat him and went away, leaving him half dead.'
Here we can see that the robbers did three things to the man.
(i) stripped him of his clothes -> shows devil taking away our salvation and praising.By the weapon of prayer we have to overcome it.
(ii) wounded -> shows the devil creating wounds in mind.
(iii) half dead. -> shows the devil not allowing you to rejoice in the presence of the Lord.

2. There was a blind beggar in Jeircho. Mark : 10:46
'Then they came to Jericho. As Jesus and his disciples, together with a large crowd, were leaving the city, a blind man, Bartimaeus (that is, the Son of Timaeus), was sitting by the roadside begging.'
This shows loosing our spiritual vision.
2 Peter 1:9 'But if anyone does not have them, he is nearsighted and blind, and has forgotten that he has been cleansed from his past sins.' This shows loosing ' godliness, brotherly kindness; and to brotherly kindness, love.'
The root word of Love is Agape, which means 'Unconditional Love'. This is the love Jesus showed to us. we have to show the same to our brothers.

3. There was a short man named 'Zacchaeus' in Jeriho Luke 19:1,2
'Jesus entered Jericho and was passing through.A man was there by the name of Zacchaeus; he was a chief tax collector and was wealthy.'
It shows we are not growing in spiritual life. we are spiritually dwarf.For a child of God, the sacel is Jesus.A child of God should live like how Jesus live, speak.

To overcome Jericho, 4 peoples are needed.Joshua 6:12,13
'Joshua got up early the next morning and the priests took up the ark of the LORD.The seven priests carrying the seven trumpets went forward, marching before the ark of the LORD and blowing the trumpets. The armed men went ahead of them and the rear guard followed the ark of the LORD, while the trumpets kept sounding.'
(i) priest -> shows fellowship of priest to overcome the devil.
(ii) trumphet -> confirmation of coming of Lord.
(iii)armed men -> shows prayer warriors.
(iv) Arch of God -> shows the power of God and his presence.

In Josua 5:15 , 'The commander of the LORD's army replied, "Take off your sandals, for the place where you are standing is holy."'. Shoe is a hindrance to the conatct with the holy land & life. Removing the shoe shows entire santification. We need an entire santification to overcome the Jericho.

Thursday, July 9, 2009

DQL query similar to TOP and ROWCOUNT in SQL

If you want to restrict your query result to a selected number of records as we are doing someting similar to "select top 5 * from authors_table" or similar to ROWCOUNT.
The same criteria can be achieved in DQL using the following parameter ENABLE(FETCH_ALL_RESULTS )

select r_object_id from dm_document ENABLE(FETCH_ALL_RESULTS 5) will return the first five records

select r_object_id from dm_document ENABLE(FETCH_ALL_RESULTS 0) will return the entire results collection.

For more information can be found at : http://robineast.wordpress.com/2007/08/14/dql-hints-optimize-top/

Monday, July 6, 2009

Weapon of Fear

As told in TPM CHURCH, ROYAPETTA 04-JULY-2009 SUNDAY SERVICE

Isaiah 54:17
"no weapon forged against you will prevail,
and you will refute every tongue that accuses you.
This is the heritage of the servants of the LORD,
and this is their vindication from me," declares the LORD.

Against the children of God, the devil uses diffrent types of weapons. In old testment, they used literal weapons but in new testmenat the weapons are not literal. Satan uses this weapon to distract the mind of Gods child away from God and mke him a backslider.

Here we will discuss one of the weapons that devil uses as a weapon against the children of God.
The weapon is FEAR.

Genesis 32:11
"Save me, I pray, from the hand of my brother Esau, for I am afraid he will come and attack me ..."
Here Jacob prayed because of fear. Eventhough he had said that the God is with me, he had heavenly dreams, he saw angels of God climbing up and dwon through the ladder , still he is afraid of his brother.

To overcome the fear, Jacob prayed.

I Samuel 17:11
"On hearing the Philistine's words, Saul and all the Israelites were dismayed and terrified."
Eventhough Saul is the King of Israel and the he is chosen by God, right now he is afraid of Goliath.
The reason is he had lost his anointing to overcome Goliath. He had lost his fellowship with God.
The fear will come into our mind when we loss the anointing or fellowship with God.

To overcome this fear , we need a heavenly anointing.

I King 19:4
"while he himself went a day's journey into the desert. He came to a broom tree, sat down under it and prayed that he might die. "I have had enough, LORD," he said. "Take my life; I am no better than my ancestors."
Eventhough he is a great prophet , when he prayed the there was no rain for three years, when he prayed the doors of sky opened, when he prayed fire descended from sky, but right now he is afraid of a woman with name Jezebel.

He also prayed, the Lord sent his angel to encourage him. I Kings 19: 7, 8 "All at once an angel touched him and said, 'Get up and eat.' He looked around, and there by his head was a cake of bread baked over hot coals, and a jar of water". Here the cake shows the word of God and water shows the holy spirit

To overcome the fear we need the word of God and water shows the holy spirit

II Samuel 15: 13, 14
"Come! We must flee, or none of us will escape from Absalom. ...".
Here the King David is fearing his son Absalom and he is flleeing from the city of Jerusalem. Jerussalem shows the Church of God and Absalom shows the word or the spirit of taking revenge. Absalom is looking for taking revenge against the king. This fear shows backsliding from the God. Even thoug David was a great king he alone killed the gigantic Goliath, now he is afraid of his son.


Job 3:25
"What I feared has come upon me; what I dreaded has happened to me."

Here Job curses his birthday. In Bible we find that two people curses their birthady and two people celebrated their birthday. The people who curses their birthady are Job (3:25) and Jeremiah (20:14). The people who celebrated their birthday are Pharaoh (Genesis 40: 20, 22) and Herod (Mathew 14: 5, 10). Then what happens on their birthady , there were two deaths. So neither celebrate birthday nor curse birthday. Pray to Lord to reveal the will of God.


Let the God helped you to overcome the weapon of fear through Prayer and Holy Spirit.

Experience of Wilderness

As told in TPM CHURCH, ROYAPETTA 21-JUNE-2009 SUNDAY SERVICE

Mark 6:31
"Come with me by yourselves to a quiet place and get some rest."
Here we see , Jesus took his disciples to wilderness and get some rest awhile
In Song of Solomon 8: 5 "Who is this coming up from the desert leaning on her lover? "
The wilderness shows leaning upon Jesus.

Here we will discuss 4 experiences of wilderness to the children of God.

Wilderness shows rest:
Matthew 11:28 "Come to me, all you who are weary and burdened, and I will give you rest."
Isaiah 28:12 saya about the rest thru anointing
to whom he said,
"This is the resting place, let the weary rest";
and, "This is the place of repose"—
but they would not listen.

Gods word is revealing to people in wilderness:
Luke 3:2 "the word of God came to John son of Zechariah in the desert."

Time of Temptation by devil:
Mathew 4: 1 "Then Jesus was led by the Spirit into the desert to be tempted by the devil."
Wilderness shows the time of temptation or time of difficulty for the children of God

Hidden Life:
Luke 1:80 "And the child grew and became strong in spirit; and he lived in the desert until he appeared publicly to Israel."

Friday, July 3, 2009

Blessings at the city of Shechem

As told in TPM CHURCH, ROYAPETTA 28-JUNE-2009 SUNDAY SERVICE

Genesis 33:18
"After Jacob came from Paddan Aram, he arrived safely at the city of Shechem in Canaan and camped within sight of the city."

Here we find that Jacob moved from Paddan Aram to Shechem . These two places have significant meaning in Bible. The city of Paddan Aram shows an ordinary life where as the city of Shechem shows a spiritual life. Here we will meditate five speciality about the city of Shechem.

Genesis 12:6
"Abram traveled through the land as far as the site of the great tree of Moreh at Shechem."
The word Moreh means teacher.
Mark 10:17 As Jesus started on his way, a man ran up to him and fell on his knees before him. "Good teacher," he asked, "what must I do to inherit eternal life?". Here the rich man called Jesus, Good teacher. Jesus is our good teacher. In new testament God gracefully given his saints to correct us and teach us. In the city of Shechem, there is good teacher to correct you and guide you in proper path.It shows accepting Jesus as your master.

Genesis 37:12
"Now his brothers had gone to graze their father's flocks near Shechem,"
In Shechem there are good pastures for sheep. In Psalms 23:1-2 "The LORD is my shepherd, I shall not be in want.
He makes me lie down in green pastures,". The Lord is our shepherd and we are his sheeps. If you are in the city of Shechem, there are green pastures for you. It shows the doctrine of life from God.
1 Corinthians 1:5-7 "For in him you have been enriched in every way—in all your speaking and in all your knowledge—because our testimony about Christ was confirmed in you. Therefore you do not lack any spiritual gift as you eagerly wait for our Lord Jesus Christ to be revealed."

Joshua 24 :1
"Then Joshua assembled all the tribes of Israel at Shechem. He summoned the elders, leaders, judges and officials of Israel, and they presented themselves before God.". Here all people irrespective of their status came together at Joshua. It shows a humility and fellowhsip with the saints of God. In the city of Shechem , there is fellowship with God, Saints and each other.
The Lord gave entire power to Jesus. But as in John 13:3-5 "Jesus knew that the Father had put all things under his power, and that he had come from God and was returning to God; so he got up from the meal, took off his outer clothing, and wrapped a towel around his waist. After that, he poured water into a basin and began to wash his disciples' feet, drying them with the towel that was wrapped around him.". It shows the complete humility.

Joshua 24:15
"But as for me and my household, we will serve the LORD."
It shows serving the Lord as a family.

Joshua 20:7
"So they set apart Kedesh in Galilee in the hill country of Naphtali, Shechem in the hill country of Ephraim, and Kiriath Arba (that is, Hebron) in the hill country of Judah."
The city of Shechem contains a refugee. you can run there and get protected.
Proverbs 18:10 "The name of the LORD is a strong tower; the righteous run to it and are safe."
Jesus is our refugee.

Let the good God fill you with the blessings of the City of Shechem.