Sunday 20 September 2015

USB_debuggin_enable

USB dubugging enable for new android mobile - Asus zenfone

http://firstandgeek.com/developer-option-usb-debugging-asus-zenfone-5/

Go to Settings

Click on About

Then Choose Software Information


Tap the Build Number for nearly 10 times, so that for each press, it shows you are near to the developer option. Continue until it unlocks the developer option for you.


After that go to the Settings page again. At the bottom, You could see the developer option as following.

Inside the developer option, there is USB debugging option.

Not only the USB debugging feature, but also Stake Away, Mock Location Allowing, Force RTL layout direction, animation scale, GPU rendering, Strict mode etc can be accessed by simply enabling this Developer option. As I owned Zenfone now, more Zenfone tips and tricks will be updated soon. if you have any problems regarding your Zenfone, kindly mail me and I will give you the answer.

sleep_android_activity

Thread closeActivity = new Thread(new Runnable() {
  @Override
  public void run() {
    try {
      Thread.sleep(3000);
      // Do some stuff
    } catch (Exception e) {
      e.getLocalizedMessage();
    }
  }
});

Showing hint of page on Nav Bar TAB

Nav bar - mouse over- show name of current tab/page show

<a href="index.html" title="Home" ></a>


 <ul class="nav">
       <li><a href="index.html" title="Home">Home</a></li>
            <li><a href="advisoryboard.html">Advisory Board</a></li>
     <li><a href="editorialboard.html">Editorial Board</a></li>
            <li><a href="instructionstoauthor.html">Instructions to Author</a></li>
  <li  class="active"><a href="indexing_listing.html">Indexing And Listing</a></li>  
            <li><a href="current_issues.html">Current Issue</a></li>
     <li><a href="archives.html">Archives</a></li>
  <li><a href="contactus.html">Contact Us</a></li>
      </ul>

jQuery Mobile: Stick footer to bottom of page:

jQuery Mobile: Stick footer to bottom of page:
=================================
add css:
----------
[data-role=page]{height: 100% !important; position:relative !important;}
[data-role=footer]{bottom:0; position:absolute !important; top: auto !important; width:100%;}


Disable Div.jqm-content :

css :
div.jqm-contne{ display:none; }

Fav_Icon_for web site

Convert your image to the ICO format :

http://image.online-convert.com/convert-to-ico

Upload image and set pixel 16x16

convert and download image as ico format..

Add this line in html page after meta Tag and before Css inclusion.

<link rel="icon" type="image/jpg" href="images/fav.ico">

Friday 24 July 2015

Send mail with attachement in php:

Send mail with attachement in php: (MIME/application-pdf)
===============================================

<?php
$fileatt = "pdf/pdfname 1101.pdf"; // Path to the file                
$fileatt_type = "application/pdf"; // File Type
$fileatt_name = "pdf/pdfname 1101.pdf"; // Filename that will be used for the file as the attachment
$email_from = "user@webapp.net"; // Who the email is from
$email_subject = "Your attached file"; // The Subject of the email
$email_message = "Thanks for visiting mysite.com!  Here is your free file.<br>";
$email_message .= "Thanks for visiting.<br>"; // Message that the email has in it
$email_to = "siteadmin@webapp.net";//$_POST['email']; // Who the email is to
$headers = "From: ".$email_from;
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
   
$headers .= "\nMIME-Version: 1.0\n" .
            "Content-Type: multipart/mixed;\n" .
            " boundary=\"{$mime_boundary}\"";
$email_message .= "This is a multi-part message in MIME format.\n\n" .
                "--{$mime_boundary}\n" .
                "Content-Type:text/html; charset=\"iso-8859-1\"\n" .
               "Content-Transfer-Encoding: 7bit\n\n" .
$email_message .= "\n\n";
$data = chunk_split(base64_encode($data));
$email_message .= "--{$mime_boundary}\n" .
                  "Content-Type: {$fileatt_type};\n" .
                  " name=\"{$fileatt_name}\"\n" .
                  //"Content-Disposition: attachment;\n" .
                  //" filename=\"{$fileatt_name}\"\n" .
                  "Content-Transfer-Encoding: base64\n\n" .
                 $data .= "\n\n" .
                  "--{$mime_boundary}--\n";
$ok = @mail($email_to, $email_subject, $email_message, $headers);
if($ok) {
echo "<font face=verdana size=2><center>You file has been sent<br> to the email address you specified.<br>
Make sure to check your junk mail!<br>
Click <a href=\"#\" onclick=\"history.back();\">here</a> to return to mysite.com.</center>";
} else {
die("Sorry but the email could not be sent. Please go back and try again!");
}
?>

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>

Wednesday 25 March 2015

Numberic keyboard for my password - Phonegap - JQM

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>

Monday 23 March 2015

Submit a jQuery Mobile form via AJAX with PHP


 index.html:
=========

<html !doctype>
<html>
<head>
<title>Submit a form via AJAX</title>
      <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.css">
      <script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
      <script src="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.js"></script>


    <script>
        function onSuccess(data, status)
        {
            data = $.trim(data);
            $("#notification").text(data);
        }
 
        function onError(data, status)
        {
            // handle an error
        }       
 
        $(document).ready(function() {
            $("#submit").click(function(){
                alert(1);
 
                var formData = $("#callAjaxForm").serialize();
                alert(formData);
 
                $.ajax({
                    type: "POST",
                    url: "http://localhost/pdm/callajax.php",
                    cache: false,
                    data: formData,
                    success: onSuccess,
                    error: onError
                });
 
                return false;
            });
        });
    </script>
    </head>
  <boby>
    <!-- call ajax page -->
    <div data-role="page" id="callAjaxPage" data-url="callAjaxPage" class="ui-page ui-body-c ui-page-active">
        <div data-role="header" class="ui-bar-a ui-header" role="banner">
            <h1 class="ui-title" tabindex="0" role="heading" aria-level="1">Call Ajax</h1>
        </div>
 
        <div data-role="content" class="ui-content" role="main">
            <form id="callAjaxForm">
                <div data-role="fieldcontain" class="ui-field-contain ui-body ui-br">
                    <label for="firstName" class="ui-input-text">First Name</label>
                    <input type="text" name="firstName" id="firstName" value="" class="ui-input-text ui-body-null ui-corner-all ui-shadow-inset ui-body-c">

                    <label for="lastName" class="ui-input-text">Last Name</label>
                    <input type="text" name="lastName" id="lastName" value="" class="ui-input-text ui-body-null ui-corner-all ui-shadow-inset ui-body-c">
                    <h3 id="notification"></h3>
                    <div data-theme="b" class="ui-btn ui-btn-up-b ui-btn-corner-all ui-shadow" aria-disabled="false"><span class="ui-btn-inner ui-btn-corner-all"><span class="ui-btn-text">Submit</span></span><button data-theme="b" id="submit" type="submit" class="ui-btn-hidden" aria-disabled="false">Submit</button></div>
                </div>
            </form>
        </div>
 
        <div data-role="footer" class="ui-bar-a ui-footer" role="contentinfo">
            <h1 class="ui-title" tabindex="0" role="heading" aria-level="1">GiantFlyingSaucer</h1>
        </div>
    </div>


<div class="ui-loader ui-body-a ui-corner-all" style="top: 326.5px;"><span class="ui-icon ui-icon-loading spin"></span><h1>loading</h1></div>v

</body>

</html>


callajax.php :
=========
<?php
 $firstName = $_POST["firstName"];
    $lastName = $_POST["lastName"];
    
    echo("First Name: " . $firstName . " Last Name: " . $lastName);
    ?>


Thanks for Ref:

http://www.sitepoint.com/50-jquery-mobile-development/

Friday 23 January 2015

NameSpace in Javascript :

NameSpace in Javascript :
=======================

In order to reduce the number of objects and functions that are added to the global scope in our applications,

using namespaces in JavaScript is definitely a recommended practice. Just like static members,

namespaces don’t have any dedicated syntax built into the language either.

But we’re able to get the same benefits by creating a single global object and adding all our objects and functions to this object.

var AppSpace = AppSpace || {};

AppSpace.Podcast = function {
    this.title = 'Astronomy Cast';
    this.description = 'A fact-based journey through the galaxy.';
    this.link = 'http://www.astronomycast.com';
};

AppSpace.Podcast.prototype.toString = function() {
    return 'Title: ' + this.title;
}

This way we lower the possibility of naming collisions when using our code in conjunction with other JavaScript libraries.

We can also use the same naming conventions for namespaces as in any other programming language that does provide syntactical support.

Suppose we want to use a namespace like “MyCompany.MyApplication.Model”.

We can accomplish this by using the same approach as shown earlier:

var MyCompany = MyCompany || {};
MyCompany.MyApplication = {};
MyCompany.MyApplication.Model = {};

or something like the following:

var MyCompany = MyCompany || {
    MyApplication: {
        Model: {}
    }      
};

However, this approach can become very cumbersome and hard to maintain when our code expands over time.

In order to overcome this issue we can use a general purpose namespace function to achieve the same thing using a single line of code.

var model = namespace('MyCompany.MyApplication.Model');

model.Podcast = function {
    this.title = 'Astronomy Cast';
    this.description = 'A fact-based journey through the galaxy.';
    this.link = 'http://www.astronomycast.com';
};

model.Podcast.prototype.toString = function() {
    return 'Title: ' + this.title;
}

Here’s an example of how we can implement such a namespace function.

function namespace(namespaceString) {
    var parts = namespaceString.split('.'),
        parent = window,
        currentPart = '';  
       
    for(var i = 0, length = parts.length; i < length; i++) {
        currentPart = parts[i];
        parent[currentPart] = parent[currentPart] || {};
        parent = parent[currentPart];
    }
   
    return parent;
}

Using this approach requires less typing and the resulting code also looks less verbose. Some JavaScript libraries,

like YUI and the Dojo Toolkit, provide their own implementations for such a namespace utility function.

I encourage you to take a look at their implementations as well.

Android USB Driver Update

Android USB Driver Update:

Nexus 7 can’t be recognized by MS-Windows via USB
1.Connect your Nexus 7 to your computer's USB port.

2.Right-click on Computer from your desktop or Windows Explorer, and select [Manage].
 http://kmpic.asus.com/images/2013/09/23/96034148-472b-4260-addd-ccfc0a229d81.png

3.Select [Device Manager] in the left pane of the Computer Management window.
4.Locate and expand [ASUS Android Device] in the right pane.
5.Right-click Android Composite ADB Interface and select [Update Driver Software].
http://kmpic.asus.com/images/2013/09/23/06996354-6745-4aed-a697-824625469d33.jpg

6.Click [Browse my computer for driver software] to specify a location. 
http://kmpic.asus.com/images/2013/09/23/8fe2dcc7-94b9-4501-a9ee-2badd775c74b.png       
NOTE : Some time it’s located in Other devices. We have to right click & process follg steps.
7.Click[Let me pick from a list of device drivers on my computer to specify the driver file.
NOTE :
First we have to downlaod USB Driver from http://dottech.org/26188/usb-adb-and-fastboot-drivers-for-windows-for-all-android-phones/#all
Or Nexuz product here Asus. So, I get driver from asus site.
( i.e )relavent Nexux 7 or category. I will enhance this for my blog too. Thanks for your feture post.
http://kmpic.asus.com/images/2013/09/23/3ffde5f9-6752-4011-b648-a8bc4a6d2e18.png

8.Click [USB Composite Device] option and Click on [Next].
http://kmpic.asus.com/images/2013/09/23/c323ff48-fa78-4395-b667-873250ccfa61.png

9.Click [Close] when the update is finished.
http://kmpic.asus.com/images/2013/09/23/fa3025b9-5246-4dd8-bb77-36675d7ff73c.png



Step to install APK in Android Emulator :

Step to install APK in Android Emulator :
=========================================
Step 1-> Run the emulator ( While I created new emulator Now )

step 2-> Paste the apk in SDK manager tools and platform-tools folders.
( To avoid some issues/ error)

Step 3-> Run this command adb CMD:\>install AppName.APK (open eun->cmd)

step 4-> Wait for 2 min it's show Success Message.
Sometimes App icon closed unfortunately.

step 5->But App will run continuous Try

Load an External JavaScript file dynamically calling:

Load an External Javascript file dyanamically calling:
======================================================

<script>

var oHead = document.getElementsByTagName('HEAD').item(0);
var oScript= document.createElement("script");
oScript.type = "text/javascript";
oScript.src="other.js";    // we can pass even folder level js files too. (i.e) foldernamee+"mainjs.js";
oHead.appendChild( oScript);

</script>


For Further Ref:
Thanks for Sharing :
http://ntt.cc/2008/02/10/4-ways-to-dynamically-load-external-javascriptwith-source.html

PHP - How to call external host from local host - Cross Domain Call

How to call external host from local host / (cross domain call from PHP WAMP)
===================================================================

In the JS file have this request :

var request = new XMLHttpRequest();
request.open("POST", endpoint + "/api/version/authedication/userlogin", true);


Here endpoint is external IP / URL for hosted Domain address

So, Make the following changes in WAMP -> Apache -> config -> http.config gile

Below this virtual host:

# Virtual hosts


#Include conf/extra/httpd-vhosts.conf


# Oauth ESA server
ProxyPassMatch ^/(api)(.*) http://23.543.34.34:8480/$1$2
  -> $1 is (api),$2 is http://....

ProxyPassReverse /api/ http://23.543.34.34:8490/$1$2

Exp: => when call link start with api redirect to follwing URL and follwed folder

Uncommand this modules in the same file

LoadModule vhost_alias_module modules/mod_vhost_alias.so

LoadModule proxy_http_module modules/mod_proxy_http.so

LoadModule proxy_scgi_module modules/mod_proxy_scgi.so

etc....

Load / Add JS Dynamically :

Load / Add JS Dynamically :
-----------------------------------

addElement JavaScript Function
==============================
function addElement() {

  var ni = document.getElementById('myDiv');

  var numi = document.getElementById('theValue');

  var num = (document.getElementById('theValue').value -1)+ 2;

  numi.value = num;

  var newdiv = document.createElement('div');

  var divIdName = 'my'+num+'Div';

  newdiv.setAttribute('id',divIdName);

  newdiv.innerHTML = 'Element Number '+num+' has been added! <a href=\'#\' onclick=\'removeElement('+divIdName+')\'>Remove the div "'+divIdName+'"</a>';

  ni.appendChild(newdiv);

}

removeElement JavaScript Function
=================================

function removeElement(divNum) {

  var d = document.getElementById('myDiv');

  var olddiv = document.getElementById(divNum);

  d.removeChild(olddiv);

}

Input value change by Number Picker based on left right side of text box:

Input value change by Number Picker based on left right side of text box:
========================================================================

Javascript Arithamatic Operation :


Javascript addion word if both the varaible are in Numeric datatype;

when try to make addiona operation in javscript function,

It's consider as string concationation in var + number.


<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Spinner Control in HTML5 by Mobile DON</title>
<script>
function inc()
{

var inc= document.getElementById('age').value;

inc++;
console.log(inc);
document.getElementById('age').value=inc;
}

function dec()
{

var dec= document.getElementById('age').value;
dec= dec-1;
console.log(dec);
document.getElementById('age').value=dec;
}

</script>
</head>
<body>
   <form>
     <label for="age" >
      <i value="dec" onclick="dec()" >   Minus </i>
      <input type="number" name="age" id="age"  />
      <i value="inc" onclick="inc()" > Plus</i>
     </label>
    </form>
</body>
</html>

Dynamically Load JS/CSS using Javascript Function:

Dynamically Load JS/CSS using Javascript Function:
-----------------------------------------------------------------

<input type="button" onclick="helper()" value="Helper">

   <script language="JavaScript">
   function helper()
   {
      var head= document.getElementsByTagName('head')[0];
      var script= document.createElement('script');
      script.type= 'text/javascript';
      script.src= 'helper.js';
      head.appendChild(script);
   }
   </script>

Load xml data in Javascript

Load xml data in Javascript 
load_xml_data.html:
=====================

<html>

<body>
    <h1>W3Schools Internal Note</h1>
    <div>
        <b>To:</b>  <span id="to"></span>
        <br />
        <b>From:</b>  <span id="from"></span>
        <br />
        <b>Message:</b>  <span id="message"></span>
    </div>

    <script>
        if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp = new XMLHttpRequest();
        } else { // code for IE6, IE5
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.open("GET", "node.xml", false);
        xmlhttp.send();
        xmlDoc = xmlhttp.responseXML;
       
        document.getElementById("to").innerHTML = xmlDoc.getElementsByTagName("exitButtonText")[0].childNodes[0].nodeValue;
        document.getElementById("from").innerHTML = xmlDoc.getElementsByTagName("balanceButtonText")[0].childNodes[0].nodeValue;
       // document.getElementById("message").innerHTML = xmlDoc.getElementsByTagName("body")[0].childNodes[0].nodeValue;
    </script>

</body>

</html>


node.xml:
==========

<?xml version="1.0" encoding="UTF-8" ?>
<node>
    <to>Tove</to>
    <from>Jani</from>
    <heading>Reminder</heading>

    <body>Don't forget me this weekend!</body>
</node>




PhoneGap/Cordova Android get screen size after onDeviceReady :

PhoneGap/Cordova Android get screen size after onDeviceReady :
==============================================================
SOLN 1:
=======
function getWindowSizes()
{
  var windowHeight = 0, windowWidth = 0;
 
  if (typeof (window.innerWidth) == 'number') {
      windowHeight = window.innerHeight;
      windowWidth = window.innerWidth;
     
  } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
      windowHeight = document.documentElement.clientHeight;
      windowWidth = document.documentElement.clientWidth;
     
  } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
     windowHeight = document.body.clientHeight;
     windowWidth = document.body.clientWidth;
  }
  return [windowWidth, windowHeight];
}
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1,
width=device-width, height=device-height, target-densitydpi=device-dpi" />




There are a few ways to do it, for example:

    Check window.orientation value
    Compare innerHeight vs. innerWidth

You can adapt one of the methods below.

SOLN 2:
=======

Check if device is in portrait mode

function isPortrait() {
    return window.innerHeight > window.innerWidth;
}

SOLN 3:
=======
Check if device is in landscape mode

function isLandscape() {
    return (window.orientation === 90 || window.orientation === -90);
}

SOLN 4:
=======
Example usage

if (isPortrait()) {
    alert("This page is best viewed in landscape mode");
}

SOLN 5:
=======
How do I detect the orientation change?

$(document).ready(function() {
    $(window).on('orientationchange', function(event) {
        console.log(orientation);
    });
});

Read Json in javaScript using Ajax call

Read Json in javaScript using Ajax call (XMLHttp)

data.json File:
===============

data = '[{"name" : "Harry", "age" : "32"}]';

html file :
============

<!doctype html>
<html>
    <head>
        <title>askyb - Load JSON File Locally by Javascript Without JQuery</title>
        <script type="text/javascript" src="sub/data.json"></script>
        <script type="text/javascript">
function load() {
var mydata = JSON.parse(data);
alert(mydata[0].name);
alert(mydata[0].age);
alert(JSON.stringify(mydata));
}

</script>
    </head>
    <body onload="load()">
        askyb - Load JSON File Locally by Javascript Without JQuery
    </body>
</html>


Example 2: using Ajax Call
===========================

<!doctype html>
<html>
<head>
<script>
function AJAX_JSON_Req( url )
{
    var AJAX_req = new XMLHttpRequest();
    AJAX_req.open( "GET", url, true );
    AJAX_req.setRequestHeader("Content-type", "application/json");

    AJAX_req.onreadystatechange = function()
    {
        if( AJAX_req.readyState == 4 && AJAX_req.status == 200 )
        {
            var response = JSON.parse( AJAX_req.responseText );
            document.write( response.name );
        }
    }
    AJAX_req.send();
}

AJAX_JSON_Req('js/people.json');

</script>
</head>
<body>

</body>
</html>

Rotate Screen Orientation detection Device Desktop:

Rotate Screen Orientation Device Desktop:
==============================

<!DOCTYPE html>
<html>

<body>
    <script>
        window.addEventListener("orientationchange", function () {
            var _width = window.innerWidth;
        });
    </script>


    <style>
       
       
        @media screen and (max-width:720px) and (orientation: landscape) {
            body {
                background: url(img/portrait.png) no-repeat center center fixed;
                -webkit-background-size: contain;
                -moz-background-size: contain;
                -o-background-size: contain;
                background-size: contain;
             
            }
        }
       
       
        @media screen and (orientation: landscape) {}
    </style>
</body>

</html>

Toggle_show_hide_same_button


show hide in Same Button ( TOGGLE )
====================================

<a onclick ="javascript:ShowHide('HiddenDiv')" href="javascript:;" >Show/Hide</a>

<div class="mid" id="HiddenDiv" style="DISPLAY: none" >
This text was hidden
</div>

<script language="JavaScript">
function ShowHide(divId)
{
if(document.getElementById(divId).style.display == 'none')
{
document.getElementById(divId).style.display='block';
}
else
{
document.getElementById(divId).style.display = 'none';
}
}
</script>


Show / Hide in seperate Button :
=================================


<a onclick ="javascript:Show('HiddenDiv')" href="javascript:;" >Show</a>

<div class="mid" id="HiddenDiv" style="DISPLAY: none" >
This text was hidden
</div>

<script language="JavaScript">
function Show(divId)
{
if(document.getElementById(divId).style.display == 'none')
{

document.getElementById(divId).style.display='block';
}
}
function hide(divId)
{
if(document.getElementById(divId).style.display == 'block')
{
document.getElementById(divId).style.display = 'none';
}
}
</script>

<a onclick ="javascript:hide('HiddenDiv')" href="javascript:;" >Hide</a>

Toggle image_Javascript

Toggle image_Javascript :
--------------------------------
<!DOCTYPE html>
<html>
<head>
<script language="javascript" type="text/javascript">
var imageNo = 2;
function swapImage() {
image = document.getElementById('image')
switch (imageNo) {
case 1:
  image.src = "img/back.png"
  imageNo = 2
  document.getElementById('content').style.display = 'none'
  return(false);
case 2:
  image.src = "img/back2.png"
  imageNo = 1
document.getElementById('content').style.display = 'block'
return(false);
}
}
</script>
</head>
<body>

 <h4><a ><img id="image" name="image" src="img/back.png" border="0" onclick="swapImage();"/></a></h4>
<!-- Your normal document content lives here -->
</body>
</html>

Toggle_Play_puase_image_audio_JS

Toggle_Play_puase_image_audio_JS :

<!doctype html>

<html>
<body>
<audio  id="player" src="Kalimba.mp3"></audio>
    <img src="img/volumemute.jpg" class="topbottomicon" onclick="aud_play_pause()" id="image"/>

<script>
function aud_play_pause() {
  var myAudio = document.getElementById("player");
  var image = document.getElementById("image");
  if (myAudio.paused) {
     
    myAudio.play();
      image.src = "img/volume.jpg"
  } else {
    myAudio.pause();
      image.src = "img/volumemute.jpg"
  }
}
</script>
</body>
</html>


Two_images_Toggle_Js

Two_images_Toggle_Js :
==================
<!DOCTYPE html>
<html>
<head>
<script language="javascript" type="text/javascript">
var imageNo = 2;
function swapImage()
{
image = document.getElementById('back_btn_image');
if(imageNo ==1)
{
  image.src = "img/back.png"
  imageNo = 2;

  return(false);
}
else
{
  image.src = "img/back2.png"
  imageNo = 1;

return(false);
}
}
</script>
</head>
<body>
<h4><a ><img id="back_btn_image" name="back_btn_image" src="img/back.png" border="0" onclick="swapImage();"/></a></h4>
<!-- Your normal document content lives here -->
</body>
</html>

React + Typescript_ Module federation _ Micro Front end -Standalone and integrated

Module Federation The Module Federation is actually part of Webpack config. This config enables us to expose or receive different parts of t...