From: JB Eriksson Date: 2005-10-11T19:48:05+09:00 Subject: Re: Bit of Fun ------=_Part_7552_13401695.1129027681828 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline cool beans. couldn't get it to work first,so I edited out the proxy bit: require 'net/http' require 'rubygems' require_gem 'fxruby' include Fox host =3D "news.google.com " loc =3D "/news?sourceid=3Dnavclient&ie=3DUTF-8&rls=3DGGLD,GGLD:2005-18,GGLD:en&tab= =3Din&ned=3Dus" 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, 5,MATRIX_BY_COLUMNS|FRAME_RAISED) x =3D 0 y =3D 0 w =3D 100 h =3D 100 Net::HTTP.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 On 10/11/05, Lyndon Samson wrote: > > 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 >" > loc =3D > > "/news?sourceid=3Dnavclient&ie=3DUTF-8&rls=3DGGLD,GGLD:2005-18,GGLD:en&ta= b=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::Proxy(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--- > > > > > -- > Into RFID? www.rfidnewsupdate.com < > http://www.rfidnewsupdate.com> Simple, > fast, news. > > ------=_Part_7552_13401695.1129027681828--