Monday, 19 July 2010

How to unzip tar.gz file in ubuntu?

Hi guys,

Please use the following command:

tar xvzf something.tar.gz


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!

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;