Wednesday 6 July 2016

Django Terms

Best Editor For making django projects is  "Sublime text"


Django  is "python web framework"
To start a new project ->>              django-admin startproject 'project nm'
To start the server ->>                    python manage.py runserver
To create a new app ->>                 python manage.py startapp "music"
To create a super user ->>              python manage.py createsuperuser

each url is connected to a view
1) view gives Httpresponse
2) when we make app we hv to mention  in settings. file

3) when we udpate smthing in databse ,
3.a) do it in  models.py file ,
3.b) python manage.py makemigrations 'app name'
3.c) python manage.py migrate
  now databse is synced with code

Tuesday 7 July 2015

Complete code for mobile app sending data to php & php inserting that data to databse (A MOBILE APP SINGUP SYSTEM)

                                                    ( A MOBILE APP  SINGUP  SYSTEM)


1) SOURCE  CODE  OF  APP  SIDE :::---

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>

    <script>

        $(document).on("pagecreate", "#pageone", function ()
        {
            $("li").on("swipe", function () {
                $(this).hide();
            });
            $(document).on("scrollstart", function () {
                alert("you started scroling!!");
            });
        });


       function checkLogin()
        {
            alert("abs");

            var aa = document.getElementById("name").value;
            var bb = document.getElementById("pass").value;
            alert(aa);
            alert(bb);

            var data =
            {
                user: aa,
                pass: document.getElementById("pass").value
            };

            $.getJSON("http://mapg.host22.com/mobileapp/insert.php?jsonp=?", data, function (data,status) {

                var status = JSON.stringify(data['status']);
                alert(data['status']);

                alert(status);              ////  how program works= status;
                alert(data);                /// all the echo of insert.php  is  data;   echo of insert.php= data;

            }
            );
        }
        
    </script>
</head>

<body>
    <div data-role="page" id="pageone">
        <div data-role="header">
            <h1>page 1</h1>
        </div>

        <div id="mess" >

        </div>

        <div data-role="main" class="ui-content">
            <p> LOGIN PAGE </p>
            Username : <input type="text" id="name" placeholder="your Name " />
            Password : <input type="password" id="pass" placeholder="your Password " />
            <input type="button" value="LOGIN" id="button" onclick="checkLogin()" />
            <input type="range" min="0" max="100" value="20" name="range_name" />
        </div>

        <div data-role="footer" data-position="fixed">
            <h1> &copy; Nikhil </h1>
        </div>

    </div>
</body>
</html>





-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
2) SOURCE CODE FOR PHP SIDE:

   <?php
 
$conn=mysql_connect($servername,$username,$password)
mysql_select_db($databasename,$conn);

//$function_name=$_GET['jsonp'];

$a=$_GET['user'];

$pwd=$_GET['pass'];

$query="insert into mobilecheck  values('','$a','$pwd')";
$result=mysql_query($query);


?>

php code



 <?php    

 echo " welcome ";
                                            
 $conn=mysql_connect("mysql7.000webhost.com","a8678936_kishlay","nikhilnn2");
 $db= mysql_select_db("a8678936_aman",$conn);
 
 $function_name=$_GET['jsonp'];
 $a=$_GET['user'];
 $pwd=$_GET['pass'];

 $query="select * from member where user='$a' and pass='$pwd'";
 $result=mysql_query($query);
 $num=mysql_num_rows($result);


 //create json array
 $JSON_array=array();


 if($num>0)
 {
 $json_array['status']="true";                            
 }
 else
 {
 $json_array['status']="false";
 }

 //echo the json array
 echo "$fuction_name{";
   
 print json_encode($json_array);

 echo "}";
 ?>

Monday 6 July 2015

navigation from one page to another

<!DOCTYPE html>
<!--
    Licensed to nikhil  
-->


<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

        <meta name="viewport" content="width=device-width,initial-scale=1" >
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" >
        <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
        <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
       
        <script>
            function pagetwonav()
            {

                window.location.href = "#pagetwo";
                var r = document.getElementById("name").value;
                document.getElementById("show").innerHTML = r;

            }

        </script>
       </head>



    <body>
           <div data-role="page" id="pageone">
             <div data-role="header">
                  <h1> welcome  to page one</h1>
             </div>
           
            <div data-role="main" class="ui-content">
                <p>welcome </p>
                <a href="#pagetwo" data-transition="pop"> go to page 2</a>
                <input type="text" id="name" placeholder="your Name " />
                <input type="button"  value="go" id="button" onclick="pagetwonav()" />

                <ol data-role="listview">
                    <li> tea </li>
                    <li> coffee </li>
                </ol>
            </div>
              
         
             <div data-role="footer" data-position="fixed">
              <h1> &copy; Nikhil </h1>
            </div>
                         
           </div>




        <div data-role="page" id="pagetwo">
            <div data-role="header">
                <h1> welcome to page two</h1>
            </div>



            <div data-role="main" class="ui-content">
                <p>welcome to page 2</p>
                <a href="#pageone"> go to page 1</a>

                <div id="show">

                </div> 
            </div>




            <div data-role="footer" data-position="fixed">
                <h1> footer text for page 2</h1>
            </div>
        </div>


    </body>

</html>

Saturday 4 July 2015

Mobile's side coding for check login (php excluded)

<!DOCTYPE html>
<html>
<head>
    <!-- Include meta tag to ensure proper rendering and touch zooming -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Include jQuery Mobile stylesheets -->
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
    <!-- Include the jQuery library -->
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <!-- Include the jQuery Mobile library -->
    <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
    <script>
 
        function pagetwonav() {
            window.location.href = "#pagetwo";
            var name = document.getElementById('naam').value;
            document.getElementById('showName').innerHTML=name
        }
 
        $(document).on("pagecreate","#pageone",function(){
            $("li").on("swipe", function () {
                $(this).hide();
            });
            $(document).on("scrollstart", function () {
           //     alert("you started scroling!!");
            });
        });
       
        function checkLogin()
        {
            var data = {
                user: document.getElementById("naam").value,
                pass: document.getElementById("mypass").value
            };
            $.getJSON("http://college9909.site90.net/desc.php?jsonp=?", data, function (data) {
                var status = JSON.stringify(data['status']);
                alert(status);
            }
            );
        }
       
 
    </script>
</head>
<body>
 
    <div data-role="page" id="pageone">
        <div data-role="header">
            <h1>Welcome To My Homepage</h1>
        </div>
 
        <div data-role="main" class="ui-content">
            <p>Welcome!</p>
            <a href="#pagetwo" data-transition="slide"> Navigate to page two</a>
            <input type="text" name="name" placeholder="Your Name" id="naam">
            <input type="password" name="pass" placeholder="Your password" id="mypass">
            <input type="button" value="Go" id="button" onclick="checkLogin()">
            <input type="range" min="0" max="100" value="20" name="range_name">
        </div>
       
        <div data-role="footer" data-position="fixed" style="background-color:#ff0000">
            <h1>&copy; Codeblix</h1>
        </div>
    </ol>
 
    <div data-role="page" id="pagetwo">
     
  •   <div data-role="header">
  •             <h1>Welcome </h1>
            </div>
     
            <div data-role="main" class="ui-content">
                <p>Welcome <div id="showName"></div></p>
     
            </div>
     
            <div data-role="footer" data-position="fixed">
                <h1>Footer Text for page 2</h1>
            </div>
        </div>
     
     
    </body>
      </html>

    Jquery mobile's ONSCROLL function

    <!DOCTYPE html>
    <html>
    <head>
        <!-- Include meta tag to ensure proper rendering and touch zooming -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <!-- Include jQuery Mobile stylesheets -->
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
        <!-- Include the jQuery library -->
        <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
        <!-- Include the jQuery Mobile library -->
        <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
        <script>
     
            function pagetwonav() {
                window.location.href = "#pagetwo";
                var name = document.getElementById('naam').value;
                document.getElementById('showName').innerHTML=name
            }
     
            $(document).on("pagecreate","#pageone",function(){
                $("li").on("swipe", function () {
                    $(this).hide();
                });
                $(document).on("scrollstart", function () {
                    alert("you started scroling!!");
                });
            });
           
           
     
        </script>
    </head>
    <body>
     
        <div data-role="page" id="pageone">
            <div data-role="header">
                <h1>Welcome To My Homepage</h1>
            </div>
     
            <div data-role="main" class="ui-content">
                <p>Welcome!</p>
                <a href="#pagetwo" data-transition="slide"> Navigate to page two</a>
                <input type="text" name="name" placeholder="Your Name" id="naam">
                <input type="button" value="Go" id="button" onclick="pagetwonav()">
            </div>
            <ul data-role="listview" >
                <li>tea</li>
                <li>coffee</li>
                <li>tea</li>
                <li>coffee</li><li>tea</li>
    <li>coffee</li><li>tea</li>
    <li>coffee</li><li>tea</li>
    <li>coffee</li><li>tea</li>
    <li>coffee</li><li>tea</li>
    <li>coffee</li><li>tea</li>
    <li>coffee</li><li>tea</li>
    <li>coffee</li><li>tea</li>
    <li>coffee</li><li>tea</li>
    <li>coffee</li><li>tea</li>
    <li>coffee</li><li>tea</li>
    <li>coffee</li><li>tea</li>
    <li>coffee</li><li>tea</li>
    <li>coffee</li><li>tea</li>
    <li>coffee</li><li>tea</li>
    <li>coffee</li>
                </ul>
     
            <div data-role="footer" data-position="fixed" style="background-color:#ff0000">
                <h1>&copy; Codeblix</h1>
            </div>
        </ol>
     
        <div data-role="page" id="pagetwo">
            <div data-role="header">
                <h1>Welcome </h1>
            </div>
     
            <div data-role="main" class="ui-content">
                <p>Welcome <div id="showName"></div></p>
     
            </div>
     
            <div data-role="footer" data-position="fixed">
                <h1>Footer Text for page 2</h1>
            </div>
        </div>
     
     
    </body>
      </html>

    Friday 3 July 2015

    How to make branch ,clone , push, pull and merge in Github


    1) GIT COMMAND TO SEE ,HOW MANY  BRANCHES ARE THERE :
         $ git  branch

    2) GIT COMMAND  TO MAKE  A NEW  BRANCH :

       $ git branch "ur branch name"

    3) GIT COMMAND TO SWITCH  TO SOME OTHER BRANCH :

      $ git checkout  "my_branch"                 (this command will take me to branch- my_branch)


    4) GIT COMMAND  TO  DO  CLONE  OF SOME  OTHER'S  OR YOUR OWN'S PROJECT
         WE  JUST  NEED  THE  SSH  CODE OF THAT REPOSITORY:

     $ git clone "SSH URL"



    5)  GIT  COMMAND  TO  PUSH  IN SOME OTHER BRANCH

       $ git remote add "variable_name" "SSH URL"
      $ push "variable_name" "branch_name"


    6) GIT COMMAND  TO  PULL  SOME BRANCH (before pushing ,it is recommended to pull)
     
       $ git pull "variable" master


    7) GIT COMMAND TO MERGE
     
      $ git merge master