Skip to content

Instantly share code, notes, and snippets.

@relax-more
relax-more / gist:5545831
Created May 9, 2013 06:01
[nginx]  locationディレクティブの優先順位に関して
locationの適用順は…
修飾子=、完全一致
修飾子なし、完全一致
修飾子^~、前方一致
修飾子~ or ~* 正規表現マッチ
修飾子なし、前方一致
URIのパラメータ(?以降)はlocation適用順に影響しない。
参照:http://paulownia.hatenablog.com/entry/20111117/1321531964
@relax-more
relax-more / gist:5597413
Created May 17, 2013 07:03
[Shell] process の利用している port を調べる
$ sudo lsof -i:8443
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
java 4249 globus 5u IPv4 650367 TCP *:8443 (LISTEN)
java 18389 globus 5u IPv4 650367 TCP *:8443 (LISTEN)
http://d.hatena.ne.jp/stakizawa/20080324/t1
@relax-more
relax-more / gist:5610207
Created May 20, 2013 03:04
Numa ? Uma ?
複数のCPUがメモリーを共有するUMA(Uniform Memory Architecture)
それぞれのCPUにメモリーが直結している構造をNUMA(Non-Uniform Memory Architecture)
参考
http://hpcdiyc.hpc.co.jp/topics01.html
@relax-more
relax-more / gist:5641470
Created May 24, 2013 05:37
[NoSQL] NoSQL DB のパフォーマンス検証に関する情報
■ そもそも何をチェックするのか?
分散データベースをベンチマークするチェックリスト - sunsuk7tpのメモメモ
http://d.hatena.ne.jp/sunsuk7tp/20111101/1320159385
■ ツール
[YCSB - Yahoo! Cloud Serving Benchmark]
http://research.yahoo.com/Web_Information_Management/YCSB/
@relax-more
relax-more / gist:5656055
Last active December 17, 2015 18:49
[eclipse] 初期設定でのはまりどころ集
■ eclipse, tomcat 6系, console に出力される文字コードがおかしい場合
eclipse.ini にあれを追加する
-Dfile.encoding=utf-8
参考:http://krakenbeal.blogspot.jp/2011/07/eclipseutf-8.html
■ The APR based Apache Tomcat Native library。。。云々で怒られる
server.xml から下記の行をコメントアウトする
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
@relax-more
relax-more / controller.java
Created May 27, 2013 10:37
[java][spring] springMVC で、redirectする方法
@RequestMapping("test/loggin")
public ModelAndView getLogginUrl(@PathVariable("language") String language, HttpServletRequest request, HttpServletResponse response) {
setLocale(language, request, response);
ModelAndView mav = new ModelAndView();
String logginPageUrl = getLogginPageURL();
// ポイントはここ。 redirect: を prefix に設定すればよい
 mav.setViewName("redirect:" + logginPageUrl);
@relax-more
relax-more / gist:5677326
Created May 30, 2013 11:52
[HTTP] session, cookie に関してよくわかってなかったのでまとめ
明確な違いは
session は、Dataをserver 上に保持している
cookie は、Dataをclient 上に保持している
という点。
session はserver のメモリ上に保持されているがcookie はlocal に保存される。
cookie のファイルはブラウザ別に保存される。
http://oshiete.goo.ne.jp/qa/2375010.html
以下余談
@relax-more
relax-more / checkcommand.sh
Created May 31, 2013 08:50
[nginx] ファイルとurl を紐つける -> 設定のテスト-> 再起動
# test of configuration
nginx -t
# reload config file
nginx -s reload
@relax-more
relax-more / ExtendHandlerInterceptor.java
Created June 4, 2013 03:08
[java] [spring] spring でAOPではなく共通的に処理を挟む
public class ExtendHandlerInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// any code
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
@relax-more
relax-more / spling-before.xml
Created June 4, 2013 08:32
[java][spring] @ExceptionHandler が利用できなくてハマったので調査した
AnnotationMethodHandlerExceptionResolverの追加が必要。
今回の自分のケースでは、SimpleMappingExceptionResolverを既に利用していたので、 ExceptionResolver の優先順位付けをして、
AnnotationMethodHandlerExceptionResolver を優先度高く設定する必要があった。
詳しくは下記
http://forum.springsource.org/showthread.php?102713-Spring-Web-MVC-ExceptionHandler-ignore-when-exceptionResolver-in-place&p=347448#post347448