2008-09-30から1日間の記事一覧

ActiveSupport、Hash#to_xml

>> require "rubygems" => true >> require "active_support" => true >> Hash.from_xml([{:foo => 1, :bar => 2}, {:baz => 3}].to_xml).to_xml => "\n<hash>\n <records type=\"array\">\n <record>\n <foo type=\"integer\">1</foo>\n <bar type=\"integer\">2</bar>\n </record></records></hash>

JDK5.0 新機能:java.util.concurrentパッケージ2、Callableインタフェース

「12.2. Callableインタフェース」まんま import java.util.Date; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import jav…

Parsec.Char:oneOf

Prelude> :m Text.ParserCombinators.Parsec Prelude Text.ParserCombinators.Parsec> :t oneOf oneOf :: forall st. [Char] -> CharParser st Char module Main where import Text.ParserCombinators.Parsec vowel = oneOf "aeiou" run :: Show a => Parser…

C API、lua_checkstack()

/* * $ gcc -Wall -W -o 2008093000 -llua50 2008093000.c */ #include <stdio.h> #include <lua50/lua.h> int main(void) { lua_State *L; L = lua_open(); printf("%d\n", lua_checkstack(L, 10)); printf("%d\n", lua_checkstack(L, 10)); printf("%d\n", lua_checkstack(L, 100</lua50/lua.h></stdio.h>…