這樣量距離只有不到 30K?
[note] javascript 的 foreach / split / php explode style 寫法
var loc="25.258861, 121.509389"; var arr=loc.split(","); var content = ''; for (var key in arr) { content += key + ' : ' + arr[key] + "\n"; }
另一個
var myarr = new Array('red','green','blue'); var content=''; for(var key in myarr){ content += key+' : '+myarr[key]+"\n"; } alert( content );
nginx [engine x] is a HTTP server and mail proxy server
nginx has been running for more than four years on many heavily loaded sites
FreeNAS , Openfiler 免費的 file server
今天知道 Jack大大入手了 Synology USB Station 三合一SOHO伺服器
http://shopping.pchome.com.tw/?mod=item&func=exhibit&IT_NO=DGAK0J-A16377028&SR_NO=DGAK0J&ROWNO=5
我記得有幾個免費的 file server 可以抓來用, 今天玩的心得: FreeNAS VS. Openfiler
我測試的結果 –> FreeNAS 勝!
FreeNAS 各類 server 都有了 , 甚至 BT / iTunes server … 舊電腦可以裝這個來用了 , 他說記憶體有 128MB 就夠了.
FreeNAS
http://www.freenas.org/
ID : admin
PW : freenas
Openfiler
http://www.openfiler.com/
ID : openfiler
PW : password
unix shell programming / sh / csh syntax
Shell script syntax Bourne shell (sh) syntax samples test: [ number -lt|-le|-eq|-ne|-ge|-gt number ] [ string = != string ] if [ test ] then commands elif [ test ] commands else commands fi for var in item1 item2 item3 do commands done while test do commands done case expression in case1) commands ;; case2|case3) commands ;; *) default-commands ;; esac # How to read an input file into shell variables: while read variable1 variable2 do ... done < $input_file # How to redirect stdout/stderr echo something 1>&2 echo something 2>&1 # How to throw out stdout and stderr some_command > /dev/null 2>&1 # Shell functions: func () { echo $1 $2 $3 } func a b c C shell (csh) syntax samples test: ( expression ==|!=|>>|<< expression ) if ( test ) command if ( test ) then commands else if ( test ) then commands else commands end if foreach var ( list list list ) commands end while condition commands end # How to throw out stdout and stderr some_command >& /dev/null
另一個
#!/bin/sh count=0 while [ $count -lt 5 ] do count=`expr $count + 1` echo $count done
sysctl / Linux tunning /etc/sysctl.conf
net.ipv4.ip_local_port_range = 1024 65536 net.core.rmem_max=16777216 net.core.wmem_max=16777216 net.ipv4.tcp_rmem=4096 87380 16777216 net.ipv4.tcp_wmem=4096 65536 16777216 net.ipv4.tcp_fin_timeout = 3 net.ipv4.tcp_tw_recycle = 1 net.core.netdev_max_backlog = 30000 net.ipv4.tcp_no_metrics_save=1 net.core.somaxconn = 262144 net.ipv4.tcp_syncookies = 0 net.ipv4.tcp_max_orphans = 262144 net.ipv4.tcp_max_syn_backlog = 262144 net.ipv4.tcp_synack_retries = 2 net.ipv4.tcp_syn_retries = 2
取代 squid 的 HTTP 加速器 varnish
據說用 3台 varnish 可以抵 12台 squid 來用 , 有時間要來玩一下.
http://varnish.projects.linpro.no/
Varnish is a state-of-the-art, high-performance HTTP accelerator. It uses the advanced features in Linux 2.6, FreeBSD 6/7 and Solaris 10 to achieve its high performance.
Some of the features include
- A modern design
- VCL – a very flexible configuration language
- Load balancing with health checking of backends
- Partial support for ESI
- URL rewriting
- Graceful handling of "dead" backends
- more features…
Varnish is free software and is licenced under a modified BSD licence. Please read the introduction to get started with Varnish.