Inheritance and Overriding

Classes can extend generic classes, and provide values for type parameters or add new type parameters by in doing so. For example, all the following are legal:
 class MyStringList extends ArrayList<String> { ... }
 class A<X, Y, Z> { ... }
 class B<M,N> extends A<N, String, Integer> { ... }
The addition of generics does, however, change the rules of method overriding slightly. Note in the first example above (MyStringList) the effective signatures of the 'get' method in ArrayList and our subclass:
 public Object get(int i);
 public String get(int i);
Through inheritance, the return type has changed. Prior to Java 1.5, this would not have been legal; however, with the addition of parameterized types, the rule has change from "the return types must be identical" to "the return type of the method must be a subtype of all the methods it overrides." As such, the following, which would not compile in a 1.4 environment, is perfectly acceptable in 1.5:
  public class Parent {
    public Number getX() { ... }
  public class Child extends Parent {
    public Integer getX() { ... }

Exception Handling in Generics

Type parameters may be used in the throws clause of a method declaration, but (to preserve JVM compatibility) not in a catch clause. shows an example.

 Generic exception handling.

 public interface MyAction <E extends Exception> {

  public void doWork() throws E;


 public class MyFileAction implements MyAction<FileNotFoundException> {

 public void doWork() throws FileNotFoundException {

   new File("/foo/bar.txt");

  // do something here...



 // client code

 MyFileAction fileAction = new MyFileAction();

  try {



  catch (FileNotFoundException e) {



Type Erasure of Generics

When a generic type is instantiated, the compiler translates those types by a technique called type erasure — a process where the compiler removes all information related to type parameters and type arguments within a class or method. Type erasure enables Java applications that use generics to maintain binary compatibility with Java libraries and applications that were created before generics.
For instance, Box<String> is translated to type Box, which is called the raw type — a raw type is a generic class or interface name without any type arguments. This means that you can't find out what type of Object a generic class is using at runtime. The following operations are not possible:
public class MyClass<E> {
    public static void myMethod(Object item) {
        // Compiler error
        if (item instanceof E) {
        // Compiler error
        E item2 = new E();
        // Compiler error
        E[] iArray = new E[10];
        // Unchecked cast warning
        E obj = (E)new Object();
The operations shown in bold are meaningless at runtime because the compiler removes all information about the actual type argument (represented by the type parameter E) at compile time.

40 million people in protest against SOPA and PIPA campaign

In protest against SOPA, Mozilla announced more than 40 million people were reached.around 30 million people in the U.S. use Firefox's default start page, which reached the lion's share of users; and the social media messages Mozilla sent out were retweeted, shared, and liked by more than 20,000 people.As a result of Mozilla's campaign, 360,000 e-mails were sent to senators and members of Congress, 1.8 million people went to to learn more about the antipiracy laws, and 600,000 went on to visit the Strike Against Censorship page that is hosted by the Electronic Frontier Foundation, Fowler said
Other major Web sites also launched informational and take-action campaigns. Google redirected users to sign a petition being sent to Congress and the Senate that more than 7 million people signed. Wikipedia completely blacked out its English language site and provided information for people to protest SOPA and PIPA.
It's likely that this isn't the last that U.S. legislators will hear from these protesters. "The debate is far from over," Fowler wrote. "Keep the pressure on and make sure your elected officials understand the nuance of the issue and the importance of protecting the open Web."

Device Queue and Print Daemon

Device Queue

All the Print Requests are registered in the Print Queue and printed, for example, directly in UNIX or by using the BAAN lp6.1 script. Some options are:
  • You can restart the print request without running the session again
  • You can preserve the request for later use.
  • You can display the request.
  • You can also change a couple of things depending on the Status of the Print Request. 

Printer Daemon
The Printer Daemon is a process that handles the Queue and registers the request as mentioned before. Without having the Printer Daemon up and running, it is not possible to print, but you can use the Display device.

To start and stop the Printer Daemon, some scripts are used. At system boot time the rc.start script is used to start a couple of processes, one of them is the pdaemon6.1. The rc.stop script is used to stop the processes. But you can also start and stop them by typing:
  • pdaemon6.1 -r Start
  • pdaemon6.1 -k Stop

1) Communication
The Printer Daemon establishes communication with the following processes:

  • lp or other UNIX command
  • lp6.1 
  • filter6.1

The filter6.1 process is used to translate the BAAN internal codes for bold, italic, underlined, and so on, into the printer-specific codes. The filter6.1 process makes use of Printer Interface files which are stored in the ${BSE}/lib/printinf directory. An example is:

Device Management in BAAN ERP

Generating output is one of the most important tasks of an information system.  Raw data is fed into the system and processed.  The processed data must then be sent to a suitable output device such as a printer, a terminal screen, or a file to be of further use.

Figure Representing Device Management:

Device Types:

Within BAAN Software the following Device Types can be defined:
  • Printer (Physical Printer)
  • Direct (also a physical printer but not handled by the print deamon)
  • Logical Printer (set of physical printers)
  • Append to File
  • Rewrite File
  • Screen
  • Aux. Port
1) Screen Device

2) File Devices

There are two different File Devices:

  • Append
  • Rewrite

If required, you can make use of a converting program to convert the output into other formats, for example, ASCII format. 
The user may assign a name and directory path to the output file.

3) Printer Devices
There are three kinds of Printer Devices:

  • Printer
  • Logical Printer
  • Direct

4) The Printer Device Types
A Printer Device is handled by the BAAN shell script lp6.1. This shell script contains the UNIX commands for different kinds of hardware platforms. To define a Printer Device, you have to specify the UNIX Spooler name of that printer, for example pr1001. 
The Logical Printer is group of physical Printers.
The Direct Printer is handled directly by UNIX. You have to specify the whole UNIX command like: /bin/lp -c -dpr1005 -n%d -s %s. See the paragraph on Maintaining Device Data for an explanation of this command. 

5) Device Queue and Printer Daemon
The Device Queue is the Tools Table ttaad320, which contains all the Print Requests. This table is used by the Printer Daemon to register the Requests and to handle them. 

Phone hacking: Jude Law, Lord Prescott and Sara Payne get payouts

 Law's phone was hacked repeatedly between 2003 and 2006

Jude Law and Lord Prescott are among the latest people given payouts over phone hacking by the News of the World.

Actor Law received £130,000 ($200,000) and his ex-wife Sadie Frost £50,000. The ex-deputy PM got £40,000, the High Court was told.

Sara Payne, mother of murdered schoolgirl Sarah, and Shaun Russell, whose wife and daughter were murdered in 1996, were given undisclosed sums.

News International apologised in court but said it would not comment further.

As details emerged of the latest 36 cases, lawyers said most people pursuing damages had now settled out of court.

In a statement issued after the hearing, Law said: "I was suspicious about how information concerning my private life was coming out in the press.

"I changed my phones, I had my house swept for bugs but still the information kept being published. I started to become distrustful of people close to me."

In total 16 articles were published containing Law's personal information. His personal assistant Ben Jackson was also awarded £40,000, while his public relations consultant Ciara Parkes got £35,000.

Law's phone was repeatedly hacked between 2003 and 2006. Frost said she had distrusted him because journalists always knew where she would be, the court heard.

What do you mean by string immutability in Java?

Ques:what is meant by strings are immutable in java?
Ans: immutable means that once an object of that Class has been created it can't be altered.

This is useful as it means you can pass references to the object around, without worrying that someone else is going to change it's contents.

Why String is immutable?
If they were mutable then there would be no String pool implementation and the performance gains of the String pool become lost.

Wrong Use of Generics

When we define generics, we use Object as a data type where we are not sure about the actual type.
Map<String, Object> data = new HashMap<String, Object>();
We are not doing any value add by defining the generic as Object (You must be remembering that Object class is the Super parent class).

Subtyping of Generics

As you already know, it's possible to assign an object of one type to an object of another type provided that the types are compatible. For example, you can assign an Integer to an Object, since Object is one of Integer's supertypes:
Object someObject = new Object();
Integer someInteger = new Integer(10);
someObject = someInteger; // OK
In object-oriented terminology, this is called an "is a" relationship. Since an Integer is a kind of Object, the assignment is allowed. But Integer is also a kind of Number, so the following code is valid as well:
public void someMethod(Number n){
    // method body omitted
someMethod(new Integer(10));  // OK
someMethod(new Double(10.1)); // OK
The same is also true with generics. You can perform a generic type invocation, passing Number as its type argument, and any subsequent invocation of add will be allowed if the argument is compatible with Number:
Box<Number> box = new Box<Number>();
box.add(new Integer(10));  // OK
box.add(new Double(10.1)); // OK

What is Wildcard in Generics?

When no specific knowledge of the value of a type parameter is needed, it can be replaced by a wildcard. The wildcard alone, represented by a question mark, takes the value of the default bound of the corresponding formal type parameter, which is Object in following example:

void printElements(List<?> myList) { ... }

A wildcard might include an upper bound, which states that the value of the type parameter must be equal to, or a descendent of the bound, as in the following:

 void addAll(Collection<? extends E>) { ... {

A wildcard may alternately specify a lower bound, as in the following:

 void addAll(Collection<? super E>) { ... {

example of upperbound wildcard

It is possible to set the upper bound of the wildcard like this:

List<? extends Vehicle> vehicles = new ArrayList<? extends Vehicle>();   

In this example I have specified the upper bound to be the class Vehicle. I can now define the processElements() method like this:

public void processElements(List<? extends Vehicle> elements){
   for(Vehicle o : elements){

As you can see it is now safe to cast each element in the list to a Vehicle, as it is done by the new for loop inside the method.
Furthermore, it is now safe to call the method using a List<Car> instance, provided that Car extends Vehicle. Here is an example:

List<Car> elements = new ArrayList<Car>
// ... add Car elements to the list.

But, even when using a wildcard with an upper bound it is not safe to write to the List. After all, a Car is always a Vehicle, but a Vehicle is not always a Car.

By using wildcard, Well, we got:
1) A way to specify that a collection can contain any type.
2) A way to specify that a collection can contain any subtype of X.
3) ... and this at the price of not being able to write to such a collection.

Explain Bounded type parameters of Generics

A declaration of type parameters for a class or an interface is allowed to place restrictions on the relations between the types involved. These restrictions are of the form of subtype (supertype) relations. For example
public class Foo<S,T extends S> {
declares two type parameters S and T for class Foo, but requires in addition that, in any instantiation, T must be a subtype of S. (It can be expected that this relation between the two types will be exploited in the code defining the class Foo, otherwise it would be pointless.)
Here is a more concrete example in which one of the types is constant.
public class SortedList<E extends Comparable> {
    public void insert(E item);
The elements of a sorted list (or priority queue or binary search tree etc.) must be comparable with respect to order, since this will be assumed in the insertion routine. The type declaration ensures this by requiring that elements of type E implement the Comparable interface:
public interface Comparable {
    public int compareTo(Object o);
It is instructive to compare this with the earlier approach to such classes. Previously a generic sorted list might be defined by
public class SortedList {
    public void insert(Comparable item);
This will ensure that any object inserted into the list implements a compareTo method. But it does not ensure that it is the same relation. For example:
SortedList list = new SortedList();
list.insert(new Integer(0));
list.insert(new Float(0.0));
will succeed at compile-time but lead to a ClassCastException at run-time, when an attempt is made to compare the order of an Integer and a Float.
If instead, in Java 5, we use the definition
public class SortedList<E extends Comparable> {
    public void insert(E item);
then the compiler will force the programmer to decide between
SortedList<Float> list = new SortedList<Float>();
SortedList<Integer> list = new SortedList<Integer>();
so that one or other of the lines
list.insert(new Integer(0));
list.insert(new Float(0.0));
will already fail at compile-time.

The Diamond - Generics

 In Java SE 7 and later, you can replace the type arguments required to invoke the constructor of a generic class with an empty set of type parameters (<>) as long as the compiler can determine, or infer, the type arguments from the context. This pair of angle brackets, <>, is informally called the diamond. For example, you can create an instance of Box<Integer> with the following statement:
Box<Integer> integerBox = new Box<>(); 
Generic Methods: 

You can write a single generic method declaration that can be called with arguments of different types. Based on the types of the arguments passed to the generic method, the compiler handles each method call appropriately. Following are the rules to define Generic Methods:
- All generic method declarations have a type parameter section delimited by angle brackets (< and >) that precedes the method's return type ( < E > in the next example).
- Each type parameter section contains one or more type parameters separated by commas. A type parameter, also known as a type variable, is an identifier that specifies a generic type name.
- The type parameters can be used to declare the return type and act as placeholders for the types of the arguments passed to the generic method, which are known as actual type arguments.
- A generic method's body is declared like that of any other method. Note that type parameters can represent only reference types not primitive types (like int, double and char).
Following example illustrate how we can print array of different type using a single Generic method:
public class GenericMethod
   // generic method printArray                        
   public static < E > void printArray( E[] inputArray )
      // Display array elements             
         for ( E element : inputArray ){       
            System.out.printf( "%s ", element );

    public static void main( String args[] )
        // Create arrays of Integer, Double and Character
        Integer[] integerArray = { 1, 2, 3, 4, 5 };
        Double[] doubleArray = { 1.1, 2.2, 3.3, 4.4 };
        Character[] characterArray = { 'H', 'E', 'L', 'L', 'O' };

        System.out.println( "Array integerArray contains:" );
        printArray( integerArray ); // pass an Integer array

        System.out.println( "\nArray doubleArray contains:" );
        printArray( doubleArray ); // pass a Double array

        System.out.println( "\nArray characterArray contains:" );
        printArray( characterArray ); // pass a Character array
This would produce following result:
Array integerArray contains:
1 2 3 4 5 6

Array doubleArray contains:
1.1 2.2 3.3 4.4

Array characterArray contains:

What is Generics?

Generics are a built-in language feature that will make your software more reliable .The feature of Generics in Java allows Applications to create classes and objects that can operate on any defined types. Programmers can now make use of the Generics feature for a much better code. There is no need for un-necessary casting when dealing with Objects in a Collection.

Why we use generics?
Generics add stability to your code by making more of your bugs detectable at compile time.
Let's begin by designing a nongeneric class.

public class NonGenerics {

        public static void main(String[] args) {
                Map data = new HashMap();
                data.put("Key1", new Integer(100));
Take a closer look at the last line involving casting of object pulled out of the HashMap. There is no restriction from Map or HashMap on what type of object we add to this collection. The only requirement is – it should be an object i.e. we cannot add primitive to the collection unless it is wrapped in its respective object. Can you visualize problem with above approach?
User of the data from collection is expecting that the data should be of type Integer, but the creator of data is not having any such restriction. If the data added is of type other than Integer then there will be a ClassCastException. e.g. instead of Integer you add String to the collection, and end up in ClassCastException when you try to call any method of Integer. When do you come to know about this problem? It is at runtime, which is not correct. The solution is – use of generics. Let us change above code to use generics.
import java.util.HashMap;
import java.util.Map;

public class UseGenerics {

        public static void main(String[] args) {
                Map<String, Integer> data = new HashMap<String, Integer>();
                data.put("Key1", new Integer(100));
here we are restricting the kind of objects we can add to the collection .we fix that key should be String type only and value should be Integer type...If at all you try to add any other type of data then there is compile time error. This means that the compiled code is generated using the generics only.

ORA-32018: Parameter Cannot be modified in memory on another instance

ORA-32018: parameter cannot be modified in memory on another instance
Cause: Parameter adjustment can take a very long time
Action: Modify the parameter individually on each instance using the SID clause of the alter system command

Problem Description
In RAC database setting a memory parameter fails with ORA-32018. For example whenever we try to set streams_pool_size to a value then it fails like below.

SQL> alter system set streams_pool_size=100M;
alter system set streams_pool_size=100M
ERROR at line 1:
ORA-32018: parameter cannot be modified in memory on another instance

SQL> alter system set streams_pool_size=100M sid='*';
alter system set streams_pool_size=100M sid='*'
ERROR at line 1:
ORA-32018: parameter cannot be modified in memory on another instance

Cause of the Problem
The error message indicates that may be in one instance in RAC database parameter can be set successfully but in another instance it fails and overall you can't set the parameter across all instances.

Solution of the Problem
In order to know the instance which is causing the failure, try to set the parameter individually on each instance using the SID clause of the alter system command. Ensure the instance name by,

SQL> show parameter instance

NAME                                            TYPE      VALUE
------------------------------------       -------------- ------------------------------
active_instance_count              integer
cluster_database_instances      integer          3
instance_groups                      string
instance_name                        string            3
instance_number                      integer         3
instance_type                          string         
open_links_per_instance           integer         4
parallel_instance_group             string
parallel_server_instances          integer         3

From the parameter value we see we are in 3 nodes RAC database and our instance name is ORA3. So set the parameter in our current instance by specifying a SID value.

SQL> alter system set streams_pool_size=100M sid='ORA3';

System altered.

Similarly set it on rest of the instances ORA2 and ORA1 for example.

SQL> alter system set streams_pool_size=100M sid='ORA2';

System altered.

SQL> alter system set streams_pool_size=100M sid='ORA1';

ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-04033: Insufficient memory to grow pool

So we see ORA1 instance is causing the problem. This is because there is insufficient memory in ORA1 instance so you might try to increase SGA_TARGET/MEMORY_TARGET parameter or shut down ORA1 instance and restart and then we can set.

Types of problem that can occur during Media Recovery

Media recovery encounters a problem while recovering a database backup. There are some problems occur during media recovery.

1) Missing ArchivedLog:
In this database cannot find the archived log recorded in the control file so it stops the recovery.

2) When you attempt to open the database, error ORA-01113 Indicates that a datafile needs media recovery:
- You are performing incomplete recovery but failed to restore all needed datafile backups. 
- Incomplete recovery stopped before datafiles reached a consistent SCN. 
- You are recovering datafiles from an online backup, but not enough redo was applied to make the datafiles consistent. 
- You are performing recovery with a backup control file, and did not specify the location of a needed online redo log. 
- A datafile is undergoing media recovery when you attempt to open the database. 
- Datafiles needing recovery were not brought online before executing RECOVER DATABASE, and so were not recovered.

 3) Corrupted archived logs:
Logs may be corrupted while they are stored on or copied between storage systems. If DB_BLOCK_CHECKSUM is enabled, then the database usually signals checksum errors. If checksumming is not on, then log corruption may appear as a problem with redo.

4) Redo record problems:
- In this, stuck recovery problem occur because of failed consistency checks thats why it stops recovery.
- The database signals an internal error when applying the redo. This problem can be caused by an Oracle bug. If checksums are not being used, it can also be caused by corruptions to the redo or data blocks.

5) Corrupted data blocks:
A datafile backup may have contained a corrupted data block, or the data block may become corrupted either during recovery or when it was copied to the backup. If checksums are being used, then the database signals a checksum error. Otherwise, the problem may also appear as a redo corruption.

6) Random problems:

Memory corruptions and other transient problems can occur during recovery.

ORA-00001 unique constraint (string.string) violated

ORA-00001 unique constraint (string.string) violated
Cause: An UPDATE or INSERT statement attempted to insert a duplicate key.
Action: Either remove the unique restriction or do not insert the key.
  • Drop the unique constraint
  • Change the constraint to allow duplicate values
  • Modify your SQL so that a duplicate value is not created

If you are not sure which unique constraint was violated, you can run the following SQL:

    select distinct table_name
    from all_indexes
    where index_name = 'CONSTRAINT_NAME';

User Management in BAAN ERP

One of the most important tasks in an information system environment is effectively managing and monitoring system usage.  Special user requirements and restrictions may have to be implemented.  BAAN provides comprehensive facilities to handle user and security management.

Login Procedure

Users can login and work with the BAAN software if their user accounts are defined at two different levels:

  • UNIX
  • BAAN

With all the User Interfaces, the password file is checked for the right login code and password. With BA and BX, settings like the BSE-variable are set in the “profile” files. BW has these kinds of settings in its configuration screen.
When a user logs in, the Bshell accesses the user file in ${BSE}/lib/user directory.  The information in this file is used to tell the system what authorizations the user has and what system settings will be

UNIX vs. BAAN Profile
Normally, a UNIX user has one BAAN Profile. However, you can base two or more BAAN Profiles on the same UNIX Profile. This can be beneficial for Users who need to work in Production, Test, or Design environments. They just have to remember one UNIX password. 
Switching between your User Profiles means setting your $USER variable. 
From your BW configuration enter 
-- -set USER=jan
in the box labeled command:. Running this configuration will switch you from user jp to jan as shown in above figure.

Overview User Management 
User Management in relation with DEM
This slide depicts some overlapping features within User Management in Tools and the Dynamic Enterprise Modeler. With DEM you can create a User account and generate Session Authorizations. Then if you need some additional authorizations or you need to make some changes you can use Tools.  The entire user management process can be done through Tools; however, DEM is a quick start creating users.

User Types and Authorizations 

There are two different user types: 
  • Super 
  • Normal
Depending on the User Type and on what kind of permissions a user needs, you can set the following authorizations:
  • Session
  • Database
  • Company
  • Text
  • Developer
  • Terminal ( only if terminal is connected to a fixed tty port)
Steps in Creating BAAN Users
Figure outlines the steps necessary to create a user.  The first step is creating a UNIX id for the user.  Once we have the UNIX id we can then create a BAAN id for the user.  To activate the id you must do a convert to runtime.  The steps on the right are additional steps to add the appropriate authorizations.

Source code of Symantec stolen in 2006 Hack

2006 security breach led to the theft of source code for some of its flagship products, backtracking on earlier statements that its network had not been hacked

2006 security breach led to the theft of source code for some of its flagship products, backtrackThe security software maker, which had previously blamed the theft on a third party, acknowledged that hackers had infiltrated its own networks. The hackers obtained 2006-era source code for Norton Antivirus Corporate Edition, Norton Internet Security, Norton SystemWorks (Norton Utilities and Norton GoBack), and PCAnywhere, the company said in a statement.
"Upon investigation of the claims made by Anonymous regarding source code disclosure, Symantec believes that the disclosure was the result of a theft of source code that occurred in 2006," a Symantec representative said in a statement.
The software maker said that due to the age of the exposed source code, most Symantec customers are not in any increased danger of cyberattacks as a result of the code's theft. However, the company said users of its remote-access suite PCAnywhere may face a "slightly increased security risk," and that the company is in the process of notifying those users of the situation and providing them a remedy to protect their on earlier statements that its network had not been hacked.
A hacker group calling itself Yama Tough and employing the mask of hacktivist group Anonymous in its Twitter avatar said in a tweet Saturday that it would release 1.7GB of source code for Norton Antivirus today.

What do you mean by string immutability in Java?

Ques:What is meant by strings are immutable in java?
Ans: Immutable means that once an object of that Class has been created it can't be altered.

This is useful as it means you can pass references to the object around, without worrying that someone else is going to change it's contents.

Why String is immutable?
If they were mutable then there would be no String pool implementation and the performance gains of the String pool become lost.

Ques: What is the difference between Spring and Spring-MVC.
Ans: Spring is composed of three parts:
Spring dependency,spring mvc,Spring AOP

Spring-MVC is itself part of the Spring.Spring mvc is basically used for web applications.

Application Dictionary(APDD) vs Runtime Dictionary(RTDD)

APDD are the Tools Tables of Company 000. With the Tools application, you will maintain the BAAN Software creating entries in Company 000. These changes need to be moved to the directory structure by:

  • Compilation:  Reports, Program Scripts and Dynamic Link Libraries
  • Generate Dump:  Forms and Menus
  • Conversion:  User Data, Database Information, etc.
  • Direct Available:  Means that those tables are used at runtime as well
It is important to note that those items requiring a conversion will require the user to log off and login again.  This needs to be done because critical data has been changed at the Operating System level. Logging in / Starting the application again means that the bshell is able to read the changes.
Another important table is the runtime table (ttadv999). This table can be considered as a kind of shopping list for the Bshell. If the Bshell needs to run a session, it uses the information stored in the runtime table (ttadv999) to locate any objects, forms, reports, etc. which are linked to that session.
  • Object
  • Form
  • Report
Related Questions:

  • what is the need of converting software components to runtime data dictionary after any change in software component.?
  • Why this is recommended that after any change in software component  we should log off Baan and login again? 

How SubString Works in Java?

Ques:  How SubString works in Java
ans:Substring is used to get chunk of text from the get the substring ,we need starting index and last index.Starting index defines the starting position from where the first letter of the substring starts.and last letter is last index-1.
for example
String a="Hello";


we can also use only starting index
for example:
String FullName = "Bill Gates";
String test = FullName.substring( 2 );

output:ll Gates

This time, we only have 1 number between the round brackets of substring. Now, Java will start at character two in the string FirstName, and then grab the characters from position 2 right to the end of the string.

${BSE} directory

In the ${BSE} directory there are many subdirectories with software, settings and log information.


  • application: In the application directory runtime dumps of software components, like forms, menus, and report objects are stored.  Each Package VRC has its own separate directory. 
  • bin: This directory contains UNIX programs used by BAAN IV.  The Bshell (Logic Server), Database drivers and many more programs are stored there.  A few examples of these programs are:
ba6.1; ASCII display server
bx6.1; X-window display server
shmmanager6.1; shared memory manager
  • include6.1: This directory contains several files for standard functions and definitions used by the bshell during the compilation of program and report scripts.
  • tools: The Tools software and its table and domain definitions are stored separately in the ${BSE}/tools directory.
  • tmp : BAAN IV provides the capability to repeat print requests by storing temporary files for print requests in the ${BSE}/tmp directory.  The files in this directory all start with tmp.  
  •  log:  If an error occurs while the application is used, an error message is displayed on the screen.  These error messages, as well as information, is stored in a log file in the log directory.   Some examples: log.bshell, log.audit, log.repgen6.1, log.bdbpost. 
  • etc :This directory contains a number of shell scripts used by BAAN IV.  Scripts for start up, shut down, and job management can be found in this directory.
  •  lib :The ${BSE}/lib directory contains the settings and driver information files. 
The ${BSE}/lib directory
The ${BSE}/lib directory contains definition files for:
  • Users
  • Software
  • Data
  • Devices (printers)
In the ${BSE}/lib/user directory, you will find the user files. These files contain information about users, such as:
  • Start Menu
  • Default Company (Set of Data)
  • Package Combination (whether the user is in the Production Environment or in the Design Environment or elsewhere)
An example of a User File:

  • tabledef6.1: WHAT kind of Database Management System is being used for the BAAN IV tables.  If tables are installed on a remote system, the name of that system is also displayed in the file.
  • isamdef6.1: WHERE to find the tables for B-base databases.  The file contains the addresses of the ISAM tables on the system.
  • compnr6.1 :  Used in the case of “SHARED TABLES” 

The ${BSE}/application directory

Software components are stored in the $BSE/application directory by Package VRC. Here is an example with the directory tdB40_b (Distribution BAAN IV b). The module sls is Sales .
  • ftdsls2 Forms, English Language (Lang. 2)
  • mtdsls2 Menus, English Language (Lang. 2)
  • otdsls2 Report Objects English Language (Lang. 2)
  • otdsls Objects
  • ptdsls Program Scripts (if any)
  • itdsls Include Files
  • rtdsls Report Scripts
Note: Program Scripts do not automatically come with the system.
  • Language Dependent
  • Language Independent

Tables Directory (Bbase)
If a B-base database is used, the data of the BAAN IV application is stored in ISAM tables in the tables directory.
In this Figure , the tables directory contains sub-directories for the different company numbers which are used within BAAN IV.  A directory of a certain company number consists of several sub-directories for the different modules of the BAAN IV packages.  In these directories, the data is stored in ISAM tables.
An ISAM table consists of two UNIX files.  For example, and tsls040200.bdt.
The file with the .bdt extension contains the table data.  The file with the .bid extension contains the table index information.
In other Database Management Systems, parameters will be set to point to those tables in that database.

${BSE}/dict directory
The place of the dict directory can differ from installation to installation. It can be set up in, for example, /usr1/dict or /usr1/bse/dict. This figure depicts:
  • Tools tables by modules
  • Database Independent Model (table and domain definitions) 
In regards to Tools, it is important to note:
  • The Tools Tables are company 000 representing the APDD (Application Data Dictionary).
  • Tools can be divided into several modules
Some of the Tools modules are:
  • aad Application Administration
  • adv Application Development
  • txt Text
  • iex Import / Export
The Database Independent Model consists of files with domains (characteristics) and table definitions (the layout of the tables).

Difference Between Error and Exception

Ques:Difference between error and exception 
Ans: Error and Exceptions both areboth inherit fromThrowable..but they are differ by the following ways...
1.Error: Any departure from the expected behavior of the system or program, which stops the working of the system is an error.

Exception:Any error or problem which one can handle and continue to work normally.

2.An error is an irrecoverable condition occurring at runtime. Such as OutOfMemory error. These JVM errors and you can not repair them at runtime. While exceptions are conditions that occur because of bad input etc. e.g. FileNotFoundException will be thrown if the specified file does not exist. Or a NullPointerException will take place if you try using a null reference. In most of the cases it is possible to recover from an exception (probably by giving user a feedback for entering proper values etc.).

3.Error's are irrecoverable exceptions. Usually a program terminates when an error is encountered. but exceptions are recoverable conditions.

4.Errors don't have subclasses while exception has two subclasses, they are compile time exception or checked exception (ClassNotFound Exception, IOException, SQLException etc.) and runtime or unchecked exception(ArrayIndexOutOfBounds Exception, NumberFormat Exception).

Directory Structure

The Bshell acts as the logic server gathering information from the directory structure at the Operating System level. This information can be system settings or software components.  System directory paths and users definitions are examples of the type of informational settings that can be set.  Software components are objects, forms, menus, reports, etc. 
These settings and software components are created with the use of the Tools software. The Tools software writes the information in the Tools Tables (company 000).
This information must be converted into a runtime object that is made available at the operating system level.  These runtime objects are created by doing a Convert to Runtime Data Dictionary, a compile, or using generate dump.  The Bshell can now use the converted object.


This figure depicts the relationship between Users, Software, and Data. Users use the software to provide an interface between them and their data.  This data can consist of system parameters or user data.
The ${BSE}/lib directory contains the setting and driver information files.
BSE is the name of a variable, which stands for BAAN Software Environment.  The location of the software environment is defined by this UNIX environment variable.  Each BAAN IV user must have a correct BSE variable set up for them.
Different user interfaces are available within BAAN. The type of equipment being used determines which user interface the user will execute.
If the user is running BA (ASCII), the environment variable is set in UNIX files like /etc/profile and a personal .profile in the home directory of the user. If you are using BW, it is set in the BW Configuration screen. 

Short description of directories:
bse         BAAN Software Environment, it contains the software environment.
dict The dict directory contains sub-directories for the table and domain definitions                
                (data dictionary)  of each package combination as well as the BAAN IV Tools
                 package(company 000).
tables      If a B-Base database is used, the data of the BAAN IV application is stored in ISAM       
                 tables in the tables directory.
test           If a B-base database is used the test tables are stored here

Related Posts:


Comparable - This interface imposes a total ordering on the objects of each class that implements it. This ordering is referred to as the class's natural ordering, and the class's compareTo method is referred to as its natural comparison method.
Lists (and arrays) of objects that implement this interface can be sorted automatically by Collections.sort (and Arrays.sort). Objects that implement this interface can be used as keys in a sorted map or elements in a sorted set, without the need to specify a comparator.
package java.lang;
public interface Comparable<T> {

         * Compares this object with the specified object for order.  Returns a
         * negative integer, zero, or a positive integer as this object is less
         * than, equal to, or greater than the specified object.
        public int compareTo(T o);

Comparator - Represents an order relation, which may be used to sort a list or maintain order in a sorted set or map. Can override a type's natural ordering, or order objects of a type that does not implement the Comparable interface.
A comparison function, which imposes a total ordering on some collection of objects. Comparators can be passed to a sort method (such as Collections.sort) to allow precise control over the sort order. Comparators can also be used to control the order of certain data structures (such as TreeSet or TreeMap).
package java.util;

public interface Comparator<T> {
         * Compares its two arguments for order.  Returns a negative integer,
         * zero, or a positive integer as the first argument is less than, equal
         * to, or greater than the second.
        int compare(T o1, T o2);
        boolean equals(Object obj);

How to choose which Java Colletion Class to use?

How to choose which Java collection class to use?
The Java Collections API provides a whole host of data structures, especially since the API was expanded in Java 5 (and again slightly in Java 6) to include concurrent collections. At first, the array of choices can be a little daunting: should I use a HashMap or a LinkedHashMap? When should I use a list or a HashSet? When should I use a TreeMap rather than a HashMap? But with a bit of guidance, the choice needn't be quite so daunting. There are also a few cases where it's difficult to decide because the choice is very arguable. And in other cases, having a clear set of rules of thumb can guide you to an appropriate decision.

Basic approach to choosing a collection
The overall approach I'd suggest for choosing is as follows:
1.choose the general type of organisation that your data needs to have (e.g. map or list); without too much thought, this is usually fairly clear;
2.then, choose the implementation of that type that has the minimum functionality that you actually require (e.g. don't choose a sorted structure if you don't actually need the data to be sorted).

LinkedHashMap And TreeMap

LinkedHashMap extends  HashMap:-
Hash table and linked list implementation of the Map interface, with predictable iteration order. This implementation differs from HashMap in that it maintains a doubly-linked list running through all of its entries. This linked list defines the iteration ordering, which is normally the order in which keys were inserted into the map (insertion-order). Note that insertion order is not affected if a key is re-inserted into the map.
import java.util.*;

public class LinkedHashMapDemo {
        public static void main(String args[]) {
                LinkedHashMap Lhm = new LinkedHashMap();
                Lhm.put(1, "Gyan");
                Lhm.put(6, "Ankit");
                Lhm.put(5, "Arun");
                Lhm.put(4, "Anand");
                Lhm.put(3, "Ram");
                System.out.println("The Entries of LinkedHashMap are : " +Lhm);

The Entries of LinkedHashMap are :
 {1=Gyan, 6=Ankit, 5=Arun, 4=Anand, 3=Ram}

TreeMap implements NavigableMap:-
This class guarantees that the map will be in ascending key order, sorted according to the natural order for the key’s class (see Comparable), or by the comparator provided at creation time, depending on which constructor is used.
import java.util.TreeMap;
2.public class TreeMapExample {
4.  public static void main(String[] args) {
6.    //create TreeMap object
7.TreeMap treeMap = new TreeMap();
9.//add key value pairs to TreeMap
10. treeMap.put("1","One");
11. treeMap.put("2","Two");

13.boolean Exists=treeMap.containsKey("1");
14.    System.out.println("1 exists in TreeMap ? : " + Exists);
15.  }
19.Output would be
20.1 exists in TreeMap ? : true

Hashtable implements Map

Hashtable implements Map:-
Hashtable based implementation of the Map interface. This implementation provides all of the optional map operations, and permits null values and the null key. This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time.

import java.util.Hashtable;

import java.util.Iterator;

import java.util.Set;

import java.util.Map;

public class HashTableJava {

    public static void main(String[] args) {

        Hashtable<Integer,String> hTable=new Hashtable<Integer,String>();

        hTable.put(new Integer(2), "Two");

        hTable.put(new Integer(1), "One");

        hTable.put(new Integer(4), "Four");

        hTable.put(new Integer(3), "Three");

        hTable.put(new Integer(5), "Five");

        Set s =hTable.entrySet();

        Iterator i=s.iterator();



            Map.Entry m=(Map.Entry);

            int key = (Integer)m.getKey();

            String value=(String)m.getValue();

            System.out.println("Key :"+key+"  value :"+value);





Key :5 value :Five
Key :4 value :Four
Key :3 value :Three
Key :2 value :Two
Key :1 value :One

HashMap implements Map

HashMap implements Map:-
The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.
The two most important HashMap's methods are:
- get( Object key ) - returns the value associated with specified key in this hash map, or null if there is no value for this key
- put(K key, V value) - associates the specified value with the specified key in this map
There are some other useful HashMap's methods:
- containsKey(Object key) - (boolean) returns true if this map contains a value for the specified key
- values() - returns a collection of the values contained in this map
- keySet() - returns a set view of the keys contained in this map
- remove(Object key) - removes the mapping for key from this map if present
- isEmpty() - (boolean) returns true if this map contains no key-value mappings
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class HashMapExample {

    public static void main(String[] args) {

        HashMap<Object,String> hm=new HashMap<Object,String>();

        // adding or set elements in HashMap by put method key and value pair
        hm.put(new Integer(2), "Two");
        hm.put(new Integer(1), "One");
        hm.put(new Integer(3), "Three");
        hm.put(new Integer(4), "Four");

        // Get hashmap in Set interface to get key and value
        Set s=hm.entrySet();

        // Move next key and value of HashMap by iterator
        Iterator it=s.iterator();

            // key=value separator this by Map.Entry to get key and value
            Map.Entry m =(Map.Entry);

            // getKey is used to get key of HashMap
            int key=(Integer)m.getKey();

            // getValue is used to get value of key in HashMap
            String value=(String)m.getValue();

            System.out.println("Key :"+key);
            System.out.println("value :"+value);
Key :1
value :One
Key :2
value :Two
Key :3
value :Three
Key :4
value :Four

PriorityQueue implements Queue

PriorityQueue implements Queue:- In a priority queue, items are ordered by key value, so that the item with the lowest key (or in some implementations the highest key) is always at the front. Items are inserted in the proper position to maintain the order.

import java.util.PriorityQueue;

public class PriorityQueueExample {
    public static void main(String[] args) {
        PriorityQueue<string> priorityQueue = new PriorityQueue<string>();

[test1, test2, test3, test4, test5]


Twitter Delicious Facebook Digg Stumbleupon Favorites More