Friday 25 May 2012

How to check checkbox is checked or not using jquery?

Hi All,

Please use the following code:

How to check checkbox is checked or not using jquery?
function validateMultipleCheck(formId){
    if(formId == undefined){
        var totalInput = $('input:checkbox').length;
    }else{
        var totalInput = $('#'+formId+' input:checkbox').length;
    }
    var checkedValues = '';
    if(totalInput > 0){
        $(":input:checkbox:checked").each(function(){
            checkedValues = checkedValues + ',' + this.value;
        })
    }
    return checkedValues;
}

var values = validateMultipleCheck();
alert(values);


Cheers!

How to check radio button selected or not using jquery?

Folks,

Use the following code:

function validateMultipleRadio(formId){
        if(formId == undefined){
            var totalInput = $('input:radio').length;
        }else{
            var totalInput = $('#'+formId+' input:radio').length;
        }
        var checkedValues = '';
        if(totalInput > 0){
            $(":input:radio:checked").each(function(){
                checkedValues = checkedValues + ',' + this.value;
            })
        }
        return checkedValues;

}

var checkValues = validateMultipleRadio('frm');
alert(checkValues);



Cheers!

Wednesday 23 May 2012

How to fetch data in excel/csv format using mysql query?

Dear All,

Suppose you have a query given below:
SELECT ud.email FROM user_detail ud group by ud.email having count(ud.email) > 1;

The above query return all email addresses which are duplicate in the system.

Now go to server and type following:

## Fetching duplicate email address and saving them into file...   
mysql -uuser_name -p -hhost_name -A -Ddatabase_name -B --skip-column-names -e "SELECT ud.user_id, ud.email FROM user_detail ud group by ud.email having count(ud.email) > 1;">  /var/www/duplicateEmail

"/var/www/" is a path where you want to save file.
"duplicateEmail" is a file name.


Cheers!

Tuesday 15 May 2012

How to implement facebook connect using facebook javascript?

Guys,


######### HTML PART #############
<!---fb:login scope="email" >Login with Facebook</fb:login-->
<input type="button" id="login_button_server" onclick="facebookLogin()" value="Facebook Login"/>
<div id="fb-root"></div>
<script>
    window.fbAsyncInit = function() {
        FB.init({
            appId: '7845787548501',
            cookie: true,
            xfbml: true,
            oauth: true
        });
        FB.Event.subscribe('auth.statusChange', function(response) {
            //alert(response.status);
            if (response.status === 'connected') {

                var uid = response.authResponse.userID;
                var accessToken = response.authResponse.accessToken;

                FB.api('/me', function(response) {

                    //alert(response);
                    var email = response.email;
                    var name = response.name;
                    var username = response.username;
                    alert('Good to see you, ' + response.email + '.');
                });
            }else{
                alert("Error found while logged in. Please try again.");
            }
        });

    };
    (function () {       
        var e = document.createElement('script');
        e.async = true;
        e.type = 'text/javascript';
        e.src = 'https://connect.facebook.net/en_US/all.js';       
        document.getElementsByTagName('head')[0].appendChild(e);
    }());


    function facebookLogin() {
        FB.login(function(response) {}, {scope:'email'});
    }
</script>

Cheers!

Friday 4 May 2012

How to install Yii in wamp?

Guys

Follow the following steps for installation:

* goto “My Computer”

* Right Click and select Properties

* You will see “System Properties” window

* Select “Advanced”tab

* In “Advanced” tab, click on “Environment Variables”

* Select “Path” in “System Variables” section

* Click on “Edit”  “Path” in “System Variables” section

* “Edit System Varibale” window will appear with “Variable name” and “Variable value” fields

* Enter “D:\wamp\bin\php\php5 at the end without double quotes.

* Click on OK

* Open dos prompt

* D:\>cd wamp\www

* D:\wamp\www>mkdir myproject

* Download yii framework and put it into www directory

* D:\wamp\www>cd yii\framework

* D:\wamp\www\yii\framework> yiic webapp D:\wamp\www\myproject
Create a Web application under ‘D:\wamp\www\myproject’? [Yes|No] y


Your application has been created successfully under C:\wamp\www\myYii.

Thats all. now You are ready to use your application by accessing the URL : http://localhost/myproject/

Cheers!