Posts

Showing posts from September, 2014

How to Connect Twitter to Facebook

Image
To Connect to Twitter to Facebook. Just open the Following Twitter link: https://twitter.com/settings/profile/ https://facebook.twitter.com/  Follow the step given there, Just a Easy step, you have to just Click Connect to Facebook.

How to Connect Facebook to Twitter

Image
To Connect to Facebook to Twitter, Just open the Following Facebook link: https://www.facebook.com/twitter/ Follow the step given there, Just a Easy step, you have to just Click Link to Twitter. 

How to Work with Select Box after POST Data in PHP

Everytime We create a form, we used Fields like Text-BOX, Select Box, Radio and Checkbox, Here we will understand a Function to POST data to be selected on database. PHP Code  <?php function isselected($value,$optionvalue)                         {                                  if ( $value == $optionvalue )                                                          {                                                                   return "selected='selected'";                                                          } else {                                                                return false;                                                           }                         } echo "<form method="POST">";             if(isset($_POST['selectbox']))                      {                                  $valueselected = $_POST['selectbox'];                       }             echo "&l

Plane Example in JQuery

Please Follow the Link for DEMO

A Program in Jquery for Excercise - Jquery

Image
A Program in Jquery for Pity - Jquery: Style to be Define (CSS): body { margin:0px; padding:0px;background:#cc0000; } .container { margin:0px auto; padding:10px; background:#0f0f0f; position:relative; min-height:100%; width:350px; text-align: center; } .container img { display:none; max-width:100%; } .container h3 { background: #cc0000; color: aqua; padding: 5px 5px; font-size: 35px; font-weight: normal; font-family: arial; } Script to be Define (.js file): /* A JQuery Program to run a Excercise */ function startpity() { $("#gamestatus").val('1'); } function stoppity() { $("#gamestatus").val('0'); } var runningtimer = 0; var starttimer = 0; var stoptimer = 0; function runthepity() { runningtimer++; var gamestatus = $("#gamestatus").val(); if( gamestatus ==1  ) { starttimer++; console.log('pity is run for '+starttim

A Program to Printing a Box from For loop.

A Program to Printing a Box from For loop. #################################### PHP Code #################################### <?php echo "<table cellspacing= '0' cellpadding= '0'><tr>"; for ($i=1;$i<=30;$i++) { echo "<td>"; for($j=1;$j<$i;$j++ ) { echo "*"; echo "<br/>"; } echo "</td>"; } for ($i=1;$i<=30;$i++) { echo "<td>"; for($j=30;$j>=$i;$j-- ) { echo "*"; echo "<br/>"; } echo "</td>"; } echo "<table><tr>"; ?> #################################### O/P of the Code #################################### * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

PHP function call of a another class within another class

################################ PHP CODE ################################ <?php // function call of a another class class class1 { function function1() { return 123; } function function2() { return 259; } } class class2 { function function1() { $object = new class1(); echo $object->function1()+$object->function2(); } } $obj = new class2(); $obj->function1(); // function call of a another class echo "<hr/>"; echo "Above Exapmle Basic : " . (123+259); echo "<hr/>"; ?> ################################ Output of the  CODE ################################ 382 Above Example Basic : 382

PHP Function definition within in a class

######################## PHP CODE ######################## <?php // function definition within in a class class common { function addition($a,$b) { echo "<br/> Sum of the " . $a . " and  " . $b . " is : " . ( $a + $b ) ; } function multiplication($a,$b) { echo "<br/> Multiplication of the " . $a . " and  " . $b . " is : " . ( $a * $b ) ; } } // function defination within in a class // object creation for class $com1 = new common(); // object creation for class // function call via class's object $com1->addition(2,3); $com1->multiplication(2,3); // function call via class's object ?>                    ########################                        OUTPUT of the CODE                     ######################## Sum of the 2 and 3 is : 5 Multiplication of the 2 a

Function definition with returning some value - PHP

############################ PHP Code ################### ######## <?php         // function definition with returning some value  function sum($a,$b)   {      $sum = $a + $b;   return $sum;  }  function minus($a,$b)  {    $minus = $a - $b;  return $minus;  }  // function definition with returning some value  // use of return function as a variable  echo "Sum of 2 and 3 is : ".sum(2,3);  // use of return function as a variable  // function definition with returning some value  ?> ############################ Output of the Code ############################ Sum of 2 and 3 is : 5

Function definition with returning array value - PHP

####################### PHP Code ####################### <?php function callmeforarray($a,$b) { $addition = $a + $b; $minus = $a - $b; $multiplication = $a * $b; $division = $a / $b; $modulus = $a % $b; $returnvalue['sum'] = $addition."<br/>"; $returnvalue['min'] = $minus."<br/>"; $returnvalue['mul'] = $multiplication."<br/>"; $returnvalue['div'] = $division."<br/>"; $returnvalue['mod'] = $modulus."<br/>"; return $returnvalue; } echo "<hr/>"; $result = callmeforarray(30,5); echo "Sum is : ". $result['sum']; echo "Min is : ". $result['min']; echo "mul is : ". $result['mul']; echo "div is : ". $result['div']; echo "mod is : ". $result['mo

PHP Function call - Just running the code within it

############################ PHP Code ############################ Program 01:      Normal Function just running the code within it <?php    //  Normal Function just running the code within it    //  function definition  function callme($a,$b)   {     // echo "<br/>Sum of the ".$a." and ".$b. "is = ".$a+$b;       echo "<br/>Sum of the ".$a." and ".$b. "is = ".($a+$b);       echo "<br/>Multi of the ".$a." and ".$b. "is = ".$a*$b;       echo "<br/>Min of the ".$a." and ".$b. "is = ".$a-$b;       echo "<br/>Divide of the ".$a." and ".$b. "is = ".$a/$b;       echo "<br/>Modulus of the ".$a." and ".$b. "is = ".$a%$b;     }    // function defination     // function call      callme(2,5);     // function call ?> ############################ Ou

Basic for Function on PHP

Function:        Function are a set of bloch, which are defined for calling a set of code again and again. There are two way to calling a function in PHP: Directly calling a Function. Function called by a object of a class and defined within a class.  They are Important as some of the code, we have to use different location on a site. So a good way is to define in a File i.e. "functions.php" and include it to top of the position. ############################ PHP Code ############################ Program 01:      Normal Function just running the code within it <?php //  Normal Function just running the code within it //  function definition function callme($a,$b) { // echo "<br/>Sum of the ".$a." and ".$b. "is = ".$a+$b; echo "<br/>Sum of the ".$a." and ".$b. "is = ".($a+$b); echo "<br/>Multi of the ".$a." and ".$b. "

Type of the Variable

Here we will understand, How we can know the type of the variable. As PHP automatic set the type to the variable as we defined it, But sometime it is neccessary to check the type of the variable. Suppose you have a condition, that it there is more then 10 Items in store,  you will add them all for calculation of the total payment, but when  the item is only one, there is no need to adding them, as the total cost will be cost of the item. So you can do by checking the variable type of the variable m If it is array then we will add them all, if this is only a string or Integer, and it is the final cost. Example you have an Variable $value. if it is array, we will use array function to check as follow: <?php                                $totalcost = 0;    if( is_array ($value) )               {                    foreach ( $value as $single )                       {                              $totalcost = $totalcost + $value;                    

Loop in PHP - For Loop

So we are going to understand the for loop. As you know the loop is a re-execute of a block code for the some condition to be true. For example, I will keep waking till I reached the temple. Here Temple is a condition and walk is the block of code to be executed. The structure of the for loop as follow: for  ( {initial value for the loop} ; { contion to be check } ; { initial value to be changed } ) { } #################################### PHP Code #################################### <html> <head> <title>Loop Example- for</title> </head> <body> <h3> Example 1 </h3> <?php  for ( $i = 1 ; $i < 5 ; $i++ )  { echo " <br/> The Value ot the Intiator : " . $i ; } ?> <hr/> <h3> Example 2 </h3> <?php  for ( $j = 5 ; $j > 1 ; $j-- )  { echo

Loop in PHP - while loop

There is three main loop in PHP:  while for foreach while:   while(condition) { do this } ################################### PHP Code ################################### <html> <head> <title>Loop Example</title> </head> <body> <?php /* one way of using loop: in this Program will check condition First and execute block of code within it, if the condition is true */ echo " <br/> "; $i = 0; while( $i < 10) { echo $i; echo " <br/> "; $i++;   // will increment i with 1 } echo " <hr/> "; $j = 0; do { echo $j; echo " <br/> "; // will increment j with 1 $j++; } while ( $j < 10 ) ?> </body> </html>

Logical Expression in PHP

        Today, we will talk about logical expression in PHP. Syntax of the Logical expression are same as the other Programming languages i.e. C and java. Syntax: if Condition:   if(condition)  run this if else Condition:   if(condition)  run this else run this nested if else Condition:   if(condition)  run this else if  run this else run this ############################ PHP Code ############################ <?php $a = 4; $b = 5; // if condition if( $a > $b ) // if no curly braces is used, then only next line will be executed  echo " <br/> a is  greater then b "; echo " <br/> this will not depend on the condition "; echo " <hr/> "; if( $a < $b )   echo " <br/> a is  less then b "; echo " <br/> this will not depend on the condition "; echo " <hr/> ";

What is MD5 ?

MD5 stands for 'Message Digest algorithm 5'. MD5 algorithm is used as a cryptographic hash function or a file fingerprint. Often used to encrypt password in databse, MD5 can also generate a fingerprint file to ensure that a file is the same after a transfer for example. A MD5 hash is composed of 32 hexadecimal characters. Enter a word in the MD5 encrypter form above to know the corresponding MD5 hash. What is a MD5 hash? MD5 (Message Digest algorithm, 5th version) is an algorithm which converts a given sequence of characters into another unique sequence of characters, with a fixed length, called "hash". For instance, the MD5 hash of the word "admin" is "21232f297a57a5a743894a0e4a801fc3". These hashes are mostly used to validate file integrity, to encrypt sensitive data (like passwords), and to generate unique identifiers. Is it secure? MD5 hashes are theoretically impossible to reverse directly, ie, it is not possible to retrieve the or