Archives

You are currently viewing archive for 29 October 2007
Category: Web dev
Posted by: hajime osako
レイヤーを作るとき(style="position:absolute|relative")、ポジションは親ブロックオブジェクトを基準に作られる。この時、親ブロックオブジェクトにポジションが明示されていないと、レイヤーは正しい位置に作られない(IE6/7, Firefox)
例:
<div style="position:relative; width:480px; margin-left:auto; margin-right:auto; padding:0px;"> (親)
<div style="position:absolute; top:0px; left:0px; width:480px; z-index:10; text-align:left; margin:0px; padding:0px;">
Category: Study
Posted by: hajime osako
Numeric Expressions

When numbers are used in an arithmetic or comparison operation, the result may depend on whether it involves exact or approximate values. For example:

   SELECT 1.1+2.2=3.3 as 'exact', 1.1E0+2.2E0=3.3E0 as 'approx.';

The column 'exact' returns true (1), but 'approx' returns false (0).


String Expressions

Double quotes can't be used if the ANSI_QUOTES SQL mode is enabled.
The || operator can be used for string concatenation if the PIPES_AS_CONCAT SQL mode is enabled.

The default character set and collation for literal strings depend on the values of the character_set_connection (the default is latin1) and collation_connection (the default is latin1_swedish_ci) system variables.

A non-binary string can be treated as a binary string by preceding it with the BINARY keyword. For example:

   SELECT BINARY 'Hello' = 'hello'; (returns FALSE(0))

If ether string in a comparison is binary, both strings are treated as binary.
String comparison rules also apply to ORDER BY, GROUP BY and DISTINCT operations.

LENGTH() returns the length of a string in bytes, whereas CHAR_LENGTH() returns the length in characters.
The UPPER() and LOWER() functions perform case conversion only if the argument is a non-binary string. To make the two functions perform case conversion for a binary string, convert it to a non-binary string like below:

   SELECT UPPER((CONVERT(BINARY 'AbCd' USING latin1));

MySQL allows use of LIKE with non-string values by converting non-string values to strings before performing the pattern match.