投稿

9月, 2011の投稿を表示しています

[Java] 母音か子音か

SRM 240 Div2 easyより 変数chrがStringで、小文字一文字だけだった時に、母音(a, i, u, e, o)か子音かを判定したい時、素直に考えて chr.equals("a") || chr.equals("i") || chr.equals("u") || chr.equals("e") || chr.equals("o") と書いていたけど、 "aiueo".indexOf(chr) >= 0 のスマートさに愕然とした。

Ruby Version Manager

https://rvm.beginrescueend.com/ http://gihyo.jp/dev/serial/01/ruby/0039 http://po-ru.com/diary/using-rvm-with-tcsh/ tcshの説明部分については、po-ru.comから引用しています。 RVMのインストール bashやzsh bash < <(curl -s https://rvm.beginrescueend.com/install/rvm) tcsh curl -Lo rvm-install.sh https://rvm.beginrescueend.com/install/rvm bash rvm-install.sh RVMの設定 bashやzsh [[ -s "/Users/mikami/.rvm/scripts/rvm" ]] && source "/Users/mikami/.rvm/scripts/rvm" tcsh まず、ラッパースクリプトrvm.tcshを作成します。 #!/usr/bin/env tcsh set rvm_command="source ${HOME}/.rvm/scripts/rvm; rvm $*" if ($1 == "use") then bash -c "$rvm_command && tcsh" else bash -c "$rvm_command" endif あとは、エイリアス設定を行っておいきます。 alias rvm rvm.tcsh rvmシェルでのプロンプト設定は set prompt_info = "" if ($?RUBY_VERSION) then set prompt_info = "[$RUBY_VERSION] $prompt_info" endif # plus any other information you want set prompt = "$prompt_info%. %# " # yours