Prev | Current Page 355 | Next

David Berube

"Practical Reporting with Ruby and Rails"

) You set
three options. The first is OFN_HIDEREADONLY, which hides the ???read-only??? check box.
This check box exists by default and allows the users to indicate that they wish to
open the file for reading only, but since this application has no function except to
write to databases, there??™s no point in displaying that option. The other two options,
OFN_PATHMUSTEXIST and OFN_FILEMUSTEXIST, guarantee that the user must select an
existing path and file; otherwise, they could type in the name of a nonexistent file.
Once you have a database file to import into, you can start downloading the data:
begin
domain = 'localhost'
port = '3000'
xml = open("http://#{domain}:#{port}/log/all").read
grades = XmlSimple.xml_in(xml)['grade']
This code opens the address, reads the data, and then parses the XML using
XmlSimple.xml_in. The reason you can use open to download a web page is that you
require??™d the open-uri at the top of the script. This allows the call to open to download
data from remote URIs, which it normally cannot do.


Pages:
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367
doktorat lampy ogrodowe określić zakłady bukmacherskie Wczasy nad morzem