Tuesday, 28 February 2012

JavaScript cookies

Some Web sites stored some information with a small text file in user hard disk , these files are known as cookies. In JavaScript  cookie is  a property of document object.   JavaScript  provides comprehensive access rights of Cookies. 
Before continuing, we need to learn the basic of a cookie.
  Each Cookie has an expiry date, once the computer clock cross the expiration date, the cookie will be deleted. We can not directly delete a cookie, but you can set the expiration date earlier  to indirectly delete it. 
  Each page, or that each site has its own cookies, these cookies can only access by this site's pages and pages from other sites or the same site, an unauthorized region i.e. from a different browser can not access .
  Now we will learn to use the document.cookie property . 
  If you directly use the document.cookie property, or, in some way, for example, assign the variables to the value of document.cookie, we can know how many Cookies are in the present document, the name of each Cookies, and its value. For example, in a document to add document.write (document.cookie) ", the results showed that:

document.cookie="NAME=VALUE; expires=DATE; path=PATH; domain=DOMAIN; secure"; 
name and value : The first part of the cookie string must have the name and value.

encodeURIComponent() and decodeURIComponent() functions.
To ensure that  cookie value string does not contain any commas, semicolons, or whitespace characters use  encodeURIComponent () function. Use  decodeURIComponent() function is used to  decode the encoded string by encodeURIComponent() functions.

expires : To give more life to the cookies you must set an expiration date in the following format. DD-Mon-YY HH:MM:SS GMT

Here is an example where the cookie will live upto Sun, 12 Jun 2012:00:00:00 GMT

path : To set a cookie in a specified path called 'backup' under root use the following command.

document.cookie= "VisiterName=George;expires=Mon,12Jun2011:00:00:00"
+ ";path=/backup;"; domain : To set the cookie in a domain name myexample.com

Thursday, 22 December 2011

MySQL CASE OPERATOR Tutorial

MySQL CASE Operator is used for  flow control. It is useful to create a complex conditional construct.

The Synatx is as follows :

CASE case_value
WHEN when_value THEN statement_list
[WHEN when_value THEN statement_list] ...
[ELSE statement_list]
END CASE

An example of MySQL CASE Operator is :


Refernce : MySQL CASE OPERATOR of w3resource MySQL Tutorial.

Tuesday, 22 November 2011

CROSS JOIN SQL

What does SQL CROSS JOIN do?

It produces number of rows in  the first table multiplied by the number of rows in the second table - a Cartesian Product.

Syntax 


FROM table1
CROSS JOIN table2;




What are the options to create table in PostgreSQL

Here is a list of ways you can Create Table in PostgreSQL

Command line


PgAdmin III






phpPgAdmin



Which way do you prefer?






Monday, 29 August 2011

JSON Tutorial

This page introduces you to JSON - JavaScript Object Notation. We have discussed definition, history, usage and Comparison with XML of JSON in this page.http://www.w3resource.com/JSON/introduction.php

NoSQL

NoSQL is a non-relational database management systems, different from traditional relational database management systems in some significant ways. It is designed for distributed data stores where very large scale of data storing needs (for example Google or Facebook which collects terabits of data every day for their users). These type of data storing may not require fixed schema, avoid join operations and typically scale horizontally. http://www.w3resource.com/mongodb/nosql.php

Schema.org tutorial

Schema.org is a Open Source project announced on June 2, 2011 by Bing, Google, Yahoo and sitemap.org.
The purpose of Schema.org is to introduce a set of schema (html tags). Upon using these tags in a website, search engines can understand the intention of using content(text, image, video) in that website better; which in turn would return better search results when a user is looking for a specific content through search engine.http://www.w3resource.com/schema.org/introduction.php