Archive for June 2009

Graphical Database Schema Metadata Browser – SchemaSpy

wordpress 的 schema

ver 2.7:

wp_2.7

幾個查詢例:

SELECT m.* FROM  wp_posts  p , wp_postmeta m
where p.id=m.post_id
order by post_id desc

SELECT tr.*
FROM  wp_posts  p , wp_term_relationships tr
where p.id=tr.object_id
order by p.id desc

SELECT p.id , w.*
FROM  wp_posts  p , wp_term_relationships tr , wp_term_taxonomy t
where p.id=tr.object_id
and tr.term_taxonomy_id=t.term_taxonomy_id
order by p.id desc

SELECT p.id , w.*
FROM  wp_posts  p , wp_term_relationships tr , wp_term_taxonomy t ,  wp_terms w
where p.id=tr.object_id
and tr.term_taxonomy_id=t.term_taxonomy_id
and t.term_id = w.term_id
order by p.id desc

gentoo emerge php options

2009.0630 Monster LAMP Pack:

取消 :
ncurses pdo readline spell

增加 :
ctype json sockets
berkdb gdbm
xmlreader xmlwriter
oci8-instant-client

USE="apache2 berkdb bzip2 calendar cjk cli crypt ctype curl gd gdbm hash iconv json mysql mysqli nls oci8-instant-client pcre reflection session simplexml sockets spl ssl tokenizer truetype unicode xml xmlreader xmlwriter zlib" emerge -av php

2009.0630 發現 wordpress code 裡面有用到 token_get_all ( tokenizer 所以不能取消)

Oracle documentation library

Simple Monster Tracking System – step by step

mts.js , 網上範例很多 , 這個是基本型:
70a13e19e02a2c85496d095bec62ba1b

這段 code 前面就是一連串的組出 z 變數(包括 OS , BROWSER , SCREEN WIDTH/HEIGHT …) , 然後用一個小點透過 apache 的 log 記錄下來.

這個 apache 要裝 mod_setenvif 或 mod_rewrite modules , 在 apache config 中設定 只 log 特定的 tracking data.

SetEnvIf Request_URI /dot.gif MTS_icon
LogFormat "%{%Y-%m-%d}t , %{%H:%M:%S}t , %a , \"%q\" , \"%{Referer}i\" , \"%{User-agent}i\"" MTS_format
CustomLog "| /usr/sbin/cronolog /var/www/ts.monster.com.tw/log/access-%Y%m%d%H.log" MTS_format env=MTS_icon

引用例:

fce31197e4af4ae225f2a76fb86e84cb

然後 apache log 會長這個樣子:

32e8d2437c1ca7c201d84d7e14f56c72

寫一段 PHP code:

$fp = fopen($mts_logfile,"r");

while ( $temp = fgetcsv($fp,$max_size)  ) {
  if ( count($temp)<1 ) continue;
  print_r($temp);
}
fclose($fp);

結果就類似這樣:

237de7c2773e273a224561d7bfcba4c7

再來就是處理 [3] 那邊的各種 data …

MySQL – Optimizing Database Structure

參考: http://dev.mysql.com/doc/refman/5.0/en/optimizing-database-structure.html

7.4.1. Make Your Data as Small as Possible
7.4.2. Column Indexes
7.4.3. Multiple-Column Indexes
7.4.4. How MySQL Uses Indexes
7.4.5. The MyISAM Key Cache
7.4.6. MyISAM Index Statistics Collection
7.4.7. How MySQL Opens and Closes Tables
7.4.8. Disadvantages of Creating Many Tables in the Same Database

減少 record structure 的大小 – Numeric Types 參考表
(用 MEDIUMINT 3bytes 比 INT 4bytes 好 , 若資料內容不可能有負值那加上 UNSIGNED , 則數值範圍可多一倍!)

fd5aa2a415b47b898c229846a7644cf8

Protected: 規格表 schema

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


mysql index 的建立/使用 , Multiple-Column Indexes

http://dev.mysql.com/doc/refman/5.0/en/multiple-column-indexes.html

CREATE TABLE test (
    id         INT NOT NULL,
    last_name  CHAR(30) NOT NULL,
    first_name CHAR(30) NOT NULL,
    PRIMARY KEY (id),
    INDEX name (last_name,first_name)
);

The name index is an index over the last_name and first_name columns. The index can be used for queries that specify values in a known range for last_name, or for both last_name and first_name. Therefore, the name index is used in the following queries:

SELECT * FROM test WHERE last_name='Widenius';

SELECT * FROM test
  WHERE last_name='Widenius' AND first_name='Michael';

SELECT * FROM test
  WHERE last_name='Widenius'
  AND (first_name='Michael' OR first_name='Monty');

SELECT * FROM test
  WHERE last_name='Widenius'
  AND first_name >='M' AND first_name < 'N';

However, the name index is not used in the following queries, 以下的 query 用不到 index —> 多重 index 有先後區別.

SELECT * FROM test WHERE first_name='Michael';

SELECT * FROM test
  WHERE last_name='Widenius' OR first_name='Michael';

Protected: 2009.0618 DBA

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


2009基隆市外木山海上4000公尺長泳

照這樣看, 不到 3000公尺呀??

今天游了 1小時8分 , 比去年快6分, 聽說今天海流是順的, 而且水母不多…

42d277a77c5dbad6571035b81a73f78f

這是今天的路徑圖

c038ed36349feff7f7fcd5e08d22eadc

特殊符號

Protected: ORACLE DBA 心得 (2)

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


Protected: Some Simple C Programs – 好用的 C 範例程式/片段

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


Protected: ★★★ Oracle streams standby architecture 架構圖 – 很多值得參考的範例

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


Manage Oracle Streams Advanced Queuing – DBMS_AQADM

 

官網資料 : http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_aqadm.htm#i1015375

The DBMS_AQADM package provides procedures to manage Oracle Streams Advanced Queuing (AQ) configuration and administration information.

See Also:

This chapter contains the following topics:

Protected: Subversion 命令列用戶端 svn command / svn client / 常用 svn command

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


Oracle Applications DBA Field Guide

看看它的各章節, 也許可以知道 DBA 的工作是什麼

http://www.amazon.com/Oracle-Applications-Field-Guide-Experts/dp/1590596447/ref=sr_1_1?ie=UTF8&s=books&qid=1244462254&sr=1-1

Ch1. Components and Architecture of Oracle Applications
Ch2. Configuration
Ch3. Monitoring and Troubleshooting
Ch4. Performance Tuning
Ch5. Patching
Ch6. Toolkit
Ch7. Resources

另外, 這邊有一位真正的 Oracle DBA : http://blog.xuite.net/charley_ocp/mydba01

Protected: 最近遇上的 Oracle 問題, 2009.0608 心得

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


2009 單車挑戰太平山

全國共有99個車隊組團參加,比賽車友有720人, 比賽起程路線從(樂水運動場)到(見晴觀景臺),沿途連續上坡全長28公里,更從海拔300公尺爬升到標高1900公尺, 競賽分為公路車組、登山車組兩大組別,公路車組限使用彎把公路車,登山組限使用平把車,另外還開放推廣組…

▍活動日期: 98年6月7日(星期日)
▍集合地點:樂水(樂水運動場)(集合、出發及頒獎點)
▍比賽路線:宜51線(樂水運動場)轉宜專1線至見晴觀景台,沿途連續上坡全長28公里(自海拔300公尺起爬升至標高1900公尺)。
▍路線概況:活動自樂水運動場出發,沿太平山公路前進,沿途連續上坡23公里(自海拔300公尺起爬升至標高1900公尺),途中於14.5公里處(白嶺)設飲水及食物補給站,到終點後憑號碼牌至起點換「餐點」。
DSC02970

一路都被超…
P002
當時還有些力氣…自拍一下…
P003

一路風景不錯 … 只是爬坡很辛苦 … 通常就是一個轉彎後就是一個陡坡

P005 P006

這是整場的路徑/時間圖 , 落後太多了….得要好好的練 bike 了 …
eb1d301d163d21caa63b90d5e43cf67c

Protected: Oracle’s V$ Views

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