1 a
:55:{i
:0;a
:3:{i
:0;s
:14:"document_start";i
:1;a
:0:{}i
:2;i
:0;}i
:1;a
:3:{i
:0;s
:6:"p_open";i
:1;a
:0:{}i
:2;i
:0;}i
:2;a
:3:{i
:0;s
:7:"p_close";i
:1;a
:0:{}i
:2;i
:1;}i
:3;a
:3:{i
:0;s
:12:"section_edit";i
:1;a
:4:{i
:0;i
:-1;i
:1;i
:0;i
:2;i
:1;i
:3;s
:0:"";}i
:2;i
:1;}i
:4;a
:3:{i
:0;s
:6:"header";i
:1;a
:3:{i
:0;s
:4:"Ruby";i
:1;i
:1;i
:2;i
:1;}i
:2;i
:1;}i
:5;a
:3:{i
:0;s
:12:"section_open";i
:1;a
:1:{i
:0;i
:1;}i
:2;i
:1;}i
:6;a
:3:{i
:0;s
:6:"p_open";i
:1;a
:0:{}i
:2;i
:19;}i
:7;a
:3:{i
:0;s
:5:"cdata";i
:1;a
:1:{i
:0;s
:1:"
2 ";}i
:2;i
:20;}i
:8;a
:3:{i
:0;s
:12:"externallink";i
:1;a
:2:{i
:0;s
:24:"http://www.ruby-lang.org";i
:1;s
:4:"Ruby";}i
:2;i
:21;}i
:9;a
:3:{i
:0;s
:5:"cdata";i
:1;a
:1:{i
:0;s
:2:": ";}i
:2;i
:54;}i
:10;a
:3:{i
:0;s
:13:"interwikilink";i
:1;a
:4:{i
:0;s
:34:"wp>Ruby_%28programming_language%29";i
:1;s
:4:"Ruby";i
:2;s
:2:"wp";i
:3;s
:31:"Ruby_%28programming_language%29";}i
:2;i
:56;}i
:11;a
:3:{i
:0;s
:7:"p_close";i
:1;a
:0:{}i
:2;i
:99;}i
:12;a
:2:{i
:0;s
:6:"plugin";i
:1;a
:4:{i
:0;s
:7:"uparrow";i
:1;a
:1:{i
:0;s
:42:"lib/plugins/uparrow/images/tango-small.png";}i
:2;i
:1;i
:3;s
:6:"~~UP~~";}}i
:13;a
:3:{i
:0;s
:13:"section_close";i
:1;a
:0:{}i
:2;i
:103;}i
:14;a
:3:{i
:0;s
:12:"section_edit";i
:1;a
:4:{i
:0;i
:1;i
:1;i
:102;i
:2;i
:1;i
:3;s
:4:"Ruby";}i
:2;i
:103;}i
:15;a
:3:{i
:0;s
:6:"header";i
:1;a
:3:{i
:0;s
:44:"How to process a file with a list of numbers";i
:1;i
:2;i
:2;i
:103;}i
:2;i
:103;}i
:16;a
:3:{i
:0;s
:12:"section_open";i
:1;a
:1:{i
:0;i
:2;}i
:2;i
:103;}i
:17;a
:3:{i
:0;s
:4:"file";i
:1;a
:3:{i
:0;s
:543:"
4 lines = IO.read(ARGV[0]).split("\n
");
5 min = lines.inject{ |x, y| [x.to_i, y.to_i].min }
6 max = lines.inject{ |x, y| [x.to_i, y.to_i].max }
7 media = lines.inject{ |x, y| x.to_i + y.to_i }.to_f / lines.size;
8 desvio = Math.sqrt(lines.inject(0){ |x, y| x.to_i + (y.to_i - media) ** 2 } / (lines.size - 1))
9 coef = 2.262 * desvio / Math.sqrt(lines.size)
10 #print sprintf(" & %i & %i & %0.2f & %0.2f \\\\\n", min, max, media, desvio)
11 print sprintf(" & %0.2f & %0.2f & [%0.2f, %0.2f] \\\\\n", media, desvio, media - coef, media + coef)
12 ";i:1;s:4:"ruby";i:2;s:7:"calc.rb";}i:2;i:166;}i:18;a:3:{i:0;s:4:"file";i:1;a:3:{i:0;s:10:"
16 ";i:1;s:4:"text";i:2;s:7:"calc.in";}i:2;i:737;}i:19;a:3:{i:0;s:4:"file";i:1;a:3:{i:0;s:39:"
17 & 99.99 & 99.99 & [99.99, 99.99] \\
18 ";i:1;s:4:"text";i:2;s:8:"calc.out";}i:2;i:775;}i:20;a:2:{i:0;s:6:"plugin";i:1;a:4:{i:0;s:7:"uparrow";i:1;a:1:{i:0;s:42:"lib/plugins/uparrow/images/tango-small.png";}i:2;i:1;i:3;s:6:"~~UP~~";}}i:21;a:3:{i:0;s:13:"section_close";i:1;a:0:{}i:2;i:838;}i:22;a:3:{i:0;s:12:"section_edit";i:1;a:4:{i:0;i:103;i:1;i:837;i:2;i:2;i:3;s:44:"How to process a file with a list of numbers";}i:2;i:838;}i:23;a:3:{i:0;s:6:"header";i:1;a:3:{i:0;s:30:"How to process a list of names";i:1;i:2;i:2;i:838;}i:2;i:838;}i:24;a:3:{i:0;s:12:"section_open";i:1;a:1:{i:0;i:2;}i:2;i:838;}i:25;a:3:{i:0;s:4:"file";i:1;a:3:{i:0;s:402:"
20 lines = IO.read(ARGV[0]).gsub(/.*\*.*\n/, '').gsub(/ \(.\)/, '').split("\n");
23 line.split(' ').join.each { |word|
24 print '\begin{figure}[!h]
26 \includegraphics[scale=0.42]{'
28 system("touch " + word + ".jpg")
31 print "Diagrama de Interação: " + line
38 ";i:1;s:4:"ruby";i:2;s:9:"figure.rb";}i:2;i:887;}i:26;a:3:{i:0;s:6:"p_open";i:1;a:0:{}i:2;i:1312;}i:27;a:3:{i:0;s:5:"cdata";i:1;a:1:{i:0;s:17:"Removing accents:";}i:2;i:1314;}i:28;a:3:{i:0;s:7:"p_close";i:1;a:0:{}i:2;i:1331;}i:29;a:3:{i:0;s:4:"file";i:1;a:3:{i:0;s:622:"
40 lines = IO.read(ARGV[1]).gsub(/.*\*.*\n/, '').gsub(/ \(.\)/, '').split("\n");
41 lines2 = IO.read(ARGV[0]).gsub(/.*\*.*\n/, '').gsub(/ \(.\)/, '').split("\n");
43 lines.each_with_index { |line, index|
46 line.split(' ').join.each { |word|
47 print '\begin{figure}[htbp]
49 \includegraphics[scale=0.42]{'
51 #system("touch " + word + ".jpg")
52 #system("cp int.jpg " + word + ".jpg")
55 print "Diagrama de Interação: " + lines2[index]
61 print "\\clearpage\n\n"
65 ";i:1;s:4:"ruby";i:2;s:10:"figure2.rb";}i:2;i:1338;}i:30;a:3:{i:0;s:4:"file";i:1;a:3:{i:0;s:54:"
69 Inicializar Sistema (F)
70 ";i:1;s:4:"text";i:2;s:9:"figure.in";}i:2;i:1991;}i:31;a:3:{i:0;s:4:"file";i:1;a:3:{i:0;s:302:"
73 \includegraphics[scale=0.42]{ConsultarUsuario.jpg}
74 \caption{Diagrama de Interação: Consultar Usuário}
80 \includegraphics[scale=0.42]{InicializarSistema.jpg}
81 \caption{Diagrama de Interação: Inicializar Sistema}
83 ";i:1;s:5:"latex";i:2;s:10:"figure.out";}i:2;i:2075;}i:32;a:2:{i:0;s:6:"plugin";i:1;a:4:{i:0;s:7:"uparrow";i:1;a:1:{i:0;s:42:"lib/plugins/uparrow/images/tango-small.png";}i:2;i:1;i:3;s:6:"~~UP~~";}}i:33;a:3:{i:0;s:13:"section_close";i:1;a:0:{}i:2;i:2404;}i:34;a:3:{i:0;s:12:"section_edit";i:1;a:4:{i:0;i:838;i:1;i:2403;i:2;i:2;i:3;s:30:"How to process a list of names";}i:2;i:2404;}i:35;a:3:{i:0;s:6:"header";i:1;a:3:{i:0;s:8:"Examples";i:1;i:2;i:2;i:2404;}i:2;i:2404;}i:36;a:3:{i:0;s:12:"section_open";i:1;a:1:{i:0;i:2;}i:2;i:2404;}i:37;a:3:{i:0;s:4:"code";i:1;a:3:{i:0;s:104:"
84 sum = 0.0; 10.times{ |i| sum += IO.read("#{i+1}.out").split("\n")[5].split()[0].to_i }; print sum / 10
85 ";i:1;s:4:"ruby";i:2;N;}i:2;i:2431;}i:38;a:3:{i:0;s:4:"code";i:1;a:3:{i:0;s:78:"
86 10.times{ |i| print IO.read("#{i+1}.out").split("\n")[5].split()[0] + "\n" }
87 ";i:1;s:4:"ruby";i:2;N;}i:2;i:2555;}i:39;a:3:{i:0;s:4:"code";i:1;a:3:{i:0;s:156:"
89 Net::HTTP.new("verdi.softwarelivre.org", 80).get("http://verdi.softwarelivre.org/papers_ng/swiss/get?token=4E0C4F2EC6B29562").body.to_s
90 ";i:1;s:4:"ruby";i:2;N;}i:2;i:2653;}i:40;a:3:{i:0;s:4:"code";i:1;a:3:{i:0;s:50:"
91 "4E0C4F2EC6B29599".to_i(16).succ.to_s(16).upcase
92 ";i:1;s:4:"ruby";i:2;N;}i:2;i:2829;}i:41;a:3:{i:0;s:4:"code";i:1;a:3:{i:0;s:64:"
93 5.times { print "s:#{s = s.to_i(16).succ.to_s(16).upcase}\n" }
94 ";i:1;s:4:"ruby";i:2;N;}i:2;i:2899;}i:42;a:3:{i:0;s:4:"code";i:1;a:3:{i:0;s:487:"
97 s = "4E0C4F2EC6B29561"
99 p = Net::HTTP.new("verdi.softwarelivre.org", 80).get("http://verdi.softwarelivre.org/papers_ng/swiss/get?token=#{s = s.to_i(16).succ.to_s(16).upcase}").body.to_s
102 print s + " depleted\n" if !p.match("DepletedToken").nil?
103 print s + " doesn't exist\n" if !p.match("DoesNotExist").nil?
104 print s + " good?\n" if p.match("DepletedToken").nil? && p.match("DoesNotExist").nil?
106 ";i:1;s:4:"ruby";i:2;s:7:"fisl.rb";}i:2;i:2983;}i:43;a:3:{i:0;s:4:"code";i:1;a:3:{i:0;s:52:"
107 rand("10000000000000000".to_i(16)).to_s(16).upcase
108 ";i:1;s:4:"ruby";i:2;N;}i:2;i:3498;}i:44;a:3:{i:0;s:4:"file";i:1;a:3:{i:0;s:509:"
112 p = Net::HTTP.new("verdi.softwarelivre.org", 80).get("http://verdi.softwarelivre.org/papers_ng/swiss/get?token=#{s = rand("10000000000000000".to_i(16)).to_s(16).upcase}").body.to_s
115 print s + " depleted\n" if !p.match("DepletedToken").nil?
116 print s + " doesn't exist\n" if !p.match("DoesNotExist").nil? && s.to_i(16) % 1000 == 0
117 print s + " good?\n" if p.match("DepletedToken").nil? && p.match("DoesNotExist").nil?
119 ";i:1;s:4:"ruby";i:2;s:8:"fisl2.rb";}i:2;i:3570;}i:45;a:3:{i:0;s:4:"code";i:1;a:3:{i:0;s:116:"
120 "2a 2t 38 3b 2t 2t 38 w 2x 2u w 3d 33 39 w 30 2x 2z 2t w 36 39 2q 3d w 38 33 33 x".split.map{|c|c.to_i(36).chr}*""
121 ";i:1;s:4:"ruby";i:2;N;}i:2;i:4108;}i:46;a:3:{i:0;s:4:"file";i:1;a:3:{i:0;s:734:"
122 p = Net::HTTP.new("gog.gateit.net", 80).get("http://gog.gateit.net/books/").body.to_s
123 p.lines.each{|l| m = l.match(/a href="([^\"]*)"/); print m.captures[0].to_s + "\n\n\n" if m}.length
124 p2
= Net
::HTTP.new
("gog.gateit.net", 80).get
("http://gog.gateit.net/books/Wrox.XML.Problem.Design.Solution.Jun.2006.ISBN.0471791199.pdf").body.to_s
125 p2.lines.each
{|l| m
= l.match
(/a href
="([^\"]*)"/); print m.captures[0].to_s + "\n\n\n
" if m}.length
126 p3 = Net::HTTP.new("ebooks-it.org
", 80).get("http
://ebooks-it.org
/?do_search
=1&search=Wrox.XML.Problem.Design.Solution.Jun.2006.ISBN.0471791199.pdf&x=0&y=0").body.to_s
127 p3.lines.to_a.map{|l| m = l.match(/a href="([^\"]*)"/); print m.captures[0].to_s + "\n\n\n" if m; m.captures[0] if m}.compact[28]
128 ";i:1;s:4:"ruby
";i:2;s:8:"books.rb
";}i:2;i:4244;}i:47;a:3:{i:0;s:4:"file
";i:1;a:3:{i:0;s:993:"
130 lines
= IO.read
(ARGV
[0]).split
("\n");
134 l.split.each_cons
(4) { |n| a
= n.inject
{|a
, x| a.to_i
* x.to_i
}; res
= [res
, a
].max
; print
";#{a}\n" }
138 print
"mat: #{mat}\n";
141 l.each_cons
(4) { |n| a
= n.inject
{|a
, x| a.to_i
* x.to_i
}; res
= [res
, a
].max
; print
";#{a}\n" }
145 if
(i
>= mat.size
- 3) then break end
146 mat
[i
].each_index
{ |j|
147 if
(j
>= mat
[i
].size
- 3) then break
; end
148 a
= 1; 4.times
{|d| a
*= mat
[i
+ d
][j
+ d
].to_i
;}; res
= [res
, a
].max
; print
":#{a}\n";
149 if
(a
== 1788696) then
150 print
"here: #{i}, #{j}\n";
156 if
(i
>= mat.size
- 3) then break end
157 mat
[i
].each_index
{ |j|
158 if
(j
>= mat
[i
].size
- 3) then break
; end
159 a
= 1; 4.times
{|d| a
*= mat
[i
+ 3 - d
][j
+ d
].to_i
;}; res
= [res
, a
].max
; print
":#{a}\n";
163 ";i:1;s:4:"ruby
";i:2;s:5:"11.rb
";}i:2;i:5007;}i:48;a:3:{i:0;s:4:"file
";i:1;a:3:{i:0;s:495:"
167 dp
= Array.new
(1000000, 0)
169 1000000.times
{|i| t
= i
+ 1;
171 while
(t
>= 1000000 or dp
[t
] == 0) do
180 dp
[i
+ 1] = r
+ dp
[t
]
181 res
= [res
, dp
[i
+ 1]].max
;
182 if
(res
== dp
[i
+ 1]) then
185 if
(i
% 1000 == 0) then
186 print
"#{i + 1}: dp: #{dp[i + 1]} res: #{res}: resi = #{resi}\n"
188 #if
(i
> 13) then break end
190 print
"resi: #{resi}\n"
191 ";i:1;s:4:"ruby
";i:2;s:5:"14.rb
";}i:2;i:6026;}i:49;a:3:{i:0;s:4:"file
";i:1;a:3:{i:0;s:344:"
193 lines
= IO.read
(ARGV
[0]).split
("\n");
196 mat
[lines.size
- i
- 1] = lines
[i
].split.map
{|c| c.to_i
}
201 if
(i
== mat.size
) then break end
202 print
":b#{mat[i]}\n"
203 mat
[i
].each_index
{|j|
204 mat
[i
][j
] += [mat
[i
- 1][j
], mat
[i
- 1][j
+ 1]].max
208 ";i:1;s:4:"ruby
";i:2;s:5:"18.rb
";}i:2;i:6547;}i:50;a:3:{i:0;s:4:"file
";i:1;a:3:{i:0;s:333:"
210 lines
= IO.read
(ARGV
[0]).split
("\",\
"");
211 lines
[0].delete
!("\"")
212 lines[-1].delete!("\
"")
219 #print
"#{b}: #{b.to_i - 'A'[0].to_i + 1}\n"
220 p
+= b.to_i
- 'A'
[0].to_i
+ 1 if b.to_i
> 0
224 print
"#{res}, #{p}:#{l}\n"
226 ";i:1;s:4:"ruby
";i:2;s:5:"22.rb
";}i:2;i:6917;}i:51;a:2:{i:0;s:6:"plugin
";i:1;a:4:{i:0;s:7:"uparrow
";i:1;a:1:{i:0;s:42:"lib
/plugins
/uparrow
/images
/tango-small.png
";}i:2;i:1;i:3;s:6:"~~
UP~~
";}}i:52;a:3:{i:0;s:13:"section_close
";i:1;a:0:{}i:2;i:7270;}i:53;a:3:{i:0;s:12:"section_edit
";i:1;a:4:{i:0;i:2404;i:1;i:0;i:2;i:2;i:3;s:8:"Examples
";}i:2;i:7270;}i:54;a:3:{i:0;s:12:"document_end
";i:1;a:0:{}i:2;i:7270;}}