[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: how to got a preview of a web page

David Vallner

11/5/2006 12:45:00 PM

Haofei wrote:
> for example i want to have a method which just like
>
> def preview_of ( url )
> #some relate operation
> end
>
> then i can have a picture (jpeg, png ...) of the web page somewhere,
> i am not familiar with the graphic libraries of ruby.
> do u guys have write something like this ?
> thanks :-)
>

def preview_of(url)
`opera -newpage #{url}`
end

*cough*

Seriously, this is a nontrivial example that requires you to more or
less write a webbrowser. The simplest (relatively speaking) way would be
to use ruby-gnome2 and Gtk::MozEmbed, and severe whacking of Gtk with a
cluebyfour to make it render to an image buffer which you'd then output
to disk.

David Vallner

8 Answers

Michael Trier

11/5/2006 2:30:00 PM

0

> Haofei wrote:
> > for example i want to have a method which just like
> >
> > def preview_of ( url )
> > #some relate operation
> > end
> >
> > then i can have a picture (jpeg, png ...) of the web page somewhere,
> > i am not familiar with the graphic libraries of ruby.
> > do u guys have write something like this ?
> > thanks :-)
> >
>
> def preview_of(url)
> `opera -newpage #{url}`
> end
>
> *cough*
>
> Seriously, this is a nontrivial example that requires you to more or
> less write a webbrowser. The simplest (relatively speaking) way would be
> to use ruby-gnome2 and Gtk::MozEmbed, and severe whacking of Gtk with a
> cluebyfour to make it render to an image buffer which you'd then output
> to disk.

David is correct. It's a problem I've spent numerous hours on. All
the existing libraries seem to be lacking. The "easiest" approach is
to use an existing web browser rendering engine.

Michael

rjmccorkle

11/5/2006 2:36:00 PM

0

I'm curious - as a newby- where to find existing code snippets that I
can use for chat amongst other things. I saw that there are
repositories but haven't had much luck. Any recommendations?

Robert

David Vallner

11/5/2006 3:49:00 PM

0

Robert McCorkle wrote:
> I'm curious - as a newby- where to find existing code snippets that I
> can use for chat amongst other things. I saw that there are
> repositories but haven't had much luck. Any recommendations?
>
> Robert
>

1. You seem to have written this as a reply to a thread with another
topic. Try to avoid this, hijacking threads is confusing, and they tend
get derailed horribly over time by themselves already.

2. Depends on what kind of chat you want. The path of least effort would
be running a Jabber or IRC server and using the respective Ruby
bindings. The path of even less effort would be just using existing
Jabber servers -and- clients, of course. Depends on your purpose, if you
want to actually run a chat for some other purpose, or want to reinvent
the wheel for some reason (doing it better, etc.)

David Vallner

rjmccorkle

11/5/2006 5:57:00 PM

0

where do I start a topic? I only saw where to subscribe and it
looked like it wanted replies going to the ruby-talk@ruby-lang.org

On Sunday November 5,2006, at November 5, 9:48AM, David Vallner wrote:

> Robert McCorkle wrote:
>> I'm curious - as a newby- where to find existing code snippets that I
>> can use for chat amongst other things. I saw that there are
>> repositories but haven't had much luck. Any recommendations?
>>
>> Robert
>>
>
> 1. You seem to have written this as a reply to a thread with another
> topic. Try to avoid this, hijacking threads is confusing, and they
> tend
> get derailed horribly over time by themselves already.
>
> 2. Depends on what kind of chat you want. The path of least effort
> would
> be running a Jabber or IRC server and using the respective Ruby
> bindings. The path of even less effort would be just using existing
> Jabber servers -and- clients, of course. Depends on your purpose,
> if you
> want to actually run a chat for some other purpose, or want to
> reinvent
> the wheel for some reason (doing it better, etc.)
>
> David Vallner
>


rjmccorkle

11/5/2006 6:01:00 PM

0

sorry hit the send button before i was done replying...

i want a chat that probly will be reinventing the wheel- though of
course I'd love to grab code similar to lingr or moreso campfire but
I don't see that type of project in works by anyone else, looks like
they gave up and said use lingr or campfire for their purposes. I'm
a part of 6 other developers that are developing an all encompassed
app to surpass what current bible resources on the web currently
offer- my portion that pulled me into the group was my bible study
online. Currently I use lace but the ajax is too slow and requires
too much server talk and it goes into overflow- whereas all the ruby
implementations i've seen are incredible and allow for scalability of
larger groups of people! (more than 7 unlike lace that starts
getting clunky). The chat is very important and i'd like to
integrate it so that its both a group chat and offers IM capabilities
in ruby. Sure it'd be great if i could offer the ability to connect
through existing chat plugins such as jabber/irc/google/etc. But
baby steps- I just need an initial chat to start off with that is
similar to campfire/lingr as that's my approach that I'm wanting to
take and add customization after that.

Any help is appreciated.

Let go, and let GOD!
Robert


On Sunday November 5,2006, at November 5, 9:48AM, David Vallner wrote:

> Robert McCorkle wrote:
>> I'm curious - as a newby- where to find existing code snippets that I
>> can use for chat amongst other things. I saw that there are
>> repositories but haven't had much luck. Any recommendations?
>>
>> Robert
>>
>
> 1. You seem to have written this as a reply to a thread with another
> topic. Try to avoid this, hijacking threads is confusing, and they
> tend
> get derailed horribly over time by themselves already.
>
> 2. Depends on what kind of chat you want. The path of least effort
> would
> be running a Jabber or IRC server and using the respective Ruby
> bindings. The path of even less effort would be just using existing
> Jabber servers -and- clients, of course. Depends on your purpose,
> if you
> want to actually run a chat for some other purpose, or want to
> reinvent
> the wheel for some reason (doing it better, etc.)
>
> David Vallner
>


David Vallner

11/5/2006 8:48:00 PM

0

Robert McCorkle wrote:
> where do I start a topic? I only saw where to subscribe and it looked
> like it wanted replies going to the ruby-talk@ruby-lang.org
>

Any mailing list post is an email to that address. If it's a reply to a
post you received, it's a reply in that thread, if it's not a reply to
anything, it's a whole new thread. Email software will group an email
and replies to it together, which makes it easier to follow threads, if
you hijack a thread, people get confused.

David Vallner

James Gray

11/9/2006 9:34:00 PM

0

On Nov 5, 2006, at 8:36 AM, Robert McCorkle wrote:

> I'm curious - as a newby- where to find existing code snippets that
> I can use for chat amongst other things. I saw that there are
> repositories but haven't had much luck. Any recommendations?

Page 533 of the Ruby Cookbook has a slim but functional chat server
in about 30 lines of Ruby code.

James Edward Gray II

Keith Fahlgren

11/9/2006 10:09:00 PM

0

On 11/9/06, James Edward Gray II <james@grayproductions.net> wrote:
> Page 533 of the Ruby Cookbook has a slim but functional chat server
> in about 30 lines of Ruby code.

The code for (most) O'Reilly books is available from the "examples"
link on the book's catalog page. For this one:
http://examples.oreilly.com...

It's a good book, go buy it! (http://www.oreilly.com/catalog...)



Keith