Javascript: User interaction – alert, prompt and confirm

Javascript provides some basic UI methods which are very useful in basics UI operations: alert prompt confirm ALERT: Syntax: alert(message) This method accepts one argument. It outputs a window with the message and stops execution until visitor presses “OK” button. PROMPT: This method accepts two arguments. Syntax: var result = prompt(text[, default]); It outputs a… Read More »

PHP: Auto-loading files in PHP

Let’s discuss why files auto-loading is required specially for beginners. If you have many classes, then you need to write as many require statements as many files you need which does not seems to be nice. The solution is php’s built-in functions: spl_autoload_register and __autoload. Folder Structure: Step 1: Create a file for class A… Read More »

Use any browser window as notepad

Sometimes we just need to write down some information temporary while internet browsing. All you need to do is just type the following code into the browser’s URL bar:

Hit Enter, and start typing away directly in your browser window. All this is possible due to the new contenteditable attribute of HTML5. The contenteditable… Read More »

What is Transmission Control Protocol/Internet Protocol (TCP/IP)?

Transmission Control Protocol/Internet Protocol(TCP/IP) is a set of rules (protocols) governing communications among all computers on the Internet. TCP/IP was developed in 1978 and driven by Bob Kahn and Vint Cerf. TCP/IP is a combination of two main protocols among the suite of protocols: Transmission Control Protocol (TCP) and Internet Protocol (IP). Two things are… Read More »

Difference between Internet and World Wide Web

The terms Internet and World Wide Web(WWW) are often used without much distinction, but these two are not same. The Internet is a global system of interconnected computer networks that use the Internet protocol suite (TCP/IP) to link billions of devices worldwide. In other words, Internet is a network of networks. The World Wide Web… Read More »

MySQL: DISTINCT clause and its use

There are many cases where we get duplicate rows in the result set. We can remove these duplicate rows using DISTINCT clause in the SELECT statement. NOTE: DISTINCT clause must be the first in the SELECT list. Before we start, we need some data on which we perform DISTINCT clause queries. Table: users

Data:… Read More »

MySQL: GROUP BY clause

GROUP BY clause is used to group values from a column(s). Many calculations can be performed on grouped values of that column(s). AGGREGATE functions (like COUNT, SUM, AVG, etc., functions) can be used on the grouped column(s). Let’s discuss GROUP BY in details. But, before we need to create data on which we shall run… Read More »

MySql: Query related to fetch (N)th maximum salary

Hi All, Here we shall discuss some queries related to nth maximum salary among the employees. Let’s create a table “emp” first:

Now, insert some data in table “emp“:

Get (N)th highest salary of employee using LIMIT:

Get (N)th highest salary of employee without using LIMIT:

Other ways to get the… Read More »