Wednesday, December 28, 2011

Accessing another managed Bean


The Two method Suppose I want to access the login bean from welcome bean.
1) Using the Value Binding
FacesContext fc = FacesContext.getCurrentInstance();
LoginBean loginBean = (LoginBean)  fc.getApplication().createValueBinding("# {login}").getValue(fc);

2) Using the Variable Resolver
FacesContext fc = FacesContext.getCurrentInstance();
LoginBean loginBean = (LoginBean) fc.getApplication().getVariableResolver().resolveVariable(fc, "login");

Friday, November 04, 2011

Change HTTP port in OracleXE


SQL> begin
 2    dbms_xdb.sethttpport('9080');
 3  end;
 4  /

Tuesday, November 01, 2011

How to Database options in Oracle

select * from v$options;


 it  will give parameters configured in DB like Partitioning(TRUE/FALSE),RAC,DB queuing,Indexing ,Spatial,Duplex backup,Java,OLAP,DataMinig

Sunday, October 30, 2011

SYS.DBMS_SCHEDULER


BEGIN
    SYS.DBMS_SCHEDULER.CREATE_JOB (
            job_name => '"SYSTEM"."MULT2"',
            job_type => 'PLSQL_BLOCK',
            job_action => 'BEGIN 
 INSERT INTO HR.HEXA VALUES(''IND'',''KER'');
 INSERT INTO HR.HEXA VALUES(''NETHERLAND'',''HOLLAND'');
COMMIT;
END;',
            number_of_arguments => 0,
            start_date => SYSTIMESTAMP,
            repeat_interval => 'FREQ=MINUTELY',
            end_date => NULL,
            job_class => '"SYS"."DEFAULT_JOB_CLASS"',
            enabled => FALSE,
            auto_drop => FALSE,
            comments => 'MULT2 Descri');


    SYS.DBMS_SCHEDULER.SET_ATTRIBUTE( 
             name => '"SYSTEM"."MULT2"', 
             attribute => 'logging_level', value => DBMS_SCHEDULER.LOGGING_OFF);
  
  
    SYS.DBMS_SCHEDULER.enable(
             name => '"SYSTEM"."MULT2"');
END; 
/

Scheduled JOB, Oracle DB


BEGIN
dbms_scheduler.create_schedule(  
schedule_name  => 'INTERVAL_EVERY_1_MINUTES',  
  start_date    => trunc(sysdate),  
  repeat_interval => 'freq=MINUTELY',  
  comments     => 'Runtime: Every minut');
 
  dbms_scheduler.create_program  
(program_name=> 'PROG_DO_HR_INSERT',  
 program_type=> 'PLSQL_BLOCK',  
 program_action=> 'BEGIN  INSERT INTO HR.HEXA VALUES('actiont','FRM MINUT SCHEDULE-R'); COMMIT; END',  
 enabled=>true,  
 comments=>'Procedure to save sample Data to \hexa table every Minut'  
 );
 
  dbms_scheduler.create_job  
 (job_name => '30_OCT_2011_Job1',  
  program_name=> 'PROG_DO_HR_INSERT',  
  schedule_name=>'INTERVAL_EVERY_1_MINUTES',  
  enabled=>true,  
  auto_drop=>false,  
  comments=>'Job to  save sample Data to \hexa table every Minut');
 COMMIT; 
 END; 

SCHEDULER_JOB in oracle data base

SELECT JOB_NAME,JOB_TYPE,JOB_ACTION,SCHEDULE_NAME,SCHEDULE_TYPE,JOB_CLASS,STATE FROM  DBA_SCHEDULER_JOBS WHERE JOB_NAME='JobName';
--------------------------------------------------------------------------------------


SELECT owner, program_name, enabled FROM dba_scheduler_programs;

Saturday, October 29, 2011

Oracle Database Scheduler


BEGIN
    sys.DBMS_SCHEDULER.CREATE_SCHEDULE (
     
        repeat_interval  => 'FREQ=MINUTELY;INTERVAL=2',    
        start_date => TO_TIMESTAMP_TZ('2011-10-29 15:57:26 Asia/Riyadh','YYYY-MM-DD HH24.MI.SS TZR'),
        schedule_name  => '"EVERY2minut"');
       
END;

Monday, October 17, 2011

JAVA Card: Applet Code

From :Jan Vossaert`s Smart Card Tutorial

package be.msec.smartcard;

import com.sun.javacard.crypto.ad;

import javacard.framework.APDU;
import javacard.framework.Applet;
import javacard.framework.ISO7816;
import javacard.framework.ISOException;
import javacard.framework.OwnerPIN;

public class IdentityCard extends Applet {
private final static byte IDENTITY_CARD_CLA =(byte)0x80;

private static final byte VALIDATE_PIN_INS = 0x22;
private static final byte GET_SERIAL_INS = 0x26;

private static final byte GET_IDENTITY_NO = 0x25;

private final static byte PIN_TRY_LIMIT =(byte)0x03;
private final static byte PIN_SIZE =(byte)0x04;

private final static short SW_VERIFICATION_FAILED = 0x6300;
private final static short SW_PIN_VERIFICATION_REQUIRED = 0x6301;

private byte[] serial = new byte[]{(byte)0x4A, (byte)0x61, (byte)0x6e};
private OwnerPIN pin;

private IdentityCard() {
/*
* During instantiation of the applet, all objects are created.
* In this example, this is the 'pin' object.
*/
pin = new OwnerPIN(PIN_TRY_LIMIT,PIN_SIZE);
pin.update(new byte[]{0x01,0x02,0x03,0x04},(short) 0, PIN_SIZE);

/*
* This method registers the applet with the JCRE on the card.
*/
register();
}

/*
* This method is called by the JCRE when installing the applet on the card.
*/
public static void install(byte bArray[], short bOffset, byte bLength)
throws ISOException {
new IdentityCard();
}

/*
* If no tries are remaining, the applet refuses selection.
* The card can, therefore, no longer be used for identification.
*/
public boolean select() {
if (pin.getTriesRemaining()==0)
return false;
return true;
}

/*
* This method is called when the applet is selected and an APDU arrives.
*/
public void process(APDU apdu) throws ISOException {
//A reference to the buffer, where the APDU data is stored, is retrieved.
byte[] buffer = apdu.getBuffer();

//If the APDU selects the applet, no further processing is required.
if(this.selectingApplet())
return;

//Check whether the indicated class of instructions is compatible with this applet.
if (buffer[ISO7816.OFFSET_CLA] != IDENTITY_CARD_CLA)ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
//A switch statement is used to select a method depending on the instruction
switch(buffer[ISO7816.OFFSET_INS]){
case VALIDATE_PIN_INS:
validatePIN(apdu);
break;
case GET_SERIAL_INS:
getSerial(apdu);
break;
//If no matching instructions are found it is indicated in the status word of the response.
//This can be done by using this method. As an argument a short is given that indicates
//the type of warning. There are several predefined warnings in the 'ISO7816' class.
default: ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
}
}

/*
* This method is used to authenticate the owner of the card using a PIN code.
*/
private void validatePIN(APDU apdu){
byte[] buffer = apdu.getBuffer();
//The input data needs to be of length 'PIN_SIZE'.
//Note that the byte values in the Lc and Le fields represent values between
//0 and 255. Therefore, if a short representation is required, the following
//code needs to be used: short Lc = (short) (buffer[ISO7816.OFFSET_LC] & 0x00FF);
if(buffer[ISO7816.OFFSET_LC]==PIN_SIZE){
//This method is used to copy the incoming data in the APDU buffer.
apdu.setIncomingAndReceive();
//Note that the incoming APDU data size may be bigger than the APDU buffer
//size and may, therefore, need to be read in portions by the applet.
//Most recent smart cards, however, have buffers that can contain the maximum
//data size. This can be found in the smart card specifications.
//If the buffer is not large enough, the following method can be used:
//
//byte[] buffer = apdu.getBuffer();
//short bytesLeft = (short) (buffer[ISO7816.OFFSET_LC] & 0x00FF);
//Util.arrayCopy(buffer, START, storage, START, (short)5);
//short readCount = apdu.setIncomingAndReceive();
//short i = ISO7816.OFFSET_CDATA;
//while ( bytesLeft > 0){
// Util.arrayCopy(buffer, ISO7816.OFFSET_CDATA, storage, i, readCount);
// bytesLeft -= readCount;
// i+=readCount;
// readCount = apdu.receiveBytes(ISO7816.OFFSET_CDATA);
//}
if (pin.check(buffer, ISO7816.OFFSET_CDATA,PIN_SIZE)==false)
ISOException.throwIt(SW_VERIFICATION_FAILED);
}else ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
}

/*
* This method checks whether the user is authenticated and sends
* the serial number.
*/
private void getSerial(APDU apdu){
//If the pin is not validated, a response APDU with the
//'SW_PIN_VERIFICATION_REQUIRED' status word is transmitted.
if(!pin.isValidated())ISOException.throwIt(SW_PIN_VERIFICATION_REQUIRED);
else{
//This sequence of three methods sends the data contained in
//'serial' with offset '0' and length 'serial.length'
//to the host application.
apdu.setOutgoing();
apdu.setOutgoingLength((short)serial.length);
apdu.sendBytesLong(serial,(short)0,(short)serial.length);

}
}
}


DOCS 
---------------------------------------------------------

Java Card Applet Deployment

JAVA CARD:Gemalto TOP IM GX4

GPShell script


mode_211
gemXpressoPro
enable_trace
establish_context
card_connect
select -AID A000000018434D00
open_sc -security 3 -keyind 0 -keyver 0 -key 47454d5850524553534f53414d504c45 // Open secure channel
delete -AID 0102030405060708090000
delete -AID 01020304050607080900
install -file smartcard.cap -priv 04 -sdAID A000000018434D00 -nvCodeLimit 4000
card_disconnect
release_context


------------------------------------------
Docs
http://sourceforge.net/apps/mediawiki/globalplatform/index.php?title=GPShell

Java Card compilation code

"C:\jdk1.6.0_27\bin\javac.exe" -source 1.2 -target 1.2 -g -classpath "C:\Tutorial\eclipse\java_card_kit-2_2_1"\lib\javacardframework.jar;"C:\Tutorial\eclipse\java_card_kit-2_2_1"\lib\apduio.jar;"C:\Tutorial\eclipse\java_card_kit-2_2_1"\lib\apdutool.jar;"C:\Tutorial\eclipse\java_card_kit-2_2_1"\lib\jcwde.jar;"C:\Tutorial\eclipse\java_card_kit-2_2_1"\lib\converter.jar;"C:\Tutorial\eclipse\java_card_kit-2_2_1"\lib\scriptgen.jar;"C:\Tutorial\eclipse\java_card_kit-2_2_1"\lib\offcardverifier.jar;"C:\Tutorial\eclipse\java_card_kit-2_2_1"\lib\api.jar;"C:\Tutorial\eclipse\java_card_kit-2_2_1"\lib\installer.jar;"C:\Tutorial\eclipse\java_card_kit-2_2_1"\lib\capdump.jar;"C:\Tutorial\eclipse\java_card_kit-2_2_1"\samples\classes;%CLASSPATH% -d .\target C:\Projects\JavaCard\src\sajjad\IdentityCard.java

Friday, October 14, 2011

TLV parser -2


 public static void parseTLV(String TAG,byte[] b) throws Exception
    {
     System.out.println("-------------------- TAG------------------------"+TAG);
    byte[] tagBA=hexStringToByteArray(TAG);
    boolean isTagExist=false;
    int tagStartLoc=0;
    for(int i=0;i<b.length;i++)
    {
        if(isTagExist)
            break;
           for(int j=0;j<tagBA.length;j++)
           {
           if(b[i+j]!=tagBA[j])
               break;
           if(j==tagBA.length-1)
           {
               isTagExist=true;
               tagStartLoc=i;
         
           }
           }
    }
    if(isTagExist)
    {
        for(int i=tagStartLoc;i<b.length;i++)
            System.out.println("  - "+b[i]);
       byte[] bx=new byte[b.length-tagStartLoc];
        System.out.println("Starting Location"+tagStartLoc);
        System.arraycopy(b, tagStartLoc, bx, 0,tagBA.length);
        byte[] length=new byte[1];
        System.arraycopy(b, tagStartLoc+tagBA.length,length, 0,1);
        System.out.println("-------------------- TAG------------------------");
        String lenStr=getHexString(length);
        Integer lenInt=Integer.parseInt(lenStr, 16);
        byte[] data= new byte[lenInt];
        System.arraycopy(b, tagStartLoc+tagBA.length+1,data, 0,lenInt);
        System.out.println(getHexString(data));
     
    }

Simple TLV parser


    public static String getHexString(byte[] b) throws Exception {
   String a="";
    for (int i = 0; i < b.length; i++) {
     a = a+Integer.toString((b[i] & 0xff) + 0x100, 16).substring(1);
    }
    return a;
}
   public static String[] getStringArray(String hexString)
   {
       String[] sr=new String[hexString.length()/2];
       
        for(int i=0;i<hexString.length()-1;i++)
        {
            if(i%2==0)
             
        sr[i/2]=hexString.substring(i, i+2);
                 
                }
       return sr;
   }
   public static String[] dataToStrArray(byte[] b) throws Exception
   {
     
       String s=getHexString(b);
       String[] sr=getStringArray(s);
       return sr;
     
   }
   public  static void parseTLV(String[] r, String tag)
   {
      if(tag.length()==2)
      {
        Integer len=new Integer(0) ;
         for(int i=0;i<r.length;i++)
   
          if(r[i].equalsIgnoreCase(tag))
          { //System.out.println("TAG"+tag+"\n Len:"+r[i+1]);
             len=Integer.parseInt(r[i+1], 16);
             System.out.println();
            for (Integer j=1;j<=len;j++)
            {
                System.out.print(r[i+j+1]+" \t");
            }
            System.out.println();
          }
      }
      else if(tag.length()==4)
      {
            Integer len=new Integer(0) ;
            String tagHandler;
         for(int i=0;i<r.length-1;i++)
         {    tagHandler=r[i]+r[i+1];
          if(tagHandler.equalsIgnoreCase(tag))
          {
              System.out.println("TAG"+tagHandler+"\n Len:"+r[i+2]);
             len=Integer.parseInt(r[i+2], 16);
             System.out.println();
            for (Integer j=1;j<=len;j++)
            {
                System.out.print(r[i+j+2]+" \t");
            }
            System.out.println();
          }
         }
      }
       
   
   }
 
    public static byte[] hexStringToByteArray(String s) {
        int len = s.length();
        byte[] data = new byte[len / 2];
        for (int i = 0; i < len; i += 2) {
            data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
                                 + Character.digit(s.charAt(i+1), 16));
        }
        return data;
    }

Monday, September 12, 2011

Handling Scalar values(aggregation function) From JPA layer




---------in EJB file------------

public List<CountryRegCount> getReg()
    {
    List<CountryRegCount> lst=new ArrayList<CountryRegCount>();  
     
      Iterator<Object[]> results=em.createQuery("select count(c) ,c.regionId from Countries c GROUP BY c.regionId").getResultList().iterator();
     
         
          while ( results.hasNext() ) {
    Object[] row = results.next();
   
    Long count = (Long) row[0];
   
    int  count_i=count.intValue();
   
    Regions regId = (Regions) row[1];
    BigDecimal  regId_i=regId.getRegionId();
   
    lst.add(new CountryRegCount(count_i, regId.getRegionName()));
   
        }
       
       return lst;
    }


--------------------------------------------------------------------------------------------------------
Entity file in JPA layer


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jpa;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Sajjad
 */
@Entity
@Table(name = "COUNTRIES")
@XmlRootElement
@NamedQueries({
   
    @NamedQuery(name = "Countries.findAll", query = "SELECT c FROM Countries c"),
    @NamedQuery(name = "Countries.findAll", query = "SELECT c FROM Countries c"),
    @NamedQuery(name = "Countries.findByCountryId", query = "SELECT c FROM Countries c WHERE c.countryId = :countryId"),
    @NamedQuery(name = "Countries.findByCountryName", query = "SELECT c FROM Countries c WHERE c.countryName = :countryName")})
public class Countries implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2)
    @Column(name = "COUNTRY_ID")
    private String countryId;
    @Size(max = 40)
    @Column(name = "COUNTRY_NAME")
    private String countryName;
    @JoinColumn(name = "REGION_ID", referencedColumnName = "REGION_ID")
    @ManyToOne
    private Regions regionId;
    @OneToMany(mappedBy = "countryId")
    private List<Locations> locationsList;

    public Countries() {
    }

    public Countries(String countryId) {
        this.countryId = countryId;
    }

    public String getCountryId() {
        return countryId;
    }

    public void setCountryId(String countryId) {
        this.countryId = countryId;
    }

    public String getCountryName() {
        return countryName;
    }

    public void setCountryName(String countryName) {
        this.countryName = countryName;
    }

    public Regions getRegionId() {
        return regionId;
    }

    public void setRegionId(Regions regionId) {
        this.regionId = regionId;
    }

    @XmlTransient
    public List<Locations> getLocationsList() {
        return locationsList;
    }

    public void setLocationsList(List<Locations> locationsList) {
        this.locationsList = locationsList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (countryId != null ? countryId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Countries)) {
            return false;
        }
        Countries other = (Countries) object;
        if ((this.countryId == null && other.countryId != null) || (this.countryId != null && !this.countryId.equals(other.countryId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jpa.Countries[ countryId=" + countryId + " ]";
    }
   
}


Monday, August 15, 2011

JSF custom validator

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.test;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.FacesValidator;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;

/**
*
* @author Sajjad
*/
@FacesValidator("com.test.Recp")
public class RecpValidator implements Validator{
public void validate(FacesContext context, UIComponent component,Object value) {
if(value == null) return;
String valString=value.toString();
if(valString.length()!=6) {
FacesMessage message = new FacesMessage();
// com.corejsf.util.Messages.getMessage("com.corejsf.messages", "badLuhnCheck", null);
message.setSeverity(FacesMessage.SEVERITY_ERROR);
message.setSummary("String length must be 6");
message.setDetail("String length must be 6");

throw new ValidatorException(message);
}
}
}

Sunday, July 24, 2011

Derby JDBC client file

The Apache Derby JDBC driver is included inside the derbyclient.jar file that comes with the BIN or lib distribution of Derby.

Wednesday, July 20, 2011

ArrayList

import java.util.ArrayList;



public class Main {

/**
* @param args
*/
public static ArrayList merge(String[] words, String[] more) {
ArrayList sentence = new ArrayList();
for (String w : words) sentence.add(w);
for (String w : more) sentence.add(w);
return sentence;
}
public static void main(String[] args) {
String[] northAmerica=new String[5];
northAmerica[0]="USA";
northAmerica[2]="CANADA";
northAmerica[1]="Mexico";
northAmerica[3]="Panama";
northAmerica[4]="Haiti" ;

String[] southAmerica=new String[5];
southAmerica[0]="Brazil";
southAmerica[1]="Argentina";
southAmerica[2]="Colombia";
southAmerica[3]="Uruguay";
southAmerica[4]="Venezuela";
ArrayList americanContr=new ArrayList();
americanContr=merge(northAmerica, southAmerica);
System.out.println(americanContr);
}

}

HashTable

import java.util.HashMap;

/**
*
*/

/**
* @author Sajjad
*
*/
class Student
{
private int id;
private String name;
private String std;

public int getId() {
return id;
}

public Student(int id, String name, String std) {
this.id = id;
this.name = name;
this.std = std;
}

@Override
public String toString() {
return "Student [id=" + id + ", name=" + name + ", std=" + std + "]";
}


}
public class hashTable {

/**
* @param args
*/
public static HashMap buildMap(Student[] students) {
HashMap map = new HashMap();
for (Student s : students) map.put(s.getId(), s);
return map;
}
public static void main(String[] args) {
Student[] students = new Student[5];
students[0]=new Student(1, "abdulla", "KG1");
students[1]=new Student(2, "Mohd", "KG2");
students[2]=new Student(3, "Harry", "2");
students[3]=new Student(4, "Saud", "KG1");
students[4]=new Student(5, "John", "KG2");

// TODO Auto-generated method stub
// for (Student s : students)
//{
// System.out.println(s);
//}
HashMap myMap = new HashMap();
myMap=buildMap(students);
System.out.println(myMap);

}

}

Friday, July 15, 2011

write log-in data in session - JSF

FacesContext context = FacesContext.getCurrentInstance();
HttpSession session =
(HttpSession)context.getExternalContext().getSession(true);

session.setAttribute("username", user);
session.setAttribute("password", pass);

Wednesday, July 13, 2011

change Run target in Jdeveloper

Project Properties->Run/Debug Profile Edit default profile->Launch Settings

Wednesday, June 22, 2011

get Locale in JSF

public Locale getLocale()
{
FacesContext fc=FacesContext.getCurrentInstance();
UIViewRoot vr= fc.getViewRoot();
Locale lc=vr.getLocale();
return lc;

}

Tuesday, June 21, 2011

JSF validation function

public void validateName(FacesContext fc, UIComponent c, Object value) {
if ( ((String)value).contains("_") )
throw new ValidatorException(
new FacesMessage("Name cannot contain underscores"));

Tuesday, June 07, 2011

View Parameter in JSF(equalant to $_GET in PHP)

url:http://localhost:8080/Jfa/faces/profile.xhtml?user=tom  

<f:metadata>
<f:viewParam name="user" value="#{student.getx}"/>
</f:metadata>

Tuesday, May 17, 2011

NetWork interface Reader


import java.io.*;
import java.net.*;
import java.util.*;
import static java.lang.System.out;
public class Main  {
  public  void  call()
  {

  }
    public static void main(String[] args) throws IOException  {
        
             Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
             int i=0;
        for (NetworkInterface netint : Collections.list(nets))
        {out.print("---------------------"+i+++"\n");
            displayInterfaceInformation(netint);
        }


    }
     static void displayInterfaceInformation(NetworkInterface netint) throws SocketException {
       out.printf("Display name: %s\n", netint.getDisplayName());
        out.printf("Name: %s\n", netint.getName());
        Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();

        for (InetAddress inetAddress : Collections.list(inetAddresses)) {
            out.printf("InetAddress: %s\n", inetAddress);
        }

        out.printf("Up? %s\n", netint.isUp());
        out.printf("Loopback? %s\n", netint.isLoopback());
        out.printf("PointToPoint? %s\n", netint.isPointToPoint());
        out.printf("Supports multicast? %s\n", netint.supportsMulticast());
        out.printf("Virtual? %s\n", netint.isVirtual());
        out.printf("Hardware address: %s\n",
                    Arrays.toString(netint.getHardwareAddress()));
        out.printf("MTU: %s\n", netint.getMTU());

        out.printf("\n");
     }

}

JSF application with file extension .JSF



<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.jsf</param-value>
</context-param>

in web.xmlin web.xml

Tuesday, May 10, 2011

Port Scanner in Java


public static void main(String[] args)  {
        URLConnection conn;
       for(int port=1;port<65535;port++)
       {
            try {
                ServerSocket serv = new ServerSocket(port);
                if(serv.isBound())
                    {
                    serv.close();
                    }
            } catch (IOException ex) {
                System.out.println(port);
            }

       }


    }

Tuesday, April 26, 2011

Issue:Netbeans Project properties: Add Framework disabled

If Frameworks disabled in project properties, do the following procedures
go to
 Tools->Plugins->installed plug ins
Select JavaEE+Web
activate

after activating Plugins of Java EE , Frameworks will load in your project properties