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: 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; } };
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
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: 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
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."