$ vi /etc/mysql/my.cnf
search bind_address..
comment bind_address..
$ sudo -s -H
$ ls -l /etc | grep my
$ ls -l /etc/mysql | grep my
$ /etc/init.d/mysql restart
$ mysql -u root -p
mysql > show grants;
Now you will see the following query:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B' WITH GRANT OPTION
Copy above query and paste it into terminal and replace 'localhost' by %.
mysql > flush privileges;
Cheers!
This blog will give you all kind of Open Source help like Drupal, Zend, Symfony, Joomla and Magento.
Wednesday, 11 August 2010
Monday, 19 July 2010
How to unzip tar.gz file in ubuntu?
Hi guys,
Please use the following command:
tar xvzf something.tar.gz
Cheers!
Please use the following command:
tar xvzf something.tar.gz
Cheers!
Sunday, 18 July 2010
The 8 ball problem?
Hie All,
Please use the following and get the result in 2 iteration:
You can identify the heavier ball in only 2 weighings!
The secret is not to get fooled into the "divide and conquer" approach where the input is halved in each iteration as explained above.
To achieve this in only 2 weighings, you first put 3 balls in each bowl on the scale, e.g. {1,2,3} against {4,5,6}.
Should the scale balance, you have only 2 balls remaining which you can compare by putting each in a separate bowl on the scale, e.g. {7} against {8}.
Should the scale not balance, however, take the 3 balls from the heavier bowl on the scale (e.g. 1,2,3).
Pick any 2 balls and compare these against each other, e.g. {1} against {2}. If the scale balances, you know it is ball 3 is the heavier. Is the scale moving, you know it's the ball on the heavier side.
Thanks & Cheers!
Please use the following and get the result in 2 iteration:
You can identify the heavier ball in only 2 weighings!
The secret is not to get fooled into the "divide and conquer" approach where the input is halved in each iteration as explained above.
To achieve this in only 2 weighings, you first put 3 balls in each bowl on the scale, e.g. {1,2,3} against {4,5,6}.
Should the scale balance, you have only 2 balls remaining which you can compare by putting each in a separate bowl on the scale, e.g. {7} against {8}.
Should the scale not balance, however, take the 3 balls from the heavier bowl on the scale (e.g. 1,2,3).
Pick any 2 balls and compare these against each other, e.g. {1} against {2}. If the scale balances, you know it is ball 3 is the heavier. Is the scale moving, you know it's the ball on the heavier side.
Thanks & Cheers!
Tuesday, 6 July 2010
How to get connection from doctrine to run sql query in Symfony?
Hey folks,
$db = Doctrine_Manager::getInstance()->getCurrentConnection();
$sql = "UPDATE admin_info SET admin_category='".$permissions."' WHERE username = '".$username."'";
$result = $db->execute($sql);
return $result;
Cheers!
$db = Doctrine_Manager::getInstance()->getCurrentConnection();
$sql = "UPDATE admin_info SET admin_category='".$permissions."' WHERE username = '".$username."'";
$result = $db->execute($sql);
return $result;
Cheers!
Tuesday, 29 June 2010
How to Install MEMCACHED on ubuntu?
first of all write the following command on command line:
sudo apt-get install memcached
now go to php.ini file and enable memcache.so
OR
following command automatically append php.ini file and write memcache.so
sudo apt-get install php5-memcache memcached
now check memcached is running or not?
type
/etc/init.d/memcached status
/etc/init.d/memcached start
To check wether 11211 port is enable or not with 127.0.0.1
telnet 127.0.01 11211
Now run the memcached script on server:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<?php
// put your code here
$cache = new Memcache();
$cache->connect("127.0.0.1");
//addServer("127.0.0.1",11211);
$user_key = 12345;
/** Look in cache, if not found, set object (misses null) **/
if (!$user = $cache->get($user_key)) {
/**
* Set object with expire of 1 hour and no compression
*/
$value = array(34,56,34,23,23,124,65,767,34,76576,99);
$cache->set($user_key, $value, NULL, 6000);
$user = $value;
echo "In";
}
else
{
$tVar = $cache->get($user_key);
echo '<PRE>';
print_r($tVar);
echo "Out";
}
?>
</body>
</html>
This script will first time enter in if condition and second time in else condition.... if it does then your memcached is working fine else there is some error.
Cheers!
sudo apt-get install memcached
now go to php.ini file and enable memcache.so
OR
following command automatically append php.ini file and write memcache.so
sudo apt-get install php5-memcache memcached
now check memcached is running or not?
type
/etc/init.d/memcached status
/etc/init.d/memcached start
To check wether 11211 port is enable or not with 127.0.0.1
telnet 127.0.01 11211
Now run the memcached script on server:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<?php
// put your code here
$cache = new Memcache();
$cache->connect("127.0.0.1");
//addServer("127.0.0.1",11211);
$user_key = 12345;
/** Look in cache, if not found, set object (misses null) **/
if (!$user = $cache->get($user_key)) {
/**
* Set object with expire of 1 hour and no compression
*/
$value = array(34,56,34,23,23,124,65,767,34,76576,99);
$cache->set($user_key, $value, NULL, 6000);
$user = $value;
echo "In";
}
else
{
$tVar = $cache->get($user_key);
echo '<PRE>';
print_r($tVar);
echo "Out";
}
?>
</body>
</html>
This script will first time enter in if condition and second time in else condition.... if it does then your memcached is working fine else there is some error.
Cheers!
Friday, 25 June 2010
How to login on other server using command line?
Write down the following in the terminal:
$ ssh <username>@<IP Address>
and then press enter. It will be asked to enter password.
give password and you are done.
e.g.,
$ ssh root@10.10.12.40
it will ask password. give password and done.
Cheers!
$ ssh <username>@<IP Address>
and then press enter. It will be asked to enter password.
give password and you are done.
e.g.,
$ ssh root@10.10.12.40
it will ask password. give password and done.
Cheers!
what are 777 means in sense of permissions?
Whenever we give permission to the folder or anything, we usually write 777.
Here are three 777.
First seven means permission is giving to User(Owner)
Second seven means permission is giving to Group
Third seven means permission is giving to Others
so 777 means UGO
now comes to each 7. what the means of 7?
each 7 consist read, write or execute permission.
therefore,
read(r) : 4
write(w) : 2
execute(x) : 1
Suppose, if we want to give read, write and execute permission then
read + write + execute (rwx) => 4 +2 + 1 => 7
read + write (rw) => 4 + 2 => 6
read + execute (rx) => 4 + 1 => 5
write + execute (wx) => 2+1 => 3
Cheers!
Here are three 777.
First seven means permission is giving to User(Owner)
Second seven means permission is giving to Group
Third seven means permission is giving to Others
so 777 means UGO
now comes to each 7. what the means of 7?
each 7 consist read, write or execute permission.
therefore,
read(r) : 4
write(w) : 2
execute(x) : 1
Suppose, if we want to give read, write and execute permission then
read + write + execute (rwx) => 4 +2 + 1 => 7
read + write (rw) => 4 + 2 => 6
read + execute (rx) => 4 + 1 => 5
write + execute (wx) => 2+1 => 3
Cheers!
Subscribe to:
Posts (Atom)