There is many examples how to do it, I propose you to add one tiny method to your code and forget.
Showing posts with label simple java examples. Show all posts
Showing posts with label simple java examples. Show all posts
Friday, February 3, 2012
How To: wrapp StringBuffer.append to print each "append" in new line
All of you know fine StringBuilder (StringBuffer) classes. Time to time you need to out multilines text and must code something like
Thursday, February 2, 2012
How To: simple Log in Java
If you need log in your application, you could find a lot of implementation in the internet. The best one is Apache log4j
But in the case of simple application I prefer to use a tiny Log class:
But in the case of simple application I prefer to use a tiny Log class:
How To: clean directory in Java
There are tons of file utils on the web. The best one is File Utilities in Apache commons IO.
Any way, if you need just deleting directory with sub-directories or just clean directory form all files and sub-directories, then look at my tiny example
Any way, if you need just deleting directory with sub-directories or just clean directory form all files and sub-directories, then look at my tiny example
How To: run Domino agent outside from Lotus Notes client
This is simple with the help of Java API
How To: parse DXL in Java
How to export database in to DXL I described in How To: export DXL in Java
To do something with resulting DXL we need to find a way to easy get anything we want from the DXL. I will show how to do it with DOM parser. This is easy as always.
To do something with resulting DXL we need to find a way to easy get anything we want from the DXL. I will show how to do it with DOM parser. This is easy as always.
Wednesday, February 1, 2012
How To: read image from URL in Java
It's fairly easy.
Next example shows how to read an image and show it in a little java window, as well as read as image and store it in to the file
Next example shows how to read an image and show it in a little java window, as well as read as image and store it in to the file
How To: read HTML source from URL in Java
HTML source could be read easily like
HtmlRemoteSource class
HtmlRemoteSource class
How To: detect operation system in Java
There is well known way to detect operation system
Work with strict type is much better in my opinion. Something like this:
It will allow to do strict switch:
The class itself
Work with strict type is much better in my opinion. Something like this:
It will allow to do strict switch:
The class itself
Tuesday, January 31, 2012
How To: export DXL in Java
We will do few simple steps to allow DXL exporting like this
Let's create simple class for description of database location. We will use it as light database representation
Exporter class itself
Class for run a simple example
Do not forget
You need add to the java class path also few libraries to allow DCL exporter to work:
Good old
Lotus\Notes\jvm\lib\ext\Notes.jar
And
Lotus\Notes\jvm\lib\tools.jar
Lotus\Notes\jvm\lib\ext\websvc.jar
Let's create simple class for description of database location. We will use it as light database representation
Exporter class itself
Class for run a simple example
Do not forget
You need add to the java class path also few libraries to allow DCL exporter to work:
Good old
Lotus\Notes\jvm\lib\ext\Notes.jar
And
Lotus\Notes\jvm\lib\tools.jar
Lotus\Notes\jvm\lib\ext\websvc.jar
How To: file separator in Java
I am always use
There is one more elegant way to get the same result
I did performance test of both on my PC and it's have the same speed. So you could use what you like
There is one more elegant way to get the same result
I did performance test of both on my PC and it's have the same speed. So you could use what you like
Monday, January 30, 2012
How To: compare two documents
Java Code for compearing two documents item by item.
It prints only item's that is different by Name, Type, IsSummary, Values.
It prints only item's that is different by Name, Type, IsSummary, Values.
How To: print all items of document
Java Code for printing all items and it's values from some document:
Subscribe to:
Posts (Atom)