2008-08-27から1日間の記事一覧

ActiveSupport、String#ord

>> "a".ord NoMethodError: undefined method `ord' for "a":String from (irb):1 >> require "rubygems" => true >> require "active_support" => true >> "a".ord => 97 >> "abc".ord => 97

JDK5.0 新機能:EnumSet.allOf

「4.6. EnumSet」 import java.util.*; enum C2008082700_Color { RED, BLUE, YELLOW, BLACK, WHITE } public class C2008082700 { public static void main(String[] args) { EnumSet<C2008082700_Color> s = EnumSet.allOf(C2008082700_Color.class); System.out.println(s); </c2008082700_color>…

ディレクティブ autoscore

#!/usr/bin/env perl use strict; use Parse::RecDescent; my $grammar = q{ inputs : <autoscore: 1> | 'a' { print "*a1 $score $score_return*\n"; } | 'a' { print "*a2 $score $score_return*\n"; } | 'a' { print "*a3 $score $score_return*\n"; } }; my $parse = n</autoscore:>…

os.remove

元 remove ?まんま #!/usr/bin/env lua a, error = os.remove("foo") if not a then print("1: ", error) end a, error = os.remove("foo") if not a then print("2: ", error) end で、 2: foo: No such file or directory