Java Tips

I (AngsumanChakraborty) am creating this page to share a few JavaLanguage & non-Java tips & tricks, techniques and findings I figured along the way. Let me know if you find this page useful.

The information presented below may contain errors or inaccuracies and is ever growing. I have based them on my experimentations and website documentations. I tried to be accurate, but to err is human... Use it at solely your own risk.

Unit Testing

  1. In HttpUnit for spanned rows or columns the cell data is repeated.

  2. In ServletUnit, most methods of HttpServletRequest are not implemented. So try not to implement methods which take request as parameter as it will be hard to unit test them.


  1. Exporting emails in bulk from Outlook Express can be done by selecting all of them (click on one and type Ctrl-A) and dragging them to a windows folder in explorer. They are saved individually as eml files which have a very standard format.

External Process on Windows

  1. To start a separate process on Win NT/2000/XP use "cmd /c start ..." and not just "start"

  2. For commands like dir, cd, copy etc. which are provided by dos, use "cmd /c dir" etc.


Beaming data(contacts/memos/appointments) from desktop app to palm pilot(IR enabled) using infrared.

Palm incorporates an IRDA device and contains IRDA protocol stack for communication. It also has IRObex (a high level protocol, details later) implemented on top of IRDA. For details on IRObex, go to (Counter Point) or its parent company (Extended Systems).

You might have noticed that you can beam appointments, memo, contacts from one palm to another. These is done using IRObex.


I evaluated a some devices before choosing Jet Eye PC from Extended Systems. Why?
  1. It comes with Quick Beam suite (details later)
  2. It comes with IRDA stack and IRObex (some competitors rely on the native OS to provide the IRDA support, Windows 98 and Windows 2k does so but not Windows NT. I don't think, however, any of these OS's provide IRObex support
which you need).
  1. It was better priced at around $89 when I bought.


Here is the fun part -

So now you have IRDA stack and IRObex. How do you use it? I found no sample code anywhere and I searched a lot. (Let me know if you have better success)

Note: You can implement IRDA stack but that is a costly effort.

Note 2: Getting samples and source code costs 1000$ as I was informed.

I mean at the least you have to know which dll's to use and what methods are available... right?

I mentioned Quick Beam comes with Jet Eye PC (It can be bought separately). This allows you to exchange files between two Quick Beam enabled PC using infrared.

Anyway, I found something interesting and undocumented. QuickBeam? exchanges data using IRObex. What it means is it speaks the same language as palm.

Here are the key benefits:

The following data can be exchanged with palm using Quick Beam:

  1. Memo - beam .txt files and it will be saved as memo
  2. Contacts - beam .vcf (vCard) files
  3. Calendar - beam .vcs (vCalendar) files

The file formats are defined in separate rfc's Open the file in Quick Beam and Send it. The exchange is bi-directional.

Most PIM's like Outlook can save data in this format. Outlook however does some non-standard things (what's new?).

Another critical undocumented feature(even the Customer Service said it cannot be done) is that quick beam has a command line interface. Just pass it the file name.

So now from my application I can format the data in any of these formats, save it as a file and excecute the program with the file name. Not the neatest solution but it sure beats developing an IRDA stack and IRObex or shelling out 1000$ for getting access to the source code.

Note 3: Palm in this context refers to all IRDA enabled palms (III, V and VII, I believe. I have tested with Palm V only).

Any feedback is appreciated.

-- AngsumanChakraborty

see also JavaIdioms

View edit of July 27, 2010 or FindPage with title or text search