2008-05-01から1ヶ月間の記事一覧
require 'pdf/quickref' qr = PDF::QuickRef.new qr.title "My QuickRef" p qr.render p qr.to_s で、 "%PDF-1.3\n ... "%PDF-1.3\n ...
Java FAQ:S013 Q-05 public class C2008052100 { static void こんにちは() { System.out.println("こんにちは"); } public static void main(String[] args) { int 変数 = 1; System.out.println(変数); こんにちは(); } } で、 1 こんにちは
#!/usr/bin/env ruby require 'tdp' include TDParser parser = TDParser.define {|g| g.input = (rule(:abc) | rule(:def)) >> proc {|x| x } def abc token("a") - token("b") - token("c") >> proc {|x| x } end def def token("d") - token("e") - token…
require 'pdf/quickref' qr = PDF::QuickRef.new qr.title "My QuickRef" qr.hline qr.hline(style = PDF::Writer::StrokeStyle.new(10)) qr.hline(style = PDF::Writer::StrokeStyle.new(10), color = Color::RGB::Blue) qr.save_as("2008052000.pdf")
Java FAQ:S013 Q-04メソッドと変数は C とかの連想で大丈夫だと思ったけど、クラス名との関連が気になった。 public class C2008052000 { public static void main(String[] args) { int C2008052000 = 1; System.out.println(C2008052000); } } で、 1 そ…
#!/usr/bin/env ruby require 'tdp' include TDParser parser = TDParser.define {|g| g.a = "a" g.b = "b" g.c = "c" g.d = "d" g.e = "e" g.f = "f" g.input = (rule(:abc) | rule(:def)) >> proc {|x| x } g.abc = g.a - g.b - g.c >> proc {|x| x } g.de…
require 'pdf/quickref' qr = PDF::QuickRef.new qr.title "My QuickRef" qr.h1 "H1 Text" qr.body "body Text" qr.pre "pre Text" qr.body "body Text 2" qr.pre "pre Text 2" qr.save_as("2008051900.pdf") 複数書けるものなんだっけ?
Java FAQ:S012 Q-22三つの解決法が書いてあった その1:ラッパクラスを作成 class C2008051900_IntegerWrapper { int value; } public class C2008051900 { static void swap(C2008051900_IntegerWrapper n, C2008051900_IntegerWrapper m) { int tmp = n.…
label, stack, negative lookahead というものは良く分からないのでとばす。 #!/usr/bin/env ruby require 'tdp' include TDParser parser = TDParser.define {|g| g.input = token("a") - token("b") - token("c") >> proc {|x| [x[0], x[1], x[2]] } def p…
require 'pdf/quickref' qr = PDF::QuickRef.new qr.h1 "H1 Text" qr.h2 "H2 Text" qr.h2 "H2 Text" qr.h3 "H3 Text" qr.h3 "H3 Text" qr.h4 "H4 Text" qr.h4 "H4 Text" qr.h1 "H1 Text" qr.save_as("2008051800.pdf")
Java FAQ:S012 Q-20 public class C2008051800 { static void foo(int x) { x = 10; } public static void main(String[] args) { int x = 1; foo(x); System.out.println(x); } } で、 1class C2008051811 { int x; } public class C2008051810 { static v…
#!/usr/bin/env ruby require 'tdp' parser = TDParser.define {|g| g.a = "a" g.input = (g.a * (2..4)) >> proc {|x| x } def parse(str) tokens = str.split(/\s+/) input.parse(tokens) end } p parser.parse("a") p parser.parse("a a") p parser.parse…
require 'pdf/quickref' qr = PDF::QuickRef.new qr.pairs "foo" qr.codepairs "bar" qr.lines "baz" qr.codelines "hoge" qr.save_as("2008051700.pdf")
Java FAQ:S012 Q-16 class C2008051701 { void foo() { int x = 1; class C2008051702 { C2008051702() { System.out.println(x); } } new C2008051702(); } } public class C2008051700 { public static void main(String[] args) { new C2008051701().foo…
#!/usr/bin/env ruby require 'tdp' parser = TDParser.define {|g| g.a = "a" g.input = (g.a * 3) >> proc {|x| x } def parse(str) tokens = str.split(/\s+/) input.parse(tokens) end } p parser.parse("a a") p parser.parse("a a a") p parser.parse(…
require 'pdf/quickref' qr = PDF::QuickRef.new qr.pairs "foo" qr.codepairs "bar" qr.save_as("2008051600.pdf") 何?
Java FAQ とちょっと離れて public class C2008051600 { class C2008051601 { C2008051601() { System.out.println("C2008051601"); } } public static void main(String[] args) { new C2008051601(); } } で、 C2008051600.java:10: static でない 変数 th…
#!/usr/bin/env ruby require 'tdp' parser = TDParser.define {|g| g.a = "a" g.b = "b" g.c = "c" g.d = "d" g.e = "e" g.f = "f" g.input = g.abc | g.def >> proc {|x| x } g.abc = g.a - g.b - g.c >> proc {|x| [x[0], x[1], x[2]] } g.def = g.d - g.…
require 'pdf/quickref' qr = PDF::QuickRef.new qr.title "My QuickRef" p qr.heading_font p qr.heading_font_encoding p qr.h1_font_size p qr.h2_font_size p qr.h3_font_size p qr.h4_font_size p qr.body_font p qr.code_font p qr.body_font_encoding…
Java FAQ:S012 Q-14 class C2008051501 { int x = 2; } class C2008051502 extends C2008051501 { int x = 3; } public class C2008051500 { public static void main(String[] args) { System.out.println(new C2008051501().x); System.out.println(new C…
#!/usr/bin/env ruby require 'tdp' class MyParser include TDParser def input token("a") - token("b") - token("c") >> proc {|x| [x[0], x[1], x[2]] } end def parse(str) tokens = str.split(/\s+/) input.parse(tokens) end end parser = MyParser.n…
require 'pdf/quickref' qr = PDF::QuickRef.new qr.title "My QuickRef" p qr.title_font_size #qr.title_font_size = 20 qr.title_font_size = 40 qr.save_as("2008051400.pdf") で、 14変わってる?
Java FAQ:S012 Q-13 public class C2008051400 { int x = 1; void foo() { System.out.println(x); { System.out.println(x); int x = 2; System.out.println(x); } System.out.println(x); int x = 3; System.out.println(x); } public static void main(S…
#!/usr/bin/env ruby require 'tdp' parser = TDParser.define {|g| g.a = "a" g.b = "b" g.c = "c" g.input = g.a - g.b - g.c >> proc {|x| [x[0], x[1], x[2]] } def parse(str) tokens = str.split(/\s+/) input.parse(tokens) end } p parser.parse("a …
require 'pdf/quickref' qr = PDF::QuickRef.new qr.title "My QuickRef" p qr.title_font_encoding で、 nil
Java FAQ:S012 Q-11 public class C2008051300 { int x; void foo(int y) { this.x = x; } public static void main(String[] args) { new C2008051300().foo(2); } } で、エラーも何も出ない javap -c を実行 Compiled from C2008051300.java public class…
#!/usr/bin/env ruby require 'tdp' parser = TDParser.define {|g| g.a = "a" g.b = "b" g.c = "c" g.input = g.a - g.b - g.c def parse(str) tokens = str.split(/\s+/) input.parse(tokens) end } p parser.parse("a b c") p parser.parse("a b c") p pa…
require 'pdf/quickref' qr = PDF::QuickRef.new qr.title "My QuickRef" p qr.title_font qr.title_font = "Times-Bold" qr.save_as("2008051200.pdf") で、 "Times-Roman"
Java FAQ:S012 Q-10ローカル変数は 1メソッド内で 65535個が上限らしい。 メソッド引数は 1メソッド内で 255個が上限らしい。 public class C2008051200 { static void foo (int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9, int …
関数定義可能。変数スコープあり。コードを理解できていないので、意味(動作)から推測(IntpFrame クラスはなし) %{ use Data::Dumper; package Node; sub new { my $class = shift; bless {}, $class; } sub exec_list { my $self = shift; my ($nodes) = @_…