ls -lh
finding out the sizes of different files in a folder
wc -l
finding out the number of lines in a file
head -10
top 10 lines of a file
Monday, March 4, 2013
Wednesday, February 27, 2013
Sharing files in Linux!
python -mSimpleHTTPServer xxxx (xxxx- port number) to start HTTP Server at current working directory. Quite handy for sharing files/directories.
Friday, February 15, 2013
Pass a PHP array to a JavaScript function
Use JSON.
In the following example
$php_variable can be any PHP variable.<script type="text/javascript">
var obj = <?php echo json_encode($php_variable); ?>;
</script>
In your code, you could use like the following:
drawChart(600/50, <?php echo json_encode($day); ?>, ...)
In cases where you need to parse out an object from JSON-string (like in an AJAX request), the safe way is to use
JSON.parse(..) like the below:var s = "<JSON-String>";
var obj = JSON.parse(s);
Thursday, February 14, 2013
$('#urlresults .concept-name').each(function(){$(this).html()});
$('#urlresults .concept-name').each(function (){if ($(this).html() === 'tarot readings') {$(this).html("test")}});
$('#urlresults .concept-name').each(function (){if ($(this).html() === 'test') {$(this).next(".block").html("block")}});
$('#urlresults .concept-name').each(function (){if ($(this).html() === 'bikini photos') {$next = $(this).next(".block"); $next.html($next.attr('data-tld'))}});
$('#urlresults .concept-name').each(function (){if ($(this).html() === 'bikini photos') {$next = $(this).next(".block"); $next.html(generateUnblockConceptLink($next.attr('data-tld'), $next.attr('data-basis'), $next.attr('data-admin-id'), $next.attr('data-url')))}});
$('#urlresults .concept-name').each(function (){if ($(this).html() === 'tarot readings') {$(this).html("test")}});
$('#urlresults .concept-name').each(function (){if ($(this).html() === 'test') {$(this).next(".block").html("block")}});
$('#urlresults .concept-name').each(function (){if ($(this).html() === 'bikini photos') {$next = $(this).next(".block"); $next.html($next.attr('data-tld'))}});
$('#urlresults .concept-name').each(function (){if ($(this).html() === 'bikini photos') {$next = $(this).next(".block"); $next.html(generateUnblockConceptLink($next.attr('data-tld'), $next.attr('data-basis'), $next.attr('data-admin-id'), $next.attr('data-url')))}});
Saturday, February 9, 2013
Comma Rupees php
<?php
function my_money_format($number)
{
if(strstr($number,"-"))
{
$number = str_replace("-","",$number);
$negative = "-";
}
$split_number = @explode(".",$number);
$rupee = $split_number[0];
$paise = @$split_number[1];
if(@strlen($rupee)>3)
{
$hundreds = substr($rupee,strlen($rupee)-3);
$thousands_in_reverse = strrev(substr($rupee,0,strlen($rupee)-3));
for($i=0; $i<(strlen($thousands_in_reverse)); $i=$i+2)
{
$thousands .= $thousands_in_reverse[$i].$thousands_in_reverse[$i+1].",";
}
$thousands = strrev(trim($thousands,","));
$formatted_rupee = $thousands.",".$hundreds;
}
else
{
$formatted_rupee = $rupee;
}
if((int)$paise>0)
{
$formatted_paise = ".".substr($paise,0,2);
}
return $negative.$formatted_rupee.$formatted_paise;
}
?>
http://php.net/manual/en/function.number-format.php
Subscribe to:
Posts (Atom)