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

ActiveSupport、Time#last_month

>> require "rubygems" => true >> require "active_support" => true >> Time.local(2008, 1, 1).last_month => Sat Dec 01 00:00:00 +0900 2007

Commons Lang、StringUtils.isNotBlank()

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

Parsec.Combinator:option

まんま module Main where import Char import Text.ParserCombinators.Parsec priority :: Parser Int priority = option 0 (do{ d <- digit ; return (digitToInt d) }) run :: Show a => Parser a -> String -> IO () run p input = case (parse p "" inp…

C API、lua_newtable(), lua_gettable(), lua_settable()

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