L
Lyndon Samson
------=_Part_34850_12204166.1128999252813
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Bit of fun learning FXRuby. This will download and display the thumbnail
images from news.google.com <http://news.google.com/> in a grid
Interesting google are not producing XHTML, their img src's are not quote
delimitered.
---cut/here---
require 'net/http'
require 'rubygems'
require_gem 'fxruby'
include Fox
host =3D "news.google.com <http://news.google.com/>"
loc =3D
"/news?sourceid=3Dnavclient&ie=3DUTF-8&rls=3DGGLD,GGLD:2005-18,GGLD:en&tab=
=3Din&ned=3Dus"
phost =3D "your-proxy"
pport =3D 8080
puser =3D "your-uid"
ppwd =3D "your-pwd"
app =3D FXApp.new
win =3D FXMainWindow.new(app, "news.google.com <http://news.google.com/> -
Image Collection",nil, nil, DECOR_ALL, 100, 100, 800, 600)
matrix =3D FXMatrix.new(win, 7,MATRIX_BY_COLUMNS|FRAME_RAISED)
x =3D 0
y =3D 0
w =3D 100
h =3D 100
Net::HTTP:roxy(phost, pport, puser, ppwd).start(host) {|http|
jpgs =3D http.get(loc).body.to_s.scan(/src=3Dhttp:\/\/.*?(\/.*?jpg) /)
jpgs.each {|pic|
puts "Loading #{pic[0]}"
jpgdata =3D http.get(pic[0]).body
img =3D FXJPGImage.new(app, jpgdata, IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP)
x +=3D 150
imageview =3D FXImageView.new(matrix, img, nil, 0,
LAYOUT_FILL_ROW|LAYOUT_EXPLICIT, x, y ,w ,h)
}
}
app.create
win.show
app.run
---cut/here---
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Bit of fun learning FXRuby. This will download and display the thumbnail
images from news.google.com <http://news.google.com/> in a grid
Interesting google are not producing XHTML, their img src's are not quote
delimitered.
---cut/here---
require 'net/http'
require 'rubygems'
require_gem 'fxruby'
include Fox
host =3D "news.google.com <http://news.google.com/>"
loc =3D
"/news?sourceid=3Dnavclient&ie=3DUTF-8&rls=3DGGLD,GGLD:2005-18,GGLD:en&tab=
=3Din&ned=3Dus"
phost =3D "your-proxy"
pport =3D 8080
puser =3D "your-uid"
ppwd =3D "your-pwd"
app =3D FXApp.new
win =3D FXMainWindow.new(app, "news.google.com <http://news.google.com/> -
Image Collection",nil, nil, DECOR_ALL, 100, 100, 800, 600)
matrix =3D FXMatrix.new(win, 7,MATRIX_BY_COLUMNS|FRAME_RAISED)
x =3D 0
y =3D 0
w =3D 100
h =3D 100
Net::HTTP:roxy(phost, pport, puser, ppwd).start(host) {|http|
jpgs =3D http.get(loc).body.to_s.scan(/src=3Dhttp:\/\/.*?(\/.*?jpg) /)
jpgs.each {|pic|
puts "Loading #{pic[0]}"
jpgdata =3D http.get(pic[0]).body
img =3D FXJPGImage.new(app, jpgdata, IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP)
x +=3D 150
imageview =3D FXImageView.new(matrix, img, nil, 0,
LAYOUT_FILL_ROW|LAYOUT_EXPLICIT, x, y ,w ,h)
}
}
app.create
win.show
app.run
---cut/here---