PHP 和 MySQL 雙方傳遞資料的編碼要正確才能避免亂碼的問題。
要避免亂碼的問題以下兩個條件必須使用一致的編碼:
1. 網頁在瀏覽器所使用的編碼
2. MySQL Client 設定使用的編碼
針對 PHP 和 MySQL 間溝通所使用的編碼,
我們可以使用 mysql_client_encoding 來確認目前 MySQL Client 所使用的編碼,
並用 mysql_set_charset 來做設定的動作。
Reference:
mysql_client_encoding
mysql_set_charset
2012年5月29日 星期二
2012年4月3日 星期二
RFC2544
Throughput:
a. Specific rate
b. Specific frame size
c. Binary Search ( Fail = Reduce the rate)
d. Result = Maximum rate ( frames/second or bits/second)
Latency:
a. Maximum rate (Result of throughput testing)
b. Specific corresponded frame size
c. Option:
c-1 Store and Forward (LIFO)
c-2 Bit Forwarding (FIFO)
c-3 Cut Through (LILO)
d. Result =>time interval
Frame Loss Rate:
a. Specific maximum rate (100% Utilization)
b. Specific frame size
c. Binary Search (Fail = Reduce the maximum rate (10% interval))
d. Result: Frame loss rate (%)
Back-to-Back:
a. Minimum inter-frame gap
b. Send a specific number of frames
c. Binary Search (Reduce the length of burst)
d. Result: Frame count
a. Specific rate
b. Specific frame size
c. Binary Search ( Fail = Reduce the rate)
d. Result = Maximum rate ( frames/second or bits/second)
Latency:
a. Maximum rate (Result of throughput testing)
b. Specific corresponded frame size
c. Option:
c-1 Store and Forward (LIFO)
c-2 Bit Forwarding (FIFO)
c-3 Cut Through (LILO)
d. Result =>time interval
Frame Loss Rate:
a. Specific maximum rate (100% Utilization)
b. Specific frame size
c. Binary Search (Fail = Reduce the maximum rate (10% interval))
d. Result: Frame loss rate (%)
Back-to-Back:
a. Minimum inter-frame gap
b. Send a specific number of frames
c. Binary Search (Reduce the length of burst)
d. Result: Frame count
2012年3月26日 星期一
Windows 7 遠端桌面設定
1. 控制台→系統→遠端設定 (務必選取使用者,即使已顯示有權限)
2. 檢查使用者是否已加入 Remote Desktop Users 群組
3. 檢查防火牆
4. 更新到最新的 patch
2. 檢查使用者是否已加入 Remote Desktop Users 群組
3. 檢查防火牆
4. 更新到最新的 patch
2012年3月9日 星期五
職場心得分享
剛跟老婆去吃中華附近最近開的一家簡餐店,
老闆夫婦都曾在 TSMC 擔任主管。
聽老闆娘分享以前在職場的經驗:
賺人生經驗比賺很多錢重要,
保護好自己的立場比保護好利益重要,
有度量、不計較、盡本分、正向思考、多運動,
活得久才賺得多,賺得多也要用得到。
老闆夫婦都曾在 TSMC 擔任主管。
聽老闆娘分享以前在職場的經驗:
賺人生經驗比賺很多錢重要,
保護好自己的立場比保護好利益重要,
有度量、不計較、盡本分、正向思考、多運動,
活得久才賺得多,賺得多也要用得到。
2012年1月31日 星期二
可能的職涯規劃
QA -> Senior QA -> QA Leader -> Management
QA -> FAE
QA -> Marketing
QA -> Pre-sales
QA -> Software RD -> Senior Software RD
OA Value:
1. Study new feature
2. Study Client application
3. Management
RD Value:
1. Plan software architecture
2. Plan software SPEC.
3. Management
QA -> FAE
QA -> Marketing
QA -> Pre-sales
QA -> Software RD -> Senior Software RD
OA Value:
1. Study new feature
2. Study Client application
3. Management
RD Value:
1. Plan software architecture
2. Plan software SPEC.
3. Management
2011年11月28日 星期一
Yahoo 系統工程師的技能需求與具體描述
##
1. Linux/FreeBSD
2. Apache
3. MySQL
4. PHP
5. Nagios
6. MRTG
7. Perl
8. Shell Script
##
A. Function as a technical generalist responsible for the overall health and performance of our many web applications and cloud services
B. Develop tools by scripts (shell scripts, Perl, python, …etc) to automate the deployment, administration, and monitoring of a large-scale Linux and FreeBSD environments on different global locations.
C. Gain deep application-level knowledge of the systems as well as contributing to their overall design
D. Work with development teams to harden, enhance, document, establish process and generally improve the operability of our systems
E. Assist in the configuration/build-out of new deployments to facilitate our constant growth
F. Participate in a global support of on-call pager rotation
Common Tech Skills for Search Cloud Service Engineering
Boot Process and Configs
Areas
BIOS, POST
Remote on/off Machines / Remote Boot
MBR, GRUB, Lilo.
Kernel device probing, root mount
init process, run levels
configs of apache, dns, network, …etc
Perl
a hash and/or hashing function works.
Sorting of arrays and hashes.
Recursive functions
Plus: Advanced Perl
Shell Scripting
Areas
Bash / Commands
Write an init scrip..
Awk, sed, regular expression.
Pipe, redirect
If, loop, case, …
Monitoring, Alerting and Nagios
Areas
nrpe,
RTTS/Uranus,
Plus: Cacti, ganglia, cricket, etc.
Plus: Gomez or Keynote or other such tools
Troubleshooting
Areas
df show partition is full, you delete a file, df still shows full. What's going on?
Web performance is slow. What do you do? (Network, system, app, DB, etc. troubleshooting.)
Disk is "slow" what might you look at? iostat, dmesg to see if the disk is dying, etc.
Network is slow. What do you look at? duplex, saturation, etc.
Unix Internals
Areas
Fork()
Paging, swapping. How to tell what's occurring (vmstat, etc.) Ill-effects of paging.
How typical FFS based filesystems work. Cylinder groups, inodes, data blocks, indirect blocks, super blocks.
log/extents/journal based filesystems
inodes and dirents.
symlinks and hardlinks.
/proc/ filesystem.
Block devices vs. raw devices.
FIFOs, regular files, …etc.
sysctl and other tunables
IPC
Networking/DNS
Areas
how DNS works. Recursive vs. iterative. Zones. Record types.
Socket, bind, …etc
nsswitch.conf, /etc/hosts, resolv.conf.
network performance tuning.
SACK and interface aggregation.
Deeper network topics like 802.1Q, core/aggregation|distribution/access switch infrastructure, BGP, OSPF, etc.
Discussion of load balancing techniques. like DSR, SNAT, etc.
Healthchecking
TCP packets, IP packets, ethernet frames
ARP and RARP, switches , routers.
Hardware, RAID, misc.
Areas
RAID levels.
Difference between 32-bit and 64-bit architectures.
Software RAID vs. Hardware RAID.
SAN vs. NAS.
…
Infrastructure and Architecture
Areas
A typical three tier web site architecture
Concerns to design an architecture
GSLB (akadns, brooklyn), failover, BCP.
Capacity planning
…
1. Linux/FreeBSD
2. Apache
3. MySQL
4. PHP
5. Nagios
6. MRTG
7. Perl
8. Shell Script
##
A. Function as a technical generalist responsible for the overall health and performance of our many web applications and cloud services
B. Develop tools by scripts (shell scripts, Perl, python, …etc) to automate the deployment, administration, and monitoring of a large-scale Linux and FreeBSD environments on different global locations.
C. Gain deep application-level knowledge of the systems as well as contributing to their overall design
D. Work with development teams to harden, enhance, document, establish process and generally improve the operability of our systems
E. Assist in the configuration/build-out of new deployments to facilitate our constant growth
F. Participate in a global support of on-call pager rotation
Common Tech Skills for Search Cloud Service Engineering
Boot Process and Configs
Areas
BIOS, POST
Remote on/off Machines / Remote Boot
MBR, GRUB, Lilo.
Kernel device probing, root mount
init process, run levels
configs of apache, dns, network, …etc
Perl
a hash and/or hashing function works.
Sorting of arrays and hashes.
Recursive functions
Plus: Advanced Perl
Shell Scripting
Areas
Bash / Commands
Write an init scrip..
Awk, sed, regular expression.
Pipe, redirect
If, loop, case, …
Monitoring, Alerting and Nagios
Areas
nrpe,
RTTS/Uranus,
Plus: Cacti, ganglia, cricket, etc.
Plus: Gomez or Keynote or other such tools
Troubleshooting
Areas
df show partition is full, you delete a file, df still shows full. What's going on?
Web performance is slow. What do you do? (Network, system, app, DB, etc. troubleshooting.)
Disk is "slow" what might you look at? iostat, dmesg to see if the disk is dying, etc.
Network is slow. What do you look at? duplex, saturation, etc.
Unix Internals
Areas
Fork()
Paging, swapping. How to tell what's occurring (vmstat, etc.) Ill-effects of paging.
How typical FFS based filesystems work. Cylinder groups, inodes, data blocks, indirect blocks, super blocks.
log/extents/journal based filesystems
inodes and dirents.
symlinks and hardlinks.
/proc/ filesystem.
Block devices vs. raw devices.
FIFOs, regular files, …etc.
sysctl and other tunables
IPC
Networking/DNS
Areas
how DNS works. Recursive vs. iterative. Zones. Record types.
Socket, bind, …etc
nsswitch.conf, /etc/hosts, resolv.conf.
network performance tuning.
SACK and interface aggregation.
Deeper network topics like 802.1Q, core/aggregation|distribution/access switch infrastructure, BGP, OSPF, etc.
Discussion of load balancing techniques. like DSR, SNAT, etc.
Healthchecking
TCP packets, IP packets, ethernet frames
ARP and RARP, switches , routers.
Hardware, RAID, misc.
Areas
RAID levels.
Difference between 32-bit and 64-bit architectures.
Software RAID vs. Hardware RAID.
SAN vs. NAS.
…
Infrastructure and Architecture
Areas
A typical three tier web site architecture
Concerns to design an architecture
GSLB (akadns, brooklyn), failover, BCP.
Capacity planning
…
2011年11月27日 星期日
在 Linux 上調整 glassfish 的 porcess pool number 時遇到的問題
在 Linux 上每個 porcess 可以開啟的檔案數量預設為 1024,
glassfish 在預設 porcess pool number 為 5 時執行就已經開啟了 500 多的檔案,
所以要是將 porcess pool number 調整為 500 瞬間就會超過 1024,然後出現下面的 Error Message。
##
#|2011-11-26T21:39:51.917+080
0|SEVERE|glassfish3.0.1|grizzl y|_ThreadID=18;_ThreadName= Thread-14;|doSelect IOException
java.io.IOException: 開啟太多檔案
at sun.nio.ch.IOUtil.initPipe(Nat ive Method)
at sun.nio.ch.EPollSelectorImpl.< init>(EPollSelectorImpl.java:4 9)
at sun.nio.ch.EPollSelectorProvid er.openSelector(EPollSelectorP rovider.java:18)
at java.nio.channels.Selector.ope n(Selector.java:209)
at com.sun.grizzly.util.Utils.ope nSelector(Utils.java:100)
at com.sun.grizzly.TCPSelectorHan dler.initSelector(TCPSelectorH andler.java:399)
at com.sun.grizzly.TCPSelectorHan dler.preSelect(TCPSelectorHand ler.java:379)
at com.sun.grizzly.SelectorHandle rRunner.doSelect(SelectorHandl erRunner.java:183)
at com.sun.grizzly.SelectorHandle rRunner.run(SelectorHandlerRun ner.java:130)
at java.util.concurrent.ThreadPoo lExecutor$Worker.runTask( ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoo lExecutor$Worker.run(ThreadPoo lExecutor.java:908)
at java.lang.Thread.run(Thread.ja va:662)
|#]
##
解法是要先調整每個 porcess 可以開啟的檔案數上限,
先編輯 /etc/security/limits.conf
加入下面這一行,目的是未來機器重開都會讀取我們設定的新上限值。
##
* soft nofile 65536
##
然後用這個指令動態修改
##
參考資料:
http://www.cyberciti.biz/faq/howto-linux-get-list-of-open-files/
http://www.linuxidc.com/Linux/2010-04/25283.htm
glassfish 在預設 porcess pool number 為 5 時執行就已經開啟了 500 多的檔案,
所以要是將 porcess pool number 調整為 500 瞬間就會超過 1024,然後出現下面的 Error Message。
##
#|2011-11-26T21:39:51.917+080
java.io.IOException: 開啟太多檔案
at sun.nio.ch.IOUtil.initPipe(Nat
at sun.nio.ch.EPollSelectorImpl.<
at sun.nio.ch.EPollSelectorProvid
at java.nio.channels.Selector.ope
at com.sun.grizzly.util.Utils.ope
at com.sun.grizzly.TCPSelectorHan
at com.sun.grizzly.TCPSelectorHan
at com.sun.grizzly.SelectorHandle
at com.sun.grizzly.SelectorHandle
at java.util.concurrent.ThreadPoo
at java.util.concurrent.ThreadPoo
at java.lang.Thread.run(Thread.ja
|#]
##
解法是要先調整每個 porcess 可以開啟的檔案數上限,
先編輯 /etc/security/limits.conf
加入下面這一行,目的是未來機器重開都會讀取我們設定的新上限值。
##
* soft nofile 65536
##
然後用這個指令動態修改
##
ulimit -Sn 65536##
參考資料:
http://www.cyberciti.biz/faq/howto-linux-get-list-of-open-files/
http://www.linuxidc.com/Linux/2010-04/25283.htm
訂閱:
文章 (Atom)