Archive for 三月, 2013

Nginx的epoll类非阻塞事件模型以及被说的烂了,但这只是它高性能的一角,细节决定成败。这次重操旧业,希望能真正了解nginx。

请求处理的不同阶段

在使用ngx_lua时,经常看到可以在access、rewrite等各阶段插入lua代码,那一个请求的处理过程中,会经过多少阶段,是不是每个阶段都能够插入callback呢?filter所需的参数是如何传递的呢?filter与nginx worker之间又是如何调度并表达返回值的呢?

 

 

先收集一些资料,后续写体会:

nginx中upstream的设计和实现

使用异步 I/O 大大提高应用程序的性能

使用 Nginx 提升网站访问速度 (较浅)

利用 squid 反向代理提高网站性能

當您在 e-mail 訊息或網頁上按一下超連結,或在網頁超連結上按滑鼠右鍵,並按一下 [在新視窗開啟] 時,您可能遇到下列一項以上的徵兆:

  • 未執行任何動作。
  • 新視窗可能為空白。
  • 您可能收到指令錯誤訊息。

若要在 Internet Explorer 中解決此問題,請依循下列步驟:

  1. 結束所有執行中程式。
  2. 按一下 [開始],再按一下 [執行]
  3. 輸入 regsvr32 urlmon.dll,再按一下 [確定]
  4. 當您收到「urlmon.dll 的 DllRegisterServer 已完成」訊息時,按一下 [確定]

如果這樣還不能解決問題,請在每個檔案上重複步驟 2 到 4 (在步驟 3 中,請將 Urlmon.dll 檔名置換為下列檔案):

  • Shdocvw.dll
  • Msjava.dll
  • Actxprxy.dll
  • Oleaut32.dll
  • Mshtml.dll
  • Browseui.dll
  • Shell32.dll (僅適用 Windows XP 與 Windows 2000)

如果問題仍未解決,請確認下列機碼值存在且正確:

HKLM\SOFTWARE\Classes\Interface\{00020400-0000-0000-C000-000000000046} 
名稱:(預設)
值: IDispatch
HKLM\SOFTWARE\Classes\Interface\{00020400-0000-0000-C000-000000000046}\ProxyStubClsid
名稱:(預設)
值: {00020420-0000-0000-C000-000000000046} 
HKLM\SOFTWARE\Classes\Interface\{00020400-0000-0000-C000-000000000046}\ProxyStubClsid32
名稱:(預設)
值: {00020420-0000-0000-C000-000000000046}

如果問題仍未解決,請重新安裝 Internet Explorer。如果您使用的 Internet Explorer 版本包括在您的作業系統中,請重新安裝或修復您的作業系統。

 

zz from:http://support.microsoft.com/kb/281679/zh-tw

I have marked with a * those which I think are absolutely essential
Items for each section are sorted by oldest to newest. Come back soon for more!

BASH
* In bash, 'ctrl-r' searches your command history as you type
- Add "set -o vi" in your ~/.bashrc to make use the vi keybindings instead
  of the Emacs ones. Takes some time to get used to, but it's fantastic!
- Input from the commandline as if it were a file by replacing 
  'command < file.in' with 'command <<< "some input text"'
- '^' is a sed-like operator to replace chars from last command 
  'ls docs; ^docs^web^' is equal to 'ls web'. The second argument can be empty.
* '!!:n' selects the nth argument of the last command, and '!$' the last arg
  'ls file1 file2 file3; cat !!:1-2' shows all files and cats only 1 and 2
- More in-line substitutions: http://tiny.cc/ecv0cw http://tiny.cc/8zbltw
- 'nohup ./long_script &' to leave stuff in background even if you logout
- 'cd -' change to the previous directory you were working on
- 'ctrl-x ctrl-e' opens an editor to work with long or complex command lines
* Use traps for cleaning up bash scripts on exit http://tiny.cc/traps
* 'shopt -s cdspell' automatically fixes your 'cd folder' spelling mistakes

PSEUDO ALIASES FOR COMMONLY USED LONG COMMANDS
- function lt() { ls -ltrsa "$@" | tail; }
- function psgrep() { ps axuf | grep -v grep | grep "$@" -i --color=auto; }
- function fname() { find . -iname "*$@*"; }

VIM
- ':set spell' activates vim spellchecker. Use ']s' and '[s' to move between
  mistakes, 'zg' adds to the dictionary, 'z=' suggests correctly spelled words
- check my .vimrc http://tiny.cc/qxzktw and here http://tiny.cc/kzzktw for more

TOOLS
* 'htop' instead of 'top'
- 'ranger' is a nice console file manager for vi fans
- Use 'apt-file' to see which package provides that file you're missing
- 'dict' is a commandline dictionary
- Learn to use 'find' and 'locate' to look for files
- Compile your own version of 'screen' from the git sources. Most versions
  have a slow scrolling on a vertical split or even no vertical split at all
* 'trash-cli' sends files to the trash instead of deleting them forever. 
  Be very careful with 'rm' or maybe make a wrapper to avoid deleting '*' by
  accident (e.g. you want to type 'rm tmp*' but type 'rm tmp *')
- 'file' gives information about a file, as image dimensions or text encoding
- 'sort | uniq' to check for duplicate lines
- 'echo start_backup.sh | at midnight' starts a command at the specified time
- Pipe any command over 'column -t' to nicely align the columns
* Google 'magic sysrq' and learn how to bring you machine back from the dead
- 'diff --side-by-side fileA.txt fileB.txt | pager' to see a nice diff
* 'j.py' http://tiny.cc/62qjow remembers your most used folders and is an 
  incredible substitute to browse directories by name instead of 'cd' 
- 'dropbox_uploader.sh' http://tiny.cc/o2qjow is a fantastic solution to 
  upload by commandline via Dropbox's API if you can't use the official client
- learn to use 'pushd' to save time navigating folders (j.py is better though)
- if you liked the 'psgrep' alias, check 'pgrep' as it is far more powerful
* never run 'chmod o+x * -R', capitalize the X to avoid executable files. If
  you want _only_ executable folders: 'find . -type d -exec chmod g+x {} \;'
- 'xargs' gets its input from a pipe and runs some command for each argument

NETWORKING
- Don't know where to start? SMB is usually better than NFS for most cases.
  'sshfs_mount' is not really stable, any network failure will be troublesome
- 'python -m SimpleHTTPServer 8080' shares all the files in the current 
  folder over HTTP, port 8080
- 'ssh -R 12345:localhost:22 server.com "sleep 1000; exit"' forwards 
  server.com's port 12345 to your local ssh port, even if you machine 
  is not externally visible on the net. 
  Now you can 'ssh localhost -p 12345' from server.com and you will 
  log into your machine. 
  'sleep' avoids getting kicked out from server.com for inactivity
* Read on 'ssh-keygen' to avoid typing passwords every time you ssh
- 'socat TCP4-LISTEN:1234,fork TCP4:192.168.1.1:22' forwards your port
  1234 to another machine's port 22. Very useful for quick NAT redirection.
* Configure postfix to use your personal Gmail account as SMTP:
  http://tiny.cc/n5k0cw. Now you can send emails from the command line.
  'echo "Hello, User!" | mail user@domain.com'
- Some tools to monitor network connections and bandwith:
  'lsof -i' monitors network connections in real time
  'iftop' shows bandwith usage per *connection*
  'nethogs' shows the bandwith usage per *process*
* Use this trick on .ssh/config to directly access 'host2' which is on a private 
  network, and must be accessed by ssh-ing into 'host1' first
  Host host2
      ProxyCommand ssh -T host1 'nc %h %p'
  	  HostName host2
* Pipe a compressed file over ssh to avoid creating large temporary .tgz files
  'tar cz folder/ | ssh server "tar xz"' or even better, use 'rsync'

                                     -~-

(CC) by-nc, Carles Fenollosa <carles.fenollosa@bsc.es> 
Retrieved from http://mmb.pcb.ub.es/~carlesfe/unix/tricks.txt
Last modified: vie 08 mar 2013 12:42:06  CET

zz from: http://mmb.pcb.ub.es/~carlesfe/unix/tricks.txt