Tuesday 28 October 2014

Android SDK Manager failing to open in Android Development Tools Bundle

Thax for Ref :
http://techathlon.com/fix-android-sdk-manager-failing-open-android-development-tools-bundle/


Some times you might encounter an issue with the Android Development Tools bundle where the Android SDK  manager fails to open or closes immediately after showing a command prompt like window. Fortunately it is really easy to solve.
Step 1 :
Go to [sdk-folder]/tools folder (For me it was C:\adt-bundle-windows-x86_64-20130522\sdk\tools).
Step 2 : 
Open the file android.bat in notepad by right clicking on it and selecting Edit from the context menu.
Step 3 :
Find the line in the file that says java_exe.
Notepad android.bat
Step 4:
Now edit the “set java_exe=” line to
set java_exe="C:\Program Files\Java\jre7\bin\java.exe"
My Case It's was windows7 32 processer. I followed without double quotes.
eg : set java_exe=C:\Program Files\Java\jdk1.8.0_20\bin\java.exe
Try some times JRE if java path in that particular location
Here “C:\Program Files\Java\jre7\bin\java.exe” is the path where the java.exe file for the JRE is installed. You should check your Java executable location and change the line accordingly.
Now save the file and close it.  To test it out, in Eclipse go to Window > Android SDK Manager.
Android SDK Manager

Wednesday 3 September 2014

Dynamic pop up dialog using Bootstrap

Dynamic pop up dialog using Bootstrap
html: /php File
    <td class="center"><a style="text-decoration:none;"   data-target="#myModal2" data-toggle="modal" class="btn-lg btn-success btn-small" href="#" onclick="videolink(2)">   Play </a></td>
    <input type="hidden" id="link2" value="mov_bbb.mp4"  />
js:
<script>


function videolink(id)
        {
       
        var videofile=document.getElementById('link'+id).value;
        //alert(videofile);
        
        $("video").append("<source src='<?php echo base_url();?>img/"+videofile+"' type='video/mp4'>");

        }
function closevideo()
{
location.reload(true);
}
</script>


<div class="modal fade " id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-content1">
    <div class="modal-body">
        <video width="530" height="300" controls>
       
        </video>
    </div>
    <div class="modal-footer">
    <button type="button" class="btn btn-danger" data-dismiss="modal" onclick="closevideo()">Close</button>
    </div>
    </div>
</div>

xamp conflict with skype Error

XAMPP, Apache - Error: Apache shutdown unexpectedly

I've just reinstaled XAMPP... + when I try to start my Apache server in the Control Panel I now get following errors:

16:50:25  [Apache]  Status change detected: running
16:50:26  [Apache]  Status change detected: stopped
16:50:26  [Apache]  Error: Apache shutdown unexpectedly.
16:50:26  [Apache]  This may be due to a blocked port, missing dependencies,
16:50:26  [Apache]  improper privileges, a crash, or a shutdown by another method.
16:50:26  [Apache]  Press the Logs button to view error logs and check
16:50:26  [Apache]  the Windows Event Viewer for more clues
16:50:26  [Apache]  If you need more help, copy and post this
16:50:26  [Apache]  entire log window on the forums

SOLUTION:



If you are using the latest Skype, go to Tools -> Options -> Advanced -> connection.

Disable the "Use port 80 and 443 for alternatives for incoming connections"

Sign Out and Close all Skype windows. Try restart your Apache again.

Thanks for Ref Link:
http://stackoverflow.com/questions/18300377/xampp-apache-error-apache-shutdown-unexpectedly

SOLUTION #2

open your xampp control panel then click its "config"
choose the "Apache (httpd.conf)" and find this code below and change it into this one:

#Change this to Listen on specific IP addresses as shown below

#to prevent Apache from glomming onto all bound IP addresses.

#Listen 0.0.0.0:80

#Listen [::]:80

Listen 80

# Dynamic Shared Object (DSO) Support

save it (ctrl + s)
after that, go back to xampp control panel and click again its config
choose "Apache (httpd-ssl.conf)" find this code below and change it again:
# Note: Configurations that use IPv6 but not IPv4-mapped addresses need two

# Listen directives: "Listen [::]:443" and "Listen 0.0.0.0:443"

#

#Listen 0.0.0.0:443

#Listen [::]:443

Listen 443

save it (ctrl + s)
then, click the "config" (note: above the netstat) and click the "service and port settings" then save both of it.
finally, go to the "control panel" -> "Programs & Features" -> "Turn Windows On or Off".
Uncheck your "Internet Information Services" then click ok.
just wait for it and your computer/laptop will be automatically restart and try to open again your xampp control panel then start your Apache.

PHP Array value existing in dropdown box

PHP site Array value existing in Drop Down box

$accom=mysql_query("SELECT * FROM `busyProfile` WHERE `id`='$updateid'");
$accomdetail=mysql_fetch_array($accom);
$accom=$accomdetail['accomm'];
$accom= explode(",",$accom);
//echo $accom[0];


$getcafeDetails=mysql_query("SELECT * FROM `accomm`");   
$i=0;
while($getDetails=mysql_fetch_array($getcafeDetails))
{
    $accom_id=$getDetails['accommodation_id'];
    $accom__text=urldecode($getDetails['accommodation_text']);
   
    ?>   


<?php if(in_array($accom_id, $accom)) {  echo 'checked'; } ?>


$i++;}
------------------------------------------------------------------------------------------

$type='str1';

while($getType=mysql_fetch_array($getBusinessType))
{
$businessType=$getType['businessType'];
$businessTypeid=$getType['id'];

?>


<option name="businessTypename" value="<?php echo $businessTypeid;?>" 
<?php if(isset($type)) if($type == $businessTypeid ) { ?>selected= "selected"<?php } ?>>
<?php echo $businessType; ?></option>

PHP upload empty checking

PHP upload file is checking for empty or null 

if (!empty($_FILES['file2']) && ($_FILES['file2']['name'] != ''))
{

}

Time show in header footer of Site

Display Time Header /footer any part of web site :
-------------------------------------------------------------------
paste this code with matched bgcolor and show time everypage of template / site
           
<?php    date_default_timezone_set("Asia/Kolkata");
echo date('h:i A'); ?>

PHP select single colun value





PHP single column value :

$post_like_id=mysql_query("SELECT * FROM `post_answer` WHERE `postid` = '$questionID'");

$post_answer = mysql_fetch_array($post_like_id);

$like=$post_answer['p_id'];

PHP 12 hour to 24 hrs time format conversion

PHP 12 hour time 24 hour time convertion:
==========================================


<?PHP

// 24-hour time to 12-hour time
$time_in_12_hour_format  = DATE("g:i a", STRTOTIME("13:30"));

// 12-hour time to 24-hour time
$time_in_24_hour_format  = DATE("H:i", STRTOTIME("1:30 pm"));

?>

REf :link Thax for link
http://psoug.org/snippet/Convert_12_to_24_hour_time_and_vice_versa_241.htm

To add one year - PHP mysql

To add one year to todays date use the following: PHP

$oneYearOn = date('Y-m-d',strtotime(date("Y-m-d", mktime()) . " + 365 day"));

For the other examples you must initialize $StartingDate with a timestamp value for example:

$StartingDate = mktime();  // todays date as a timestamp

Try this

$newEndingDate = date("Y-m-d", strtotime(date("Y-m-d", strtotime($StaringDate)) . " + 365 day"));

or

$newEndingDate = date("Y-m-d", strtotime(date("Y-m-d", strtotime($StaringDate)

PHP JS How to assign a PHP variable value to JavaScript variable

How to assign a PHP variable value to JavaScript variable

In javascript with echo version: var name1= "'.$name.'";

<?php
$name = "anurag singh";
echo '
    <html>
        <head>
        <script type="text/javascript" src="jquery-2.0.2.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                var name1= "'.$name.'";
                $.post("main_page.php",{input1: name1}, function(msg){
                    alert("hi "+msg);
                });
            });
        </script>
        </head>

        <body>
            <h1>This is the demo!</h1>
            <h2>In echo we can add more than one statements</h2>
        </body>
    </html>
    ';
?>

Foreach loop in CI - Array value display

To display Array values from control ( more than 1 row or records) PHP

use foreach($arravar as $arr) :

 <?php foreach($schedule as $sched) { $sched['col_name'] }
    ?>

End once all records are showed

-------------------------------------------------------------------

To display Array values from control only 1 row

use $arravar[0]['col_name']
 <?php echo $schedule[0]['schedule_child_id']; ?>
                              

To display Array values from control ( more than 1 row or recods)

To display Array values from control ( more than 1 row or records) PHP

use foreach($arravar as $arr) :

 <?php foreach($schedule as $sched) { $sched['col_name'] }
    ?>

End once all records are showed

-------------------------------------------------------------------

To display Array values from control only 1 row

use $arravar[0]['col_name']
 <?php echo $schedule[0]['schedule_child_id']; ?>
                              

Thursday 28 August 2014

Array filter with Implode process - PHP

 Array filter with Implode process :

<?php
$chat_list=array(0,1,2,3,4,5,0,4,2,3);  // This array have duplicates

$user=array();

foreach($chat_list as $key=>$chat)
{
 $user[$key]=$chat['UserName'];
}

 print_r(implode(' , ',array_unique($user))); //This will show unique and added comma for each element.

 ?>

PHP Array filter working code


Array filter does not allow duplicate values:

<?php
$array = array(1, "hello", 1, "world", "hello");

$new=array_filter(array_count_values($array),'custom_filter');

print_r($new);

function custom_filter($val)
{
  return $val > 1;
}

?>

HTML Image Zoom Js function

<!doctype html>
<html>

<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

<script type="text/javascript" src="http://www.dynamicdrive.com/dynamicindex4/jquery.magnifier.js">

/***********************************************
* jQuery Image Magnify- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/

</script>

</head>

<body>
<img src="icon.jpg" class="magnify" style="width:200px; height:150px" />

<img src="logo.jpg" class="magnify" border="0" />
</body>
</html>

HTML video play

HTML Video Play Control : 

<html>
<head>
  </head>
<body>

  <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none"
 width="450" height="264"       data-setup="{}">
   
    <source src="v1.mp4" type='video/mp4' />
   
    <video src="v1.mp4" controls autoplay loop muted preload="auto" poster="demo.jpg" >
HTML5 Video is required for this example
 
  </video>

</body>
</html>

required JS for Phonenumber validation accept + -

Text field validation keep data after submit use required="required"
--------------------------------------------------------------------

Article:2
<input type="text" id="" name="phone" onkeypress="return onlyNos(event,this);" maxlength="15" required="required">

<script language="Javascript" type="text/javascript">

        function onlyNos(e, t) {

            try {

                if (window.event) {

                    var charCode = window.event.keyCode;

                }

                else if (e) {

                    var charCode = e.which;

                }

                else { return true; }

                if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode > 43 && charCode > 45) {

                    return false;

                }

                return true;

            }

            catch (err) {

                alert(err.Description);

            }

        }



    </script>

Image Upload When click on sample image HTML PHP

html:

<input id="profile-image-upload" class="hidden" type="file">
<div id="profile-image">click here to change profile image</div>

js:

$(function() {
    $('#profile-image').on('click', function() {
        $('#profile-image-upload').click();
    });
});

   
css:

input.hidden {
    position: absolute;
    left: -9999px;
}

#profile-image {
    cursor: pointer;
    background: #8adffb;
     width: 80px;
    height: 80px;
}

Ref : jquery1.9.1
REF: http://jsfiddle.net/L8xCb/3/

working code:


<div id="profile-image1"><img  src="<?php echo $image1; ?>" ></div>
 <input id="profile-image-upload1" class="hidden" type="file" name="file1"></input>

We can add more than one image image1,image2 at css,js files.

Footer Fixed at bottom possible without jQuery

Footer fixed bottom position

I have a page with only a couple of lines of content. I want the footer to be pushed to the bottom.

<div id="footer"></div>

I don't want to use #footer{ position:fixed;bottom:0; } AKA Sticky Footer

Is this possible without jQuery?

ThaX for REf link:    http://stackoverflow.com/questions/16679146/force-footer-on-bottom-on-pages-with-little-content
<html>
    <head>
        <link rel="stylesheet" href="layout.css" ... />
    </head>
    <body>
        <div class="wrapper">
            <p>Your website content here.</p>
            <div class="push"></div>
        </div>
        <div class="footer">
            <p>Copyright (c) 2008</p>
        </div>
    </body>
<style>

* {
margin: 0;
}
html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -4em;
}
.footer, .push {
height: 4em;
}
</style>
</html>

Dynamic Text Box add edit and delete and change HTML PHP

Dynamic Text Box add edit and delete and change that values as Array format and store in single column with comma(,) seperator.
Addform.php:
-------------
<?php
<script src="admin/js/jquery-1.11.1.js" ></script>

<form action="adddata.php" method="post" name="addevents"
 <td rowspan="2" style="border:1px solid #ccc;overflow:auto;">
    <div style="overflow:auto;">
    Latitude : <input type="text" name="latitude[]"   />
    Longitude : <input type="text" name="longitude[]"    />
    <input type="button" onclick="addFormField()" value="add" /><br>
   
   
    <div id="MoreFiles">
    </div>
   
<script type="text/javascript" language="javascript">
  var id = 1;
  function addFormField() {
 
      if(id < 100){
        
     
      jQuery("#MoreFiles").append("<div class='spacer'></div><div class='AdmFleft'>
      <div id='row"+id+"'><div class='control-group'>
      <div class='controls'>
      <label class='control-label' for='focusedInput'>Latitude : <input class='input-xlarge focused'  type='text' value='' name='latitude[]'>&nbsp;
      <label class='control-label' for='focusedInput'>Longitude : <input class='input-xlarge focused'  type='text' value='' name='longitude[]'>
      <a href='#' onClick='removeFormField(\"#row"+id+"\"); return false;'>DELETE</a></div></div></div></div>");
      id++;
      //id = (id-1) + 2;
      //document.getElementById('id').value = id;
     // datep();
      }
      else
        alert('Limit Reached');
     
  }
  function removeFormField(id) {
  alert(id);
     
      jQuery(id).remove();
  }

</script>
</td>
</form>
?>

adddata.php:
============
<?php

$lat=$_POST["latitude"];
$long=$_POST["longitude"];
foreach($lat as $latitude)
{
 $item1 .= $latitude.',';
}
foreach($long as $longitude)
{
 $item2 .= $longitude.',';
}
$latitude=substr($item1,0,-1);
$longitude=substr($item2,0,-1);
//$longitude0.','.$longitude1.','.$longitude2.','.$longitude3.','.$longitude4;
//insert  into $latitude......,

?>

================================
editform.php:
-------------


$id = $_GET['id'];
$query=mysql_query("select * from events where eventid=$id");
$res = mysql_fetch_assoc($query);

<td rowspan="2" style="border:1px solid #ccc;">
   
    <?php $latitude=explode(',' ,$res["latitude"]);  $longitude=explode(',' ,$res["longitude"]); ?>
    <?php foreach($latitude as $key => $lat1) { if($latitude[0] == $latitude[$key]) { ?>
   
    Latitude : <input type="text" name="latitude[]" id="latitude0"  value="<?php if(isset($lat1)){ echo $lat1;} else{ echo ''; }; ?>"  />
    Longitude : <input type="text" name="longitude[]" id="longitude0"   value="<?php if(isset($longitude[$key])) { echo $longitude[$key];} else{ echo ''; }; ?>"/>
        <input type="button" onclick="addFormField()" value="add" /><?php }
        else{?> <div id=<?php echo $key; ?>'>
       
    <div id="MoreFile">
    <div class="spacer"></div><div class="AdmFleft"><div id="rows<?php echo $key;?>"><div class="control-group"><div class="controls"><label for="focusedInput" class="control-label">Latitude : <input type="text" name="latitude[]" value="<?php if(isset($lat1)){ echo $lat1;} else{ echo ''; }; ?>" class="input-xlarge focused">&nbsp;<label for="focusedInput" class="control-label">Longitude : <input type="text" name="longitude[]" value="<?php if(isset($longitude[$key])) { echo $longitude[$key];} else{ echo ''; }; ?>" class="input-xlarge focused"><a onclick="removeFormField1(rows<?php echo $key;?>); return false;" href="#">DELETE</a></label></label></div></div></div></div></div>
                <?php } } ?>
       
        <div id="MoreFiles">
    </div>
   
   
<script type="text/javascript" language="javascript">

  var id = 1;
  function addFormField() {
 
      if(id < 100){
     
      jQuery("#MoreFiles").append("<div class='spacer'></div><div class='AdmFleft'><div id='row"+id+"'><div class='control-group'><div class='controls'><label class='control-label' for='focusedInput'>Latitude : <input class='input-xlarge focused'  type='text' value='' name='latitude[]'>&nbsp;<label class='control-label' for='focusedInput'>Longitude : <input class='input-xlarge focused'  type='text' value='' name='longitude[]'><a href='#' onClick='removeFormField(\"#row"+id+"\"); return false;'>DELETE</a></div></div></div></div>");
      id++;
      //id = (id-1) + 2;
      //document.getElementById('id').value = id;
     // datep();
      }
      else
        alert('Limit Reached');
     
  }
  function removeFormField(id) {
  //alert(id);
     
      jQuery(id).remove();
  }
   function removeFormField1(id) {
  alert(id);
     
      jQuery(id).remove();
  }


</script>
    </td>
-----
edit_event_process.php
Same thing follow in add details....

HTML Time Picker

Dowload files link : http://curioussolutions.github.io/DateTimePicker/



HTML TimePicker Example Snippet:

<!DOCTYPE html>

<html>

   
<head>
   

<title>Time Picker</title>

<link rel="stylesheet" type="text/css" href="../src/DateTimePicker.css" />
   


<script type="text/javascript" src="jquery-1.11.0.min.js"></script>
   
<script type="text/javascript" src="../src/DateTimePicker.js"></script>
   

<!--[if lt IE 9]>
           
<link rel="stylesheet" type="text/css" href="../src/DateTimePicker-ltie9.css" />

<script type="text/javascript" src="../src/DateTimePicker-ltie9.js"></script>

<![endif]-->
       


<style type="text/css">

p{
margin-left: 20px;

}


input{
width: 200px;

padding: 10px;

margin-left: 20px;
   
margin-bottom: 20px;

}

</style>
       

</head>
   

<body>
   

<p>Time : </p>
<input type="text" data-field="time" readonly>
   
<div id="timeBox"></div>
   
<input type="text" data-field="date" readonly>

<div id="dateBox"></div>

<script type="text/javascript">
   
$(document).ready(function()
   
{
$("#timeBox").DateTimePicker();
   
$("#dateBox").DateTimePicker();
    });

</script>
   

</body>

s
</html>

Tuesday 26 August 2014

JQM Phonegap Database login , php and home page

login.html:

<!DOCTYPE html> 
<html>
<head>
<meta charset="utf-8">
<title> Mobile Web App</title>
<link href="jquery-mobile/jquery.mobile-1.0.min.css" rel="stylesheet" type="text/css"/>
<script src="jquery-mobile/jquery-1.6.4.min.js" type="text/javascript"></script>

<script src="jquery-mobile/jquery.mobile-1.0.min.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jquery.validate.js"></script>
<link rel="stylesheet" href="css/validate.css" />
<link rel="stylesheet" href="kphome.css" />
<script type="text/javascript" src="cordova-2.6.0.js"></script>

<script type="text/javascript">    

            $(document).bind("mobileinit", function()    // script for page flickering
        {    
                $.mobile.defaultPageTransition = 'none';
                $.mobile.defaultDialogTransition = 'none';
          
        });
            
            </script> 
            
<script type="text/javascript">    
            

var url="http://192.168.1.36:9090/hrms/";


document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady()                          // device functionality
{
Dplatform=device.platform;
OSveriosn=device.version;
UUID= device.uuid;
alert('UUID'+UUID+'name'+OSveriosn+'OS'+Dplatform);
deviceinfo='OS: '+Dplatform+'Versionname: '+OSveriosn+'UUID: '+UUID;
alert(deviceinfo);
getDeviceLocation();
//alert("GEO:"+geo);


document.addEventListener("backbutton", Backbutton,false);
//msgloadingimage();
UUID=device.uuid;
//alert(UUID);
   sessionStorage.setItem('uuid',UUID);   
ApplicationVersionName="1.0";

/* if(navigator.network.connection.type==Connection.NONE || navigator.network.connection.type=="unknown" || navigator.network.connection.type==Connection.UNKNOWN)

{
        alert("Check Internet Connectivity");
       
        }
else{ */        
   
 $.ajax({
 url: url+"ANDROID_versionname.php",
 type:"POST",
 data:{"version":ApplicationVersionName}, 
 timeout: 5000,
 success: function(data) {
 if(data==10)
 {
 
 }
 else if(data==20)
 {
 alert("Please update the Current version 1.1");
 navigator.app.exitApp();  
 }
 
   },error:function(x, t, m)                      //notification API
       {   
           if(t==="timeout") {  navigator.notification.alert("Your Data connection is too slow", alertCallback,  "Alert");  
           
           else {  navigator.notification.alert("Check Internet Connectivity", alertCallback,  "Alert");           }
       }

}); 
       // }
 





function alertCallback()
{}

 function Backbutton(){
 if($.mobile.activePage.is("#index")){
  
navigator.notification.confirm('Do you want to exit', onConfirm,'Alert');               
     } 
     
     function onConfirm(button) 
     {
      if(button==1)
      {
       //  e.preventDefault();                  
            navigator.app.exitApp();
      }
      else
      {
      }
     }
 }


function  getDeviceLocation() {                  // geolocation API
//alert('a');
        navigator.geolocation.getCurrentPosition(showPosition, showError, { enableHighAccuracy: true } );
   }

function showPosition(position) {
alert('b');
         alert("Latitude: " + position.coords.latitude + "Longitude: " + position.coords.longitude);    
 geo="Latitude: " + position.coords.latitude + "Longitude: " + position.coords.longitude;
        // geo1=geo.val();
         alert(geo);
        
 }

//5.Create a function to handle the error.

 function showError(error) {

       alert("Errorcode: "    + error.code    + 
                "Errormessage: "+ error.message );
   }
function AlertHandler()
{
       // Codes 
navigator.notification.alert('This is an alert message', AlertHandler, 'Message', 'Exit');
   }
function loginvalidate()
 {
//alert("s");
        
var x=document.forms["loginn"]["username"].value;       
      
      if(x==null || x=="")
      {
navigator.notification.alert("Username cannot be left blank", alertCallback,  "Alert");      
          return false;  
       }

var x=document.forms["loginn"]["password"].value;         
      
      if(x==null || x=="")
      {
navigator.notification.alert("Password cannot be left blank", alertCallback,  "Alert");                                 
          return false;  
       }
    
      else
      {
          
          return true;
      }
 
 }   
 
function help()
{
navigator.notification.alert("Credentials identifies your organization at kp. Your organization may not be on our mobile application support.Please write/check with your Mobile HRMS for your Organization enrolment and the company Details", alertCallback,  "Alert"); 
}

function passingcode()                        // AJAX jquery Database connectivity
    {
//var url="http://http://192.168.1.36:9090//hrms/";
alert("passcode")
// $.mobile.loading( 'show' );

        var validate=loginvalidate();
        if(validate==true){
            
    var username= $("#username").val().toString(); //document.getElementById('compcode').value;
    var password= $("#password").val().toString(); 
    datavalue="username="+username+"&password="+password;
    alert(datavalue)
    $.ajax({
    url: url+"kp_login.php",
    type:"POST",
    data:datavalue,
    timeout: 5000,
    success: function(data) {   
   //  alert('c');
     
  data=jQuery.parseJSON(data);
  alert(data);
 
  if(data.status==1){
 
  / // db maintanance
 
  sessionStorage.clear();  // storage session info clear
  sessionStorage.setItem('dbname',data.dbname);
sessionStorage.setItem('dbserver',data.dbserver);
//sessionStorage.setItem('logo',data.logo);
sessionStorage.setItem('dbuserid',data.dbuserid);        
sessionStorage.setItem('dbpass',data.dbpass);

//sessionStorage.setItem('uid',username);//empcode
sessionStorage.setItem('url',url);
//sessionStorage.setItem('name',data.name);
//sessionStorage.setItem('companyid',compcode);
sessionStorage.setItem('empid',data.empid);
$.mobile.showPageLoadingMsg();
               window.location='kphome.html';
               //sessionStorage.clear(); do not pass data 
               
  navigator.notification.alert("Login success", alertCallback,  "Alert");
  sessionStorage.setItem('url',url);
  // alert("Login success");
  $.mobile.showPageLoadingMsg();
  window.location="kphome.html";
  //$.mobile.pageLoading;
   }
   else if(data==2)
   {
  navigator.notification.alert("Invalid Username", alertCallback,  "Alert");     
  //alert("Invalid username");
  $('#username').val('');
  $('#password').val('');
  }
 
      },error: function(){
  alert('Network activity error');
  }
  });
        }else{
       
        $.mobile.hidePageLoadingMsg();
          //  $.mobile.loading( 'hide' );
        }
   }

</script>

</head> 
<body> 

<div data-role="page" id="index"><!-- index page -->

<div data-role="header"  data-theme="b" style="background: url(images/bg5.png) repeat-x;">
     <div align="center"><img src="images/icon.png" a style="vertical-align:bottom;height:40px;text-align:center;">
  <span>MOBILE HRMS</span></div>
    </div><!-- /header -->

<div data-role="content" class="pagecontent" >
 
            <div class="inset" >
            <div align="center">  <h3 style="color:#08298A;"> MEMBER LOGIN </h3></div>
            <br>
            <hr size="1px" align="left">
            <!-- <form name="kp_login" method="get"  onSubmit="return loginvalidate();" or add to login function function call action="javascipt:kp_login();"> -->
            <form id="Login" method="post" name="loginn" action="javascript:passingcode()">
            
            <p> USER NAME :<img src="images/Help.png" align="right" style="vertical-align:right;" onclick="help()" /> </p>
            <input type="text" name="username" id="username" value="" autocomplete="off" placeholder="User Name" data-clear-btn="true" min="3" maxlength="10"/>
            <p> PASS WORD : </p>
            <input type="password" data-clear-btn="true" name="password" id="password" autocomplete="off" value=""placeholder="Pass Word" min="3" maxlength="8"/>
          
            <div data-role="fieldcontain">
             <input type="submit" name="login" value="Sign In"  /> 
            </div>
        </form>
            <br />
            <hr size="1px">
            <div data-role="fieldcontain" align="justify">
            <a  href="kp_newreg.html" rel="external" data-role="button"  data-inline="true" data-theme="a">New Registration</a>
      <a  href="kp_forgotpass.html" rel="external" data-role="button"  data-inline="true" data-theme="a">Forgot Password?</a>
     
            </div>
            </div>
        </div>
</div><!-- /content -->
    
    <div data-role="footer" data-position="fixed"  style="background: url(images/bg5.png) repeat-x;overflow:hidden;">
    <h4> Tech</h4>
    
</div><!-- /footer -->
</div><!-- /index page -->

</body>
</html>

kp_login.php:

<?php 
//session_start();
$username =$_POST["username"]; //Storing username in $username variable.
$password =$_POST["password"]; //Storing password in $password variable.
include("kp_dbconn.php"); //including config.php in our file
$row=array();
$qry = mysql_query("select firstname from persons where firstname = '$username' and lastname = '$password'") or die (mysql_error());


 if(mysql_affected_rows()>0){


$empdetail =mysql_query("select * from corpratedetails where empid = '$username'") or die(mysql_error());// select here image of emp and amp logo
if($empdetail==true)


//$row = mysql_fetch_array($empdetail);

  //echo $row[];
 $row['status']=1;$row['empid']=$username; $row['dbname']='test'; $row['dbserver']='localhost'; $row['dbuserid']='root';
  $row['dbpass']=' ';

echo json_encode($row);
}
else{

echo 2;
echo "username and password wrong";
}
}
   

?>


kphome.html:

<!DOCTYPE html> 
<html>
<head>
<meta charset="utf-8">
<title> Mobile Web App</title>
<link href="jquery-mobile/jquery.mobile-1.0.min.css" rel="stylesheet" type="text/css"/>
<script src="jquery-mobile/jquery-1.6.4.min.js" type="text/javascript"></script>
<script src="jquery-mobile/jquery.mobile-1.0.min.js" type="text/javascript"></script>
<script src="json2.js" type="text/javascript"></script>

<script type="text/javascript" src="cordova-2.6.0.js"></script>
<link rel="stylesheet" href="kphome.css" />
<script type="text/javascript">    
            $(document).bind("mobileinit", function()
        {    
                $.mobile.defaultPageTransition = 'none';
                $.mobile.defaultDialogTransition = 'none';
          
        });
</script>  
<script>
document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() { 
url=sessionStorage.getItem('url');

document.addEventListener("backbutton", Backbutton , false);
}


function Backbutton() 
{
//alert('a')
$.mobile.showPageLoadingMsg();
window.location="index.html";
$.mobile.hidePageLoadingMsg();
}
function back_button()
{
navigator.notification.alert("Use logout", alertCallback,  "Alert"); 
/* $.mobile.showPageLoadingMsg();
window.location="index.html";
$.mobile.hidePageLoadingMsg(); */
}
function alertCallback()
{}
function logout()
{
navigator.notification.confirm('Do you want to logout', onConfirm,'Alert');

}


function onConfirm(button) 
{
if(button==1)
{
$.mobile.showPageLoadingMsg();
window.location="index.html";
sessionStorage.clear();
}
else
{

}
}

</script>
</head> 
<body> 

<div data-role="page" id="kphomepage">
<div data-role="header"  data-theme="b" style="background: url(images/bg5.png) repeat-x;">
    <h1 style="color:#FFF">Mobile HRMS</h1>
    
    <!--<a href="#" data-icon="gear" class="ui-btn-right">Options</a>-->
   <!-- <div data-role="navbar" >
        <ul>
            <li><a  href="#page3" style="color:#fff;background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#bdbdbd), to(#000));;border-color:#fff;border-left-color:#fff;border-right-color:#fff;" class="ui-btn-active">Attendence System</a></li>
            <li><a href="#page4"style="color:#fff;background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#bdbdbd), to(#000));;border-color:#fff;border-left-color:#fff;border-right-color:#fff;">Corporate Directory</a></li>
            <li><a href="#page5"style="color:#fff;background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#bdbdbd), to(#000));;border-color:#fff;border-left-color:#fff;border-right-color:#fff;">List of Holidays</a></li>
        </ul>
    </div>--><!-- /navbar -->
</div><!-- /header -->

<div data-role="content" class="pagecontent" >
    <div class="backlogobutton" >
    
    
    <!-- <a href="javascript:back_button()" rel="external"  data-theme="b" data-inline="true" style="float:left; margin-top:0px;" >
<img id="home_icon" alt="home"  style="width:20px;  height:20px; " src="images/2.png"> </a> -->

    <img src="images/kp.gif" id='helplogo' >   
 
  <a href="javascript:logout()"  title="Logout" rel="external"  data-theme="b" data-inline="true" style="float:right;margin-top:0px; " >
<img id="logout_icon" alt="logout"  style="width:35px;  height:35px;vertical-align: center " src="images/logout.png"  > </a>
<br>

   
    
    </div>
     <div class="inset" >
<ul data-role="listview" data-inset="true">
        <li><a href="kpattendence.html" rel="external">Attendance Management</a></li>
<li><a href="kp_corp_add.html" rel="external" >Corporate Directory</a></li>
            <li><a href="kp_listofholidays.html" rel="external" >List of Holidays</a></li>
            <li><a href="kp_timsheet.html" rel="external">Time sheet</a></li>
<li><a href="kp_payslip.html" rel="external">Pay slip</a></li>
            <li><a href="kp_helpdesk.html" rel="external">Help Desk</a></li>
            <!--<li><a href="#page8">Help Desk</a></li>
            
<li><a href="#page10">Page ten</a></li>-->
</ul>
</div>
    </div>
<!--<div data-role="footer" data-position="fixed" style="background: url(images/bg5.png) repeat-x;";>
<h4>kp Tech</h4>
</div>-->
    
    <div data-role="footer" data-position="fixed"  style="background: url(images/bg5.png) repeat-x;overflow:hidden;">
    <h3 align="center">@kp</h3>
    <!--<div data-role="navbar">
        <ul>
            <li><a  href="#page3" style="color:#fff;background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#000), to(#bdbdbd));border-color:#fff;border-left-color:#fff;border-right-color:#fff;" class="ui-btn-active">Time Sheet</a></li>
            <li><a  href="#page3" style="color:#fff;background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#000), to(#bdbdbd));border-color:#fff;border-left-color:#fff;border-right-color:#fff;" class="ui-btn-active">Pay Slip</a></li>
            <li><a  href="#page3" style="color:#fff;background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#000), to(#bdbdbd));border-color:#fff;border-left-color:#fff;border-right-color:#fff;" class="ui-btn-active">Help Desk</a></li>
        </ul>-->
    </div><!-- /navbar -->
</div><!-- /footer -->
</div>




</body>

</html>

Friday 22 August 2014

Multiple version of jquery in the same Page

jQuery in no-conflict mode. "No conflict" mode is the typical solution to get jQuery working on a page with other frameworks like prototype, and can be also be used here as it essentially namespaces each version of jQuery which you load.
<script src="jQuery1.3.js"></script>
<script>
    jq13 = jQuery.noConflict(true);
</script>

<!-- original author's jquery version -->
<script src="jQuery1.2.3.js"></script>
<script src="jQuery1.3.js"></script>
<script>
    jq13 = jQuery.noConflict(true);
</script>
<script src="jQuery1.3.1.js"></script>
<script>
    jq131 = jQuery.noConflict(true);
</script>

<!-- original author's jquery version -->
<script src="jQuery1.2.3.js"></script>
The variables jq13 and jq131 would each be used for the version-specific features you require.
It's important that the jQuery used by the original developer is loaded last - the original developer likely wrote their code under the assumption that $() would be using their jQuery version. If you load another version after theirs, the $ will be "grabbed" by the last version you load, which would mean the original developer's code running on the latest library version, rendering the noConflicts somewhat redundant!
Why do conflicts happen? Conflicts typically happen because many JavaScript Libraries/Frameworks use the same shortcut name which is the dollar symbol $. Then if they have the same named functions the browser gets confused!
How do we prevent conflicts? Well, to prevent conflicts i recommend aliasing the jQuery namespace (ie by using example 3 above). Then when you call $.noConflict() to avoid namespace difficulties (as the $ shortcut is no longer available) we are forcing it to wrtie jQuery each time it is required.
1
2
3
4
5
6
7
8
9
10
jQuery.noConflict(); // Reverts '$' variable back to other JS libraries
jQuery(document).ready( function(){
         //do jQuery stuff when DOM is ready with no conflicts
   }); 
 
//or the self executing function way
 jQuery.noConflict();
 (function($) {
    // code using $ as alias to jQuery
})(jQuery);

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...