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

PDF::Writer:#image で :justification オプションを指定

require 'pdf/writer' pdf = PDF::Writer.new pdf.image('images/chunkybacon.jpg', { :justification => :left }) pdf.image('images/chunkybacon.jpg', { :justification => :right }) pdf.image('images/chunkybacon.jpg', { :justification => :center }…

関数 set-category-table

(set-category-table (standard-category-table)) => #^[t #&128"...nil "While filling, we can break a line at this character." nil nil] nil]

『とほほのJava入門』「リスナー マウスモーションリスナー」

『とほほのJava入門』を読んでいるところ20. リスナー の「マウスモーションリスナー」 ページのソースをそのまま試す。

カスタマイズ可能メソッド report_fatal_error()

「error EOL」があると発生しないようなので、はずしてCUP ファイルは、 import java_cup.runtime.*; parser code {: public void report_error(String message, Object info) { System.out.println("report_error: " + message); System.out.println("repor…

PDF::Writer:#image で :resize オプションを指定

その1 require 'pdf/writer' pdf = PDF::Writer.new pdf.image('images/chunkybacon.jpg', { :resize => :width }) File.open("2008021900.pdf", "wb") { |f| f.write pdf.render } その2 require 'pdf/writer' pdf = PDF::Writer.new pdf.image('images/chu…

関数 copy-category-table

(copy-category-table) => #^[t #&128"...nil "While filling, we can break a line at this character." nil nil] nil]

『とほほのJava入門』「リスナー マウスリスナー」

『とほほのJava入門』を読んでいるところ20. リスナー の「マウスリスナー」 ページのソースをそのまま試す。

カスタマイズ可能メソッド report_error()

CUP ファイルは、 import java_cup.runtime.*; parser code {: public void report_error(String message, Object info) { System.out.println("report_error: " + message); System.out.println("report_error: " + info); } :}; terminal A, EOL; non term…

PDF::Writer:#image で :width オプションを指定

require 'pdf/writer' pdf = PDF::Writer.new pdf.image('images/chunkybacon.jpg', { :width => 100 }) File.open("2008021800.pdf", "wb") { |f| f.write pdf.render }

関数 standard-category-table

(standard-category-table) => #^[t #&128"... nil "While filling, we can break a line at this character." nil nil] nil]

『とほほのJava入門』「リスナー ウィンドウリスナー」

『とほほのJava入門』を読んでいるところ20. リスナー の「ウィンドウリスナー」 ページのソースをそのまま試す。AWT の場合には、windowClosed を捕まえて、 終了するようにすれば良いのか?

オプション -dump

Summary 以外も詳しく出力される Opening files... Parsing specification from standard input... Checking specification... Building parse tables... Computing non-terminal nullability... Computing first sets... Building state machine... Filling…

PDF::Writer:#image で :pad オプションを指定

require 'pdf/writer' pdf = PDF::Writer.new pdf.image('images/chunkybacon.jpg', { :pad => 100 }) File.open("2008021700.pdf", "wb") { |f| f.write pdf.render }

関数 category-table-p

(category-table-p t) => nil (category-table-p (category-table)) => t

『とほほのJava入門』「リスナー アクションリスナー」

『とほほのJava入門』を読んでいるところ20. リスナー の「アクションリスナー」 ページのソースをそのまま試す。

オプション -parser, -symbols

「-parser」で parser.java に出力されていたのを、 「-symbols」で sym.java に出力されていたのを変更できるようだ。

PDF::Writer:#image

require 'pdf/writer' pdf = PDF::Writer.new pdf.image('images/chunkybacon.jpg') File.open("2008021600.pdf", "wb") { |f| f.write pdf.render }

関数 get-unused-category

(get-unused-category (category-table)) => 33

『とほほのJava入門』「レイアウト パネルによるレイアウト」

『とほほのJava入門』を読んでいるところ19. レイアウト の「パネルによるレイアウト」ちょっと改造AWT で、 import java.awt.*; public class C2008021600 extends Frame { C2008021600() { super("PanelTest"); Panel p1 = new Panel(); Panel p2 = new Pa…

start 宣言

import java_cup.runtime.*; terminal A, EOL; non terminal Object input, line; start with input; line ::= EOL | A EOL {: System.out.println("*a*"); :} ; input ::= | input line ; 宣言の最後でなく、宣言の最初の方に書いたらエラーになった

PDF::Writer:#add_image_from_file で URI を指定

require 'pdf/writer' require 'open-uri' pdf = PDF::Writer.new pdf.add_image_from_file('http://www.ruby-lang.org/images/logo.gif', 100, 100) File.open("2008021500.pdf", "wb") { |f| f.write pdf.render } open-uri を require しなくてもエラーに…

関数 category-table

(category-table) => #^[t #&128 ... nil "While filling, we can break a line at this character." nil nil] nil]

『とほほのJava入門』「レイアウト ボックスレイアウト」

『とほほのJava入門』を読んでいるところ19. レイアウト の「ボックスレイアウト」Swing で追加されたものらしい import java.awt.*; import javax.swing.*; class C2008021500 extends JFrame { C2008021500() { JLabel label1 = new JLabel("Label1"); JLa…

init, scan 宣言

import java_cup.runtime.*; init with {: // Init 1 // Init 2 // Init 3 :}; scan with {: // Scan 1 // Scan 2 // Scan 3 :}; terminal A, EOL; non terminal Object input, line; input ::= | input line ; line ::= EOL | A EOL {: System.out.println(…

PDF::Writer:#add_image_from_file

require 'pdf/writer' pdf = PDF::Writer.new pdf.add_image_from_file('images/chunkybacon.jpg', 100, 100) File.open("2008021400.pdf", "wb") { |f| f.write pdf.render }

関数 category-docstring

(category-docstring ?a) => "ASCII" (category-docstring ?l) => "Latin"

『とほほのJava入門』「レイアウト カードレイアウト」

『とほほのJava入門』を読んでいるところ19. レイアウト の「カードレイアウト」AWT で、 import java.awt.*; import java.awt.event.*; public class C2008021400 extends Frame implements ActionListener { CardLayout cl = new CardLayout(); C200802140…

{action,parser} code 宣言

import java_cup.runtime.*; action code {: // Action Code 1 // Action Code 2 // Action Code 3 :}; parser code {: // Parser Code 1 // Parser Code 2 // Parser Code 3 :}; terminal A, EOL; non terminal Object input, line; input ::= | input line…

PDF::Writer:#add_image で link を指定

require 'pdf/writer' pdf = PDF::Writer.new f = open('images/chunkybacon.jpg') image = f.read pdf.add_image(image, 100, 100, 132, 114, nil, {:type => :external, :target => "http://rubyforge.org/projects/ruby-pdf/"}) File.open("2008021300.pd…

関数 define-category

(define-category ?a "foo") error--> Category `a' is already defined