Tuesday, May 18, 2010

EXTJS Hide Tab Panels

This is for hide the tab
Ext.getCmp(tabpanel_id).hideTabStripItem(tabitem_id);

This is for show the tab again
Ext.getCmp(tabpanel_id).unhideTabStripItem(tabitem_id);

Thanks!

Thursday, May 13, 2010

Prime Number Program

function IsPrime($number)
{
if ($number < 2) { /* We don't want zero or one showing up as prime */
return FALSE;
}
for ($i=2; $i<=($number / 2); $i++) {
if($number % $i == 0) { /* Modulus operator, very useful */
return FALSE;
}
}
return TRUE;
}

for($i = 0; $i < 100; $i++)
{
echo $i." is a prime number? ".IsPrime($i)."
";
}

Mysql

1 Stored Procedure
2 Cursor
3 Trigger
4 What is indexing
5 Difference between MyIsam and InnoDB.
6 Delete Duplicate entries and keep only one from the table

Friday, May 7, 2010

How to increase your session time out PHP


/*********************** Increase the session time out *****************/
$values = $_SESSION;

// keep session config
$trans = ini_get( 'session.use_trans_sid' );
if( $trans ) {
ini_set( 'session.use_trans_sid', 0 );
}
$cookie = session_get_cookie_params();

// create new session id
$id = 0;
while (strlen($id) < 32) {
$id .= mt_rand(0, mt_getrandmax());
}

$id = md5( uniqid($id, true));

// kill session
session_destroy();

$cookie['lifetime'] = 7*60; // minutes * 60

// restore config
ini_set( 'session.use_trans_sid', $trans );
session_set_cookie_params( $cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure'] );

session_cache_expire($cookie['lifetime'] / 60);
ini_set('session.gc_maxlifetime', $cookie['lifetime']);
// restart session with new id
session_id( $id );
session_start();
$_SESSION = $values;

/*********************************** End *******************************/
?>