CVSNT and JDeveloper Integration : Step by Step Approach

1. Install CVSNT from http://www.march-hare.com/cvspro/#free and Select Complete Install and Install it on your Windows XP box.

2. Create CVS directories
Create two directories on the target machine, c:\cvsrepos and c:\cvsrepos\cvstemp. If you have a separate disk partition to spare for CVS then use that instead. The important point here is that the disk where the repository is located on is NTFS.
3. Directory security and permissions
Give c:\cvsrepos\cvstemp security settings that allows full control for all accounts including SYSTEM.
Important:
The cvstemp directory must NOT be located in either c:\WINNT\Temp or anywhere in the "C:\Documents and Settings" tree because these locations have imposed restrictions on user access!

2.

3. Shut down the CVSNT service
Check that the CVSNT Service is not running (Start button is enabled). This is the initial screen showing that both services are running:

clip_image002[1]

4. Repository creation
The tab will initially look like this:

clip_image004[1]

5. Add repository
Now you will add a repository to the server. This is done using the "Add" button. When you click this a dialogue shows up where you will define your repository.

clip_image006[1]

clip_image008[1]

6. Name repository
Now fill in the description and the name of the repository as well.
NOTE:
Do NOT
accept the suggested name, which is the same as the folder path!
Instead only use the bare folder name with a leading / like this:

clip_image010[1]

7. Initializing the repository
When you click the OK button there will be a dialog where CVSNT offers to initialize the new repository.
When you click Yes then the new folder will be converted to a real repository:

clip_image012[1]

8. First repository added!
Now the list of repositories has been populated with the first repository:

9. clip_image014[1]

You can add as many as you like (almost) but please do not fall for the temptation to use one repository for each and every project! There are a lot of possibilities to streamline the development process using CVSNT, but many of these use the virtual modules concept and this is only possible within a single repository.

10. Server Settings
Now go on to the Server Settings tab.
Here the default settings are all right for now, except the Temporary Directory setting.

clip_image016[1]

NOTICE about Domains:
You can set the Default domain entry to either the CVSNT server PC name (as in the example above) or the domain name to which the CVSNT server belongs. CVSNT will strip the domain part from all accounts that log on using the default domain before processing. All other logons will be processed using their complete names (DOMAIN\username). The result of this is that all users that "belong" to the domain specified in this box will be logged using only the account name, likewise these usernames will be supplied to the administrative scripts without the domain name. All others will have a domain name added. This must be accounted for in any admin script used.
The CVSROOT/users file is one such admin file that needs to be handled with care concerning domain and non-domain entries.
Temp dir: Use the ellipsis button to browse for the folder prepared for this purpose above:

clip_image018[1]

11. Compatibility
On the next tab (Compatibility Options) there is nothing you need to change for now:

clip_image020[1]

12. Plugins and protocols
The Plugins tab define a lot of the extra features of CVSNT including some aspects of the connection protocols. The sceen list the available plugins and when you select a line you will be able to configure this plugin by clicking the configure button:

Keep default settings…

clip_image022[1]

13. Advanced settings
The final tab on the Control Panel deals with advanced configuration settings and you need not change anything here.

Keep Default Settings….

clip_image024[1]

14. Apply configuration changes
Now click the Apply button! This is really important, nothing will happen unless you do this! Note that after you have done this the Apply button is disabled.
15. Start the CVSNT service
Go back to the first tab and click the Start button. After a few moments the Stop button will be highlighted.
Now CVSNT runs (success!)

15.Restart the server
In order for you to be able to use the command line cvs you need to have the path variable set to include the location of the cvs.exe just installed (c:\programs\cvsnt). Since the installer will have put this into the system path variable it will work if you restart the server.
You can check this by going to a command window and typing the command:
cvs –ver

Adding and managing CVS users for pserver

1. Creating CVS accounts on the server
In order for pserver and sserver to work you have to define CVS users, but before you can do this you need to create two real accounts on the server. These accounts will be used by the CVS users as the working accounts.
You need one account which will be a CVS administrative account and one which will be a normal user account. Note that the CVS administrator need not be a server administrator!

clip_image026[1]

The two accounts are added through the Users dialog in Computer Management.
I have used the account names cvsadmin and cvsuser as shown above.

2. Adding CVS users
Open a command window and do the following (replace items <text> with the real values from your system).

clip_image028[1]

clip_image030[1]

Here don’t worry too much about sspi. We are doing this process for pserver protocol only. Do what it says.

You will now be asked to enter a password for this user. This password is only for CVS use so it should not be the real system password! Enter the password twice.
Now the CVSROOT/passwd file will be created and the user you entered will be added to the list in this file.
This step is necessary if you are going to use the pserver

Creating Admin File:

  • Create a text file called admin (no extension) inside the CVSROOT directory of the repository. That is C:\cvsrepos\MyCode\CVSROOT
  • Edit this file by adding on separate lines the login names of the users you want to give administrative priviliges on the CVS server.

The file could look like this:
cvsadmin

Make sure you won’t create a .txt file. It shouldn’t contain any extension. If you don’t know how to create a file with no extension, copy one of the existing file and rename it as admin and remove its contents and above content. Still you can’t do this, Buy a computer professor CD from walmart and learn it. J (nice idea!! Right)

Giving Permissions to CVSAdmin User:

Give Permissions to cvsadmin user on cvsroot directory.

C:\cvsrepos\MyCode\CVSROOT : right click and add cvsadmin user and give full permissions.

clip_image032[1]

Adding new users to the CVS:

1. Open the command prompt and set the cvsroot for cvsadmin user.

clip_image034[1]

2. Now login into CVS with cvsadmin user.

Type cvs login on the command promt and enter password of cvsadmin user. This user is your System user that you created above. (System password of cvsadmin).

clip_image036[1]

Create CVS Users as many as you want:

Type below command and give the name of the user you want to use.

C:\>cvs passwd -r cvsadmin -a thamos

It will ask for a password for two times, Give it whatever you want for this user.

clip_image038[1]

Very nice!! So far you have added CVS Users in to the system.

5. Testing the CVS connection with pserver:

Set the CVS Root:

C:\>set cvsroot=:pserver:thamos@sharatlaptop:/cvsrepos/MyCode

clip_image040[1]
Open another command window and type:
set cvsroot=:pserver:thamos@sharatlaptop:cvsrepos/MyCode
Then:
cvs login (enter password on prompt)
cvs ls -l -R
(this should give you a list of the files in C:\cvsrepos\MyCode)

Awesome!! You did a great job so far.

If you cannot get this far, for example if the login fails, then you should check the Windows Firewall settings on the CVSNT server:

7. Modifying Windows Firewall to allow CVS calls

  • Go to Control Panel
  • Open the Windows Firewall item.
  • Select the Exceptions tab
  • Click the "Add port" button
  • Enter the name CVSNT and port number 2401 as a TCP port
  • Accept back to the main screen
  • Make sure Windows Firewall is set to ON

clip_image042[1]

clip_image044[1]

clip_image046[1]

Integrating with JDeveloper 10.1.3

Open JDeveloper:

clip_image048

To configure JDeveloper to use CVS:

  1. Choose Toolsclip_image049 Preferences, then select Extensions from the left panel of the Preferences dialog.
  2. In the right panel, ensure that Versioning Support n.n is checked.
  3. In the left panel of the Preferences dialog, open the Versioning node and then the CVS node. The main CVS preferences panel is shown. Other CVS preferences panels are shown when you click on the items beneath the CVS node.
  4. Make changes to the preferences as required. For more information about the specific preferences, press F1.
  5. Click OK to close the Preferences dialog.

clip_image051

clip_image053

Make sure here it is selected as External Executable.

Connecting to a CVS repository

You connect to a CVS repository through the CVS Connection wizard, which you can open from the CVS Navigator by selecting CVS, then clicking the right mouse button and choosing New CVS Connection.

clip_image055

clip_image057

clip_image059

clip_image061

clip_image063

clip_image065

Click on TestConnection.

clip_image067

Give the user password.

clip_image069

clip_image071

clip_image073

Now you must be doing this, to check some project/files. So open your java project in JDeveloper.

clip_image075

Now Click on Versioning and Click on Import Module.

clip_image077

clip_image079

clip_image081

clip_image083

clip_image085

clip_image087

clip_image089

clip_image091

clip_image093

Say YES

clip_image095

No change some part of your code in the Test JSP file.

clip_image097

clip_image099

Now Save the file and Click on Commit.

clip_image101

As this is the first time, you have to all folders.

clip_image103

Commit until workspace folder.

clip_image105

NOW LOGIN AS A DIFFERENT USER and See IF HE CAN COMMIT AND UPDATE THE FILES

Before setting it up for second user, remove first user stuff from Jdeveloper IDE.

1. Remove CVS Connection.

clip_image107

clip_image109

Now JDEV will be like this:

clip_image111

Here you go:

clip_image113

Now get the cvs connection using second user login: babu

clip_image115

Here there is one catch: If the user name you gave it has john and if you type here as John

Here (small) j VS (caps)J. It will fail. User name is also case sensitive. I know you love this tip!!

clip_image117

clip_image119

Click on Test Connection:

clip_image121

Now you can see the JDev like this:

clip_image123

Now checkout the module:

clip_image125

clip_image127

clip_image129

Make sure u check out to the JohnWork folder (some folder) Because u are testing it for two user from the same box.

Once you check out, see the application navigator. You got the code commited by previous user.

clip_image131

Now open testfile.jsp and change something to :

clip_image133

Now Save the file and commit:

clip_image135

clip_image137

Now you can see version got changed to 1.3 (or some number) to testfile.jsp.

clip_image139

Check the version history of the testfile.jsp:

clip_image141

clip_image143

You are done… have a wonderful day……..

Advertisements

JDK 1.5 Features

1.Generics
Allows programmers to specify the types allowed for Collections
Allows the compiler to enforce the type specifications
//Before
List stringList
//In JDK 1.5
List<String> stringList;
2.Enhanced for loop
A new language constuct for the Iterator pattern
//Before
for(Iterator i = line.iterator();i.hasNext(); )
{
  String word = (String)i.next();
  …
}
//In JDK 1.5
for(String word: line)
{
  …
}
3.Autoboxing
Essentially bridges between the “primitive” types (such as int, boolean) and the
“boxed” types (such as Integer, Boolean)

int primitive = 5;
Integer boxed = primitive;
int unboxed = boxed + 5;

4.Varargs
Allow a variable number of arguments for methods like printf() or Method.invoke()
Internally parameters are an array of Object
Compiler constructs array for the call
void printf(String format, Object…args);

printf(“{0} {1}\n”, “Hello”, “World”);
printf(“PI = {0}”, 3.14159);
5.Enumerations
Essentially the “typesafe enum pattern”.
Simple C-style enumeration
Can add behavior to each instance
High peformance EnumSet implementaion using a bit-vector

public enum Coin {
PENNY(1), NICKEL(5);
private final int value;
Coin(int value) {this.value = value}
}

6.Metadata
Ability to decorate Java classes and their members with arbitrary data
Retrieve values
– From source files
– From class files
– At runtime using Reflection
@Retention(RetentionPolicy.RUNTIME)
public @interface Test{}

Spring Framework

  1. What is Spring?

Spring is a lightweight inversion of control and aspect-oriented container framework.

  1. Explain 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 (AOP) – Spring supports Aspect oriented programming and enables cohesive development by separating application business logic from system services.

  • Container – Spring contains and manages the life cycle and configuration of application objects.

  • Framework – Spring provides most of the intra functionality leaving rest of the coding to the developer.

  1. What are the different modules in Spring framework?

  • The Core container module

  • Application context module

  • AOP module (Aspect Oriented Programming)

  • JDBC abstraction and DAO module

  • O/R mapping integration module (Object/Relational)

  • Web module

  • MVC framework module

  1. What is the structure of Spring framework?

  1. What is the Core container module?

This module is provides the fundamental functionality of the spring framework. In this module BeanFactory is the heart of any spring-based application. The entire framework was built on the top of this module. This module makes the spring container.

  1. What is Application context module?

The Application context module makes spring a framework. This module extends the concept of BeanFactory, providing support for internationalization (I18N) messages, application lifecycle events, and validation. This module also supplies many enterprise services such JNDI access, EJB integration, remoting, and scheduling. It also provides support to other framework.

  1. What is AOP module?

The AOP module is used for developing aspects for our Spring-enabled application. Much of the support has been provided by the AOP Alliance in order to ensure the interoperability between Spring and other AOP frameworks. This module also introduces metadata programming to Spring. Using Spring’s metadata support, we will be able to add annotations to our source code that instruct Spring on where and how to apply aspects.

  1. What is JDBC abstraction and DAO module?

Using this module we can keep up the database code clean and simple, and prevent problems that result from a failure to close database resources. A new layer of meaningful exceptions on top of the error messages given by several database servers is bought in this module. In addition, this module uses Spring’s AOP module to provide transaction management services for objects in a Spring application.

  1. What are object/relational mapping integration module?

Spring also supports for using of an object/relational mapping (ORM) tool over straight JDBC by providing the ORM module. Spring provide support to tie into several popular ORM frameworks, including Hibernate, JDO, and iBATIS SQL Maps. Spring’s transaction management supports each of these ORM frameworks as well as JDBC.

  1. What is web module?

This module is built on the application context module, providing a context that is appropriate for web-based applications. This module also contains support for several web-oriented tasks such as transparently handling multipart requests for file uploads and programmatic binding of request parameters to your business objects. It also contains integration support with Jakarta Struts.

  1. What is web module?

Spring comes with a full-featured MVC framework for building web applications. Although Spring can easily be integrated with other MVC frameworks, such as Struts, Spring’s MVC framework uses IoC to provide for a clean separation of controller logic from business objects. It also allows you to declaratively bind request parameters to your business objects. It also can take advantage of any of Spring’s other services, such as I18N messaging and validation.

  1. What is a BeanFactory?

A BeanFactory is an implementation of the factory pattern that applies Inversion of Control to separate the application’s configuration and dependencies from the actual application code.

  1. What is AOP Alliance?

AOP Alliance is an open-source project whose goal is to promote adoption of AOP

and interoperability among different AOP implementations by defining a common

set of interfaces and components.

  1. What is Spring configuration file?

Spring configuration file is an XML file. This file contains the classes information and describes how these classes are configured and introduced to each other.

  1. What does a simple spring application contain?

These applications are like any Java application. They are made up of several classes, each performing a specific purpose within the application. But these classes are configured and introduced to each other through an XML file. This XML file describes how to configure the classes, known as the Spring configuration file.

  1. What is XMLBeanFactory?

BeanFactory has many implementations in Spring. But one of the most useful one is org.springframework.beans.factory.xml.XmlBeanFactory, which loads its beans based on the definitions contained in an XML file. To create an XmlBeanFactory, pass a java.io.InputStream to the constructor. The InputStream will provide the XML to the factory. For example, the following code snippet uses a java.io.FileInputStream to provide a bean definition XML file to XmlBeanFactory.

BeanFactory factory = new XmlBeanFactory(new FileInputStream(“beans.xml”));

To retrieve the bean from a BeanFactory, call the getBean() method by passing the name of the bean you want to retrieve.

MyBean myBean = (MyBean) factory.getBean(“myBean”);

  1. What are important ApplicationContext implementations in spring framework?

  • ClassPathXmlApplicationContext – This context loads a context definition from an XML file located in the class path, treating context definition files as class path resources.

  • FileSystemXmlApplicationContext – This context loads a context definition from an XML file in the filesystem.

  • XmlWebApplicationContext – This context loads the context definitions from an XML file contained within a web application.

  1. Explain Bean lifecycle in Spring framework?

1. The spring container finds the bean’s definition from the XML file and instantiates the bean.

2. Using the dependency injection, spring populates all of the properties as specified in the bean definition.

3. If the bean implements the BeanNameAware interface, the factory calls setBeanName() passing the bean’s ID.

4. If the bean implements the BeanFactoryAware interface, the factory calls setBeanFactory(), passing an instance of itself.

5. If there are any BeanPostProcessors associated with the bean, their post- ProcessBeforeInitialization() methods will be called.

6. If an init-method is specified for the bean, it will be called.

7. Finally, if there are any BeanPostProcessors associated with the bean, their postProcessAfterInitialization() methods will be called.

  1. What is bean wiring?

Combining together beans within the Spring container is known as bean wiring or wiring. When wiring beans, you should tell the container what beans are needed and how the container should use dependency injection to tie them together.

  1. How do add a bean in spring application?

<?xml version=”1.0″ encoding=”UTF-8″?>

<!DOCTYPE beans PUBLIC “-//SPRING//DTD BEAN//EN”

http://www.springframework.org/dtd/spring-beans.dtd”&gt;

<beans>

<bean id=”foo” class=”com.act.Foo”/>

<bean id=”bar” class=”com.act.Bar”/>

</beans>

In the bean tag the id attribute specifies the bean name and the class attribute specifies the fully qualified class name.

 

  1. What are singleton beans and how can you create prototype beans?

Beans defined in spring framework are singleton beans. There is an attribute in bean tag named ‘singleton’ if specified true then bean becomes singleton and if set to false then the bean becomes a prototype bean. By default it is set to true. So, all the beans in spring framework are by default singleton beans.

<beans>

<bean id=”bar” class=”com.act.Foo” singleton=”false”/>

</beans>

  1. What are the important beans lifecycle methods?

There are two important bean lifecycle methods. The first one is setup which is called when the bean is loaded in to the container. The second method is the teardown method which is called when the bean is unloaded from the container.

  1. How can you override beans default lifecycle methods?

The bean tag has two more important attributes with which you can define your own custom initialization and destroy methods. Here I have shown a small demonstration. Two new methods fooSetup and fooTeardown are to be added to your Foo class.

<beans>

<bean id=”bar” class=”com.act.Foo” init-method=”fooSetup” destroy=”fooTeardown”/>

</beans>

  1. What are Inner Beans?

When wiring beans, if a bean element is embedded to a property tag directly, then that bean is said to the Inner Bean. The drawback of this bean is that it cannot be reused anywhere else.

  1. What are the different types of bean injections?

There are two types of bean injections.

    1. By setter

    2. By constructor
    1. What is Auto wiring?

    You can wire the beans as you wish. But spring framework also does this work for you. It can auto wire the related beans together. All you have to do is just set the autowire attribute of bean tag to an autowire type.

    <beans>

    <bean id=”bar” class=”com.act.Foo” Autowire=”autowire type”/>

    </beans>

    1. What are different types of Autowire types?

    There are four different types by which autowiring can be done.

      • byName

      • byType

      • constructor

        1. autodetect
        1. What are the different types of events related to Listeners?

        There are a lot of events related to ApplicationContext of spring framework. All the events are subclasses of org.springframework.context.Application-Event. They are

        • ContextClosedEvent – This is fired when the context is closed.

        • ContextRefreshedEvent – This is fired when the context is initialized or refreshed.

        • RequestHandledEvent – This is fired when the web context handles any request.

        1. What is an Aspect?

        An aspect is the cross-cutting functionality that you are implementing. It is the aspect of your application you are modularizing. An example of an aspect is logging. Logging is something that is required throughout an application. However, because applications tend to be broken down into layers based on functionality, reusing a logging module through inheritance does not make sense. However, you can create a logging aspect and apply it throughout your application using AOP.

        1. What is a Jointpoint?

        A joinpoint is a point in the execution of the application where an aspect can be plugged in. This point could be a method being called, an exception being thrown, or even a field being modified. These are the points where your aspect’s code can be inserted into the normal flow of your application to add new behavior.

         

        1. What is an Advice?

        Advice is the implementation of an aspect. It is something like telling your application of a new behavior. Generally, and advice is inserted into an application at joinpoints.

        1. What is a Pointcut?

        A pointcut is something that defines at what joinpoints an advice should be applied. Advices can be applied at any joinpoint that is supported by the AOP framework. These Pointcuts allow you to specify where the advice can be applied.

        1. What is an Introduction in AOP?

        An introduction allows the user to add new methods or attributes to an existing class. This can then be introduced to an existing class without having to change the structure of the class, but give them the new behavior and state.

        1. What is a Target?

        A target is the class that is being advised. The class can be a third party class or your own class to which you want to add your own custom behavior. By using the concepts of AOP, the target class is free to center on its major concern, unaware to any advice that is being applied.

        1. What is a Proxy?

        A proxy is an object that is created after applying advice to a target object. When you think of client objects the target object and the proxy object are the same.

        1. What is meant by Weaving?

        The process of applying aspects to a target object to create a new proxy object is called as Weaving. The aspects are woven into the target object at the specified joinpoints.

        1. What are the different points where weaving can be applied?

        • Compile Time

        • Classload Time

        • Runtime

        1. What are the different advice types in spring?

        • Around : Intercepts the calls to the target method

        • Before : This is called before the target method is invoked

        • After : This is called after the target method is returned

        • Throws : This is called when the target method throws and exception

        • Around : org.aopalliance.intercept.MethodInterceptor

        • Before : org.springframework.aop.BeforeAdvice

        • After : org.springframework.aop.AfterReturningAdvice

        • Throws : org.springframework.aop.ThrowsAdvice

        1. What are the different types of AutoProxying?

        • BeanNameAutoProxyCreator

        • DefaultAdvisorAutoProxyCreator

        • Metadata autoproxying

        1. What is the Exception class related to all the exceptions that are thrown in spring applications?

        DataAccessException – org.springframework.dao.DataAccessException

         

        1. What kind of exceptions those spring DAO classes throw?

        The spring’s DAO class does not throw any technology related exceptions such as SQLException. They throw exceptions which are subclasses of DataAccessException.

        1. What is DataAccessException?

        DataAccessException is a RuntimeException. This is an Unchecked Exception. The user is not forced to handle these kinds of exceptions.

        1. How can you configure a bean to get DataSource from JNDI?

        <bean id=”dataSource” class=”org.springframework.jndi.JndiObjectFactoryBean”>
        <property name=”jndiName”>       <value>java:comp/env/jdbc/myDatasource</value>
          </property>
        </bean>

        1. How can you create a DataSource connection pool?

        <bean id=”dataSource” class=”org.apache.commons.dbcp.BasicDataSource”>
        <property name=”driver”>
        <value>${db.driver}</value>
        </property>
        <property name=”url”>
        <value>${db.url}</value>
        </property>
        <property name=”username”>
        <value>${db.username}</value>
        </property>
        <property name=”password”>
        <value>${db.password}</value>
        </property>
        </bean>

        1. How JDBC can be used more efficiently in spring framework?

        JDBC can be used more efficiently with the help of a template class provided by spring framework called as JdbcTemplate.

        1. How JdbcTemplate can be used?

        With use of Spring JDBC framework the burden of resource management and error handling is reduced a lot. So it leaves developers to write the statements and queries to get the data to and from the database.

        JdbcTemplate template = new JdbcTemplate(myDataSource);

        A simple DAO class looks like this.

        public class StudentDaoJdbc implements StudentDao {
        private JdbcTemplate jdbcTemplate;
             public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
                  this.jdbcTemplate = jdbcTemplate;
             }
             more..
        }

        The configuration is shown below.

        <bean id=”jdbcTemplate” class=”org.springframework.jdbc.core.JdbcTemplate“>
        <property name=”dataSource”>
               <ref bean=”dataSource”/>
           </property>
        </bean>
        <bean id=”studentDao” class=”StudentDaoJdbc”>
        <property name=”jdbcTemplate”>
                <ref bean=”jdbcTemplate”/>
           </property>
        </bean>
        <bean id=”courseDao” class=”CourseDaoJdbc”>
        <property name=”jdbcTemplate”>
               <ref bean=”jdbcTemplate”/>
           </property>
        </bean>

        1. How do you write data to backend in spring using JdbcTemplate?

        The JdbcTemplate uses several of these callbacks when writing data to the database. The usefulness you will find in each of these interfaces will vary. There are two simple interfaces. One is PreparedStatementCreator and the other interface is BatchPreparedStatementSetter.

        1. Explain about PreparedStatementCreator?

        PreparedStatementCreator is one of the most common used interfaces for writing data to database. The interface has one method createPreparedStatement().

        PreparedStatement createPreparedStatement(Connection conn)
        throws SQLException;

        When this interface is implemented, we should create and return a PreparedStatement from the Connection argument, and the exception handling is automatically taken care off. When this interface is implemented, another interface SqlProvider is also implemented which has a method called getSql() which is used to provide sql strings to JdbcTemplate.

        1. Explain about BatchPreparedStatementSetter?

        If the user what to update more than one row at a shot then he can go for BatchPreparedStatementSetter. This interface provides two methods

        setValues(PreparedStatement ps, int i) throws SQLException;
        int getBatchSize();

        The getBatchSize() tells the JdbcTemplate class how many statements to create. And this also determines how many times setValues() will be called.

        1. Explain about RowCallbackHandler and why it is used?

        In order to navigate through the records we generally go for ResultSet. But spring provides an interface that handles this entire burden and leaves the user to decide what to do with each row. The interface provided by spring is RowCallbackHandler. There is a method processRow() which needs to be implemented so that it is applicable for each and everyrow.

        void processRow(java.sql.ResultSet rs);

        Dojo Examples – II

        1. Getting Data

        Create one sample file to load in and name it as sample.txt with below text
        I am a <em>remote</em> file.
        We used Dojo(Ajax) to put text
        in our page

        <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
        <html>
        <head>
        <meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″>
        <title>Getting data with Dojo</title>
        <!– load the dojo toolkit base –>
        <script type=”text/javascript” src=”dojo/dojo.js”
        djConfig=”parseOnLoad:true, isDebug:true”></script>
        <script type=”text/javascript”>
        var init = function(){
        var contentNode = dojo.byId(“content”);
        dojo.xhrGet({
        url: “sample.txt”,
        handleAs: “text”,
        load: function(data,args){
        // fade out the node we’re modifying
        dojo.fadeOut({
        node: contentNode,
        delay: 2000,
        onEnd: function(){
        // set the data, fade it back in
        contentNode.innerHTML = data;
        dojo.fadeIn({node: contentNode}).play();
        }
        }).play();
        },
        // if any error occurs, it goes here:
        error: function(error,args){
        console.warn(“error!”,error);
        }

        // single handle argument is used instead of both load & error
        handle: function(data,args){
        if(typeof data == “error”){
        console.warn(“error!”);
        console.log(args);
        }else{
        dojo.fadeOut({
        node: contentNode,
        delay: 2000,
        onEnd: function(){
        // set the data, fade it back in
        contentNode.innerHTML = data;
        dojo.fadeIn({node: contentNode}).play();
        }
        }).play();
        }
        }
        });
        };
        dojo.addOnLoad(init);
        </script>
        <style type=”text/css”>
        container {
        border:1px dotted #b7b7b7;
        background:#ededed;
        width:75px;
        height:55px;
        }
        </style>
        </head>

        <body>
        <div id=”container” class=”box”>
        <div id=”content”>
        I am some Inner Content.
        I am going to be replaced
        </div>
        </div>
        </body>
        </html>

        Dojo Examples – I

        <html>
        <head>
        <title>Dojo Toolkit Working Examples</title>
        <!– load the dojo toolkit base –>
        <script type=”text/javascript” src=”dojo/dojo.js”
        djConfig=”parseOnLoad:true, isDebug:true”></script>
        <script type=”text/javascript”>
        /* our JavaScript will go here */
        dojo.require(“dijit.form.Button”);
        dojo.require(“dijit.TitlePane”);
        dojo.require(“dojo.NodeList-fx”);
        //——Example – 1————-
        dojo.addOnLoad(function(){
        dojo.byId(“testHeading”).innerHTML = “We’re on our way!”
        console.log(“onLoad fires after require() is done”);
        dojo.query(“#testHeading”)
        // add “testClass” to its class=”” attribute
        .addClass(“testClass”)
        // and fade it out after 500 ms
        .fadeOut({ delay:2000 }).play();
        dojo.query(“.para”)
        .addClass(“testClass”)
        .fadeOut({ delay: 1000 }).play();
        var node = dojo.byId(“testHeading”);
        dojo.connect(node,”onclick”,function(){
        node.innerHTML = “I’ve been clicked”
        });
        });
        // ——– Example – 2 —————————-

        var disableLinks = function(){
        dojo.query(“a”).connect(“onclick”,function(e){
        e.preventDefault(); // stop the event
        console.log(‘clicked: ‘,e.target); // the node we clicked on
        });
        };
        dojo.addOnLoad(disableLinks);
        // ———— Example – 3 ——————–
        var mineObj = {
        aMethod: function(){
        console.log(‘running A’);
        },
        bMethod: function(){
        console.log(‘running B’);
        }
        };
        var otherObj = {
        cMethod: function(){
        console.log(‘running C’);
        }
        };
        dojo.addOnLoad(function(){
        // run bMethod() whenever aMethod() gets run
        dojo.connect(mineObj,”aMethod”,mineObj,”bMethod”);
        // run an entirely different object’s method via a separate connection
        dojo.connect(mineObj,”bMethod”,otherObj,”cMethod”);
        // start chain of events
        mineObj.aMethod();
        });
        // ————- Example – 4 ———————-
        dojo.addOnLoad(function(){
        var animArgs = {
        node: “testHeading”,
        duration: 1000, // ms to run animation
        delay: 250 // ms to stall before playing
        };
        dojo.fadeOut(animArgs).play();
        });
        // ———- Example – 5 —————————–
        dojo.addOnLoad(function(){
        dojo.style(“testHeading”,”opacity”,”0″); // hide it
        var anim1 = dojo.fadeOut({ node: “testHeading”, duration:700 });
        var anim2 = dojo.animateProperty({
        node: “testHeading”, delay: 1000,
        properties:{
        // fade back in and make text bigger
        opacity: { end: 1 }, fontSize: { end:19, unit:”pt”}
        }
        });
        anim1.play();
        anim2.play();
        });
        // ———- Example – 6 —————————–

        dojo.require(“dojo.fx”);
        dojo.addOnLoad(function(){
        var anim = dojo.fadeOut({ node: “testHeading” });
        var anim2 = dojo.fx.slideTo({ node: “testHeading”, top:75, left:75 });
        var result = dojo.fx.combine([anim,anim2]);
        result.play();
        });
        // ——– Example – 7 —————

        dojo.addOnLoad(function(){
        var anim = dojo.fadeOut({ node: “testHeading” });
        dojo.connect(anim,”onEnd”,function(){
        dojo.byId(“testHeading”).innerHTML = “replaced after fade!”
        dojo.fadeIn({ node:”testHeading” }).play();
        });
        anim.play();
        });
        // ——– Example – 8 ——————

        dojo.addOnLoad(function(){
        var anim = dojo.animateProperty({
        node:”testHeading”,
        duration:700,
        properties: {
        // javascript css names are camelCase (not hyphenated)
        fontSize: { start:12, end:22, unit:”pt” },
        opacity: { start:1, end:0.5 },
        color: { start: “#000″, end:”#FFE” }
        },
        delay:100 // be careful of this trailing comma, it breaks IE.
        });
        anim.play();
        });
        // ———– Example – 9 —————————-

        dojo.require(“dojo.NodeList-fx”);
        var fadeThemOut = function(){
        dojo.query(“.fadeNode”).fadeOut().play();
        }
        var fadeThemIn = function(){
        dojo.query(“.fadeNode”).fadeIn().play();
        }
        dojo.addOnLoad(function(){
        dojo.connect(dojo.byId(“fadeOutTest”),”onclick”,fadeThemOut);
        dojo.connect(dojo.byId(“fadeInTest”),”onclick”,fadeThemIn);
        });
        </script>
        <style type=”text/css”>
        /* our CSS can go here */
        .testClass {
        color:red;
        }
        </style>
        </head>
        <body>
        <!– this is a Typical WebPage starting point … –>
        <h1 id=”testHeading”>Dojo Skeleton Page</h1>
        <a class=”link” href=”#”>First link</a>
        <a class=”link” href=”#”>Second Link</a>
        <p class=”para”>First paragraph</p>
        <p class=”para”>Second paragraph</p>
        <p class=”para”>Third paragraph</p>
        <p class=”fadeNode”>FadeNode1 </p>
        <p class=”fadeNode”>FadeNode2</p>
        <p class=”fadeNode”>FadeNode3</p>
        <div id=”fadeInTest”> Click to fadeIn</div>
        <div id=”fadeOutTest”>Click to fadeOut</div>
        <div id=”contentNode”>
        <p>Some Content To Replace</p>
        </div>
        </body>
        </html>

        JavaScript

        1. What is JavaScript?
        JavaScript is a platform-independent, event-driven, interpreted client-side scripting and programming language developed by Netscape Communications Corp. and Sun Microsystems.
        2. How is JavaScript different from Java?
        Java is an entire programming language developed by Sun Microsystems, while JavaScript is a scripting language that was introduced by Netscape.
        3.What’s relationship between JavaScript and ECMAScript?
        ECMAScript is yet another name for JavaScript (other names include LiveScript). The current JavaScript that you see supported in browsers is ECMAScript revision 3.
        4.How do you submit a form using Javascript?
        Use document.forms[0].submit();
        (0 refers to the index of the form – if you have more than one form in a page, then the first one has the index 0, second has index 1 and so on).
        5.How do we get JavaScript onto a web page?
        JavaScript can be placed inside of the <head> element or it can directly add inside <body> element.
        <script type=”text/javascript” >
        // Add scripting code here
        </script>
        JavaScript can be referenced from a separate file also
        <script type=”text/javascript” SRC=”myStuff.js”></script>
        6.How to read and write a file using javascript?
        I/O operations like reading or writing a file is not possible with client-side javascript. However , this can be done by coding a Java applet that reads files for the script.
        7.How to detect the operating system on the client machine?
        In order to detect the operating system on the client machine, the navigator.appVersion
        string (property) should be used.
        8.How can JavaScript make a Web site easier to use? That is, are there certain JavaScript techniques that make it easier for people to use a Web site?
        JavaScript’s greatest potential gift to a Web site is that scripts can make the page more immediately interactive, that is, interactive without having to submit every little thing to the server for a server program to re-render the page and send it back to the client. For example, consider a top-level navigation panel that has, say, six primary image map links into subsections of the Web site. With only a little bit of scripting, each map area can be instructed to pop up a more detailed list of links to the contents within a subsection whenever the user rolls the cursor atop a map area.
        9.What are JavaScript types?
        Number, String, Boolean, Function, Object, Null, Undefined.
        10.How do you convert numbers between different bases in JavaScript?
        Use the parseInt() function, that takes a string as the first parameter, and the base as a second parameter. So to convert hexadecimal 3F to decimal, use parseInt (“3F”, 16); 
        11.How to create arrays in JavaScript?
        var arr = new Array();
        arr[0] = ‘HTML’
        arr[1] = ‘JavaScript’
        // We also can create the arrays like this
        var arr = new Array(21, 22, 23, 24, 25);
        12.How do you target a specific frame from a hyperlink?
        Include the name of the frame in the target attribute of the hyperlink. <a href=”mypage.htm” target=”myframe”>>My Page</a>
        13.What is a fixed-width table and its advantages?
        Fixed width tables are rendered by the browser based on the widths of the columns in the first row, resulting in a faster display in case of large tables. Use the CSS style table-layout:fixed to specify a fixed width table.
        If the table is not specified to be of fixed width, the browser has to wait till all data is downloaded and then infer the best width for each of the columns. This process can be very slow for large tables.
        14.Example of using Regular Expressions for syntax checking in JavaScript
        var re = new RegExp(“^(&[A-Za-z_0-9]{1,}=[A-Za-z_0-9]{1,})*$”);
        var text = myWidget.value;
        var OK = re.test(text);
        if( ! OK ) {
        alert(“The extra parameters need some work.\r\n Should be something like: \”&a=1&c=4\””);
        }
        15.How to add Buttons in JavaScript?
        <input type=”submit” value=”GO!” />
        Another useful approach is to set the “type” to “button” and use the “onclick” event.
        <input type=”button” value=”Hector” onclick=”displayHero(this)” />
        16.Where are cookies actually stored on the hard disk?
        This depends on the user’s browser and OS.
        In the case of Netscape with Windows OS,all the cookies are stored in a single file called
        cookies.txt
        c:\Program Files\Netscape\Users\username\cookies.txt
        In the case of IE,each cookie is stored in a separate file namely username@website.txt.
        c:\Windows\Cookies\username@Website.txt
        17.What can javascript programs do?
        Generation of HTML pages on-the-fly without accessing the Web server. The user can be given control over the browser like User input validation Simple computations can be performed on the client’s machine The user’s browser, OS, screen size, etc. can be detected Date and Time Handling
        18.How to set a HTML document’s background color?
        document.bgcolor property can be set to any appropriate color.
        19.How can JavaScript be used to personalize or tailor a Web site to fit individual users?
        JavaScript-enhanced page can instruct the browser to render only certain content based on the browser, operating system, and even the screen size.
        Scripting can even go further if the page author desires. For example, the author may include a preference screen that lets the user determine the desired background and text color combination. A script can save this information on the client in a well-regulated local file called a cookie. The next time the user comes to the site, scripts in its pages look to the cookie info and render the page in the color combination selected previously. The server is none the wiser, nor does it have to store any visitor-specific information.
        20.What does isNaN function do?
        Return true if the argument is not a number. 
        21.What is negative infinity?
        It’s a number in JavaScript, derived by dividing negative number by zero.
        22.In a pop-up browser window, how do you refer to the main browser window that opened it?
        Use window.opener to refer to the main window from pop-ups.
        23.What is the data type of variables of in JavaScript?
        All variables are of object type in JavaScript.
        24.Methods GET and POST in HTML forms – what’s the difference?.
        GET: Parameters are passed in the querystring. Maximum amount of data that can be sent via the GET method is limited to about 2kb.
        POST: Parameters are passed in the request body. There is no limit to the amount of data that can be transferred using POST. However, there are limits on the maximum amount of data that can be transferred in one name/value pair.
        25.How to write a script for “Select” lists using javascript
        1. To remove an item from a list set it to null
        mySelectObject.options[3] = null;
        2. To truncate a list set its length to the maximum size you desire
        mySelectObject.length = 2;
        3. To delete all options in a select object set the length to 0.
        mySelectObject.leng
        26.Text From Your Clipboard?
        It is true, text you last copied for pasting (copy & paste) can be stolen when you visit web sites using a combination of JavaScript and ASP (or PHP, or CGI) to write your possible sensitive data to a database on another server.
        27.What does the “Access is Denied” IE error mean?
        The “Access Denied” error in any browser is due to the following reason.
        A javascript in one window or frame is tries to access another window or frame whose
        document’s domain is different from the document containing the script.
        28.Is a javascript script faster than an ASP script?
        Yes.Since javascript is a client-side script it does require the web server’s help for its
        computation,so it is always faster than any server-side script like ASP,PHP,etc..
        29.Are Java and JavaScript the Same?
        No.java and javascript are two different languages.
        Java is a powerful object – oriented programming language like C++,C whereas Javascript is a
        client-side scripting language with some limitations.
        30.How to embed javascript in a web page?
        javascript code can be embedded in a web page between <script
        langugage=”javascript”></script> tags 
        31.What boolean operators does JavaScript support?
        &&, || and !
        32.What does “1”+2+4 evaluate to?
        Since 1 is a string, everything is a string, so the result is 124. 
        33.How to get the contents of an input box using Javascript?
        Use the “value” property.
        var myValue = window.document.getElementById(“MyTextBox”).value;
        34.How to determine the state of a checkbox using Javascript?
        var checkedP = window.document.getElementById(“myCheckBox”).checked;
        35.How to set the focus in an element using Javascript?
        document.forms[0].elements[“myelementname”].focus(); 
        36.How to access an external javascript file that is stored externally and not embedded?
        This can be achieved by using the following tag between head tags or between body tags.
        <script src=”abc.js”></script>
        37.What is the difference between an alert box and a confirmation box?
        An alert box displays only one button which is the OK button whereas the Confirm box
        displays two buttons namely OK and cancel. 
        38.What is a prompt box?
        A prompt box allows the user to enter input by providing a text box.
        39.Can javascript code be broken in different lines?
        Breaking is possible within a string statement by using a backslash \ at the end but not within any other javascript statement.
        that is ,
        document.write(“Hello \ world”);
        is possible but not document.write \
        (“hello world”);
        40.How about 2+5+”8″?
        Since 2 and 5 are integers, this is number arithmetic, since 8 is a string, it’s concatenation, so 78 is the result.
        41.What is the difference between SessionState and ViewState?
        ViewState is specific to a page in a session. Session state refers to user specific data that can be accessed across all pages in the web application.
        42.How to Accessing Elements using javascript?
        We can use the “getElementById” method (which is generally preferred)
        document.getElementById(“useless”).style.color = “red”;
        43.What looping structures are there in JavaScript?
        for, while, do-while loops, but no foreach.
        44.To put a “close window” link on a page ?
        <a href=’javascript:window.close()’ class=’mainnav’> Close </a>
        45.How to hide javascript code from old browsers that dont run it?
        Use the below specified style of comments <script language=javascript> <!– javascript code goes here // –> or Use the <NOSCRIPT>some html code </NOSCRIPT> tags and code the display html statements between these and this will appear on the page if the browser does not support javascript
        46.How to comment javascript code?
        Use // for line comments and
        /* */ for block comments
        47.Name the numeric constants representing max,min values
        Number.MAX_VALUE
        Number.MIN_VALUE
        48.What does javascript null mean?
        The null value is a unique value representing no value or no object.
        It implies no object,or null string,no valid boolean value,no number and no array object.
        49.How do you create a new object in JavaScript?
        var obj = new Object(); or var obj = {};
        50.How do you assign object properties?
        obj[“age”] = 17 or obj.age = 17.
        51.What’s a way to append a value to an array?
        arr[arr.length] = value;
        52.What is this keyword?
        It refers to the current object.
        53.What does the term sticky session mean in a web-farm scenario? Why would you use a sticky session? What is the potential disadvantage of using a sticky session?
        Sticky session refers to the feature of many commercial load balancing solutions for web-farms to route the requests for a particular session to the same physical machine that serviced the first request for that session. This is mainly used to ensure that a in-proc session is not lost as a result of requests for a session being routed to different servers. Since requests for a user are always routed to the same machine that first served the request for that session, sticky sessions can cause uneven load distribution across servers.
        54.To set all checkboxes to true using JavaScript?
        var checkboxes = document.getElementsByTagName(“input”);
        checkboxes.item(0).checked = true;
        55.How to select an element by id and swapping an image ?
        ..
        <script language=”JavaScript” type=”text/javascript” >
        function setBeerIcon() {

        var beerIcon = document.getElementById(“beerIcon”);
        beerIcon.src = “images/”+getSelectValue(“beer”)+”.jpg”;
        }
        </script>

        <img border=”0″ src=”” id=”brandIcon” alt=”brand” />

        <select name=”beer” id=”beer” onChange=”setButton();setBeerIcon();”>
        <option value=”–Select–“>Select beer</option>
        <option value=”heineken”>heineken</option>
        <option value=”sol”>sol</option>
        <option value=”amstellight”>amstellight</option>
        <option value=”coronalight”>coronalight</option>
        <option value=”coronaextra”>coronaextra</option>
        <option value=””></option>
        </select>
        56.What does undefined value mean in javascript?
        Undefined value means the variable used in the code doesnt exist or is not assigned any value or the property doesnt exist.
        57.What is the difference between undefined value and null value?
        (i)Undefined value cannot be explicitly stated that is there is no keyword called undefined whereas null value has keyword called null
        (ii)typeof undefined variable or property returns undefined whereas typeof null value returns object
        58.What is variable typing in javascript?
        It is perfectly legal to assign a number to a variable and then assign a string to the same variable as follows
        example
        i = 10;
        i = “string”;
        This is called variable typing
        59.Does javascript have the concept level scope?
        No.Javascript does not have block level scope,all the variables declared inside a function possess the same level of scope unlike c,c++,java.
        60.What are undefined and undeclared variables?
        Undeclared variables are those that are not declared in the program (do not exist at all),trying to read their values gives runtime error.But if undeclared variables are assigned then implicit declaration is done .
        Undefined variables are those that are not assigned any value but are declared in the program.Trying to read such variables gives special value called undefined value.
        61.What is === operator ?
        ==== is strict equality operator ,it returns true only when the two operands are having the same value without any type conversion.
        62.How to find the selected radio button immediately using the ‘this’ variable?
        <script>
        function favAnimal(button) {
        alert(‘You like ‘+button.value+’s.’);
        }
        </script>
        <input type=”radio” name=”marsupial” value=”kangaroo”
        onchange=”favAnimal(this)”>Kangaroo
        <br /><input type=”radio” name=”marsupial” value=”Opossum”
        onchange=”favAnimal(this)”>Opossum
        <br /><input type=”radio” name=”marsupial” value=”Tasmanian Tiger”
        onchange=”favAnimal(this)”>Tasmanian Tiger
        63.How to find radio button selection when a form is submitted?
        <script type=”text/javascript”>
        function findButton() {
        var myForm = document.forms.animalForm;
        var i;
        for(i=0;i<myForm.marsupial.length; i++) {
        if(myForm.marsupial[i].checked) {
        break;
        }
        }
        alert(“You selected \””+myForm.marsupial[i].value+”\”.”);
        }
        </script>
        <form name=”animalForm” action=””>
        <input type=”radio” name=”marsupial” value=”kangaroo” />Kangaroo
        <br /><input type=”radio” name=”marsupial” value=”Opossum” />Opossum
        <br /><input type=”radio” name=”marsupial” value=”Tasmanian Tiger” />Tasmanian Tiger
        <input type=”button” name=”GO” value=”GO” onclick=”findButton()” />
        64.How to disable an HTML object
        document.getElementById(“myObject”).disabled = true;
        65.To write messages to the screen without using “document.write()” ?

        <span id=”mystatus”>Test. </span>

        var element = document.getElementById(“mystatus”);
        element.textContent = message; //for Firefox
        element.innerHTML = message; //for IE
        66.How to Add new elements dynamically.

        <p id=”firstP”>firstP<p>

        var newP = document.createElement(“p”);
        var textNode = document.createTextNode(” I’m a new text node”);
        newP.appendChild(textNode);
        document.getElementById(“firstP”).appendChild(newP);
        67.how to have an element invoke a javascript on selection, instead of going to a new URL:
        <script type=”text/javascript”>
        function pseudoHitMe() {
        alert(“Ouch!”);
        }
        </script>
        <a href=”javascript:pseudoHitMe()”>hit me</a>
        68.How to have the status line update when the mouse goes over a link (The support of the status line is sporadic)?
        <a href=”javascript.shtml”
        onmouseover=”window.status=’Hi There!’;return true”
        onmouseout=”window.status=”;return true”>Look at the Status bar</a>

        Look at the Status bar as your cursor goes over the link.
        69.How to create a popup warning box
        alert(‘Warning: Please enter an integer between 0 and 100.’);
        70.How to create a confirmation box?
        confirm(“Do you really want to launch the missile?”);
        71.How to create an input box?
        prompt(“What is your temperature?”);
        72.How to open a window with no toolbar, but with the location object.
        window.open(“http://www.mysite.org/Misc/Pennies”,”Pennies”,”resizable=yes, status=yes,toolbar=yes,location=yes,menubar=yes,scrollbars=yes,width=800,height=400″);
        73.How to setting a cookie with the contents of a textbox ?
        Values stored in cookies may not have semicolons, commas, or spaces. You should use the handy “escape()” function to encode the values, and “unescape()” to retrieve them.

        <input name=”myTextBox” type=”text” id=”myTextBox”/>

        var myBox = window.document.getElementById(myTextBox”);
        document.cookie = “myTextBox=”+ escape(myBox.value);
        74.How to getting values from cookies to set widgets?
        ….
        var cookieData = document.cookie;
        var cEnd = cookieData.length;
        unescape(cookieData.substring(0, cEnd));

        75.How to Handle Event Handlers?

        function onHit() {
        alert(“I’ve been hit!”);
        }

        <input type=”button” id=”hitme” name=”hitme” value=”hit me” onclick=”onHit()” />
        Or
        document.getElementById(“hitme”).onclick = onHit;
        Or
        document.getElementById(“hitme”).onclick = function () { alert(“howdy!”); }
        Or
        document.getElementById(“hitme”).addEventListener(“click”, onHit, false); 
        76.How to remove the event listener:
        document.getElementById(“hitme”).removeEventListener(“click”, onHit, false);
        77.How to change style on an element?
        document.getElementById(“myText”).style.color = “green”;
        document.getElementById(“myText”).style.fontSize = “20”;
        -or-
        document.getElementById(“myText”).className = “regular”;
        78.How to make elements invisible
        Change the “visibility” attribute of the style object associated with your element. Remember that a hidden element still takes up space, use “display” to make the space disappear as well.

        if ( x == y) {
        myElement.style.visibility = ‘visible’;
        } else {
        myElement.style.visibility = ‘hidden’;
        }
        79.How to set the cursor to wait.
        In theory, we should cache the current state of the cursor and then put it back to its original state.
        document.body.style.cursor = ‘wait’;
        //do something interesting and time consuming
        document.body.style.cursor = ‘auto’; 
        80.How to reload the current page
        window.location.reload(true); 
        81.how to force a page to go to another page using JavaScript?
        <script language=”JavaScript” type=”text/javascript” ><!– location.href=”http://newhost/newpath/newfile.html”; //–></script>
        82.How to convert a string to a number using JavaScript?
        You can use the parseInt() and parseFloat() methods. Notice that extra letters following a valid number are ignored, which is kinda wierd but convenient at times.
        parseInt(“100”) ==> 100
        parseFloat(“98.6”) ==> 98.6
        parseFloat(“98.6 is a common temperature.”) ==> 98.6
        parseInt(“aa”) ==> Nan //Not a Number
        parseInt(“aa”,16) ==> 170 //you can supply a radix or base
        83.How to convert numbers to strings using JavaScript?
        You can prepend the number with an empty string
        var mystring = “”+myinteger;
        or
        var mystring = myinteger.toString();
        You can specify a base for the conversion,
        var myinteger = 14;
        var mystring = myinteger.toString(16);

        mystring will be “e”.
        84.How to test for bad numbers using JavaScript?
        the global method, “isNaN()” can tell if a number has gone bad.
        var temperature = parseFloat(myTemperatureWidget.value);
        if(!isNaN(temperature)) {
        alert(“Please enter a valid temperature.”);
        }
        85.What’s Math Constants and Functions using JavaScript?
        The Math object contains useful constants such as Math.PI, Math.E
        Math also has a zillion helpful functions.
        Math.abs(value); //absolute value
        Math.max(value1, value2); //find the largest
        Math.random() //generate a decimal number between 0 and 1
        Math.floor(Math.random()*101) //generate a decimal number between 0 and 100 
        86.What’s the Date object using JavaScript?
        Time inside a date object is stored as milliseconds since Jan 1, 1970.
        new Date(06,01,02) // produces “Fri Feb 02 1906 00:00:00 GMT-0600 (Central Standard Time)”
        new Date(06,01,02).toLocaleString() // produces “Friday, February 02, 1906 00:00:00”
        new Date(06,01,02) – new Date(06,01,01) // produces “86400000” 
        87.What does the delete operator do?
        The delete operator is used to delete all the variables and objects used in the program ,but it does not delete variables declared with var keyword.
        88.How to delete an entry using JavaScript?
        The “delete” operator removes an array element, but oddly does not change the size of the array.
        89.How to use strings as array indexes using JavaScript?
        Javascript does not have a true hashtable object, but through its wierdness, you can use the array as a hashtable.

        <script type=”text/javascript”>
        var days = [“Sunday”,”Monday”,”Tuesday”,”Wednesday”, “Thursday”,”Friday”,”Saturday”];

        for(var i=0; i < days.length; i++) {
        days[days[i]] = days[i];
        }

        document.write(“days[\”Monday\”]:”+days[“Monday”]);
        </script>
        This produces
        days[“Monday”]:Monday
        90.How to use “join()” to create a string from an array using JavaScript?
        “join” concatenates the array elements with a specified seperator between them.

        <script type=”text/javascript”>
        var days = [“Sunday”,”Monday”,”Tuesday”,”Wednesday”, “Thursday”,”Friday”,”Saturday”];
        document.write(“days:”+days.join(“,”));
        </script>
        This produces
        days:Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday
        91.How to make a array as a stack using JavaScript?
        The pop() and push() functions turn a harmless array into a stack

        <script type=”text/javascript”>
        var numbers = [“one”, “two”, “three”, “four”];
        numbers.push(“five”);
        numbers.push(“six”);
        document.write(numbers.pop());
        document.write(numbers.pop());
        document.write(numbers.pop());
        </script>
        This produces
        sixfivefour
        92.How to shift and unshift using JavaScript?
        <script type=”text/javascript”>
        var numbers = [“one”, “two”, “three”, “four”];
        numbers.unshift(“zero”);
        document.write(” “+numbers.shift());
        document.write(” “+numbers.shift());
        document.write(” “+numbers.shift());
        </script>
        This produces
        zero one two
        shift, unshift, push, and pop may be used on the same array. Queues are easily implemented using combinations.
        93.How to create an object using JavaScript?
        var myMovie = new Object();
        myMovie.title = “Aliens”;
        myMovie.director = “James Cameron”;
        …OR…
        function movie(title, director) {
        this.title = title;
        this.director = director;
        }
        var aliens = new movie(“Aliens”,”Cameron”);
        …OR…
        function movie(title, director) {
        title : title;
        director : director;
        }
        var aliens = new movie(“Aliens”,”Cameron”);

        94.How to associate functions with objects using JavaScript?
        this.title = title;
        this.director = director;
        this.toString = function movieToString() {
        return(“title: “+this.title+” director: “+this.director);
        }
        …OR…
        this.title = title;
        this.director = director;
        this.toString = movieToString; //assign function to this method pointer
        95.eval()?
        The eval() method is incredibly powerful allowing you to execute snippets of code during exection.
        var USA_Texas_Austin = “521,289”;
        eval(“USA_”+”Texas_”+”Austin”)
        96.What does break and continue statements do?
        Continue statement continues the current loop (if label not specified) in a new iteration whereas break statement exits the current loop.
        97.How to create a function using function constructor?
        The following example illustrates this
        It creates a function called square with argument x and returns x multiplied by itself.
        var square = new Function (“x”,”return x*x”);
        98.What’s Prototypes for JavaScript?
        Objects have “prototypes” from which they may inherit fields and functions.

        <script type=”text/javascript”>
        function movieToString() {
        return(“title: “+this.title+” director: “+this.director);
        }
        function movie(title, director) {
        this.title = title;
        this.director = director || “unknown”; //if null assign to “unknown”
        this.toString = movieToString; //assign function to this method pointer
        }
        movie.prototype.isComedy = false; //add a field to the movie’s prototype
        var officeSpace = new movie(“OfficeSpace”);
        var narnia = new movie(“Narni”,”Andrew Adamson”);
        document.write(narnia.toString());
        document.write(“
        Narnia a comedy? “+narnia.isComedy);
        officeSpace.isComedy = true; //override the default just for this object
        document.write(“
        Office Space a comedy? “+officeSpace.isComedy);
        </script>
        99.unescape(), escape() ?
        These are similar to the decodeURI() and encodeURI(), but escape() is used for only portions of a URI.
        var myvalue = “Sir Walter Scott”;
        escape(myvalue);

        &author=”+escape(myvalue);
        100.decodeURI(), encodeURI() ?
        Many characters cannot be sent in a URL, but must be converted to their hex encoding. These functions are used to convert an entire URI (a superset of URL) to and from a format that can be sent via a URI.
        <script type=”text/javascript”>
        var uri = “http://www.google.com/search?q=sonofusion Taleyarkhan”
        document.write(“Original uri: “+uri);
        document.write(“<br />encoded: “+encodeURI(uri));
        </script>

        HTML

        1. What is HTML?
              HTML, or HyperText Markup Language, is a Universal language which allows an individual using special code to create web pages to be viewed on the Internet. HTML Code is the code that tells the browser what to do.
        2. What is a tag?
              In HTML, a tag tells the browser what to do. When you write an HTML page, you enter tags for many reasons — to change the appearance of text, to show a graphic, or to make a link to another page.      
        3. What is the simplest HTML page?
          HTML Code:
        <HTML><HEAD><TITLE>This is my page title! </TITLE></HEAD><BODY>This is my message to the world!</BODY></HTML>
        Browser Display: This is my message to the world!
        4. How do I create frames? What is a frameset?
             Frames allow an author to divide a browser window into multiple (rectangular) regions. Multiple documents can be displayed in a single window, each within its own frame. Graphical browsers allow these frames to be scrolled independently of each other, and links can update the document displayed in one frame without affecting the others.
              You can’t just “add frames” to an existing document. Rather, you must create a frameset document that defines a particular combination of frames, and then display your content documents inside those frames. The frameset document should also include alternative non-framed content in a NOFRAMES element.
              The HTML 4 frames model has significant design flaws that cause usability problems for web users. Frames should be used only with great care.
        5. How can I include comments in HTML?
              An HTML comment begins with “<!–“, ends with “–>”, and does not contain “–” or “>” anywhere in the comment.
        6. What is a Hypertext link?
              A hypertext link is a special tag that links one page to another page or resource. If you click the link, the browser jumps to the link’s destination.
        7. What is a DOCTYPE? Which one do I use?
              According to HTML standards, each HTML document begins with a DOCTYPE declaration that specifies which version of HTML the document uses. Originally, the DOCTYPE declaration was used only by SGML-based tools like HTML validators, which needed to determine which version of HTML a document used (or claimed to use).
        8. Can I nest tables within tables?
              Yes, a table can be embedded inside a cell in another table. Here’s a simple example:
            <table><tr><td>this is the first cell of the outer table</td>
                       <td>this is the second cell of the outer table, with the inner table embedded in it
                           <table><tr><td>this is the first cell of the inner table</td>
                                         <td>this is the second cell of the inner table</td>
                                      </tr>
                               </table>
                           </td>
                       </tr>
                 </table>
              Older versions of Netscape Navigator have problems with tables that are nested extremely deeply (e.g., tables nested ten deep). To avoid problems, avoid nesting tables more than a few deep. You may be able to use the ROWSPAN and COLSPAN attributes to minimize table nesting.
        9. How do I align a table to the right (or left)?
              You can use <TABLE ALIGN=”right”> to float a table to the right. (Use ALIGN=”left” to float it to the left.) Any content that follows the closing </TABLE> tag will flow around the table. Use <BR CLEAR=”right”> or <BR CLEAR=”all”> to mark the end of the text that is to flow around the table
        10. How can I use tables to structure forms?
              <FORM ACTION=”[URL]”>
                 <TABLE BORDER=”0″>
                   <TR>
                   <TH>Account:</TH>
                      <TD><INPUT TYPE=”text” NAME=”account”></TD>
                   </TR>
                   <TR>
                      <TH>Password:</TH>
                   <TD><INPUT TYPE=”password” NAME=”password”></TD>
                   </TR>
                   <TR>
                      <TD> </TD>
                      <TD><INPUT TYPE=”submit” NAME=”Log On”></TD>
                   </TR>
                 </TABLE>
               </FORM>

        11. How do I center a table?
              In your HTML, use

            <div class=”center”>
                <table>…</table>
            </div>

            In your CSS, use

            div.center {
                text-align: center;
            }

            div.center table {
                margin-left: auto;
                margin-right: auto;
                text-align: left;
            }
        12. How do I use forms?
              The basic syntax for a form is: <FORM ACTION=”[URL]”>…</FORM>
            When the form is submitted, the form data is sent to the URL specified in the ACTION attribute. This URL should refer to a server-side (e.g., CGI) program that will process the form data. The form itself should contain

            * at least one submit button (i.e., an <INPUT TYPE=”submit” …> element),
            * form data elements (e.g., <INPUT>, <TEXTAREA>, and <SELECT>) as needed, and
            * additional markup (e.g., identifying data elements, presenting instructions) as needed.
        13. How can I check for errors?
              HTML validators check HTML documents against a formal definition of HTML syntax and then output a list of errors. Validation is important to give the best chance of correctness on unknown browsers (both existing browsers that you haven’t seen and future browsers that haven’t been written yet).
              HTML checkers (linters) are also useful. These programs check documents for specific problems, including some caused by invalid markup and others caused by common browser bugs. Checkers may pass some invalid documents, and they may fail some valid ones.
              All validators are functionally equivalent; while their reporting styles may vary, they will find the same errors given identical input. Different checkers are programmed to look for different problems, so their reports will vary significantly from each other. Also, some programs that are called validators (e.g. the “CSE HTML Validator”) are really linters/checkers. They are still useful, but they should not be confused with real HTML validators.
              When checking a site for errors for the first time, it is often useful to identify common problems that occur repeatedly in your markup. Fix these problems everywhere they occur (with an automated process if possible), and then go back to identify and fix the remaining problems.
              Link checkers follow all the links on a site and report which ones are no longer functioning. CSS checkers report problems with CSS style sheets.
        14. How do I make a form so it can be submitted by hitting ENTER?
              The short answer is that the form should just have one <INPUT TYPE=TEXT> and no TEXTAREA, though it can have other form elements like checkboxes and radio buttons.  
        15. How do I set the focus to the first form field?
              You cannot do this with HTML. However, you can include a script after the form that sets the focus to the appropriate field, like this:

            <form id=”myform” name=”myform” action=…>
                <input type=”text” id=”myinput” name=”myinput” …>
            </form>

            <script type=”text/javascript”>
                document.myform.myinput.focus();
            </script>

              A similar approach uses <body onload=…> to set the focus, but some browsers seem to process the ONLOAD event before the entire document (i.e., the part with the form) has been loaded.
        16. How can I eliminate the extra space after a </form> tag?
              HTML has no mechanism to control this. However, with CSS, you can set the margin-bottom of the form to 0. For example:
              <form style=”margin-bottom:0;” action=…>
              You can also use a CSS style sheet to affect all the forms on a page:
              form { margin-bottom: 0 ; }     
        17. Can I have two or more actions in the same form?
              No. A form must have exactly one action. However, the server-side (e.g., CGI) program that processes your form submissions can perform any number of tasks (e.g., updating a database, sending email, logging a transaction) in response to a single form submission.
        18. How can I use forms for pull-down navigation menus?
              There is no way to do this in HTML only; something else must process the form. JavaScript processing will work only for readers with JavaScript-enabled browsers. CGI and other server-side processing is reliable for human readers, but search engines have problems following any form-based navigation.
        19. Can I use percentage values for <TD WIDTH=…>?
              The HTML 3.2 and HTML 4.0 specifications allow only integer values (representing a number of pixels) for the WIDTH attribute of the TD element. However, the HTML 4.0 DTD allows percentage (and other non-integer) values, so an HTML validator will not complain about <TD WIDTH=”xx%”>.
              It should be noted that Netscape and Microsoft’s browsers interpret percentage values for <TD WIDTH=…> differently. However, their interpretations (and those of other table-aware browsers) happen to match when combined with <TABLE WIDTH=”100%”>. In such situations, percentage values can be used relatively safely, even though they are prohibited by the public specifications.
        20. Why doesn’t <TABLE WIDTH=”100%”> use the full browser width?
              Graphical browsers leave a narrow margin between the edge of the display area and the content.
              Also note that Navigator always leaves room for a scrollbar on the right, but draws the scrollbar only when the document is long enough to require scrolling. If the document does not require scrolling, then this leaves a right “margin” that cannot be removed.
        21. Why is there extra space before or after my table?
              This is often caused by invalid HTML syntax. Specifically, it is often caused by loose content within the table (i.e., content that is not inside a TD or TH element). There is no standard way to handle loose content within a table. Some browsers display all loose content before or after the table. When the loose content contains only multiple line breaks or empty paragraphs, then these browsers will display all this empty space before or after the table itself.
              The solution is to fix the HTML syntax errors. All content within a table must be within a TD or TH element.
        22. How do I create a link that sends me email?
              Use a mailto link, for example
              Send me email at
              <A HREF=”mailto:me@mydomain.com”>me@mydomain.com</A>.
        23. How can I have two sets of links with different colors?
              You can suggest this presentation in a style sheet. First, specify colors for normal links, like this:

            a:link {color: blue; background: white}
            a:visited {color: purple; background: white}
            a:active {color: red; background: white}

            Next, identify the links that you want to have different colors. You can use the CLASS attribute in your HTML, like this:

            <a class=”example1″ href=”[URL]”>[link text]</a>
            Then, in your style sheet, use a selector for links with this CLASS attribute, like this:

            a.example1:link {color: yellow; background: black}
            a.example1:visited {color: white; background: black}
            a.example1:active {color: red; background: black}

            Alternatively, you can identify an element that contains the links that you want to have different colors, like this:

            <div class=”example2″>…
            <a href=”[URL]”>[link text]</a>…
            <a href=”[URL]”>[link text]</a>…
            <a href=”[URL]”>[link text]</a>…
            </div>

            Then, in your style sheet, use a selector for links in this containing element, like this:

            .example2 a:link {color: yellow; background: black}
            .example2 a:visited {color: white; background: black}
            .example2 a:active {color: red; background: black}
        24. How can I show HTML examples without them being interpreted as part of my document?
              Within the HTML example, first replace the “&” character with “&amp;” everywhere it occurs. Then replace the “&lt;” character with “<” and the “&gt;” character with “>” in the same way.
            Note that it may be appropriate to use the CODE and/or PRE elements when displaying HTML examples.
        25. Should I put quotes around attribute values?
              It is never wrong to quote attribute values, and many people recommend quoting all attribute values even when the quotation marks are technically optional. XHTML 1.0 requires all attribute values to be quoted. Like previous HTML specifications, HTML 4 allows attribute values to remain unquoted in many circumstances (e.g., when the value contains only letters and digits).
              Be careful when your attribute value includes double quotes, for instance when you want ALT text like “the “King of Comedy” takes a bow” for an image. Humans can parse that to know where the quoted material ends, but browsers can’t. You have to code the attribute value specially so that the first interior quote doesn’t terminate the value prematurely. There are two main techniques:

            * Escape any quotes inside the value with " so you don’t terminate the value prematurely: ALT=”the "King of Comedy" takes a bow”.
            * Use single quotes to enclose the attribute value: ALT=’the “King of Comedy” takes a bow’.

              Both these methods are correct according to the specification and are supported by current browsers, but both were poorly supported in some earlier browsers. The only truly safe advice is to rewrite the text so that the attribute value need not contain quotes, or to change the interior double quotes to single quotes, like this: ALT=”the ‘King of Comedy’ takes a bow”.
        26. HTML for Lists
              1. Bulleted Lists: <ul> begins a bulleted, indented list. Each item in the list is then prefaced with the <li> tag. It is not necessary to insert a break at the end of each line — the <li> tag automatically creates a new line.

            * with <li type=disc>
            * with <li type=square>
            * with <li type=circle>

              2. Numbered Lists: <ol> begins a numbered, indented list. Each item in the list is then prefaced with the <li> tag. You need to close the list with the </ol> tag. Note: You can expand the <ol> to specify the TYPE of numbering:

            <ol> 1 (decimal numbers: 1, 2, 3, 4, 5, …)
            <ol type=”a”> a (lowercase alphabetic: a, b, c, d, e, …)
            <ol type=”A”> A (uppercase alphabetic: A, B, C, D, E, …)
            <ol type=”i”> i (lowercase Roman numerals: i, ii, iii, iv, v, …)
            <ol type=”I”> I (uppercase Roman numerals: I, II, III, IV, V, …)
        27. How do I eliminate the blue border around linked images?
              In your HTML, you can specify the BORDER attribute for the image:
              <a href=…><img src=… alt=… border=”0″></a>
              However, note that removing the border that indicates an image is a link makes it harder for users to distinguish quickly and easily which images on a web page are clickable.
        28. How do I eliminate the space around/between my images?
              If your images are inside a table, be sure to set the BORDER, CELLSPACING, and CELLPADDING attributes to 0.
              Extra space between images is often created by whitespace around the <IMG> tag in the markup. It is safe to use newlines inside a tag (between attributes), but not between two tags. For example, replace this:

              <td …>
              <img src=… alt=…>
              <img src=… alt=…>
              </td>

              with this:

              <td …><img src=… alt=…><img src=… alt=…></td>

              According to the latest specifications, the two should be equivalent. However, common browsers do not comply with the specifications in this situation.
              Finally, extra space between images can appear in documents that trigger the “standards” rendering mode of Gecko-based browsers like Mozilla and Firefox.
        29. How can I specify colors?
              If you want others to view your web page with specific colors, the most appropriate way is to suggest the colors with a style sheet. Cascading Style Sheets use the color and background-color properties to specify text and background colors. To avoid conflicts between the reader’s default colors and those suggested by the author, these two properties should always be used together.
              With HTML, you can suggest colors with the TEXT, LINK, VLINK (visited link), ALINK (active link), and BGCOLOR (background color) attributes of the BODY element.
              Note that these attributes are deprecated by HTML 4. Also, if one of these attributes is used, then all of them should be used to ensure that the reader’s default colors do not interfere with those suggested by the author. Here is an example:
              <body bgcolor=”#ffffff” text=”#000000″ link=”#0000ff” vlink=”#800080″ alink=”#000080″>
              Authors should not rely on the specified colors since browsers allow their users to override document-specified colors.
        30. How do I get form data emailed to me?
              The only reliable mechanism for processing form submissions is with a server-side (e.g., CGI) program. To send form data to yourself via email, you should use a server-side program that processes the form submission and sends the data to your email address.
        31. Can I prevent a form from being submitted again?
              No. The server-side (e.g., CGI) program that processes the form submission must handle duplicate submissions gracefully.
              You could generate the form with a server-side (e.g., CGI) program that adds a hidden field with a unique session ID. Then the server-side program that processes the form submission can check the session ID against a list of previously used session IDs. If the session ID has already been used, then an appropriate action can be taken (e.g., reject the submission, or update the previously submitted data).
              Ultimately, your server-side program must be smart enough to handle resubmitted data. But you can avoid getting resubmitted data by not expiring the confirmation page from form submissions. Since you want to expire pages quickly when they have transient data, you might want to avoid putting transient data on the confirmation page. You could provide a link to a database query that returns transient data though.
        32. How can I allow file uploads to my web site?
              These things are necessary for Web-based uploads:

            * An HTTP server that accepts uploads.
            * Access to the /cgi-bin/ to put the receiving script. Prewritten CGI file-upload scripts are available.
            * A form implemented something like this:

            <form method=”post” enctype=”multipart/form-data” action=”submitAction”>
            File to upload: <input type=file name=upfile><br>
            Notes about the file: <input type=text name=note><br>
            <input type=submit value=Press> to upload the file!
            </form>
        33. How can I require that fields be filled in, or filled in correctly?
              Have the server-side (e.g., CGI) program that processes the form submission send an error message if the field is not filled in properly. Ideally, this error message should include a copy of the original form with the original (incomplete or incorrect) data filled in as the default values for the form fields. The Perl CGI.pm module provides helpful mechanisms for returning partially completed forms to the user.
              In addition, you could use JavaScript in the form’s ONSUBMIT attribute to check the form data. If JavaScript support is enabled, then the ONSUBMIT event handler can inform the user of the problem and return false to prevent the form from being submitted.
              Note that the server-side program should not rely upon the checking done by the client-side script.
        34. How do I change the title of a framed document?
              The title displayed is the title of the frameset document rather than the titles of any of the pages within frames. To change the title displayed, link to a new frameset document using TARGET=”_top” (replacing the entire frameset).
        35. How do I link an image to something?
              Just use the image as the link content, like this:
            <a href=…><img src=… alt=…></a>
        36. How do I link to a location in the middle of an HTML document?
              There are different ways to fullfil the above requirement
              a. <h2><a name=”section2″>Section 2: Beyond Introductions</a></h2>
              b.<h2 id=”section2″>Section 2: Beyond Introductions</h2>
              c.<a href=”#section2″>go to Section 2</a>
              d.<a href=”thesis.html#section2″>go to Section 2 of my thesis</a>   
        37. How do I create a link?
              <A HREF=”http://www.yoursite.com/faq/html/”>Web Authoring FAQ</A>
        38. How do I create a link that opens a new window?
              <a target=”_blank” href=…> opens a new, unnamed window.
              <a target=”example” href=…> opens a new window named “example”, provided that a window or frame by that name does not already exist.
        39. How do I let people download a file from my page?
              Once the file is uploaded to the server, you need only use an anchor reference tag to link to it. An example would be:
              <a href=”../files/foo.zip”>Download Foo Now! (100kb ZIP)</a>
        40. How do I create a button which acts like a link?
              This is best done with a small form:

            <FORM ACTION=”[URL]” METHOD=GET>
                <INPUT TYPE=submit VALUE=”Text on button”>
            </FORM>
        41. How can I make a form with custom buttons?
              Rather than a normal submit button (<input type=”submit” …>), you can use the image input type (<input type=”image” …>). The image input type specifies a graphical submit button that functions like a server-side image map.      
            <input type=”image” name=”Send” alt=”Send” value=”Send” src=”send-button.gif”>      
        42. How do I specify page breaks in HTML?
               There is no way in standard HTML to specify where page breaks will occur when printing a page. HTML was designed to be a device-independent structural definition language, and page breaks depend on things like the fonts and paper size that the person viewing the page is using.
        43. Which should I use, &entityname; or &#number; ?
              In HTML, characters can be represented in three ways:

            1. a properly coded character, in the encoding specified by the “charset” attribute of the “Content-type:” header;
            2. a character entity (&entityname;), from the appropriate HTML specification (HTML 2.0/3.2, HTML 4, etc.);
            3. a numeric character reference (&#number;) that specifies the Unicode reference of the desired character. We recommend using decimal references; hexadecimal references are less widely supported.

        44. How do I remove the border around frames?
              Removing the border around frames involves both not drawing the frame borders and eliminating the space between the frames. The most widely supported way to display borderless frames is <FRAMESET … BORDER=0 FRAMEBORDER=0 FRAMESPACING=0>.
              Note that these attributes are proprietary and not part of the HTML 4.01 specifications. (HTML 4.01 does define the FRAMEBORDER attribute for the FRAME element, but not for the FRAMESET element.) Also, removing the border around a frame makes it difficult to resize it, as this border is also used in most GUIs to change the size of the frame.
        45. How can I specify background images?
              With HTML, you can suggest a background image with the BACKGROUND attribute of the BODY element. Here is an example:
              <body background=”imagefile.gif” bgcolor=”#ffffff” text=”#000000″ link=”#0000ff” vlink=”#800080″ alink=”#000080″>
              If you specify a background image, you should also specify text, link, and background colors since the reader’s default colors may not provide adequate contrast against your background image. The background color may be used by those not using your background image. Authors should not rely on the specified background image since browsers allow their users to disable image loading or to override document-specified backgrounds.
        46. Is it possible to make the HTML source not viewable?
              In short, there is no real method or script for making standard HTML source code not viewable. You may consider doing any of the below if they are concerned about your source code.

            1. Create the web page in Macromedia Flash or a similar program. The visitor would need to download the Macromedia Flash plug-in and would be unable to view the source code for the flash applet.
            2. There are various scripts that will disable the right click feature, preventing the user from saving images or viewing the source. However, this will not protect the source code of your page. For example, Internet Explorer users may still click “View” and “Source” to view the source code of the page, or a user could disable scripts and images can be saved by simply saving the web page to the hard drive.
            3. There are several programs that will help scramble your code, making it difficult (not impossible) to read. Again, this is not going to prevent someone from viewing your code.
        47. How do I make a thumbnail for my image(s)?
              Thumbnails are very useful, but they take a little bit of time to make. All you need is a graphics editing program that has functions to resize an image (sometimes it’s under a function called image attributes). Be advised–when you have made a thumbnail, you will need to save it as something different than the original. Also, you will generally want to link to the larger graphic when you are done.
              <a href=”taco.jpg”><img src=”tacot.jpg” width=100 height=25 border=0 alt=”click for larger taco”></a>
        48. What is the difference between the HTML form methods GET and POST?
              The method parameter specifies which method the client is using to send information to the WEB server. The method determines which parameter you will find the CGI request data in:

            * POST – post_args
            * GET – http_search_args
        49. How do I put sounds for older versions of Internet Explorer?
              For older versions of Internet Explorer, this technique was used <BG SOUND=”sound.ext”>.
        50. How to transferring user to new web page automatically?
              You will need to use the below meta tag.
            <META HTTP-EQUIV=”Refresh” CONTENT=”2″; URL=”http://www.yourname.com”>
                Placing the above tag in your <HEAD></HEAD> will load yousite.com in 2 seconds.
                Changing the 2 value on CONTENT=”2″ to another value will increase or decrease the delay until loading the new page.
        51. I’m trying to `include’ a HTML document in another document…Is there a way to do this?
              SGML already provides the standard way to do this, using an entry in the DocType Declaration for a file:

            <!doctype html public “-//IETF//DTD HTML 3.0//EN” [
            <!entity foo system “bar.html”>
            ]>
            …
            and then later when you want to include the file
            …
            &foo;
        52. My page looks good on one browser, but not on another.
              There are slight differences between browsers, such as Netscape Navigator and Microsoft Internet Explorer, in areas such as page margins. The only real answer is to use standard HTML tags whenever possible, and view your pages in multiple browsers to see how they look.
        53. How do I make sure my framed documents are displayed inside their frameset?
              If the reader’s browser has JavaScript support enabled, the following script will restore the frameset:

            <SCRIPT TYPE=”text/javascript”>
            if (parent.location.href == self.location.href) {
            if (window.location.href.replace)
            window.location.replace(‘frameset.html’);
            else
            // causes problems with back button, but works
            window.location.href = ‘frameset.html’;
            }
            </SCRIPT>
            A more universal approach is a “restore frames” link:

            <A HREF=”frameset.html” TARGET=”_top”>Restore Frames
        54. How do I update two frames at once?
              There are two basic techniques for updating multiple frames with a single link: The HTML-based technique links to a new frameset document that specifies the new combination of frames. The JavaScript-based solution uses the onClick attribute of the link to update the additional frame (or frames).

            The HTML-based technique can link to a new frameset document with the TARGET=”_top” attribute (replacing the entire frameset). However, there is an alternative if the frames to be updated are part of a nested frameset. In the initial frameset document, use a secondary frameset document to define the nested frameset. For example:

            <frameset cols=”*,3*”>
            <frame src=”contents.html” name=”Contents”>
            <frame src=”frameset2.html” name=”Display”>
            <noframes>
            <!– Alternative non-framed version –>
            </body></noframes>   
            </frameset>

            A link can now use the TARGET=”Display” attribute to replace simultaneously all the frames defined by the frameset2.html document.
            The JavaScript-based solution uses the onClick attribute of the link to perform the secondary update. For example:
            <a href=”URL1″ target=”Frame1″ onClick=”top.Frame2.location=’URL2′;”>Update frames
            The link will update Frame1 with URL1 normally. If the reader’s browser supports JavaScript (and has it enabled), then Frame2 will also be updated (with URL2).     
        55. Can I have two or more Submit buttons in the same form?
              Yes. This is part of HTML 2.0 Forms support (some early browsers did not support it, but browser coverage is now excellent).
            The submit buttons must have a NAME attribute. The optional VALUE attribute can be used to specify different text for the different submit buttons.
            To determine which submit button was used, you need to use different values for the NAME and/or VALUE attributes. Browsers will send to the server the name=value pair of the submit button that was used. Here is an example:

            <input type=”submit” name=”join” value=”I want to join now”>
            <input type=”submit” name=”info” value=”Please send full details”>

        56. How do I make a link or form in one frame update another frame?
              in the frameset document (the HTML document containing the <frameset> <frame> tags), make sure to name the individual frames using the NAME attribute. The following example creates a top frame named “navigation” and a bottom frame named “content”:

            <frameset rows=”*,3*”>
                <frame name=”navigation” src=”navigation.html”>
                <frame name=”content” src=”content.html”>
                <noframes><body>
                <!– Alternative non-framed version –>
                </body></noframes>
            </frameset>

            Then, in the document with the link, use the TARGET attribute to specify which frame should be used to display the link. (The value of the TARGET attribute should match the value of the target frame’s NAME attribute.) For example:

            <a target=”content” href=…>
            To target a form submission, use the TARGET attribute of the FORM element, like this:

            <form target=”content” action=…>
            Note that when forms are processed entirely by JavaScript, the target frame must be specified in the JavaScript. The value of the TARGET attribute is irrelevant.
            Normally, the default target frame is the current frame (“_self”). To change the default target for every link/form on the page, use the TARGET attribute of the BASE element, like this: <base target=”content”>
        57. When I try to upload my site, all my images are X’s. How do I get them to load correctly?
              They are a few reasons that this could happen. The most common are:

            1. You’re attempting to use a .bmp or .tif or other non-supported file format. You can only use .gif and .jpg on the web. You must convert files that are not .gif or .jpg into a .gif or .jpg with your image/graphics program.
            2. You’ve forgotten to upload the graphic files. Double-Check.
            3. You’ve incorrectly linked to the images. When you are starting out, try just using the file name in the <img> tag. If you have cat.jpg, use
            img src=”cat.jpg”>.
            4. Image file names are case-sensitive. If your file is called CaT.JpG, you cannot type cat.jpg, you must type CaT.JpG exactly in the src.
            5. If all of the above fail, re-upload the image in BINARY mode. You may have accidentally uploaded the image in ASCII mode.     
        58. Why does the browser show my plain HTML source?
               If Microsoft Internet Explorer displays your document normally, but other browsers display your plain HTML source, then most likely your web server is sending the document with the MIME type “text/plain”. Your web server needs to be configured to send that filename with the MIME type “text/html”. Often, using the filename extension “.html” or “.htm” is all that is necessary. If you are seeing this behavior while viewing your HTML documents on your local Windows filesystem, then your text editor may have added a “.txt” filename extension automatically. You should rename filename.html.txt to filename.html so that Windows will treat the file as an HTML document.
        59. How can I display an image on my page?
              Use an IMG element. The SRC attribute specifies the location of the image. The ALT attribute provides alternate text for those not loading images. For example:

            <img src=”logo.gif” alt=”ACME Products”>
        60. Why do my links open new windows rather than update an existing frame?
              If there is no existing frame with the name you used for the TARGET attribute, then a new browser window will be opened, and this window will be assigned the name you used. Furthermore, TARGET=”_blank” will open a new, unnamed browser window.
            In HTML 4, the TARGET attribute value is case-insensitive, so that abc and ABC both refer to the same frame/window, and _top and _TOP both have the same meaning. However, most browsers treat the TARGET attribute value as case-sensitive and do not recognize ABC as being the same as abc, or _TOP as having the special meaning of _top.
            Also, some browsers include a security feature that prevents documents from being hijacked by third-party framesets. In these browsers, if a document’s link targets a frame defined by a frameset document that is located on a different server than the document itself, then the link opens in a new window instead.
         61. How do I make a frame with a vertical scrollbar but without a horizontal scrollbar?
              The only way to have a frame with a vertical scrollbar but without a horizontal scrollbar is to define the frame with SCROLLING=”auto” (the default), and to have content that does not require horizontal scrolling. There is no way to specify that a frame should have one scrollbar but not the other. Using SCROLLING=”yes” will force scrollbars in both directions (even when they aren’t needed), and using SCROLLING=”no” will inhibit all scrollbars (even when scrolling is necessary to access the frame’s content). There are no other values for the SCROLLING attribute.
        62. Are there any problems with using frames?
              The fundamental problem with the design of frames is that framesets create states in the browser that are not addressable. Once any of the frames within a frameset changes from its default content, there is no longer a way to address the current state of the frameset. It is difficult to bookmark – and impossible to link or index – such a frameset state. It is impossible to reference such a frameset state in other media. When the sub-documents of such a frameset state are accessed directly, they appear without the context of the surrounding frameset. Basic browser functions (e.g., printing, moving forwards/backwards in the browser’s history) behave differently with framesets. Also, browsers cannot identify which frame should have focus, which affects scrolling, searching, and the use of keyboard shortcuts in general.
              Furthermore, frames focus on layout rather than on information structure, and many authors of framed sites neglect to provide useful alternative content in the NOFRAMES element. Both of these factors cause accessibility problems for browsers that differ significantly from the author’s expectations and for search engines.
        63. How do I open a link into a new window?
              This feature is a byproduct of frames (In many opinions, the only good things frames did for web design). On any HTML page, you can just add target=”_blank” to your link syntax. e.g. yoursite.com