JavaScript でクリックのイベント処理とか GET 以外ならトークンを含めるとか全部やらないといけないから面倒くさい
<a href="/some_action" class="some-action">some action</a>
| ##### nginxでリバースプロキシして後段でエラーが発生した場合にnginx側でエラーページの制御をしたい時の設定 ##### | |
| proxy_intercept_errors on; # errorをproxy側で肩代わりする設定 | |
| error_page 403 404 500 502 503 504 /error.html; # /var/www/html/error.htmlを置いておく | |
| location /error.html { | |
| root /var/www/html/; | |
| } | |
| #### headerの値を参照する #### | |
| $http_フィールド名 |
| use strict; | |
| use AnyEvent::Redis; | |
| my $r = AnyEvent::Redis->new(host => '127.0.0.1'); | |
| my $cv = AE::cv; | |
| $r->del('foo', $cv); | |
| $cv->recv; | |
| for my $bit (1, 3, 4, 7, 8, 13, 16, 22, 24, 31, 32, 33) { | |
| warn "SETBIT $bit 1\n"; |
| =pod | |
| Nyan Cat TAP Formatter | |
| 1. Save this file into your PERL5LIB | |
| 2. Run prove with option like following: | |
| $ prove --formatter NyanCat | |
| http://www.mattsears.com/articles/2011/11/16/nyan-cat-rspec-formatter |
原文:Scaling Isomorphic Javascript Code (This is just for study, please contact me at tily05 atmark gmail.com if any problem.)
考えてみれば Model-View-Controller とか MVC ってよく聞くよね。実際どんなものか知ってる? 抽象的に言うなら「オブジェクト情報の保持されるグラフィック・システム (つまり、ラスターではないグラフィック。ゲームとか) 上に構築された、表示系を中心としたアプリケーションにおいて、主要な機能どうしの関わりをうまく分離すること」とでも言おうか。もう少し深く考えを押し進めてみれば、これは当然、他のさまざまなアプリケーションにもあてはまる言葉 (bucket term ?) だ。
過去に多くの開発コミュニティが MVC による解決案を提供し、それによってよくあるユースケースにうまく対処し、地位を築くことができた。例をあげるなら、Ruby や Python コミュニティは Rails や Django を作り、MVC アーキテクチャを実現した。
りすこがこんなの書いてて、聞いてみたら名詞だけ抜き出してcountとかやりたいとか。 そういう時はawk使うと便利ですよ(perlでもいいですが)
$ cat filename | awk '$4 ~ /^名詞/{print $1}' | sort | uniq -c | sort -n
4個目のカラムが「品詞」で始まる性質を使ってます。
| - app.psgi | |
| sub { | |
| return ['200', ['content-type' => 'text/html', 'content-length' => 11], ['hello world']]; | |
| } | |
| ab -n 10000 -c 10 -k http://127.0.0.1:8080/ | |
| [Plack::Handler::Nginx] | |
| - keepalive_requests 0; | |
| Requests per second: 4777.98 [#/sec] (mean) |
| package Isucon; | |
| use 5.14.1; | |
| use Nginx::Simple; | |
| use Text::Xslate::Util qw/html_escape/; | |
| use POSIX qw/strftime/; | |
| use List::Util qw/first/; | |
| use JSON::XS; | |
| use IO::Handle; | |
| use Encode; |
| use 5.14.1; | |
| use Plack::Request; | |
| use Plack::Builder; | |
| use FindBin; | |
| use Text::Xslate::Util qw/html_escape/; | |
| use POSIX qw/strftime/; | |
| use List::Util qw/first/; | |
| use JSON::XS; | |
| use IO::Handle; | |
| use Encode; |
| #Apache httpd Remote Denial of Service (memory exhaustion) | |
| #By Kingcope | |
| #Year 2011 | |
| # | |
| # Will result in swapping memory to filesystem on the remote side | |
| # plus killing of processes when running out of swap space. | |
| # Remote System becomes unstable. | |
| # | |
| use IO::Socket; |