Friday 24 October 2014

How to get the number of rows in a table - tbodyin jquery?

<table id="myTable" cellpadding="0" cellspacing="0">
  <thead>
    <tr>
      <th>First Name</th>
      <th>Last Name</th>
      <th>Birth Date</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>John</td>
      <td>Smith</td>
      <td>03-11-1980</td>
    </tr>
  </tbody>
</table>

Solution:
$("#myTable tbody tr").length - Its wrong.
$("#myTable > tbody > tr").length; - Its right to get solution.

Thursday 16 October 2014

How To Get a Multiple Rows From JSON Object and Append to the Table

$("#table-list tr").detach();
    $.get(url+"payroll/payroll-ajax.php","id="+arg+"&param=view_loan",function(data){
    var objJSON = eval("(function(){return " + data + ";})()");
    var i=objJSON.length;
    for (var j=0;j<i;j++) {
        k=j+1;
        var newRow =
        "<tr>"
        +"<td>"+k+"</td>"
        +"<td>"+objJSON[j].deduction_date+"</td>"
        +"<td>&#2352;  "+objJSON[j].deduction_amt+"</td>"
        +"</tr>" ;
        $(newRow).appendTo("#table-list tbody");
    }
    $('#view-loan-table-modal').modal('toggle');
    var objJSON="";
    });

This above code is used to get multiple rows from json object.

If the variable data is contains following values.

data=[{"id":"3","loan_id":"8","deduction_date":"2014-07-16 12:54:14","deduction_amt":"16667"},{"id":"9","loan_id":"8","deduction_date":"2014-08-12 10:25:36","deduction_amt":"16667"},{"id":"10","loan_id":"8","deduction_date":"2014-08-12 02:22:53","deduction_amt":"16667"}]

This is JSON object value.

The out put is:

SVG Image Example

SVG IMAGE Examlpe
SVG Image
<html>
<title>SVG Image</title>
<body>
<h1>Sample SVG Image</h1>
<svg width="100" height="100">
  <circle cx="50" cy="50" r="40" stroke="red" stroke-width="2" fill="green" />
</svg>
</body>
</html>

Tuesday 14 October 2014

List of Android "Secret" Codes, Tips, and Tricks for HTC Mobiles

HTC CODES

Code Description
*#*#3424#*#* HTC function test Program.
*#*#4636#*#* HTC Info menu
*#*#8255#*#* launching GTalk Service Monitor
##3424# Diagnostic mode.
##3282# for EPST.
##8626337# for VOCODER
##33284# Field trial menu.
##786# Reverse Logistics Support.
##7738# Protocol Revision.
##775# Unknown
##2539# Unknown

List of Android "Secret" Codes, Tips, and Tricks for SAMSUNG Mobiles

SAMSUNG CODES

Code Description
*#*#4636#*#* Display information about Phone, Battery and Usage statistics
*#*#7780#*#* Restting your phone to factory state-Only deletes application data and applications
*2767*3855# It's a complete wiping of your mobile also it reinstalls the phones firmware
*#*#34971539#*#* Shows completes information about the camera
*#*#7594#*#* Changing the power button behavior-Enables direct poweroff once the code enabled
*#*#273283*255*663282*#*#* For a quick backup to all your media files
*#*#197328640#*#* Enabling test mode for service activity
*#*#232339#*#* OR *#*#526#*#* Wireless Lan Tests
*#*#232338#*#* Displays Wi-Fi Mac-address
*#*#1472365#*#* For a quick GPS test
*#*#1575#*#* A Different type GPS test
*#*#0283#*#* Packet Loopback test
*#*#0*#*#* LCD display test
*#*#0673#*#* OR *#*#0289#*#* Audio test
*#*#0842#*#* Vibration and Backlight test
*#*#2663#*#* Displays touch-screen version
*#*#2664#*#* Touch-Screen test
*#*#0588#*#* Proximity sensor test
*#*#3264#*#* Ram version
*#*#232331#*#* Bluetooth test
*#*#7262626#*#* Field test
*#*#232337#*# Displays bluetooth device address
*#*#8255#*#* For Google Talk service monitoring
*#*#4986*2650468#*#* PDA, Phone, Hardware, RF Call Date firmware info
*#*#1234#*#* PDA and Phone firmware info
*#*#1111#*#* FTA Software version
*#*#2222#*#* FTA Hardware verion
*#*#44336#*#* Displays Build time and change list number
*#06# Displsys IMEI number
*#*#8351#*#* Enables voice dialing logging mode
*#*#8350#*#* Disables voice dialing logging mode
##778 (+call) Brings up Epst menu

How to check value & its variable type in php?

$i=10; $j="10"; if($i===$j){ ..... } Here we have to check value & its variable type in php

Friday 10 October 2014

Autocomplete JQuery script full source code example

<script src="http://www.jqueryautocomplete.com/js/jquery/jquery-1.7.1.min.js"></script>
<script src="http://www.jqueryautocomplete.com/js/jquery/jquery.ui.core.min.js"></script>
<script src="http://www.jqueryautocomplete.com/js/jquery/jquery.ui.widget.min.js"></script>
<script src="http://www.jqueryautocomplete.com/js/jquery/jquery.ui.position.min.js"></script>
<script src="http://www.jqueryautocomplete.com/js/jquery/jquery.ui.autocomplete.min.js"></script>
<link rel="stylesheet" href="http://www.jqueryautocomplete.com/js/jquery/smoothness/jquery-ui-1.8.16.custom.css"/>
<script>var data = [
  {"label" : "Aragorn"},
  {"label" : "Arwen"},
  {"label" : "Bilbo Baggins"},
  {"label" : "Boromir"},
  {"label" : "Frodo Baggins"},
  {"label" : "Gandalf"},
  {"label" : "Gimli"},
  {"label" : "Gollum"},
  {"label" : "Legolas"},
  {"label" : "Meriadoc Merry Brandybuck"},
  {"label" : "Peregrin Pippin Took"},
  {"label" : "Samwise Gamgee"}
  ];
</script>
<script>
$(function() {

 $( "#search" ).autocomplete(
 {
   source:data
 })
});
</script>

<input type="text" id="search" />

Thursday 9 October 2014

Enter Floating Number only

Input field onkeyup check floating values only to allow
onkeyup="if (!isFinite(this.value)) this.value = this.value.replace(/(\s+)?.$/,'')"

How to send e-mail messages using PHP?

<?php
    mail("recipient@example.com",
        "This is the message subject",
        "This is the message body",
        "From: sender@example.com" . "\r\n" . "Content-Type: text/plain; charset=utf-8",
        "-fsender@example.com");
?>

How to change the default directory index page using an .htaccess file?

You can use the DirectoryIndex directive in an .htaccess file 
to specify a custom file or files that the web server looks for 
when a visitor requests a directory. To enable the DirectoryIndex 
directive, use a text editor to modify the .htaccess file as 
follows. Replace filename with the file that you want to 
display whenever a user requests the directory:

DirectoryIndex filename

You can also specify multiple filenames, and the web server
 will search for each file until it finds a match. Consider 
this example directive:

DirectoryIndex index.php index.html index.htm

How to enable and disable directory index listings using an .htaccess file?

Enable directory index listings
In some cases, however, you may want to enable index listings for a directory. 
To do this, use a text editor to add the following line to the .htaccess file:

Options +Indexes

This directive enables standard indexing, where the index listing shows 
only the filenames. You can also enable “fancy” indexing, where the 
index listing shows filenames, their filesizes, and when they were 
last modified. To do this, add the following line to the .htaccess file:

IndexOptions +FancyIndexing

How to protect your file content using htaccess?

# Prevent Apache from serving .htaccess files:
<FilesMatch "^\.htaccess">
    Order allow,deny
    Deny from all
</FilesMatch>

How to enable and disable the PHP magic quotes directive?

When the magic quotes directive is enabled, PHP automatically escapes 
data from HTTP GET and POST requests and cookie data. For example, 
if a user types “hello” (with the quotation marks) in a form, PHP 
automatically escapes the quotation marks and stores the value as 
\“hello\”. To enable this functionality, use a text editor to 
modify the magic quotes directive in the php.ini file as follows:

magic_quotes_gpc = on

To disable this functionality, modify the magic quotes directive in the php.ini file as follows:

magic_quotes_gpc = off

How to enable and disable the PHP register_globals directive?

When the register_globals directive is enabled, PHP creates variables 
automatically from HTML form parameters and cookie data. 
To enable this functionality, use a text editor to modify the 
register_globals directive in the php.ini file as follows:

register_globals = on

To disable this functionality, modify the register_globals 
directive in the php.ini file as follows:

register_globals = off

How to enable and disable the PHP allow_url_fopen directive?

To enable this functionality, use a text editor to modify 
the allow_url_fopen directive in the php.ini file as follows:

allow_url_fopen = on

To disable this functionality, modify the allow_url_fopen 
directive in the php.ini file as follows:

allow_url_fopen = off

How to change the maximum number of input variables for PHP scripts?

PHP obtains input variables from HTML forms (through GET and POST requests), 
as well as from any cookies enabled on a page. 
By default, the maximum number of input variables allowed for 
PHP scripts is set to 1000. You can change this amount by 
adding the max_input_vars directive to a php.ini file.

To change the maximum number of input variables allowed, use a text editor
 to add the max_input_vars directive to your php.ini file. For example,
 to set the maximum number of input variables to 1500, add the following setting:

max_input_vars = 1500

How to enable and disable the expose_php directive?

When the expose_php directive is enabled, PHP includes the following line in 
the HTTP response header when a PHP page is requested 
(the exact version number may differ depending on your configuration):

X-Powered-By: PHP/5.3.27

By default, the expose_php directive is enabled. However, you may not want to 
broadcast the specific PHP version your site is using. Similarly, 
some third-party applications require the expose_php directive to be disabled.

To disable the expose_php directive, use a text editor to modify your php.ini file as follows:

expose_php = off

With the expose_php directive disabled, PHP will not send the X-Powered-By header. 
To re-enable the expose_php directive and send the X-Powered-By header, 
modify your php.ini file as follows:

expose_php = on

How to do copy files from one directory to another directory using php?

Copy files from one directory to another directory using php
copy('foo/test.php', 'bar/test.php');

Saturday 4 October 2014

Wednesday 1 October 2014

Easy to integrate Facebook login to your web application

<fb:login-button scope="public_profile,email" onlogin="checkLoginState();">
</fb:login-button>
<span id="status"></span>
<script type='text/javascript'>
function statusChangeCallback(response) {
    console.log('statusChangeCallback');
    console.log(response);
    if (response.status === 'connected') {
      testAPI();
    } else if (response.status === 'not_authorized') {
      document.getElementById('status').innerHTML = 'Please log ' +'into this app.';
    } else {
      document.getElementById('status').innerHTML = 'Please log ' +'into Facebook.';
    }
}
function checkLoginState() {
    FB.getLoginStatus(function(response) {  statusChangeCallback(response); });
}

window.fbAsyncInit = function() {
    FB.init({
        appId      : "FB_APP_ID", 
        cookie     : true,  // enable cookies to allow the server to access // the session
        xfbml      : true,  // parse social plugins on this page
        version    : 'v2.1' // use version 2.1
    });
    //FB.getLoginStatus(function(response) {  statusChangeCallback(response); });
};

(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

function testAPI() {
    console.log('Welcome!  Fetching your information.... ');
    FB.api('/me', function(response) {
        console.log('Successful login for: ' + response.name);
        var name = response.name;
        var email = response.email;
        document.getElementById('status').innerHTML = 'Thanks for logging in, ' + response.email + '!';
    });
}
</script>

How to resolve auto restart in Android mobile after Factory reset on your device?

Kindly follow steps to follw,
1. First to reset your device
2. To connect internet via wireless or mobile data to configure in Gmail Account first
3. Asking To insert SIM then to insert & restart your device issue solved