Archive for February 2008

Protected: SVN 設定

This post is password protected. To view it please enter your password below:


判斷瀏覽器 XMLHttpRequest 的方式 / IE7

in_array 的寫法

避免 $user_list 是空的 array 時 出現 Warnning Continue reading ‘in_array 的寫法’ »

Splitting a large Apache log file with PHP

[code language='php']
$months = array(
  'Jul' => '07',
  'Aug' => '08',
  'Sep' => '09'
);

$open_file = false;
$fw = false;

$fp = fopen('filename.log', 'r');

while($line = fgets($fp)) {
  preg_match(':([0-9]{2})/(Jul|Aug|Sep):', $line, $matches);
  // $matches[1] = day of month
  // $matches[2] = month name
  $filename = "filename.log.2007{$months[$matches[2]]}{$matches[1]}";
  if($filename != $open_file) {
    if($fw) {
      fclose($fw);
    }
    $fw = fopen($filename, 'a');
    $open_file = $filename;
    echo "$filename\n";
  }
  fputs($fw, $line);
}

fclose($fw);
fclose($fp);
[/code]

An A-Z Index of Oracle SQL Commands (version 9.2)

Oracle Cheat Sheet

各類速查表 cheat sheets ….

wordpress / gentoo / apache / mod_rewrite 的設定

<VirtualHost *:80>
  ServerName toy.monster.tw
  ServerAdmin rimmon@monster.com.tw
  DocumentRoot “/var/www/toy.monster.tw”
  CustomLog /var/www/toy.monster.tw/log/access_log.txt combined

  <Directory “/var/www/toy.monster.tw”>
    Options FollowSymLinks
    AllowOverride All
    # AllowOverride controls what directives may be placed in .htaccess files.
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

Continue reading ‘wordpress / gentoo / apache / mod_rewrite 的設定’ »

Role-based access control in SQL, part 2

How to build role-based access control in SQL,part 1

mySQL 在update 時順便更新 timestamp 的 create table syntax

UltraEdit : 換行符號 ^n

Firefox 加速設定

Wish list ….

zoo keeper

http://www.geocities.com/rimmon/resource/zookeeper.swf

mysql performance blog

oracle/sqlrelay/php 把 field 的 name 轉成小寫 sample code

// $__oradb->setOption('portability', DB_PORTABILITY_LOWERCASE);
require_once "config.php";
require_once "sqlrelay.php";

unset($__config['sqlrelay_dsn']);
$__config['sqlrelay_dsn'][]="sqlrelay://xx_id:xx_pass@172.30.0.17:9000";

$sql="select aaa,bbb from xxxx t where g_close_date is null";

$__now=get_microtime();
$__oradb=_fn_connect_sqlrelay();
$__oradb->setOption('portability', DB_PORTABILITY_LOWERCASE);

$result = $__oradb->query($sql);
if (DB::isError($result)) {
  echo "db error\n";
  printf("Execution time : %s\n",get_microtime()-$__now);
  exit;
}

while ( $row=$result->fetchRow(DB_FETCHMODE_ASSOC) ) {
  // -----
  echo $row['aaa'] . ' : ' . $row['bbb'];
}

$result->free();
$__oradb->disconnect();

// 取時間 function
function get_microtime() {
    list($usec, $sec) = explode(' ',microtime() );
    return ((double)$usec + (double)$sec);
}

畫統計圖的 API

多伺服器的日誌合併統計

最簡單的想法是將日誌一一讀出來,然後按日誌中的時間欄位排序

Continue reading ‘多伺服器的日誌合併統計’ »

Protected: [歌詞] 是非題

This post is password protected. To view it please enter your password below: