November 6, 2009 by paragasu
<ul class="menu">
<li><a href="/"> Home </a></li>
</ul>
to activate the link when user click on li
$('.menu li').click(function(e){
location.href = $(this).find('a').attr('href');
});
Now, user doesn’t have to click on the “Home” to activate the link.
Tags: click li activate a, jquery
Posted in jquery | Leave a Comment »
November 3, 2009 by paragasu
enable query cache (maybe default depends of the server configuration)
SELECT SQL_CACHE SUM(points) FROM account;
turn off mysql query cach
SELECT SQL_NO_CACHE SUM(points) FROM account;
the mysql query cache
Tags: mysql cache query, sql_cache, sql_no_cache
Posted in database | Leave a Comment »
November 3, 2009 by paragasu
add this code in the HTML head section
<script type="text/javascript">
history.forward();
</script>
Tags: disable back button
Posted in Website | Leave a Comment »
October 25, 2009 by paragasu
$str = preg_replace('/\s+/', ' ', $str); //" \n\n\n" will end up as " \n"
$str = preg_replace('/\x20+/', ' ', $str); //only space
Tags: replace many space with one space
Posted in php | Leave a Comment »
October 20, 2009 by paragasu
ajax request will send additional header
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')
echo 'ajax';
stackoverflow
Tags: detect ajax request
Posted in php | Leave a Comment »
October 14, 2009 by paragasu
server configuration php5-cgi, php5-tidy nginx, debian etch.
Tidy configuration tab-size=>0 can trigger this error. Just change the tab-size value to be greater than 0 to fix
tab-size => 1
Tags: The page you are looking for is temporarily unavailable. Please try again later.
Posted in Linux, php | Leave a Comment »
October 5, 2009 by paragasu
you should have
Option "SendCoreEvents" "true"
inside the Section “Input Device”, Driver “mouse”
Posted in Linux | Leave a Comment »
October 3, 2009 by paragasu
echo $num; // 1
$str = sprintf('%02d', $num, 2);
echo $str; //01
Tags: add leading zero
Posted in php | 1 Comment »
October 2, 2009 by paragasu
$timestamp = strtotime($end_date) - strtotime($start_date);
$days = round($timestamp / 86400);
this code only works on linux box.
Tags: number of days between two dates
Posted in php | Leave a Comment »