Thursday, 4 July 2013

Dynamic Theme or background change using Colour picker


We can dynamically change the particular div background colour using javascript colour picker 
we have to follow 4 steps to done above task
step 1 :include jscolor picker file in ur file 
step 2 :create a text box and define a class color
step 3 :create javascript function for change the div background colour according to the selection by using js cookie 
step 4 :call the Js-function in text box onblur event 
picker.html

<html>
<head>
 <title>colour picker demo</title>
<script>
function pick()    //------------------------------------------>step 3
{
var elem = document.getElementById("para1").value;
var cook=document.cookie="#"+elem;
var colour=document.getElementById("change");
colour.style.background=cook;
}
</script>
</head>
<body>
<div style="height:100px; width:400px;" id="change"> 
<!--colour change-->
</div>
 <script type="text/javascript" src="jscolor.js"></script> //->step1
 Click here: <input class="color" value="" onblur="pick()" id="para1">//->step2
//---------------------------------------------------- >step 4
</body>
</html>

Video preview:
Download

Tuesday, 2 July 2013

cURL-tutorial startup


cURL:
         1.cURL is a Command line tool for getting and sending datas through URL 
         
Now we can display the Google webpage with search key word "technoblazze" in your server by using cURL
We have to Follow 4 steps to do the above task
1.initialize the curl session
2.set various option for the session
3.Execute the option, fetch and display the datas in your server
4.close the curl session
curl.php
<?php 
$curl = curl_init('http://www.google.com/search?q=technoblazze.blog'); //step1
curl_setopt($curl, CURLOPT_FAILONERROR, true);    //step2
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); 
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);   
$result = curl_exec($curl);                       //step3
curl_close($curl);                                //step4
echo $result;
?>
Download

Monday, 1 July 2013

Start with XML - fetch and display the xml datas using php


books.xml :   
<?xml version="1.0"?>
<datas>
  <books>
    <book>
      <id>1</id>       <title>PHP Undercover</title>         <author>Arun</author>     </book>     <book>       <id>2</id>       <title>PHP Enterprise</title>         <author>Vibin</author>     </book>   </books> </datas>

xmlread.php :
<?php
$xml = simplexml_load_file("books.xml")        or die("Error: Cannot create object");        //include the books.xml file foreach($xml as $books)                                       // seperate variables, books array from xml file { foreach($books as $book )                           // seperate variables, book array from books file       {  echo $book->id;                                        //display the id  echo "<br />";  echo $book->title;                                     //display the title  echo "<br />";  echo $book->author;                                //display the author  echo "<br />"; }
} ?>
Output:
1
PHP Undercover
Arun
2
PHP Enterprise
Vibin

Download

Cloud Computing


Cloud computing is a colloquial expression used to describe a variety of different computing concepts that involve a large number of computers that are connected through a real-time communication network (typically the Internet). Cloud computing is a jargon term without a commonly accepted non-ambiguous scientific or technical definition. In science, cloud computing is a synonym for distributed computing over a network and means the ability to run a program on many connected computers at the same time. The popularity of the term can be attributed to its use in marketing to sell hosted services in the sense of application service provisioning that run client server software on a remote location.


Advantages:

We can use and access the cloud from any where through internet.
Reduce the Storage capacity in your harddrive.

Cloud Storage Services :

Cloud storage services offer paid monthly subscriptions either for unlimited storage or for hundreds of gigabytes of data. Most of us do not have that much critical data to backup and therefore it would be a total waste of money. And for those of us who have data which cannot be stored using the 1 or 2GB free space offered, we have a list of four of the best free online storage services that offer free space of more than 10GB.

Best Sites for Cloud Computing :


1.Google Drive:

  Link : https://drive.google.com/
 

2.DROP BOX

Link:https://www.dropbox.com/


3:BOX

Link: https://www.box.com/


4:SKYDRIVE

Link: https://skydrive.live.com/

Tuesday, 25 June 2013

Kick Start for HTML,CSS

http://www.99lime.com/
Tips for using html and css in easy way :
go to -------->http://www.99lime.com/
goto---------->HTML kick Start
download--->from github
And call the particular class files mentioned in tutorial..


Thursday, 20 June 2013

Structure of xml

Input XML FILE:
<?xml version="1.0"?>
<note>
    <to cat="head">
        <cc>Arun</cc>
        <cc>Vibin</cc>
    </to>
    <from>
        <bc>Jani</bc>
        <bc>ishya</bc>
    </from>    
</note>


EXPLAIN:
<note>------->parent Element
<to>,<from>-->Child Element
<cc>,<bc>----->siblings
cat----------->attribute
Strcture Tree Diagram:

Tuesday, 18 June 2013

Print the Report or Page using Javascript And PHP


Javascript file:
<script>
function printDiv(id)
{
  var divToPrint=document.getElementById(id);
  newWin=window.open('', '', 'left=5,top=10,width=1024,height=768,toolbar=0,scrollbars=0,status=0');
  var str='<html><head><link href="css/css.css" rel="stylesheet" type="text/css"/></head><body><div align="center"><img src="image/logo.png" border="0"></div><br/><div align="center"><b>Outstanding Report</b></div><br></body></html>';
  newWin.document.write(str);
  newWin.document.write(divToPrint.outerHTML);
  newWin.print();
  newWin.close();
}
</script>

Passing the Div ID parameter:
<input type="image" onClick="return printDiv('sprint');"  value="print"  src="image/printj.png" class="flrt" title="print report"/>
<div id="sprint">
<?php
// Dynamic Code here
?>
</div>
Expected Output:

Saturday, 15 June 2013

Script for Dynamic MORE or LESS and [all the DIV's become Less when One more option is clicked]

<script>
 $(document).ready(function () {
var showChar = 100;
 var ellipsestext = "...";
 var moretext = "more";
 var lesstext = "less";
 var txtlen = 1;
 $('.more').each(function () {
 var content = $(this).html();
 if (content.length > showChar) {
 var c = content.substr(0, showChar);
 var h = content.substr(showChar - 1, content.length - showChar);
 var html = c + '<span class="moreelipses">' + ellipsestext + '</span>&nbsp;<span class="morecontent"><span>' + h + '</span>&nbsp;&nbsp;<a href="" class="morelink" id=testimonial' + txtlen + '>' + moretext + '</a></span>';
$(this).html(html);
 }
 txtlen++;
 });
 $(".morelink").click(function () {
 if ($(this).hasClass("less")) {
 $(this).removeClass("less");
$(this).html(moretext);
 } else {

 for (var i = 1; i < txtlen; i++) {
if ($("a#testimonial" + i).attr('class') == "morelink less")
 {
 $("a#testimonial" + i).trigger("click");
 }
 }
 $(this).addClass("less");
 $(this).html(lesstext);
}
 $(this).parent().prev().toggle();
 $(this).prev().toggle();
 return false;
 });
 });
</script>

<div class="comment more">
 <?php 
              //give dynamic code
        ?>
</div>
<div class="comment more">
 <?php 
              //give dynamic code
        ?>
</div>

Sunday, 9 June 2013

Face book Wall Post



Index.php:

<?php
include 'class.php';
$db=new database();
$db->connect();
?>
<link rel="stylesheet" href="wall.css" type="text/css" />
<script type="text/javascript" src="jquery-latest.js"></script>
<script>
$(document).ready(function() {
$('#textpost').click(function() {
      var b=$("#fbpost").val();
      var dataString = 'fbwall='+b;
      $.ajax( {
              type:"POST",
      		async: false,
              url:"ajax.php",
              data: dataString,
              success: function(data) {		

			  	  $("#fbpost").val("");		 
                  $("#viewpost").html(data);				  				             
              }
          });
});
});

</script>
<div id="container">
	<div>
    <img src="facebook-logo.jpg" width="200" height="75"/>
    </div>
	<div id="post">
    	<form action="" method="post">
        	<p class="example-twitter">
        	<textarea name="fbwall" id="fbpost" class="" placeholder="whatzz upp?" >
            </textarea>               
            <br/>  <br/> 
            <a href="#" class="button postfb" id="textpost">Post</a>
            </p>
        </form>                      
    </div>
    <br><br><br><br>
    <div id="viewpost">
    <?
	$queyr=$db->query("select * from fb ORDER BY `id` DESC");
	while($query=$db->fetch($queyr))
	{
	?>
    <div id="display">
    	<div id="leftdisplay">
        <img src="http://lh3.googleusercontent.com/-Iw_xOyvn0z0/AAAAAAAAAAI/AAAAAAAAAFw/r_0QqjeH2vQ/s512-c/photo.jpg"  width="120" height="120"/>
        </div><br/><br/>
        <div id="rightdisplay">
        	<p class="triangle-border left">
            	<? echo $query["wallpost"];?>
            </p>
        </div>
    </div>
    <div style="height:200px;"></div> 
    <? } ?>   
    </div>
</div>


Ajax.php:

<?
include 'class.php';
$db=new database();
$db->connect();
if(isset($_REQUEST["fbwall"]))
{
	$wall=$_REQUEST["fbwall"];
	$insert=$db->query("INSERT INTO fb (wallpost) VALUES ('$wall')");
	if($insert)
	{
		$select=$db->query("select * from fb ORDER BY `id` DESC");
		while($view=$db->fetch($select))
		{?>
             <div id="display">
                <div id="leftdisplay"><img src="http://lh3.googleusercontent.com/-Iw_xOyvn0z0/AAAAAAAAAAI/AAAAAAAAAFw/r_0QqjeH2vQ/s512-c/photo.jpg"  width="120" height="120"/></div><br/><br/><br/><br/>
                <div id="rightdisplay">
                    <p class="triangle-border left">
                        <? echo $view["wallpost"];?>
                    </p>
                </div>
            </div>
            <div style="height:200px;"></div>
		<? }
	}
}
?>

Database:
id---------->int(11)
wallpost--->longtext()

class.php
<?

class database

{
	 public function connect()
     {

        $con=mysql_connect("localhost","root","") or die("unable to connect");
        mysql_select_db("test",$con) or die("unable to select");
     }
     public function query($sql)
     {
         $sc=mysql_query($sql) or die("query not working".  mysql_error());
         return $sc;
        
     }
     public function  fetch($qu)
     {
         $ft=mysql_fetch_array($qu);
         return $ft;
     }
     public function num($rows)
     {
         $rw=mysql_num_rows($rows);
         return $rw;
       
     }
}
?>

Output:

Download

Thursday, 6 June 2013

Dynamic Autocomplete using php

index.php:<
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Auto Complete Input box</title>
<link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.autocomplete.js"></script>
<script>
$(document).ready(function(){
 $("#tag").autocomplete("autocomplete.php", {
  selectFirst: true
 });
});
</script>
</head>
<body>
<label>Tag:</label>
<form action="" method="post">
<input name="tag" type="text" id="tag" size="20"/> 
 <input type="submit" value="submit" name="gt"/>
<form>
</body>
<?php
if(isset($_POST["gt"]))
{
$mysql=mysql_connect("localhost","root","123");
mysql_select_db("hi",$mysql);
mysql_query("insert into tag (name) values ('".$_POST["tag"]."')");
echo $_POST["tag"];
}
?>
</html>
autocomplete.php:
<?php
 $q=$_GET['q'];
 $my_data=mysql_real_escape_string($q);
 $mysqli=mysqli_connect('localhost','root','123','hi') or die("Database Error");
 $sql="SELECT name FROM tag WHERE name LIKE '%$my_data%' ORDER BY name";
 $result = mysqli_query($mysqli,$sql) or die(mysqli_error());
 
 if($result)
 {
  while($row=mysqli_fetch_array($result))
  {
   echo $row['name']."\n";
  }
 }
?>


Database :
id--->int(4)--->Autocomplete
Name--->varchar(50)
Download