07/27: MySQL > Numeric Data Types
Integer Data Types
The number 4 is the display width which is unrelated to the range of the data type.
Values shorter than the display width are padded with spaces as necessary.
It won't cause output truncation.
INT(4) column does not require half as much storage per value at INT(8). All INT data type require 4 bytes.
No display width is specified, MySQL use the width of the full range of values for the type. Ex: SMALLINT is 6 because the widest is -32768.
Floating-Point Data Types
FLOAT and DOUBLE may be used to represent approximate-value numbers in the native binary floating-point format used by the server host's CPU.
Fixed-Point Data Types (DECIMAL)
The defaults for omitted precision and scale are 10 and 0.
The amount of storage required for DECIMAL is approximately four bytes are required per nine digits on each side of the decimal point.
The BIT Data Type
BIT(n) column presents the range of value 0 to 2n -1, and the storage requirement is approximately INT((n+7/8) bytes per value.
To wirete literal bit values, the leteral-value notation b'xxx' can be used. For example, b'1111' equals 15.
TINYINT 1 byte SMALLINT 2 bytes MEDIUMINT 3 bytes INT 4 bytes BIGINT 8 bytesINT(4)
The number 4 is the display width which is unrelated to the range of the data type.
Values shorter than the display width are padded with spaces as necessary.
It won't cause output truncation.
INT(4) column does not require half as much storage per value at INT(8). All INT data type require 4 bytes.
No display width is specified, MySQL use the width of the full range of values for the type. Ex: SMALLINT is 6 because the widest is -32768.
Floating-Point Data Types
FLOAT and DOUBLE may be used to represent approximate-value numbers in the native binary floating-point format used by the server host's CPU.
FLOAT 4 bytes DOUBLE 8 bytesYou can specify explicit precision and scale, but if you don't, MySQL uses the maximum accuracy allowed by the hardware. Floating-point values are stored using mantissa/exponent representation.
Fixed-Point Data Types (DECIMAL)
The defaults for omitted precision and scale are 10 and 0.
The amount of storage required for DECIMAL is approximately four bytes are required per nine digits on each side of the decimal point.
The BIT Data Type
BIT(n) column presents the range of value 0 to 2n -1, and the storage requirement is approximately INT((n+7/8) bytes per value.
To wirete literal bit values, the leteral-value notation b'xxx' can be used. For example, b'1111' equals 15.
07/27: Javascriptでオブジェクト指向に挑戦2
function Validator()
{
// Constructor
// Declare Properties
this.regExpPatterns = new Object();
this.errMsgs = new Object();
// Declare Methods
this.validate = function(elm, ptn, msg)
{
var _str = null;
if(!ptn && elm.name && _parent.regExpPatterns[elm.name])
{
ptn = this.regExpPatterns[elm.name];
}
...
}
this.setAlertErr = function(bool)
{
this.alertErr = bool;
}
this.getAlertErr = function()
{
return this.alertErr;
}
}
OR
var Validator = new Function();
Validator.prototype.field1 = XXXXXX;
Validator.prototype.method1 = function (param1, param2)
{
[snip]
}
07/27: Javascript > prototypeの説明
Blog.okuryu : PHP の array_multisort で多次元配列をソートする
$tmpOrderBy1 = array(); $tmpOrderBy2 = array(); foreach($dbResult as $key=>$row) { $tmpOrderBy1[$key] = $row[orderby_column_1]; $tmpOrderBy2[$key] = $row[orderby_column_2]; } array_multisort($tmpOrderBy1, SORT_DESC, $tmpOrderBy2, SORT_ASC, $dbResult);
07/25: MySQL > レプリケーション
07/25: MySQL > Softwares and Tools
MySQL Query Browser
The result area tab is splittable horizontally or vertically. The Script Editor provides debugging options such as single-stepping and breakpoints.
Double-clicking a table name enters SELECT statement automatically.
Queries in the bookmark or history browser is draggable. Double-clicking a query also enters it into the query area. Most of the option settings are shared between Query Browser and Administrator.
Passwords can be save as plain text or in 'obscured' format.
MySQL Client Interfaces
MySQL Connector/ODBC, /J and /NET
/ODBC is written by C and /J and /NET are written by native language, which support for MySQL capabilities such as server-side prepared statements, stored routines and Unicode.
The result area tab is splittable horizontally or vertically. The Script Editor provides debugging options such as single-stepping and breakpoints.
Double-clicking a table name enters SELECT statement automatically.
Queries in the bookmark or history browser is draggable. Double-clicking a query also enters it into the query area. Most of the option settings are shared between Query Browser and Administrator.
Passwords can be save as plain text or in 'obscured' format.
MySQL Client Interfaces
MySQL Connector/ODBC, /J and /NET
/ODBC is written by C and /J and /NET are written by native language, which support for MySQL capabilities such as server-side prepared statements, stored routines and Unicode.
07/25: JavaScript 1.5 > ゲッタとセッタの定義
Core JavaScript 1.5 Guide:Creating New Objects:Defining Getters and Setters - MDC
o = { a:7, get b() { return this.a+1; }, set c(x) { this.a = x/2; } };
07/24: MySQL > Client Program
Excute SQL from shell shell> mysql -e (or --excute) "SELECT DATABASE(); SELECT VERSION();" Statement Terminators \c to cancel current statement \q to exit mysql comand console \g is terminator \G is terminator plus output vertically Using Script Files mysql> SOURCE input_file shell> mysql de_name < input_file Output Formats --batch (or -B) tab-delimited output --table (or -t) tabular output --html (or -H) HTML format --xml (or -X) XML format Clinet Commands and SQL statements mysql> STATUS; mysql> HELP item;
07/24: Cygwin > 起動時のmount
Life with Cygwin 3"普通の Unix では /etc/fstab 等のファイルに mount の設定を保存しますが, Cygwin に該当するファイルはありません。 Cygwin は Windows アプリケーションらしくレジストリに設定を記録します。"
07/24: MySQL > Server SQL Modes
- ANSI_QUOTES
- The double quote character is interpreted as an identifier-quoting character.
- IGNORE_SPACE
- Ignore spaces after function names.
- ERROR_FOR_DIVISION_BY_ZERO
- The default is that MySQL returns NULL rather than a warning (or an error in strict mode.)
- STRICT_TRANS_TABLES, STRICT_ALL_TABLES
- Switching on 'strict mode.' STRICT_TRANS_TABLES is only for transactional tables.
- TRADITIONAL
- strict modes plus several additional restrictions.
- ANSI
- enables behaviors are more like ANSI SQL (ex. ANSI_QUOTES, PIPES_AS_CONCAT)
MySQL AB :: MySQL 5.0 Reference Manual :: 8.8.5.2 Using the --safe-updates Option
What it does is:
SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=1000, SQL_MAX_JOIN_SIZE=1000000;
How to use:
mysql --safe-updates --select_limit=500 --max_join_size=10000
What it does is:
SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=1000, SQL_MAX_JOIN_SIZE=1000000;
How to use:
mysql --safe-updates --select_limit=500 --max_join_size=10000
--protocol [ tcp | socket | pipe | memory ] --host=host_name or -h host_name (default: localhost) --port=port_number or -P port_number (default: 3306) --shared-memory-base-name=memory_name (default: MYSQL) --socket=socket_name or -S socket_name (default: /tmp/mysql.sock) --user=user_name or -u user_name --password=pass_value or -ppass_value or -p --compress or -C
How to import option file:
shell: mysql --defaults-file=file_pathother options: --defaults-extra-file, --no-defaults
07/20: MySQL > rootパスワードを忘れたとき
MySQLの小技
# service mysqld stop
# /usr/bin/safe_mysqld --skip-grant-tables
# mysql -u root mysql
UPDATE user SET Password=PASSWORD('mynewpassword') WHERE User='root';
FLUSH PRIVILEGES;
# service mysqld start
# service mysqld stop
# /usr/bin/safe_mysqld --skip-grant-tables
# mysql -u root mysql
UPDATE user SET Password=PASSWORD('mynewpassword') WHERE User='root';
FLUSH PRIVILEGES;
# service mysqld start
07/20: セキュリティ > Apache
07/20: Eclipse プラグイン > UML
07/19: Javascript > 動的にファイルを読み込む
How to Dynamically load JavaScript Source files to a webpage
//Create a 'script' element var scrptE = document.createElement("script"); // Set it's 'type' attribute scrptE.setAttribute("type", "text/javascript"); // Set it's 'language' attribute scrptE.setAttribute("language", "JavaScript"); // Set it's 'src' attribute scrptE.setAttribute("src", "myjsfile.js"); // Now add this new element to the head tag document.getElementsByTagName("head")[0].appendChild(scrptE);
benlog.org: Prototype: solving the file size issue"JQuery is distributed with a compressed version that weighs in at 19kb. The uncompressed version is 55kb. Prototype users will find the syntax fairly similar. Another library is mootools, a fork of Prototype that’s also distributed in compressed form. Their website also lets you pick and choose the components you need, which may result in a significantly smaller library file."
07/13: Javascript > JSON parser
07/12: MySQL > DESCRIBE table_name
Column 'Key' has three value: PRI, UNI and MUL. Even this Key is null, still this column could be the part of index as a secondary column.
MUL indicates the first column of a non-unique index or a unique value index that can contain NULL.
Are You Using Abstract Classes, Polymorphism, and Interfaces? @ JAVA DEVELOPER"A class is called abstract if it has at least one abstract (not implemented) method."