Category: Life & Work

个人知识管理方式

无论是开发项目还是运营项目,都需要整理很多数据,总结有用的信息。知识的获取,积累,整理和以后的检索重用是每个人必须的一项工作。以下是我的管理方式和用到的工具。

信息的获取来源

  • Google
  • Stackoverflow 和 Slideshares Smashingmagzine 37signals 之类常用网站
  • Google Reader中订阅的成百上千开发博客
  • Twitter中的订阅
  • 新浪微博中的订阅
  • Gmail中的邮件订阅分类

知识记录整理工具

  • Vim+Vimwiki+Calendar 日志方式记录
  • Dropbox 家里和公司进行同步
  • Gmail中tag和分类整理

订阅通知

  • Firefox + echofon的twitter客户端
  • Chrome的Gmail和GoogleReader订阅通知

Dropbox, twitter和某些网站需要用的特殊访问方式

  • Linux ssh proxy
  • Firefox QuickProxy代理切换插件

知识检索

  • 直接用文件系统对文本内容的检索

Use netcat to make your working efficient.

1. listen on a post or connect to a port

nc -l 3333
nc 192.168.0.1 3333

2. serve a file on a port for downloading or connect to a port to download a file

cat backup.iso | nc -l 3333
nc 192.168.0.1 3333 > backup.iso

3. serve a file on a port for downloading or connect to a port to download a file and show the process during downloading ( You should install pv)

cat backup.iso | pv -b | nc -l 3333
nc 192.168.0.1 3333 | pv -b > backup.iso

4. backup the files under a directory to somewhere

tar -czf – /etc/ | nc -l 3333
nc 192.168.0.1 3333 | pv -b > mybackup.tar.gz

5. transfer files in different shell and directory

cat backup.iso | nc -l 3333
nc 192.168.0.1 3333 > backup.iso

6. look up a word in directory

nc dict.org 2628
DEFINE wn server
QUIT

Drupal upload progress

Drupal filefield provide a upload progress bar when you uploding files. You should install APC upload progress module or PECL uploadprogress module.

PHP 5.2+ should be updated if you use APC as the upload progress system. The detailed instruction you can find at IBM’s guide.

PECL uplaod progress module can be find at http://pecl.php.net/package/uploadprogress/

Or install just a command line: pecl install uploadprogress.  Then Add extension=uploadprogress.so to php.ini, restart your Apache Server. This module is suggested.

All these modules must install with Apache Server.

Nginx upload progress Module

Nginx also provide the upload progress system. If this module are enabled, all upload files will be cached in Nginx before the whole file is uploaded.

Nginx buffers the entire upload before passing it to the php backend. So if you chose Nginx as the HTTP server or Proxy at the front of Apache Server, the Drupal upload progress will not work!

But the Nginx upload system is so brilliant that it will reduce the stress to the PHP backend, so your Server will be more stable and fast.

How to use Nginx upload progress module with Drupal uploading progress bar:

1. APC progress or PECL progress module are NOT required, because we use Nginx upload progress moudle.

2. You should install filefield_nginx_progress module in Drupal

3. You should compile Nginx with HttpUploadProgressModule

./configure –add-module=/www/nginx_uploadprogress_module

4. Configure in php.ini with upload file size limit and post size limit.

post_max_size = 2000M

upload_max_filesize = 2000M

5. Sample Nginx configuration file:

Apache as the back end server at port 81, Nginx as the proxy at port 80. Your domain name is www1.dev

http {
    client_max_body_size 2000M;
    client_body_buffer_size 128k;

    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    upload_progress uploads 1m;

    #gzip  on;

    server {
        listen       80;
        server_name  www1.dev;

	location ~ (.*)/x-progress-id:(\w*) {
            rewrite ^(.*)/x-progress-id:(\w*)  $1?X-Progress-ID=$2;
        }

        location ^~ /progress {
            report_uploads uploads;
        }

	location / {
	   proxy_set_header    X-Real-IP  $remote_addr;
	   proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
	   proxy_set_header    Host $http_host;

	   proxy_pass          http://127.0.0.1:81;
	   proxy_redirect      default;
	   add_header        X-Test Proxied;  # for diagnosis only - can be removed

	   track_uploads uploads 60s;
	}

	# serve static files directly
	location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {
	   root /www/docs/www1.dev/drupal-6.x-dev;
	   access_log        off;
           expires           30d;
           add_header        X-Test Direct;  # for diagnosis only - can be removed
	}
    }
}

Drupal nginx progress module: http://drupal.org/project/filefield_nginx_progress

Nginx upload progress module: https://github.com/masterzen/nginx-upload-progress-module

Instruction about Drupal nginx uploading progress module:

http://drupalcode.org/viewvc/drupal/contributions/modules/filefield_nginx_progress/README.txt?view=co&pathrev=DRUPAL-6–1