[QUIZ] Object Browser (#8)

Jamis Buck wrote:

http://ruby.jamisbuck.org/objbrowser-03.png
  This is the same, drilling down to inspect the constants defined in
the class of one of the instance variables.

I think something like this (maybe used in conjunction with the
breakpoint and assert concepts that have been discussed on this list)
would be useful in debugging, especially if the ability to modify values
were added. I'm still hoping someone submits a nicer solution to the
quiz than mine, since mine is pretty rough, and is really only half done. :slight_smile:

I agree heavily. This looks very interesting. Would you be interested in patching this so it can work with Breakpoints? I can not do it myself unfortunately as GTK is completely screwed on this machine and I think I can only fix that by reinstalling Windows...

The required changes would basically be using drb_gateway.evaluate(nil, "methods") instead of directly doing examined_obj.methods and so on.

* Brian Schröder <ruby@brian-schroeder.de> [2004-11-24 04:38:41 +0900]:

> I particularly liked the clean colorization of the ruby code. What did you use
> (and what color style) to convert the Ruby code to HTML?

I use xemacs' htmlize package to convert the ruby-code to html. Then I include a stylesheet. (You can copy that from my page if you want)

htmlize: $(patsubst %.rb,browse/%-rb.html,$(wildcard *.rb))

browse/%-rb.html: %.rb
  mkdir -p browse/unsuccessfull
  xemacs -nw -eval '(htmlize-file "$<" "$@")' -kill && \
  mv $@ $@.temp && \
  cat $@.temp | ruby -e 'puts $$stdin.read.gsub(/<style type="text\/css">.*<\/style>/m, "<link id=\"css\" href=\"../ruby.css\" rel=\"stylesheet\">")' > $@ && \
  rm $@.temp

Thanks. Uhh, sorry to be so dense, but (not being an emacs person) it
appears that htmlize-file.el is not part of the xemacs distro and I'm not
sure what version to get. Also, it would be great if you could provide a
command line example without the make cipher added. The obvious:

  xemacs -nw -eval '(htmlize-file "myfile.rb")' -kill

doesn't seem to work.

···

--
Jim Freeze
Code Red. Code Ruby

I'm concerned about the state of GUI toolkits for Ruby when in comes to
installation requirements, particularly under Mac OS X.

Amen.

I recently went through the steps to get Tk working with Ruby under Mac OS X.
It was fairly complicated. After all that work I found that GUIs I had created under Windows didn't look very good on Mac OS X.

I agree. TK doesn't do it for me.

I then decided to try FOX. That required downloading the X11 software from Apple. I installed that and then found that I didn't automatically get the X11 library files that are needed in order to build FOX. Maybe I'll get this figured out eventually.

Many Mac users won't even consider installing X and I can't say I blame them. Who needs two Window managers running? And X is so un-Mac. To me, if it's not native, it's not a realistic solution.

Do others think this is an issue?

I would LOVE to have a Swing-like library (more robust, with document classes) in the Ruby Std Lib. I realize that's asking the world, but I can't imagine we wouldn't see huge returns on the effort invested.

James Edward Gray II

···

On Nov 24, 2004, at 9:26 PM, R. Mark Volkmann wrote:

R. Mark Volkmann wrote:

I'm concerned about the state of GUI toolkits for Ruby when in comes to
installation requirements, particularly under Mac OS X. I'm think about the
case where we want to create a Ruby-based GUI application for non-developers to
use.

I recently went through the steps to get Tk working with Ruby under Mac OS X. It was fairly complicated. After all that work I found that GUIs I had created
under Windows didn't look very good on Mac OS X. I then decided to try FOX. That required downloading the X11 software from Apple. I installed that and
then found that I didn't automatically get the X11 library files that are
needed in order to build FOX. Maybe I'll get this figured out eventually.

The bottom line is that even if you take the time to write a great GUI app.
using Ruby, your audience of potential users will likely be quite small. Installing Ruby is easy enough, but setting up a GUI toolkit is prohibitively
complex for a non-developer. Compare this to Java. Install the Java Runtime
Environment or use Java Web Start and Swing is available.

One answer is to create web apps instead. That's not appropriate for every
application though.

Do others think this is an issue?

--
R. Mark Volkmann
Partner, Object Computing, Inc.

Complete sense. What we need is an interface to make use of many toolkits
Ex. Swing. I've been using WideStudio, but the main complaint is from MacOS
users(it needs X11, and its not "pretty" like Cocoa). The main problem with
these toolkits like wxWidgets(aka wxWindows, changed because M.S. forced
them to change the name) are 1) lack of features, and 2) glitches between
operating systems.

What you say is not really an issue at all. On unicies you are required to
downloaded needed runtime libraries. This also includes MacOSX. Simply
download and install the needed libraries. If they are too difficult get a
computer specialist to install them for you. Libraries are the main issue, if
they are not in the system, it can be problematic to the non-tech savy user.

David Ross

···

--
Hazzle free packages for Ruby?
RPA is available from http://www.rubyarchive.org/

R. Mark Volkmann wrote:

One answer is to create web apps instead. That's not appropriate for every
application though.

Do others think this is an issue?

One word: wxRuby.

Nice looking apps that move gracefully between platforms. I've worked with wxPython and it's very nice.

···

--
Glenn Parker | glenn.parker-AT-comcast.net | <http://www.tetrafoil.com/&gt;

I'd say with all your contributions your ego should be floating quite high :wink:

Well, it seems that this line truly is a leftover from my experiments. I'm shure you will find lots of junk in the solution. The new solution should contain less junk, so please put a disclaimer about "experimental alpha junk" into the summary if you are talking about my first version.

Regards,

Brian

···

On Thu, 25 Nov 2004 09:49:47 +0900 James Edward Gray II <james@grayproductions.net> wrote:

Since we're talking...

I want to avoid embarrassing myself in the summary again by claiming to
know your code better than you, so I'll embarrass myself in this thread
with all of Ruby Talk looking on. See the question in the comment
below:

def object_browser(classtree = ClassTreeNode.new(Kernel))
   ObjectSpace.each_object do | x |
     classnode = classtree # <- This line truly isn't needed, right???
     x.class.ancestors.reverse[1..-1].inject(classtree){ | classnode,
klass | classnode.add_class(klass) }.add_object(x)
   end
   classtree
end

Tell me I'm right this time, even if you need to lie to me. It's good
for my ego.

--
Brian Schröder
http://www.brian-schroeder.de/

qtruby installs easily on mac os x and has no dependancy on
the x11 cruft. qt looks good on linux windows and mac os x.
only issue is licensing on windows. this is no problem with
mac or linux but trolltech have screwed up slightly wrt to
licensing and gpl'ed windows applications. if someone could
pressure^Wencourage them to sort out this then i'd be
interested in making a port for windows.

Alex

···

On Nov 25, 2004, at 4:26 AM, R. Mark Volkmann wrote:

I'm concerned about the state of GUI toolkits for Ruby when in comes to
installation requirements, particularly under Mac OS X. I'm think about the
case where we want to create a Ruby-based GUI application for non-developers to use.

I recently went through the steps to get Tk working with Ruby under Mac OS X. It was fairly complicated. After all that work I found that GUIs I had created
under Windows didn't look very good on Mac OS X. I then decided to try FOX. That required downloading the X11 software from Apple. I installed that and
then found that I didn't automatically get the X11 library files that are
needed in order to build FOX. Maybe I'll get this figured out eventually.

Did you try RubyCocoa (http://www.fobj.com/rubycocoa/w.en/\) ? If OS X is your desired platform, then really this is the toolkit you should be using.

The bottom line is that even if you take the time to write a great GUI app.
using Ruby, your audience of potential users will likely be quite small. Installing Ruby is easy enough, but setting up a GUI toolkit is prohibitively
complex for a non-developer. Compare this to Java. Install the Java Runtime
Environment or use Java Web Start and Swing is available.

This is assuming you want to install the ruby development environment on the users machine so they can use your software. There are better ways to do it. If you link the interpreter to your own "startup" binary, you can wrap it in a bundle on Mac OS X, or have the start menu call it from Windows. I've bundled apps on OS X and put the required libraries in the Resources directory, and they start just like Mac OS X apps (and install just as easily too). For Mac OS X, I'd say RubyCocoa is the best GUI toolkit (It's available in Framework form for easy installation). For Windows, you need to choose the toolkit that best matches your needs. For Linux, the Ruby GTK bindings I think make the most sense. For multi-platform apps, I think wxRuby works great on GTK, Windows, and OS X.

In the end, it's not up to the user to have the libraries necessary to run your app. You need to use the libraries that make the most sense for your audience, and you need to install them in the best location. This requires getting a little dirty with the installers, the ruby interpreter, and the system at hand. But if the user can't install your app, then they probably won't run it.

Nick

R. Mark Volkmann wrote:

···

I'm concerned about the state of GUI toolkits for Ruby when in comes to
installation requirements, particularly under Mac OS X. I'm think about the
case where we want to create a Ruby-based GUI application for non-developers to
use.

I recently went through the steps to get Tk working with Ruby under Mac OS X. It was fairly complicated. After all that work I found that GUIs I had created
under Windows didn't look very good on Mac OS X. I then decided to try FOX. That required downloading the X11 software from Apple. I installed that and
then found that I didn't automatically get the X11 library files that are
needed in order to build FOX. Maybe I'll get this figured out eventually.

The bottom line is that even if you take the time to write a great GUI app.
using Ruby, your audience of potential users will likely be quite small. Installing Ruby is easy enough, but setting up a GUI toolkit is prohibitively
complex for a non-developer. Compare this to Java. Install the Java Runtime
Environment or use Java Web Start and Swing is available.

One answer is to create web apps instead. That's not appropriate for every
application though.

Do others think this is an issue?

--
R. Mark Volkmann
Partner, Object Computing, Inc.

Hello Masao,

Hi,

See
http://ruby-gnome2.sourceforge.jp/hiki.cgi?Install+Guide+for+Windows
You can install them just four steps, though it's not one click ;).

And fails on step 2 with

Z:\work\arachno\make>ruby -e "require 'gtk2'"
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/glib2.so: 126: The specified module could not be found.
- c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/glib2.so (LoadError)
        from c:/ruby/lib/ruby/site_ruby/1.8/glib2.rb:64
        from c:/ruby/lib/ruby/site_ruby/1.8/gtk2.rb:1:in `require'
        from c:/ruby/lib/ruby/site_ruby/1.8/gtk2.rb:1
        from -e:1:in `require'
        from -e:1

The file exists all all DLL's also, so there is some other thing wrong here.
My System is WinXP SP2.

···

On Mon, 22 Nov 2004 11:38:36 +0900 > Jamis Buck <jgb3@email.byu.edu> wrote:

--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ruby-ide.com
CTO Scriptolutions Ruby, PHP, Python IDE 's

The RPA stuff is on the way (will take a while though).

···

On Mon, Nov 22, 2004 at 10:55:35PM +0900, Masao Mutoh wrote:

See http://ruby-gnome2.sourceforge.jp/hiki.cgi?Install+Guide+for+Windows
You can install them just four steps, though it's not one click ;).

> - Jamis
>
> P.S.: A plea to the ruby-gnome2 folks: a gemmable version would be a
> real boon. A similar plea to the RPA folks... :wink:

Good idea. Are there anyone to work for them ?

--
Hassle-free packages for Ruby?
RPA is available from http://www.rubyarchive.org/

Florian Gross wrote:

Jamis Buck wrote:

http://ruby.jamisbuck.org/objbrowser-03.png
  This is the same, drilling down to inspect the constants defined in
the class of one of the instance variables.

I think something like this (maybe used in conjunction with the
breakpoint and assert concepts that have been discussed on this list)
would be useful in debugging, especially if the ability to modify values
were added. I'm still hoping someone submits a nicer solution to the
quiz than mine, since mine is pretty rough, and is really only half done. :slight_smile:

I agree heavily. This looks very interesting. Would you be interested in patching this so it can work with Breakpoints? I can not do it myself unfortunately as GTK is completely screwed on this machine and I think I can only fix that by reinstalling Windows...

The required changes would basically be using drb_gateway.evaluate(nil, "methods") instead of directly doing examined_obj.methods and so on.

I'd be happy to make that change, Florian, but I think it might be better to combine my approach with Brian's. His is much prettier, for one thing, but it also has the ability to navigate to specific instances of a class, which is nice.

Unfortunately, I'm racing to get Net::SSH ready to release (I wanted to do a release before Thanksgiving, but I'm not sure that'll happen). Then I need to work on Net::SFTP... If no one has tackled this by the time I'm done with SFTP, I'll take another look at it.

- Jamis

···

--
Jamis Buck
jgb3@email.byu.edu
http://www.jamisbuck.org/jamis

Hello Jim,

I installed htmlize as part of the debian package

emacs-goodies-el - Miscellaneous add-ons for Emacs

In your example you forgot the output file. It should be

xemacs -nw -eval '(htmlize-file "myfile.rb" "myfile-rb.html")' -kill

Or you can try it interactively

open a ruby file in xemacs
C-x C-f myfile.rb

htmlize the buffer
M-x htmlize-buffer

save the file
C-x C-s myfile-rb.html

Make shure that you have turned font-lock on, such that the file is fontified in xemacs.

HTH,

Brian

···

On Wed, 24 Nov 2004 07:47:03 +0900 jim@freeze.org wrote:

* Brian Schröder <ruby@brian-schroeder.de> [2004-11-24 04:38:41 +0900]:

> > I particularly liked the clean colorization of the ruby code. What did you use
> > (and what color style) to convert the Ruby code to HTML?
>
> I use xemacs' htmlize package to convert the ruby-code to html. Then I include a stylesheet. (You can copy that from my page if you want)
>
> htmlize: $(patsubst %.rb,browse/%-rb.html,$(wildcard *.rb))
>
> browse/%-rb.html: %.rb
> mkdir -p browse/unsuccessfull
> xemacs -nw -eval '(htmlize-file "$<" "$@")' -kill && \
> mv $@ $@.temp && \
> cat $@.temp | ruby -e 'puts $$stdin.read.gsub(/<style type="text\/css">.*<\/style>/m, "<link id=\"css\" href=\"../ruby.css\" rel=\"stylesheet\">")' > $@ && \
> rm $@.temp

Thanks. Uhh, sorry to be so dense, but (not being an emacs person) it
appears that htmlize-file.el is not part of the xemacs distro and I'm not
sure what version to get. Also, it would be great if you could provide a
command line example without the make cipher added. The obvious:

  xemacs -nw -eval '(htmlize-file "myfile.rb")' -kill

doesn't seem to work.

--
Brian Schröder
http://www.brian-schroeder.de/

Hello Glenn,

R. Mark Volkmann wrote:

One answer is to create web apps instead. That's not appropriate for every
application though.

Do others think this is an issue?

One word: wxRuby.

Nice looking apps that move gracefully between platforms. I've worked
with wxPython and it's very nice.

Yes but you still hit the borders of wxWidgets very soon on a little
bit more complex applications. Julian Smart realized that and they now
try to offer most of the widgets in a generic form: this means don't
use the native widgets anymore they only use the native Theming engine.

I also believe that this is the right way to get something running on
all three systems.

The main problem with GUI Toolkits is at the moment that none was
developed with MacOSX in mind they all tried a port later, to late to
get the different Mac things right. Any GUI that offers Drawers, proxy
items in the title, Sheets .... ?

···

--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ruby-ide.com
CTO Scriptolutions Ruby, PHP, Python IDE 's

After reading this again, I want to stress that I'm very happy if someone criticizes my code or points me to weaknesses. I'm doing this to learn, not to boost.

(It is always difficult to find the right tone in emails :wink:

Regards,

Brian

···

On Thu, 25 Nov 2004 18:02:43 +0900 Brian Schröder <ruby@brian-schroeder.de> wrote:

On Thu, 25 Nov 2004 09:49:47 +0900 > James Edward Gray II <james@grayproductions.net> wrote:

> Since we're talking...
>
> I want to avoid embarrassing myself in the summary again by claiming to
> know your code better than you, so I'll embarrass myself in this thread
> with all of Ruby Talk looking on. See the question in the comment
> below:
>
> def object_browser(classtree = ClassTreeNode.new(Kernel))
> ObjectSpace.each_object do | x |
> classnode = classtree # <- This line truly isn't needed, right???
> x.class.ancestors.reverse[1..-1].inject(classtree){ | classnode,
> klass | classnode.add_class(klass) }.add_object(x)
> end
> classtree
> end
>
> Tell me I'm right this time, even if you need to lie to me. It's good
> for my ego.
>

I'd say with all your contributions your ego should be floating quite high :wink:

Well, it seems that this line truly is a leftover from my experiments. I'm shure you will find lots of junk in the solution. The new solution should contain less junk, so please put a disclaimer about "experimental alpha junk" into the summary if you are talking about my first version.

--
Brian Schröder
http://ruby.brian-schroeder.de/

I recently went through the steps to get Tk working with Ruby under Mac OS X. It was fairly complicated. After all that work I found that GUIs I had created
under Windows didn't look very good on Mac OS X. I then decided to try FOX. That required downloading the X11 software from Apple. I installed that and
then found that I didn't automatically get the X11 library files that are
needed in order to build FOX. Maybe I'll get this figured out eventually.

Did you try RubyCocoa (http://www.fobj.com/rubycocoa/w.en/\) ? If OS X is your desired platform, then really this is the toolkit you should be using.

OS X is just one of my desired platforms. I want to write the code using a single GUI toolkit and be able to run it under at least Windows, OS X and Linux. I'm undecided about whether using native widgets is important, but I'm leaning that way.

The bottom line is that even if you take the time to write a great GUI app.
using Ruby, your audience of potential users will likely be quite small. Installing Ruby is easy enough, but setting up a GUI toolkit is prohibitively
complex for a non-developer. Compare this to Java. Install the Java Runtime
Environment or use Java Web Start and Swing is available.

This is assuming you want to install the ruby development environment on the users machine so they can use your software. There are better ways to do it. If you link the interpreter to your own "startup" binary, you can wrap it in a bundle on Mac OS X, or have the start menu call it from Windows. I've bundled apps on OS X and put the required libraries in the Resources directory, and they start just like Mac OS X apps (and install just as easily too). For Mac OS X, I'd say RubyCocoa is the best GUI toolkit (It's available in Framework form for easy installation). For Windows, you need to choose the toolkit that best matches your needs. For Linux, the Ruby GTK bindings I think make the most sense. For multi-platform apps, I think wxRuby works great on GTK, Windows, and OS X.

In the end, it's not up to the user to have the libraries necessary to run your app. You need to use the libraries that make the most sense for your audience, and you need to install them in the best location. This requires getting a little dirty with the installers, the ruby interpreter, and the system at hand. But if the user can't install your app, then they probably won't run it.

I agree. It seems though that "getting a little dirty with the installers" could be done once for all of us rather that repeated for every Ruby GUI application that requires portability to Windows, OS X and Linux and desires to be used by non-developers. Having a one-click installer for each platform that installs everything needed for a portable GUI seems ideal.

···

----- Original Message ----- From: "Nick" <devel@nicreations.com>
To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
Sent: Sunday, November 28, 2004 11:31 PM
Subject: Re: Ruby GUIs and installation effort

Hello Nick,

Did you try RubyCocoa (http://www.fobj.com/rubycocoa/w.en/\) ? If OS X is
your desired platform, then really this is the toolkit you should be using.

Is this still maintained ?
The last not in the changelog file is about 16 month old.

···

--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ruby-ide.com
CTO Scriptolutions Ruby, PHP, Python IDE 's

Hi Lothar,

···

On Tue, 23 Nov 2004 00:07:38 +0900 Lothar Scholz <mailinglists@scriptolutions.com> wrote:

Hello Masao,

> Hi,

> On Mon, 22 Nov 2004 11:38:36 +0900 > > Jamis Buck <jgb3@email.byu.edu> wrote:

> See
> http://ruby-gnome2.sourceforge.jp/hiki.cgi?Install+Guide+for+Windows
> You can install them just four steps, though it's not one click ;).

And fails on step 2 with

Z:\work\arachno\make>ruby -e "require 'gtk2'"
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/glib2.so: 126: The specified module could not be found.
- c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/glib2.so (LoadError)
        from c:/ruby/lib/ruby/site_ruby/1.8/glib2.rb:64
        from c:/ruby/lib/ruby/site_ruby/1.8/gtk2.rb:1:in `require'
        from c:/ruby/lib/ruby/site_ruby/1.8/gtk2.rb:1
        from -e:1:in `require'
        from -e:1

The file exists all all DLL's also, so there is some other thing wrong here.
My System is WinXP SP2.

On step 2? Did you do step 3 and 4?

And are there c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/glib2.so ?

--
.:% Masao Mutoh<mutoh@highway.ne.jp>

Mauricio Fernández wrote:

···

On Mon, Nov 22, 2004 at 10:55:35PM +0900, Masao Mutoh wrote:

See http://ruby-gnome2.sourceforge.jp/hiki.cgi?Install+Guide+for+Windows
You can install them just four steps, though it's not one click ;).

- Jamis

P.S.: A plea to the ruby-gnome2 folks: a gemmable version would be a real boon. A similar plea to the RPA folks... :wink:

Good idea. Are there anyone to work for them ?

The RPA stuff is on the way (will take a while though).

Awesome, batsman. Thanks! I figured it wouldn't be easy--I tried to gemify it at one point, but got a little overwhelmed by the magnitude of the task.

- Jamis

--
Jamis Buck
jgb3@email.byu.edu
http://www.jamisbuck.org/jamis

Hi,

···

On Tue, 23 Nov 2004 00:51:28 +0900 Mauricio Fern__ndez <batsman.geo@yahoo.com> wrote:

On Mon, Nov 22, 2004 at 10:55:35PM +0900, Masao Mutoh wrote:
> See http://ruby-gnome2.sourceforge.jp/hiki.cgi?Install+Guide+for+Windows
> You can install them just four steps, though it's not one click ;).
>
> > - Jamis
> >
> > P.S.: A plea to the ruby-gnome2 folks: a gemmable version would be a
> > real boon. A similar plea to the RPA folks... :wink:
>
> Good idea. Are there anyone to work for them ?

The RPA stuff is on the way (will take a while though).

Wow, Great ;).
Thanks in advance.

--
.:% Masao Mutoh<mutoh@highway.ne.jp>

My code is also in need of a good overhaul. It developed while learning how to use a Gtk::TreeView and reflection, so it is not structured very good. I'd love to merge it with Jamis solution, but I can't promise that I'll get time because I'm in the midst of my carreer-finals.

If you could point me to some description of how breakpoints works, I'll take a look next time I get too bored and want to waste some time :wink:

Regards,

Brian

···

On Wed, 24 Nov 2004 00:36:17 +0900 Jamis Buck <jgb3@email.byu.edu> wrote:

Florian Gross wrote:
> Jamis Buck wrote:
>
>> http://ruby.jamisbuck.org/objbrowser-03.png
>> This is the same, drilling down to inspect the constants defined in
>> the class of one of the instance variables.
>>
>> I think something like this (maybe used in conjunction with the
>> breakpoint and assert concepts that have been discussed on this list)
>> would be useful in debugging, especially if the ability to modify values
>> were added. I'm still hoping someone submits a nicer solution to the
>> quiz than mine, since mine is pretty rough, and is really only half
>> done. :slight_smile:
>
>
> I agree heavily. This looks very interesting. Would you be interested in
> patching this so it can work with Breakpoints? I can not do it myself
> unfortunately as GTK is completely screwed on this machine and I think I
> can only fix that by reinstalling Windows...
>
> The required changes would basically be using drb_gateway.evaluate(nil,
> "methods") instead of directly doing examined_obj.methods and so on.

I'd be happy to make that change, Florian, but I think it might be
better to combine my approach with Brian's. His is much prettier, for
one thing, but it also has the ability to navigate to specific instances
of a class, which is nice.

Unfortunately, I'm racing to get Net::SSH ready to release (I wanted to
do a release before Thanksgiving, but I'm not sure that'll happen). Then
I need to work on Net::SFTP... If no one has tackled this by the time
I'm done with SFTP, I'll take another look at it.

--
Brian Schröder
http://www.brian-schroeder.de/