Wednesday, December 10, 2008

make autorun cd

If you want to make a autorun file for that CD you are ready to burn

here is a small trick for u


1) You open notepad
2) now you writ: [autorun]
OPEN=INSTALL\aaa.EXE
ICON=INSTALL\aaa.EXE

Now save it but not as a .txt file but as a aaa.inf file.

But remember! And you also need to rember that it is not all of the setup files there are called '.exe but some are called '.msi

3) Now burn your CD with the autorun aaa.inf file included.

4) Now set the CD in you CD drive and wait for the autorun to begin or if nothing happens just double-click on the CD drive in "This Computer"

Tuesday, November 18, 2008

AJAX features

AJAX is a mixture of several popular technologies put together to build the next generation of web applications, which are more responsive, more interactive and behave like their desktop counterparts. MX AJAX Toolbox brings the benefits of AJAX to Dreamweaver.
Asynchronous loading of content without page refresh
With MX AJAX Toolbox, an AJAX site has one or more master pages. The building blocks of any master page are the AJAX panels – regions of content that users can place anywhere in their site and that change their state independently from the rest of the page. Each AJAX panel has one or more states – the actual files included in the website when an AJAX request that calls them is performed. AJAX Panels can be reused across multiple master pages, in order to reduce development time. For instance, you can reuse a menu panel in all your site pages, without having to rebuild it each time.




When AJAX links are clicked within a site, only the targeted panel state is loaded, independently and asynchronously, without refreshing the whole page.
Working with AJAX panels will appear very familiar to developers, since the approach is similar to using editable regions in Dreamweaver templates, or using master pages in Microsoft Visual Studio.
Increased interactivity and responsiveness
With MX AJAX Toolbox, developers can build Rich Internet Applications (RIA) that interact with site visitors, offering them a unique web experience. Visitors can continue using the website while parts of it load separately and asynchronously. They will enjoy the increased interactivity that comes with a suite of AJAX controls and widgets included in the toolbox. AJAX websites will render fast on their first load, while incrementally loading necessary JavaScript files in the background. This means users on slow connections (such as dial-up) will be able to see and interact with the website immediately after they access it.
Reduced loading time and server traffic
Since only parts of the site are loaded at one time (states of the AJAX panels), the loading time is obviously shorter than if the whole page refreshed. Server traffic is considerably reduced. Because only parts of the page content are sent, the bandwidth usage decreases and websites will appear to load seamlessly.

Monday, November 10, 2008

The Purpose of the Marker Interface

One of the "clean" features of the Java programming language is that it mandates a separation between interfaces (pure behavior) and classes (state and behavior). Interfaces are used in Java to specify the behavior of derived classes.

Often you will come across interfaces in Java that have no behavior. In other words, they are just empty interface definitions. These are known as marker interfaces. Some examples of marker interfaces in the Java API include:


- java,lang.Cloneable
- java,io.Serializable
- java.util.EventListener



Marker interfaces are also called "tag" interfaces since they tag all the derived classes into a category based on their purpose. For example, all classes that implement the Cloneable interface can be cloned (i.e., the clone() method can be called on them). The Java compiler checks to make sure that if the clone() method is called on a class and the class implements the Cloneable interface. For example, consider the following call to the clone() method on an object o:


SomeObject o = new SomeObject();
SomeObject ref = (SomeObject)(o.clone());


If the class SomeObject does not implement the interface Cloneable (and Cloneable is not implemented by any of the superclasses that SomeObject inherits from), the compiler will mark this line as an error. This is because the clone() method may only be called by objects of type "Cloneable." Hence, even though Cloneable is an empty interface, it serves an important purpose.

IO Operations - Reading a File

package com.test.corejava;

/**
*
* @author seetharam
*/
import java.io.*;

public class IOReading {

/**
* Fetch the entire contents of a text file, and return it in a String.
* This style of implementation does not throw Exceptions to the caller.
*
* @param aFile is a file which already exists and can be read.
*/
public static String getContents(File aFile) {
//...checks on aFile are elided
StringBuilder contents = new StringBuilder();

try {
//use buffering, reading one line at a time
//FileReader always assumes default encoding is OK!
BufferedReader input = new BufferedReader(new FileReader(aFile));
try {
String strLine = null; //not declared within while loop
/*
* readLine is a bit quirky :
* it returns the content of a line MINUS the newline.
* it returns null only for the END of the stream.
* it returns an empty String if two newlines appear in a row.
*/
while (( strLine = input.readLine()) != null){
contents.append(strLine);
contents.append(System.getProperty("line.separator"));
}

}
finally {
input.close();
}
}
catch (IOException ex){
ex.printStackTrace();
}

return contents.toString();
}
public static void main(String a[]){

File f= new File("c:/myfile.txt");
String str =getContents(f);
System.out.println(str);
}
}

idempotent request and non-idempotent request - in HttpServletResquest Header

Official definition from dictionary.com is "unchanged when multiplied by itself". In HTTP perspective, you can send idempotent requests multiple times without altering system state / data / resource.

Since get requests are meant to get required resource and not change anything, it's considered idempotent. Although technically it's feasible to implement your program in bad way that would alter the data even for get request.

Post request are usually implemented to achieve server side action that would alter data. For example, providing your credit card and submitting purchase button. If you submit the button twice, chances are that you might pay twice! Since post requests are non-idempotent, one should take extra care in implementing it such that duplicate request doesn't go through.

mutable and immutable objects in java

As per the dictionary, mutable objects are objects which can change their values and immutable objects are objects which cannot have their values changed.

>>java.lang.String is an example of an immutable object in Java
whereas
>>java.lang.StringBuffer is a mutable object.

Sunday, November 9, 2008

response.sendRedirect-RequestDispatcher.forward-PageContext.forward

Q. What is the difference between response.sendRedirect(), RequestDispatcher.forward(), and PageContext.forward()?

In a nutshell, RequestDispatcher.forward() works on the server and response.sendRedirect() works on the browser. When you invoke RequestDispatcher.forward(), the servlet engine transfers control of this HTTP request internally from your current servlet or JSP to another servlet or JSP or static file. When you invoke response.sendRedirect(), this sends an HTTP response to the browser to make another request at a different URL.

RequestDispatcher.forward()
and PageContext.forward() are effectively the same. PageContext.forward() is a helper method that calls the RequestDispatcher method.