Tuesday 25 June 2013

Phongap JQM background hear image include


Phonegap Background image include in phonegap application

<!-- Copyright (c) 2012 Mobile Developer Solutions -->
<!DOCTYPE HTML>
<html>
  <head>
    <meta http-equiv="Content-type" name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">
    <title>MDS PhoneGap API Demo with jQuery Mobile</title>

        <link rel="stylesheet" href="jquery.mobile/jquery.mobile{$jqmversion}.min.css" />
        <link rel="stylesheet" href="index.css" />

    <script src="jquery.mobile/jquery-1.7.2.min"></script>
        <script src="jquery.mobile/jquery.mobile-1.1.0.min.js"></script>
        <script type="text/javascript" charset="utf-8" src="phonegap-1.4.1.js"></script>
        <script type="text/javascript" charset="utf-8" src="index.js"></script>
       

 <style type="text/css">

.ui-page {
    background: url(image/HRMS.png);
    background-repeat:no-repeat;
    background-position:center center;
    background-size:cover;
     background-size:100% 100%;
   
}

</style>

</head>
<body>

<div data-role="page" data-theme="b" id="pagehome">

<div data-role="header">
    <h1>Header tex</h1>
</div><!-- /header -->

<div data-role="content" data-theme="d">  
some text
    </div><!-- /content -->

<div data-role="footer">
<h1>Neki izbornik</h1>
</div>
</div><!-- /page -->
  </body>
</html>









=================================

Header image include in phonegap


<div id="wrapperHeader">
 <div id="header">
  <img src="images/logo.png" alt="logo" />
 </div>
</div>



div#wrapperHeader {
 width:100%;
 height;200px; /* height of the background image? */
 background:url(images/header.png) repeat-x 0 0;
 text-align:center;
}

div#wrapperHeader div#header {
 width:1000px;
 height:200px;
 margin:0 auto;
}

div#wrapperHeader div#header img {
 width:; /* the width of the logo image */
 height:; /* the height of the logo image */
 margin:0 auto;
}

Save word file as PDF format in ms word 2007


Save word file as PDF format in ms word 2007

Open an MS word file (with your content).Have to save as a PDF format, the following steps help.
1) File save as -> add pdf or XPs plugin. Click it.
2) Download the saveasPDF.exe file. (first it download as 37 MB download file. Second time download tat as 937 KB saveasPDF file.exe format.
3) After installation success. Automatically  in word file change to save as PDF format option appear.
(No need to close and open word file)(No need pdf converted).(internet connection required).(If have that save asPDF.exe application no need internet connection).

Saturday 1 June 2013

Mysql datadase to Excel Sheet convertsion PHP script


PHP script for mysql database to excel can convert automatically the file run in browser.

Database, User name, Password, Table Name are included/mention here. Consider user requirements.

<?php
 ob_start();
 mysql_connect('localhost','root','');
 mysql_select_db('test');
 $sql = "SELECT * from log_attempts";
 $res = mysql_query( $sql) or die();
 $count = mysql_num_fields($res);

 // fetch table header from database
 $header = '';
 for ($i = 0; $i < $count; $i++){
    $header .= mysql_field_name($res, $i)."\t";
    }

 // fetch data each row, store on tabular row data
 while($row = mysql_fetch_row($res)){
   $line = '';
   foreach($row as $value){
   if(!isset($value) || $value == ""){
     $value = "\t";
   }else{
     $value = str_replace('"', '""', $value);
     $value = '"' . $value . '"' . "\t";
   }
   $line .= $value;
   }
   $data .= trim($line)."\n";
   $data = str_replace("\r", "", $data);
  }

 $name=date('d-m-y').'-list.xls';
header("Content-type:application/vnd.ms-excel;name='excel'");
 header("Content-Disposition: attachment; filename=$name");
 header("Pragma: no-cache");
 header("Expires: 0");

 // Output data
 echo $header."\n\n".$data;
 ?>

HTML5 Offline Database Complete code


HTML5 Database 
<!DOCTYPE html>
<html>
<head>
<title>OffLine Storage</title>
<script src="http://www.google.com/jsapi"></script>
<script>
      google.load("jquery", "1.4.1");
</script>
<script>
      var db = window.openDatabase("Student", "", "Previous Course", 1024*1000);

      function insertSubject(subject_one, subject_two, course_id, email) {

       db.transaction(function(tx) {
          tx.executeSql('INSERT INTO Course (course_id, subject_one, subject_two, email) VALUES (?, ?, ?, ?)', [course_id, subject_one, subject_two, email]);
       });
      }

      function renderResults(tx, rs) {
          e = $('#previous_course');
          e.html("");
          for(var i=0; i < rs.rows.length; i++) {
            r = rs.rows.item(i);
            e.html(e.html() + 'id: ' + r['id'] + ', subject_one: ' + r['subject_one'] + ', subject_two: ' + r['subject_two'] + ', email: ' + r['email'] + '<br />');
          }
        }
        function displayData(email) {
          db.transaction(function(tx) {
            if (!(email === undefined)) {
              tx.executeSql('SELECT * FROM Course WHERE email = ?', [email], renderResults);
            } else {
              tx.executeSql('SELECT * FROM Course', [], renderResults);
            }
          });
        }
        $(document).ready(function() {

         db.transaction(function(tx) {
                 tx.executeSql('CREATE TABLE IF NOT EXISTS Course(id INTEGER PRIMARY KEY, course_id INTEGER, subject_one TEXT, subject_two TEXT, email TEXT)', []);
               });
               $('#course_form').submit(function() {
                course = { 1: $('#subject1').val(), 2: $('#subject2').val() };
                insertSubject($('#subject1').val(), $('#subject2').val(), 1, $('#email').val());
                displayData();
            return false;
          });
              displayData();
        });
    </script>
</head>
<body>
<form method="get" id="course_form">
<div>
<label for="1">Subject 1</label> <input type="text" value=""
id="subject1" name="subject1" placeholder="subject" />
</div>
<div>
<label for="2">Subject 2</label> <input type="text" value=""
id="subject2" name="subject2" placeholder="subject" />
</div>
<div>
<input type="email" id="email" placeholder="Enter your email address"
size="40" />
</div>
<div>
<input type="submit" value="Upload Data" />
<input type="button" value="Fetch" onChange="displayData(email);" />
</div>
</form>
<div>
<h2>Previous Course</h2>
</div>
<div id="previous_course"></div>
</body>
</html>
<!--

table created: file one script
-----------------------------
 <script src="http://www.google.com/jsapi"></script>
    <script>
      google.load("jquery", "1.4.1");
    </script>
    <script>
      var db = window.openDatabase("Student", "", "Previous Course", 1024*1000);
      $(document).ready(function() {
        db.transaction(function(tx) {
          tx.executeSql('CREATE TABLE IF NOT EXISTS Course(id INTEGER PRIMARY KEY, course_id INTEGER, subject_one TEXT, subject_two TEXT, email TEXT)', []);
        });
      });
    </script>
   
   
insert data feilds; File two script
------------------------------------
<script>
      var db = window.openDatabase("Student", "", "Previous Course", 1024*1000);

      function insertSubject(subject_one, subject_two, course_id, email) {
       db.transaction(function(tx) {
          tx.executeSql('INSERT INTO Course (course_id, subject_one, subject_two, email) VALUES (?, ?, ?, ?)', [course_id, subject_one, subject_two, email]);
       });
      }

      $(document).ready(function() {
        db.transaction(function(tx) {
          tx.executeSql('CREATE TABLE IF NOT EXISTS Course(id INTEGER PRIMARY KEY, course_id INTEGER, subject_one TEXT, subject_two TEXT, email TEXT)', []);
        });

        $('#course_form').submit(function() {
         course = { 1: $('#subject1').val(), 2: $('#subject2').val() };
         
           insertSubject($('#subject1').val(), $('#subject2').val(), 1, $('#email').val());

          return false;
        });
      });
    </script>
   
 Fetch data file automatically: file three script
 -------------------------------------------------

 <script src="http://www.google.com/jsapi"></script>
<script>
      google.load("jquery", "1.4.1");
</script>
<script>
      var db = window.openDatabase("Student", "", "Previous Course", 1024*1000);

      function insertSubject(subject_one, subject_two, course_id, email) {

       db.transaction(function(tx) {
          tx.executeSql('INSERT INTO Course (course_id, subject_one, subject_two, email) VALUES (?, ?, ?, ?)', [course_id, subject_one, subject_two, email]);
       });
      }

      function renderResults(tx, rs) {
          e = $('#previous_course');
          e.html("");
          for(var i=0; i < rs.rows.length; i++) {
            r = rs.rows.item(i);
            e.html(e.html() + 'id: ' + r['id'] + ', subject_one: ' + r['subject_one'] + ', subject_two: ' + r['subject_two'] + ', email: ' + r['email'] + '<br />');
          }
        }
        function displayData(email) {
          db.transaction(function(tx) {
            if (!(email === undefined)) {
              tx.executeSql('SELECT * FROM Course WHERE email = ?', [email], renderResults);
            } else {
              tx.executeSql('SELECT * FROM Course', [], renderResults);
            }
          });
        }
        $(document).ready(function() {

         db.transaction(function(tx) {
                 tx.executeSql('CREATE TABLE IF NOT EXISTS Course(id INTEGER PRIMARY KEY, course_id INTEGER, subject_one TEXT, subject_two TEXT, email TEXT)', []);
               });
               $('#course_form').submit(function() {
                course = { 1: $('#subject1').val(), 2: $('#subject2').val() };
                insertSubject($('#subject1').val(), $('#subject2').val(), 1, $('#email').val());
                displayData();
            return false;
          });
               displayData();
        });
    </script>
 -->