Thursday, September 13, 2007

Cookies

Cookies:-

Cookies
provide a useful means in Web applications to store user-specific information. For example, when a user visits your site, you can use cookies to store user preferences or other information. When the user visits your Web site another time, the application can retrieve the information it stored earlier.

A cookie is a small bit of text that accompanies requests and pages as they go between the Web server and browser. The cookie contains information the Web application can read whenever the user visits the site. Imagine that when users request a page from your site, www.contoso.com, your application sends not just a page, but a cookie containing the date and time. When the user's browser gets the page, the browser also gets the cookie, which it stores in a folder on the user's hard disk. Later, the user requests a page from your site again. When the user enters the URL www.contoso.com, the browser looks on the local hard disk for a cookie associated with the URL. If the cookie exists, the browser sends the cookie to your site along with the page request. Your application can then determine the date and time that the user last visited the site. You might use the information to display a message to the user, check an expiration date, or perform any other useful function.

Cookies are associated with a Web site, not with a specific page, so the browser and server will exchange the www.contoso.com cookie information no matter what page the user requests from your site. As the user visits different sites, each site might send a cookie to the user's browser as well; the browser stores all the cookies separately.


Limitations
§ Most browsers support cookies of up to 4096 bytes. That is plenty of space for storing a few values on the user's computers, but you would not want to try to store a dataset or some other potentially large piece of data in a cookie. More practically, you probably do not want to store a big collection of user information in a cookie.

§ Browsers also impose limitations on how many cookies your site can store on the user's computer. Most browsers allow only 20 cookies per site; if you try to store more, the oldest cookies are discarded.

§ A cookie limitation that you are likelier to run into is that users can set their browser to refuse cookies. You cannot do much to get around this problem except to avoid cookies altogether and use a different mechanism to store user-specific information.

Add more to it u know.





Wishes
Whocares

How to find sql server version installed and service pack installed.

How to find sql server version installed and service pack installed.

Some time there is need to find what service pack your sql server already have.

1. Go to Sql query analyser

SELECT @@VERSION

It will give u the output something like this:-
=>For Sql server 2000

Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05 Copyright © 1988-2003 Microsoft Corporation Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 4)


=>For sql server 2005
Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86) Oct 14 2005 00:33:37 Copyright © 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 4)

But Something is missing here, the service pack info of sql server is missing.

2. Go to Query analyser
SELECT SERVERPROPERTY('productversion')as ProductVersion, SERVERPROPERTY ('productlevel')as ProductLevel, SERVERPROPERTY ('edition') as ServerEdition

=>Output of query for Sql server 2000 is

ProductVersion : ProductLevel : ServerEdition
8.00.760 : SP3 : Enterprise Edition

=>Output of query for Sql server 2005 is

ProductVersion : ProductLevel : ServerEdition
9.00.1399.06 : RTM : Enterprise Edition

How to get only Column name returned as result., Info

Sometimes in programming we just need to return the column name for a given table.

To solve this

1. Write a simple query:-

select name from syscolumns where id = object_id ('Typeurtablenamehere')


to see more attributes write
select * from syscolumns where id = object_id ('Typeurtablenamehere')

2. Also other method:-

select * from tablename where 1=0

It will give only the column name as output..


3. Also One more:-

select Column_NAME from information_schema.columns where table_name = 'Typeurtablenamehere'


Add more to this if some other methods is there also.

Enjoy....
..
.