Dynamic key ajax

AJAX is termed as Asynchronous Javascript And XML. Generally, we use following methods in ajax, jquery

  • $.post
  • $.ajax

In this tutorial, we will learn to pass dynamic key in both ajax method

Checkbox validation

Checkbox: It is an element in HTML which can be checked or unchecked. It is grouped on the basis of name.

In this tutorial we will learn about validation of checkbox in javascript and retrieve its value in PHP. Checkbox is classified in two types.

  • Multiple checkbox
  • Single checkbox

1. Multiple checkbox: You can select more than one checkbox, but atleast one checkbox must be selected. In PHP, you have to retrieve its value.

2. Single checkbox: Sometimes you have single checkbox and you have to validate it and retrieve its value in PHP. e.g. You have to agree to terms and condition

Birthday Cakes

You are in charge of the cake for your daughter's birthday and have decided the cake will have one candle for each year of her total age. When she blows out the candles, she'll only be able to blow out the tallest ones. Your task is to find out how many candles she can successfully blow out.

For example, if your daughter is turning 4 years old, and the cake will have 4 candles of height 4, 4, 1, 3, she will be able to blow out 2 candles successfully, since the tallest candles are of height and there are such candles.

Input: An array containing height of candle [4,4,1,3]

Output: Print the number of candles that can be blown out. 2

Explanation: We have one candle of height 1, one candle of height 2, and two candles of height 3. Your daughter only blows out the tallest candles, meaning the candles where height=3. Because there are 2 such candles, we print 2.

Min and max values

Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers.

For example, arr=[1,3,5,7,9] . Our minimum sum is 1+3+5+7 and our maximum sum is 3+5+7+9. We would print 16 24

Copy MySQL Tables

Table can be created using create statement. We can create table using following statement like

create table employee (id int(11) not null auto_increment primary key, name varchar(255));

But sometime we need to create a new table based on the content of old table. We use following statement to create new tables based on old tables.

Regular Expression

It is also expressed as regex. Regular expression is the backbone of form validation. We can validate any form elements using it. Both client side and server side elements can be validated using it. It is used in various programming or scripting language like PHP, JAVASCRIPT, PYTHON, PERL, etc.

It starts with carat(^) and end with dollor($) sign. E.g.

  • /^[0-9]/ means starts with digit ie. 0 to 9, but end can be any thing.
  • /[0-9]$/ means starting can be any character but it should end with digits.
  • /^[0-9]$/ means starting with digit and end with digits.


CAPTCHA stands for Completely Automated Public Turing test to tell Computers and Humans Apart. It is used for prevention of automated script from spammers. Normally it contains some random alphabets and number in image. User has to write same in text box provided.

Monkey man algorithm

A monkey man caught inside a jail. He can jumps across the wall. He can jump 'X' meters, but due to slippery walls he falls 'Y' meters after each jump. To escape from jail, he has to cross 'N' number of walls, where height of each wall is given in an array.

Write a program to find total number of jumps, he has to make, to escape

Input Format

Your function will take three arguments, where:

Argument 1: An integer depicting X, which he can jump

Argument 2: An integer depicting Y, which he falls

Argument 3: An array of N integers having the height of each wall.




Output Format

Your program should return total number of jumps required to escape.

Sample Test Case

Test case 1

Sample Input 10 1 1 10

Sample Output 1


Here monkey man can jump 10 meters high, but slides down by 1 meter. He has 1 wall to jump and the height of the wall is 10 meters. Since he jumps 10 meters in the first attempt he cross the wall easily in the first attempt only.

Test case 2

Sample Input 5 1 2 9 10

Sample Output 5


Here, the monkey man can jump 5 meters high, but slides down by 1 meters. He has 2 walls to jump and the walls are 9 and 10 meters hight respectively.

While crossing the first wall, he takes 2 attempts, because during the first attempt he jumps 5 meters but slides down by 1 meters since he didn't cross the wall. In the next attempt he jumps 5 more meters from that position and this time he doesn't slide because he crossed the wall in this attempt because 4+5=9 and 9 meters is the actual height of the wall.

Similarly, while crossing the second wall, he takes 3 attempts because during his second attempt on this wall, he silides down by 1 meters since 4+5=9 and the height of the wall is 10 meters. During his third attempt, he was able to escape.

Simply upload file

Simplest way to upload file is by using FormData. It is used in key/value pairs to send XMLHttpRequest. Initially FormData used to send all form elements data in key/value pair, but it can be used to send keyed data also. Data sent by FormData is in same format as used in form's submit() method. It sends upload data also, if we use multipart/form-data in form's encoding

Tidy number

Ananya likes to keep things tidy. Her toys are sorted from smallest to largest and pencils are sorted from shortest to longest. One day, when practicing her counting skills, she noticed that some integers, have their digits sorted in non-decreasing order. She calls 8, 123, 555, and 224488 as numbers tidy. Numbers that do not have this property, like 20, 321, 495 and 999990, are not tidy.

She just finished counting all positive integers in ascending order from 1 to N. What was the last tidy number she counted?


The first line of the input gives the number of test cases, T. T lines follow. Each line describes a test case with a single integer N, the last number counted by Ananya.


For each test case, output is the last tidy number counted by Ananya.

1 ≤ T ≤ 100.

Sample Input:


Sample Output:


Resolver IP

Resolver IP is the DNS Server IP of website. It is an optional parameter for OCSP stapling. OCSP stapling itself is an optional parameter but it is highly recommended to use it as it will improve SSL handshake speed of website.

If resolver IP it is not added, it defaults to the server's DNS IP.

You can get Server's DNS IP using following commands in Linux

Command: cat /etc/resolv.conf


options timeout:2 attempts:5
; generated by /sbin/dhclient-script
search ap-south-1.compute.internal
nameserver x.x.x.x

facebook login button

Facebook api gives facility to login on single click. In todays fast life, very less people want to fill credential everytime on any website. So now a days, social login generates maximum market.

Facebook make it very simple to use. To create facebook login in your website, we must have facebook developer account. After it you have to create an app in facebook. In app dashboard you will get an appId, it will be used for facebook login code.