Monday, January 21, 2013

Toshiba Tecra A11-1DT battery

Toshiba Tecra A11-1DT battery

Original battery number/type: PA3788U-1BRS

6 cells, DC 10.8v, 55Wh.

Thursday, January 10, 2013

PHP: Escape HTML output and allow custom html tags

Escape HTML output using htmlentities and allow at the same time a custom list of HTML tags.

 * Escape HTML output
 * Allow custom HTML tag list
 * @param string $sText
 * @return string
private function escapeHtml($sText)
    $sText = htmlentities($sText, ENT_QUOTES, 'UTF-8');
    $aAllowedTags = array('b', 'strong', 'i', 'em', 'br');
    foreach($aAllowedTags as $sTag)
        $sText = preg_replace('`&lt;(/?'.$sTag.'.*)&gt;`Ums', '<$1>', $sText);
    return $sText;

Saturday, January 5, 2013

MySQL: Fix error "Lock wait timeout exceeded; try restarting transaction"

MySQL error message: "Lock wait timeout exceeded; try restarting transaction"
MySQL error code: 1205

The MySQL variable innodb_lock_wait_timeout specifies the lock timeout in seconds.

See the current value of innodb_lock_wait_timeout:
SHOW VARIABLES LIKE 'innodb_lock_wait_timeout';

For MySQL versions greater than 5.5: use SET GLOBAL or SET SESSION syntax to change the value of innodb_lock_wait_timeout at runtime.

For all MySQL versions and earlier versions set this value in my.cnf:
# example: