Archives

You are currently viewing archive for July 2007
Category: Web dev
Posted by: hajime osako

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]
}
Category: Web dev
Posted by: hajime osako
Category: Web dev
Posted by: hajime osako
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);
Category: Web dev
Posted by: hajime osako
Category: Web dev
Posted by: hajime osako
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; }
};
Category: Web dev
Posted by: hajime osako
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
Category: Web dev
Posted by: hajime osako
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
Category: Web dev
Posted by: hajime osako
Category: Web dev
Posted by: hajime osako
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);
 
Category: Web dev
Posted by: hajime osako
PHP: Error Control Operators - Manual
@ のPHPでの呼び方をよく忘れるので。
エラーメッセージはグローバル変数 $php_errormsg に保存されます
Category: Web dev
Posted by: hajime osako
"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."
benlog.org: Prototype: solving the file size issue
Category: Web dev
Posted by: hajime osako
Category: Web dev
Posted by: hajime osako
Category: Web dev
Posted by: hajime osako
"A class is called abstract if it has at least one abstract (not implemented) method."
Are You Using Abstract Classes, Polymorphism, and Interfaces? @ JAVA DEVELOPER
Category: Web dev
Posted by: hajime osako
第2回 JavaScriptの関数をマスターしよう - @IT
var add = new Function("x", "y", "return x + y");
Category: Web dev
Posted by: hajime osako
Category: Web dev
Posted by: hajime osako