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

ActiveSupport、Time#last_year

>> require "rubygems" => true >> require "active_support" => true >> Time.local(2008, 12, 31).last_year => Mon Dec 31 00:00:00 +0900 2007

Commons Lang、StringUtils.isNotEmpty()

まんま import org.apache.commons.lang.StringUtils; public class C2008103000 { public static void main(String[] args) { System.out.println(StringUtils.isNotEmpty(null)); System.out.println(StringUtils.isNotEmpty("")); System.out.println(Str…

Parsec.Combinator:choice

module Main where import Text.ParserCombinators.Parsec run :: Show a => Parser a -> String -> IO () run p input = case (parse p "" input) of Left err -> do{ putStr "parse error at " ; print err } Right x -> print x で、 *Main> :l 20081004_…

C API、lua_rawget(), lua_rawset()

/* * $ gcc -Wall -W -I/usr/include/lua50 -o 2008103000 -llua50 2008103000.c */ #include <stdio.h> #include <lua.h> int main(void) { lua_State *L; L = lua_open(); lua_newtable(L); lua_pushstring(L, "foo"); lua_rawget(L, 1); printf("%d\n", lua_isnil(L, -1))</lua.h></stdio.h>…