Archive

June 2015

Browsing

Micro max launches Micromax Canvas Silver 5 at Rs 17,999

MicroMax has Launched a new canvas silver – Micromax Canvas Silver 5 at Just Rs 17,999 /-. The Sleek Device Thickness is 5.1 mm, end-to-end. The weight of the canvas is 97 grams, the company claims it is lightest smartphone compare than others. At Demo Event, the company even took a dig at its competitor known for churning out sleek devices.

Micromax-Canvas-Silver-5-Phone Developer desks

Specification – Micromax Canvas Silver 5

Thickness       –  5.1 mm
Weight            –  97 grams (lightest smartphone)
Display            –  4.8-inch AMOLED display
Resolution      –  1280 x 720 pixels of resolution.
Android Version – Lollipop 5.0 (Latest Version)
Sim                  – 4G double data from Airtel
Ram                – Qualcomm Snapdragon 410 coupled with 2GB RAM
Internal memory – 16GB
Camera           – 8-megapixel rear snapper
Camera          – 5MP front-facing camera

The Canvas 5 sports a 4.8-inch AMOLED display with 1280 x 720 pixels of resolution. The smartphone runs the latest Android 5.0 and comes with a 4G double data offer from Airtel.

Micromax-Canvas-Silver-5-Phone Developer desks

Micromax Canvas Silver 5 is powered by a Qualcomm Snapdragon 410 coupled with 2GB RAM. One will find 16GB onboard storage, and the expandable memory slot and dual SIM abilities have been given a miss. Obviously, the lightweight and sleekness comes at a price.

On the camera front, it gets an 8-megapixel rear snapper. The 8MP Sony IMX219 comes stacked with CMOS sensor. The camera also comes with the professional mode. For selfie lovers, Micromax Canvas Silver 5 also gets a 5MP front-facing camera.

Micromax Canvas Silver 5 will feature NXP Smart power amplifier and Dirac HD Sound. The connectivity options include 3G, 4G LTE, Wi-Fi, Bluetooth 4.0 and GPS.

A 2000mAh battery completes the package. The company has promised improved after sales service with guaranteed 7-day service, and Hugh Jackman will be promoting the smartphone. – Micromax Canvas Silver 5

Google and Mozilla are Joined to Create Web Assembly Fastest Browser in the World

Developers at Google, Apple, Microsoft and Mozilla are Working to Create WebAssembly (a.k.a wasm) Fastest browser , a bytecode for use in the browsers of the future that promises up to 20 times faster performance.

A new byte-code (a machine-readable instruction set that’s quicker for browsers to load than high-level languages) is used to create the Web Assembly Fastest browser Project and it make more efficient to both the Desktop and Mobile versions browsers to parse than the full source code of a Web page or app.

JavaScript is currently used for browsers to write code and enable functionality on websites such as dynamic and forum content. But the browser fastest improvement in based on the load times via asm.js, Now the byte code is based faster system like .NET.

Proposed as a standard that could one day be implemented in all browsers, Web Assembly Fastest browser could bring app-like performance to Web content and apps.

Until Web Assembly Fastest browser becomes more widely available, the coalition of developers plan to bridge the gap with a JS script that will convert wasm to Mozilla’s widely supported asm.js for browsers that don’t support the new format yet.

WebAssembly is still very much in its early days: neither its specifications nor its high level design have been finalized yet. However, with major browser developers behind the project, it should see the light of day soon enough.

Simple JavaScript Calculator code with example

Here we going to learn simple javascript calculator code. Generally for beginners, they think its difficult to writing code for calculator. But its not that much difficult in the codding.
We just know only simple things in function like add, sub, mutli and div functions in php. If you know that then the calci code is very simple, you may try it now
javascript calculator code

Step 1:
First create html file

<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Simple JavaScript Calculator</title>

</head>
 
<body>
<h2>Simple JavaScript Calculator</h2>
 
<form name="calcForm">
<table>
<tr>
  <td colspan="4"><input type="text" name="display"
                         style="text-align:right"></td>
</tr>
<tr>
  <td><input type="button" name="btn1" value="1"
             onclick="calcForm.display.value += '1'"></td>
  <td><input type="button" name="btn2" value="2"
             onclick="calcForm.display.value += '2'"></td>
  <td><input type="button" name="btn3" value="3"
             onclick="calcForm.display.value += '3'"></td>
  <td><input type="button" name="btnAdd" value="+"
             onclick="calcForm.display.value += ' + '"></td>
</tr>
<tr>
  <td><input type="button" name="btn4" value="4"
             onclick="calcForm.display.value += '4'"></td>
  <td><input type="button" name="btn5" value="5"
             onclick="calcForm.display.value += '5'"></td>
  <td><input type="button" name="btn6" value="6"
             onclick="calcForm.display.value += '6'"></td>
  <td><input type="button" name="btnSub" value="-"
             onclick="calcForm.display.value += ' - '"></td>
</tr>
<tr>
  <td><input type="button" name="btn7" value="7"
             onclick="calcForm.display.value += '7'"></td>
  <td><input type="button" name="btn8" value="8"
             onclick="calcForm.display.value += '8'"></td>
  <td><input type="button" name="btn9" value="9"
             onclick="calcForm.display.value += '9'"></td>
  <td><input type="button" name="btnMul" value="x"
             onclick="calcForm.display.value += ' * '"></td>
</tr>
<tr>
  <td><input type="button" name="btnClear"
             value="C" onclick="calcForm.display.value = ''"></td>
  <td><input type="button" name="btn0" value="0"
             onclick="calcForm.display.value += '0'"></td>
  <td><input type="button" name="btnEqual" value="="
             onclick="calcForm.display.value = eval(calcForm.display.value)"></td>
  <td><input type="button" name="btnDiv" value="/"
             onclick="calcForm.display.value += ' / '"></td>
</tr>
</table>
</form>
 
</body>
</html>

Step 2: Add Css file for the page

input {
       font-family: consola, monospace;
       color: blue;
     }
     td {
       margin-left: auto;
       margin-right: auto;
       text-align: center;
     }
     table {
       border: thick solid;
     }

Step 3: Add javascript for the calci function.

window.onload = initClock;
 
function initClock() {
  var now = new Date();
  var hr  = now.getHours();
  var min = now.getMinutes();
  var sec = now.getSeconds();
  if (min < 10) min = "0" + min;  // insert a leading zero
  if (sec < 10) sec = "0" + sec;
  document.getElementById('clockDisplay').innerHTML
        = "Time is " + hr + ":" + min + ":" + sec;
  setTimeout('initClock()', 500);
}

Here the Demo –

See the Pen KpvNZR by Rajaseka G (@SekarG) on CodePen.

Calendar Code javascript For form using php

Calendar Code javascript For form using php
Here we create Calendar Code javascript For form using php
Step 1:
Create Html Code for calendar as calendar.html

<!DOCtype html>
<!-- JSCalendarSimple.html -->
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>JavaScript Calendar</title>
  <link rel="stylesheet" href="JSCalendarSimple.css">
  <script src="JSDateUtil.js"></script>
  <script src="JSCalendarSimple.js"></script>
</head>
 
<body>
  <h2>Calendar</h2>
 
  <form id="frmCalendar">
    <select id="selMonth">
      <option>January</option>
      <option>February</option>
      <option>March</option>
      <option>April</option>
      <option>May</option>
      <option>June</option>
      <option>July</option>
      <option>August</option>
      <option>September</option>
      <option>October</option>
      <option>November</option>
      <option>December</option>
    </select>
    <input type="text" id="tfYear" size="4" maxlength="4"><br><br>
 
    <input type="button" id="btnPrevYear"  value=" <<  ">
    <input type="button" id="btnPrevMonth" value="  <  ">
    <input type="button" id="btnToday"     value="Today">
    <input type="button" id="btnNextMonth" value="  >  ">
    <input type="button" id="btnNextYear"  value="  >> "><br><br>
 
    <table id="tableCalendar"></table>
  </form>
</body>
</html>

Step 2:
Create Css file for calendar style.css

/* JSCalendarSimple.css */
.today {
  background: gray;
  color: white;
  font-weight: bold
}
 
.sunday {
  color: red
}
 
input, select {
  font-family: Consolas, monospace;
  font-weight: bold;
  color: blue
}
 
table {
  font-family: Consolas, monospace;
  text-align: right;
  border-collapse:collapse;
  border: 1px solid black
}
 
td, th {
  padding: 3px 5px;
  border: 1px solid black
}

Step 3 :
Create dateui.js file for get current date

// DateUtil.js
// Return true if the given year is a leap year
function isLeapYear(year) {
   return ((year % 4) === 0 && ((year % 100) !== 0 || (year % 400) === 0));
}
 
// Return the number of days in the given month (1-12) of the year (xxxx)
function getDaysInMonth(year, month) {
   if (month === 2) {
      if (isLeapYear(year)) {
         return 29;
      } else {
         return 28;
      }
   } else if ((month === 1) || (month === 3) || (month === 5) || (month === 7)
       || (month === 8) || (month === 10) || (month === 12)) {
      return 31;
   } else {
      return 30;
   }
}
 
// Get the day of the week given year, month (1-12) and day (1-31)
function getDayInWeek(year, month, day) {
  var weekdays = ["Sunday", "Monday", "Tuesday", "Wednesday",
                  "Thursday", "Friday", "Saturday"];
  var theDate = new Date(year, month-1, day);
  return weekdays[theDate.getDay()];
}

Step 4:

Create calendarjs.js file for javascript function

window.onload = init;
 
// Global variables
// Today's year, month(0-11) and day(1-31)
var thisYear, thisMonth, thisDay;
 
// The "onload" handler, run after the page is fully loaded.
function init() {
   setToday();
 
   document.getElementById("selMonth").onchange = setMonth;
   document.getElementById("tfYear").onchange   = setYear;
 
   document.getElementById("btnPrevYear").onclick  = setPreviousYear;
   document.getElementById("btnPrevMonth").onclick = setPreviousMonth;
   document.getElementById("btnNextMonth").onclick = setNextMonth;
   document.getElementById("btnNextYear").onclick  = setNextYear;
   document.getElementById("btnToday").onclick     = setToday;
 
   document.getElementById("frmCalendar").onsubmit = function() {
      return false; // Stay in current page, do not refresh.
   }
}
 
// Set thisYear, thisMonth, thisDay to Today
// So that we can highlight today on the calendar
function setToday() {
   var now   = new Date();         // today
   thisDay   = now.getDate();      // 1-31
   thisMonth = now.getMonth();     // 0-11
   thisYear  = now.getFullYear();  // 4-digit year
 
   document.getElementById("selMonth").selectedIndex = thisMonth;
   document.getElementById("tfYear").value = thisYear;
   printCalendar(thisYear, thisMonth);
}
 
// Print the month-calendar for the given 4-digit year and month (0-11)
function printCalendar(year, month) {
   var daysInMonth = getDaysInMonth(year, month + 1);  // number of days
   var firstDayOfMonth = (new Date(year, month, 1)).getDay();  // 0-6 for Sun to Sat
 
   var tableInnerHTML = "<tr><th class='sunday'>Sun</th><th>Mon</th><th>Tue</th>"
        + "<th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th></tr>";
 
   var tdCellCount = 0;  // count of table's <td> cells
   if (firstDayOfMonth !== 0) {  // Leave these cells blank
      tableInnerHTML += "<tr><td colspan='" + firstDayOfMonth + "'></td>";
      tdCellCount = firstDayOfMonth;
   }
   for (var day = 1; day <= daysInMonth; day++) {
      if (tdCellCount % 7 === 0) {  // new table row
         tableInnerHTML += "<tr>";
      }
 
      // Use different style classes for today, sunday and other days
      if ((day === thisDay) && (month === thisMonth) && (year === thisYear)) {
         tableInnerHTML += "<td class='today'>" + day + "</td>";
      } else if (tdCellCount % 7 === 0) {
         tableInnerHTML += "<td class='sunday'>" + day + "</td>";
      } else {
         tableInnerHTML += "<td>" + day + "</td>";
      }
 
      tdCellCount++;
      if (tdCellCount % 7 === 0) {
         tableInnerHTML += "</tr>";
      }
   }
   // print the remaining cells and close the row
   var remainingCells = 7 - tdCellCount % 7;
   if (remainingCells < 7) {
      tableInnerHTML += "<td colspan='" + remainingCells + "'></td></tr>";
   }
 
   document.getElementById("tableCalendar").innerHTML = tableInnerHTML;
}
 
// The onchange handler for the month selection
function setMonth() {
   var year  = document.getElementById("tfYear").value;
   var month = document.getElementById("selMonth").selectedIndex;
   printCalendar(year, month);
}
 
// The onchange handler for the year textfield
function setYear() {
   var year  = document.getElementById("tfYear").value;
   var month = document.getElementById("selMonth").selectedIndex;
   if (isValidYear(year)) {
      printCalendar(year, month);
   }
}
 
// Validate the year
function isValidYear(year) {
   if (year < 1 || year > 9999) {
      alert ("Sorry, the year must be between 1 and 9999.");
      document.getElementById("tfYear").focus();
      return false;
   } else {
      return true;
   }
}
 
// The onclick handler for the previous-year button
function setPreviousYear() {
   var year  = document.getElementById("tfYear").value;
   var month = document.getElementById("selMonth").selectedIndex;
   year--;
   if (isValidYear(year)) {
      document.getElementById("tfYear").value = year;
      printCalendar(year, month);
   }
}
 
// The onclick handler for the next-year button
function setNextYear() {
   var year  = document.getElementById("tfYear").value;
   var month = document.getElementById("selMonth").selectedIndex;
   year++;
   if (isValidYear(year)) {
      document.getElementById("tfYear").value = year;
      printCalendar(year, month);
   }
}
 
// The onclick handler for the previous-month button
function setPreviousMonth() {
   var year  = document.getElementById("tfYear").value;
   var month = document.getElementById("selMonth").selectedIndex;
   if (month === 0) {
      month = 11;
      year--;
   } else {
      month--;
   }
   if (isValidYear(year)) {
      document.getElementById("tfYear").value = year;
      document.getElementById("selMonth").selectedIndex = month;
      printCalendar(year, month);
   }
}
 
// The onclick handler for the next-year button
function setNextMonth() {
   var year  = document.getElementById("tfYear").value;
   var month = document.getElementById("selMonth").selectedIndex;
   if (month === 11) {
      month = 0;
      year++;
   } else {
      month++;
   }
   if (isValidYear(year)) {
      document.getElementById("tfYear").value = year;
      document.getElementById("selMonth").selectedIndex = month;
      printCalendar(year, month);
   }
}

Thats it, enjoy the code.

Demo –

See the Pen jPLVqG by Rajaseka G (@SekarG) on CodePen.

A Date Picker using JavaScript with demo

A Date Picker using JavaScript with demo

Here we go to create JavaScript code for A Date Picker

Step 1:
Create Files date.php

<!DOCTYPE html>

<html lang="en">
<head>
  <meta charset="utf-8">
  <title>A Date Chooser</title>
  <script src="dateui.js"></script>
  <script src="datepicker.js"></script>
</head>
<body>
  <h2>A Date Chooser</h2>
  <form id="theForm">
    Year: <input type="text" name="year" id="year" size="4" maxLength="4">
    Month: <select name="month" id="month">
      <option id="month1" value="1">Jan</option>
      <option id="month2" value="2">Feb</option>
      <option id="month3" value="3">Mar</option>
      <option id="month4" value="4">Apr</option>
      <option id="month5" value="5">May</option>
      <option id="month6" value="6">Jun</option>
      <option id="month7" value="7">Jul</option>
      <option id="month8" value="8">Aug</option>
      <option id="month9" value="9">Sep</option>
      <option id="month10" value="10">Oct</option>
      <option id="month11" value="11">Nov</option>
      <option id="month12" value="12">Dec</option>
    </select>
    Day: <select name="day" id="day"></select>&nbsp;
    <input type="text" name="dayInWeek" id="dayInWeek" readonly>&nbsp;
    <input type="button" id="btnNow" value="Now">
  </form>
</body>
</html>

Step 2:
Create dateui.js file

// Dateuijs
// Return true if the given year is a leap year
function isLeapYear(year) {
   return ((year % 4) === 0 && ((year % 100) !== 0 || (year % 400) === 0));
}
 
// Return the number of days in the given month (1-12) of the year (xxxx)
function getDaysInMonth(year, month) {
   if (month === 2) {
      if (isLeapYear(year)) {
         return 29;
      } else {
         return 28;
      }
   } else if ((month === 1) || (month === 3) || (month === 5) || (month === 7)
       || (month === 8) || (month === 10) || (month === 12)) {
      return 31;
   } else {
      return 30;
   }
}
 
// Get the day of the week given year, month (1-12) and day (1-31)
function getDayInWeek(year, month, day) {
  var weekdays = ["Sunday", "Monday", "Tuesday", "Wednesday",
                  "Thursday", "Friday", "Saturday"];
  var theDate = new Date(year, month-1, day);
  return weekdays[theDate.getDay()];
}

Explanation

      The function isLeapYear(year) returns true if year is a leap year.
      The function getDaysInMonth(year, month) returns the number of days in the given month (1-12) of the year (4-digit). Take note that JavaScript represents a month in the range of 0-11 (for Jan to Dec), instead of 1-12.
      The function getDayInWeek(year, month, day) returns the day of the week (Sunday to Saturday). It constructs a built-in object Date with the given year, month and day, and use the getDay() function of the Date object to obtain the day of the week in the range of 0-6.

Step 3:
Create datepicker.js file

window.onload = init;
 
// Global variables for the currently selected year, month and day
var selectedYear;   // 4-digit year
var selectedMonth;  // 1 to 12 for Jan to Dec
var selectedDay;    // 1 to 31
 
// The "onload" handler, runs after the page is fully loaded.
function init() {
   setToday();      // Set global variables
   updateDisplay();
 
   document.getElementById("year").onchange = function() {
      selectedYear=this.value;
      // In case the current day is no longer valid for non-leap year,
      // e.g., 29 Feb 2001. Set to the last year of the month
      updateDayDisplay();
      updateDayInWeekDisplay();
   }
 
   document.getElementById("month").onchange = function() {
      selectedMonth=this.value;
      // In case the current day is no longer valid, e.g., 31 in Feb.
      // Set to the last year of the month
      updateDayDisplay();
      updateDayInWeekDisplay()
   }
 
   document.getElementById("day").onchange = function() {
      selectedDay=this.value;
      updateDayInWeekDisplay();
   }
 
   document.getElementById("btnNow").onclick = function() {
      setToday();
      updateDisplay();
   }
}
 
// Set global variable selectedYear, selectedMonth and selectedDay
// to today.
function setToday() {
   var now = new Date();
   selectedYear = now.getFullYear();   // 4-digit year
   selectedMonth = now.getMonth() + 1; // 1 to 12 for Jan to Dec
   selectedDay = now.getDate();        // 1 to 31
}
 
// Update the year, month, day and day-in-week display according
// to the selected values.
function updateDisplay() {
   // Set the value of text fields and select the correct options
   document.getElementById("year").value = selectedYear;
   updateMonthDisplay();
   updateDayDisplay();
   updateDayInWeekDisplay();
}
 
function updateMonthDisplay() {
   document.getElementById("month" + selectedMonth).selected = true;
}
 
function updateDayDisplay() {
   var elm = document.getElementById("day");
   elm.innerHTML = "";
   var daysInMonth = getDaysInMonth(selectedYear, selectedMonth);
   // The selectedDay is no longer valid. Set to the last day of month
   if (selectedDay > daysInMonth) {
      selectedDay = daysInMonth;
   }
   var options = "";
   for (var day = 1; day <= daysInMonth; day++) {
      options += "<option value='" + day + "'";
      if (day === selectedDay) {
         options += " selected";
      }
      options += ">" + day + "</option>";
   }
   elm.innerHTML = options;
}
 
function updateDayInWeekDisplay() {
   document.getElementById("dayInWeek").value
      = getDayInWeek(selectedYear, selectedMonth, selectedDay);
}

Explanation:
The form consists of 5 input elements: a text field for the year, pull-down menus for month and day, a read-only text field for the day of the week, and a button to set the display to today. When the page is first loaded, the current date is display. If you change the year, month or day, the day of the week changes. If you change the year or month, the options in day adjust automatically, e.g., there are 28/29 days in Feb for non-leap and leap years.

Enjoy the code here

Demo Here –

See the Pen dozOPB by Rajaseka G (@SekarG) on CodePen.

Multi select filter option for mysql data using ajax

Hello Developers, Initially I’m trying to developer e-commerce website using php, css and mysql. I developed with designs and templates. Created mysql database and all data’s are fetched from database. Finally the important thing in the e-commerce website is filter concept. So many of them come with filter concepts and face some difficulties, So here We learn about Multi select filter option using ajax.

First We are going the to create database with data

Step 1:
Create products table for data

CREATE TABLE IF NOT EXISTS `products` (
`id` int(11) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `products` varchar(100) DEFAULT NULL,
  `brands` varchar(100) DEFAULT NULL,
  `price` varchar(100) DEFAULT NULL,
  `color` varchar(1000) DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

Step 2:
Insert data into the table

INSERT INTO `products` (`id`, `name`, `products`, `brands`, `price`, `color`) VALUES
(1, 'product 1', 'Computer', 'Apple', '10000', '1'),
(2, 'product 2', 'Laptop', 'Apple', '30000', '0'),
(3, 'product 3', 'pendrive', 'Apple', '10000', '0'),
(4, 'product 4', 'Computer', 'Apple', '20000', '0'),
(5, 'product 5', 'Computer', 'hp', '20000', '1'),
(6, 'product 6', 'Laptop', 'Apple', '30000', '0'),
(7, 'product 7', 'Laptop', 'hp', '20000', '0'),
(8, 'product 8', 'pendrive', 'Apple', '10000', '1'),
(9, 'product 9', 'pendrive', 'hp', '20000', '1'),
(10, 'product 10', 'pendrive', 'lenovo', '20000', '1'),
(11, 'product 11', 'Laptop', 'lenovo', '20000', '1'),
(12, 'product 12', 'Computer', 'lenovo', '20000', '1'),
(13, 'product 13', 'Computer', 'Apple', '20000', '0'),
(14, 'product 14', 'Computer', 'Apple', '10000', '1'),
(15, 'product 15', 'Computer', 'Apple', '30000', '0'),
(16, 'product 16', 'Computer', 'Apple', '30000', '1'),
(17, 'product 17', 'Laptop', 'Apple', '20000', '0'),
(18, 'product 18', 'Laptop', 'Apple', '20000', '1'),
(19, 'product 19', 'Laptop', 'Apple', '10000', '0'),
(20, 'product 20', 'Laptop', 'Apple', '10000', '1'),
(21, 'product 21', 'pendrive', 'Apple', '20000', '1'),
(22, 'product 22', 'pendrive', 'Apple', '20000', '1'),
(23, 'product 23', 'pendrive', 'Apple', '30000', '1'),
(24, 'product 24', 'pendrive', 'Apple', '30000', '1'),
(25, 'product 13', 'Computer', 'hp', '20000', '0'),
(26, 'product 14', 'Computer', 'hp', '10000', '1'),
(27, 'product 15', 'Computer', 'hp', '10000', '0'),
(28, 'product 16', 'Computer', 'hp', '30000', '1'),
(29, 'product 25', 'Computer', 'hp', '30000', '1'),
(30, 'product 17', 'Laptop', 'hp', '20000', '0'),
(31, 'product 18', 'Laptop', 'hp', '30000', '1'),
(32, 'product 19', 'Laptop', 'hp', '30000', '0'),
(33, 'product 20', 'Laptop', 'hp', '10000', '1'),
(34, 'product 27', 'Laptop', 'hp', '10000', '1'),
(35, 'product 21', 'pendrive', 'hp', '20000', '1'),
(36, 'product 22', 'pendrive', 'hp', '10000', '1'),
(37, 'product 23', 'pendrive', 'hp', '10000', '1'),
(38, 'product 24', 'pendrive', 'hp', '30000', '1'),
(39, 'product 28', 'pendrive', 'hp', '30000', '1'),
(40, 'product 13', 'Computer', 'lenovo', '20000', '0'),
(41, 'product 14', 'Computer', 'lenovo', '10000', '1'),
(42, 'product 15', 'Computer', 'lenovo', '10000', '0'),
(43, 'product 16', 'Computer', 'lenovo', '30000', '1'),
(44, 'product 25', 'Computer', 'lenovo', '30000', '1'),
(45, 'product 17', 'Laptop', 'lenovo', '20000', '0'),
(46, 'product 18', 'Laptop', 'lenovo', '30000', '1'),
(47, 'product 19', 'Laptop', 'lenovo', '30000', '0'),
(48, 'product 20', 'Laptop', 'lenovo', '10000', '1'),
(49, 'product 27', 'Laptop', 'lenovo', '10000', '1'),
(50, 'product 21', 'pendrive', 'lenovo', '20000', '1'),
(51, 'product 22', 'pendrive', 'lenovo', '10000', '1'),
(52, 'product 23', 'pendrive', 'lenovo', '10000', '1'),
(53, 'product 24', 'pendrive', 'lenovo', '30000', '1'),
(54, 'product 28', 'pendrive', 'lenovo', '30000', '1');

Step 3:
Create index file with data and filter functionality named as Index.php

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>AJAX Search filter demo</title>
</head>
<body>
<h1>Demo</h1>
<table id="employees">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>products</th>
<th>brands</th>
<th>Price</th>
<th>colors</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div id="filter">


<h3>Products </h3>
<div>
<input type="radio" id="language" name="brand" value="Computer">
Computer<br/>
<input type="radio" id="language2" name="brand" value="Laptop">
Laptop<br/>
<input type="radio" id="language3" name="brand" value="pendrive">
pendrive
</div>

<h3>Brands</h3>
<div>
 <input type="radio" name="apple" id="car" value="apple">Apple<br/>
  <input type="radio" name="apple" id="car1" value="hp">hp<br/>
  <input type="radio" name="apple" id="car3" value="lenovo">lenovo
</div>

<h3>Price </h3>
<div>
<input type="radio" id="nights" name="price" value="price1">
10000<br/>
<input type="radio" id="nights1" name="price" value="price2">
20000<br/>
<input type="radio" id="nights2" name="price" value="price3">
30000
</div>

</div>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
function makeTable(data){
var tbl_body = "";
$.each(data, function() {
var tbl_row = "";
$.each(this, function(k , v) {
tbl_row += "<td>"+v+"</td>";
})
tbl_body += "<tr>"+tbl_row+"</tr>";
})
return tbl_body;
}
function getEmployeeFilterOptions(){
var opts = [];
$checkboxes.each(function(){
if(this.checked){
opts.push(this.value);
}
});
return opts;
}
function updateEmployees(opts){
$.ajax({
type: "POST",
url: "search.php",
dataType : 'json',
cache: false,
data: {filterOpts: opts},
success: function(records){
$('#employees tbody').html(makeTable(records));
}
});
}
var $checkboxes = $("input:radio");
$checkboxes.on("change", function(){
var opts = getEmployeeFilterOptions();
updateEmployees(opts);
});
updateEmployees();
</script>

<script>
$(document).ready(function(){
    $('input[type="checkbox"]').click(function(){
        if($(this).attr("value")=="apple"){
           $("#car3").css("background-color", "yellow");
        }
</script>

</body>
</html>

Explanation

For html page create table and fetched the data from database show it.
Ajax function for search and update the database filter concept

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
function makeTable(data){                   // create table get data from database
var tbl_body = "";                          // table body
$.each(data, function() {                   // table data
var tbl_row = "";
$.each(this, function(k , v) {
tbl_row += "<td>"+v+"</td>";               // table row
})
tbl_body += "<tr>"+tbl_row+"</tr>";
})
return tbl_body;
}
function getEmployeeFilterOptions(){     // get filter options value
var opts = [];
$checkboxes.each(function(){             // this function select when radio button is clicked
if(this.checked){
opts.push(this.value);                 // get check box values
}
});
return opts;
}
function updateEmployees(opts){        // update the filter value using ajax
$.ajax({
type: "POST",                          //       POST method
url: "search.php",                      // search. page send data using json
dataType : 'json',
cache: false,
data: {filterOpts: opts},
success: function(records){
$('#employees tbody').html(makeTable(records));
}
});
}
var $checkboxes = $("input:radio");          // check radio button is clicked
$checkboxes.on("change", function(){
var opts = getEmployeeFilterOptions();    // update the database 
updateEmployees(opts);
});
updateEmployees();
</script>

Explanation

When radio button is checked, then tha value of radio button is passed to the search.php page using ajax page call. Data send to the search.php page using post method.

Step 3:
Create search.php page for select data from the database

<?php
$pdo = new PDO('mysql:host=localhost;dbname=elect', 'root', '');    // connect database
$select = 'SELECT *';
$from = ' FROM products';                 // Select data from database
$where = ' WHERE TRUE';                // where condition
$opts = isset($_POST['filterOpts'])? $_POST['filterOpts'] : array(''); 
if (in_array("hp", $opts)){        // in_array function is used the search the values in array
$where .= " AND brands = 'hp'";      // if hp is presend then where brands = hp
}
if (in_array("lenovo", $opts)){
$where .= " AND brands = 'lenovo'";   // same search functionality repeats
}
if (in_array("apple", $opts)){
$where .= " AND brands = 'Apple'";
}
if (in_array("Computer", $opts)){
$where .= " AND products = 'Computer'";
}
if (in_array("Laptop", $opts)){
$where .= " AND products = 'Laptop'";
}
if (in_array("pendrive", $opts)){
$where .= " AND products = 'pendrive'";
}
if (in_array("price1", $opts)){
$where .= " AND price = '10000'";
}
if (in_array("price2", $opts)){
$where .= " AND price = '20000'";
}
if (in_array("price3", $opts)){
$where .= " AND price = '30000'";
}
$sql = $select . $from . $where;
$statement = $pdo->prepare($sql);
$statement->execute();
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
$json = json_encode($results);   // get the all data using json method
echo($json);
?>

Using In_array functions, the query search the value if the value is present it set the WHERE condition and print the data.

So its very Easy to set the Filter Concept to all the products, You may try and enjoy the Code.

Step 5: Style sheet, Include this code for CSS

body {
padding: 10px;
  width: 950px;
}
h1 {
margin: 0 0 0.5em 0;
color: #343434;
font-weight: normal;
font-family: 'Ultra', sans-serif;
font-size: 36px;
line-height: 42px;
text-transform: uppercase;
text-shadow: 0 2px white, 0 3px #777;
}
h2 {
margin: 1em 0 0.3em 0;
color: #343434;
font-weight: normal;
font-size: 30px;
line-height: 40px;
font-family: 'Orienta', sans-serif;
}
#employees {
font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
font-size: 12px;
background: #fff;
margin: 15px 25px 0 0;
border-collapse: collapse;
text-align: center;
float: right;
width: 700px;
}
#employees th {
font-size: 14px;
font-weight: normal;
color: #039;
padding: 10px 8px;
border-bottom: 2px solid #6678b1;
}
#employees td {
border-bottom: 1px solid #ccc;
color: #669;
padding: 8px 10px;
}
#employees tbody tr:hover td {
color: #009;
}
#filter {
float:left;
}

Multi select filter option for mysql data using ajax

Download

5 Features We Going To Miss In Windows 10

Features we will Miss In Windows 10

We know that Windows 10 of Microsoft gonna release next month(July). So we are exiting about the new features but you know what we were really miss the features in windows 7. Now some of these features might not be useful to today’s generation, but we really value our floppy drives and the infamous media center. Below is the list of 5 major features we will be waving goodbye to when we switch over to windows 10 next month :

1. Floppy Drive Support
download (2)

I’m a 90’s kid and I still have a good collection of floppy disks and even floppy installations disks for Windows 95. Although I’ve backed up the precious 1.44 MB from each of my disks I still sometimes like going through them for old times sakes. Sadly Windows 10 will no longer support internal or external floppy drives.

2.DVD Playback

5 Features We Going To Miss In Windows 10

You can no longer simply plug in your favorite DVD and watch it on a Windows 10 desktop. Windows will no longer support playback for DVD’s by default, but the good news is you can still use a disk drive right. You can always use VLC player even if you’re storing videos on floppy disks.

3. Widgets
5 Features We Going To Miss In Windows 10

Remember that cool CPU performance meter, the analog clock and the weather widget. Well you can’t use them anymore, technically widgets were removed in Windows 8 itself so not finding them on Windows 10 is evident. The reason for that is that Windows 10 already has a start menu with live tiles which cancels out the need for those widgets.

4.Windows Media Center
5 Features We Going To Miss In Windows 10

Windows media center has been a great tool for organizing both video and music collections. We’ve also used it for streaming and its been passed on to Windows 8 as well but unfortunately in windows 10 it will no longer be available. Microsoft has decided that we should all use Xbox Music and the Windows Media player, its unsure that in the near future we will see an updated version of the media center.

5. Optional Windows Updates
5 Features We Going To Miss In Windows 10

Most of us will end up receiving the Windows 10 home edition or the standard edition and we will no longer be able to choose when to update our desktops and laptops. Microsoft will now push updates to Windows 10 users and not let you opt out or even install them later. As soon as a system update is released, your desktop or laptop will download and install that update. The only exemption made for automatic updates is for Windows 10 Pro and Enterprise users who can have more administrative privileges but the good news is that someone will probably be able to port a patch from those editions into the standard ones once the OS is released.

Facebook Launched A New Way to Send a Location in Messenger

Facebook Launched A New Way to Send a Location in Messenger , Now you can choose to explicitly send a map of your location or another particular place as a separate message.

To get started, just tap the More icon or the location pin at the bottom of your screen. If you want to tell a friend which restaurant to meet you at, search for the restaurant and send a map of where it is. If you’re running late, send a map of where you are to your friend to let him or her know how far away you are.

 

Facebook Launched A New Way to Send a Location in Messenger

 

 

With this update, you have full control over when and how you share your location information. You only send a location when you tap on the location pin and then choose to send it as a separate message. You can also share a location—like a meeting spot—even if you’re not there.

Facebook Launched A New Way to Send a Location in Messenger

Sending a location is completely optional. Nothing is changing about how we receive your location information:

  • As always, Messenger doesn’t get any location information from your device unless you enable location services for the app.
  • Messenger does not get location information from your device in the background—only each time you select a location and tap Send when you use the Messenger app. We are not requesting any new permissions for your information.

Source – FB-newsroom

 

 

Microsoft Windows 10 launch on July 29

Microsoft has finally announced July 29 as the exact date of Windows 10 launch. Existing Windows customers will get a free upgrade, Windows 10 has many new features and upgrades including Start menu, new browser, cortana and much more. Watch the following Windows 10 feature highlights video to learn more.

Some Features of Windows

The Start Menu

The Start Menu is back with faster startup and resume. Windows 10 is secure with a free anti-malware protection, Windows Defender. Also considered secure than other platforms since it is the only platform with a commitment to deliver free ongoing security updates. These security updates will be supported till the lifetime of the device.

Windows Hello
Biometric authentication now with easier integration through face, iris, or finger, this is for instant recognition. It lets you log in without a password and will give an instant and secure access to your Windows 10 device.
Sync through OneDrive 
 The designs of Music, People, Maps, Mail, Calendar apps have been updated. Sync with OneDrive allows you to start and save something on one device and continue it on another.
Office on Windows
 The creation of Word, Excel, and PowerPoint has become easier with touch-first experience. The touch-first controls in Excel allows you to easily create and edit word documents, deliver PowerPoint presentations, create and update spreadsheets in Excel without using keyboard and mouse.
Microsoft Edge
Microsoft Edge is a new browser with features such as built-in commenting system on the web, sharing comments and a reading view that makes easier and faster reading of websites content
Cortana
It is the world’s first personal digital assistant. Cortana provides recommendation, fast access to information, reminders, etc. Cortana experience is not only limited to PC, but will also help on your smartphone.
Free Windows 10 upgrade can now be reserved through a simple reservation process. Find the following icon in your system tray at the bottom of your screen
5 Features We Going To Miss In Windows 10
and click on it. Next step, complete the registration process.
5 Features We Going To Miss In Windows 10
Enjoy the windows 10 features in your system

Facebook Lite is a lightweight Android app for emerging markets

Facebook Lite is a lightweight Android app for emerging markets – mark zuckerberg (Chairman & CEO of Facebook)

Now days, Most of our hours(may be minutes) we spend our time with facebook. Initially we used to access facebook in computer or laptops, but now every one used mobile phones(android, iphone models), but we bother about data consumptive while using facebook, the mobile app is data consumptive.

For the emerging market, Facebook has launched Facebook Lite, which will strip away much of the frills for those in emerging markets.

Built for Android, Facebook Lite includes core experiences like News Feed, status updates, photos and notifications. At less than 1MB, the app is meant to load and update quickly.

Facebook says Lite was developed for geographies with slow connectivity, with the purpose of “giving people a reliable Facebook experience when bandwidth is at a minimum.”

Facebook Lite is rolling out today to parts of Asia, and will be arriving in Latin America, Africa and Europe in the coming weeks.

Facebook Lite is a lightweight Android app for emerging markets