Creating a Cookie-Javascript

To make life easier for ourselves, we'll write a function that allows us to create a new cookie and set certain of its attributes with more ease. We'll look at the code first and create an example using it shortly.
function setCookie(cookieName, cookieValue, cookiePath, cookieExpires)
{
   cookieValue = escape(cookieValue);
   if (cookieExpires == "")
   {
      var nowDate = new Date();
      nowDate.setMonth(nowDate.getMonth() + 6);
      cookieExpires = nowDate.toGMTString();
   }
   if (cookiePath != "")
   {
      cookiePath = ";Path=" + cookiePath;
   }
   document.cookie = cookieName + "=" + cookieValue +
      ";expires=" + cookieExpires + cookiePath;
}
The secure and domain parts of the cookie string are unlikely to be needed, so we just allow the name, value, expires, and path parts of a cookie to be set by the function. If we don't want to set a path or expiration date, we just pass empty strings for those parameters. If no path is specified, the current directory and its subdirectories will be the path. If no expiration date is set, we just assume a date six months from now.
The first line of the function introduces the escape() function, which we've not seen before.
cookieValue = escape(cookieValue);
When we talked about setting the value of a cookie, we mentioned that certain characters cannot be used directly, such as a semicolon. (This also applies to the name of the cookie.) To get around this problem, we can use the built-in escape() and unescape() functions.


alert(escape("2001 a space odyssey;"));
We can see that the spaces have been converted to %20, % indicating that they represent an escape or special character rather than an actual character, and that 20 is the ASCII value of the actual character. The semicolon has been converted to %3B, as we'd expect.
As we'll see later, when retrieving cookie values we can use the unescape() function to convert from the encoded version to plain text.
Back to our function; we next have an if statement.
   if (cookieExpires == "")
   {
      var nowDate = new Date();
      nowDate.setMonth(nowDate.getMonth() + 6);
      cookieExpires = nowDate.toGMTString();
   }
This deals with the situation where an empty string, "", has been passed for the cookieExpires parameter of the function. Because most of the time we want a cookie to last longer than the session it's created in, we set a default value for expires that is six months after the current date.
Next, if a value other than an empty string ("") has been passed to the function for the cookiePath parameter, we need to add that value when we create the cookie. We simply put "path=" in front of any value that has been passed in the cookiePath parameter.
   if (cookiePath != "")
   {
      cookiePath = ";Path=" + cookiePath;
   }
Finally on the last line we actually create the cookie, putting together the cookieName, cookieValue, cookieExpires, and cookiePath parts of the string.
   document.cookie = cookieName + "=" + cookieValue +
      ";expires=" + cookieExpires + cookiePath;
We'll be using the setCookie() function whenever we want to create a new cookie because it makes setting a cookie slightly easier than having to remember all the parts we want to set. More importantly, it can be used to set the expiration date to a date six months ahead of the current date.
For example, to use the function and set a cookie with default values for expires and path we just type the following:
setCookie("cookieName","cookieValue","","")

what is X Series for Network Communications

A set of recommendations adopted by the International Telecommunication Union Telecommunication Standardization Sector ITU-T, formerly the CCITT, and International Organization for Standardization ISO for standardizing equipment and protocols used in both public access and private computer networks.
Recommendation Number What It Covers
X.25 Interface required to connect a computer to a packet-switched network such as the Internet
X.75 Protocols for connecting two public data networks
X.200 Seven-layer set of protocols known as the ISO/OSI reference model for standardizing computer-to-computer connections
X.400 Format at the ISO/OSI application layer for e-mail messages over various network transports, including Ethernet, X.25, and TCP/IP. Gateways must be used to translate e-mail messages between the X.400 and Internet ­formats
X.445 Asynchronous Protocol Specification, which governs the transmission of X.400 messages over dial-up telephone lines
X.500 Protocols for client/server systems that maintain and access directories of users and resources in X.400 form
X.509 Digital certificates

What is MIME?

Acronym for Multipurpose Internet Mail Extensions. A protocol widely used on the Internet that extends the SMTP Simple Mail Transfer Protocol to permit data, such as video, sound, and binary files, to be transmitted by Internet e-mail without having to be translated into ASCII format first. This is accomplished by the use of MIME types, which describe the contents of a document. A MIME-compliant application sending a file, such as some e-mail programs, assigns a MIME type to the file. The receiving application, which must also be MIME-compliant, refers to a standardized list of documents that are organized into MIME types and subtypes to interpret the content of the file. For instance, one MIME type is text, and it has a number of subtypes, including plain and html. A MIME type of text/html refers to a file that contains text written in HTML. MIME is part of HTTP, and both Web browsers and HTTP servers use MIME to interpret e-mail files they send and receive. 

What is memory management?

In operating systems for personal computers, procedures for optimizing the use of RAM (random access memory). These procedures include selectively storing data, monitoring it carefully, and freeing memory when the data is no longer needed. Most current operating systems optimize RAM usage on their own; some older operating systems, such as early versions of MS-DOS, required the use of third-party utilities to optimize RAM usage and necessitated that the user be more knowledgeable about how the operating system and applications used memory. See also memory management unit, RAM. 2. In programming, the process of ensuring that a program releases each chunk of memory when it is no longer needed. In some languages, such as C and C++, the programmer must keep track of memory usage by the program. Java, a newer language, automatically frees any chunk of memory that is not in use. See also C, C++, garbage collection, Java. 

Memory management program :- A program used to store data and programs in system memory, monitor their use, and reassign the freed space following their execution. 2. A program that uses hard disk space as an extension of the random access memory RAM.  

Memory management unit :-The hardware that supports the mapping of virtual memory addresses to physical memory addresses. In some systems, such as those based on the 68020, the memory management unit is separate from the processor. In most modern microcomputers, however, the memory management unit is built into the CPU chip. In some systems, the memory management unit provides interfacing between the microprocessor and memory. This type of memory management unit is typically responsible for address multiplexing and, in the case of DRAMs, the refresh cycle. Acronym: MMU. See also physical address, refresh cycle, virtual address.

What is markup language?

A set of codes in a text file that instructs a computer how to format the file on a printer or video display or how to index and link its contents. Examples of markup languages are Hypertext Markup LanguageHTML and Extensible Markup Language XML, which are used in Web pages, and Standard Generalized Markup Language SGML, which is used for typesetting and desktop publishing purposes and in electronic
documents. Markup languages of this sort are designed to enable documents and other files to be platform-independent and highly portable between applications. See also HTML, SGML, XML.

why need For a relational database?

A database or database management system that stores information in tables—rows and columns of data—and conducts searches by using data in specified columns of one table to find additional data in another table. In a relational database, the rows of a table represent records (collections of information about separate items) and the columns represent fields (particular attributes of a record). In conducting searches, a relational database matches information from a field in one table with information in a corresponding field of another table to produce a third table that combines requested data from both tables. 


For example, if one table contains the fields EMPLOYEE-ID, LAST-NAME, FIRST-NAME, and HIRE-DATE, and another contains the fields DEPT, EMPLOYEE-ID, and SALARY, a relational database can match the EMPLOYEE-ID fields in the two tables to find such information as the names of all employees earning a certain salary or the departments of all employees hired after a certain date. In other words, a relational database uses matching values in two tables to relate information in one to information in the other. Microcomputer database products typically are relational databases. Compare flat-file database, inverted-list database.

Os registry?

A central hierarchical database in Windows 9x, Windows CE, Windows NT, and Windows 2000 used to store information necessary to configure the system for one or more users, applications, and hardware devices. The Registry contains information that Windows continually references during operation, such as profiles for each user, the applications installed on the computer and the types of documents each can create, property sheet settings for folders and application icons, what hardware exists on the system, and which ports are being used.

 The Registry replaces most of the text-based .ini files used in Windows 3. x and MS-DOS configuration files, such as AUTOEXEC.BAT and CONFIG.SYS. Although the Registry is common to the several Windows platforms, there are some differences among them. Also called: system registry. See also hierarchical database, .ini, input/output port, property sheet, Registry Editor.

Whai is macro?

In applications, a set of keystrokes and instructions recorded and saved under a short key code or macro name. When the key code is typed or the macro name is used, the program carries out the instructions of the macro. Users can create a macro to save time by replacing an often-used, sometimes lengthy, series of strokes with a shorter version. 2. In programming languages, such as C or assembly language, a name that defines a set of instructions that are substituted for the macro name wherever the name appears in a program a process called macro expansion when the program is compiled or assembled.

 Macros are similar to functions in that they can take arguments and in that they are calls to lengthier sets of instructions. Unlike functions, macros are replaced by the actual instructions they represent when the program is prepared for execution; function instructions are copied into a program only once.

What is modem?

Short for modulator/demodulator. A communications device that converts between digital data from a computer or terminal and analog audio signals that can pass through a standard telephone line. Because the telephone system was designed to handle voice and other audio signals and a computer processes signals as discrete units of digital information, a modem is necessary at both ends of the telephone line to exchange data between computers. At the transmit end, the modem converts from digital to analog audio; 
at the receiving end, a second modem converts the analog audio back to its original digital form.

 In order to move a high volume of data, high-speed modems rely on sophisticated methods for “loading” information onto the audio carrier—for example, they may combine frequency shift keying, phase modulation, and amplitude modulation to enable a single change in the carrier’s state to represent multiple bits of data. In addition to the basic modulation and demodulation functions, most modems also include firmware that allows them to originate and answer telephone calls. International standards for modems are specified by the International Telecommunications Union, or ITU. 

Despite their capabilities, modems do require communications software in order to function. See also amplitude modulation, frequency modulation, quadrature amplitude modulation. Compare digital modem. 2. Any communications device that acts as an interface between a computer or terminal and a communications channel. Although such a device may not actually modulate or demodulate analog signals, it may be described as a modem because a modem is perceived by many users to be a black box that connects a computer to a communications line such as a high-speed network or a cable TV system.

What is Internet domain?

Internet Domains

 In database design and management, the set of valid values for a given attribute. For example, the domain for the attribute AREA-CODE might be the list of all valid three-digit numeric telephone area codes in the United States.  For Windows NT Advanced Server, a collection of computers that share a common domain database and security policy. Each domain has a unique name. 3. In the Internet and other networks, the highest subdivision of a domain name in a network address, which identifies the type of entity owning the address for example, .com for commercial users or .edu for educational institutions) or the geographical location of the address for example, .fr for France or .sg for Singapore. The domain is the last part of the address for example, www.example.org. 



Top-Level Domains: Organizational

Domain Type of Organization
.aero Air-transport industry
.biz Businesses
.com Commercial
.coop Cooperatives
.edu Educational
.gov Nonmilitary agency, United States federal government
.info Unrestricted use
.int International organization
.mil United States military
.museum Museums
.name Individuals
.net Network provider
.org Nonprofit organization
.pro Professional workers
Top-Level Domains: Geographic
Domain Country/Region
.ac Ascension Island
.ad Andorra
.ae United Arab Emirates
.af Afghanistan
.ag Antigua and Barbuda
.ai Anguilla
.al Albania
.am Armenia
.an Netherlands Antilles
.ao Angola
.aq Antarctica
.ar Argentina
.as American Samoa
.at Austria
.au Australia
.aw Aruba
.az Azerbaijan
.ba Bosnia and Herzegovina
.bb Barbados
.bd Bangladesh
.be Belgium
.bf Burkina Faso
.bg Bulgaria
.bh Bahrain
.bi Burundi
.bj Benin
.bm Bermuda
.bn Brunei
.bo Bolivia
.br Brazil
.bs Bahamas, The
.bt Bhutan
.bv Bouvet Island
.bw Botswana
.by Belarus
.bz Belize
.ca Canada
.cc Cocos (Keeling) Islands
.cd Congo (DRC)
.cf Central African Republic
.cg Congo
.ch Switzerland
.ci Côte d‘Ivoire
.ck Cook Islands
.cl Chile
.cm Cameroon
.cn China
.co Colombia
.cr Costa Rica
.cu Cuba
.cv Cape Verde
.cx Christmas Island
.cy Cyprus
.cz Czech Republic
.de Germany
.dj Djibouti
.dk Denmark
.dm Dominica
.do Dominican Republic
.dz Algeria
.ec Ecuador
.ee Estonia
.eg Egypt
.er Eritrea
.es Spain
.et Ethiopia
.fi Finland
.fj Fiji Islands
.fk Falkland Islands (Islas Malvinas)
.fm Micronesia
.fo Faroe Islands
.fr France
.ga Gabon
.gd Grenada
.ge Georgia
.gf French Guiana
.gg Guernsey
.gh Ghana
.gi Gibraltar
.gl Greenland
.gm Gambia, The
.gn Guinea
.gp Guadeloupe
.gq Equatorial Guinea
.gr Greece
.gs South Georgia and the South Sandwich Islands
.gt Guatemala
.gu Guam
.gw Guinea-Bissau
.gy Guyana
.hk Hong Kong SAR
.hm Heard Island and McDonald Islands
.hn Honduras
.hr Croatia
.ht Haiti
.hu Hungary
.id Indonesia
.ie Ireland
.il Israel
.im Man, Isle of
.in India
.io British Indian Ocean Territory
.iq Iraq
.ir Iran
.is Iceland
.it Italy
.je Jersey
.jm Jamaica
.jo Jordan
.jp Japan
.ke Kenya
.kg Kyrgzstan
.kh Cambodia
.ki Kiribati
.km Comoros
.kn St. Kitts and Nevis
.kp North Korea
.kr Korea
.kw Kuwait
.ky Cayman Islands
.kz Kazakhstan
.la Laos
.lb Lebanon
.lc St. Lucia
.li Liechtenstein
.lk Sri Lanka
.lr Liberia
.ls Lesotho
.lt Lithuania
.lu Luxembourg
.lv Latvia
.ly Libya
.ma Morocco
.mc Monaco
.md Moldova
.mg Madagascar
.mh Marshall Islands
.mk Macedonia, Former Yugoslav Republic of
.ml Mali
.mm Myanmar
.mn Mongolia
.mo Macau SAR
.mp Northern Mariana Islands
.mq Martinique
.mr Mauritania
.ms Montserrat
.mt Malta
.mu Mauritius
.mv Maldives
.mw Malawi
.mx Mexico
.my Malaysia
.mz Mozambique
.na Namibia
.nc New Caledonia
.ne Niger
.nf Norfolk Island
.ng Nigeria
.ni Nicaragua
.nl Netherlands, The
.no Norway
.np Nepal
.nr Nauru
.nu Niue
.nz New Zealand
.om Oman
.pa Panama
.pe Peru
.pf French Polynesia
.pg Papua New Guinea
.ph Philippines
.pk Pakistan
.pl Poland
.pm St. Pierre and Miquelon
.pn Pitcairn Islands
.pr Puerto Rico
.ps Palestinian Authority
.pt Portugal
.pw Palau
.py Paraguay
.qa Qatar
.re Reunion
.ro Romania
.ru Russia
.rw Rwanda
.sa Saudi Arabia
.sb Solomon Islands
.sc Seychelles
.sd Sudan
.se Sweden
.sg Singapore
.sh St. Helena
.si Slovenia
.sj Svalbard and Jan Mayen
.sk Slovakia
.sl Sierra Leone
.sm San Marino
.sn Senegal
.so Somalia
.sr Suriname
.st São Tomé and Príncipe
.sv El Salvador
.sy Syria
.sz Swaziland
.tc Turks and Caicos Islands
.td Chad
.tf French Southern and Antarctic Lands
.tg Togo
.th Thailand
.tj Tajikistan
.tk Tokelau
.tm Turkmenistan
.tn Tunisia
.to Tonga
.tp East Timor
.tr Turkey
.tt Trinidad and Tobago
.tv Tuvalu
.tw Taiwan
.tz Tanzania
.ua Ukraine
.ug Uganda
.uk United Kingdom
.um U.S. Minor Outlying Islands
.us United States
.uy Uruguay
.uz Uzbekistan
.va Vatican City
.vc St. Vincent and the Grenadines
.ve Venezuela
.vg Virgin Islands, British
.vi Virgin Islands
.vn Vietnam
.vu Vanuatu
.wf Wallis and Futuna
.ws Samoa
.ye Yemen
.yt Mayotte
.yu Yugoslavia
.za South Africa
.zm Zambia
.zw Zimbabwe

what is ANSI?

Acronym for American National Standards Institute. A voluntary, nonprofit organization of business and industry groups formed in 1918 for the development and adoption of trade and communication standards in the United States. ANSI is the American representative of ISO (the International Organization for Standardization). Among its many concerns, ANSI has developed recommendations for the use of programming languages including FORTRAN, C, and COBOL, and various networking technologies. See also ANSI C, ANSI.SYS, SCSI. 2. The Microsoft Windows ANSI character set. This set is includes ISO 8859/x plus additional characters. This set was originally based on an ANSI draft standard. The MS-DOS operating system uses the ANSI character set if ANSI.SYS is installed. 

Acronym for American National Standards Institute Standards Planning and Requirements Committee. The ANSI committee that, in the 1970s, proposed a generalized, three-schema architecture that is used as the foundation for some database management systems.  

An installable device driver for MS-DOS computers that uses ANSI commands (escape sequences) to enhance the user’s control of the console. See also ANSI, driver, escape sequence, install. 

A standard entitled “Representation for Calendar Date and Ordinal Date for Information Interchange” from the American National Standards Institute (ANSI) that covers date formats. Many organizations, including the U.S.   

What is anonymous FTP?

The ability to access a remote computer system on which one does not have an account, via the Internet’s File Transfer Protocol (FTP). Users have restricted access rights with anonymous FTP and usually can only copy files to or from a public directory, often named /pub, on the remote system. Users can also typically use FTP commands, such as listing files and directories. When using anonymous FTP, the user accesses the remote computer system with an FTP program and generally uses anonymous or ftp as a logon name. The password is usually the user’s e-mail address, although a user can often skip giving a password or give a false e-mail address. In other cases, the password can be the word anonymous. Many FTP sites do not permit anonymous FTP access in order to maintain security. Those that do permit anonymous FTP sometimes restrict users to only downloading files for the same reason.

Absolute pointing device

A mechanical or physical pointing device whose location is associated with the position of the on-screen cursor. For example, if the user of a graphics tablet places the pen on the upper right corner of the tablet, the cursor moves to the upper right corner of the screen or on-screen window associated with the pen. See also absolute coordinates. Compare relative pointing device.

Why need calendar program?

An application program in the form of an electronic calendar, commonly used for highlighting dates and scheduling appointments. Some calendar programs resemble wall calendars, displaying dates in blocks labeled with the days of the week; others display dates day by day and enable the user to enter appointments, notes, and other memoranda. A day-of-the-week type of calendar program could, 
for example, be used to find out that Christmas 2003 will be on a Saturday. Depending on its capabilities, such a program might cover only the current century, or it might cover hundreds of years and even allow for the change . 
 
A calendar/scheduler program might show blocks of dates or, like an appointment book, single days divided into hours or half hours, with room for notes. Some programs allow the user to set an alarm to go off at an important point in the schedule. Other programs can coordinate the calendars of different people on the same network so that a person entering an appointment into his or her calendar also enters the appointment into a colleague’s calendar

Why B2B website needed?

Short for business-to-business. The electronic exchange of products and services between businesses without the direct involvement of consumers. B2B’s effects on business include streamlining purchasing, accounting, and other administrative functions; lowering transaction costs; and simplifying the sale of excess inventory. Related businesses have collaborated on the creation of Internet-based supply-chain networks. 

B2c:The direct electronic exchange of products and services between businesses and consumers. B2C’s effects on business include improving the efficiency in delivering goods and services to consumers.

What is ActiveX

A set of technologies that enables software components to interact with one another in a networked environment, regardless of the language in which the components were created. ActiveX, which was developed by Microsoft in the mid 1990s and is currently administered by the Open Group, is built on Microsoft’s Component Object Model (COM). Currently, ActiveX is used primarily to develop interactive content for the World Wide Web, although it can be used in desktop applications and other programs. ActiveX controls can be embedded in Web pages to produce animation and other multimedia effects, interactive objects, and sophisticated applications. 

ActiveX control : A reusable software component based on Microsoft’s ActiveX technology that is used to add interactivity and more functionality, such as animation or a popup menu, to a Web page, applications, and software development tools. An ActiveX control can be written in any of a number of languages, including Java, C++, and Visual Basic. See also ActiveX. Compare helper program.

What is Active Server?

The server-based component of Microsoft’s Active Platform. Comprised of a set of technologies that includes DCOM (distributed component object model), Active Server Pages, Microsoft Transaction Server, and message queues, Active Server provides support for developing component-based, scalable, high-performance Web applications on Microsoft Windows NT servers. Active Server is designed to allow developers to concentrate on creating Internet and intranet software in a variety of languages without having to focus on the intricacy of the network itself. See also Active Desktop, Active Platform, Active Server Pages, ActiveX..

Active Server Pages :-. A Web-oriented technology developed by Microsoft that is designed to enable server-side (as opposed to client-side) scripting. Active Server Pages are text files that can contain not only text and HTML tags as in standard Web documents, but also commands written in a scripting language (such as VBScript or JavaScript) that can be carried out on the server. This server-side work enables a Web author to add interactivity to a document or to customize the viewing or delivery of information to the client without worrying about the platform the client is running. All Active Server Pages are saved with an .asp extension and can be accessed like standard URLs through a Web browser, such as Microsoft Internet Explorer or Netscape Navigator. When an Active Server Page is requested by a browser, the server carries out any script commands embedded in the page, generates an HTML document, and sends the document back to the browser for display on the requesting (client) computer. Active Server Pages can also be enhanced and extended with ActiveX components.

Sony-Xperia Z2 US


Sony recently announced that its flagship smartphone, the Xperia Z2 will be available in the US
 this summer. However, if you were planning to pick the device on a lower price with a contract, then we have some bad news for you. According to a new report, Sony has confirmed that neither the
Xperia Z2 nor the Xperia Z1 Compact will be available in the US stores in the nearest future.



 Sony will have its flagship smartphone for sale only on its online store in the US. And, if you are planning to get your hands on the Xperia Z1 Compact, then getting it from overseas is your only option. If you are a Sony or Xperia fan in the US, then all you got at this point of time is the Xperia Z2 tablet

Oppo with dual-core CPU

The dual-SIM Android smartphone will go on sale in the country in the near future for about $138 in black or white color scheme. Oppo Joy features a MediaTek SoC with 1.3GHz dual-core Cortex-A7 CPU,



Mali 400 GPU, 4" WVGA display, and 512MB of RAM. There's 4GB of built-in memory on board and a
microSD card slot for further expansion. The handset boots Android 4.2.2 Jelly Bean with Color OS UI. The camera department of the Oppo Joy consists of a 3MP main snapper and 0.3MP front-facing unit. Connectivity options include HSPA+, Wi-Fi, Bluetooth, GPS, and microUSB port.


 The measures of the smartphone are 124 x 63 x 9.9mm, while its weight tips the scale at 125 grams. It is powered by a 1,700mAh battery. There is no word on availability of the Oppo Joy outside of Indonesia.

LG L80-the magic

LG L90, L70 and L40. They will soon be joined by a fourth member, L80 and today we get to
 optically discern how the upcoming mid-range looks akin to. We got images of the dual SIM
 version of the L80, which comes with four capacitive touch buttons - back, home, menu and
 multi-tasking at the front. We postulate the single SIM L80 will feature a physical home
button as visually perceived in the earlier trio.

LG L80 will sport a 5-inch
 exhibit with a resolution of 800 x 480 pixels. The smartphone will be powered by a dual-core
 processor clocked at 1.2 GHz along with 1 GB of RAM. There will be 4 GB of internal
recollection with the option to expand it via microSD card. The L80 runs on Android 4.4
KitKat out of the box and packs a 2,540mAh battery. On the software front, the contrivance
 comes with the company's proprietary feature - LG Knock Code, which sanctions you to unlock
 your smartphone by tapping on the screen in categorical pattern. Lastly, we ken that the LG
L80 will be available in ebony and white color options.

Relational Databases-MySQL

MySQL is a relational database. An important feature of relational systems is that a single database can be spread across several tables as opposed to our flat-file phone book example. Related data is stored in separate tables and allows you to put them together by using a key common to both tables. The key is the relation between the tables. The selection of a primary key is one of the most critical decisions you'll make in designing a new database. The most important concept that you need to understand is that you must ensure the selected key is unique. If it's possible that two records past, present, or future share the same value for an attribute, don't use them as a primary key. Including key fields from another table to form a link between tables is called a foreign key relationship, like a boss to employees or a user to a purchase. The relational model is very useful because data is retrieved easier and faster.

Relationship Types

Databases relationships are quantified with the following categories:
  • One-to-one relationships
  • One-to-many relationships
  • Many-to-many relationships
We'll discuss each of these relationships and provide an example. If you think of a family structure when thinking about relationships, you're ahead of the game. When you spend time alone with one parent, that's a specific type of relationship; when you spend time with both your parents, that's another one. If you bring in a significant partner and all of youyour parents, you, and your partnerall do something together, that's another relationship. This is identical to the bucket analogy. All those different types of relationships are like specific buckets that hold the dynamics of your relationships. In the database world, it's the data you've created.

In a one-to-one relationship, each item is related to one and only one other item. Within the example of a bookstore. A one-to-one relationship exists between users and their shipping addresses.

Normalization

Thinking about how your data is related and the most efficient way to organize it is called normalization. Normalization of data is breaking it apart based on the logical relationships to minimize the duplication of data. Generally, duplicated data wastes space and makes maintenance a problem. Should you change information that is duplicated, there's the risk that you miss a portion and you risk inconsistencies in you database.
It's possible to have too much of a good thing though: databases placing each piece of data in their own tables would take too much processing time and queries would be convoluted. Finding a balance in between is the goal.
While the phone book example is very simple, the type of data that you process with a web page can benefit greatly from logically grouping related data.
Let's continue with the bookstore example. The site needs to keep track of the user's data, including login, address, and phone number, as well as information about the books, including the title, author, number of pages, and when each title was purchased.

LG G3 screenies-come

The overall look and feel of the latest Optimus UI on top of Android 4.4 KitKat
 is very clean and flat, a trend that a lot of manufacturers are embracing. Everything from the icons, launcher and notification drawer is less cluttered and looks very nice. The quick settings toggles are rounded icons, similarly to the latest Samsung TouchWiz UI on the Galaxy S5. The position of the QSlide Apps

 remains unchanged, but still, the notification drawer seems too busy for our taste. Here's a full resolution screenshot for you to gaze at, as we had to shrink the rest to a reasonable web-friendly size. LG G3 QHD resolution screenshot Unrelated to these screen caps, recent rumors claim the LG G3 is going to be based on the Japanese LG isai FL, which leaked a few days ago. The Japan-only smartphone sports a quad-core Snapdragon 801 SoC, clocked at 2.5GHz, a 5.5-inch LCD rumored to have 2560x1440 resolution, 2GB RAM, 32GB internal memory with microSD support, 3000mAh battery, and an IPX7 rating,

which means it is water resistant. Do you like the look of the new and upcoming Optimus UI better than the old one.

Backing Up and Restoring Data MySQL

Even the best maintained databases occasionally develop problems. Hardware failures, in particular, can really throw a monkey wrench into your web pages. Now that you're using a database, just backing up the files (HTML, PHP, and images) on your web server isn't enough. There's nothing worse than informing your web users that they have to reenter information, such as their accounts, or have to recreate your catalog items. Having a complete backup can make the difference between an hour of down time and having to recreate the wheel. There are a couple of tactics that we'll discuss for backing up your database data.

Copying Database Files

You can also do a simple file backup of your MySQL database's datafiles, in the same way that you can back up your HTML and PHP files. If you can back up files, you can back up the MySQL database files.
We don't recommend this tactic for moving a database from one machine to another server, since different versions of MySQL may expect these files to be in a different format. MySQL stores its datafiles in a special data directory that is usually located in C:\Program Files\MySQL\MySQL Server 4.1\data\[database_name] on Windows and in /var/lib/mysql on Unix variants such as Linux and Mac OS X.
To fully back up and restore a MySQL database using your current datafiles, all the files must be replaced in the same directory from which they were backed up. Then, the database must be restarted.

The mysqldump Command


It's better to use the MySQL command-line tool for making complete database backups. The same tools you'll use to back up and restore can also be used to change platforms or move your database from one server to another; mysqldump creates a text file containing the SQL statements required to rebuild the database objects and insert the data. The mysqldump command is accessible from the command line and takes parameters for backing up a single table, a single database, or everything. The command's syntax is:
mysqldump -u user -p objects_to_backup

The default mode for mysqldump is to export to backup and then to standard output, which is usually the screen.

Backing up
We're going to show you the commands to back up a database called test from the shell prompt.
mysqldump -u root -p test > my_backup.sql

This tells mysqldump to log into the database as the root user with a password of barney, and to back up the test database. The output of the command is saved to a file called my_backup.sql with the help of the redirect character also known as the greater-than symbol >.

To back up only a single table from a database, simply add the table name after the database name. For example, the command below illustrates how to back up only the authors table:
$ mysqldump -u root -p test authors > authors.sql

Most of the time, you'll just want to back up everything in the database. To do this, use the --all-databases command-line switch. The resulting database backup file will contain the commands necessary to create the databases and users, making a complete database restore a snap. Here's how to use this parameter:
$ mysqldump -u root -p --all-databases > my_backup.sql

To create an empty copy of your databasejust the structurefor testing, use the --no-data switch:
$ mysqldump -u root -p --no-data test > structure.sql

You can also do the opposite and just back up the data with the --no-create-info switch like this:
$ mysqldump -u root -p --no-create-info test > data.sql

Of course, having a backup of your database doesn't do you much good if you don't know how to restore the database from it.


Depending on how critical your data is and how often it changes, you can determine how often to back it up. As a rule, weekly, bi-weekly, and monthly are the most common schedules. If your business is completely dependent on your database, you should do a weekly backup schedule, if not backing up daily. Also, keeping a copy of the data in a separate location is a good idea in the event of large scale disasters, such as a fire. A client of ours keeps bi-monthly backups in a fire safe at the office, whereas another client sends the data to a backup service. A backup service can use physical hard drives, tapes, or CDs, or can log into your server and perform the backup electronically.





PHP Functions
Php tutorial - imagemagick
php.ini Basics
PHP Sessions
Cookies Versus Sessions
PHP Web-Related Variables
PHP ERRORS
maximum size of a file uploaded
Php Image upload
php file_get_contents
MySQL Data on the Web
What are GET and POST
php and pdf
$_ENV and $_SERVER
PEAR with php
SELECTING DATA PHP
prevent hijacking with PHP
LAMP
PHP MySQL Functions
PHP Zip File Functions
Substrings PHP
PHP Variable names
PHP magic methods
How to get current session id
Add variables into a session
$_GET , $_POST,$_COOKIE
different tables present in mysql
PHP CURL
php Sessions page
PHP-sorting an array
PHP-count the elements of array
Operators for If/Else Statements
PHP file uploading code
PHP global variables
Testing working using phpinfo
PHP Code for a Valid Number
PHP-Associative Arrays
PHP mvc tutorial
PHP get_meta_tags-Extracts
difference between print and echo
PHP best tutorial-PHP variables
Reading DOC file in PHP
PHP interview questions
convert time PHP
PHP implode array elements
header function-PHP
PHP-Renaming Files Directories
PHP Classes
in_array function in PHP
keep your session secure PHP
Web Application with PHP
What is SQL Injection
PHP-extract part of a string
PHP urlencode
PHP- know browser properties
PHP- Extracting Substrings
Checking Variable Values /Types
PHP-best 20 Open Source cms
IP AddressPHP
PHP-Scope Resolution Operator
how create new instance of object
how eliminate an object
PHP- ob_start
XML file using the DOM API
PHP- MVC
PHP- CAPTCHA
PHP- Position of a Value in an Array
PHP-Mail Functions
PHP-difference include vs require
calculate the sum of values in an array
PHP-total number of rows
Show unique records mysql
MySQL Triggers
MySQL data directory
MySQL Subqueries
PHP- Networking Functions
PHP- Operators
Restore database
Conditional Functions mysql
PHP-function overloading
Friend function
mysql_connect /mysql_pconnect
PHP-Error Control Operators
what is IMAP
Apache-Specific Functions
Send Email from a PHP Script
SQL inherently
WAMP, MAMP, LAMP
Php tutorial-SYMBOLS
Table Types-MySQL
PHP-Encryption data management
PHP Array
Running MySQL on Windows
Maximum Performance MySQL
XML-RPC
PHP-static variables
Advanced Database Techniques
FTP
Codeigniter
Apache Pool Size
Why NoSQL
MySQL Server Performance
Database software
SQL Interview Answers
PHP Redirect
PHP Interview Questions with Answers
Advanced PHP

Managing the Database

Creating Users

To create users above and beyond the default privileged root user, issue the grant command. The grant command uses this syntax:
GRANT PRIVILEGES ON DATABASE.OBJECTS TO'USER'@'HOST' IDENTIFIED BY 'PASSWORD';

For example:
GRANT ALL PRIVILEGES ON *.* TO 'michele'@'localhost' IDENTIFIED BY 'secret';

This creates the user michele who can access anything locally. To change to the michele user, at the mysql command prompt, type:
exit

Then start MySQL from the command line with the new username and password. The syntax for specifying the username and password when starting MySQL is:
mysql -h hostname -u username -ppassword

If you don't want users to access tables other than their own, replace * with the name of the user's database, like this:
GRANT ALL PRIVILEGES ON `store`.* TO 'michele'@'localhost' IDENTIFIED BY 'secret';

You'll need to run the above line as root or as someone with permission. In the above code, the word store correlates to the database name to which privileges are assigned, which you'll create in the next section.

8.2.2. Creating a MySQL Database

You're going to create a database called store. The create database command works like this:
CREATE DATABASE `store`;

If this works, you'll get a result like this one:
Query OK, 1 row affected 0.03 sec
 
 
To start using this database, type:
USE `store`;
You will get the result:
Database changed.
Assuming you've done everything correctly, you'll be set up with new data and selected it for use. Creating tables is an important concept, so that's where we're headed!.


To rename a table, use ALTER TABLE table RENAME newtable. In this example, we are renaming the table from books to publications.
ALTER TABLE `books` RENAME `publications`;

 

Why MySQL Database?

MySQL has its own client interface, allowing you to move data around and change database configuration. Note that you must use a password to log in. Assigning database users allows you to limit access to server tables that have multiple users. Each MySQL server, where tables are grouped together, can host many databases. Normally, a web application has its own proprietary database.
You may have installed MySQL yourself or have access through your ISP. Most ISPs that support PHP also provide a MySQL database for your use. Should you have difficulty, check their support pages or contact them to determine connection details. You'll need to know the following:
  • The IP address of the database server
  • The name of the database
  • The username
  • The password
If you've installed MySQL on your computer, you'll be able to use the defaults from the installation and the password you specified. This chapter looks at two ways to communicate with MySQL, the command line and phpMyAdmin, a web-based tool.

Once you reach the command line, type mysql and press Enter. The syntax for the mysql command is:
mysql -h hostname -u user -p

If you've installed MySQL on your computer, the default username is root. You can omit the hostname flag and value. Enter your password when MySQL displays the Enter password prompt.

At the MySQL prompt, you can enter database commands followed by Enter. There is also a set of commands that MySQL itself interprets. For a list of these commands, type help or \h at the mysql> prompt.  

Command prompt meanings
Prompt
Meaning
mysql>
Waiting for a command
->
Waiting for the next line of a command
'>
Waiting for the next line of a string that starts with a single quote
">
Waiting for the next line of a string that starts with a double quote

MySQL client commands
Command
Parameter
Meaning
quit
Exit the command-line utility
use
Database name
Use a specific database
show
tables or databases
Show lists such as tables or databases available
describe
Table name
Describe a table's columns
status
Display database version and status
source
Filename
Execute commands from a file as a script


To display the available databases, type:

mysql> SHOW DATABASES;

PHP Functions
Php tutorial - imagemagick
php.ini Basics
PHP Sessions
Cookies Versus Sessions
PHP Web-Related Variables
PHP ERRORS
maximum size of a file uploaded
Php Image upload
php file_get_contents
MySQL Data on the Web
What are GET and POST
php and pdf
$_ENV and $_SERVER
PEAR with php
SELECTING DATA PHP
prevent hijacking with PHP
LAMP
PHP MySQL Functions
PHP Zip File Functions
Substrings PHP
PHP Variable names
PHP magic methods
How to get current session id
Add variables into a session
$_GET , $_POST,$_COOKIE
different tables present in mysql
PHP CURL
php Sessions page
PHP-sorting an array
PHP-count the elements of array
Operators for If/Else Statements
PHP file uploading code
PHP global variables
Testing working using phpinfo
PHP Code for a Valid Number
PHP-Associative Arrays
PHP mvc tutorial
PHP get_meta_tags-Extracts
difference between print and echo
PHP best tutorial-PHP variables
Reading DOC file in PHP
PHP interview questions
convert time PHP
PHP implode array elements
header function-PHP
PHP-Renaming Files Directories
PHP Classes
in_array function in PHP
keep your session secure PHP
Web Application with PHP
What is SQL Injection
PHP-extract part of a string
PHP urlencode
PHP- know browser properties
PHP- Extracting Substrings
Checking Variable Values /Types
PHP-best 20 Open Source cms
IP AddressPHP
PHP-Scope Resolution Operator
how create new instance of object
how eliminate an object
PHP- ob_start
XML file using the DOM API
PHP- MVC
PHP- CAPTCHA
PHP- Position of a Value in an Array
PHP-Mail Functions
PHP-difference include vs require
calculate the sum of values in an array
PHP-total number of rows
Show unique records mysql
MySQL Triggers
MySQL data directory
MySQL Subqueries
PHP- Networking Functions
PHP- Operators
Restore database
Conditional Functions mysql
PHP-function overloading
Friend function
mysql_connect /mysql_pconnect
PHP-Error Control Operators
what is IMAP
Apache-Specific Functions
Send Email from a PHP Script
SQL inherently
WAMP, MAMP, LAMP
Php tutorial-SYMBOLS
Table Types-MySQL
PHP-Encryption data management
PHP Array
Running MySQL on Windows
Maximum Performance MySQL
XML-RPC
PHP-static variables
Advanced Database Techniques
FTP
Codeigniter
Apache Pool Size
Why NoSQL
MySQL Server Performance
Database software
SQL Interview Answers
PHP Redirect
PHP Interview Questions with Answers
Advanced PHP