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

ActiveSupport、String#to_time

>> require "rubygems" => true >> require "active_support" => true >> "2008-01-01".to_time => Tue Jan 01 00:00:00 UTC 2008 >> "2008-01-01".to_time(:local) => Tue Jan 01 00:00:00 +0900 2008 >> "2008-01-01".to_time.class => Time

JDK5.0 新機能:EnumSet.copyOf

「4.6. EnumSet」 import java.util.*; enum C2008082800_Color { RED, BLUE, YELLOW, BLACK, WHITE } public class C2008082800 { public static void main(String[] args) { EnumSet<C2008082800_Color> s1 = EnumSet.allOf(C2008082800_Color.class); EnumSet<C2008082800_Color> s2 = EnumSet.c</c2008082800_color></c2008082800_color>…

ディレクティブ score、もう一つの例

まんま #!/usr/bin/env perl use strict; use Parse::RecDescent; my $grammar = q{ inputs : line line : seplist[sep=>','] <score: -@{$item[1]}> { print "*,*\n"; } | seplist[sep=>':'] <score: -@{$item[1]}> { print "*:*\n"; } | seplist[sep=>" "] <score: -@{$item[1]}> { print "* *\n"; } seplist: <skip:""> </skip:""></score:></score:></score:>

os.rename

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