2009-05-10から1日間の記事一覧

libharu:HPDFFont#get_descent

「return NUM2INT(i);」は「return INT2NUM(i);」に修正 #!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page font = pdf.get_font("Helvetica", nil) p font.get_descent pdf.use_jp_fonts pdf.use_jp_encodings font = pdf.get_fon…

Commons Lang、Validate.isTrue()

import org.apache.commons.lang.Validate; public class C2009051000 { public static void main(String[] args) { Validate.isTrue(true, "foo", 100); Validate.isTrue(false, "foo", 100); } } で、 Exception in thread "main" java.lang.IllegalArgume…

『Rubyを256倍使うための本 無道編』の 09.errmsg/intp.y を移植

#!/usr/bin/env python from math import * import fileinput import ply.lex as lex tokens = ( 'NUMBER', 'STRING', 'IDENT', 'EOL', ) literals = "(),=" def t_NUMBER(t): r'\d+' try: t.value = int(t.value) except ValueError: print "Integer value …