Download HeadFirstServlets Chapter - 3 Mini MVC Tutorial
Download the HeadFirstJava - Chapter-3 ..Mini MVC Tutorials..
The Continuous Download of the Chapter - 2.
Learn CoreJava and advanced concepts in simple steps. This blog is maintained by Nataraz sir students from DurgaSoft and SathyaTech,Ameerpeta,Hyderabad.
import java.util.Vector; import java.util.Collections; public class FindMaximumOfVectorExample { public static void main(String[] args) { //create a Vector object Vector v = new Vector(); //Add elements to Vector v.add(new Double("324.4324")); v.add(new Double("345.3532")); v.add(new Double("342.342")); v.add(new Double("357.349")); v.add(new Double("23.32453")); Object obj = Collections.max(v); System.out.println("Maximum Element of Java Vector is : " + obj); } }
Maximum Element of Java Vector is : 357.349
import java.util.ArrayList; import java.util.Collections; public class FindMaximumOfArrayListExample { public static void main(String[] args) { //create an ArrayList object ArrayList arrayList = new ArrayList(); //Add elements to Arraylist arrayList.add(new Integer("327482")); arrayList.add(new Integer("13408")); arrayList.add(new Integer("802348")); arrayList.add(new Integer("345308")); arrayList.add(new Integer("509324")); Object obj = Collections.max(arrayList); System.out.println("Maximum Element of Java ArrayList is : " + obj); } }
Maximum Element of Java ArrayList is : 802348
import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.Vector; public class CreateArrayListFromEnumerationExample { public static void main(String[] args) { //create a Vector object Vector v = new Vector(); //Add elements to Vector v.add("A"); v.add("B"); v.add("D"); v.add("E"); v.add("F"); System.out.println("Vector contains : " + v); //Get Enumeration over Vector Enumeration e = v.elements(); //Create ArrayList from Enumeration of Vector ArrayList aList = Collections.list(e); System.out.println("Arraylist contains : " + aList); } }
Vector Contains : [A, B, D, E, F] Arraylist contains : [A, B, D, E, F]
/* Copy Elements of Vector to Java ArrayList Example This java example shows how to copy elements of Java Vector to Java ArrayList using copy method of Collections class. */ import java.util.ArrayList; import java.util.Collections; import java.util.Vector; public class CopyElementsOfVectorToArrayListExample { public static void main(String[] args) { //create a Vector object Vector v = new Vector(); //Add elements to Vector v.add("1"); v.add("2"); v.add("3"); //create an ArrayList object ArrayList arrayList = new ArrayList(); //Add elements to Arraylist arrayList.add("One"); arrayList.add("Two"); arrayList.add("Three"); arrayList.add("Four"); arrayList.add("Five"); /* To copy elements of Java Vector to Java ArrayList use, static void copy(List dstList, List sourceList) method of Collections class. This method copies all elements of source list to destination list. After copy index of the elements in both source and destination lists would be identical. The destination list must be long enough to hold all copied elements. If it is longer than that, the rest of the destination list's elments would remain unaffected. */ System.out.println("Before copy ArrayList Contains : " + arrayList); //copy all elements of Vector to ArrayList using copy method of Collections class Collections.copy(arrayList,v); /* Please note that, If ArrayList is not long enough to hold all elements of Vector, it throws IndexOutOfBoundsException. */ System.out.println("After Copy ArrayList Contains : " + arrayList); } } /* Output would be Before copy ArrayList Contains : [One, Two, Three, Four, Five] After Copy ArrayList Contains : [1, 2, 3, Four, Five] */
package collect; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; public class ListClas { public static void main(String[] args) { Listl1=new ArrayList (); l1.add("hi"); l1.add("brother"); ArrayList al=new ArrayList (); al.add("hello"); al.add("guru"); Collections.copy(al,l1); Iterator i= al.iterator(); while(i.hasNext()){ i.hasNext(); System.out.print(" "+i.next()); //System.out.println(al); } } }
After you install Directory Server Enterprise Edition, you can deploy theWARfile to access
DSCC. The following procedure contains the deployment instructions to deploy theWARfile:
▼ To DeployWAR FileWith Sun Java SystemApplication
Server
Create theWAR file for DSCC.
$ install-path/bin/dsccsetup war-file-create
For native packages installation, theWARfile is created in the /var/opt/SUNWdsee7/ directory.
For zip distribution installation, theWARfile is created in the install-path/var directory.
Initialize the DSCC registry.
$ install-path/bin/dsccsetup ads-create
Choose password for Directory Service Manager:
Confirm password for Directory Service Manager:
Creating DSCC registry...
DSCC Registry has been created successfully
To create server instances on the same host where DSCC is deployed, register the DSCC agent in
CommonAgent Container.
$install-path/bin/dsccsetup cacao-reg
Type the following command to check the location and other statistics of yourWARfile and
DSCC registry:
$ install-path/bin/dsccsetup status
Create an application server instance.
$ mkdir /local/domainroot
$ cd app-server-install-path/bin
$ asadmin create-domain --domaindir /local/domainroot --adminport 3737 \
--user admin dscc7
Edit the server.policy file.
a. Open the server.policy file.
$ vi /local/domainroot/dscc7/config/server.policy
1
2
3
4
5
DeployingWAR FileWith Sun Java System Application Server
Sun Directory
b. Add the following statements to the end of the file:
// Permissions for Directory Service Control Center
grant codeBase "file:${com.sun.aas.instanceRoot}/applications/j2ee-modules/dscc7/-"
{
permission java.security.AllPermission;
};
The addition configures the application server to grant all the Java permissions to the DSCC
application.
Deploy theWAR file in your application server instance.
$ asadmin start-domain --domaindir /local/domainroot --user admin dscc7
$ cp install-path/var/dscc7.war /local/domainroot/dscc7/autodeploy
For more information about creating and configuring application server instances and
deploying theWARfile, refer to the Sun Java System Application Server OnlineHelp.
Open DSCC.
Use http://hostname:8080/dscc7 or https://hostname:8181/dscc7 based on the
configuration of your application server.
The Directory ServiceManager Login page displays.
click here to download the fulll pge
Normalization:
Normalization is a design technique which helps to design the relational database.
Normalization is essentially a two step process that puts data into tabular form by removing redundant data from the relational tables.
Normalization has been divided into following types.
1.First Normal Form (1NF): A Relational table all column values are atomic.It means that it contains no repeating values.
(or)
A Relational table should not be any multivalued column.
2.Second Normal Form (2NF) : A Relational table is in second normal form if it is in First Normal form and every Non-Key Column is fully dependent on PrimaryKey.
(or)
The table should be in 1NF and every non key column must fully functional dependent on primaryKey.
3.Third Normal Form (3NF): A Relational table is in third Normal Form (3NF) if it is already in 2NF and every non-key column is non transitive dependent upon its primary key.
(or)
The table should be in 2NF and every non-key column should not be any transitive dependencies.
4.Boyce Codd Normal Form (BCNF) : The Relational table is in BCNF if it is already in 3NF and every non key column should not be overlapping between candidate keys.
(or)
The table should be in 3NF and the columns should not be overlapping between any candidate keys.