Wednesday, July 30, 2008

Tips for Better Life from YOGA




 

 1. Take a 10-30 minutes walk every day. And while you walk, smile.
2. Sit in silence for at least 10 minutes each day.
3. Sleep for 7 hours.
4. Live with the 3 E's -- Energy, Enthusiasm, and Empathy.
5. Play more games.
6. Read more books than you did in 2007.
7. Make time to practice meditation, yoga, and prayer. They provide us with daily fuel for our busy lives.
8. Spend time with people over the age of 70 & under the age of 6.
9. Dream more while you are awake.
10. Eat more foods that grow on trees and plants and eat less food that is manufactured in plants.
11. Drink plenty of water.
12. Try to make at least three people smile each day.
13. Don't waste your precious energy on gossip.
14. Forget issues of the past. Don't remind your partner with his/her mistakes of the past. That will ruin your present happiness.
15. Don't have negative thoughts or things you cannot control. Instead invest your energy in the positive present moment.
16. Realize that life is a school and you are here to learn. Problems are simply part of the curriculum that appear and fade away like algebra class but the lessons you learn will last a lifetime.
17. Eat breakfast like a king, lunch like a prince and dinner like a beggar.
18.
Smile and laugh more.
19.
Life is too short to waste time hating anyone. Don't hate others.
20.
Don't take yourself so seriously. No one else does.
21.
You don't have to win every argument. Agree to disagree.
22. Make peace with your past so it won't spoil the present.
23. Don't compare your life to others'. You have no idea what their journey is all about. Don't compare your partner with others.
24.
No one is in charge of your happiness except you.
25. Forgive everyone for everything.
26.. What other people think of you is none of your business.
27. However good or bad a situation is, it will change.
28.
Your job won't take care of you when you are sick. Your friends will. Stay in touch.
29. Get rid of anything that isn't useful, beautiful or joyful.
30. Envy is a waste of time. You already have all you need.
31. The best is yet to come.
32. No matter how you feel, get up, dress up and show up.
33. Do the right thing!
34.
Call your family often.
35. Your inner most is always happy. So be happy.
36. Each day give something good to others.
37. Don't over do. Keep your limits.


 




Monday, July 28, 2008

Sql

SELECT * FROM table1 g WHERE g.converted_ip NOT IN (SELECT ifnull(sl.ip_address,10) FROM tabl2 sl)

Monday, July 21, 2008

CSS display Property

CSS display Property

We are mostly using the display property as the display:none and display:block.. This Property not only having the none and block.its has more usefull and effective values as below mention.. check it out...

Definition

The display property sets how/if an element is displayed.

Inherited: No


JavaScript Syntax

CSS properties can also be dynamically changed with a JavaScript.

Scripting Syntax: object.style.display="none"

In our HTML DOM tutorial you can find more details about the display property.


Example

p
{
display: block
}

li
{
display: list-item
}

table
{
display: table
}

td, th
{
display: table-cell
}

Possible Values

Value Description
none The element will not be displayed
block The element will be displayed as a block-level element, with a line break before and after the element
inline Default. The element will be displayed as an inline element, with no line break before or after the element
list-item The element will be displayed as a list
run-in The element will be displayed as block-level or inline element depending on context
compact The element will be displayed as block-level or inline element depending on context
marker  
table The element will be displayed as a block table (like <table>), with a line break before and after the table
inline-table The element will be displayed as an inline table (like <table>), with no line break before or after the table
table-row-group The element will be displayed as a group of one or more rows (like <tbody>)
table-header-group The element will be displayed as a group of one or more rows (like <thead>)
table-footer-group The element will be displayed as a group of one or more rows (like <tfoot>)
table-row The element will be displayed as a table row (like <tr>)
table-column-group The element will be displayed as a group of one or more columns (like <colgroup>)
table-column The element will be displayed as a column of cells (like <col>)
table-cell The element will be displayed as a table cell (like <td> and <th>)
table-caption The element will be displayed as a table caption (like <caption>)

Wednesday, July 16, 2008

CSS Background-image

CSS Background-image

Background-image is the property of CSS that inserts a background image.

To add background image, you first have to have an image that you would like to appear on your page. If you have chosen an image from the net, you just have to download it and save it to your computer. You can do this by right clicking on the image. A menu will appear, click on "save image as". Once you have saved it to your computer, you can then insert the image as your background image for your web page. To do this, place the background image property to the element and include the location of the image.

body {
background-color: #FFFFFF
background-image: url (location of the image);
}

h1 {
color: #FF0000;
background-color: #000000;
}

If the image you want to attach is coming from the internet, you just type the full address of the file.

Repeated background image

When you post an image it will automatically be displayed to cover the entire screen. To control this image from appearing in the entire screen, you can use the background repeat property.

  • To make the image horizontally repeated, use the "repeat-x" value next to the property background-repeat then separate them with colon.
  • To make the image vertically repeated, use the "repeat-y" after the property background-repeat and separate them with colon.
  • If you want to make the image horizontally and vertically repeated, just use the "repeat" value after the property background-repeat and separate them with colon.
  • If you do not want an image to be repeated, just put the value, "no-repeat" after the property background-repeat and separate them with colon.

Here is the code if you want to avoid a repetition of an image:

body {
background-color: #FFCC66;
background-image: url("FILE or url NAME");
background-repeat: no-repeat;
}

h1 {
color: #990000;
background-color: #FC9804;
}

Lock background image

"background-attachment" commands a background photo whether you want it fixed or scroll along with the text element.

When you use fixed background image, as the word suggests, will make the image still and will not move with the containing element when a visitor scrolls the page. The unlocked background image, on the other hand, will allow scrolling of the image along with the texts.

There are two different values for background-attachment:

  • Scroll - this is placed after the "background-attachment" property with a colon between to separate them. Ex. Background-attachment:scroll Using this value will allow the image to scroll with the page-unlocked.
  • Fixed - this is placed after the "background-attachment" property with a colon between to separate them. Ex. Background-attachment:fixed Using this value will make the image locked.
body {
background-color: #FFCC66;
background-image: url("file or url name");
background-repeat: no-repeat;
background-attachment: fixed;
}

h1 {
color: #990000;
background-color: #FC9804;
}

Placing background image

Generally, when you attach a background image, it will automatically be placed at the top left corner of the screen. To control this, we use the "background-position" to change the default positioning giving you the control where you want the image be placed.

You can set the values of the property "background-position" in various ways. These ways, however, are formatted as a set of coordinates. Coordinates can be input as percentages of browser windows, fixed units or you can just opt to use the basic words, top, bottom, center, left and right.

Example values:

  • background-position: 2cm 2cm - this value positions the image 2 centimeter from the left and 2 centimeter down the page.
  • background-position: 50% 25% - this value positions the image centrally and one fourth down the page.
  • background-position: top right – this value positions the image at the top-right corner of the page.

Compiling

Background property allows you to compress several properties for you to be able to write your style sheet in a shorter way, this making it easier to read.

background-color: #FFCC66;
background-image: url("file or url name");
background-repeat: no-repeat;
background-attachment: fixed;
background-position: right bottom;

Using "background" will shorten your style command:

background: #FFCC66 url("file or url name") no-repeat fixed right bottom;

It will take you five lines to get the style that you want. If you use the "background" property, everything is incorporated in one line.

You have to make certain that the following order is followed:

[background-color] [background-image] [background-repeat] [background-attachment] [background-position]

When you leave certain properties blank, they will be set automatically to their default values.

Tuesday, July 15, 2008

replace single command

find /sitename/foldername/ -name  "*.html" -exec sed 's/oldtext/newtext/' {} \;

Best Firefox Addons for Designers

10 Best Firefox Addons for Designers


These 10 essential Firefox addons will make your life as a graphic and web designer much easier! The Firefox addons are extremely easy to install and you will be notified when new versions of the addons are available. I have hand picked all of these add ons and without further ado here are the 12 best Firefox addons for graphic designers!

ColorZilla 1.0

ColorZilla is an advanced eyedropper, color picker and measuring tool.

Download ColorZilla

Window Resizer

The Window Resizer addon allows you to resize your browser to common resolution sizes allowing you to view website designs in a variety of popular browsing dimensions.

Download Window Resizer

Web Developer

The Firefox Web Developer addons is one of the most popular addons for web designers. It has a variety off essential tools that allow you to code quality websites and troubleshoot problems easily.

Download Web Developer

Palette Grabber

Palette Grabber is a nifty little addon that creates a color palette for Photoshop, Paint Shop Pro, GIMP, Flash, Fireworks, or OS X based on the current page you are viewing in your browser.

Download Grabber

GridFox

GridFox is a great Firefox extension that allows you to overlay a customizable grid on any website allowing you to make sure the grid you designer in your layout translate correctly to the web.

Download GridFox

FireShot

FireShot is a cool extension that allows you to take screenshots of your web pages and also has a set of built in annotation tools that allow you to add graphics and notes.

Download FireShot

FoxyTunes

FoxyTunes is a kick butt addon for anyone who listens to music while they design. It allows you to control almost any media player from your browser. You can also find lyrics, covers and so on.

Download FoxyTunes

MeasureIt

MeasureIt allows you to overlay a ruler on a browser page so you can verify width, height and alignment of page elements.

Download MeasureIt

IE Tab

IE Tab is a useful tool for designers who need to check to see if their website looks good in Internet Explorer. A simple click will switch you back to Firefox.

Download IE Tab

FireFTP

FireFTP is a free, secure, browser based FTP client that allows you to easily access your server via Firefox instead of having to launch a separate program.

Download FireFTP


Monday, July 14, 2008

7lakesranch.com - Seven Lakes Ranch

Seven Lakes is one of the premier contiguous pristine ranches with water in all of Colorado, and represents the best of the American West. Pro golfer, Greg Norman, assembled Seven Lakes from several properties including the Seven Lakes portion of 300 acres, the 3,009 acre Pollard Ranch and the Dry Creek Ranch of 8,183 acres. An additional 80 acres are leased on a neighboring property to provide additional employee housing for staff.

More Info:
http://www.7lakesranch.com
http://www.sevenlakesranch.com/

Sunday, July 13, 2008

Image Magic in Linux convert pdf to jpj convert jpg to gif everythink is working fine

ImageMagick: A graphics wizard for the command line

By Shashank Sharma on March 30, 2005 (9:00:00 AM)

Share    Print    Comments   

For many a GNU/Linux user, the command line is supreme. But can you manipulate images without switching to the GUI and using the resource-hungry GIMP? You can, using the fantastic ImageMagick suite.

With ImageMagick (IM) you can crop your image, change its shades and colors, and add captions, among other operations.

Basic image manipulations

IM packs a nifty utility, convert, that can handle this. In addition to changing the size of an image, convert can convert it from one format to another (IM supports almost 90 different image formats), rotate an image, and add effects to an image.

To convert one image into a thumbnail for my blog, I ran the command convert -sample 80x60 big.jpg thumb.jpg. Here, big.jpg is the input image and thumb.jpg is the output image, which is to be 80x60 pixels. -sample tells IM to scale the image using pixel sampling. You can also specify percentages instead of pixels by using syntax such as convert -sample 30%x30% big.jpg thumb.jpg. ImageMagick maintains the aspect ratio of an image, which results in symmetric images.

Convert can also rotate or flip an image:

convert -rotate 90 image_0001.tiff output.tiff

The -rotate switch, by default, rotates the image clockwise by the number of degrees specified. If you wish to rotate the image counter-clockwise, use a negative number.

The -flip switch produces an upside-down image of the original while the -flop switch turns the image on a vertical axis.

convert -flip me.jpg me_flipped.jpg
convert -flop me.jpg me_flopped.jpg

You can change a JPG file to PNG with a command such as convert one.jpg newone.png. If you have a huge collection of images to convert, use IM's mogrify utility with the -format switch:

mogrify -format tiff *.png

You can also use mogrify to create same-sized thumbnails of multiple images:

mogrify -sample 80x60 *.jpg

Be careful, however -- this command will overwrite your existing images! If you wish to preserve the originals, you have to use a different format for the thumbnails. For instance, this command would make PNG thumbnails of all your JPG files:

mogrify -format png -sample 15%x15% *.jpg

Adding other effects to an image

Among its many options, convert offers artistic effects to enhance your images, including charcoal, colorize, implode, solarize, and more. I find the charcoal effect really cool; it looks like an artist's initial draft, with no colors, just a sketch made with charcoal. To apply the effect, use a command such as:

convert -charcoal 1 me.png coal.png

The numeric value specified refers to the amount of charcoal you want in the image.

Playing with PDFs

Now imagine you're traveling, and you want to share some photos with your friends. Your mail client may allow large attachments, but how many attachments do you really want to send? The convert utility lets you to put all your images into one neatly organized PDF file, one image per page, with a command such as:

convert *jpg allinone.pdf

Convert also lets you extract all the images from a PDF file:

convert allinone.pdf image_%04d.tiff

The %d operator is a format specifier, much like the printf format specifier in C language. %d means a decimal number, and the 0 that follows it means you want leading zeroes in the file name. The 4 after the 0 specifies how many digits the total value should use. So, %04d means that you want leading zeroes and the total number of digits should be four, thus creating files named image_0001.tiff, image_0002.tiff, and so on.

You can also run the command without the %d operator; convert will automatically append unique numbers to the filename.

convert allinone.pdf img.png
ls img*
img.png.0 img.png.1 img.png.2

Adding text

If you're a prolific digital photographer, how do you distinguish one set of images from another? One good way is to put a tag on all the images -- a word or two describing where and when they were snapped.

I labeled a few picture from a recent trip to Bangalore using convert:

convert -font helvetica -fill yellow -pointsize 25 \
> -draw 'text 100,250 "Nandi Hills, Bangalore"' \
> image.png text.png

This command specifies the font, color, and size of the text, its location (specified by the column and row in pixels where text should begin), and the actual text itself. You can add text at two different locations in different colors like so:

convert -font helvetica -fill yellow -pointsize 36 \
> -draw 'text 100,250 "Nandi Hills, Bangalore"' \
> -fill green -draw 'text 150,300 Beautiful' \
> image.png text.png

Notice the variations in quotes. Use double quotes when you need to draw more than one word on your image. If you have only one word to write, you don't need to include it within double quotes.

You can specify different font sizes for the two texts, and, if the font you wish to use if it is in a non-standard directory, you can include the path to the font in the command as well.

Frames for your images

Frames and borders help enhance images and make them more appealing. To add a simple solid-colored frame around your image, use a command such as:

convert -bordercolor blue -border 5x5 pic001.png border001.png

In the size specification (5x5), the horizontal size comes first and then the vertical. You can't make a frame larger than the picture, and you must specify the border color. You can check the complete list of colors IM supports for border, text, and backgrounds with the command convert -list color.

I like frames with raised and lowered borders. To create a raised border, use the -raise option along with the dimensions:

convert -raise 5x5 image.png raised.png

To create a lowered border, replace the hyphen before the raise argument with a plus-sign.

For more complex frames with padded borders, you can use the -mattecolor and the -frame options in place of -bordercolor and -border.

Conclusion

Being a command-line tool has its advantages. You can make all of the above mentioned modifications through scripts written using programming languages such as Perl, Python, and C/C++. ImageMagick also provides interfaces for various languages -- PerlMagick (Perl), Magick++ (C++), PythonMagick (Python), MagickWand (PHP), RMagcik (Ruby), TclMagick (Tcl) and JMagick (Java).

While all we've talked about has been command-line operations, IM also has a GUI which you can invoke with the command display.

Shashank Sharma is a computer science student who loves to write about free and open source software for new users.

Shashank Sharma specializes in writing about free and open source software for new users and moderates the Linux.com forum boards. He is the coauthor of Beginning Fedora, published by Apress.

Friday, July 11, 2008

New Object Oriented Features in PHP5

New Object Oriented Features

The new object oriented features are too numerous to give a detailed description in this section. The object oriented language chapter goes over each feature in detail.

The following is a list of the main new features:

1. public/private/protected access modifiers for methods and properties

Allows the use of common OO access modifiers to control access to methods and properties.

class MyClass {
    private
$id = 18;

    public function
getId() {
        return
$this->id;
    }
}

2. Unified constructor name __construct()

Instead of the constructor being the name of the class, it should now be declared as __construct(), making it easier to shift classes inside class hierarchies.

class MyClass {
    function
__construct() {
        print
"Inside constructor";
    }
}

3. Object destructor support by defining a __destructor() method

Allows defining a destructor function that runs when an object is destroyed.

<?php

class MyClass {
    function
__destruct() {
        print
"Destroying object";
    }
}

?>

4. Interfaces

Gives the ability for a class to fulfill more than one is-a relationships. A class can inherit from one class only but may implement as many interfaces as it wants.

interface Display {
    function
display();
}

class
Circle implements Display {
    function
display() {
        print
"Displaying circle ";
    }
}

5. instanceof operator

Language level support for is-a relationship checking. The PHP 4 is_a() function is now deprecated.

if ($obj instance of Circle) {
    print
'$obj is a Circle';
}

6. final methods

The final keyword allows you to mark methods so that an inheriting class can't overload them.

class MyClass {
    final function
getBaseClassName() {
        return
__CLASS__;
    }
}

7. final classes

After declaring a class as final, it can't be inherited. The following example would error out:

final class FinalClass {
}

class
BogusClass extends FinalClass {
}

8. Explicit object cloning

In order to clone an object you have to use the clone keyword. You may declare a __clone() method which will be called during the clone process (after the properties have been copied from the original object).

class MyClass {
    function
__clone() {
        print
"Object is being cloned";
    }
}
$obj = new MyClass();
clone
$obj;

9. Class constants

Classes definitions can now include constant values, and are referenced using the class.

class MyClass {
    const
SUCCESS = "Success";
    const
FAILURE = "Failure";
}
print
MyClass::SUCCESS;

10. Static members

Classes definitions can now include static members (properties), accessible via the class. Common usage of static members is in the Singleton pattern.

class Singleton {
    static private
$instance = NULL;

    private function
__construct() {
    }

    static public function
getInstance() {
        if (
self::$instance == NULL) {
            
self::$instance = new Singleton();
        }
        return
self::$instance;
    }
}

11. Static methods

You can now define methods as static allowing them to be called from non-object context. Static methods don't define the $this variable as they aren't bound to any specific object.

<?php

class MyClass {
    static function
helloWorld() {
        print
"Hello, world";
    }
}
MyClass::helloWorld();

?>

12. abstract classes

A class may be declared as abstract so as to prevent it from being instantiated. However, you may inherit from an abstract class.

abstract class MyBaseClass {
    function
display() {
        print
"Default display routine being called";
    }
}

13. abstract methods

A method may be declared as abstract, thereby deferring its definition to an inheriting class. A class that includes abstract methods must be declared as abstract.

abstract class MyBaseClass {
    
abstract function display();
}

14. Class type hints

Function declarations may include class type hints for their parameters. If the functions are called with an incorrect class type an error occurs.

function expectsMyClass(MyClass $obj) {

}

15. Support for dereferencing objects which are returned from methods.

In PHP 4, you could not directly dereference objects which are returned from methods. You would have to first assign the object to a dummy variable and then dereference it.
PHP 4:

$dummy = $obj->method();
$dummy->method2();

PHP 5:

$obj->method()->method2();

16. Iterators

PHP 5 allows both PHP classes and PHP extension classes to implement an Iterator interface. Once you implement this interface you will be able to iterate instances of the class by using the foreach() language construct.

$obj = new MyIteratorImplementation();
foreach (
$obj as $value) {
    print
"$value";
}

For a more complete example, please refer to the "Advanced OOP & Design Patterns" chapter.

17. __autoload()

Many developers writing object-oriented applications create one PHP source file per-class definition. One of the biggest annoyances is having to write a long list of needed includes at the beginning of each script (one for each class). In PHP 5, this is no longer necessary. You may define an __autoload() function which is automatically called in case you are trying to use a class which hasn't been defined yet. By calling this function the scripting engine is giving a last chance to load the class before PHP bails out with an error.

function __autoload($class_name) {
    include_once(
$class_name . "php");
}

$obj  = new MyClass1();
$obj2 = new MyClass2();

Other New Language Features

1. Exception handling

PHP 5 adds the ability for the well known try/throw/catch structured exception handling paradigm. You are only allowed to throw objects which inherit from the Exception class.

class SQLException extends Exception {
    public
$problem;
    function
__construct($problem) {
        
$this->problem = $problem;
    }
}

try {
    ...
    
throw new SQLException("Couldn't connect to database");
    ...
}
catch (SQLException $e) {
    print
"Caught an SQLException with problem $obj->problem";
}
catch (Exception $e) {
    print
"Caught unrecognized exception";
}

Currently for backwards compatibility purposes most internal functions do not throw exceptions. However, new extensions are making use of this capability and you can use it in your own source code. Also, similar to the already existing set_error_handler() you may use set_exception_handler() to catch an unhandled exception before the script terminates.

2. foreach with references

In PHP 4, you could not iterate through an array and modify its values. PHP 5 supports this by allowing you to mark the foreach() loop with the & (reference) sign, thus making any values you change affect the array you're iterating over.

foreach ($array as &$value) {
    if (
$value === "NULL") {
        
$value = NULL;
    }
}

3. default values for by-reference parameters

In PHP 4, default values could only be given to parameters which are passed by-value. Giving default values to by-reference parameters is now supported.

function my_func(&$arg = null) {
    if (
$arg === NULL) {
        print
'$arg is empty';
    }
}
my_func();

General PHP changes

XML and Web Services

Following the changes in the language, the XML updates in PHP 5 are most probably the most significant and exciting. The enhanced XML functionality in PHP 5 puts it on par with other web technologies in some areas and overtakes them in others.

The Foundation

XML support in PHP 4 was implemented using a variety of underlying XML libraries. SAX support was implemented using the old Expat library, XSLT was implemented using the Sablotron library (or using libxml2 via the DOM extension) and DOM was implemented using the more powerful libxml2 library by the GNOME project.

Using a variety of libraries did not make PHP 4 excel when it came to XML support. Maintenance was poor, new XML standards weren't always supported, performance wasn't as good as it could have been, and interoperability between the varies XML extensions did not exist.

In PHP 5, all XML extensions have been rewritten to use the superb libxml2 XML toolkit (http://www.xmlsoft.org/). It is a very feature rich, highly maintained and efficient implementation of the XML standards bringing the cutting edge of XML technology to PHP.
All the above mentioned extensions (SAX, DOM and XSLT) now use libxml2 including the new additional extensions SimpleXML and SOAP.

SAX

As mentioned, the new SAX implementation has switched from using Expat to libxml2. Although the new extension should be compatible there may be some small subtle differences. Developers who still want to work with the Expat library can do so by configuring and building PHP accordingly (not recommended).

DOM

Although DOM support in PHP 4 was also based on the libxml2 library, it was quite buggy, had memory leaks and the API in many cases was not W3C compliant. The DOM extension went through a thorough facelift for PHP 5. Not only was the extension mostly rewritten it is now also W3C complaint. For example, function names now use studlyCaps as described by the W3C standard making it easier for you to read general W3C documentation and implementing what you learnt, right away in PHP. In addition, the DOM extension now supports three kinds of schemas for XML validation, DTD, XML Schema and RelaxNG.

As a result of these changes PHP 4 code using DOM will not always run in PHP 5. However, in most cases adjusting the function names to the new standard will probably do the trick.

XSLT

In PHP 4, there were two extensions that supported XSL Transformations. The first was using the Sablotron extension and the second was using the XSLT support in the DOM extension. In PHP 5, a new XSL extension was written and, as mentioned, is based on the libxml2 extension. As in PHP 5, the XSL Transformation does not take the XSLT stylesheet as a parameter but depends on the DOM extension to load it, the stylesheet can be cached in memory and may be applied to many documents saving execution time

SimpleXML

Probably when looking back in a year or two it will be clear that SimpleXML has revolutionized the way PHP developers work with XML files. SimpleXML could really be called "XML for Dummies". Instead of having to deal with DOM or even worse SAX, SimpleXML represents your XML file as a native PHP object. You can read, write or iterate over your XML file with ease accessing elements and attributes.

Consider the following XML file:

<clients>
<
client>
    <
name>John Doe</name>
    <
account_number>87234838</account_number>
</
client>
<
client>
    <
name>Janet Smith</name>
    <
account_number>72384329</account_number>
</
client>
</
clients>

The following piece of code prints each client's name and account number:

$clients = simplexml_load_file('clients.xml');
foreach (
$clients->client as $client) {
    print
"$client->name has account number $client->account_number ";
}

It's obvious how simple SimpleXML really is.

And in case there is something advanced you need to do to your SimpleXML object which isn't supported in this lightweight extension, you can convert it to a DOM tree by calling dom_import_simplexml(), manipulate it in DOM and covert it back to SimpleXML using simplexml_import_dom(). Thanks to both extensions using the same underlying XML library switching between these two has been made a reality.

SOAP

Official native SOAP support in PHP 4 was lacking. The most commonly used SOAP implementation was PEAR's but as it was implemented entirely in PHP it could not perform as well as a built-in C extension. Other available C extensions never reached stability and wide adoption and, therefore, were not included in the main PHP 5 distribution.

SOAP support in PHP 5 was completely rewritten as a C extension and, although it was only completed at a very late stage in the beta process, it was incooperated into the default distribution due to its thorough implementation of most of the SOAP standard.

The following calls SomeFunction() defined in a WSDL file:

$client = new SoapClient("some.wsdl");
$client->SomeFunction($a, $b, $c);

New MySQLi (MySQL Improved) extension

For PHP 5, MySQL AB (http://www.mysql.com) has written a new MySQL extension that allows you to take full advantage of the new functionality in MySQL 4.1 and later. As opposed to the old MySQL extension, the new one gives you both a functional and an object oriented interface so that you can choose what you prefer. New features supported by this extension include prepared statements and variable binding, SSL and compressed connections, transaction control, replication support and more...

SQLite extension

Support for SQLite (http://www.sqlite.org) was first introduced in the PHP 4.3.x series. It is an embedded SQL library which does not require an SQL server and is very suitable for applications which don't require the scalability of SQL servers or if you're deploying at an ISP who doesn't give you access to an SQL server. Contrary to what its name implies SQLite is very feature rich and supports transactions, sub-selects, views and large DB files. It is mentioned here as a PHP 5 feature because it was introduced so late in the PHP 4 series and as it takes advantage of PHP 5 by providing an object oriented interface and supporting iterators.

Tidy extension

PHP 5 includes support for the useful Tidy (http://tidy.sf.net/) library. It allows PHP developers to parse, diagnose, clean and repair HTML documents. The Tidy extension supports both a functional and an object oriented interface, and it's API uses the PHP 5 exception mechanism.

Perl extension

Although not bundled in the default PHP 5 package, the Perl extension allows you to call Perl scripts, use Perl objects and use other Perl functionality natively from within PHP. This new extension sits within the PECL (PHP Extension Community Library) repository a http://pecl.php.net/package/perl.

Other New Things in PHP 5:

New memory manager

The Zend Engine features a new memory manager. The two main advantages are better support for multi-threaded environments (allocations don't need to do any mutual exclusion locks) and after each request freeing the allocated memory blocks is much more efficient. As this is an underlying infra-structure change you will not notice it directly as the end-user.

Dropped support for Windows 95

Running PHP on the Windows 95 platform is not supported anymore due to it not supporting functionality which PHP uses. As Microsoft has officially stopped supporting it over a year ago the PHP development community decided that this is a wise decision.

Thursday, July 10, 2008

copy different folder in to single folder

If you want to copy to all subdirectories (ie Child_Directory1,2,3,4 etc are the only subdirs), you can do the following:
Code:
find <parent directory> -type d -exec cp <parent directory>/<Filename1> {}/ \;
If you have other junk in the parent dir but a pattern that matches all subdirs (eg Child_Directory*), you can do this (bourne/ksh/bash):
Code:
for subdir in <parent directory>/<pattern> ; do cp <parent directory>/<Filename1> ${subdir}/ ; done

Tuesday, July 8, 2008

String Replace in Mysql

UPDATE table_name   SET value= REPLACE(value,"dev","content");


here Value refers the column name;
ex:
if column value has "test_something" its replace "live_something" if we write the query like this below


UPDATE table_name   SET value= REPLACE(value,"test_","live_");

Wednesday, July 2, 2008

Regular Expression Patterns Examples

http://regexlib.com/DisplayPatterns.aspx

How to Set Environment Variable in .htaacess

SetEnv SERVER_ADMIN webmaste@tstindia.com
in .htaccess file
 write php script

<?
echo "<pre>";
print_r($_SERVER);
echo "</pre>";
?>

output
Array
(
[DB_USER] => root
[DB_PASS] =>
[SERVER_ADMIN1] => webmaste@htaccesselite.com
[HTTP_HOST] => 192.168.2.61
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
[HTTP_ACCEPT] => text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
[HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5
[HTTP_ACCEPT_ENCODING] => gzip,deflate
[HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
[HTTP_KEEP_ALIVE] => 300
[HTTP_CONNECTION] => keep-alive
[HTTP_COOKIE] => poll=Voted; style=null; SMFCookie575=a%3A4%3A%7Bi%3A0%3Bs%3A1%3A%221%22%3Bi%3A1%3Bs%3A40%3A%22fad077d4e426943b32e462a38d114fbd337b3fc4%22%3Bi%3A2%3Bi%3A1399441877%3Bi%3A3%3Bi%3A0%3B%7D; __utmz=157290106.1207050145.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); __utma=157290106.1426920627.1207050145.1210759060.1214305026.6; WT_FPC=id=247bbbe7e73420e83c21209459354270:lv=1209460134764:ss=1209459354270; SMFCookie956=a%3A4%3A%7Bi%3A0%3Bs%3A1%3A%221%22%3Bi%3A1%3Bs%3A40%3A%22e53f2ea11a88993a04d0837b81ccb7c4c3699121%22%3Bi%3A2%3Bi%3A1399292921%3Bi%3A3%3Bi%3A0%3B%7D; PHPSESSID=e2536b9303b16fb31076d6a8b1b3ed1d; USRNIM=; PASSVIN=; REMIZ=; SESSd1d6ec85abd01c207c8a130a38579464=5bf10fdb87e2d001299a0acb37206889; 5cd4ea95eb59d31cfbbd83d1c02f8921=8b024a3149f666280b6f54fe21cbc471
[HTTP_CACHE_CONTROL] => max-age=0
[PATH] => C:\Perl\site\bin;C:\Perl\bin;E:\ruby\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Teleca Shared;E:\ruby\bin
[SystemRoot] => C:\WINDOWS
[COMSPEC] => C:\WINDOWS\system32\cmd.exe
[PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.RB;.RBW
[WINDIR] => C:\WINDOWS
[SERVER_SIGNATURE] =>
Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e mod_autoindex_color PHP/5.2.3 Server at 192.168.2.61 Port 80


[SERVER_SOFTWARE] => Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e mod_autoindex_color PHP/5.2.3
[SERVER_NAME] => 192.168.2.61
[SERVER_ADDR] => 192.168.2.61
[SERVER_PORT] => 80
[REMOTE_ADDR] => 192.168.2.61
[DOCUMENT_ROOT] => C:/xampp/htdocs/
[SERVER_ADMIN] => admin@localhost
[SCRIPT_FILENAME] => C:/xampp/htdocs/server.php
[REMOTE_PORT] => 1575
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /server.php
[SCRIPT_NAME] => /server.php
[PHP_SELF] => /server.php
[REQUEST_TIME] => 1215003903
[argv] => Array
(
)

[argc] => 0
)



Virtual host Setting in Appache

<VirtualHost *:80>
ServerName localhost
DocumentRoot D:/apachefriends/xampp/htdocs/abcd

Alias /AT D:/apachefriends/xampp/htdocs/abcdweb
Alias /ATS D:/apachefriends/xampp/htdocs/abcdweb
# And then some 80 or more Aliasses
</VirtualHost>

MySQL table types

  • HEAP tables; Fixed row size tables that are only stored in memory and indexed with a HASH index.
  • ISAM tables; The old B-tree table format in MySQL 3.22.
  • MyISAM tables; New version of the ISAM tables with a lot of extensions:
    • Binary portability.
    • Index on NULL columns.
    • Less fragmentation for dynamic-size rows than ISAM tables.
    • Support for big files.
    • Better index compression.
    • Better key statistics.
    • Better and faster auto_increment handling.
  • Berkeley DB (BDB) tables from Sleepycat: Transaction-safe (with BEGIN WORK / COMMIT | ROLLBACK).

How MySQL stores data

  • Databases are stored as directories.
  • Tables are stored as files.
  • Columns are stored in the files in dynamic length or fixed size format. In BDB tables the data is stored in pages.
  • Memory-based tables are supported.
  • Databases and tables can be symbolically linked from different disks.
  • On Windows MySQL supports internal symbolic links to databases with .sym files.

Optimizing tables

  • MySQL has a rich set of different types. You should try to use the most efficient type for each column.
  • The ANALYSE procedure can help you find the optimal types for a table: SELECT * FROM table_name PROCEDURE ANALYSE()
  • Use NOT NULL for columns which will not store null values. This is particularly important for columns which you index.
  • Change your ISAM tables to MyISAM.
  • If possible, create your tables with a fixed table format.
  • Don't create indexes you are not going to use.
  • Use the fact that MySQL can search on a prefix of an index; If you have and INDEX (a,b), you don't need an index on (a).
  • Instead of creating an index on long CHAR/VARCHAR column, index just a prefix of the column to save space. CREATE TABLE table_name (hostname CHAR(255) not null, index(hostname(10)))
  • Use the most efficient table type for each table.
  • Columns with identical information in different tables should be declared identically and have identical names.

Important MySQL startup options

back_log Change if you do a lot of new connections.
thread_cache_size Change if you do a lot of new connections.
key_buffer_size Pool for index pages; Can be made very big
bdb_cache_size Record and key cache used by BDB tables.
table_cache Change if you have many tables or simultaneous connections
delay_key_write Set if you need to buffer all key writes
log_slow_queries Find queries that takes a lot of time
max_heap_table_size Used with GROUP BY
sort_buffer Used with ORDER BY and GROUP BY
myisam_sort_buffer_size Used with REPAIR TABLE
join_buffer_size When doing a join without keys

Speed difference between different SQL servers (times in seconds)


    Reading 2000000 rows by key: NT Linux
    mysql 367 249
    mysql_odbc 464 
    db2_odbc 1206 
    informix_odbc 121126 
    ms-sql_odbc 1634 
    oracle_odbc 20800 
    solid_odbc 877 
    sybase_odbc 17614 
     
    Inserting (350768) rows: NT Linux
    mysql 381 206
    mysql_odbc 619 
    db2_odbc 3460 
    informix_odbc 2692 
    ms-sql_odbc 4012 
    oracle_odbc 11291 
    solid_odbc 1801 
    sybase_odbc 4802 


In the above test, MySQL was run with a 8M cache; the other databases were run with installations defaults.

Optimizing SQL


Use SQL for the things it's good at, and do other things in your application. Use the SQL server to:
  • Find rows based on WHERE clause.
  • JOIN tables
  • GROUP BY
  • ORDER BY
  • DISTINCT
Don't use an SQL server:
  • To validate data (like date)
  • As a calculator
Tips
  • Use keys wisely.
  • Keys are good for searches, but bad for inserts / updates of key columns.
  • Keep by data in the 3rd normal database form, but don't be afraid of duplicating information or creating summary tables if you need more speed.
  • Instead of doing a lot of GROUP BYs on a big table, create summary tables of the big table and query this instead.
  • UPDATE table set count=count+1 where key_column=constant is very fast!
  • For log tables, it's probably better to generate summary tables from them once in a while than try to keep the summary tables live.
  • Take advantage of default values on INSERT.

Mysql Tips

Many times, slow access to a mysql database can be the result of Badly defined or non-existent indexes and fixing these can often lead to better performance. Here is an

example table:

CREATE TABLE address_book (

contact_number char(10) NOT NULL,
firstname varchar(40),
surname varchar(40),
address text,
telephone varchar(25)
);

example query: SELECT firstname FROM address_book WHERE contact_number = '12312′;

This will retrieve the firstname of a person added to the address_book table, based on the contact number.

Without any kind of indexes added to this table, mysql will have to search through each row to find the item that you would like to find, which is very inefficient.

Optimizing your table

There is a built-in command called explain, that can show you what, if any, indexes that are being used to retrieve results.

example:

EXPLAIN SELECT firstname FROM address_book WHERE contact_number = '12312′;

This will return a set of results that will tell you how myql is processing the results

table: The table the output is about (will show multiple if you have joins)
type: The type of join is being used.best to worst the types are: system, const, eq_ref, ref, range, index, all
possible_keys: Shows which possible indexes apply to this table
key: And which one is actually used
key_len: The length of the key used. The shorter that better.
ref: The column, or a constant, is used
rows: The number of rows mysql believes it must examine to get the data
extra: You don't want to see "using temporary" or "using filesort"

and index can be added to the above example table using the following command:

ALTER TABLE address_book ADD INDEX(contact_number);

you can also add an index on only part of a varchar. In the following, I will add an index on only 8 of the 10 characters.

ALTER TABLE address_book ADD INDEX(contact_number(8));

Why would you want to do this?

Indexes do increase performance in the right situations, but they are also a tradeoff between speed and space. The bigger an index is, the more space it will consume on your harddrive.

Using the query optimizer/analyzer

the following command can analyze your table key distribution to find out the best indexes to use:

analyze table *tablename*

also, another thing to keep in mind is the fact that over time, update and delete operations leave gaps in the table, which will cause un-needed overhead when reading data from your tables.

from time to time, it is a good idea to run the following (which will fix the above issue):

optimize table *tablename*
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
5 mysql tips

By Justin Silverton

These are some tips that may help you out when dealing with mysql tables (known in 4.1 and below).

1) char and varchar are case sensitive

example:

if you have a table that contains the following:

table newtable (
name varchar(32)
)

name contains the name "John Smith".

the following statement: "SELECT * from newtable where name='john smith' will return our record.

to stop this from happening, use the following when you create your table:

CREATE TABLE newtable (
name VARCHAR(32) BINARY
)

2) Varchar type is limited to 255 characters

3) Varchar trailing spaces are stripped

example: insert into newtable values('Test with no spaces ');

select concat(name, 'no spaces') FROM newtable;

output will be: Test with no spacesnospaces

Varchar works this way, because it saves space by stripping the spaces.

if you need to keep the trailing spaces in the data you are adding to a varchar type,
you need to use the text or blob types.

4) operator

The (or) operater is a logical operator

example: select 'string1′ 'string2′ will not return 'string1string2′

5) function parameters

This issue has caused me many headaches in the past, and I am not sure why this issue was never fixed. If there is a space
between the paramater list and an internal function that you want to execute, it will return an error.

example: select min (my_field) from mytable wil return an error, while select min(my_field) from my_table will not

Redirection methods in All languages

Am I missing something? Most definately! Please use the comment form below to suggest new code.
Redirect with meta http-equiv tags

These go in the <head> </head> section of your html. Usually when you use this meta redirect method you should also use the javascript method, just to be safe.
Refresh meta http-equiv tag

Redirects to http://www.askapache.com after 0 seconds.

<meta http-equiv="refresh" content="0;url=http://www.askapache.com" />

Redirect with javascript

These go in the <head> </head> section of your html.
Basic javascript Redirect method

Will redirect user to http://www.askapache.com immediately

<script type="text/javascript">
window.location.href='http://www.askapache.com';
</script>

Redirect after specific time period

This will redirect to http://www.askapache.com after 2 seconds

<body onload="javascript:setTimeout(function(){window.location.href='http://www.askapache.com'},2000);">

Redirect with PHP
Using "Location" header

<?php
header('Location:http://www.askapache.com');
exit;
exit();
?>

Using "Refresh" header

<?php
header('Refresh: 0; URL=http://www.askapache.com');
exit;
exit();
?>

Ultimate PHP method

It redirects to a page specified by "$url". $mode can be:

    * LOCATION: Redirect via Header "Location"
    * REFRESH: Redirect via Header "Refresh"
    * META: Redirect via HTML META tag
    * JS: Redirect via JavaScript command

<?php
function do_redirect($url,$mode)
{
    if (strncmp('http:',$url,5) && strncmp('https:',$url,6)) {
        $starturl = ($_SERVER["HTTPS"] == 'on' ? 'https' : 'http') . '://'.
        (empty($_SERVER['HTTP_HOST'])? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST']);
        if ($url[0] != '/') $starturl .= dirname($_SERVER['PHP_SELF']).'/';
        $url = "$starturl$url";
    }
    switch($mode) {
        case 'LOCATION':
        header("Location: $url");
        exit;
        case 'REFRESH':
        header("Refresh: 0; URL=\"$url\"");
        exit;
        case 'META':
        exit;
        default:
        ?><script type="text/javascript">
        window.location.href='<?=$url?>';
        </script><?
    }
    exit;
}
?>

Redirect with Perl
Simple 302 Redirect with perl

#!/usr/bin/perl
my $URL = "http://www.askapache.com";
print "Status: 302 Moved\nLocation: $URL\n\n";

Simpler 302 Redirect with perl

#!/usr/bin/perl
print "Location: http://www.askapache.com\n\n";
exit;

Redirect with ColdFusion (CFM)
Using cheader for 301 "permanent" redirect

<cfheader statuscode="301" statustext="Moved Permanently">
<cfheader name="Location" value="http://www.askapache.com">
<cfabort>

Using clflocation for 302 "temporary" redirect

<cflocation url="http://www.askapache.com">

Redirect with ASP (VB Script)
301 Redirect

<%@ Language=VBScript %>
<%
response.status="301 moved permanently"
Response.AddHeader "Location", "http://www.askapache.com"
%>

Redirect with shell script
302 Redirect with sh shell script

#!/bin/sh
echo "Content-type: text/html"
echo "Location: http://www.askapache.com";
echo "";
exit 0;

Redirect with mod_rewrite in apache htaccess

See also Ultimate Apache htaccess article and URL Redirection
301 Redirect

Redirects permanently when a request is made to site.com/thisword.html to http://www.askapache.com

RewriteEngine On
RewriteBase /
RewriteRule ^thisword\.html$ http://www.askapache.com [R=301,NC,L]

302 Redirect

Redirects temporarily when a request is made to site.com/thisword.html to http://www.askapache.com

RewriteEngine On
RewriteBase /
RewriteRule ^thisword\.html$ http://www.askapache.com [R,NC,L]

Redirect with mod_alias in apache htaccess
301 Redirect

Redirect 301 /thisword.html http://www.askapache.com

or with RedirectPerm

RedirectPerm /thisword.html http://www.askapache.com

or with RedirectMatch

RedirectMatch 301 ^thisword\.html$ http://www.askapache.com

302 Redirect

Redirect 302 /thisword.html http://www.askapache.com

or with RedirectTemp

RedirectTemp /thisword.html http://www.askapache.com

or with RedirectMatch

RedirectMatch 302 ^thisword\.html$ http://www.askapache.com

Redirect with ErrorDocument in apache htaccess
302 Redirect

Issues a 302 Redirect to http://www.askapache.com when a file is not found. See also Force Apache to output any HTTP Status Code with ErrorDocument

ErrorDocument 404 http://www.askapache.com

Redirect with Python / Django

Thanks to thebjorn for contributing this one.

from django import http
def view(request):
return http.HttpResponseRedirect('http://www.askapache.com')

List of the 27 Request Methods Recognized by Apache

List of the 27 Request Methods Recognized by Apache

  1. GET
  2. PUT
  3. POST
  4. DELETE
  5. CONNECT
  6. OPTIONS
  7. TRACE
  8. PATCH
  9. PROPFIND
  10. PROPPATCH
  11. MKCOL
  12. COPY
  13. MOVE
  14. LOCK
  15. UNLOCK
  16. VERSION_CONTROL
  17. CHECKOUT
  18. UNCHECKOUT
  19. CHECKIN
  20. UPDATE
  21. LABEL
  22. REPORT
  23. MKWORKSPACE
  24. MKACTIVITY
  25. BASELINE_CONTROL
  26. MERGE
  27. INVALID

GET

The GET method indicates that the script should produce a document based on the meta-variable values. By convention, the GET method is 'safe' and 'idempotent' and SHOULD NOT have the significance of taking an action other than producing a document.

The meaning of the GET method may be modified and refined by protocol-specific meta-variables.

POST

The POST method is used to request the script perform processing and produce a document based on the data in the request message-body, in addition to meta-variable values. A common use is form submission in HTML [18], intended to initiate processing by the script that has a permanent affect, such a change in a database.

The script MUST check the value of the CONTENT_LENGTH variable before reading the attached message-body, and SHOULD check the CONTENT_TYPE value before processing it.

HEAD

The HEAD method requests the script to do sufficient processing to return the response header fields, without providing a response message-body. The script MUST NOT provide a response message-body for a HEAD request. If it does, then the server MUST discard the message-body when reading the response from the script.

OPTIONS

The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.

Responses to this method are not cacheable.

If the OPTIONS request includes an entity-body (as indicated by the presence of Content-Length or Transfer-Encoding), then the media type MUST be indicated by a Content-Type field. Although this specification does not define any use for such a body, future extensions to HTTP might use the OPTIONS body to make more detailed queries on the server. A server that does not support such an extension MAY discard the request body.

If the Request-URI is an asterisk ("*"), the OPTIONS request is intended to apply to the server in general rather than to a specific resource. Since a server's communication options typically depend on the resource, the "*" request is only useful as a "ping" or "no-op" type of method; it does nothing beyond allowing the client to test the capabilities of the server. For example, this can be used to test a proxy for HTTP/1.1 compliance (or lack thereof). If the Request-URI is not an asterisk, the OPTIONS request applies only to the options that are available when communicating with that resource.

A 200 response SHOULD include any header fields that indicate optional features implemented by the server and applicable to that resource (e.g., Allow), possibly including extensions not defined by this specification. The response body, if any, SHOULD also include information about the communication options. The format for such a body is not defined by this specification, but might be defined by future extensions to HTTP. Content negotiation MAY be used to select the appropriate response format. If no response body is included, the response MUST include a Content-Length field with a field-value of "0″.

The Max-Forwards request-header field MAY be used to target a specific proxy in the request chain. When a proxy receives an OPTIONS request on an absoluteURI for which request forwarding is permitted, the proxy MUST check for a Max-Forwards field. If the Max-Forwards field-value is zero ("0″), the proxy MUST NOT forward the message; instead, the proxy SHOULD respond with its own communication options. If the Max-Forwards field-value is an integer greater than zero, the proxy MUST decrement the field-value when it forwards the request. If no Max-Forwards field is present in the request, then the forwarded request MUST NOT include a Max-Forwards field.

PUT

The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI. If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to indicate successful completion of the request. If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be given that reflects the nature of the problem. The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not understand or implement and MUST return a 501 (Not Implemented) response in such cases.

If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries SHOULD be treated as stale. Responses to this method are not cacheable.

The fundamental difference between the POST and PUT requests is reflected in the different meaning of the Request-URI. The URI in a POST request identifies the resource that will handle the enclosed entity. That resource might be a data-accepting process, a gateway to some other protocol, or a separate entity that accepts annotations. In contrast, the URI in a PUT request identifies the entity enclosed with the request — the user agent knows what URI is intended and the server MUST NOT attempt to apply the request to some other resource. If the server desires that the request be applied to a different URI, it MUST send a 301 (Moved Permanently) response; the user agent MAY then make its own decision regarding whether or not to redirect the request.

A single resource MAY be identified by many different URIs. For example, an article might have a URI for identifying "the current version" which is separate from the URI identifying each particular version. In this case, a PUT request on a general URI might result in several other URIs being defined by the origin server.

HTTP/1.1 does not define how a PUT method affects the state of an origin server.

PUT requests MUST obey the message transmission requirements.

Unless otherwise specified for a particular entity-header, the entity-headers in the PUT request SHOULD be applied to the resource created or modified by the PUT.

DELETE

The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human intervention (or other means) on the origin server. The client cannot be guaranteed that the operation has been carried out, even if the status code returned from the origin server indicates that the action has been completed successfully. However, the server SHOULD NOT indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible location.

A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, 202 (Accepted) if the action has not yet been enacted, or 204 (No Content) if the action has been enacted but the response does not include an entity.

If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries SHOULD be treated as stale. Responses to this method are not cacheable.

TRACE

The TRACE method is used to invoke a remote, application-layer loop- back of the request message. The final recipient of the request SHOULD reflect the message received back to the client as the entity-body of a 200 (OK) response. The final recipient is either the origin server or the first proxy or gateway to receive a Max-Forwards value of zero (0) in the request (see section 14.31). A TRACE request MUST NOT include an entity.

TRACE allows the client to see what is being received at the other end of the request chain and use that data for testing or diagnostic information. The value of the Via header field (section 14.45) is of particular interest, since it acts as a trace of the request chain. Use of the Max-Forwards header field allows the client to limit the length of the request chain, which is useful for testing a chain of proxies forwarding messages in an infinite loop.

If the request is valid, the response SHOULD contain the entire request message in the entity-body, with a Content-Type of "message/http". Responses to this method MUST NOT be cached.

CONNECT

This specification reserves the method name CONNECT for use with a proxy that can dynamically switch to being a tunnel e.g. SSL tunneling.