Wednesday, 3 September 2014

Basic Linux Commands

1. mkdir - make directories
2. cd - change directories
3. mv- change the name of a directory
   Ex: mv testdir newnamedir
4. pwd - print working directory
   will show you the full path to the directory you are currently in.
   This is very handy to use, especially when performing
   some of the other commands on this page
5. rmdir - Remove an existing directory
6. rm -r
   Removes directories and files within the directories recursively.
7. chown - change file owner and group
8. chmod - change file access permissions
9. reboot - Reboots the system (requires root privileges).
10.ping host - Sends an echo request via TCP/IP to the specified host. A response confirms that the host is operational.

How to read data from excel file using php?

<?php
include 'reader.php';
$excel = new Spreadsheet_Excel_Reader();
?>
<table  border="1">
<?php
$excel->read('sample.xls');//set the excel file name here   
$x=1;
while($x<=$excel->sheets[0]['numRows']) { // reading row by row 
echo "\t<tr>\n";
$y=1;
while($y<=$excel->sheets[0]['numCols']) {// reading column by column 
$cell = isset($excel->sheets[0]['cells'][$x][$y])?$excel->sheets[0]['cells'][$x][$y] :'';
if($cell)
echo "\t\t<td>$cell</td>\n";  // get each cells values
$y++;
}  
echo "\t</tr>\n";
$x++;
}
?>    
</table><br/>

Tuesday, 2 September 2014

Clock running scripts in php with jquery

<div class="col-xs-12 col-sm-12 col-lg-12 cal">
      <p id='demo' class="text-center cal-container"></p> 
   </div>
                       </a>
                       <?php
   
   $current_timestamp = time();
  ?>
                       <script type='text/javascript'>
                        flag = true;
            timer = '';
            phpJavascriptClock();
            setInterval(function(){phpJavascriptClock();},1000);
 
            function phpJavascriptClock()
            {
               
                if ( flag ) {
                    timer = <?php echo $current_timestamp;?>*1000;
                }
                var d = new Date(timer);
                months = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 
'Jun', 'Jul', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec');
 
                month_array = new Array('January', 'Febuary', 'March', 
'April', 'May', 'June', 'July', 'Augest', 'September', 'October', 
'November', 'December');
 
                currentYear = d.getFullYear();
                month = d.getMonth();
                var currentMonth = months[month];
                var currentMonth1 = month_array[month];
                var currentDate = d.getDate();
                currentDate = currentDate < 10 ? '0'+currentDate : currentDate;
 
                var hours = d.getHours();
                var minutes = d.getMinutes();
                var seconds = d.getSeconds();
 
                var ampm = hours >= 12 ? 'PM' : 'AM';
                hours = hours % 12;
                hours = hours ? hours : 12; // the hour ’0' should be ’12'
                minutes = minutes < 10 ? '0'+minutes : minutes;
                seconds = seconds < 10 ? '0'+seconds : seconds;
                var strTime = hours + ':' + minutes+ ':' + seconds + ' ' + ampm;
                document.getElementById("demo").innerHTML= currentMonth+' 
' + currentDate+' , ' + currentYear + ' ' + strTime ;
                flag = false;
                timer = timer + 1000;
            }
                       </script>