This category gives the solution for the problems which you are facing while working with Joomla CMS


  • Example 1:
    The simplest way to see what is going on inside your code is to temporarily add echo statements for variables to show their values on the screen. For example, say you want to know what the value of some variables are when $i is "5". You could use code like this:
    for ( $i = 0; $i < 10; $i++ ) {
    if ( $i == 5 ) {
    echo '$i=' . $i;
    // other echo statements
    This works for simple situations. However, if you are planning on doing a lot of Joomla! development, it is worth the effort to install and learn an integrated development environment (IDE) that includes a real PHP debugger.

  • Introduction

    When using PHP as an Apache module, you can change the configuration settings using directives in Apache configuration files (e.g. httpd.conf and .htaccess files). You will need "AllowOverride Options" or "AllowOverride All" privileges to do so. If you control your own Apache configuration, you can and should use httpd.conf. If you do not control your Apache configuration (such as on a shared server), you must use .htaccess files.


    1. First look for the file, htaccess.txt in your root directory. It should have been installed during the Joomla! installation. (Note that this file name does not begin with a dot.) Open and carefully read htaccess.txt. It contains important suggestions on how to protect your site.

  • There are three traditional backup types
    2.cumulative and

    Full Backups

    A complete backup of all associated files and database at a known point in time.

    Both of these are considered Incremental backups, they can be used independently of each other or in conjunction with each other but always relate back to a FULL backup.

    Cumulative Backups

    This is a backup of the differences since the last FULL backup, so each cumulative backup gets bigger each cycle as it is also backing up data previously backup, since the last FULL backup.

  • Joomla module folder structure



    What are Joomla modules?


    Modules extend the capabilities of Joomla! giving the software new functionality. Modules are small content items that can be displayed anywhere that your template allows it to be displayed by assigning them to positions and pages through the module manager in the administrative interface.

    Modules are installed in the Admin Section. Joomla! modules may include: Main Menu, Top menu, Template Chooser, Polls, Newsflash, Hit Counter, etc. Members of the Joomla! Community produces Joomla! modules on a continuous basis.

    COM_EASYBLOG_POST_TAGGED Joomla Joomla interview questions PHP


    • Setup the Development Environment for Hibernate
    • Hibernate distribution bundle
    • MySQL installed in your Computer
    • Setup the Database
    • To use simple database named "userdata" which has two tables named "users" and "tasks"
    • Create project Hibernate Example1
    • Create POJO Classes
    • Create class user
    • Create class task
    • Create Mapping Files
    • Hibernate needs to know how to load and store objects of the persistent class.
    • The mapping file tells Hibernate what table in the database it has to access, and what columns in that table it should use.
    • Create user.hbm.xml file
    • should also have a mapping file
    • Create task.hbm.xml file
    • Hibernate Configuration
    • Save it as hibernate.cfg.xml. Here you have to give the username and password according to your MySQL account. In my case username is root and there is no password
    • To startup Hibernate by creating a global org.hibernate.SessionFactory object and storing it somewhere for easy access in your application code
    • Create class HibernateUtil
    • A org.hibernate.SessionFactory is used to obtain org.hibernate.Session instances.
    • A org.hibernate.Session represents a single-threaded unit of work.
    • The org.hibernate.SessionFactory is a thread-safe global object that is instantiated once
    • Create class new

    Users table
    create table users(
    id INT(10),
    First_Name Varchar(100) Not Null,
    Second_Name Varchar(100) Not Null
    table table
    create table tasks(
    id INT(10),
    user_id INT(10),
    title Varchar(100) Not Null,
    Descriptor  Varchar(100) Not Null
    COM_EASYBLOG_POST_TAGGED Hibernate Example1 j2ee java MySQL
  • Introduction

    Hibernate is an open source java based library used to work with relational databases. Hibernate is an Object/Relational Mapping (ORM) tool for Java environments. The term Object/Relational Mapping (ORM) refers to the technique of mapping a data representation from an object model to a relational data model with a SQL-based schema. It is a very powerful ORM solution built on top of JDBC (Java Database Connectivity) API.

    Hibernate not only takes care of the mapping from Java classes to database tables (and from Java data types to SQL data types), but also provides data query and retrieval facilities. It can also significantly reduce development time otherwise spent with manual data handling in SQL and JDBC.


    COM_EASYBLOG_POST_TAGGED Extension Interfaces Hibernate j2ee java
    • Create the java project example
    • Add jar files for hibernates
    • Create the Presistent class
    • Create the Mapping file for persistent class
    • Create the Configuration file
    • Create the class that retrieves or stores persistent object
    • Run the application

    Employee .java

    package com.tws;

    public class Employee {
    private int id;
    private String firstName,lastName;

    public int getId() {
    return id;
    public void setId(int id) { = id;
    public String getFirstName() {
    return firstName;
    public void setFirstName(String firstName) {
    this.firstName = firstName;
    public String getLastName() {
    return lastName;
    public void setLastName(String lastName) {
    this.lastName = lastName;




    • What is Spring ?
      Spring is an open source framework created to address the complexity of enterprise application development. One of the chief advantages of the Spring framework is its layered architecture, which allows you to be selective about which of its components you use while also providing a cohesive framework for J2EE application development.
    • What are the advantages of Spring framework?
      The advantages of Spring are as follows:
      Spring has layered architecture. Use what you need and leave you don't need now.
      Spring Enables POJO Programming. There is no behind the scene magic here. POJO programming enables continuous integration and testability.
      Dependency Injection and Inversion of Control Simplifies JDBC
      Open source and no vendor lock-in.
    • What are features of Spring ?
      Lightweight: spring is lightweight when it comes to size and transparency. The basic version of spring framework is around 1MB. And the processing overhead is also very negligible.
      Inversion of control (IOC):Loose coupling is achieved in spring using the technique Inversion of Control. The objects give their dependencies instead of creating or looking for dependent objects.

    Aspect Oriented programming (AOP) is often defined as a programming technique that promotes separation of

    system services (or concerns) from the business logic The different system services (concerns) are loggrng.

    trasaction managent exceptions security etc. These system services are common reffered to as across cutting

    The DI helps us decouple our application object from each other, AOP helps us decouple cross-cutting concerns

    from the objects that they effect.

    AOP makes it possible to modularize these concerns and them declaratively to the components.

    The Advantages with AOP

    1.. The business components look very clean having only business related statements without systems services code

    2. All system services are implement in a common place,Which simlifies code maintenance.

    3. We can make changes in a common locations os that the changes are reflected across all components

    4. Promotes re-usability.

    5. Clear demarcation (separation) among developers.

    AOP Terminology


    Every system service is an aspect which is written in one place,but can be integrated with components.


    Advice is the actual implementation of an aspect it defines the job that an aspect will perform.Advice define both

    what and when of an aspect.

    Spring aspect can work with live kind of advice:

    Advice type Interface Description

    org.springrframe work.aop.method Before Advice

    Called before target method is invoked
    After org.springrframe work.aop.After Advice Called after the target method returns regardless of the outcome
    After Returning org.springrframe work.aop.After Returning Advice Called after target method completes successfully.
    Around org.aopalliance.Intercept.method Incerceptor Both Before and After
    After throwing org.springrframe work.aop.Throws Advice Called when target method throws an exception.


    The Spring MVC helps us to build web based application that are flexible and loosely coupled.

    Conclusion:The spring moves requests around between a dispatcher servlet,handler mapping,controller,and view resolver. will parse web.xml file.

    Whenever Spring MVC application is deployed into servlet container,then the container


    It is front controller servlet which delegates request to controller(business component).

    The DispatcherServlet will consult a ViewResolver to map the logical view name to specific physical response page.

    Handler Mapping

    It is used to decide one controller among many controller using urlpath.

    Handler Mapping Implementation Description


    Maps controller to URLs that are based on controller bean name in spring configuration files component contains only database operations without transactional statements.


    Same as above except the bean names arenot required to follow URl conventions.


    Maps controller to URLs that are based on controller class name as the basis for their URLs.

    Maps reuest to controller and controller methods that are annotated with @RequestMapping.

    SimplerUrlHandlerMapping Maps controllers to URLs using a property collection defined in the spring application context.



    The Spring framework supports both Programmatic and Declarative transactions.

    In case of Programmatic transaction,the business component contains both database opeartions as well as transactional statements.

    In case of Declarative transactions,the business component contains only database operations without transactional statements.The transactional statements are implemented as transaction advice and merged using AOP.

    Difference between Programmatic and Declarative transactions:

    Programmatic Transactions Declarative Transactions

    Business component contains both database operations as well as transactional statements.

    Business component contains only database operations without transactional statements.

    Gives fine grained control since single method may have multiple transactions.

    Convenient to use because of AOP.

    Propagation Behaviour(or Transaction Attributes)

    Method1 begins a transaction and invokes method2.When method2 executes, does it run within the method1

    transaction or does it execute in a new transaction?The answer depends on the transaction attribute of method2.

    A tranbsaction attribue may have one of the following values:

    • Required
    • ReguiresNew
    • Supports
    • NotSupported
    • Mandatory
    • Never
    • Nested


    If the method1 is running within a transaction and invokes the method2, the method2 executes within the

    method1 transaction. If the method1 is not associated with a transaction, the container starts a new transaction

    before running the method 2.


    If the methos1 is running within a transaction and involkes the method2, the container does the following steps:

    1. Suspends the method1 transaction

    2. Starts a new transaction

    3. Delegates the call to the method 2

    4. Resumes the method1 transaction after the method 2 completes.

    If the method1 is notassociates with a transaction, the container starts a new transaction before running the method 2.

    You should use the RequiresNew attribute when you want to ensure taht the method2 always runs within a new transaction


    We can reduce spring configuration using following mechanisms:

    1. Autowiring

    2. Annotation based wiring((Newlyaddeidn Spring2 .5)

    3. Autodiscover(Newly added in Spring 2.5)

    4. Java-baseSd spring configuratio(Newly added in Spring3)


    Autowiring eliminate the need fororelements by letting spring atomatically figure out how to wire bean dependencies

    There are 4 modes of autowirings they are explained using below bean class

    Public class AccountDaolmpl implement AccountDao{

    Private DataSource dataSource;

    Public AccountDaompl{}// no-arg constructor

    Public AccountDaolmpl(DataSource ds){this.dataSource=ds;}

    Public void setDataSource(DataSource){this.dataSource=ds;}

    Public Datasource getDatasource(){return dataSource;}

    Following is the spring configuration file snippetr;



  • what are the main features of java?

    Platform Independent Robust

    • Simple
    • Object Oriented
      4.Dynamic binding
    • Robust
    • Distributed
    • Portable
    • Dynamic
    • Secure
    • Performance
    • Multithreaded
    • Interpreted
    • Architecture Neutral

    Platform Independent :

    The concept of Write-once-run-anywhere (known as the Platform independent) is one of the important key feature of java language that makes java as the most powerful language. Not even a single language is idle to this feature but java is more closer to this feature. The programs written on one platform can run on any platform provided the platform must have the JVM

    Simple :

    Java was designed to be easy for the professional programer to learn and use effectively.

    Object Oriented :

    Object-oriented programming (OOP) is at the core of Java. In fact, all Java programs are to atleast some extent object-oriented. OOP is so integral to Java that it is best to understand its basic principles before you begin writing even simple Java programs

    1. Inheritance : It is the process of creating the new classes and using the behavior of the existing classes by extending them just to  reuse  the existing code and adding the additional features as needed.
    2. Encapsulation: It is the mechanism of combining the information and providing the abstraction.
    3. Polymorphism: As the name suggest one name multiple form, Polymorphism is the way of providing the different functionality by the  functions  having the same name based on the signatures of the methods
    4. Dynamic binding: When type of the object is determined at run-time, it is known as dynamic binding

    Robust : Java is robust because it is highly supported language, meaning that unlike C you cannot crash your computer with a bad program. Also, another factor in its robustness is its portability across many Operating systems, with is supported by the Java Virtual Machine.

    Distributed: Java is designed as distributed language because for creating applications on network.

    Portable: Java can run on nearly every type of hardware and operating system.

    Dynamic: Connecting to the Internet, a user immediately has access to thousands of programs and other computers.


    1. The Java compiler catches more compile-time errors; other languages (like C++) will compile programs that produce unpredictable results.
    2. Java does not allocate direct pointers to memory. This makes it impossible to accidentally reference memory that belongs to other programs.

    Performance: Java uses native code usage, and lightweight process called  threads. In the beginning interpretation of bytecode resulted the performance slow but the advance version of JVM uses the adaptive and just in time compilation technique that improves the performance


    Multithreading is a technique that allows a program or a process to execute many tasks concurrently It allows a process to run its tasks in parallel mode on a single processor system.

    Interpreted :

    Java is both compiled and interpreted .At first, the Java source code (in .java files) is compiled into the so-called Bytecode (.class files). The Bytecode is a pre-compiled, platform independent version of your program. The .class files can be used on any operating system. When the Java application is started, the Bytecode is interpreted by the Java Virtual Mashine. Because the Bytecode is pre-compiled, Java does not have the disadvantages of classical interpreted languages, like BASIC.

    Architecture Neutral :

    Java is a compiled language but rather than producing machine code for a specific processor, the Java compiler generates Java  bytecodes which are interpreted by a Java Virtual Machine (JVM). Providing a computer or workstation has an implementation of the JVM, any Java program can be run on that mac

    What Is a Class?

    A class is a way of binding the data and associated methods in a single unit Any JAVA program if we want to develop then that should be developed with respective class only without class there is no JAVA program.

    Syntax for defining a CLASS:
    Variable declaration;
    Methods definition;


    Define a class called a student..?
    Class student
    Int stno;
    String stname; Float marks;
    String cname;
    Int getnohoursstudy ()
    String getgrade ()

    What Is an Object?

    The process of creating objects from a class is called instantiation. An object is an instance of a class. The object is constructed using the class as a blueprint and is a concrete instance of the abstraction that the class represents. An object must be created before it can be used in a program.

    What is encapsulation ?

    The ability to make changes in your code without breaking the code of all others who use your code is a key benefit of encapsulation. You should always hide implementation details. To elaborate, you must always have your variables as private and then have a set of public methods that others can use to access your variables. Since the methods are public anyone can access them, but since they are in your class you can ensure that the code works the way that is best for you. So in a situation that you want to alter your code, all you have to do is modify your methods. No one gets hurt because i am just using your method names in my code and the code inside your method doesnt bother me much. 

    If you want maintainability, flexibility, and extensibility (and I guess, you do), your design must include encapsulation. How do you do that? 

    1. Keep instance variables protected (with an access modifier, mostly private). 
    2. Make public accessor methods, and force calling code to use those methods rather than directly accessing the instance variable. 
    3. For the methods, use the JavaBeans naming convention of set and get. 

    What is inheritance ?

    Inheritance is a concept in java that will achieve super class properties inside of base class called inheritance means we inherits data from parents class to child class.

    what is polymorphism ?

    Polymorphism is the association between a generalized reference and a more specific object. For instance, consider the following code:

    Animal a = new Dog(); //right
    Dog d = new Animal(); //wrong

    The first example, the reference ais referencing a Dog object. So when a method call is made, such; the eat method is carried out by the Dog object that a references.

    The second example is incorrect, because not all Animals can perform Dog actions, so a method call of d.bark() does not make sense, because not all Animals can bark.

    same action can act differently on different object
    ex- operation move can be different for chess and a person

    why Java is Secure ?

    Java was designed to allow secure execution of code across network. To make Java secure many of the features of C and C++ were eliminated. Java does not use Pointers. Java programs cannot access arbitrary addresses in memory.

    What is a pointer and does Java support pointers?

    Pointer is a reference handle to a memory location. Improper handling of pointers leads to memory leaks and reliability issues hence Java doesn't support the usage of pointers.

    Why is java called 'strongly typed' language?

    First every variable has a type every expression has a type and every type is strictly defined.

    what is Strongly Typed ?

    Java is a strongly typed programming language because every variable must be declared with a data type. A variable cannot start off life without knowing the range of values it can hold, and once it is declared, the data type of the variable cannot change

    what is weak typed ?

    One last characteristic of JavaScript needs to be discussed before going on to the next chapter. JavaScript is considered a weakly typed.

    What is Java Virtual Machine (JVM) ?

    JVM is the main component of Java architecture and it is the part of the JRE (Java Runtime Enviroment) . It provides the cross platform functionality to java. This is a software process that converts the compiled Java byte code to machine code. Byte code is an intermediary language between Java source and the host system.

    What is Java Development Kit (JDK) ?

    A Java Development Kit (JDK) is a program development environment for writing Java applets and applications. It consists of a runtime environment that "sits on top" of theoperating system layer as well as the tools and programming that developers need to compile, debug, and run applets and applications written in the Java language

    What is the difference between a JDK and a JVM?

    JDK is Java Development Kit which is for development purpose and it includes execution environment also. But JVM is purely a run time environment and hence you will not be able to compile your source files using a JVM.

    What is the base/super class for all classes in Java?

    Every class that is not extending another class is implicitly extending Object class in Java. So java.lang.Object class is the super most class of all classes in Java. Whereas an abstract class can contains abstract methods without any body but it can also have non-abstract methods with body (which is not possible with interfaces). However, interface and abstract classes can not have objects. They can only have object references which point to object of implementing class or sub clas

     why java does not support multiple inheritance?

    Java absolutly support multiple inheritence in terms of Interface.We can extend one class only to avoid ambiguity problem.In interface we have to define the functions.So we don't get any ambiguity.In c++ it is big problem with multiple inheritence but in JAVA this thing is improved by introducing Interfaces

    Is Java a pure object oriented language?

    No. Java is an object oriented programming language but it is not 100% purely object oriented. It still has some features related to other programming patterns and hence cannot be considered pure object oriented

    What is variables and then types?
    Variables is an identifier that denotes a storage location used to store a data values.unlike constants that remain unchanged during the execution of a program, a variable may takes different values at different times during the execution of the program.
    Instance variables
    Class variables
    Local variable

    what is dot operator?
    The dot operator(.) is used to access the instance variables and methods of class objects.It is also used to access classes and sub-packages from a package.
    Examples :
    Person1.age ---------> Reference to the variable age

    Define strings?
    Strings represent a sequence of characters.The easiest way to represent a sequence of characters in java is by using a character array.

    What is serialization?
    Serialization is the process of converting a objects into a stream of bytes.

    What are different types of access modifiers?
    Access specifiers are keywords that determine the type of access to the member a class.

    What is an abstract class?
    Abstract class is a class which contain one or more abstract methods, which has to be implemented by sub classes. An abstract class can contain no abstract methods also i.e. abstract class may contain concrete methods.

    what are class variables?
    Class variables are global to a class and belong to the entire set of objects that class creates. Only one memory location is created for each variable.

    What is the Collection interface?
    The Collection interface provides support for the implementation of a mathematical bag - an unordered collection of objects that may contain duplicates.

    What must a class do to implement an interface?
    The class must provide all of the methods in the interface and identify the interface in its implements clause.

    What is the Collections API?
    The Collections API is a set of classes and interfaces that support operations on collections of objects.

    What is an array?
    Array is a group of related data items that share a common name.For instance, we can define an array name salary to represent a set of salaries of a group of employees.
    Examples : salary[10]

    What is a list iterator?
    The List and Set collections provide iterators, which are objects that allow going over all the elements of a collection in sequence. The java.util.Iterator interface provides for one-way traversal and java.util.ListIterator is an iterator for lists that allows the programmer to traverse the list in either direction (i.e. forward and or backward) and modify the list during iteration.

    What is the main difference between a String and a StringBuffer class?
    String is immutable : you can’t modify a string object but can replace it by creating a new instance. Creating a new instance is rather expensive.StringBuffer is mutable : use StringBuffer or StringBuilder when you want to modify the contents. StringBuilder was added in Java 5 and it is identical in all respects to StringBuffer except that it is not synchronized,which makes it slightly faster at the cost of not being thread-safe.

    When to use serialization?
    A common use of serialization is to use it to send an object over the network or if the state of an object needs to be persisted to a flat file or a database.

    What is the main difference between shallow cloning and deep cloning of objects?
    Java supports shallow cloning of objects by default when a class implements the java.lang.Cloneable interface.
    Deep cloning through serialization is faster to develop and easier to maintain but carries a performance overhead.

    What are wrapper classes?
    primitive data types may be converted into object types by using the wrapper classes contained in the java.lang package.
    Exampes : int, float, long, char, double

    What is the difference between an instance variable and a static variable?
    Class variables are called static variables. There is only one occurrence of a class variable per JVM per class loader.When a class is loaded the class variables are initialized.
    Instance variables are non-static and there is one occurrence of an instance variable in each class instance.Also known as a member variable or a field.

    Where and how can you use a private constructor?
    Private constructor is used if you do not want other classes to instantiate the object and to prevent subclassing.The instantiation is done by a public static method (i.e. a static factory method) within the same class.

    What is type casting?
    Type casting means treating a variable of one type as though it is another type.
    Examples :
    int m = 5;
    byte n =i;

    What is a user defined exception?
    User defined exceptions may be implemented by defining a new exception class by extending the Exception class.

    What is an instanceof operator?
    Instanceof is an object reference operator and returns true if the object on the left-hand side is an instance of the glass given to the right hand side.This operator allows to determine whether the object belongs to a particular class or not.

    What are runtime exceptions?
    Runtime exceptions are those exceptions that are thrown at runtime because of either wrong input data or because of wrong business logic etc. These are not checked by the compiler at compile time.

    What is the difference between an interface and an abstract class?
    An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class.

    what is a package?
    A package is a namespace that organizes a set of related classes and interfaces.The classes contained in the packages of other programs can be easily reused.Packages, classes can be unique compared with classes in other packages.That is, two classes in two different packages can have the same name.

    Why do threads block on I/O?
    Threads block on i/o (that is enters the waiting state) so that other threads may execute while the i/o Operation is performed.

    What is the List interface?
    The List interface provides support for ordered collections of objects.

    What is the Vector class?
    The Vector class provides the capability to implement a growable array of objects.

    What is the base class of all classes?

    What is the importance of static variable?
    static variables are class level variables where all objects of the class refer to the same variable. If one object changes the value then the change gets reflected in all the objects.

    What is the difference between a while statement and a do while statement?
    A while statement checks at the beginning of a loop to see whether the next loop iteration should occur. A do while statement checks at the end of a loop to see whether the next iteration of a loop should occur. The do whilestatement will always execute the body of a loop at least once.

    Describe life cycle of thread?
    A thread is similiar to a program that has a single flow of control.A thread is a execution in a program. The life cycle of threads are
    Newborn state
    Runnable state
    Running state
    Blocked state
    Dead state

    What is an Applets?
    Applets are small java programs that are primarily used in Internet computing. They can be transported over the internet from one computer to another and run using the Applet Viewer or any web browser that supports java.

    What are wrapped classes?
    Wrapped classes are classes that allow primitive types to be accessed as objects.

    What is the difference between an if statement and a switch statement?
    The if statement is used to select among two alternatives. It uses a boolean expression to decide which alternative should be executed. The switch statement is used to select among multiple alternatives. It uses an int expression to determine which alternative should be executed.s

    What modifiers are allowed for methods in an Interface?

    Only public and abstract modifiers are allowed for methods in interfaces.

    What is the difference between method overriding and overloading?
    Overriding is a method with the same name and arguments as in a parent, whereas overloading is the same method name but different arguments.

    What do you mean by polymorphism?
    Polymorphism means the ability to take more than one form. fro example, an operation may exhibit behaviour in different instances. The behaviour depends upon the types of data used in the operatiom.

    What is the difference between an abstract class and an interface?
    Abstract class Interface - Have executable methods and abstract methods.Can only subclass one abstract class
    Interface - Have no implementation code. All methods are abstract.A class can implement any number of interfaces.

    What is the purpose of finalization?
    The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected.

    What is the difference between a break statement and a continue statement?
    Break statement results in the termination of the statement to which it applies (switch, for, do, or while).
    A Continue statement is used to end the current loop iteration and return control to the loop statement.

    When is a method said to be overloaded and when is a method said to be overridden?
    Overloading deals with multiple methods in the same class with the same name but different method signatures.
    Overriding deals with two methods, one in the parent class and the other one in the child class and has the same name and signatures.

    How is final different from finally and finalize()?
    Final - constant declaration.
    The finally block always executes when the try block exits, except System.exit(0) call.
    finalize() is a method of Object class which will be executed by the JVM just before garbage collecting object to give a final chance for resource releasing activity.

    What is Byte Code?
    All Java programs are compiled into class files that contain bytecodes. These byte codes can be run in any platform and hence java is said to be platform independent.

    What is the difference between error and an exception?
    Exception means When a method encounters an abnormal condition (an exception condition) that it can’t handle itself, it may throw an exception.
    ssError mens system doesn’t handle.For example:Overflow,Out of memory.

    What if the main method is declared as private?
    When a method is declared as private, the program compiles properly but it will give runtime error Main method not “public.

    What type of parameter passing does Java support?
    In Java the arguments are always passed by value.

    What is singleton?
    It is one of the design pattern. This falls in the creational pattern of the design pattern. There will be only one instance for that entire JVM. You can achieve this by having the private constructor in the class.

    What is Locale?
    A Locale object represents a specific geographical, political, or cultural region.

    What is the difference between constructors and normal methods?
    Constructors must have the same name as the class and can not return a value. They are only called once while regular methods could be called many times and it can return a value or can be void.

    What is the difference between static and non-static variables?
    A static variable is associated with the class as a whole rather than with specific instances of a class.
    Non-static variables take on unique values with each object instance.

    What is the difference between java and c++?
    Java is a true object - oriented language while c++ is basically c with object-oriented extension.
    C++ supports multiple inheritence but Java provides interfaces in case of multiple inheritence.
    Java does not support operator overloading.
    Java does not have template classes as in c++.
    java does not use pointers.

  • Web Services

    Web Services

    What Are Web Services?
    Web services, as the name implies, are services offered via the Web. web services is an application or business logic that is accessible using standard Internet protocols. A business application sends a request to a service at a given URL using the SOAP protocol over HTTP. The service receives the request, processes it, and returns a response.

    Web services are client and server applications that communicate over the World Wide Web’s (WWW) HyperText Transfer Protocol (HTTP).
    Web services provide a standard means of interoperating between software applications running on a variety of platforms and frameworks.
    Web services are characterized by their great interoperability and extensibility, as well as their machine-processable descriptions, thanks to the use of XML.
    Web services can be combined in a loosely coupled way to achieve complex operations. Programs providing simple services can interact with each other to deliver sophisticated added-value services.
    The term Web services describes a standardized way of integrating Web-based applications using the XML, SOAP, WSDL and UDDI open standards over an Internet protocol backbone. The basic Web services platform is XML + HTTP . All the standard Web Services works using following component

    • XML is used to tag the data.
    • SOAP (Simple Object Access Protocol) is used to transfer the data.
    • WSDL(Web Services Description Language) is used for describing the services available.
    • UDDI (Universal Description, Discovery and Integration) is used for listing what services are available.
    • Web services allow different applications from different sources to communicate with each other without time-consuming custom coding, and because all communication is XML, Web services are not tied to any one operating system or programming language.

    How Does it Work?

    You can build a Java-based Web Service on Solaris that is accessible from your Visual Basic program that runs on Windows. You can also use C# to build new Web Services on Windows that can be invoked from your Web application that is based on JavaServer Pages (JSP) and runs on Linux.


    Consider a simple account-management and order -processing system. The accounting personnel use a client application built with Visual Basic or JSP to create new accounts and enter new customer orders.

    The client program bundles the account registration information into a SOAP message. This SOAP message is sent to the Web Service as the body of an HTTP POST request. The Web Service unpacks the SOAP request and converts it into a command that the application can understand. The application processes the information as required and responds with a new unique account number for that customer. Next, the Web Service packages up the response into another SOAP message, which it sends back to the client program in response to its HTTP request. The client program unpacks the SOAP message to obtain the results of the account registration process.


    A wholesale distributor of spices could be in the consumer role when it uses a Web service to check on the availability of vanilla beans and in the provider role when it supplies prospective customers with different vendors’ prices for vanilla beans.

    Web services do not require the use of browsers or HTML. Web services are sometimes called application services Web services and consumers of Web services are typically businesses, making Web services predominantly business-to-business (B-to-B) transactions. An enterprise can be the provider of Web services and also the consumer of other Web services. Types of Web Services On the conceptual level, a service is a software component provided through a network-accessible endpoint. The service consumer and provider use messages to exchange invocation request and response information in the form of self-containing documents that make very few assumptions about the technological capabilities of the receiver. On a technical level, web services can be implemented in various ways. The two types of web services discussed in this section can be distinguished as “big” web services and “RESTful” web services.

    • SOAP Based or Big Web Services
    • RESTful Web Service
  • Types Of Web Services


    Types of Web Services

    • "Big” web services “RESTful” web services.
    • “RESTful” web services.

    1.Big web services

    Big web services are based on SOAP standard and often contain a WSDL to describe the interface that the web service offers. The details of the contract may include messages, operations, bindings, and the location of the web service.
    The SOAP message format and the WSDL interface are traditional types.

    SOAP based Web Services used when

  • Asynchronous processing
  • Reliability
  • Stateful operations
  • 2.RESTful web services

    RESTful web services are based on the way how our web works. Our very own world wide web (www) – the largest distributed application – is based on an architectural style called REST-- Representational State Transfer. REST is neither a standard nor a protocol. It is just an architectural style like say for example client-server architecture (client-server is neither a standard nor a protocol). Web services following this architectural style are said to be RESTful Web services.

    what is REST?

    In the web, everything is identified by resources. When we type a URL in the browser we are actually requesting a resource present on the server. A representation of the resource (normally a page) is returned to the user which depicts the state of the application. On clicking any other link, the application transfers state with the new representation of the resource. Hence the name Representational State Transfer.

    A RESTful Web Services used when

    • The web services are completely stateless.
    • The data that the web service returns is not dynamically generated and can be cached.
    • The service producer and service consumer have a mutual understanding of the context and content being passed along.
    • Bandwidth is particularly important and needs to be limited.
    • Web service delivery or aggregation into existing web sites is to be enabled.
  • The document is intended for programmers who want to write client applications that can interact with Picasa Web Albums.
  • To use ClientLogin (also called "Authentication for Installed Applications"), create a PicasawebService object, then invoke the setUserCredentials method to set the user ID and password.
  • You can now use this object to make authenticated requests (like inserts, deletes, or updates).
  • To authenticate a user using AuthSub, you have to follow these general steps:
  • Construct the AuthSub URL.
  • Send the user to a Google page to enter their AuthSub credentials.
  • When the user returns, acquire a session token.
  • Create a PicasawebService object.
  • Albums are the way Picasa Web Albums groups photos into useful sets.
  • These albums can be public or unlisted, and have their own properties such as a geographic location, a description, or a date.
  • creates a new AlbumEntry, then sets various attributes for the album (title and description).
  • It assumes thatmyService is an authenticated PicasawebService object.
  • myService then calls the insert method to add the album and receive the response.
  • Once an entry is retrieved, it can be easily modified using the update method.
  • Retrieved entries can also be deleted using the delete method.
  • When uploading, modifying, or removing photos, you will have to authenticate a service object using one of the methods discussed in the Authentication section.
  • It is also possible to retrieve the photos associated with a user, but without specifying any particular album.
  • In previous examples, only the title of a photo was printed out. However, many different metadata fields can be retrieved about a photo— such as EXIF information, thumbnail URLs, the ID of the album
  • You can upload a photo to Picasa Web Albums using the insert method of the PicasawebService object.
  • The following demonstrates uploading a new photo named "puppies.jpg," with the title "Puppies FTW," and the description "Puppies are the greatest.
  • We assume that myService is an authenticated PicasawebService object. Note that "image/jpeg" is the valid MIME type of of our "puppies.jpg" file, but adjust for whatever photo file you are uploading
  • Deleting a photo is done by using the delete method, after you have retrieved the photo object
  • program code:


    • Java program to upload photos in Facebook
    • By using this this program we can upload a single photo and mulpitle photos
    • Using concepts of and likeHttpURLConnection,
    • DataOutputStream, DataInputStream, FileInputStream, Proxy ,String boundary, ByteArrayOutputStream,
    • This class is the facebook implementation
    • Create a File object
    • Create a File dir object
    • Create a path for particular image or images
    • Construct the AuthSub URL.
    • The java URL connection to the resource
    • Establish the connection to the URL
    • Create a FileInputStream object
    • The java URL connection to the resource
    • Establish the connection to the URL
    • When the user returns, acquire a session token.
    • Check if request was successful
    • Print the Before Open Connection
    • Once an entry is retrieved, it can be easily modified using the update method.
    • String boundaryMessage set path of the images getBoundaryMessage which calls froms images and upload fields and String getBoundaryMessage,String boundary, String fileField,String fileName, String fileType