Showing posts with label JAVA. Show all posts
Showing posts with label JAVA. Show all posts

Wednesday, 16 April 2014

Change the orientation in Birt reporting tools to Landscape and portrait

I am just joined the Birt reporting tool, one of the most popular reporting tools in java , and open source too,
using the help I could developed the report and deployed it on the web and Export it to PDF and EXCEL in easy way and few steps .


the problems come when I want to change the orientation from portrait to landscape

I had search alot , I think that my BIRT version wasn't new enough , it only support from the IDE to make the view Fixed layout or Auto Layout

then 

HOW TO SOLVE IT :

Wednesday, 30 October 2013

What is GWT ? Why we want to use GWT ?

GWT :

Google Web Toolkit (GWT) is an open source Java software development framework that makes writing AJAX applications easy.

Tuesday, 22 October 2013

How can we make a Empty interface ?

we can make an empty interface that to call it and make that configuration to the Compiler to take care about how to deal with the class that implement that interface.


Wednesday, 9 October 2013

Tomcat version 6.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web modules

I had this problem when I was adding my new server(Tomcat 6), While I was configured an old server (Tomcat 7) for the same project



Monday, 23 September 2013

which is better to Packaging EJB in JavaEE 6 WAR vs EAR ?



An important motivation for having EJB beans in a separate JAR is for the age old separation of business logic and view logic.
Since EJBs are supposed to concentrate solely on business logic, it makes sense to put them into a separate module.
This is exactly what the

What is the difference between EJB2 and EJB3?

EJB2 vs EJB3



EJB (Enterprise JavaBeans) is a Java API (Application Programming Interface) found within Java EE (Java Platform, Enterprise Edition) specification. EJB describes an architectural model for the development of enterprise applications. This is a managed server-side model that is able to capture the business logic of the enterprise application. IBM is EJB’s original creator who developed it in 1997. Sun Microsystems adopted it in 1999.

Before the introduction of EJB, it was found that solutions to problems found in back-end business code were frequently re-implemented by the programmers. As a result, EJB was introduced to address these common problems such as persistence, transactional integrity and security. EJB provides standard ways to handle these back end problems, by specifying how the application server should process transactions, integrate with JPA (Java Persistence API) services, handle concurrency control, handle JMS (Java Message Service) Events, resolve naming issues with JNDI (Java Naming and Directory Interface), develop secure programs with JCE (Java Cryptography Extension) and JAAS (Java Authentication and Authorization Service), deploy components, communicate remotely with RMI-IIOP (Java Remote Method Invocation interface over the Internet Inter-Orb Protocol), develop web services, invoke asynchronous methods and use the Timer service.

Monday, 26 August 2013

Java Web Services #Interview Questions and Answers ?

Q. What are the different application integration styles?

A. There are a number of different integration styles like

1. Shared database
2. batch file transfer
3. Invoking remote procedures (RPC)
4. Exchanging asynchronous messages over a message oriented middle-ware (MOM).

Thursday, 22 August 2013

How To Check If Two Or More Rows Have The Same Field Value ?


you want to filter details from db.


The Problem :


I want to select the first row with the last name "usama" and then I want to skip the next row which has the same field "usama".

Sunday, 18 August 2013

Read file and convert it to Array list #java

here is an simple demo of how to read a file and insert it's data into array list separated by new lines.


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class FileArrayProvider {

    public String[] readLines(String filename) throws IOException {
        FileReader fileReader = new FileReader(filename);
        BufferedReader bufferedReader = new BufferedReader(fileReader);
        List<String> lines = new ArrayList<String>();
        String line = null;
        while ((line = bufferedReader.readLine()) != null) {
            lines.add(line);
        }
        bufferedReader.close();
        return lines.toArray(new String[lines.size()]);
    }
}

Friday, 26 July 2013

Total Validation on JTextFiled inputs #java #swing 3 steps

I had found a simple and created an util class that can help in easy way to handle a lot of validations in JText files.

Only in 3 steps in easy way :


how to load Image with relative path and re-size it #java


I had faced it while i was trying to add some image to desktop Applications.

and found many ways by buffered image and loading images itself , here is an easy-way to handle it


Wednesday, 24 July 2013

How To insert and Retrieve image from DB #jdbc #java #MySQL

here is a few steps to insert and retrieve image files from DB.

1. Creating the Image column:


how to change the coffee cup in #Java Frames #GUI

it's weird when you install your program to customer and found that cup in your frames,

While handling this issue is very easy.


you just want to change the icon Image of your fame.

Sunday, 21 July 2013

Two ways to validate email address #regular expression #java

 validation on the email address will be handled using two ways below :


  • Regular expression 
  • apache-commons Email validator.( you need to download the Jar.)


Thursday, 18 July 2013

How to Make All .Jar and lip files in one JAR file . #net-Beans. #java

How to make my project in only one jar file using  net-beans?


In order to make the created JAR include the lips jar.
All what you need is to add below data in Build.xml of your project :


How To convert .jar to .exe #java

How to change jar file and make it executable ".exe" file ?


that's a serious question and there are a lot of programs do it.

but I prefer that one and will make it ease to use it in few steps


How to make a jar file ? #java #net-beans #eclipse #batch file #Windows

In this post, you will know how to create a jar file using net-beans , Eclipse and using ant scripts in easy and straightforward way.

Net-beans.

Step 1: you had to right click on the project 
Step 2: Click Clean and Build.
Step 3: check out the Jar that already created under the project folder (./dist)

PS. to change the entry man class. choose it and edit in MANIFEST.MF       
    Main-Class: package.MainClass

OR 

change the Build.xml  and add below tag.

<manifest file="MANIFEST.MF">
    <attribute name="Main-Class" value="package.MainClass" />
</manifest>


How to run .jar file by #double click #batch file #java

Well. I had faced this issue a lot while I was installing the product to my clients.
and I found just a simple way to handle it easy :)

Double  click into the jar file:


Step 1: Start Control panel
Step 2: Click Default Programs
Step 3: Click Associate a file type or protocol with a specific program
Step 4: Double click .jar
Step 5: Browse C:\Program Files\Java\jre7\bin\javaw.exe
Step 6: Click the button Open
Step 7: Click the button OK

OR
Step 1:  right-click  on the jar file
Step 2: Open With a Java Runtime listed ( C:\Program Files\Java\jre7\bin\javaw.exe)
Step 3: make it the default program to run with.



Wednesday, 17 July 2013

Observer design Pattern with Examples .#Java

Observer design pattern  is a fundamental core pattern where Observe watch for any change in state or property of Subject. 

For Example Company updates all its shareHolder for any decision .

they make here Company is Subject and Shareholders are Observers, 
any change in policy of company , the company will notifies all its Shareholders (observers).



What is Observer design Pattern?


Observer design pattern is very important pattern and as name suggest it’s used to observe things. Suppose you want to notify for change in a particular object than you observer that object and changes are notified to you. Object which is being observed is refereed as Subject and classes which observe subject are called Observer. 

This pattern is used heavily along with Model View Controller Design pattern where change in model is propagated to view so that it can render it with modified information.


Saturday, 13 July 2013

Difference between Enumeration and Iterator ? #java #interview

both Iterator and Enumeration provides way to traverse or navigate through entire collection in java

Enumeration is older and its there from JDK1.0 while iterator was introduced later. 
Iterator can be used with Java arraylist,  java hashmap keyset  and with any other collection classes.


As far Enumeration is older than Iterator so that  functionality of Enumeration interface is duplicated by the Iterator interface.

Only major difference is Iterator has a remove() method while Enumeration doesn't. Enumeration acts as Read-only interface, because it has the methods only to traverse and fetch the objects, where as by using Iterator we can manipulate the objects like adding and removing the objects from collection e.g. Arraylist.