Monday, March 28, 2016

What is RDBMS? CODD'S Principles

In this post we are going to discuss about RDBMS and features of RDBMS and their CODD'S Rules.why we use RDBMS and importance of RDBMS.

Definition of RDBMS?

RDBMS is a Relational Data Base Management System or simply Relational DBMS. It was introduced by E.F.Codd which adds an additional condition that the system supports a tabular structure for the data with enforced relationships among the tables.

Features of RDBMS:


  • The ability to create multiple tables and enter data into them.
  • An interactive Query Language
  • Retrieval of information stored in more than one table
  • provides a catalog or Dictionary,which itself consists of tables
The table consists of rows and columns.

Operations:

SELECT: extracts specified rows from a table
PROJECT: extracts specified columns from a table
JOIN: joins together two tables on the basis of common values in a common column operations are all set-at-a-time and not row-at-a-time.


Catalog means consists of all the information of the various  schemas(external,conceptual,internal) and all of the corresponding mappings.

CODD'S Principles/Rules:

0. The Rule specifies the system must qualify as relational and use its relational  felicities to manage and access database.

1. All information in a relational database which includes table name,column names are represented by values in tables

2. Every quantify of data in a relational database can be accessed by using  combination of a table name, a primary key value which identifies the row and attribute name that is identified as a cell.

3. The RDBMS provides a mechanism which handles records that have unknown or inapplicable values in a pre-defined fashion

4. The information of a database and in its contents are database objects(tables)and therefore can be queried via the data manipulation language(DML)

5. A RDBMS system should allow user to do all of the following  Define tables and views,query and update the data,set integrity constraints,set authorizations and define transactions.

6. RDBMS provides a mechanism to update any view which is theoretically update-able  Data consistency is ensured, since the changes made in the views are transmitted to the original table and vice-versa.

7. The RDBMS provides mechanism for insertions,updation and deletion at a table level. The performance is improved since the commands act on a set of records rather than one record at a time.


Saturday, March 26, 2016

Normalization in Database

In This Post we are discussing about Normalization in Database and different types of Normalization.This article helps who have been working with databases and might have heard Database Normalization.

What is Normalization?
Database Normalization is the process of organizing the data in a database.The main problem existing in "raw" database is redundancy. Redundancy means storing the same data items in more than one place. Redundancy creates several problems like fallowing:

1. Extra storage space because storing the same data in many places takes large amount of disk space.
2. Ensuring data dependencies make sense(only storing related data in a table)
3.Entering same data more than once during insertion
4.deleting same data more than once during deletion
5.Modifying the data more than once 


To solve these problems the "raw"database needs to be normalized. This is step by step process of  removing  different kinds of redundancy at each step.

Normalization Rules:
Normalization rules are divided into the following normal form

First Normal Form(1NF)
Second Normal Form(2NF)
Third Normal Form(3NF)
BCNF

First Normal Form(1NF):
The First Rule is set the basic rule for an organized database. Each set of column must have a unique value,such that multiple columns can not be used to fetch the same row. Each table should be organized into rows,and each row should have a primary key that represents it as unique.



Using the first normal form data redundancy increases,there will be many columns with same data in multiple  rows but each row contain unique.

Second Normal Form(2NF):
A relations is said to be 2NF if it is already 1NF and each and every attribute fully depends on the primary key of the relation.If a table has some attributes which is not dependent on the primary key of that table,then it is not in 2NF.Let us explain, Empid is the primary key of the above relation.Emp_name ,sales,Bank_id all depend upon Empid. But Bank_name depend upon Bank_id which is not the primary key of the table.So the table is 1NF,but not in 2NF. If this position can be removed into another related relation,it would come 2NF.


After removing the portion into another relation we store lesser amount of data in two relations without any loss information. There is also a significant reduction in redundancy.

Third Normal Form(3NF):
A relation is said to be in 3NF, if it is already in 2NF and there exists no transitive dependency in that relation. Speaking inversely, if a table contains transitive dependency, then it is not in 3NF, and the table must be split to bring it into 3NF.

Boyce-Code Normal Form (BCNF)

A relationship is said to be in BCNF if it is already in 3NF and the left hand side of every dependency is a candidate key. A relation which is in 3NF is almost always in BCNF. These could be same situation when a 3NF relation may not be in BCNF the following conditions are found true.

1. The candidate keys are composite.
2. There are more than one candidate keys in the relation.

3. There are some common attributes in the relation.




Consider, as an example, the above relation. It is assumed that:

1. A professor can work in more than one department
2. The percentage of the time he spends in each department is given.
3. Each department has only one Head of Department.

The normalization of the relation is done by creating a new relation for Dept. and Head of Dept. and deleting Head of Dept. form the given relation. The normalized relations are shown in the following.





See the dependency diagrams for these new relations.



Fourth Normal Form (4NF)


When attributes in a relation have multi-valued dependency, further Normalization to 4NF and 5NF are required. Let us first find out what multi-valued dependency is.
A multi-valued dependency is a typical kind of dependency in which each and every attribute within a relation depends upon the other, yet none of them is a unique primary key.
We will illustrate this with an example. Consider a vendor supplying many items to many projects in an organization. The following are the assumptions:

A vendor is capable of supplying many items.
A project uses many items.
A vendor supplies to many projects.
An item may be supplied by many vendors.

A multi valued dependency exists here because all the attributes depend upon the other and yet none of them is a primary key having unique value.


Tuesday, March 22, 2016

what are Web Services? Types of Web Services

What are Web Services?

Web Services are client and Server application that 
communicate over World Wide Web (WWW)and
Hyper Text Transport Protocol(HTTP).Web Services
provides a standard  means of inter-operating between
software applications running on different platforms 
and frameworks.Web Services are can be combined
in a loosely coupled way to achieve complex operations.


Types of Web Services 
Web Services can be implemented in various ways. The two types of Web Services are discussed in this article they are "Big" web services and "Restful"Web Services.

Big Web Services
In Java EE 6, JAX-WS provides the functionality for "Big" Web Services. This Web Service use XML messages that fallow the Simple Object Access Protocol(SOAP), an XML Language defining a message architecture and message format.

The SOAP message format and the WSDL interface definition Language have gained widespread adaption. Many development tools such as NetBeans IDE,can reduce the complexity of developing web services applications.

A SOAP based Design  must include the fallowing statements:


  • WSDL(Web Service Definition Language) can be used to describe the details of contract,which may include messages,operations,bindings and the location of the web services. You may also process SOAP messages in a JAX-WS without publishing WSDL.
  • Many web services specifications address such as requirements and establish a common vocabulary for them.Examples include transactions,security,addressing,trust,coordination and etc..
  • The architecture needs to handle an asynchronous processing and invocation.

Restful Web Services
 In Java EE 6, JAX-RS provides the functionality for Representational State Transfer (RESTful)  web services. REST is well suited for basic, ad hoc integration scenarios. RESTful web services,often better integrated with HTTP than SOAP-based services are, do not require XML messages or WSDL service–API definitions.developing RESTful web services is inexpensive and thus has a very low barrier for adoption. You can use a development tool such as NetBeans IDE to further reduce the complexity of developing RESTful web services.

A RESTful design may be appropriate when the following conditions are met.


  • The web services are completely stateless. A good test is to consider whether the interaction  can survive a restart of the server.

    • A caching infrastructure can be leveraged for performance. If the data that the web service returns is not dynamically generated and can be cached, the caching infrastructure that web servers and other intermediaries inherently provide can be leveraged to improve performance.However, the developer must take care because such caches are limited to the  HTTP GET method for most servers.
    • Web service delivery or aggregation into existing web sites can be enabled easily with a RESTful style.Developers can use such technologies as JAX-RS and Asynchronous JavaScript with XML (AJAX) and such toolkits as Direct Web Remoting (DWR) to consume the services in their web applications. Rather than starting from scratch, services can be exposed with XML and consumed by HTML pages without significantly refactoring the existing web site architecture. Existing developers will be more productive because they are adding to something they are already familiar with rather than having to start from scratch with new technology.

    Decides which type of Web Services to Use:

    Basically, you would want to use RESTful web services for integration over the web and use big web services in enterprise application integration scenarios that have advanced quality of service (QoS) requirements.

    1.  JAX-WS: addresses advancedQoS requirements commonly occurring in enterprise
    computing. When compared to JAX-RS, JAX-WS makes it easier to support the WS-* set of
    protocols, which provide standards for security and reliability, among other things, and
    interoperate with other WS-* conforming clients and servers.

    2. JAX-RS: makes it easier to write web applications that apply some or all of the constraints of the REST style to induce desirable properties in the application, such as loose coupling
    (evolving the server is easier without breaking existing clients), scalability (start small and
    grow), and architectural simplicity (use off-the-shelf components, such as proxies or HTTP
    routers). You would choose to use JAX-RS for your web application because it is easier for
    many types of clients to consume RESTful web services while enabling the server side to
    evolve and scale. Clients can choose to consume some or all aspects of the service and mash
    it up with other web-based services.

    ALSO READ:  SOA Architecture




    Sunday, March 20, 2016

    Log4j Tutorial

    Log4j is an Open Source logging API developed under the Jakarta Apache project.It provides a roubst,reliable,fully configurable,easily extensible and easy to implement framework for logging java applications for debugging and monitoring purposes.


    Log4j allows developers to insert log statements in their code and configure them externally.This article covers the need for logging.


    What is need for Logging?

    Logging or writing the state of a program at various stages of its execution to some repository such as a log file, is an old method used for debugging and monitoring applications.

    Inserting log statements manually is very tedious and time consuming,not to mention managing them(such ad modifying and updating)down the road due to various reasons such as ongoing upgrading and bug-fixing process for application code,and so forth.To ease this process, there is useful,efficient,and easy to use utility available called log4j API.


    What is log4j?

    Log4j is an open source logging API for java.This logging API currently in version 1.2.17. It became so popular that it has been ported to other languages such as C,C++,PYTHON,and even C# to provide logging framework for these languages.

    What can log4j do?

    1. Log4j handles inserting log statements in application code and managing them externally without touching application code,by using external configuration files.
    2. Log4j categorizes log statements according to user-specified criteria and assigns different priority levels to these log statements.These priority levels decide which log statements are important enough to be logged to the log repository.
    3.Log4j lets users choose from several destinations for log statements,such as console,file,databse,SMTP servers,GUI components etc.; with option of assigning different destinations to different categories of log statements.These log destinations can be changed anytime by simply changing log4j configuration files.
    4.Log4j also facilitates creation of customized formats for log output and provides default formats in which log statements will be written to log destination.

    How does log4j Work?

    Logically, log4j can be viewed as being comprised of three main components:

    Logger,appender and layout namely. The functionalities of each of these components are accessible through java classes of the same name.Users can extend these basic classes to create their own loggers,appenders and layouts.



    Logger:

    The component logger accepts log requests generated by log statements or printing methods during application execution and sends their output to appropriate destination,i.e. appenders specified by user.

    The logger component is accessible through  the Logger class of the log4j API.This class provides a static method Logger.getLogger(name)that either retrieves and existing logger object by the given name,or creates a new logger of given name if none exists.This logger object is then used to set properties of logger component and invoke printing methods debug(),info(),warn(),error(),fatal() and log().

    Log4j provides a default root logger that all user-defined loggers inherit from.Root logger is at the top of the logger hierarchy..


    Priority levels of log statements:

    logger can be assigned different levels of priorities. These priority levels decide which log statement is going to be logged.There are five different priority levels:
    DEBUG,INFO,WARN,ERROR,and FATAL; in ascending order of priority.

    Example of priority level of logger and log requests:


    /*instantiate a logger named MyLogger*/

    Logger mylogger=Logger.getLogger("MyLogger");

    ..........................................
    ..........................................

    /*Set logger priority level to INFO programatically.Though this is better done externally*/

    mylogger.setLevel(Level.INFO);

    ...................................
    .................................

    /*This log request is enabled and log statement logged,
    Since INFO=INFO*/
    mylogger.info("The value of paramenters passed to do_something() are:"+ a,b);

    .........................................................
    .........................................................

    /* This log request is not enabled,since DEBUG<INFO */
    mylogger.debug("operation performed successfully");

    .................................................................
    ................................................................

    /*THis log request is enabled and log statements logged,since ERROR>INFO */

    mylogger.error("value of X is null");


    APPENDER:

    Appender component is interface to the destination of log statements. A logger object receives log request from log statements being executed,enables appropriate ones,and sends their output to the appender(s) assigned to it.There are various appenders available; such as ConsoleAppender(for console),FileAppender(for file),JDBCAppender(for database) etc..

    An appender is assigned to a logger using the addAppender() method of the Logger class,or through external configuration files.

    Layout:

    The Layout component defines the format in which the log statements are written to the log destination by appender. Layout is used to specify the style and content of the log output to be recorded; such as inclusion/exclusion of date and time of log output,priority level,info about the logger,line numbers of application code from where log output originated,and so forth.This accomplished by assigning a layout to the appender concerned.

    Layout is an abstract class in log4j API; it can be extended to create user-defined layouts.some readymade layouts are alo available in a log4j package; they are PatternLayout,DateLayout,HTMLLayout,and XMLLayout.

    Implementing and Configuring log4j

    implementing and configuring log4j is quite easy. The fallowing sections show  how to do it.

    Requirements:

    The only requirement for installing and using log4j is the source of log4j API,freely available for download fallow this link download log4j  in compressed(tar or zip)files.


    Installation and running log4j:

    After downloading the compressed log4j,uncompress it,save the resulting log4j-1.217.jar at any desired location and include its absolute path in the application's CLASSPATH. Now log4j API is accessible to user's application classes and can be used for logging.






    Sunday, March 6, 2016

    SOA Architecture

    A Service Oriented Architecture(SOA) is an evaluation of distributed computer based on the request and reply design paradigm for synchronous and asynchronous.In this session we will learn about Application developers or system integrators can build application by composing one or more services without knowing their implementation in .net or JEE. we will also learn the components of SOA and their operations. 


    What is Service?

    A service is a function or some processing logic or business processing that is well defined,self-contained, and does not depend on the other services.

    Example of Services is Loan processing services,which can self-contained unit for process the Loan Applications.Other example may be weather services,which can be used to get the weather information. Any application on the network can use the service of the weather service of the weather service to get the weather information.

    What is SOA?

    SOA stands for Service Oriented Architecture. It is an Architectural style for building software applications  that use services available in a network such as web. It promotes loose coupling between software components so that they can be reused.Applications in SOA are built based on services. A Service is an implementation of a well-defined business functionality,and such services can then be consumed by clients in different applications or in Enterprise Applications.

    SOA is different from point-to-point architectures. SOA contains loosely coupled,highly inter-operable application services. These services can be developed in different development  technologies(such as java,.NET,C++,PERL,PHP), the software components become very reusable i.e. the same C#(c sharp)service may be used by a java application and or any other programming language.

    Ex: So that a web service written in C and running on Microsoft IIS can access a web service written in java,running on BEA Weblogic Server.




    SOA Architecture:



    SOA Architecture consists two Components:

    i) Roles
    ii)Operations

    Roles:

    i) Service Provider: Any entity that hosts a network-available web service is a service provider.

    what it does?
    a) Creates a service description
    b)Deploys the service in a run-time environment to make it accessible to other entities over the network.
    c)Publishers the service description to one or more services registries.
    d)Receives messages invoking  the service from service requestors.

    ii) Service Requester:

    The role of service registry is to enable match-making between service providers and service requester. Once the match has been found,the interactions are carried out directly between the service requester and the service provider.

    What it Does?

    1) Accept request from service providers to publish and advertise web service descriptions.
    2) Allows service requestors to search the collection of service descriptions contained within the service registry

    iii)Service Requester:

    who consumes the web service over the network

    What it does?

    1) Finds a service description published in a service registry
    2)Applies the service description to bind and invoke the web service hosted by a service provider.

    Operations:

    Publish:

    The publish operation performs service registration or service advertisement. When service provider publishes its web services in a registry,it is advertising the service to all requester in the network.




    Find:

    It performs looking/searching for a service based on some certain conditions like type, quality ...etc.. The result is service description that matches the search criteria.




    Bind:

    Creates client Server relationship between service requester and service provider.



    Let me know your comments on this concept and share this on social websites to reach more people.keep follow me for latest updates.




    High Paying Jobs after Learning Python

    Everyone knows Python is one of the most demand Programming Language. It is a computer programming language to build web applications and sc...