Posts Tagged Java

SQL Transactions in Java

1. Rollback all data on import from a table if a row is corrupted. You have a list of sql queries as a parameter:
Read the rest of this entry »

Tags: , , , ,

Integrating Lotus Notes applications with web services(Part 2)

Once we received the information from the web services, the next step was to parse that stream in order to get the necessary data. I needed a quick and easy way of doing this. After a little search on the existing solutions, I have chosen to use Xstream library. It’s simple to work with and you don’t need extra mapping. You just create the Java classes, that will represent our xml file.
Read the rest of this entry »

Tags: , , , ,

Parse an XML file issue

If you wish to create an XML file and then parse it to use the containing information for some other logic you should keep in mind a small, but annoying “feature”.

Error :
-> org.xml.sax.SAXParseException: Content is not allowed in prolog.

Read the rest of this entry »

Tags: , ,

“Father of Java” leaves Oracle

James Gosling, the creator of the original design of Java has resigned from Oracle a week ago.  The news is anounced only now on his blog and confirmed by other sites (where you can find more details): Read the rest of this entry »

Tags: , ,

Analyzing an application with JProfiler Tool

JProfiler is a modern and very useful Java tool for analyzing data. It’s dedicated to analyze J2EE, J2SE projects, and can integrate a number of IDE. An equivalent profiler for NetBeans is Jfluid Technology.

JProfiler’s interface is user friendly and very fast in achieving the goal that came from the need to use an analyzing tool, which is, to show the performance statistics about the selected application and the possible leaks.
Read the rest of this entry »

Tags: , ,

Connect Lotus Script to Java using LS2J

Introduced in Lotus Notes 6, LS2J allows the use of Java code from Lotus Script. To use LS2J from within Notes, your Lotus Script code must include this line:

UseLSX "*javacon"

This loads the LS2J Dynamic Link Library (DLL) on Win32 and registers all the Application Data Types (ADTs). Lotus Script provides a JavaSession ADT to be used as an instance to connect with the JVM.
Read the rest of this entry »

Tags: , ,

Core Java: How to sort strings in a language-specific order

When sorting a list of strings in alphabetical order you shouldn’t use the comparison methods of the String class (especially when writing internationalized programs). The String.compareTo method performs a binary comparison of the Unicode characters within the two strings, which is ineffective when sorting in most languages, Read the rest of this entry »

Tags: , ,

How to create a zip file with Java and offer it for download

In many web applications at some point a programmer meets the need to make an archive of a/some document(s) and offer this archive for download.
The main JAVA utilities for executing this archiving task are inside package java.util.zip.
These classes implement an output stream filter for writing files in the ZIP file format. They include support for both compressed and uncompressed entries.
The process of archiving document(s) is to read content as byte array from the original file(s), and then add the content to a java.util.zip.ZipOutputStream
Read the rest of this entry »

Tags: , , , , , , ,

Json, Struts and XWiki 2.1.1

If you want to add a feature in XWiki, something that you cannot already find implemented in XWiki code zone, you should go to the core of this platform. Implementing something new, means interacting , adding new elements to XWiki sources. It means configuring the wiki to recognize your new features and then creating a documentation for all of this that will be helpful for future reference and at XWiki update version.

Read the rest of this entry »

Tags: , , , , , ,