Saturday, July 30, 2011

MySql 管理及應用網文

設計應用
Foreign Key 相關
数据库中主键和外键的设计原则
http://www.cnblogs.com/tianyamoon/archive/2008/04/02/1134394.html

数据库设计中一个矛盾:数据库外键,用还是不用?你怎么看?
http://kb.cnblogs.com/a/1601193/

外键约束方式
http://www.cnblogs.com/bigshow/archive/2009/01/11/1373835.html

管理
mysqldump
MySQL数据库备份守则和方法
http://tech.ddvip.com/2008-09/122095329462345.html

mysqldump 5.1 資料備份詳細指令
http://jax-work-archive.blogspot.com/2009/07/mysqldump-51-mysql.html


mysql分区表介绍
http://www.sphinxsearch.org/archives/23

Saturday, July 23, 2011

Apache2 的設置檔不能用UTF-8編碼, 只能用ANSI!

Apache2 的設置檔不能用UTF-8編碼, 只能用ANSI!
發佈者:Ivan Lee· 2010年8月30日
設置完 ... 後執行apache2ctl configtest 出現錯誤信息sites-enabled/mysite​: without matching section
重新儲存為ANSI編碼後一切正常.
(咁又幾粒鐘)

注:轉自FB

Wednesday, July 06, 2011

tar 命令使用 - 備份www 資料夾

用tar總是忘記用法和出錯,以下以備份A機/var/www 到B機/var/www為例
http://linux.vbird.org/linux_basic/0240tarcompress.php#pack
一、命令參數
參數記法:
1. 決定用那一種壓縮方法有 z和j
2. x解壓還是c壓縮或t只是看壓縮檔內容
3. 要詳細列出過程v
4. 要處理的檔案f file_name.tar 若是解壓則為已存在的檔案名,若是壓縮則為將要用的檔名,f參數建議放最後,以便後跟檔案名
5. -C /tmp 指定解壓至/tmp
根據上面順序
若壓縮則得到 root@A:/var# tar -zcvf backup.tar.gz www
;www為目錄
解壓則得到 root@A:/var# tar -zxvf backup.tar.gz
;B機/var/www/會被新內容覆蓋
二、目錄的位置
若上壓縮時寫為root@A:~# tar -zcvf backup.tar.gz /var/www
若查看會全部帶有var/www, 解壓時要在對的目錄並放回對應的目錄或利用-C,否則會多了一層或覆寫了其它目錄,亦要有權限,否則出現can not open file...

Sunday, July 03, 2011

PHP Session/Cookie

PHP Session/Cookie
Ivan Lee 寫於 2011年3月23日 20:16
session_set_cookie_params($lifeTime);
只對client browser 設置有效, 無助server side session 清理,詳細參閱以下內容
[/etc/php5/apach2/php.ini]
; Define the probability that the 'garbage collection' process is started
; on every session initialization.
; The probability is calculated by using gc_probability/gc_divisor,
; e.g. 1/100 means there is a 1% chance that the GC process starts
; on each request.

; This is disabled in the Debian packages, due to the strict permissions
; on /var/lib/php5. Instead of setting this here, see the cronjob at
; /etc/cron.d/php5, which uses the session.gc_maxlifetime setting below.
; php scripts using their own session.save_path should make sure garbage
; collection is enabled by setting session.gc_probability
;session.gc_probability = 0
session.gc_divisor = 100

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 1440

; NOTE: If you are using the subdirectory option for storing session files
; (see session.save_path above), then garbage collection does *not*
; happen automatically. You will need to do your own garbage
; collection through a shell script, cron entry, or some other method.
; For example, the following script would is the equivalent of
; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
; cd /path/to/sessions; find -cmin +24 | xargs rm

google map 全屏CSS設定

google map 全屏CSS設定
Ivan Lee 寫於 2011年4月30日 3:15
#map-canvas {
bottom: 0;
height: auto;
left: 0;
position: absolute;
right: 0;
top: 0;
}

若設成
#map-canvas{
width: 100%;
height: 100%;
}
會出現空白頁, 若height指定px值, 則自動佔滿寛度.
可能成因,
http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/49cc3e330b0bafb2
the problem is that you've got a strict html doctype at the start, but the "hello world" example leaves out the doctype (and therefore runs in quirks mode). In strict mode the browser calculates the 100% height as zero (inherited from body) so you need CSS like this to see the map:


html,body {
height: 100%;
margin: 0px;
}