Saturday 24 December 2016

Find location of php.ini using Terminal

To get Location of php.ini file using terminal






Run the following command in terminal


php --ini


if php is install this command will run

else you have to run first this one

sudo apt-get install php5-cli

then run

php --ini

it will give result as

Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File:         /etc/php5/cli/php.ini
Scan for additional .ini files in: /etc/php5/cli/conf.d
Additional .ini files parsed:      /etc/php5/cli/conf.d/pdo.ini




Set Checkbox checked or unchecked using jQuery

Set Checkbox checked or unchecked using jQuery

                or
               
How to check checkbox is checked or unchecked using jQuery




Case 1    :    Single Checkbox using Id attribute


Html    :

<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
   
    <p id="check">Click me<p>

    <input type ="checkbox" name="chk_1" checked id="chk_1" value="1" /><label for="chk_1">Checkbox 1</label>
   
</body>
</html>

Script    :

    $('#check').on('click',function(){
        $("#chk_1").prop('checked', false); // Unchecks it
    })


--------------------------------------------------------------   X ---------------------------------------------------------------


Case 2    :    Multiple Checkboxes Using Class attribute

 Html    :

<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>

    <p id="check">Click me<p>

    <input type ="checkbox" name="chk_1" checked id="chk_1" value="1" class="mychechkbox"/><label for="chk_1">Checkbox 1</label>
    <input type ="checkbox" name="chk_2" checked id="chk_2" value="1" class="mychechkbox"/><label for="chk_2">Checkbox 2</label>
    <input type ="checkbox" name="chk_3" checked id="chk_3" value="1" class="mychechkbox"/><label for="chk_3">Checkbox 3</label>
    <input type ="checkbox" name="chk_4" checked id="chk_4" value="1" class="mychechkbox"/><label for="chk_4">Checkbox 4</label>

</body>
</html>


Script    :

    $('#check').on('click',function(){
        $(".mychechkbox").prop('checked', false); // Unchecks it
    })


--------------------------------------------------------------   X ---------------------------------------------------------------


Case 3    :    Single Checkbox Using name attribute

 Html    :

    <!DOCTYPE html>
    <html>
    <head>
    <script src="https://code.jquery.com/jquery-1.11.3.js"></script>
      <meta charset="utf-8">
      <title>JS Bin</title>
    </head>
    <body>

    <p id="check">Click me<p>

    <input type ="checkbox" name="chk_1" checked id="chk_1" value="1" /><label for="chk_1">Checkbox 1</label>
     
    </body>
    </html>

Script    :


    $('#check').on('click',function(){
        $("input[name='chk_1']:checkbox").prop('checked', false); // Unchecks it
    })
   
   

How to Reload Page on Anchor or label click ??

How to Reload Page on click??



Html Code:

<div id="test">
    <p>this is test.</p>
    <p id="closeAuction">Reload Page<p>
</div>




Jquery Code:

 $(document).ready(function() {
         $('#closeAuction').click(function() {
        location.reload();    
     });   
   });  




For Live Demo Click Here Live Demo

How to write a Simple jquery Code


How to write a Simple  jquery Code ??



Html code:


<input type="text" id="testid"  class="testclass" name="testname" placeholder="Event call using id on textbox click" >

<input type="text" id="testid2"  class="testclass2" name="testname2" placeholder="Event call using class on textbox leave" >


first thing download the latest jquery library from

http://code.jquery.com/jquery-migrate-1.2.1.min.js

then save it with "jquery-migrate-1.2.1.min.js" in your js folder or your project location


Jquery Code:

$(document).ready(function(){    // jquery start
    $("#testid").click(function(){    // text box click event
        alert("You have clicked");    // message to be displayed
    })
 });

This is the basic format for jquery beginner. you can use class instead of textbox id


$(document).ready(function(){    // jquery start
    $(".testclass2").blur(function(){    // text box blur event
        alert("This is use of class selector");    // message to be displayed
    })
 });


$(document).ready(function(){    // jquery start

    $("input").blur(function(){    // text box blur event on particular textbox
       
    $(this).css("border", "1px solid red");
       
    });
 });

Live Demo

How to add selected or active class to menu ??

If you want to add class selected or active to your menu just add the script in your project


Add jquery library using following url

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>


Html:

<ul id="main-ul">
   <li><a href="#">About MHG</a></li>
    <li><a href="#">Workout Programs</a></li>
    <li><a href="#">Fitness Tips</a></li>
    <li><a href="#">Contact Us</a></li>        
    <li><a href="#">Read Our Blog</a></li>
</ul


CSS:

li{list-style:none;}
.selected{background:red;}
.selected a{color:#fff;}


Script:

$(document).ready(function(){
    $("#main-ul li").click(function(){
        $('li').removeClass("selected");
        $(this).addClass("selected");
    })
})


For live demo click Here

Get Image Name from url using jquery


First add the jquery file by including following following line

Jquery library:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>



Html:

    <img width="75px" height="75px" border="0" alt="Top Tech" src="http://unitedassemblers.com/Artwork/Blank.jpg">



Jquery:

$(document).ready(function(){
    var name = $('img').attr('src');
    var fileNameIndex = name.lastIndexOf("/") + 1;
    var filename = name.substr(fileNameIndex);
    if(filename='Blank.jpg')
    {
     alert('image name is '+filename);
    }
})


Live Demo :

Click here for live demo

Check div or any tag has html or not

Check div or any tag has html or not


<div id="box3">
   
</div>

$(document).ready(function(){
   if ($("#box3").text().length > 0) {
        console.log('not empty');
   }
   else{
        console.log('empty');
   }                
 });

Wednesday 7 December 2016

Smooth scroll using jquery

Smooth scroll using jquery


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

<div class="">
    <a href="#commment" class="paythis">Go To comments</a>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <div id="commment" style="height:300px;width:300px;background:#d7d7d7; text-align:center;">
    <h3>Comment Section</h3>
</div>



<script>
   $('a.paythis').on('click',function(event){
        event.preventDefault();
        var hash = this.hash;
         $('html, body').animate({
        scrollTop: $(hash).offset().top
      }, 5000, function(){
  
        // Add hash (#) to URL when done scrolling (default click behavior)
        window.location.hash = hash;
      });
    })
</script>

Tuesday 6 December 2016

IPTUX to run in background by mistake.


IPTUX to run in background by mistake.



Steps to resolve this

#1 show hidden files
#2 open %gconf.xml file located on

home/xxxx/.gconf/apps/iptux/%gconf.xml

Now find for "hide_startup" and change

name="hide_startup" mtime="xxxxxxxxxx" type="bool" value="true"

to

name="hide_startup" mtime="xxxxxxxxxx" type="bool" value="false"