Prev | Current Page 184 | Next

David Berube

"Practical Reporting with Ruby and Rails"


The code detects that and prints out ???First 100 eBay Results??? when seller is nil.
The average price is formatted using the % operator and a format string of '$%0.2f'.
This will cause the value of 5 to be formatted as $5.00, for example.
Finally, you need to add the footer to your LaTeX document, write it, and then run
pdflatex on your LaTeX source file:
latex_source << '
\end{tabular}
\end{document}'
fh = File.open(temporary_latex_file, 'w')
fh.puts latex_source
fh.close
puts "Searched #{keywords.length} keywords and #{sellers.length} sellers for a total
of #{sellers.length*keywords.length} eBay searches."
CHAPTER 6 n TRACKING AUCTIONS WITH EBAY 130
puts `"#{path_to_pdflatex}" #{temporary_latex_file} --quiet` # Runs PDFLatex with
# the --quiet switch, which eliminates much of the chatter it usually displays.
# It will still display errors, however.
puts "Wrote report to average_price_report.pdf"
As you can see, you simply end your tabular and document elements, write the report
to a file, and pass it to pdflatex.


Pages:
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
serwis laptopów proces leczenia noclegi swinoujscie poker zasady gry teksty piosenek