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
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;
Today I had to lookup how to set svn:ignore from the command line:
$ svn propset svn:ignore [file|folder] [path]
Today I was forced to lookup how to treat <blockquote> and <p> elements. It turns out you wrap paragraphs with blockquote, i.e.:
<blockquote><p>...</p></blockquote>
Today I had to look up all the various ways HTML might nominate a content-type and I found Character encodings in HTML over on Wikipedia which had all the answers…
Today I had to lookup how to set the target frame of a form.
Basically you set the ‘target’ attribute on the form to the name of the frame you want to target.
It was a bit of a trick to find the DateInterval spec hidden away in the constructor doco, not the DateInterval class doco.
| Designator | Description |
|---|---|
| Y | years |
| M | months |
| D | days |
| W | weeks |
| H | hours |
| M | minutes |
| S | seconds |
Today I learned about LIMIT and OFFSET in PostgreSQL, which differs slightly from its MySQL cousin.
I’m always forgetting the syntax for the jQuery ‘document ready’ event. Which is an embarrassment because it’s so simple:
$( document ).ready( handler ) $().ready( handler ) (this is not recommended) $( handler )
I used to use the $( document ).ready( handler ) syntax, but starting today I use the $( handler ) syntax.