Flipkart
Thursday, September 13, 2012
Tuesday, September 11, 2012
Get overall CPU Usage using TOP command in Linux
Here is the command which gives the total CPU usage in %
top -bn1 | grep "Cpu(s)" | \sed "s/.*, *\([0-9.]*\)%\id.*/\1/" | \awk '{print 100 - $1"%"}'
Here is another command in which, we can write the conditions to display the results. Below is the example which display the process names which exceeds by given $cpuUtil value.
$cpuUtil = 2
ps -e -o pcpu -o args --no-heading | sort -k 1 -r | awk '$1 > $cpuUtil { print $2 }'
top -bn1 | grep "Cpu(s)" | \sed "s/.*, *\([0-9.]*\)%\id.*/\1/" | \awk '{print 100 - $1"%"}'
Here is another command in which, we can write the conditions to display the results. Below is the example which display the process names which exceeds by given $cpuUtil value.
$cpuUtil = 2
ps -e -o pcpu -o args --no-heading | sort -k 1 -r | awk '$1 > $cpuUtil { print $2 }'
Tuesday, July 31, 2012
New website for Free Online Games
http://games1256.com which has more than 1500 games with various categories.
Registered users can post comments, add to Favourite games, can give rating and also share to social networking websites.
Click for visite http://games1256.com
Registered users can post comments, add to Favourite games, can give rating and also share to social networking websites.
Click for visite http://games1256.com
Wednesday, December 28, 2011
You probably tried to upload too large file – phpmyadmin
Here are the solutions to solve the problem:
1. Increase the values for upload_max_filesize, memory_limit and post_max_size directories in php.ini as per requirements and restart the server
2. You can upload large sql files by changing some configuration settings in C:\xampp\phpmyadmin\config.inc.php file.
Open the config.inc.php file and look for $cfg['UploadDir'] and update it as $cfg['UploadDir'] = "upload". If you dont find just open a config.sample.inc.php and copy that line and paste into your actuall config.inc.php file and update as i mentioned above. Finally it will be:
$cfg['UploadDir'] = "upload"
Save the file and create upload folder under phpmyadmin folder.
C:\xampp\apps\phpmyadmin\upload\
Then copy your all .sql files into this folder.
Now when you go to phpmyadmin import page you will see a drop down with list of .sql files below the browse button.
You can now select this and begin the import.
If your having problem in Windows 7 and 32 bit system you need verify that your values should be under 2048M, then only it will work.
Reason:
"The largest signed integer for a 32bit operating system is -2,147,483,647 - 2,147,483,647 since 2048M = 2147483648 bytes, it was going higher than it could calculate, so it was defaulting to a negative integer. Hence the reason why the log file states -2147483648 bytes."
If you get Script timeout passed, if you want to finish import, please resubmit same file and import will resume.
add
1. Increase the values for upload_max_filesize, memory_limit and post_max_size directories in php.ini as per requirements and restart the server
2. You can upload large sql files by changing some configuration settings in C:\xampp\phpmyadmin\config.inc.php file.
Open the config.inc.php file and look for $cfg['UploadDir'] and update it as $cfg['UploadDir'] = "upload". If you dont find just open a config.sample.inc.php and copy that line and paste into your actuall config.inc.php file and update as i mentioned above. Finally it will be:
$cfg['UploadDir'] = "upload"
Save the file and create upload folder under phpmyadmin folder.
C:\xampp\apps\phpmyadmin\upload\
Then copy your all .sql files into this folder.
Now when you go to phpmyadmin import page you will see a drop down with list of .sql files below the browse button.
You can now select this and begin the import.
If your having problem in Windows 7 and 32 bit system you need verify that your values should be under 2048M, then only it will work.
Reason:
"The largest signed integer for a 32bit operating system is -2,147,483,647 - 2,147,483,647 since 2048M = 2147483648 bytes, it was going higher than it could calculate, so it was defaulting to a negative integer. Hence the reason why the log file states -2147483648 bytes."
If you get Script timeout passed, if you want to finish import, please resubmit same file and import will resume.
add
$cfg['ExecTimeLimit'] = 0; this line in config.inc.php file.By default setting for ExecTimeLimit is 300 seconds.Monday, October 3, 2011
Strip only given Tags PHP
/**
*
* @param String $str
* @param tags which needs to be strip $tags
* @param boolean $stripContent
* @return string
*/
function strip_only_tags($str, $tags, $stripContent=false) {
$content = '';
if(!is_array($tags)) {
$tags = (strpos($str, '>') !== false ? explode('>', str_replace('<', '', $tags)) : array($tags));
if(end($tags) == '') array_pop($tags);
}
foreach($tags as $tag) {
if ($stripContent)
$content = '(.+</'.$tag.'(>|\s[^>]*>)|)';
$str = preg_replace('#</?'.$tag.'(>|\s[^>]*>)'.$content.'#is', '', $str);
}
return $str;
}
*
* @param String $str
* @param tags which needs to be strip $tags
* @param boolean $stripContent
* @return string
*/
function strip_only_tags($str, $tags, $stripContent=false) {
$content = '';
if(!is_array($tags)) {
$tags = (strpos($str, '>') !== false ? explode('>', str_replace('<', '', $tags)) : array($tags));
if(end($tags) == '') array_pop($tags);
}
foreach($tags as $tag) {
if ($stripContent)
$content = '(.+</'.$tag.'(>|\s[^>]*>)|)';
$str = preg_replace('#</?'.$tag.'(>|\s[^>]*>)'.$content.'#is', '', $str);
}
return $str;
}
Remove array Element based on key value PHP
/**
* Remove array Element based on key value
* @param $arr
* @param $key
* @return array
*/
function array_pop_by_key($arr, $key) {
$array_keys = array_keys($arr);
foreach($arr as $array_key => $value) {
if($array_key == $key) {
unset($arr[$key]);
}
}
return $arr;
}
* Remove array Element based on key value
* @param $arr
* @param $key
* @return array
*/
function array_pop_by_key($arr, $key) {
$array_keys = array_keys($arr);
foreach($arr as $array_key => $value) {
if($array_key == $key) {
unset($arr[$key]);
}
}
return $arr;
}
Tuesday, September 6, 2011
Get Drupal Logo Path
Below is the code to get the Active site logo path in Drupal:
$logo = theme_get_setting('logo');
Subscribe to:
Posts (Atom)
