Found this which said:
$('<div/>').text('This is fun & stuff').html();
Found this which said:
$('<div/>').text('This is fun & stuff').html();
My CSS height value wasn’t being applied. Found this. The problem was that I needed to specify heights for all of the ancestor elements. Bug fixed!
Today I had an interesting problem.
When I ran:
# php test.php | less
The ‘less’ program entered input mode and the up and down arrow (and j, k keys) weren’t working.
Eventually I figured out a solution:
# php test.php < /dev/null | less
The PHP CLI seems to be interfering with the terminal and piping in /dev/null to PHP CLI stdin fixes the problem!
Today I read this article and found this technique for calculating a median value:
SELECT x.val from data x, data y GROUP BY x.val HAVING SUM(SIGN(1-SIGN(y.val-x.val)))/COUNT(*) > .5 LIMIT 1
Today I read What is the Meta Refresh Tag? about the HTML Meta Refresh facility, basically:
<meta http-equiv="refresh" content="0;url=https://www.jj5.net/">
Today I read about how to link to archive.org videos…
Today I used the MySQL convert_tz function.
Before I could use named timezones with convert_tz I had to load the timezones.
Turns out MySQL doesn’t load timezone info by default! As you can read about here.
To load MySQL timezone info:
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
Today I had to use PHP’s DateTimeZone->getOffset() to get a timezone offset. It needed formatting which I did with:
function timezone_offset() {
$offset = timezone()->getOffset( now() );
$hours = round( abs( $offset ) / 3600 );
$minutes = round( ( abs( $offset ) - $hours * 3600 ) / 60 );
$result = ( $offset < 0 ? '-' : '+' )
. ( $hours < 10 ? '0' : '' ) . $hours
. ':'
. ( $minutes < 10 ? '0' : '' ) . $minutes;
return $result;
}
According to this article:
rewrite ^/store/view/product/(.*) /store/view.jsp?product=$1 permanent;