This article describes how to properly redirect a  web page using an HTTP 301 status code and Location header.  The 301  status code is used to indicate that a page has permanently moved.  Multiple techniques are presented with recommendations.

  

In order to redirect an out-of-print web page to another location,  return the HTTP 301 status code and a location header in the HTTP  response of the deprecated web page.  The HTTP 301 response code will  tell user-agents that the location has permanently moved.  This is  particularly useful for search engines like Google, which will carry  over page rank to the new page if this status code is seen.   If you do  not need to indicate permanent displacement, you can accomplish  redirection by setting a Location header in PHP or using  Response.Redirect in ASP.  The location header does the actual redirection to the new location, and can be used by itself.

  

HTTP headers are sent for every web page.  If you want to see what HTTP headers look like for a particular page, visit Rex Swain's HTTP Viewer. For advanced users, I would recommend you download the Firefox web browser and install Chris Pederick's Web Developer Extensions.  Then, use the Information->View Response Headers  function.  In scripts, HTTP headers must be sent before sending any  page content, including white space, or else an error will result.  

Tags:

Overload and Override

cnttbachkhoa , 2010/08/03 23:22 , Programming , Comments (1) , Reads (2784) , Via Original
Q. What does abstract mean?
abstract means, hiding something. Here, hiding the complexity from user.

Q. Difference between an abstract class and an interface?

Abstract class is very similar to a general class only being difference  is, we can instantiate it directly. We can use a abstract class only to  inherit.

Interface will have only method signatures and final member variables and  not the implementation. We can create an instance for an interface.

Q. Difference between overloading a method and overriding a method?

In method overloading, we will have same method name with each being accepting different parameters as input.

In overriding, the function signature remains same. But, the implementation changes. It can be seen in inheritance.

The rules for overriding a method are as follows:

  • Theargument list must exactly matchthat of the overridden method.
  • Thereturn type must exactly matchthat of the overridden method.
  • Theaccesslevelmustnotbemorerestrictivethanthatoftheoverriddenmethod.
  • Theaccess level can be less restrictivethan that of the overridden method.
  • The overriding methodmust not throw new or broader checked exceptionsthan those declared by the overridden method.
  • The overriding methodcan throw narrower or fewer exceptions. Just  becausean overridden method “takes risks” doesn’t mean that the  overriding subclass’exception takes the same risks. Bottom line: An  overriding method doesn’thave to declare any exceptions that it will  never throw, regardless of whatthe overridden method declares.
  • Youcannot override a method markedfinal.
  • If a method can’t be inherited, you cannot override it.

The rules for Overloaded method are as follows:

  • Overloaded methodsmustchange the argument list.
  • Overloaded methodscanchange the return type.
  • Overloaded methodscanchange the access modifier.
  • Overloaded methodscandeclare new or broader checked exceptions.
  • A methodcanbe overloaded in the same class or in a subclass.

Overriding is the concept of runtime polymorphism while,
Overloading is the concept of compile time polymorphism...

Ajax Fundamental

cnttbachkhoa , 2009/02/17 09:29 , Programming , Comments (0) , Reads (2044) , Via Original
1. Ajax object
    Firefox, Opera, Safari: XMLHTTPRequest
    IE: Msxml2.XMLHTTP (ActiveXObject)

2. Properties
    onreadystatechange
    readyState
        0: the req is not initialized
        1: the req has been set up
        2: the req has been sent
        3: the req is in process
        4: the req is complete
    responseText: the data sent back from server

3. Sending a request
    Ajax uses open() and send() to send request to server. The open() takes 3 arguments:
        - which method to use (GET or POST)
        - URL of server-side script
        - specifies that the request should be handled asynchronous (true or false)

Any thing new is posted at the comment
Pages: 1/1 First page 1 Final page [ View by Articles | List ]