Thursday 23 April 2015

Set and reset proxy for git and npm connection

 Set and reset proxy for git and npm connection:
--------------------------------------------------
Depending on whether the connection is behind a proxy or not, the proxy settings will need to set/reset correspondingly when using npm and git.

The command to set and reset the proxy are

# Set proxy for npm:
npm config set proxy http://proxy:8080
npm config set https-proxy http://proxy:8080

# Set proxy for git:
git config --global http.proxy http://proxy:8080
git config --global https.proxy http://proxy:8080





# reset proxy for npm
npm config rm proxy
npm config rm https-proxy


# reset proxy for git
git config --global --unset http.proxy
git config --global --unset https.proxy


# get proxy setting fro git

git config --global --list
npm config get list

npm config get proxy
npm config get https-proxy


Thanks for HELP :http://jonathanblog2000.blogspot.com/2013/11/set-and-reset-proxy-for-git-and-npm.html?showComment=1425635909327#c889755258776988581

JQM/Phoengap Rregister form validation


JQM/Phoengap Rregister form validation:
=============================
<!DOCTYPE html>
<html>

<head>
    <title>jQuery Mobile Form</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="css/jquery.mobile-1.4.5.min.css">
    <script src="js/jquery-2.1.3.js"></script>
    <script src="js/jquery.mobile-1.4.5.min.js"></script>
    <link rel="stylesheet" href="logintheme1.css">
    <!--<script src="jquery-mobile.js"></script>-->
    <script src="js/jquery.validate.js"></script>
    <style>
        label.error {
            color: red;
            font-size: 16px;
            font-weight: normal;
            line-height: 1.4;
            margin-top: 0.5em;
            width: 100%;
            float: none;
        }
        @media screen and (orientation: portrait) {
            label.error {
                margin-left: 0;
                display: block;
            }
        }
        @media screen and (orientation: landscape) {
            label.error {
                display: inline-block;
                margin-left: 22%;
            }
        }
        em {
            color: red;
            font-weight: bold;
            padding-right: .25em;
        }
    </style>

</head>

<body>
    <!-------------- First page for form ----------->
    <div data-role="page" id="register">
        <!-------------- First page header ----------->
        <div data-role="header" data-position="fixed">
            <h1>jQuery Mobile Registration Form</h1>
        </div>
        <!-------------- First page main content ----------->
        <div data-role="main" class="ui-content">
            <form method="post" action="#" data-ajax="false" id="registertheme1">
                <div data-role="listview" data-inset="true" id="login_inset" class="login_inset">
                    <div class="ui-field-contain">
                        <label for="Username">Username : <span>*</span>
                        </label>
                        <input type="text" id="username" name="username" placeholder="Username">
                    </div>
                    <div class="ui-field-contain">
                        <label for="Username">Password: <span>*</span>
                        </label>
                        <input type="password" id="password" name="password" placeholder="Password" />
                    </div>
                    <div class="ui-field-contain">
                        <label for="Username">Re-Type: <span>*</span>
                        </label>
                        <input type="password" id="retype" name="retype" placeholder="Confirm Password" />
                    </div>


                    <div>

                        <input type="reset" data-icon="recycle" class="ui-btn ui-btn-inline error_color" data-inline="true" value="Reset" id="cancel">

                        <input type="submit" data-role="submit" data-icon="check" class="ui-btn ui-btn-inline success_color" data-inline="true" value="Register" id="submit">

                    </div>
            </form>
            </div>
        </div>
        <div data-role="footer" data-position="fixed">
            <h1>  Form</h1>
        </div>

        <script>
            $('#registertheme1').validate({
                rules: {
                    username: {
                        required: true
                    },
                    password: {
                        required: true
                    },
                    retype: {
                        required: true,
                        equalTo:"#password"
                    }
                },
                messages: {
                    username: {
                        required: "Please enter your user name."
                    },
                    password: {
                        required: "Please enter your password."
                    },
                    retype: {
                        required: "Please enter confirm password.",
                        equalTo: "Please enter same password again "
                    }
                },
                errorPlacement: function (error, element) {
                    error.insertAfter(element.parent());
                },
                submitHandler: function (form) {
                   
                    $(':mobile-pagecontainer').pagecontainer('change', '#success', {
                        reload: false
                    });
                    return false;
                }
            });
            /* $("#register").on("pageinit", function () {
            $("form").validate({
                rules: {
                    username: {
                        required: true
                    },
                    password: {
                        required: true
                    },
                    retype: {
                        required: true
                    }
                },
                errorPlacement: function (error, element) {
                    error.insertAfter(element.parent());
                }
            });
        });*/
        </script>
        <!-------------------------------------------------------------
End of First page
-------------------------------------------------------------->
        <!-------------- Second page ----------->
        <div data-role="page" id="pageone">
            <!-------------- Second page header ----------->
            <div data-role="header">
                <h1>JQuery Mobile Form</h1>
            </div>
            <!-------------- Second page main content ----------->
            <div data-role="main" class="ui-content">
                <h2>Form Submitted Successfully...!!</h2>
            </div>
        </div>
        <!-------------------------------------------------------------
End of Second page
-------------------------------------------------------------->
</body>

</html>

php CORS ajax -jquery

php CORS ajax -jquery :
=======================
php ajax cross domain origin request

addthe below line in php file :

Cross origin is solved from server end...

<?php
header("Access-Control-Allow-Origin: *");
?>

Android keyboard display numberic keyboard for my password Input feild

Android keyboard display numberic keyboard for my password Input feild :
==================================================
====
 <input type="tel" pattern="[0-9]*" name="Password" id="Password" />

css:

<style type="text/css">
        #Password {
            -webkit-text-security: disc;
        }
</style>

jqm_datepicker_hide_softkey_board

jqm_datepicker_hide_softkey_board:
-----------------------------------------

jqm datepicker jqm1.4.5: core jqm datepicker;
========================

Add the required datepicker js and css =files in header section

<head>
    <title>jQuery Mobile Form</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="css/jquery.mobile-1.4.5.min.css">
    <link rel="stylesheet" href="css/jquery.mobile.datepicker.css">
    <link rel="stylesheet" href="css/jquery.mobile.datepicker.theme.css">
    <script src="js/jquery-2.1.3.js"></script>
    <script src="js/datepicker.js"></script>
    <script src="js/jquery.mobile-1.4.5.min.js"></script>
    <script src="js/jquery.mobile.datepicker.js"></script>
   
    <link rel="stylesheet" href="logintheme1.css">
    <!--<script src="jquery-mobile.js"></script>-->
   <script src="js/jquery.validate.js"></script>
</head>


<body>
<div class="ui-field-contain">
                      
  <label for="dob"> DOJ </label>
  <input type="text" data-role="date" readonly>

</div>

Remove jquery validation.js error's

Remove jquery validation.js error's in reset(btn) the  form:
======================================

$("#reset").click(function() {
  $("label.error").hide();
  $(".error").removeClass("error");
  });




Soln 2 - related to full form:
------
You want the resetForm() method:

var validator = $("#myform").validate(
   ...
   ...
);

$(".cancel").click(function() {
    validator.resetForm();
});

but not remove error msg....

eclipse_Android_text color_preference

eclipse_Android_text color_preference:
------------------------------------------------
The color in the bar is the same as the color the text is highlighted with in the editor. It is set by going to

Preferences > General > Editors > Text Editors > Annotations

and changing the Occurrences and Write Occurrences colors.



The bar is called the Overview Bar or Overview Ruler (in case you need to reference it) and, as has been mentioned, the color of occurences can be changed by navigating to:

Window > Preferences > General > Editors > Text Editors > Annotations
and changing the color for Occurrences.

One difference to note in Eclipse Juno (most other responses seem to refer to Indigo) is that the change won't take effect until you restart the program.

Date picker for JQM phoengap

Date picker for JQM app dob & doj not future dates:
=======================================
mobiscroll date picker;


add the css and js as per below order and corresponding path:::
<head>

  <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="css/jquery.mobile-1.4.5.min.css">
    <link type="text/css" href="date/jqm-datebox.min.css" rel="stylesheet" />
    <script src="js/jquery-2.1.3.js"></script>
    <script src="js/jquery.mobile-1.4.5.min.js"></script>
    <link rel="stylesheet" href="logintheme1.css">
    <!--<script src="jquery-mobile.js"></script>-->

    <script type="text/javascript" src="date/jqm-datebox.core.min.js"></script>
    <script type="text/javascript" src="date/jqm-datebox.mode.datebox.min.js"></script>
    <script type="text/javascript" src="date/jquery.mobile.datebox.i18n.en_US.utf8.js"></script>
    <link href="date/mobiscroll-2.1-beta.custom.min.css" rel="stylesheet" type="text/css" />
    <script src="date/mobiscroll-2.1-beta.custom.min.js" type="text/javascript"></script>


   <script src="js/jquery.validate.js"></script>


<script type="text/javascript">
        $(document).bind("mobileinit", function()
        {   
                $.mobile.defaultPageTransition = 'none';
               $.mobile.defaultDialogTransition = 'none';
         
        });
       
       
       
    $(function () {
        var curr = new Date().getFullYear();
        var opt = {

        }
        opt.date = {
            preset: 'date'
        };
        opt.datetime = {
            preset: 'datetime',
            minDate: new Date(2012, 3, 10, 9, 22),
            maxDate: new Date(2014, 7, 30, 15, 44),
            stepMinute: 5
        };
        opt.time = {
            preset: 'time'
        };
        $('#test_default').bind('click', function () {



            $('#test_default').val('').scroller('destroy').scroller($.extend(opt['date'], {
                theme: 'default'
            }));
        });
        $('#test_default').trigger('click');
    });
</script>

</head>

<body>

 <div class="ui-field-contain">
                      
 <label for="dob"> DOB </label>
    <input type="text" name="test_default" id="test_default" class="required" />
   </div>



Custom font for JQM / Web page


Custom font for JQM / Web page:
===============================


we can add two 2 ways font-family

1. web fonts, 2. font-face

For font face -> download your choise of font and store in font folder:

add the css in you css file


@font-face {
    font-family: myFirstFont;
    src: url("font/AlexBrush-Regular.ttf");
}

*{
    font-family: myFirstFont !important;
}

soln 2:
======

Use google web fonts:

<link href=' http://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'>

 then in css h1 { font-family: 'Droid Sans', arial, serif; }

Css code in javascript function

Css code in javascript function:
================================

There are several ways to do this.

Option 1.

<script type="text/javascript">
   function MyFunction(sender, eventArgs) {
       if (someCondition) {
          someelement.style.cssText = "background: url(Images/myImage.png) !important;"
       }
    }
</script>


Option 2.

 <script type="text/javascript">
       function MyFunction(sender, eventArgs) {
           if (someCondition) {
              someelement.className = "someclass"
           }
        }
    </script>
where,

<style>
.someclass{
background: url(Images/myImage.png) !important;
}
</style>


Option 3

 <script type="text/javascript">
           function MyFunction(sender, eventArgs) {
               if (someCondition) {
                  someelement.setAttribute('style', 'background: url(Images/myImage.png) !important;');
               }
            }
        </script>