Jun 13, 2009

Diet pills for u


Hey ppl i am back with an interesting health update on diet pills. To know about it more just feel free to explore the post below.

Diet pills have become very common in order to reduce excess fat. There are so many brands of diet pills that is availble in market these days. It is really a tough task to find which suits better for your health. I sincerely advise you to consult a doctor before taking diet pills. You can also go and have a look at best diet pill . You're in luck. At this forum you can not only buy diet pills at the lowest prices, but you can also find consumer reviews on every diet pill we sell.

what for you waiting still ? just reduce your fat by best diet pill. Don't forget to spread the word to all your friends. Keep checking my blog for more health updates...

Jun 2, 2009

Disability insurance

Hey ppl i am back with an interesting update on life insurance. To know about it more just feel free to explore the post below...

The latest scheme that was launched in recent times is disability insurance . It has various sub schemes in it. I am sure you all will find it very useful. To know about it more just feel free to explore the link. One could even take monthly or yearly mediclaim policy according to that the reimbursement could be availed. The disability insurance scheme is too good and i am sure you all will surely take one policy today.
kindly leave your comments if any below.. keep checking my blog for more latest updates...

May 24, 2009

carpentry tools

Hey ppl after a long gap i am back with one more update on carpentry tools and furnitures. To know about it more just feel free to explore the post below...

If you want to keep your place filled with furniture and stuffs then i am sure you all will like this post. patio chairs is the latest buzz among many these days. The chair is designed with special carving and is available with various color and designs. To read the entire catalog just go and visit the forum and experience the fascinating home decoration stuff. What for you waiting still ? just go and grab the opportunity now... Enjoy the festive season offer... Don't forget to spread the word to all your friends... keep reading my blog for more latest updates on furniture and fashion accessories..

kindly leave your comments if any below... have fun and Enjoy life...

cheers karthik ;-)


May 17, 2009

Interface

Interface: Interfaces can be used to implement the Inheritance relationship between the non-related classes that do not belongs to the same hierarchy, i.e. any Class and any where in hierarchy.   Using Interface, you can specify what a class must do but not how it does.
A class can implement more than one Interface.
An Interface can extend one or more interfaces, by using the keyword extends.
All the data members in the interface are public, static and Final by default.
An Interface method can have only Public, default and Abstract modifiers.
An Interface is loaded in memory only when it is needed for the first time.
A Class, which implements an Interface, needs to provide the implementation of all the methods in that Interface.
If the Implementation for all the methods declared in the Interface are not provided , the class itself has to declare abstract, other wise the Class will not compile.
If a class Implements two interface and both the Intfs have identical method declaration, it is totally valid.  
If a class implements two interfaces both have identical method name and argument list, but different return types, the code will not compile.
An Interface can’t be instantiated. Intf Are designed to support dynamic method resolution at run time.
An interface can not be native, static, synchronize, final, protected or private.
The Interface fields can’t be Private or Protected.
A Transient variables and Volatile variables can not be members of  Interface.
The extends keyword should not used after the Implements keyword, the Extends must always come before the Implements keyword.
A top level Interface can not be declared as static or final.
If an Interface species an exception list for a method, then the  class implementing the interface need not declare the method with  the exception list.
If an Interface can’t specify an exception list for a method, the class can’t throw an exception. 
If an Interface does not specify the exception list for a method, he class can not throw any exception list.
The general form of Interface is 
Access interface name {
         return-type method-name1(parameter-list);
            type final-varname1=value;
          }
-----------------------
Marker Interfaces :  Serializable, Clonable, Remote, EventListener,

Java.lang is the Package of all classes and is automatically imported into all Java Program
Interfaces:  Clonable , Comparable, Runnable


OOPS concept of JAVA



Abstraction:  Showing the essential and hiding the non-Essential is known as Abstraction.

Encapsulation: The Wrapping up of data and functions into a single unit is known as Encapsulation.
     Encapsulation is the term given to the process of hiding the implementation details of the object. Once an object is encapsulated, its implementation details are not immediately accessible any more. Instead they are packaged and are only indirectly accessed via the interface of the object.

Inheritance: is the Process by which the Obj of one class acquires the properties of Obj’s another Class.
 A reference variable of a Super Class  can be assign to any Sub class derived from the Super class.
         Inheritance is the method of creating the new class based on already existing class , the new class derived is called Sub class which has all the features of existing class and its own, i.e sub class.
Adv: Reusability of code , accessibility of variables and methods of the Base class by the Derived class.

Polymorphism: The ability to take more that one form, it supports Method Overloading &  Method Overriding.

Method overloading: When a method in a class having the same method name with different arguments (diff Parameters or Signatures) is said to be Method Overloading. This is Compile time Polymorphism.
Using one identifier to refer to multiple items in the same scope.

Method Overriding: When a method in a Class having same method name with same arguments is said to be Method overriding. This is Run time Polymorphism.
Providing a different implementation of a method in a subclass of the class that originally defined the method.
 1.  In Over loading there is a relationship between the methods available in the same class ,where as in Over riding there is relationship between the Super class method and Sub class method.
 2.  Overloading  does not block the Inheritance from the Super class , Where as in Overriding blocks Inheritance from the Super Class.
 3.  In Overloading separate methods share the same name, where as in Overriding Sub class method replaces the Super Class.
4. Overloading  must have different method Signatures , Where as Overriding methods must have same Signatures.




May 2, 2009

TRIGGERS

3 TYPES

1.DATABASE TRIGGERS (TABLE)  CLASSIFIED INTO STATEMENT LEVEL AND ROW LEVEL

2.SYSTEM TRIGGERS(SYSTEM)

3.INSTEAD OF TRIGGERS(VIEW)



DATABASE TRIGGERS

commit,rollback and savepoint are not allowed within trigger
only update,insert,delete can be used


STATEMENT LEVEL  TRIGGERS 


SQL> SELECT *FROM STUDENT;

    ROLLNO NAME                STD
---------- ---------- ----------
     12345    KAR                     11
      2345     joe                       10
     12346    tarun                      9
      7890     MARIE                 12
      1357     VIMAL                  10

 1   CREATE OR REPLACE TRIGGER INTIMATE
 2   AFTER INSERT OR UPDATE OR DELETE
 3   ON STUDENT
 4   BEGIN
 5   DBMS_OUTPUT.PUT_LINE('DML INSERT OR UPDATE OR DELETE EXECUTED');
 6  END;
 7  /

TRIGGER CREATED 

SQL> UPDATE STUDENT SET NAME='KAR'  WHERE STD=10;

DML INSERT OR UPDATE OR DELETE EXECUTED

2 rows updated.




ROW LEVEL TRIGGERS


 CREATE OR REPLACE TRIGGER INTIMATE
 AFTER INSERT OR UPDATE OR DELETE
 ON STUDENT
 FOR EACH ROW
 BEGIN
 DBMS_OUTPUT.PUT_LINE('DML INSERT OR UPDATE OR DELETE EXECUTED');
 END;

SQL>  UPDATE STUDENT SET NAME='KAR'  WHERE STD=10;

DML INSERT OR UPDATE OR DELETE EXECUTED

DML INSERT OR UPDATE OR DELETE EXECUTED

2 rows updated.


USING OLD and NEW Keyword

  1  CREATE OR REPLACE TRIGGER NAMECHANGE
  2  AFTER UPDATE ON STUDENT
  3  FOR EACH ROW
  4  BEGIN
  5  DBMS_OUTPUT.PUT_LINE(:OLD.NAME  || '  CHANGED TO '|| :NEW.NAME);
  6* END;
SQL> /

Trigger created.

SQL> SELECT *FROM STUDENT;

    ROLLNO  NAME         STD
---------- ---------- ----------
     12346   tarun               9
      7890   MARIE           12
      1357   KARTHIK        10



SQL> UPDATE STUDENT SET NAME='TARUN' WHERE NAME='tarun';

tarun  CHANGED TO TARUN

1 row updated.

Note : OLD and NEW can be used only with row level triggers
               
               old value                 new value
update       before                     after 
insert         null                         after
delete       before                      null

 
Using with when clause and referencing

 CREATE OR REPLACE TRIGGER NOTIFY
 AFTER INSERT ON STUDENT
 REFERENCING OLD AS PREV NEW AS CURR
 FOR EACH ROW
 WHEN(CURR.NAME='KARTHIK')
 BEGIN
 DBMS_OUTPUT.PUT_LINE('Student KARTHIK already exists but however it is 2nd time inserted');
 END;

SQL>  insert into  student values(3934,'KARTHIK',11);

Student KARTHIK already exists but however it is 2nd time inserted

1 row created.


To drop a trigger

drop trigger triggername;


MANAGING TRIGGERS

SQL> ALTER TRIGGER NOTIFY COMPILE;

Trigger altered.

SQL> ALTER TRIGGER NOTIFY DISABLE;

Trigger altered.

insert into  student values(5034,'KARTHIK',11);

1 row created.

SQL>  ALTER TRIGGER NOTIFY ENABLE;

Trigger altered.

SQL> insert into  student values(5035,'KARTHIK',11);
Student KARTHIK already exists but however it is 2nd time inserted

1 row created.

SQL> ALTER TABLE STUDENT DISABLE ALL TRIGGERS;

Table altered.

SQL> ALTER TABLE STUDENT ENABLE ALL TRIGGERS;

Table altered.


MUTATION ERROR occurs in Row level Triggers only. There are two possible ways to find it

1. create trigger before update of sal on emp .. blah blah begin ..modify emp then mutation results
2. A special case: create trigger before update on sal ... blah blah foreign key ref...


SYSTEM TRIGGERS


CREATE,ALTER,DROP,LOGON,LOGOFF,STARTUP,SHUTDOWN are used i.e DDL and system events are considered. Refer book for eg.



INSTEAD OF

for views to restrict insert,delete or update

SQL> CREATE OR REPLACE TRIGGER TRG1
  2  INSTEAD OF INSERT ON EMPLOC
  3  BEGIN
  4  DBMS_OUTPUT.PUT_LINE('INSERTING DATA ON VIEW EMPLOC RESTRICTED');
  5  END;
  6  /

Trigger created.

Eg.

insert into emploc('jose','japan');

INSERTING DATA ON VIEW EMPLOC RESTRICTED

1 row created.

though it says '1 row created' in the view no new value get inserted.