2008-12-01から1ヶ月間の記事一覧

ActiveSupport、Date#to_time

>> require "rubygems" => true >> require "active_support" => true >> Date.new(2008,12,31).to_time => Wed Dec 31 00:00:00 +0900 2008 >> Date.new(2008,12,31).to_time.class => Time >> Date.new(2008,12,31).to_time(:utc) => Wed Dec 31 00:00:00 …

Commons Lang、NumberRange

import org.apache.commons.lang.math.NumberRange; public class C2008123100 { public static void main(String[] args) { System.out.println(new NumberRange(3)); System.out.println(new NumberRange(1, 3)); } } で、 Range[3,3] Range[1,3]

LanguageDef:identLetter

Prelude> :m Text.ParserCombinators.Parsec.Language Prelude Text.ParserCombinators.Parsec.Language> :t identLetter haskellStyle identLetter haskellStyle :: forall st. Text.ParserCombinators.Parsec.Char.CharParser st Char

io.flush()

#!/usr/bin/env lua io.output("foo") io.write("bar") io.flush() io.close()

ActiveSupport、Date#to_formatted_s, #to_s

>> require "rubygems" => true >> require "active_support" => true >> Date.new(2008,12,31).to_formatted_s => "2008-12-31" >> Date.new(2008,12,31).to_formatted_s(:db) => "2008-12-31" >> Date.new(2008,12,31).to_formatted_s(:short) => "31 Dec"…

Commons Lang、NumberUtils.stringToInt()

import org.apache.commons.lang.math.NumberUtils; public class C2008123000 { public static void main(String[] args) { System.out.println(NumberUtils.stringToInt("123")); System.out.println(NumberUtils.stringToInt("1.23")); System.out.printl…

LanguageDef:identStart

Prelude> :m Text.ParserCombinators.Parsec.Language Prelude Text.ParserCombinators.Parsec.Language> :t identStart haskellStyle identStart haskellStyle :: forall st. Text.ParserCombinators.Parsec.Char.CharParser st Char

io.close()

#!/usr/bin/env lua f = io.open("2008123000.lua") print(io.close(f)) -- print(io.close(f)) io.open("2008123000.lua") --print(io.input()) print(io.close()) io.input("2008123000.lua") --print(io.input()) print(io.close()) で、 true nil Succes…

ActiveSupport、Date#to_datetime

>> require "rubygems" => true >> require "active_support" => true >> Date.new(2008,12,31).to_datetime => Wed, 31 Dec 2008 00:00:00 +0000 >> Date.new(2008,12,31).to_datetime.class => DateTime

Commons Lang、NumberUtils.min()

import org.apache.commons.lang.math.NumberUtils; public class C2008122900 { public static void main(String[] args) { int[] aryi = {3, 1, 2}; double[] aryd = {1.3, 1.1, 1.2}; System.out.println(NumberUtils.min(1, 2, 3)); System.out.println(…

LanguageDef:nestedComments

Prelude> :m Text.ParserCombinators.Parsec.Language Prelude Text.ParserCombinators.Parsec.Language> nestedComments haskellStyle Loading package parsec ... linking ... done. True Prelude Text.ParserCombinators.Parsec.Language> nestedComments…

定義済みファイルディスクリプタ

#!/usr/bin/env lua print(io.stdin) print(io.stdout) print(io.stderr) で、 file (0x804ed18) file (0x804f080) file (0x804f0d8)

ActiveSupport、Date#to_date

>> require "rubygems" => true >> require "active_support" => true >> Date.new(2008,12,31).to_date => Wed, 31 Dec 2008 >> Date.new(2008,12,31).to_date.class => Date

Commons Lang、NumberUtils.max()

import org.apache.commons.lang.math.NumberUtils; public class C2008122800 { public static void main(String[] args) { int[] aryi = {3, 1, 2}; double[] aryd = {1.3, 1.1, 1.2}; System.out.println(NumberUtils.max(1, 2, 3)); System.out.println(…

LanguageDef:commentLine

Prelude> :m Text.ParserCombinators.Parsec.Language Prelude Text.ParserCombinators.Parsec.Language> commentLine haskellStyle Loading package parsec ... linking ... done. "--" Prelude Text.ParserCombinators.Parsec.Language> commentLine javaS…

数学関数

以前やっていないもの #!/usr/bin/env lua print(math.exp(1)) print(math.pow(2, 3)) print(__pow(2, 3)) print(math.rad(180)) print(math.frexp(1.0)) print(math.frexp(2.0)) print(math.ldexp(1.0, 0)) print(math.ldexp(1.0, 2)) print(math.random())…

ActiveSupport、Date::DATE_FORMATS

>> require "rubygems" => true >> require "active_support" => true >> Date::DATE_FORMATS => {:rfc822=>"%e %b %Y", :number=>"%Y%m%d", :short=>"%e %b", :long=>"%B %e, %Y", :db=>"%Y-%m-%d", :long_ordinal=>#

Commons Lang、NumberUtils.isNumber()

import org.apache.commons.lang.math.NumberUtils; public class C2008122700 { public static void main(String[] args) { System.out.println(NumberUtils.isNumber("123")); System.out.println(NumberUtils.isNumber("1.23")); System.out.println(Numb…

LanguageDef:commentEnd

Prelude> :m Text.ParserCombinators.Parsec.Language Prelude Text.ParserCombinators.Parsec.Language> :t commentEnd haskellStyle commentEnd haskellStyle :: String Prelude Text.ParserCombinators.Parsec.Language> commentEnd haskellStyle Loading…

table.setn()

#!/usr/bin/env lua function print_table(t) table.foreachi(t, function (i, v) print(v) end ) end t = {"foo", "bar", "baz"} table.setn(t, 4) print_table(t) print() table.setn(t, 2) print_table(t) で、 foo bar baz nil foo bar

ActiveSupport、Date.yesterday

>> require "rubygems" => true >> require "active_support" => true >> Date.current => Wed, 04 Feb 2009 >> Date.yesterday => Tue, 03 Feb 2009

Commons Lang、NumberUtils.isDigits()

import org.apache.commons.lang.math.NumberUtils; public class C2008122600 { public static void main(String[] args) { System.out.println(NumberUtils.isDigits("123")); System.out.println(NumberUtils.isDigits("1.23")); System.out.println(Numb…

LanguageDef:commentStart

Prelude> :m Text.ParserCombinators.Parsec.Language Prelude Text.ParserCombinators.Parsec.Language> :t haskellDef haskellDef :: forall st. LanguageDef st Prelude Text.ParserCombinators.Parsec.Language> :t commentStart haskellDef commentStar…

table.remove()

#!/usr/bin/env lua function print_table(t) table.foreachi(t, function (i, v) print(v) end ) end t = {"foo", "bar", "baz"} table.remove(t) print_table(t) print() table.remove(t, 1) print_table(t) で、 foo bar bar

ActiveSupport、Date.tomorrow

>> require "rubygems" => true >> require "active_support" => true >> Date.current => Wed, 04 Feb 2009 >> Date.tomorrow => Thu, 05 Feb 2009

Commons Lang、NumberUtils.createNumber()

import org.apache.commons.lang.math.NumberUtils; public class C2008122500 { public static void main(String[] args) { System.out.println(NumberUtils.createNumber("1")); System.out.println(NumberUtils.createNumber("1").getClass().getName());…

Parsec.Token:commaSep1

module Main where import Text.ParserCombinators.Parsec import Text.ParserCombinators.Parsec.Token import Text.ParserCombinators.Parsec.Language lexer :: TokenParser () lexer = makeTokenParser(javaStyle) run :: Show a => Parser a -> String …

table.insert()

#!/usr/bin/env lua function print_table(t) table.foreachi(t, function (i, v) print(v) end ) end t = {"foo", "bar", "baz"} table.insert(t, "hoge") print_table(t) print() table.insert(t, 1, "HOGE") print_table(t) で、 foo bar baz hoge HOGE f…

ActiveSupport、Date.current

>> require "rubygems" => true >> require "active_support" => true >> Date.current => Wed, 04 Feb 2009

Commons Lang、NumberUtils.createLong()

import org.apache.commons.lang.math.NumberUtils; public class C2008122400 { public static void main(String[] args) { System.out.println(NumberUtils.createLong("1")); System.out.println(NumberUtils.createLong("1").getClass().getName()); } }…