Thursday, December 19, 2013

What is Cloud Computing Technology-Basics

Cloud Computing is one of the terms which we listen a lot now a days.Here is a brief article on Cloud computing Technology. 
cloud+computing+technology

What is Cloud Computing Technology?

Cloud computing refers to a technology wherein data and applications can be maintained and saved online through internet. The benefit is that users can use their personal accounts and applications on internet, that too without installing any software. That means whenever you want, through your browser, you can open and use your files saved on internet. The most common example of cloud computing is Gmail. There are so many users registered and one can send mails by opening their account.

How Cloud Computing Works?

In a cloud computing system, there’s a significant workload shift. Local computers no longer have to do all the heavy lifting when it comes to running applications. The network of computers that make up the cloud handles them instead. Hardware and software demands on the user’s side decrease. The only thing the user’s computer needs to be able to run is the cloud computing systems interface software, which can be as simple as a Web browser, and the cloud’s network takes care of the rest.
A simple example of cloud computing is Yahoo email, Gmail, or Hotmail etc. You don’t need asoftware or a server to use them. All a consumer would need is just an Internet connection and you can start sending emails. The server and email management software is all on the cloud ( Internet) and is totally managed by the cloud service provider Yahoo , Google etc. The consumer gets to use the software alone and enjoy the benefits. The analogy is , ‘If you need milk , would you buy a cow ?’ All the users or consumers need is to get the benefits of using the software or hardware of the computer like sending emails etc. Just to get this benefit (milk) why should a consumer buy a (cow) software /hardware ?
Just to give an example it would mean, instead of installing the Microsoft Word, you can access your word applications via Google docs, available to us on the Internet. Thus this “cloud” manages all your applications in a similar manner.

Advantages of Cloud Computing:

Cloud+computing+advantages
  • 1.Reduced Cost: It helps keep the cost down for both the users and website owners. Also for the users, they can access it from any computer and still have the file they need. For the owners, they do not need to reproduce the software and ship it out. They just rent the server space.
  • 2.More Storage:  They can hold more storage than a personal computer can.  It takes away the need for the upgrading computer memory.
  • 3.Automatically Updated : The server gets the updates and everyone who uses the service gets the updates without updating anything on their end.
  • 4.Mobility: Like most networks it allows users to connect even without their own computers, meaning you can do your work from anywhere in the world as long as you have a internet connection and a computer access.
  • 5.No Downloads: The users do not need to download anything, so that saves time and hard drive space for users. They can just log onto the network.
Disadvantages of Cloud  Computing:
cloud+computing+security+and+privacy
1.Latency: The cloud can be many milliseconds away which are not suitable for real time applications like video conference, online gaming, chatting, instant messaging etc

2.Dependency: Among certain limitations of cloud computing is users’ dependency on the provider. That means internet users don’t have their data stored with them and doesn’t have control over their software.

3.Risk and Insecurity:  there is always insecurity regarding stored documents. Nothing can be recreated if their servers go out of service.

4.Migration Problems: In case the user has to switch to some other provider, there are migration issues. It’s not easy to transfer huge data from one provider to the other.

Cloud Computing Challenges:

Despite its growing influence, concerns regarding cloud computing still remain. Some common challenges are:

Data Protection: 

Data Security is a crucial element that warrants scrutiny. Enterprises fear losing data to competition and the data confidentiality of consumers. In many instances, the actual storage location is not disclosed, adding onto the security concerns. In the existing models, firewalls across data centers (owned by enterprises) protect this sensitive information. In the cloud model, Service providers are responsible for maintaining data security and enterprises would have to rely on them.

Data Recovery and Availability:

  • Appropriate clustering and Fail over
  • Data Replication
  • System monitoring (Transactions monitoring, logs monitoring and others)
  • Maintenance (Runtime Governance)
  • Disaster recovery
  • Capacity and performance management
If, any of the above mentioned services is under-served by a cloud provider, the damage & impact could be severe.

Examples of Cloud computing applications:

  • Major Service providers of cloud computing are Hotmail.com was launched in 1996, it is widely considered as the first cloud computing application. The data is stored at the vendor servers, and users could pay incrementally to increase disk space usage.
  • Google and  Microsoft  provide development platforms that can be accessed with “pay-per-use” billing model. All these services are examples of Cloud computing.
  • Amazon.com was one of the first vendors to provide storage space and computing resources following the cloud computing model.

CONCLUSION:-

Cloud computing is becoming popular now a days.Many organisations already taking advantage of cloud computing.The major draw back of Cloud Computing is security and privacy concern which is being simplified to greater extent as the Technology advances.Cloud Computing is a great milestone with the advancement of Latest Technology lets look forward to what heights this Technology reaches.

Wednesday, December 18, 2013

Understanding JOINs in MySQL and Other Relational Databases

“JOIN” is an SQL keyword used to query data from two or more related tables. Unfortunately, the concept is regularly explained using abstract terms or differs between database systems. It often confuses me. Developers cope with enough confusion, so this is my attempt to explain JOINs briefly and succinctly to myself and anyone who’s interested.

Related Tables

MySQL, PostgreSQL, Firebird, SQLite, SQL Server and Oracle are relational database systems. A well-designed database will provide a number of tables containing related data. A very simple example would be users (students) and course enrollments:
‘user’ table:
idnamecourse
1Alice1
2Bob1
3Caroline2
4David5
5Emma(NULL)
MySQL table creation code:

CREATE TABLE `user` (
 `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(30) NOT NULL,
 `course` smallint(5) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`)
) ENGINE=InnoDB;
The course number relates to a subject being taken in a course table…
‘course’ table:
idname
1HTML5
2CSS3
3JavaScript
4PHP
5MySQL
MySQL table creation code:

CREATE TABLE `course` (
 `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(50) NOT NULL,
 PRIMARY KEY (`id`)
) ENGINE=InnoDB;
Since we’re using InnoDB tables and know that user.course and course.id are related, we can specify a foreign key relationship:

ALTER TABLE `user`
ADD CONSTRAINT `FK_course`
FOREIGN KEY (`course`) REFERENCES `course` (`id`)
ON UPDATE CASCADE;
In essence, MySQL will automatically:
  • re-number the associated entries in the user.course column if the course.id changes
  • reject any attempt to delete a course where users are enrolled.
important: This is terrible database design!
This database is not efficient. It’s fine for this example, but a student can only be enrolled on zero or one course. A real system would need to overcome this restriction — probably using an intermediate ‘enrollment’ table which mapped any number of students to any number of courses.
JOINs allow us to query this data in a number of ways.

INNER JOIN (or just JOIN)

SQL INNER JOINThe most frequently used clause is INNER JOIN. This produces a set of records which match in both the user and course tables, i.e. all users who are enrolled on a course:

SELECT user.name, course.name
FROM `user`
INNER JOIN `course` on user.course = course.id;
Result:
user.namecourse.name
AliceHTML5
BobHTML5
CarlineCSS3
DavidMySQL

LEFT JOIN

SQL LEFT JOINWhat if we require a list of all students and their courses even if they’re not enrolled on one? A LEFT JOIN produces a set of records which matches every entry in the left table (user) regardless of any matching entry in the right table (course):

SELECT user.name, course.name
FROM `user`
LEFT JOIN `course` on user.course = course.id;
Result:
user.namecourse.name
AliceHTML5
BobHTML5
CarlineCSS3
DavidMySQL
Emma(NULL)

RIGHT JOIN

SQL RIGHT JOINPerhaps we require a list all courses and students even if no one has been enrolled? A RIGHT JOIN produces a set of records which matches every entry in the right table (course) regardless of any matching entry in the left table (user):

SELECT user.name, course.name
FROM `user`
RIGHT JOIN `course` on user.course = course.id;
Result:
user.namecourse.name
AliceHTML5
BobHTML5
CarlineCSS3
(NULL)JavaScript
(NULL)PHP
DavidMySQL
RIGHT JOINs are rarely used since you can express the same result using a LEFT JOIN. This can be more efficient and quicker for the database to parse:

SELECT user.name, course.name
FROM `course`
LEFT JOIN `user` on user.course = course.id;
We could, for example, count the number of students enrolled on each course:

SELECT course.name, COUNT(user.name)
FROM `course`
LEFT JOIN `user` ON user.course = course.id
GROUP BY course.id;
Result:
course.namecount()
HTML52
CSS31
JavaScript0
PHP0
MySQL1

OUTER JOIN (or FULL OUTER JOIN)

SQL FULL OUTER JOINOur last option is the OUTER JOIN which returns all records in both tables regardless of any match. Where no match exists, the missing side will contain NULL.
OUTER JOIN is less useful than INNER, LEFT or RIGHT and it’s not implemented in MySQL. However, you can work around this restriction using the UNION of a LEFT and RIGHT JOIN, e.g.

SELECT user.name, course.name
FROM `user`
LEFT JOIN `course` on user.course = course.id

UNION

SELECT user.name, course.name
FROM `user`
RIGHT JOIN `course` on user.course = course.id;
Result:
user.namecourse.name
AliceHTML5
BobHTML5
CarlineCSS3
DavidMySQL
Emma(NULL)
(NULL)JavaScript
(NULL)PHP
I hope that gives you a better understanding of JOINs and helps you write more efficient SQL queries.

Understanding JOINs in MySQL and Other Relational Databases

“JOIN” is an SQL keyword used to query data from two or more related tables. Unfortunately, the concept is regularly explained using abstract terms or differs between database systems. It often confuses me. Developers cope with enough confusion, so this is my attempt to explain JOINs briefly and succinctly to myself and anyone who’s interested.

Related Tables

MySQL, PostgreSQL, Firebird, SQLite, SQL Server and Oracle are relational database systems. A well-designed database will provide a number of tables containing related data. A very simple example would be users (students) and course enrollments:
‘user’ table:
idnamecourse
1Alice1
2Bob1
3Caroline2
4David5
5Emma(NULL)
MySQL table creation code:

CREATE TABLE `user` (
 `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(30) NOT NULL,
 `course` smallint(5) unsigned DEFAULT NULL,
 PRIMARY KEY (`id`)
) ENGINE=InnoDB;
The course number relates to a subject being taken in a course table…
‘course’ table:
idname
1HTML5
2CSS3
3JavaScript
4PHP
5MySQL
MySQL table creation code:

CREATE TABLE `course` (
 `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(50) NOT NULL,
 PRIMARY KEY (`id`)
) ENGINE=InnoDB;
Since we’re using InnoDB tables and know that user.course and course.id are related, we can specify a foreign key relationship:

ALTER TABLE `user`
ADD CONSTRAINT `FK_course`
FOREIGN KEY (`course`) REFERENCES `course` (`id`)
ON UPDATE CASCADE;
In essence, MySQL will automatically:
  • re-number the associated entries in the user.course column if the course.id changes
  • reject any attempt to delete a course where users are enrolled.
important: This is terrible database design!
This database is not efficient. It’s fine for this example, but a student can only be enrolled on zero or one course. A real system would need to overcome this restriction — probably using an intermediate ‘enrollment’ table which mapped any number of students to any number of courses.
JOINs allow us to query this data in a number of ways.

INNER JOIN (or just JOIN)

SQL INNER JOINThe most frequently used clause is INNER JOIN. This produces a set of records which match in both the user and course tables, i.e. all users who are enrolled on a course:

SELECT user.name, course.name
FROM `user`
INNER JOIN `course` on user.course = course.id;
Result:
user.namecourse.name
AliceHTML5
BobHTML5
CarlineCSS3
DavidMySQL

LEFT JOIN

SQL LEFT JOINWhat if we require a list of all students and their courses even if they’re not enrolled on one? A LEFT JOIN produces a set of records which matches every entry in the left table (user) regardless of any matching entry in the right table (course):

SELECT user.name, course.name
FROM `user`
LEFT JOIN `course` on user.course = course.id;
Result:
user.namecourse.name
AliceHTML5
BobHTML5
CarlineCSS3
DavidMySQL
Emma(NULL)

RIGHT JOIN

SQL RIGHT JOINPerhaps we require a list all courses and students even if no one has been enrolled? A RIGHT JOIN produces a set of records which matches every entry in the right table (course) regardless of any matching entry in the left table (user):

SELECT user.name, course.name
FROM `user`
RIGHT JOIN `course` on user.course = course.id;
Result:
user.namecourse.name
AliceHTML5
BobHTML5
CarlineCSS3
(NULL)JavaScript
(NULL)PHP
DavidMySQL
RIGHT JOINs are rarely used since you can express the same result using a LEFT JOIN. This can be more efficient and quicker for the database to parse:

SELECT user.name, course.name
FROM `course`
LEFT JOIN `user` on user.course = course.id;
We could, for example, count the number of students enrolled on each course:

SELECT course.name, COUNT(user.name)
FROM `course`
LEFT JOIN `user` ON user.course = course.id
GROUP BY course.id;
Result:
course.namecount()
HTML52
CSS31
JavaScript0
PHP0
MySQL1

OUTER JOIN (or FULL OUTER JOIN)

SQL FULL OUTER JOINOur last option is the OUTER JOIN which returns all records in both tables regardless of any match. Where no match exists, the missing side will contain NULL.
OUTER JOIN is less useful than INNER, LEFT or RIGHT and it’s not implemented in MySQL. However, you can work around this restriction using the UNION of a LEFT and RIGHT JOIN, e.g.

SELECT user.name, course.name
FROM `user`
LEFT JOIN `course` on user.course = course.id

UNION

SELECT user.name, course.name
FROM `user`
RIGHT JOIN `course` on user.course = course.id;
Result:
user.namecourse.name
AliceHTML5
BobHTML5
CarlineCSS3
DavidMySQL
Emma(NULL)
(NULL)JavaScript
(NULL)PHP
I hope that gives you a better understanding of JOINs and helps you write more efficient SQL queries.

How to backup and download Database using PHP

< ?php $mysqlUserName = 'databaseusername' ; $mysqlPassword = 'databasepassword' ; $mysqlHostNa...